Exemplo n.º 1
0
 private void setupSearchView()
 {
     mySearchView.SetIconifiedByDefault(false);
     mySearchView.SetOnQueryTextListener(this);
     mySearchView.SubmitButtonEnabled = true;
     mySearchView.SetQueryHint("Search");
 }
Exemplo n.º 2
0
        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            MenuInflater.Inflate(Resource.Menu.main_menu, menu);

            var item = menu.FindItem(Resource.Id.action_search);

            _searchView = item.ActionView as Android.Support.V7.Widget.SearchView;
            _searchView.SetOnQueryTextListener(this);
            item.SetOnActionExpandListener(this);
            _searchView.SetIconifiedByDefault(false);

            return(base.OnCreateOptionsMenu(menu));
        }
Exemplo n.º 3
0
        async void LoadDataAsync()
        {
            if (refreshButton != null)
            {
                refreshButton.SetEnabled(false);
            }
            loadingIndicator.Visibility = ViewStates.Visible;
            List <Book> books = await new PartialCatalogDownloader().DownloadAsync("http://api.e-azbuka.ru/1.0/catalog/user.json");

            pubHouses  = await new DictionaryDownloader().DownloadAsync <PubHouse> ("http://api.e-azbuka.ru/1.0/catalog/user/pubhouses.json");
            categories = await new DictionaryDownloader().DownloadAsync <Category> ("http://api.e-azbuka.ru/1.0/catalog/user/categories.json");

            if (books != null)
            {
                loadingIndicator.Visibility = ViewStates.Gone;
                bookListView.Adapter        = new BookListViewAdapter(this, books, categories, pubHouses);
                searchView.Enabled          = true;
                searchView.SetOnQueryTextListener(null);                 //Удаляем старый листенер если он есть
                searchView.SetOnQueryTextListener(this);
            }
            refreshButton.SetEnabled(true);
        }
Exemplo n.º 4
0
        private void InitializeUI()
        {
            _listViewPoi = FindViewById <ListView>(Resource.Id.listViewPoi);

            List <PoiViewItem> _items = Context.PoiData;

            _items               = _items.OrderBy(i => i.GpsLocation.Distance).ToList();
            _adapter             = new PoiListItemAdapter(this, _items, this);
            _listViewPoi.Adapter = _adapter;

            _listViewPoi.ItemClick += OnListItemClick;

            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetActionBar(toolbar);

            ActionBar.SetDisplayShowHomeEnabled(true);
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ActionBar.SetDisplayShowTitleEnabled(false);


            _editTextSearch           = FindViewById <SearchView>(Resource.Id.editTextSearch);
            _editTextSearch.Iconified = false;
            _editTextSearch.SetQueryHint(Resources.GetText(Resource.String.Common_Search));
            _editTextSearch.SetOnQueryTextListener(this);
            _editTextSearch.FocusableViewAvailable(_listViewPoi);

            _spinnerSelection = FindViewById <Spinner>(Resource.Id.spinnerSelection);

            var selectionAdapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, GetFilterOptions());

            _spinnerSelection.Adapter = selectionAdapter;
            _spinnerSelection.SetSelection((int)Context.SelectedPoiFilter);
            _spinnerSelection.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(OnFilterSelectionChanged);

            _spinnerCountry               = FindViewById <Spinner>(Resource.Id.spinnerCountry);
            _spinnerCountry.Adapter       = new CountryAdapter(this, true);
            _spinnerCountry.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(OnFilterCountryChanged);

            _spinnerCategory               = FindViewById <Spinner>(Resource.Id.spinnerCategory);
            _spinnerCategory.Adapter       = new CategoryAdapter(this, true);
            _spinnerCategory.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(OnFilterCategoryChanged);

            var expandButton = FindViewById <ImageButton>(Resource.Id.expandButton);

            if (expandButton != null)
            {
                expandButton.SetOnClickListener(this);
                _expandableLayout = FindViewById <LinearLayout>(Resource.Id.expandableLayout);
            }
        }
        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            MenuInflater.Inflate(Resource.Menu.Main, menu);

            var searchMenuItem = menu.FindItem(Resource.Id.ActionSearch);

            _searchView = (SearchView)MenuItemCompat.GetActionView(searchMenuItem);
            _searchView.SetOnQueryTextListener(this);

            _loginMenuItem  = menu.FindItem(Resource.Id.ActionLogIn);
            _logoutMenuItem = menu.FindItem(Resource.Id.ActionLogOut);

            return(true);
        }
