Exemplo n.º 1
0
        public void OnGlobalLayout()
        {
            try
            {
                var currentActivity = MainActivity.Instance;

                if (_inputManager is null || _inputManager.Handle == IntPtr.Zero)
                {
                    _inputManager = (InputMethodManager)currentActivity.GetSystemService(Context.InputMethodService);
                }

                // Set visibility to false when focus on background view.
                var currentFocus = currentActivity.CurrentFocus;

                if (currentFocus.AccessibilityClassName == "android.view.ViewGroup")
                {
                    SoftKeyboard.Current.InvokeVisibilityChanged(false);
                    _wasAcceptingText = _inputManager.IsAcceptingText;
                    return;
                }

                EditText editText;

                if (currentFocus is TextInputLayout inputLayout)
                {
                    editText = inputLayout.EditText;
                }
                else if (currentFocus is EditText text)
                {
                    editText = text;
                }
                else
                {
                    return;
                }

                if (!editText.ShowSoftInputOnFocus)
                {
                    _inputManager?.HideSoftInputFromWindow(currentFocus.WindowToken, HideSoftInputFlags.None);
                }

                if (_wasAcceptingText == _inputManager?.IsAcceptingText)
                {
                    // Fixed entry get focused by code pop up keyboard
                    if (!editText.ShowSoftInputOnFocus)
                    {
                        SoftKeyboard.Current.InvokeVisibilityChanged(false);
                    }
                    return;
                }

                SoftKeyboard.Current.InvokeVisibilityChanged(_inputManager.IsAcceptingText);
                _wasAcceptingText = _inputManager.IsAcceptingText;
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex);
            }
        }
Exemplo n.º 2
0
 public void Deactivate()
 {
     activity.RunOnUiThread(() =>
     {
         inputMethodManager?.HideSoftInputFromWindow(view.WindowToken, HideSoftInputFlags.None);
         view.ClearFocus();
         view.KeyDown    -= keyDown;
         view.CommitText -= commitText;
     });
 }
        protected override void DeactivateTextInput()
        {
            view.KeyDown    -= keyDown;
            view.CommitText -= commitText;

            view.Activity.RunOnUiThread(() =>
            {
                inputMethodManager?.HideSoftInputFromWindow(view.WindowToken, HideSoftInputFlags.None);
                view.ClearFocus();
            });
        }
