protected override TextInputLayout CreateNativeControl()
        {
            var textInputLayout = new TextInputLayout(Context);
            var autoComplete    = new AppCompatAutoCompleteTextView(Context)
            {
                BackgroundTintList = ColorStateList.ValueOf(GetPlaceholderColor()),
                Text = Element?.Text,
                Hint = Element?.Placeholder,
            };

            textInputLayout.Hint = " ";

            //GradientDrawable gd = new GradientDrawable();
            //gd.SetColor(global::Android.Graphics.Color.Transparent);
            //autoComplete.SetBackground(gd);
            if (Element != null)
            {
                autoComplete.SetHintTextColor(Element.PlaceholderColor.ToAndroid());
                autoComplete.SetTextColor(Element.TextColor.ToAndroid());
            }
            autoComplete.SetMaxLines(1);
            autoComplete.InputType = InputTypes.ClassText;
            textInputLayout.AddView(autoComplete);
            return(textInputLayout);
        }
Пример #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Toolbar toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);

            _backButton    = FindViewById(Resource.Id.button_back);
            _confirmButton = toolbar.FindViewById(Resource.Id.button_confirm);
            _loader        = FindViewById(Resource.Id.loader);
            _location      = FindViewById <AppCompatAutoCompleteTextView>(Resource.Id.edit_search);

            GoogleMapOptions mapOptions = new GoogleMapOptions()
                                          .InvokeMapType(GoogleMap.MapTypeSatellite)
                                          .InvokeZoomControlsEnabled(false)
                                          .InvokeCompassEnabled(true);

            FragmentTransaction fragTx = FragmentManager.BeginTransaction();

            _mapFragment = MapFragment.NewInstance(mapOptions);
            fragTx.Add(Resource.Id.fragment_map, _mapFragment, "map");
            fragTx.Commit();
            _mapFragment.GetMapAsync(this);

            toolbar.FindViewById <TextView>(Resource.Id.title).Text = AppResources.Location;
            (_confirmButton as TextView).Text = AppResources.Ok;
        }
Пример #3
0
        private void HandleSuggestionClick(object sender, SearchView.SuggestionClickEventArgs e)
        {
            if (Element is ISearchPage searchPage)
            {
                SearchView searchView = (sender as SearchView);
                AppCompatAutoCompleteTextView autoComplete = (AppCompatAutoCompleteTextView)searchView.FindViewById(Resource.Id.search_src_text);

                var selectedItem = autoComplete.Adapter.GetItem(e.Position);
                searchPage.SearchTextEvent((string)selectedItem);
            }
        }
        protected override TextInputLayout CreateNativeControl()
        {
            var textInputLayout = new TextInputLayout(Context);
            var autoComplete    = new AppCompatAutoCompleteTextView(Context)
            {
                SupportBackgroundTintList = ColorStateList.ValueOf(GetPlaceholderColor())
            };

            textInputLayout.AddView(autoComplete);
            return(textInputLayout);
        }
Пример #5
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var view = inflater.Inflate(Resource.Layout.partner_vehicle_fragment, container, false);

            CarBrandEt      = view.FindViewById <AppCompatAutoCompleteTextView>(Resource.Id.brand_ac_tv);
            CarModelEt      = view.FindViewById <AppCompatAutoCompleteTextView>(Resource.Id.model_ac_tv);
            CarYearEt       = view.FindViewById <AppCompatAutoCompleteTextView>(Resource.Id.year_ac_tv);
            CarColorEt      = view.FindViewById <AppCompatAutoCompleteTextView>(Resource.Id.color_ac_tv);
            ConditionEt     = view.FindViewById <AppCompatAutoCompleteTextView>(Resource.Id.state_ac_tv);
            RegNoEt         = view.FindViewById <TextInputLayout>(Resource.Id.reg_no_til);
            DriverLicenceEt = view.FindViewById <TextInputLayout>(Resource.Id.curr_user_til);
            ContinueBtn     = view.FindViewById <MaterialButton>(Resource.Id.part_cont_btn);
            return(view);
        }
