/// <summary>
        /// Called by the command handler to dismiss the dialog, and to close any open input service
        /// </summary>
        public override void Dismiss()
        {
            // If the media playback control is displayed the keyboard will remain visible, so explicitly get rid of it
            InputMethodManager.FromContext(Context)?.HideSoftInputFromWindow(playListName.WindowToken, HideSoftInputFlags.None);

            base.Dismiss();
        }
Exemple #2
0
        public void DismissKeyboard()
        {
            InputMethodManager imm = InputMethodManager.FromContext(CrossCurrentActivity.Current.Activity.ApplicationContext);

            imm.HideSoftInputFromWindow(
                CrossCurrentActivity.Current.Activity.Window.DecorView.WindowToken, HideSoftInputFlags.NotAlways);
        }
Exemple #3
0
        public void DismissKeyboard()
        {
            var inputMethodManager = InputMethodManager.FromContext(Android.App.Application.Context);

            inputMethodManager.HideSoftInputFromWindow(
                ((Activity)Xamarin.Forms.Forms.Context).Window.DecorView.WindowToken, HideSoftInputFlags.NotAlways);
        }
        /// <summary>
        /// Create the dialogue
        /// </summary>
        /// <param name="savedInstanceState"></param>
        /// <returns></returns>
        public override Dialog OnCreateDialog(Bundle savedInstanceState)
        {
            // Show a dialogue asking for a new playlist name. Don't install handlers for Ok/Cancel yet.
            // This prevents the default Dismiss action after the buttons are clicked
            View editView = LayoutInflater.From(Context).Inflate(Resource.Layout.new_library_dialogue_layout, null);

            libraryName = editView.FindViewById <EditText>(Resource.Id.libraryName);

            // If not restoring initialise the playlist name and the checkbox content
            if (savedInstanceState == null)
            {
                if (name.Length > 0)
                {
                    libraryName.Text = name;
                }
            }

            return(new AlertDialog.Builder(Context)
                   .SetTitle(title)
                   .SetView(editView)
                   .SetPositiveButton("Ok", (EventHandler <DialogClickEventArgs>)null)
                   .SetNegativeButton("Cancel", delegate {
                // If the media playback control is displayed the keyboard will remain visible, so explicitly get rid of it
                InputMethodManager.FromContext(Context)?.HideSoftInputFromWindow(libraryName.WindowToken, HideSoftInputFlags.None);
            })
                   .Create());;
        }
        public void DismissKeyboard()
        {
            var inputMethodManager = InputMethodManager.FromContext(CrossCurrentActivity.Current.Activity.ApplicationContext);

            // Говорим, что нормально открытая клавиатура будет закрыто "мягко"
            inputMethodManager.HideSoftInputFromWindow(CrossCurrentActivity.Current.Activity.Window.DecorView.WindowToken, HideSoftInputFlags.NotAlways);
        }
Exemple #6
0
        private void GoBack()
        {
            SupportActionBar.SetDisplayHomeAsUpEnabled(false);
            toolbar.Title = "Timesheet Tracker";
            bottomNavigation.Visibility = ViewStates.Visible;

            InputMethodManager imm = InputMethodManager.FromContext(this.ApplicationContext);

            imm.HideSoftInputFromInputMethod(this.Window.DecorView.WindowToken, HideSoftInputFlags.NotAlways);

            LoadFragment(_pastFragmentId);
        }
Exemple #7
0
        public static void HideInputKeyboard(this Activity activity)
        {
            var mgr   = InputMethodManager.FromContext(activity);
            var focus = activity.CurrentFocus;

            if (focus == null)
            {
                focus = new View(activity);
            }

            mgr.HideSoftInputFromWindow(focus.WindowToken, HideSoftInputFlags.None);
        }
Exemple #8
0
        public void HideKeyboard()
        {
            var inputMethodManager = InputMethodManager
                                     .FromContext(
                CrossCurrentActivity.Current.Activity.ApplicationContext
                );

            if (inputMethodManager != null)
            {
                inputMethodManager
                .HideSoftInputFromWindow(
                    CrossCurrentActivity.Current.Activity.Window.DecorView.WindowToken,
                    HideSoftInputFlags.None
                    );
            }
        }
Exemple #9
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.player_controls_demo);

            youTubePlayerView = FindViewById <YouTubePlayerView>(Resource.Id.youtube_view);
            stateText         = 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);
            eventLog          = FindViewById <TextView>(Resource.Id.event_log);

            styleRadioGroup = (RadioGroup)FindViewById(Resource.Id.style_radio_group);
            FindViewById <RadioButton>(Resource.Id.style_default).CheckedChange    += (sender, e) => player.SetPlayerStyle(YouTubePlayerPlayerStyle.Default);
            FindViewById <RadioButton>(Resource.Id.style_minimal).CheckedChange    += (sender, e) => player.SetPlayerStyle(YouTubePlayerPlayerStyle.Minimal);
            FindViewById <RadioButton>(Resource.Id.style_chromeless).CheckedChange += (sender, e) => player.SetPlayerStyle(YouTubePlayerPlayerStyle.Chromeless);
            logString = new StringBuilder();

            videoAdapter = new ArrayAdapter <ListEntry>(this, Android.Resource.Layout.SimpleSpinnerItem, Entries);
            videoAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            videoChooser.ItemSelected += (sender, e) =>
            {
                currentlySelectedPosition = e.Position;
                PlayVideoAtSelection();
            };
            videoChooser.Adapter = videoAdapter;

            playButton.Click    += (sender, e) => player.Play();
            pauseButton.Click   += (sender, e) => player.Pause();
            skipTo.EditorAction += (sender, e) =>
            {
                int skipToSecs = ParseInt(skipTo.Text, 0);
                player.SeekToMillis(skipToSecs * 1000);
                var imm = InputMethodManager.FromContext(this);
                imm.HideSoftInputFromWindow(skipTo.WindowToken, 0);
                e.Handled = true;
            };

            youTubePlayerView.Initialize(DeveloperKey.Key, this);

            SetControlsEnabled(false);
        }
Exemple #10
0
        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            MenuInflater.Inflate(Resource.Menu.toolbar_menu, menu);

            IMenuItem searchItem = menu.FindItem(Resource.Id.toolbar_menu_item_searchview);

            searchView = (SearchView)searchItem.ActionView;
            searchView.SubmitButtonEnabled = true;
            searchView.QueryTextSubmit    += async(o, e) =>
            {
                // clear focus close and keyboard
                View focusedView = CurrentFocus;

                if (focusedView != null)
                {
                    InputMethodManager.FromContext(this).HideSoftInputFromWindow(focusedView.WindowToken, HideSoftInputFlags.None);
                    focusedView.ClearFocus();
                }

                e.Handled = true;

                await newsFragment.Search(e.Query);
            };

            SearchViewActionExpandListener expandListener = new SearchViewActionExpandListener();

            expandListener.Collapse += async(o, e) =>
            {
                await newsFragment.Search("");
            };

            MenuItemCompat.SetOnActionExpandListener(searchItem, expandListener);


            return(base.OnCreateOptionsMenu(menu));
        }
Exemple #11
0
 public void ReInitializeInputMethod()
 {
     inputMethodManager = InputMethodManager.FromContext((Context)mainActivity);
 }