Ejemplo n.º 1
0
 private void ClearFocusFromAllEditTexts(EditText currentEditText = null)
 {
     _wrapperLayout.ClearFocus();
     if (currentEditText != null)
     {
         _inputMethodManager.HideSoftInputFromWindow(currentEditText.WindowToken,
                                                     HideSoftInputFlags.None);
     }
     else
     {
         _inputMethodManager.HideSoftInputFromWindow(_brightnessEditText.WindowToken,
                                                     HideSoftInputFlags.None);
         _inputMethodManager.HideSoftInputFromWindow(_startTimeHoursEditText.WindowToken,
                                                     HideSoftInputFlags.None);
         _inputMethodManager.HideSoftInputFromWindow(_startTimeMinutesEditText.WindowToken,
                                                     HideSoftInputFlags.None);
         _inputMethodManager.HideSoftInputFromWindow(_endTimeHoursEditText.WindowToken,
                                                     HideSoftInputFlags.None);
         _inputMethodManager.HideSoftInputFromWindow(_endTimeMinutesEditText.WindowToken,
                                                     HideSoftInputFlags.None);
         _inputMethodManager.HideSoftInputFromWindow(_daysSetEditText.WindowToken,
                                                     HideSoftInputFlags.None);
         _inputMethodManager.HideSoftInputFromWindow(_brightnessTimerEditText.WindowToken,
                                                     HideSoftInputFlags.None);
     }
     ValidateTimer();
 }