Пример #6
0
        protected override void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            if (disposing)
            {
                _disposed = true;

                SearchHandler.PropertyChanged -= OnSearchHandlerPropertyChanged;

                _textBlock.ItemClick -= OnTextBlockItemClicked;
                _textBlock.RemoveTextChangedListener(this);
                _textBlock.SetOnEditorActionListener(null);
                _textBlock.DropDownBackground.Dispose();
                _textBlock.SetDropDownBackgroundDrawable(null);

                _clearButton.Click            -= OnClearButtonClicked;
                _clearPlaceholderButton.Click -= OnClearPlaceholderButtonClicked;
                _searchButton.Click           -= OnSearchButtonClicked;

                _textBlock.Adapter.Dispose();
                _textBlock.Adapter = null;
                _searchHandlerAppearanceTracker?.Dispose();
                _textBlock.Dispose();
                _clearButton.Dispose();
                _searchButton.Dispose();
                _cardView.Dispose();
                _clearPlaceholderButton.Dispose();
            }

            _textBlock                      = null;
            _clearButton                    = null;
            _searchButton                   = null;
            _cardView                       = null;
            _clearPlaceholderButton         = null;
            _shellContext                   = null;
            _searchHandlerAppearanceTracker = null;

            SearchHandler = null;

            base.Dispose(disposing);
        }
Пример #7
0
        protected virtual void LoadView(SearchHandler searchHandler)
        {
            var query       = searchHandler.Query;
            var placeholder = searchHandler.Placeholder;

            LP  lp;
            var context = Context;

            _cardView = new CardView(context);
            using (lp = new LayoutParams(LP.MatchParent, LP.MatchParent))
                _cardView.LayoutParameters = lp;


            var linearLayout = new LinearLayout(context);

            using (lp = new LP(LP.MatchParent, LP.MatchParent))
                linearLayout.LayoutParameters = lp;
            linearLayout.Orientation = Orientation.Horizontal;

            _cardView.AddView(linearLayout);

            int padding = (int)context.ToPixels(8);

            _searchButton = CreateImageButton(context, searchHandler, SearchHandler.QueryIconProperty, Resource.Drawable.abc_ic_search_api_material, padding, 0);

            lp = new LinearLayout.LayoutParams(0, LP.MatchParent)
            {
                Gravity = GravityFlags.Fill,
                Weight  = 1
            };
            _textBlock = new AppCompatAutoCompleteTextView(context)
            {
                LayoutParameters = lp,
                Text             = query,
                Hint             = placeholder,
                ImeOptions       = ImeAction.Done
            };
            lp.Dispose();
            _textBlock.Enabled = searchHandler.IsSearchEnabled;
            _textBlock.SetBackground(null);
            _textBlock.SetPadding(padding, 0, padding, 0);
            _textBlock.SetSingleLine(true);
            _textBlock.Threshold  = 1;
            _textBlock.Adapter    = new ShellSearchViewAdapter(SearchHandler, _shellContext);
            _textBlock.ItemClick += OnTextBlockItemClicked;
            _textBlock.SetDropDownBackgroundDrawable(new ClipDrawableWrapper(_textBlock.DropDownBackground));

            // A note on accessibility. The _textBlocks hint is what android defaults to reading in the screen
            // reader. Therefor we do not need to set something else.

            _clearButton            = CreateImageButton(context, searchHandler, SearchHandler.ClearIconProperty, Resource.Drawable.abc_ic_clear_material, 0, padding);
            _clearPlaceholderButton = CreateImageButton(context, searchHandler, SearchHandler.ClearPlaceholderIconProperty, -1, 0, padding);

            linearLayout.AddView(_searchButton);
            linearLayout.AddView(_textBlock);
            linearLayout.AddView(_clearButton);
            linearLayout.AddView(_clearPlaceholderButton);

            UpdateClearButtonState();

            // hook all events down here to avoid getting events while doing setup
            searchHandler.PropertyChanged += OnSearchHandlerPropertyChanged;
            _textBlock.AddTextChangedListener(this);
            _textBlock.SetOnEditorActionListener(this);
            _clearButton.Click            += OnClearButtonClicked;
            _clearPlaceholderButton.Click += OnClearPlaceholderButtonClicked;
            _searchButton.Click           += OnSearchButtonClicked;

            AddView(_cardView);

            linearLayout.Dispose();
        }
