Exemple #1
0
        private void Setup()
        {
            autoCompleteTextView = FindViewById <AutoCompleteTextView>(Resource.Id.autocompletetextview_auth);
            autoCompleteTextView.SetOnEditorActionListener(this);

            textChangeListener = new TextChangeListener(this, autoCompleteTextView);
            autoCompleteTextView.AddTextChangedListener(textChangeListener);

            var buttonAuth = FindViewById <Button>(Resource.Id.button_auth);

            buttonAuth.Click += ButtonAuth_Click;

            var skipAuthTextView = FindViewById <TextView>(Resource.Id.textview_auth_skip);

            skipAuthTextView.Click += SkipAuthTextView_Click;

            scheduleSettings = AndroidDependencyContainer.Instance.ScheduleSettings;

            isTeacher = Intent.Extras.GetBoolean(UserTypeSelectActivity.IsTeacherIntentExtraName);

            var titleTextView = FindViewById <TextView>(Resource.Id.textview_auth_edittext_title);

            if (isTeacher)
            {
                skipAuthTextView.Text     = Resources.GetString(Resource.String.auth_teacher_later);
                titleTextView.Text        = Resources.GetString(Resource.String.auth_teacher_title);
                autoCompleteTextView.Hint = Resources.GetString(Resource.String.auth_teacher_hint);
            }
            else
            {
                skipAuthTextView.Text     = Resources.GetString(Resource.String.group_later);
                titleTextView.Text        = Resources.GetString(Resource.String.edittext_title);
                autoCompleteTextView.Hint = Resources.GetString(Resource.String.edittext_auth);
            }
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);

            ActionBar actionBar = ActionBar;

            actionBar.Title = "";
            actionBar.SetDisplayHomeAsUpEnabled(false);
            actionBar.SetDisplayShowCustomEnabled(true);
            actionBar.SetCustomView(Resource.Layout.actionBar);
            actionBar.NavigationMode  = ActionBarNavigationMode.Standard;
            this.RequestedOrientation = Android.Content.PM.ScreenOrientation.Sensor;

            try
            {
                Toolbar parent = (Toolbar)actionBar.CustomView.Parent;
                parent.SetContentInsetsAbsolute(0, 0);
            }
            catch (Exception e)
            {
                Toast.MakeText(this, e.Message, ToastLength.Long).Show();
            }

            if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
            {
                Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds);
                Window.SetStatusBarColor(Color.ParseColor("#9c0303"));
            }

            ll              = FindViewById <LinearLayout>(Resource.Id.LL);
            textView2       = FindViewById <TextView>(Resource.Id.textView2);
            autocomplete    = FindViewById <AutoCompleteTextView>(Resource.Id.autocomplete_codes);
            tableLayout     = FindViewById <TableLayout>(Resource.Id.results1);
            imageClear      = FindViewById <ImageButton>(Resource.Id.imageButton1);
            imageHelp       = FindViewById <ImageView>(Resource.Id.imageView2);
            bntSendFromMain = FindViewById <Button>(Resource.Id.btnSendFromMain);

            ll.SetBackgroundColor(Color.ParseColor("#f0f0f0"));
            ll.Click += LL_Click;

            хdoc = XDocument.Load(Resources.GetXml(Resource.Xml.codes));
            var codes   = хdoc.Root.Elements("item").Select(x => x);
            var ids     = codes.Select(x => x.Attribute("order").Value + " | " + x.Attribute("type").Value).ToList();
            var adapter = new ArrayExAdapter <string>(this, Resource.Layout.listItem, ids);

            //var adapter = ArrayAdapter.CreateFromResource(this, Resource.Array.Codes, Resource.Layout.list_item);

            autocomplete.SetHintTextColor(Color.Red);
            autocomplete.Adapter   = adapter;
            autocomplete.Threshold = 1;
            autocomplete.AddTextChangedListener(new MyTextWatcher(this.BaseContext, imageClear));
            autocomplete.ItemClick += AutoComplete_ItemClick;

            imageClear.Click      += ImageClear_Click;
            imageHelp.Click       += ImageHelp_Click;
            bntSendFromMain.Click += BtnFromMain_Click;
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            mapGraph = MainApp.Instance.MainBuildingGraph.Value;

            view = inflater.Inflate(Resource.Layout.fragment_mainbuilding, container, false);

            fragments = new List <MainBuildingMapFragment>()
            {
                new MainBuildingMapFragment(Resource.Drawable.first_floor), new MainBuildingMapFragment(Resource.Drawable.second_floor), new MainBuildingMapFragment(Resource.Drawable.third_floor)
            };

            fragmentTransaction = Activity.SupportFragmentManager.BeginTransaction();
            fragmentTransaction.Add(Resource.Id.frame_mainbuilding, fragments[2], "MAP_MAINBUILDING_3");
            fragmentTransaction.Add(Resource.Id.frame_mainbuilding, fragments[1], "MAP_MAINBUILDING_2");
            fragmentTransaction.Detach(fragments[2]);
            fragmentTransaction.Detach(fragments[1]);
            fragmentTransaction.Add(Resource.Id.frame_mainbuilding, fragments[0], "MAP_MAINBUILDING_1");
            fragmentTransaction.Commit();

            var array = MainApp.Instance.RoomsDictionary.Select(x => x.Key).ToArray();

            editTextInputFrom              = view.FindViewById <AutoCompleteTextView>(Resource.Id.autoCompleteTextView_from);
            editTextInputFrom.FocusChange += EditTextFromFocusChanged;
            editTextInputFrom.Adapter      = new ArrayAdapter(Activity.BaseContext, Android.Resource.Layout.SimpleDropDownItem1Line, array);
            editTextInputFrom.AddTextChangedListener(this);

            editTextInputTo = view.FindViewById <AutoCompleteTextView>(Resource.Id.autoCompleteTextView_to);
            editTextInputTo.SetOnEditorActionListener(this);
            editTextInputTo.FocusChange += EditTextToFocusChanged;
            editTextInputTo.Adapter      = new ArrayAdapter(Activity.BaseContext, Android.Resource.Layout.SimpleDropDownItem1Line, array);
            editTextInputTo.AddTextChangedListener(this);

            appBar = view.FindViewById <AppBarLayout>(Resource.Id.appbar_mainbuilding);
            appBar.AddOnOffsetChangedListener(this);

            fab        = view.FindViewById <FloatingActionButton>(Resource.Id.fab_mainbuilding);
            fab.Click += Fab_Click;

            relativeLayout       = view.FindViewById <RelativeLayout>(Resource.Id.search_frame_mainbuilding);
            relativeLayoutParams = (AppBarLayout.LayoutParams)relativeLayout.LayoutParameters;

            frameLayout     = view.FindViewById <FrameLayout>(Resource.Id.frame_mainbuilding);
            fabLayoutParams = (CoordinatorLayout.LayoutParams)fab.LayoutParameters;

            var rl = view.FindViewById <RelativeLayout>(Resource.Id.relativelayout_floor_buttons_mainbuilding);

            rl.BringToFront();

            buttonUp        = view.FindViewById <FloatingActionButton>(Resource.Id.fab_up_mainbuilding);
            buttonUp.Click += ButtonUp_Click;
            buttonUp.Alpha  = 0.7f;

            buttonDown         = view.FindViewById <FloatingActionButton>(Resource.Id.fab_down_mainbuilding);
            buttonDown.Click  += ButtonDown_Click;
            buttonDown.Alpha   = 0.7f;
            buttonDown.Enabled = false;

            return(view);
        }