Exemplo n.º 6
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Platform.Init(this, savedInstanceState);
            SetContentView(Resource.Layout.activity_search);

            // Locate the EditText in listview_main.xml
            editsearch = FindViewById <SearchView>(Resource.Id.search);
            editsearch.SetOnQueryTextListener(this);

            listView = FindViewById <ListView>(Resource.Id.listview);
            listView.OnItemClickListener = this;

            SetValues(new Dictionary <string, string>());
        }
Exemplo n.º 7
0
            public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
            {
                // Place an action bar item for searching.
                var item = menu.Add("Search");

                item.SetIcon(Android.Resource.Drawable.IcMenuSearch);
                MenuCompat.SetShowAsAction(item, MenuItemCompat.ShowAsActionAlways);
                var searchView = new SearchView(Activity);

                if (searchView != null)
                {
                    searchView.SetOnQueryTextListener(new MyOnQueryTextListenerCompat {
                        Parent = this
                    });
                    MenuItemCompat.SetActionView(item, searchView);
                }
            }
Exemplo n.º 8
0
        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            var item = menu.Add("Importa csv");

            item.SetShowAsAction(ShowAsAction.Never);
            item.SetOnMenuItemClickListener(new ImportCsvListener(this));

            item = menu.Add(String.Empty);
            item.SetShowAsAction(ShowAsAction.Always);
            var searchView = new SearchView(this);

            searchView.SetOnQueryTextListener(new SearchViewListener(adapter, this));
            item.SetActionView(searchView);

            base.OnCreateOptionsMenu(menu);

            return(true);
        }
Exemplo n.º 9
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            AppContextLiveData.Instance.SetLocale(this);

            if (DeviceDisplay.MainDisplayInfo.Orientation == DisplayOrientation.Portrait)
            {
                SetContentView(Resource.Layout.PhotosActivityPortrait);
            }
            else
            {
                SetContentView(Resource.Layout.PhotosActivityLandscape);
            }

            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetActionBar(toolbar);

            ActionBar.SetDisplayShowHomeEnabled(true);
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ActionBar.SetDisplayShowTitleEnabled(true);
            ActionBar.SetTitle(Resource.String.PhotosActivity);

            _photosListView           = FindViewById <ListView>(Resource.Id.listViewPhotos);
            _adapter                  = new PhotosItemAdapter(this, new List <PhotoData>(), this);
            _photosListView.Adapter   = _adapter;
            Context.PhotosItemAdapter = _adapter;

            _searchViewLayout            = FindViewById <LinearLayout>(Resource.Id.searchViewLayout);
            _searchViewLayout.Visibility = ViewStates.Gone;

            _searchViewText           = FindViewById <SearchView>(Resource.Id.searchViewPhotoName);
            _searchViewText.Iconified = false;
            _searchViewText.SetQueryHint(Resources.GetText(Resource.String.Common_Search));
            _searchViewText.SetOnQueryTextListener(this);
            _searchViewText.ClearFocus();

            ShowPhotos(Context.ShowFavoritePicturesOnly, GetSearchText());

            Context.PhotosModel.PhotoAdded   += OnPhotoAdded;
            Context.PhotosModel.PhotoUpdated += OnPhotoUpdated;
            Context.PhotosModel.PhotoDeleted += OnPhotoDeleted;
        }
Exemplo n.º 10
0
        public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
        {
            menu.Clear();

            inflater.Inflate(Resource.Menu.route_stops_view_menu, menu);

            var refreshItem = menu.FindItem(Resource.Id.menu_refresh);

            refreshItem.SetOnMenuItemClickListener(this);

            var searchMenuItem = menu.FindItem(Resource.Id.action_search);
            var searchView     = MenuItemCompat.GetActionView(searchMenuItem);

            _searchView                     = searchView.JavaCast <SearchView>();
            _searchView.QueryHint           = AppResources.route_stops_view_search_hint;
            _searchView.SubmitButtonEnabled = false;
            _searchView.SetOnQueryTextListener(this);
            _searchView.SetOnQueryTextFocusChangeListener(this);
            _searchView.Iconified = true;
        }