Пример #8
0
 public Validator(AppCompatAutoCompleteTextView edittext)
 {
     _edittext = edittext;
 }
        public override void OnViewCreated(View view, Bundle savedInstanceState)
        {
            base.OnViewCreated(view, savedInstanceState);
            SubmitBtn = view.FindViewById <MaterialButton>(Resource.Id.drv_signup_sbmtbtn);
            FnameText = view.FindViewById <TextInputLayout>(Resource.Id.drv_signup_fname_et);
            LnameText = view.FindViewById <TextInputLayout>(Resource.Id.drv_signup_lname_et);
            EmailText = view.FindViewById <TextInputLayout>(Resource.Id.drv_signup_email_et);
            PhoneText = view.FindViewById <TextInputLayout>(Resource.Id.drv_signup_phone_et);
            CodeText  = view.FindViewById <TextInputLayout>(Resource.Id.drv_signup_code_et);
            PassText  = view.FindViewById <TextInputLayout>(Resource.Id.drv_signup_pass_et);
            CityText  = view.FindViewById <AppCompatAutoCompleteTextView>(Resource.Id.autocity_et);
            var regAppBar = view.FindViewById <AppBarLayout>(Resource.Id.signup_appbar);

            var toolbar = regAppBar.FindViewById <AndroidX.AppCompat.Widget.Toolbar>(Resource.Id.main_toolbar);

            toolbar.Title = "Register";
            toolbar.InflateMenu(Resource.Menu.help_menu);
            toolbar.MenuItemClick += Toolbar_MenuItemClick;

            FnameText.EditText.AfterTextChanged += EditText_AfterTextChanged;
            LnameText.EditText.AfterTextChanged += EditText_AfterTextChanged;
            PassText.EditText.AfterTextChanged  += EditText_AfterTextChanged;
            EmailText.EditText.AfterTextChanged += EditText_AfterTextChanged;
            PhoneText.EditText.AfterTextChanged += EditText_AfterTextChanged;

            var adapter = ArrayAdapterClass.CreateArrayAdapter(Activity, names);

            CityText.Adapter           = adapter;
            CityText.AfterTextChanged += EditText_AfterTextChanged;

            SubmitBtn.Click += (s1, e1) =>
            {
                //open progress
                OnboardingActivity.ShowProgressDialog();
                fname = FnameText.EditText.Text;
                lname = LnameText.EditText.Text;
                email = EmailText.EditText.Text;
                phone = PhoneText.EditText.Text;
                city  = CityText.Text;
                code  = CodeText.EditText.Text;

                AppDataHelper.GetFirebaseAuth().CreateUserWithEmailAndPassword(email, PassText.EditText.Text)
                .AddOnCompleteListener(new OnCompleteListener(t =>
                {
                    if (!t.IsSuccessful)
                    {
                        try
                        {
                            OnboardingActivity.CloseProgressDialog();
                            throw t.Exception;
                        }
                        catch (FirebaseAuthInvalidCredentialsException)
                        {
                            OnboardingActivity.ShowErrorDialog("The email or password is not correct");
                        }
                        catch (FirebaseAuthUserCollisionException)
                        {
                            ShowEmailExistsDialog();
                        }
                        catch (FirebaseAuthInvalidUserException)
                        {
                            OnboardingActivity.ShowErrorDialog("User invalid");
                        }
                        catch (FirebaseNetworkException)
                        {
                            OnboardingActivity.ShowNoNetDialog(false);
                        }
                        catch (Exception)
                        {
                            OnboardingActivity.ShowErrorDialog("Your request could not be completed at this time");
                        }
                    }
                    else
                    {
                        SaveDriverToDb();
                    }
                }));
            };
        }