Exemple #4
0
        protected void configureActv(AutoCompleteTextView actv, AutoCompleteTextView actvOther, FrameLayout frame, Button clear, Button navButton)
        {
            //Initializes the actv suggestions adapter
            ArrayAdapterNoFilter adapter = new ArrayAdapterNoFilter(this, Android.Resource.Layout.SimpleDropDownItem1Line);
            //Initializes the suggestions updater for the adapter
            AutocompleteSuggestionUpdater suggestor = new AutocompleteSuggestionUpdater(actv, adapter, map, mbi);

            //Sets the adapter of the actv
            actv.Adapter = adapter;
            //Sets the updater to update the suggestions when the text changes
            actv.AddTextChangedListener(suggestor);
            InputMethodManager imm = (InputMethodManager)GetSystemService(Activity.InputMethodService);

            //Sets delegates for handling the opacity of the navigation button
            actv.AfterTextChanged += delegate
            {
                //Updates the color of the actv based on whether the address is valid
                makeActvTurnGreenWhenAddressesAreValid(actv, frame);
            };
            //Sets delegate for when the enter button is pushed on the keyboard
            actv.EditorAction += delegate
            {
                //Unfocuses from the actv, closes the dropdown, and hides the keyboard.
                actv.ClearFocus();
                actv.DismissDropDown();
                imm.HideSoftInputFromWindow(actv.WindowToken, 0);
            };
            //Sets delegate for if the actv is clicked
            actv.ItemClick += delegate
            {
                //Closes the dropdown menu, turns off the suggestor, updates the route button's opacity, and hides the keyboard
                actv.DismissDropDown();
                suggestor.showDialog = false;
                Tools.makeRouteButtonOpaqueIfBothAddressesAreValid(actv.Text, actvOther.Text, navButton, mbi);
                imm.HideSoftInputFromWindow(actv.WindowToken, 0);
            };
            //Sets delegate for if the actv changes color
            frame.LayoutChange += delegate
            {
                //Updates the route button's opacity
                Tools.makeRouteButtonOpaqueIfBothAddressesAreValid(actv.Text, actvOther.Text, navButton, mbi);
            };
            //Sets delegate for if the clear button has been pressed
            clear.Click += delegate
            {
                //Closes the dropdown menu, updates the route button's opacity,
                //gets the suggestor ready to start making suggestions when the user types again, and clears the text in the box
                actv.DismissDropDown();
                Tools.makeRouteButtonOpaqueIfBothAddressesAreValid(actv.Text, actvOther.Text, navButton, mbi);
                suggestor.showDialog = true;
                actv.Text            = "";
            };
        }