Exemplo n.º 11
0
        private void SetData(View rootView)
        {
            SearchManager searchManager = (SearchManager)Activity.GetSystemService(Android.Content.Context.SearchService);

            _searchView = rootView.FindViewById <SearchView>(Resource.Id.search);
            _searchView.SetSearchableInfo(searchManager.GetSearchableInfo(Activity.ComponentName));

            _searchView.SetIconifiedByDefault(false);
            _searchView.SetOnQueryTextListener(this);
            _searchView.SetOnCloseListener(this);
            _searchView.ClearFocus();

            Android.Views.InputMethods.InputMethodManager mgr = (Android.Views.InputMethods.InputMethodManager)Activity.GetSystemService(Android.Content.Context.InputMethodService);
            mgr.HideSoftInputFromWindow(_searchView.WindowToken, 0);
            SimpleSelectorItem[] items = (ParcableTest.Dialogs.SimpleSelectorItem[])Arguments.GetParcelableArray(ITEMS);

            _lvSelector = (ListView)rootView.FindViewById(Resource.Id.lvSelector);
            SimpleSelectorListAdapter adapter = new SimpleSelectorListAdapter(Activity, items.ToList());

            _lvSelector.Adapter = adapter;
        }
        private void InitView()
        {
            //设置标题栏
            var btn_header_back = FindViewById <Button> (Resource.Id.btn_header_back);

            btn_header_back.Click += (sender, e) =>
            {
                this.Finish();
            };

            FindViewById <TextView> (Resource.Id.tv_header_title).Text = "监护人绑定";

            listView = FindViewById <ListView> (Resource.Id.lv_searchGuardian);


            searchView = FindViewById <SearchView> (Resource.Id.searchView);
            searchView.SetOnQueryTextListener(this);
            //设置searchview中textview颜色
            var id = searchView.Context.Resources.GetIdentifier("android:id/search_src_text", null, null);

            textView = (TextView)searchView.FindViewById(id);
            textView.SetTextColor(Resources.GetColor(Resource.Color.lightgray));

            //查询
            var txt_Querry = FindViewById <TextView> (Resource.Id.txt_Querry);

            txt_Querry.Click += (sender, e) =>
            {
                OnQueryTextSubmit(textView.Text);
            };

            applyGuardianListAdapter = new ApplyGuardianListAdapter(this);
            applyGuardianListAdapter.RefreshAction = () => {
                QuerryBindGuardian(textView.Text);
            };
            listView.Adapter = applyGuardianListAdapter;
            //设置滑动listview停止加载图片
            listView.SetOnScrollListener(new PauseOnScrollListener(Global.imageLoader, false, false));
        }
Exemplo n.º 13
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            if (DeviceDisplay.MainDisplayInfo.Orientation == DisplayOrientation.Portrait)
            {
                SetContentView(Resource.Layout.PoiSelectActivityPortrait);
            }
            else
            {
                SetContentView(Resource.Layout.PoiSelectActivityLandscape);
            }


            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetActionBar(toolbar);

            ActionBar.SetDisplayShowHomeEnabled(true);
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ActionBar.SetDisplayShowTitleEnabled(true);
            ActionBar.SetTitle(Resource.String.PoiSelectActivity);

            _changeFilterTimer.Interval  = 1000;
            _changeFilterTimer.Elapsed  += OnChangeFilterTimerElapsed;
            _changeFilterTimer.AutoReset = false;

            var longitude = Intent.GetDoubleExtra("Longitude", Double.NaN);
            var latitude  = Intent.GetDoubleExtra("Latitude", Double.NaN);
            var sortBy    = Intent.GetStringExtra("SortBy");

            if (longitude != Double.NaN && latitude != Double.NaN)
            {
                _centerGpsLocation = new GpsLocation(longitude, latitude, 0);
            }

            if (!Enum.TryParse(sortBy, out _sortBy))
            {
                _sortBy = SortBy.Name;
            }

            _searchViewText           = FindViewById <SearchView>(Resource.Id.editTextSearch);
            _searchViewText.Iconified = false;
            _searchViewText.SetQueryHint(Resources.GetText(Resource.String.Common_Search));
            _searchViewText.SetOnQueryTextListener(this);
            _searchViewText.FocusableViewAvailable(_listViewPoi);

            _spinnerCountry               = FindViewById <Spinner>(Resource.Id.spinnerCountry);
            _spinnerCountry.Adapter       = new CountryAdapter(this, true);
            _spinnerCountry.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(OnFilterCountryChanged);

            _spinnerCategory               = FindViewById <Spinner>(Resource.Id.spinnerCategory);
            _spinnerCategory.Adapter       = new CategoryAdapter(this, true);
            _spinnerCategory.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(OnFilterCategoryChanged);

            _listViewPoi = FindViewById <ListView>(Resource.Id.listViewPoi);

            var poiViewItems = new PoiViewItemList(null, AppContext.MyLocation, _iGpsUtilities);

            if (Intent.Action == REQUEST_SELECT_DOWNLOADELEVATIONDATAAREA.ToString())
            {
                if (Peaks360Lib.Utilities.GpsUtils.HasLocation(AppContext.MyLocation))
                {
                    AddMyLocation(poiViewItems);
                }
            }

            _adapter             = new PoiListItemAdapter(this, poiViewItems, this, false);
            _listViewPoi.Adapter = _adapter;
        }