Пример #10
0
        public async void init(View rootView)
        {
            if (!isOnline())
            {
                mErrorDialog.Show();
                return;
            }
            api            = new CabsAPI();
            mLoadingDialog = new LoadingDialog(mActivity, Resource.Drawable.main);
            mLoadingDialog.SetCancelable(false);
            Window window = mLoadingDialog.Window;

            window.SetLayout(WindowManagerLayoutParams.MatchParent, WindowManagerLayoutParams.MatchParent);
            window.SetBackgroundDrawable(new ColorDrawable(Resources.GetColor(Resource.Color.trans)));
            SpannableString s = new SpannableString("Home");

            typeface = Typeface.CreateFromAsset(mActivity.Assets, "JosefinSans-SemiBold.ttf");
            s.SetSpan(new TypefaceSpan("Amaranth-Regular.ttf"), 0, s.Length(), SpanTypes.ExclusiveExclusive);
            s.SetSpan(new ForegroundColorSpan(this.Resources.GetColor(Resource.Color.title)), 0, s.Length(), SpanTypes.ExclusiveExclusive);
            mActivity.TitleFormatted = s;
            mSharedPreference        = mActivity.GetSharedPreferences(Constants.MY_PREF, 0);
            token = mSharedPreference.GetString("token", " ");
            if (mActivity.Intent.GetStringExtra("source") != null)
            {
                msourceRecieved = mActivity.Intent.GetStringExtra("source");
            }
            else
            {
                msourceRecieved = mSharedPreference.GetString("source", "1,ISB Rd,Gachibowli");
            }
            autoSourceBox                 = rootView.FindViewById <AppCompatAutoCompleteTextView>(Resource.Id.sourceauto);
            autoSourceBox.Text            = msourceRecieved;
            sourceSuggestionsAdapter      = new SearchSuggestionsAdapter(mActivity);
            autoSourceBox.Adapter         = sourceSuggestionsAdapter;
            destinationSuggestionsAdapter = new SearchSuggestionsAdapter(mActivity);
            autoSourceBox.ItemClick      += mSourceTextBoxClicked;
            autoDestinationBox            = rootView.FindViewById <AppCompatAutoCompleteTextView>(Resource.Id.destinationauto);
            autoDestinationBox.Adapter    = destinationSuggestionsAdapter;
            autoDestinationBox.ItemClick += mDestinationTextBoxClicked;
            mLoadingDialog.Show();
            mRecyclerView = rootView.FindViewById <RecyclerView>(Resource.Id.cabrecycler);
            LinearLayoutManager linearLayoutManager = new LinearLayoutManager(Application.Context);

            mRecyclerView.SetLayoutManager(linearLayoutManager);
            mRecyclerView.AddItemDecoration(new VerticalSpaceItemDecoration(VERTICAL_ITEM_SPACE));
            LayoutInflater inflater    = (LayoutInflater)Activity.GetSystemService(Context.LayoutInflaterService);
            View           Childlayout = inflater.Inflate(Resource.Layout.fragment_google_maps, null);

            if (msourceRecieved != null)
            {
                GeoResponse mResponseGetSourcelatlng = await api.GeoCodingResult(token, msourceRecieved);

                slat         = mResponseGetSourcelatlng.Position.Latitude;
                slng         = mResponseGetSourcelatlng.Position.Longitude;
                hasSourceSet = false;
                setSourceMarker(msourceRecieved);
            }
            CabsResponse response = await api.GetNearbyCabs(slat, slng, Constants.AUTH_TOKEN);

            if (response.Code == ResponseCode.SUCCESS)
            {
                mCabs               = response.Cabs;
                mAdapter            = new CabRecyclerAdapter(Application.Context, mCabs, mActivity);
                mAdapter.ItemClick += OnItemClick;
                mRecyclerView.SetAdapter(mAdapter);
                mLoadingDialog.Dismiss();
            }
        }