Exemple #5
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            view = inflater.Inflate(Resource.Layout.fragment_mainbuilding, container, false);

            var fragmentTransaction = Activity.SupportFragmentManager.BeginTransaction()
                                      .Add(Resource.Id.frame_mainbuilding, fragments[2], "MAP_MAINBUILDING_3")
                                      .Add(Resource.Id.frame_mainbuilding, fragments[1], "MAP_MAINBUILDING_2")
                                      .Add(Resource.Id.frame_mainbuilding, fragments[0], "MAP_MAINBUILDING_1")
                                      .Hide(fragments[2])
                                      .Hide(fragments[1])
                                      .Commit();

            var array = roomsDictionary.Select(x => x.Key).ToArray();

            editTextInputFrom              = view.FindViewById <AutoCompleteTextView>(Resource.Id.autoCompleteTextView_from);
            editTextInputFrom.FocusChange += EditTextFromFocusChanged;
            editTextInputFrom.Adapter      = new ArrayAdapter(Activity.BaseContext,
                                                              Android.Resource.Layout.SimpleDropDownItem1Line, array);
            editTextInputFrom.AddTextChangedListener(this);

            editTextInputTo = view.FindViewById <AutoCompleteTextView>(Resource.Id.autoCompleteTextView_to);
            editTextInputTo.SetOnEditorActionListener(this);
            editTextInputTo.FocusChange += EditTextToFocusChanged;
            editTextInputTo.Adapter      = new ArrayAdapter(Activity.BaseContext,
                                                            Android.Resource.Layout.SimpleDropDownItem1Line, array);
            editTextInputTo.AddTextChangedListener(this);

            appBar = view.FindViewById <AppBarLayout>(Resource.Id.appbar_mainbuilding);
            appBar.AddOnOffsetChangedListener(this);

            drawRouteButton        = view.FindViewById <FloatingActionButton>(Resource.Id.fab_mainbuilding);
            drawRouteButton.Click += DrawRouteButton_Click;

            var changeFloorButtonsRelativeLayout =
                view.FindViewById <RelativeLayout>(Resource.Id.relativelayout_floor_buttons_mainbuilding);

            changeFloorButtonsRelativeLayout.BringToFront();

            upButton        = view.FindViewById <FloatingActionButton>(Resource.Id.fab_up_mainbuilding);
            upButton.Click += UpButton_Click;
            upButton.Alpha  = 0.7f;

            downButton         = view.FindViewById <FloatingActionButton>(Resource.Id.fab_down_mainbuilding);
            downButton.Click  += DownButton_Click;
            downButton.Alpha   = 0.7f;
            downButton.Enabled = false;

            return(view);
        }
Exemple #6
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            MainApp.ChangeLanguage(this);
            SetTheme(Resource.Style.MyAppTheme);
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.activity_authorization);

            networkChecker           = new NetworkChecker(this);
            autoCompleteTextViewAuth = FindViewById <AutoCompleteTextView>(Resource.Id.autocompletetextview_auth);
            autoCompleteTextViewAuth.SetOnEditorActionListener(this);
            autoCompleteTextViewAuth.AddTextChangedListener(this);
            progressBar = FindViewById <ProgressBar>(Resource.Id.progressbar_auth);

            progressBar.Visibility = ViewStates.Visible;
            Task.Run(async() =>
            {
                groupsDictionary = await MainApp.Instance.GroupsDictionary;
                array            = groupsDictionary.Select(x => x.Key).ToArray();

                RunOnUiThread(() =>
                {
                    suggestAdapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleDropDownItem1Line, array);

                    autoCompleteTextViewAuth.Adapter = suggestAdapter;

                    progressBar.Visibility = ViewStates.Invisible;
                });
            });

            var buttonAuth     = FindViewById <Button>(Resource.Id.button_auth);
            var textViewLater  = FindViewById <TextView>(Resource.Id.textview_later_auth);
            var textViewUpdate = FindViewById <TextView>(Resource.Id.textview_groupsupdate_auth);

            buttonAuth.Click     += ButtonAuth_Click;
            textViewLater.Click  += TextViewLater_Click;
            textViewUpdate.Click += TextViewUpdate_Click;

            prefEditor = MainApp.Instance.SharedPreferences.Edit();
        }