Ejemplo n.º 2
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            mContainer = container;
            string dbPath_attributes = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "attributes.db3");
            var    db_attributes     = new SQLiteConnection(dbPath_attributes);

            myAttributes = db_attributes.Get <MyAttributes>(1);
            int myCFID = myAttributes.cfid;

            if (myCFID == 0) // If not registered for a career fair
            {
                View view = inflater.Inflate(Resource.Layout.GoToRegister, container, false);
                return(view);
            }

            else
            {
                if (myAttributes.type == "Student")
                {
                    // Inflate View
                    View view = inflater.Inflate(Resource.Layout.HomeTab, container, false);

                    // Call UI Elements
                    mListView      = view.FindViewById <ListView>(Resource.Id.listView1);
                    cfName         = view.FindViewById <TextView>(Resource.Id.cfName);
                    progressBar    = view.FindViewById <ProgressBar>(Resource.Id.circularProgress);
                    magGlass       = view.FindViewById <ImageView>(Resource.Id.magGlass);
                    mSearchField   = view.FindViewById <EditText>(Resource.Id.searchCompanies);
                    rootLayout     = view.FindViewById <LinearLayout>(Resource.Id.rootLayout);
                    swipeContainer = view.FindViewById <SwipeRefreshLayout>(Resource.Id.swipeLayout);

                    magGlass.Enabled = false;

                    mItems = new List <string>();

#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
                    LoadCF(true);
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed

                    bool searchFieldVisible = false;
                    magGlass.Click += (sender, e) =>
                    {
                        if (searchFieldVisible == false)
                        {
                            mSearchField.Visibility = ViewStates.Visible;
                            cfName.Visibility       = ViewStates.Invisible;
                            searchFieldVisible      = true;
                            rootLayout.ClearFocus();
                            mSearchField.RequestFocus();
                            InputMethodManager imm = (InputMethodManager)this.Activity.GetSystemService(Context.InputMethodService);
                            imm.ShowSoftInput(mSearchField, 0);
                        }
                        else if (searchFieldVisible == true)
                        {
                            InputMethodManager imm = (InputMethodManager)this.Activity.GetSystemService(Context.InputMethodService);
                            imm.HideSoftInputFromWindow(mSearchField.WindowToken, 0);
                            rootLayout.RequestFocus();
                            mSearchField.Visibility = ViewStates.Invisible;
                            mSearchField.RequestFocus();
                            cfName.Visibility  = ViewStates.Visible;
                            searchFieldVisible = false;
                            mAdapter           = new CompaniesListViewAdapter(mContainer.Context, mItems, mFavList, mWaitTimes, mNumStudents, mCompanyIds);
                            mListView.Adapter  = mAdapter;
                        }
                    };

                    mSearchField.TextChanged += MSearchField_TextChanged;
                    swipeContainer.SetColorSchemeResources(Android.Resource.Color.HoloBlueLight, Android.Resource.Color.HoloGreenLight,
                                                           Android.Resource.Color.HoloOrangeLight, Android.Resource.Color.HoloRedLight);
                    swipeContainer.Refresh += RefreshOnSwipe;

                    return(view);
                }
                else if (myAttributes.type == "Recruiter")
                {
                    View view = inflater.Inflate(Resource.Layout.RecruiterHomeTab, container, false);

                    progressBar = view.FindViewById <ProgressBar>(Resource.Id.circularProgress);

                    HMAllRadio    = view.FindViewById <Button>(Resource.Id.HMAllRadio);
                    HGTAllRadio   = view.FindViewById <Button>(Resource.Id.HGTAllRadio);
                    HGPANoneRadio = view.FindViewById <Button>(Resource.Id.HGPANoneRadio);
                    plus_major    = view.FindViewById <Button>(Resource.Id.plus_majors);
                    hmspinner1    = view.FindViewById <Spinner>(Resource.Id.hmspinner1);
                    hmspinner2    = view.FindViewById <Spinner>(Resource.Id.hmspinner2);
                    hmspinner3    = view.FindViewById <Spinner>(Resource.Id.hmspinner3);
                    hmspinner4    = view.FindViewById <Spinner>(Resource.Id.hmspinner4);
                    hmspinner5    = view.FindViewById <Spinner>(Resource.Id.hmspinner5);
                    minus_major   = view.FindViewById <Button>(Resource.Id.minus_majors);

                    hgtspinner1 = view.FindViewById <Spinner>(Resource.Id.hgtspinner1);
                    hgtspinner2 = view.FindViewById <Spinner>(Resource.Id.hgtspinner2);
                    hgtspinner3 = view.FindViewById <Spinner>(Resource.Id.hgtspinner3);
                    plus_gt     = view.FindViewById <Button>(Resource.Id.plus_gt);
                    minus_gt    = view.FindViewById <Button>(Resource.Id.minus_gradterms);

                    minGPAspinner = view.FindViewById <Spinner>(Resource.Id.minGPAspinner);

                    Button saveChanges = view.FindViewById <Button>(Resource.Id.saveChangesButton);
                    cfName = view.FindViewById <TextView>(Resource.Id.cfName);
                    TextView             HMAllText      = view.FindViewById <TextView>(Resource.Id.HMAllText);
                    TextView             HGTAllText     = view.FindViewById <TextView>(Resource.Id.HGTAllText);
                    TextView             MinGPANoneText = view.FindViewById <TextView>(Resource.Id.MinGPANoneText);
                    Android.Widget.Space plus1extender  = view.FindViewById <Android.Widget.Space>(Resource.Id.plusspace1);
                    Android.Widget.Space plus2extender  = view.FindViewById <Android.Widget.Space>(Resource.Id.plusspace2);

                    // Change name to my CF name
                    PopulateName();

                    // Click methods
                    HMAllRadio.Click     += HMAllRadio_Click;
                    HMAllText.Click      += HMAllRadio_Click;
                    HGTAllRadio.Click    += HGTAllRadio_Click;
                    HGTAllText.Click     += HGTAllRadio_Click;
                    HGPANoneRadio.Click  += HGPANoneRadio_Click;
                    MinGPANoneText.Click += HGPANoneRadio_Click;
                    saveChanges.Click    += SaveChanges_Click;

                    // connect to firebase preferences database
                    PopulatePreferences();

                    // On plus major click
                    plus_major.Click    += Plus_major_Click;
                    plus1extender.Click += Plus_major_Click;

                    // On plus gt click
                    plus_gt.Click       += Plus_gt_Click;
                    plus2extender.Click += Plus_gt_Click;

                    // on minus major click
                    minus_major.Click += (sender, e) =>
                    {
                        numMPs = numMPs - 1;
                        if (numMPs == 1)
                        {
                            hmspinner2.Visibility  = ViewStates.Gone;
                            minus_major.Visibility = ViewStates.Gone;
                        }
                        else if (numMPs == 2)
                        {
                            hmspinner3.Visibility = ViewStates.Gone;
                        }
                        else if (numMPs == 3)
                        {
                            hmspinner4.Visibility = ViewStates.Gone;
                        }
                        else if (numMPs == 4)
                        {
                            hmspinner5.Visibility = ViewStates.Gone;
                        }
                    };
                    // on minus grad term click
                    minus_gt.Click += (sender, e) =>
                    {
                        numGTPs = numGTPs - 1;
                        if (numGTPs == 1)
                        {
                            hgtspinner2.Visibility = ViewStates.Gone;
                            minus_gt.Visibility    = ViewStates.Gone;
                        }
                        else if (numGTPs == 2)
                        {
                            hgtspinner3.Visibility = ViewStates.Gone;
                        }
                    };

                    return(view);
                }
                else
                {
                    throw new NotImplementedException();
                }
            }
        }