Exemplo n.º 4
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.PlayerControls);

            youTubePlayerView = FindViewById <YouTubePlayerView>(Resource.Id.youtube_view);
            StateTextView     = FindViewById <TextView> (Resource.Id.state_text);
            videoChooser      = FindViewById <Spinner>(Resource.Id.video_chooser);
            playButton        = FindViewById <Button>(Resource.Id.play_button);
            pauseButton       = FindViewById <Button>(Resource.Id.pause_button);
            skipTo            = FindViewById <EditText>(Resource.Id.skip_to_text);
            EventLogTextView  = FindViewById <TextView>(Resource.Id.event_log);

            styleRadioGroup = FindViewById <RadioGroup>(Resource.Id.style_radio_group);
            (FindViewById <RadioButton> (Resource.Id.style_default)).CheckedChange   += HandleCheckedChange;
            (FindViewById <RadioButton>(Resource.Id.style_minimal)).CheckedChange    += HandleCheckedChange;
            (FindViewById <RadioButton>(Resource.Id.style_chromeless)).CheckedChange += HandleCheckedChange;

            // Initialize PlayerHelper - Used by Listeners
            LogString = new StringBuilder();


            videoAdapter = new ArrayAdapter <ListEntry>(this, Android.Resource.Layout.SimpleSpinnerItem, entries);
            videoAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            videoChooser.Adapter = videoAdapter;

            videoChooser.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => {
                currentlySelectedPosition = e.Position;
                PlayVideoAtSelection();
            };

            playButton.Click    += (sender, e) => Player.Play();
            pauseButton.Click   += (sender, e) => Player.Pause();
            skipTo.EditorAction += (sender, e) => {
                int skipToSecs;
                int.TryParse(skipTo.Text, out skipToSecs);
                Player.SeekToMillis(skipToSecs * 1000);
                InputMethodManager imm = (InputMethodManager)GetSystemService(Context.InputMethodService);
                imm.HideSoftInputFromWindow(skipTo.WindowToken, 0);
            };

            youTubePlayerView.Initialize(DeveloperKey.Key, this);

            playlistEventListener     = new MyPlaylistEventListener();
            playerStateChangeListener = new MyPlayerStateChangeListener();
            playbackEventListener     = new MyPlaybackEventListener();

            SetControlsEnabled(false);
        }
        private void TxtSodawnyachiTarikh_Click(object sender, EventArgs e)
        {
            InputMethodManager inputManager = (InputMethodManager)this.GetSystemService(Context.InputMethodService);

            inputManager.HideSoftInputFromWindow(this.CurrentFocus.WindowToken, HideSoftInputFlags.NotAlways);


            DatePickerFragment frag = DatePickerFragment.NewInstance(delegate(DateTime time)
            {
                txtSodawnyachiTarikh.Text = time.ToString("dd-MM-yyyy");
            });

            frag.Show(FragmentManager, DatePickerFragment.TAG);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Hide key board when refresh layout.
        /// </summary>
        /// <param name="activity"></param>
        public static void HideKeyboard(Activity activity)
        {
            InputMethodManager imm = (InputMethodManager)activity.GetSystemService(Activity.InputMethodService);
            ////Find the currently focused view, so we can grab the correct window token from it.
            View view = activity.CurrentFocus;

            ////If no view currently has focus, create a new one, just so we can grab a window token from it
            if (view == null)
            {
                view = new View(activity);
            }

            imm.HideSoftInputFromWindow(view.WindowToken, 0);
        }
Exemplo n.º 7
0
        async void SettingsDone_Click(object sender, EventArgs e)
        {
            settingsHolder.Visibility = ViewStates.Gone;
            await ServiceLayer.SharedInstance.SaveSettings();

            UpdateMapPokemon(true);
            UpdateMapRaids(true);
            InputMethodManager inputManager = (InputMethodManager)this.GetSystemService(Context.InputMethodService);

            if (this.CurrentFocus != null)
            {
                inputManager.HideSoftInputFromWindow(this.CurrentFocus.WindowToken, HideSoftInputFlags.NotAlways);
            }
        }
Exemplo n.º 8
0
        void GoButton_OnClick(object sender, EventArgs e)
        {
            if (FindViewById <EditText>(Resource.Id.et_remarks).Text != _gpsCoordinates[_idx].Remarks)
            {
                SaveData(_idx, FindViewById <EditText>(Resource.Id.et_remarks).Text);
            }

            int idx = -1;

            for (int i = 0; i < _gpsCoordinates.Count; i++)
            {
                if (FindViewById <EditText>(Resource.Id.et_tph).Text == _gpsCoordinates[i].TPH)
                {
                    idx = i;
                }
            }

            if (idx != -1)
            {
                _idx = idx;
                ShowData(_idx);
            }
            else
            {
                AlertDialog.Builder alert = new AlertDialog.Builder(this);
                alert.SetTitle("Error");
                alert.SetMessage("TPH is not found");
                alert.SetPositiveButton("OK", (senderAlert, args) =>
                {
                    FindViewById <EditText>(Resource.Id.et_tph).Text = _gpsCoordinates[_idx].TPH;

                    try
                    {
                        InputMethodManager inputManager = (InputMethodManager)this.GetSystemService(Context.InputMethodService);
                        var currentFocus = this.CurrentFocus;
                        if (currentFocus != null)
                        {
                            inputManager.HideSoftInputFromWindow(currentFocus.WindowToken, HideSoftInputFlags.None);
                        }
                    }
                    catch { }
                });

                RunOnUiThread(() =>
                {
                    alert.Show();
                });
            }
        }
Exemplo n.º 9
0
            public override void ResignFirstResponder( )
            {
                // only allow this text edit to hide the keyboard if it's the text field with focus.
                Activity activity = ( Activity )Rock.Mobile.PlatformSpecific.Android.Core.Context;

                if (activity.CurrentFocus != null && (activity.CurrentFocus as EditText) == TextField)
                {
                    InputMethodManager imm = ( InputMethodManager )Rock.Mobile.PlatformSpecific.Android.Core.Context.GetSystemService(Android.Content.Context.InputMethodService);

                    imm.HideSoftInputFromWindow(TextField.WindowToken, 0);

                    // yeild focus to the dummy view so the text field clears it's caret and the selected outline
                    TextField.ClearFocus( );
                }
            }
 public void HideKeyboard()
 {
     try
     {
         var movieTitleEditText = rootView.FindViewById <EditText>(Resource.Id.movieTitleEditText);
         // Create a manager that handles system services
         this.manager = (InputMethodManager)this.Context.GetSystemService(Context.InputMethodService);
         // Hide keyboard
         manager.HideSoftInputFromWindow(movieTitleEditText.WindowToken, 0);
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
Exemplo n.º 11
0
 //печать времени в Label
 private void print()
 {
     if (FindViewById <EditText>(Resource.Id.editText1).Text == "" || FindViewById <EditText>(Resource.Id.editText).Text == "" || FindViewById <EditText>(Resource.Id.editText3).Text == "")
     {
         Toast.MakeText(this, "Заполните все поля", ToastLength.Short).Show();
     }
     else
     {
         time.Set_time(int.Parse(FindViewById <EditText>(Resource.Id.editText1).Text), int.Parse(FindViewById <EditText>(Resource.Id.editText).Text), int.Parse(FindViewById <EditText>(Resource.Id.editText3).Text));
         txt.Text = time.To_Str();
         EditText           keyboard = FindViewById <EditText>(Resource.Id.editText3);
         InputMethodManager imm      = (InputMethodManager)GetSystemService(Android.Content.Context.InputMethodService);
         imm.HideSoftInputFromWindow(keyboard.WindowToken, 0);
     }
 }
Exemplo n.º 12
0
        public void OnClick(View v)
        {
            switch (v.Id)
            {
            case Resource.Id.btnComment:
                PostComment();
                break;

            default:
                InputMethodManager imm = (InputMethodManager)GetSystemService(Context.InputMethodService);
                imm.HideSoftInputFromWindow(txtContent.WindowToken, 0);
                ActivityCompat.FinishAfterTransition(this);
                break;
            }
        }
Exemplo n.º 13
0
        protected void CheckFocus()
        {
            EditText loanInput = FindViewById <EditText>(Resource.Id.loanAddInput);

            if (loanInput.IsFocused)
            {
                LoadInputValue(loanInput);

                InputMethodManager imm = (InputMethodManager)GetSystemService(Context.InputMethodService);
                imm.HideSoftInputFromWindow(loanInput.WindowToken, 0);

                LinearLayout loanAddLayout = FindViewById <LinearLayout>(Resource.Id.addLoanLayout);
                loanAddLayout.RequestFocus();
            }
        }
Exemplo n.º 14
0
        protected void HideSoftKeyboard()
        {
            var currentFocus = Activity.CurrentFocus;

            if (currentFocus == null)
            {
                return;
            }

            InputMethodManager inputMethodManager = (InputMethodManager)Activity.GetSystemService(Android.Content.Context.InputMethodService);

            inputMethodManager.HideSoftInputFromWindow(currentFocus.WindowToken, 0);

            currentFocus.ClearFocus();
        }
        public void SetClient(ITextInputMethodClient client)
        {
            var active = client is { };

            if (active)
            {
                _host.RequestFocus();
                Reset();
                _imm.ShowSoftInput(_host, ShowFlags.Implicit);
            }
            else
            {
                _imm.HideSoftInputFromWindow(_host.WindowToken, HideSoftInputFlags.None);
            }
        }
Exemplo n.º 16
0
        private void setupViewPager()
        {
            mainPagerAdapter = new MainPagerAdapter(ChildFragmentManager);
            int current  = 0;
            var fragment = new ReportFragment();

            mainPagerAdapter.addFragment(fragment, AppResources.Report);
            viewPager.Adapter = mainPagerAdapter;
            tabLayout.SetupWithViewPager(viewPager);
            tabLayout.TabMode = TabLayout.ModeScrollable;
            viewPager.SetCurrentItem(current, false);
            InputMethodManager imm = (InputMethodManager)Activity.GetSystemService(Context.InputMethodService);

            imm.HideSoftInputFromWindow(viewPager.WindowToken, 0);
        }
Exemplo n.º 17
0
        private async void BtnLogin_Click(object sender, EventArgs e)
        {
            var txtUsuario = (FindViewById <EditText>(Resource.Id.txtUsuario));
            var txtSenha   = (FindViewById <EditText>(Resource.Id.txtPassword));
            var mensagem   = Resource.String.LoadingTitulo.ToString();

            await Task.Run(async() =>
            {
                if (UtilAcessibilidade.VerificaAcessoInternet(this))
                {
                    if (!string.IsNullOrEmpty(txtUsuario.Text) && !string.IsNullOrEmpty(txtSenha.Text))
                    {
                        ProgressDialog loading = null;

                        RunOnUiThread(() =>
                        {
                            loading = ProgressDialog.Show(this, "Entrando", "Isso pode demorar um pouco.\nFavor aguardar!", true);
                        });

                        var entrada = new AutenticacaoEntradaDTO()
                        {
                            Usuario = txtUsuario.Text.Trim(), Senha = txtSenha.Text
                        };
                        var saida = await WebService.PostAsync <AutenticacaoEntradaDTO, AutenticacaoSaidaDTO>(entrada, CaminhoWebService.AUTENTICACAO);

                        if (loading.IsShowing && loading != null)
                        {
                            loading.Dismiss();
                        }

                        VerificaLogin(saida.Token);
                    }
                    else
                    {
                        Modal.ExibirModal(this, "Email ou senha em branco", "", "Gentileza informar os campos E-mail e Senha");
                    }
                }
                else
                {
                    Modal.ExibirModal(this, GetString(Resource.String.ConexaoInternetTitulo), "", GetString(Resource.String.ConexaoInternetMensagem));
                }
            });

            //Esconder o teclado antes de passar para próxima Activity
            InputMethodManager im = (InputMethodManager)this.GetSystemService(Context.InputMethodService);

            im.HideSoftInputFromWindow(Window.DecorView.WindowToken, HideSoftInputFlags.NotAlways);
        }
Exemplo n.º 18
0
        void initControls()
        {
            user = new User();
            img  = FindViewById <ImageView>(Resource.Id.accountCover);

            img.SetImageBitmap(GlobalHelper.GetImageBitmapFromUrl(GlobalMemory.serverAddressIP + GlobalMemory._user.CoverLink));

            imgButton        = FindViewById <Button>(Resource.Id.accountCoverButton);
            imgButton.Click += ImgButton_Click;

            updateButton        = FindViewById <Button>(Resource.Id.accountUpdateButton);
            updateButton.Click += UpdateButton_Click;

            updateValidity        = FindViewById <Button>(Resource.Id.extendValidityButton);
            updateValidity.Click += UpdateValidity_Click;

            deleteAccount        = FindViewById <Button>(Resource.Id.deleteAccount);
            deleteAccount.Click += DeleteAccount_Click;

            login       = FindViewById <TextView>(Resource.Id.loginTextView);
            login.Text += GlobalMemory._user.Login;

            email      = FindViewById <EditText>(Resource.Id.accountEmail);
            email.Text = GlobalMemory._user.Email.Trim();
            validity   = FindViewById <TextView>(Resource.Id.validityText);

            progressBar            = FindViewById <ProgressBar>(Resource.Id.accountProgressBar);
            progressBar.Visibility = ViewStates.Invisible;

            if (GlobalMemory._user.Access)
            {
                validity.Text += GlobalMemory._user.Validity.Day + "." + GlobalMemory._user.Validity.Month + "." + GlobalMemory._user.Validity.Year;
            }
            else
            {
                validity.Text = "Brak dostepu";
            }

            scrollView = FindViewById <ScrollView>(Resource.Id.AccountScrollView);
            LL         = FindViewById <LinearLayout>(Resource.Id.AccountLayout);
            LL.Touch  += LL_Touch;

            ActionBar.SetHomeButtonEnabled(true);
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            InputMethodManager imm = (InputMethodManager)GetSystemService(Context.InputMethodService);

            imm.HideSoftInputFromWindow(email.WindowToken, 0);
        }
Exemplo n.º 19
0
        void BtnSignUp_Click(object sender, EventArgs e)
        {
            InputMethodManager inputManager = (InputMethodManager)this.Activity.GetSystemService(Context.InputMethodService);

            inputManager.HideSoftInputFromWindow(this.Activity.CurrentFocus.WindowToken, HideSoftInputFlags.NotAlways);

            if (DataController.RegisterDataSubmition(_txtName.Text, _txtPassword.Text, _txtEmail.Text, _txtPhoneNumber.Text))
            {
                this.Activity.RunOnUiThread(() => Toast.MakeText(this.Activity.ApplicationContext, "Registration successful!", ToastLength.Long).Show());
                this.Dismiss();
            }
            else
            {
                this.Activity.RunOnUiThread(() => Toast.MakeText(this.Activity.ApplicationContext, "Invalid registration input", ToastLength.Long).Show());
            }
        }
Exemplo n.º 20
0
        // Click listener for autocomplete suggestions - extracts selected stop data
        private void stopInputItemClick(object sender, AdapterView.ItemClickEventArgs e)
        {
            // Get selected stop details
            currentStopName = (string)e.Parent.GetItemAtPosition(e.Position);
            currentStopId   = e.Parent.GetItemIdAtPosition(e.Position);

            inputStopName.Text = currentStopName;

            // Hide keyboard
            InputMethodManager imm = (InputMethodManager)GetSystemService(Context.InputMethodService);

            imm.HideSoftInputFromWindow(inputStopName.WindowToken, 0);

            // Search for lines
            getLines();
        }
Exemplo n.º 21
0
            protected void CloseSoftInput()
            {
                View currentView = this.CurrentFocus;

                if (currentView == null)
                {
                    return;
                }

                InputMethodManager inputManager =
                    (InputMethodManager)GetSystemService(InputMethodService);

                inputManager.HideSoftInputFromWindow(
                    currentView.WindowToken,
                    HideSoftInputFlags.NotAlways);
            }
Exemplo n.º 22
0
        private void VehicleNumber_ItemClick(object sender, AdapterView.ItemClickEventArgs e)
        {
            if (VehicleList != null && !fuelTypeSpinner.SelectedItem.Equals(ConstantValues.SHORTAGE))
            {
                var vehicleTypes = VehicleList.Where(q => q.RegNo == vehicleNumber.Text).Select(t => t.TypeName);
                vehicleTypeAdapter =
                    new ArrayAdapter(this, Resource.Layout.select_dialog_item_material, vehicleTypes.ToArray());
                //new string[] { "Select", "Line Vehicle", "InterCard", "Loader", "Genset 1", "Genset 2", "Genset 3" });
                //vehicleTypeSpinner.PerformClick();
                vehicleTypeSpinner.Adapter   = vehicleTypeAdapter;
                isVehicleTypeSpinnerSelected = false;

                InputMethodManager inputManager = (InputMethodManager)GetSystemService(InputMethodService);
                inputManager.HideSoftInputFromWindow(Window.CurrentFocus.WindowToken, HideSoftInputFlags.NotAlways);
            }
        }
Exemplo n.º 23
0
 public void Show(bool show)
 {
     if (show)
     {
         gameView.Focusable            = true;
         gameView.FocusableInTouchMode = true;
         gameView.RequestFocus();
         imm.ShowSoftInput(gameView, ShowFlags.Forced);
     }
     else
     {
         gameView.Focusable            = false;
         gameView.FocusableInTouchMode = false;
         imm.HideSoftInputFromWindow(gameView.WindowToken, 0);
     }
 }
 /// <summary>
 /// <description>Function is used for dismiss keyboard</description>
 /// </summary>
 /// <param name="ev"></param>
 /// <returns></returns>
 public override bool DispatchTouchEvent(MotionEvent ev)
 {
     try
     {
         if (this.CurrentFocus != null)
         {
             InputMethodManager imm = (InputMethodManager)GetSystemService(InputMethodService);
             imm.HideSoftInputFromWindow(CurrentFocus.WindowToken, 0);
         }
     }
     catch (Exception ex)
     {
         Toast.MakeText(this, GetString(Resource.String.somthing_wrong), ToastLength.Short).Show();
     }
     return(base.DispatchTouchEvent(ev));
 }
Exemplo n.º 25
0
        private async void Signin_Click(object sender, EventArgs e)
        {
            InputMethodManager inputManager = (InputMethodManager)GetSystemService(InputMethodService);

            inputManager.HideSoftInputFromWindow(CurrentFocus.WindowToken, 0);
            string phonenum = mobile.Text;
            string pass     = password.Text;

            if (pass.Length > 5)
            {
                if (phonenum.Length == 10)
                {
                    mLoadingDialog.Show();
                    CabsAPI        api      = new CabsAPI();
                    SignInResponse response = await api.LoginUser(phonenum, pass);

                    if (response.Code == ResponseCode.SUCCESS)
                    {
                        mLoadingDialog.Dismiss();
                        mEditor.PutString("email", response.Data.Email);
                        mEditor.PutString("mobile", response.Data.Mobile);
                        mEditor.PutString("name", response.Data.Name);
                        mEditor.PutString("token", response.Token);
                        mEditor.PutBoolean("isLoggedIn", true);
                        mEditor.Apply();
                        StartActivity(new Intent(this, typeof(GettingStartedActivity)));
                        Finish();
                    }
                    else
                    {
                        mLoadingDialog.Dismiss();
                        Toast.MakeText(this, "Incorrect Credentials", ToastLength.Short).Show();
                        return;
                    }
                }
                else
                {
                    Toast.MakeText(this, "Phone number must be of 10 digits", ToastLength.Short).Show();
                    return;
                }
            }
            else
            {
                Toast.MakeText(this, "Password must have atleast 6 digits", ToastLength.Short).Show();
                return;
            }
        }
Exemplo n.º 26
0
        private void mEncryptBtn_Click(object sender, EventArgs e)
        {
            #region FirstEncryption

            /*
             * SymmetricAlgorithm control;
             *
             * control = new AesManaged();
             *
             * control.Key = UTF8Encoding.UTF8.GetBytes(mKey.Text);
             * control.Padding = PaddingMode.PKCS7;
             * control.Mode = CipherMode.ECB;
             *
             * ICryptoTransform transform = null;
             *
             * byte[] resultArray;
             *
             * //if(Crypt.ENCRYPT)
             * transform = control.CreateEncryptor();
             *
             * //Else Decryptor
             * //control.createDecryptor();
             *
             * if(mOriginalTxt.Text is string)
             * {
             *  byte[] inputArray = UTF8Encoding.UTF8.GetBytes(mOriginalTxt.Text);
             *  resultArray = transform.TransformFinalBlock(inputArray, 0, inputArray.Length);
             *  control.Clear();
             *  String str = UTF8Encoding.UTF8.GetString(resultArray, 0, resultArray.Length);
             *  mEncryptedTxt.Text = str;
             * }
             */
            #endregion

            string encryptedTxt = SymmetricCrypt.Encrypt(mOriginalTxt.Text, mKey.Text);
            mEncryptedTxt.Text = encryptedTxt;
            keychain.SaveKey(mKey.Text);

            mKey.ClearFocus();
            mOriginalTxt.ClearFocus();
            InputMethodManager imm = (InputMethodManager)GetSystemService(Context.InputMethodService);
            imm.HideSoftInputFromWindow(mKey.WindowToken, 0);

            //RegistryKey rKey = Registry.CurrentUser.OpenSubKey("Encryptor");

            //string Getpass = Convert.ToString(rKey.GetValue("Password"));
        }
 private void init()
 {
     SetOnTouchListener(this);
     FocusChange += (o, e) =>
     {
         if (e.HasFocus)
         {
             InputMethodManager imm = (InputMethodManager)Context.GetSystemService(Context.InputMethodService);
             imm.HideSoftInputFromWindow(WindowToken, 0);
             FocusableInTouchMode = false;
             Focusable            = false;
             FocusableInTouchMode = true;
             Focusable            = true;
             ShowDialog();
         }
     };
 }
Exemplo n.º 28
0
        public void OnClick(IDialogInterface dialog, int which)
        {
            var resGoalTime = GoalTimeDao.GetGoalTime();

            if (resGoalTime == null)
            {
                return;
            }
            switch (resGoalTime.Name)
            {
            case "Year":
                InputMethodManager imm = (InputMethodManager)Singleton.Instance.GoalActivity.GetSystemService(Context.InputMethodService);
                imm.HideSoftInputFromWindow(Singleton.Instance.AddGoalView.WindowToken, HideSoftInputFlags.None);

                GoalDao.Insert(Singleton.Instance.AddGoalEditText.Text);
                //GoalUtils.GetGoal();
                dialog.Dismiss();
                break;

            case "Month":
                foreach (var item in Singleton.Instance.GoalCheckBoxs)
                {
                    CheckBox chk = item.CheckBox;
                    if (chk.Checked)
                    {
                        GoalOfMonthDao.Insert(item.IDGoal, Singleton.Instance.IDMonth);
                    }
                }
                //GoalUtils.GetGoal();
                dialog.Dismiss();
                break;

            case "Day":
                foreach (var item in Singleton.Instance.GoalCheckBoxs)
                {
                    CheckBox chk = item.CheckBox;
                    if (chk.Checked)
                    {
                        GoalOfDayDao.Insert(item.IDGoal, Singleton.Instance.IDDay);
                    }
                }
                //GoalUtils.GetGoal();
                dialog.Dismiss();
                break;
            }
        }
        private void TabBarAnimation(int position)
        {
            if (this.CurrentFocus != null && this.CurrentFocus.WindowToken != null)
            {
                InputMethodManager imm = (InputMethodManager)GetSystemService(Context.InputMethodService);
                imm.HideSoftInputFromWindow(this.CurrentFocus.WindowToken, HideSoftInputFlags.NotAlways);
            }

            imgTabIconDashboard.SetImageResource(GetImageByTheme(FN_ICON_TAB_DASHBOARD_INACTIVE));
            imgTabIconCamera.SetImageResource(GetImageByTheme(FN_ICON_TAB_CAMERA_INACTIVE));
            imgTabIconSettings.SetImageResource(GetImageByTheme(FN_ICON_TAB_SETTINGS_INACTIVE));
            imgTabIconHelp.SetImageResource(GetImageByTheme(FN_ICON_TAB_HELP_INACTIVE));

            imgTabBottomDashboard.Visibility = ViewStates.Gone;
            imgTabBottomCamera.Visibility    = ViewStates.Gone;
            imgTabBottomSettings.Visibility  = ViewStates.Gone;
            imgTabBottomHelp.Visibility      = ViewStates.Gone;

            viewBGTabDashboard.SetBackgroundColor(Color.Transparent);
            viewBGTabCamera.SetBackgroundColor(Color.Transparent);
            viewBGTabSettings.SetBackgroundColor(Color.Transparent);
            viewBGTabHelp.SetBackgroundColor(Color.Transparent);

            switch (position)
            {
            case 0:
                imgTabIconDashboard.SetImageResource(GetImageByTheme(FN_ICON_TAB_DASHBOARD_ACTIVE));
                SetActiveTab(imgTabBottomDashboard, viewBGTabDashboard);
                break;

            case 1:
                imgTabIconCamera.SetImageResource(GetImageByTheme(FN_ICON_TAB_CAMERA_ACTIVE));
                SetActiveTab(imgTabBottomCamera, viewBGTabCamera);
                break;

            case 2:
                imgTabIconSettings.SetImageResource(GetImageByTheme(FN_ICON_TAB_SETTINGS_ACTIVE));
                SetActiveTab(imgTabBottomSettings, viewBGTabSettings);
                break;

            case 3:
                imgTabIconHelp.SetImageResource(GetImageByTheme(FN_ICON_TAB_HELP_ACTIVE));
                SetActiveTab(imgTabBottomHelp, viewBGTabHelp);
                break;
            }
        }
Exemplo n.º 30
0
        private void ClearFocus()
        {
            if (editTextA.IsFocused || editTextB.IsFocused || editTextC.IsFocused)
            {
                editTextA.ClearFocus();
                editTextB.ClearFocus();
                editTextC.ClearFocus();
            }

            Activity           activity           = (Activity)context;
            InputMethodManager inputMethodManager = (InputMethodManager)activity.GetSystemService(Activity.InputMethodService);

            if (activity.CurrentFocus != null)
            {
                inputMethodManager.HideSoftInputFromWindow(activity.CurrentFocus.WindowToken, 0);
            }
        }