示例#1
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var ignore = base.OnCreateView(inflater, container, savedInstanceState);

            var view = this.BindingInflate(FragmentId, null);

            _toolbar = view.FindViewById <Toolbar>(Resource.Id.toolbar);
            //_toolbar.SetTitleTextColor(Resource.Color.white);
            if (_toolbar != null)
            {
                ((MainActivity)Activity).SetSupportActionBar(_toolbar);
                ((MainActivity)Activity).SupportActionBar.SetDisplayHomeAsUpEnabled(true);

                _drawerToggle = new MvxActionBarDrawerToggle(
                    Activity,                                                   // host Activity
                    ((MainActivity)Activity).DrawerLayout,                      // DrawerLayout object
                    _toolbar,                                                   // nav drawer icon to replace 'Up' caret
                    Resource.String.drawer_open,                                // "open drawer" description
                    Resource.String.drawer_close                                // "close drawer" description
                    );
                _drawerToggle.DrawerOpened += (sender, e) => ((MainActivity)Activity).HideSoftKeyboard();
                ((MainActivity)Activity).DrawerLayout.SetDrawerListener(_drawerToggle);
            }
            _actionBar = ((MainActivity)Activity).SupportActionBar;
            _actionBar.SetCustomView(Resource.Layout.toolbar_search);
            _edtSearch = (AppCompatEditText)_actionBar.CustomView.FindViewById(Resource.Id.edtSearch);
            _edtSearch.AddTextChangedListener(this);

            Messenger = Mvx.Resolve <IMvxMessenger>();
            Messenger.Subscribe <ToastMessage>(DisplayToast);


            return(view);
        }
示例#2
0
        public static void AddTextChangedActions(this AppCompatEditText self,
                                                 Action <ICharSequence, int, int, int> beforeTextChangedHandler,
                                                 Action <IEditable> afterTextChangedHandler,
                                                 Action <ICharSequence, int, int, int> onTextChangedHandler)

        {
            self.AddTextChangedListener(new DelegateTextWatcher(
                                            beforeTextChangedHandler,
                                            afterTextChangedHandler,
                                            onTextChangedHandler));
        }