Esempio n. 1
0
    public void LoadMaterials(int value) // 1 - frame, 2 - lens, 3 - arms
    {
        //Clear all the buttons in the scrollview
        foreach (Transform child in buttonParent.transform)
        {
            Destroy(child.gameObject);
        }



        if (value == 1)
        {
            materials = sunglassMaterials.frameMaterials;
        }
        else if (value == 2)
        {
            materials = sunglassMaterials.lensMaterials;
        }
        else if (value == 3)
        {
            materials = sunglassMaterials.frameMaterials;
        }

        for (int i = 0; i < materials.Length; i++)
        {
            tempButtonObj = Instantiate(buttonPrefab, buttonParent);
            tempButton    = tempButtonObj.GetComponent <MaterialButton>();

            tempButton.SetupButton(materials[i].buttonTexture, materials[i].tintColour, value, i);
        }
    }
Esempio n. 2
0
        private void ConnectViews(View view)
        {
            BtnPanic            = view.FindViewById <MaterialButton>(Resource.Id.BtnPanic);
            txt_invite_count    = view.FindViewById <TextView>(Resource.Id.txt_invite_count);
            FabInvites          = view.FindViewById <FloatingActionButton>(Resource.Id.FabInvites);
            recycler            = view.FindViewById <RecyclerView>(Resource.Id.recyclerContactsList);
            BtnPanic.LongClick += BtnPanic_LongClick;

            BtnPanic.Click += BtnPanic_Click;

            FabInvites.Click += FabInvites_Click;


            LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context);
            ContactsAdapter     adapter             = new ContactsAdapter(items);

            linearLayoutManager.Orientation = RecyclerView.Horizontal;
            recycler.HasFixedSize           = true;
            recycler.SetLayoutManager(linearLayoutManager);

            recycler.SetAdapter(adapter);
            adapter.ItemClick += Adapter_ItemClick1;

            CrossCloudFirestore.Current.Instance
            .Collection("PEOPLE")
            .AddSnapshotListener((value, errors) =>
            {
                if (!value.IsEmpty)
                {
                    foreach (var dc in value.DocumentChanges)
                    {
                        var users = dc.Document.ToObject <AppUsers>();
                        switch (dc.Type)
                        {
                        case DocumentChangeType.Added:
                            items.Add(users);
                            adapter.NotifyDataSetChanged();
                            break;

                        case DocumentChangeType.Modified:
                            items[dc.OldIndex] = users;
                            //Toast.MakeText(context, items[dc.OldIndex].Id, ToastLength.Long).Show();
                            adapter.NotifyDataSetChanged();
                            break;

                        case DocumentChangeType.Removed:
                            items.RemoveAt(dc.OldIndex);
                            adapter.NotifyDataSetChanged();
                            break;

                        default:
                            break;
                        }
                    }
                }
            });


            IsPlayServiceAvailabe();
        }
        public override void OnViewCreated(View view, Bundle savedInstanceState)
        {
            base.OnViewCreated(view, savedInstanceState);
            var postToggleBtn = view.FindViewById <MaterialButtonToggleGroup>(Resource.Id.photo_choser_togglegrp);

            postImageView      = view.FindViewById <ImageView>(Resource.Id.image_to_post);
            profile_image_view = view.FindViewById <CircleImageView>(Resource.Id.create_post_userProfile);
            commentEt          = view.FindViewById <TextInputLayout>(Resource.Id.create_post_et);
            doneBtn            = view.FindViewById <MaterialButton>(Resource.Id.done_btn);
            postProgress       = view.FindViewById <ProgressBar>(Resource.Id.post_progress);
            closeBtn           = view.FindViewById <ImageButton>(Resource.Id.post_cancel_btn);
            closeBtn.Click    += CloseBtn_Click;
            postToggleBtn.AddOnButtonCheckedListener(new ButtonCheckedListener(
                                                         onbuttonChecked: (g, id, isChecked) =>
            {
                if (isChecked)
                {
                    switch (id)
                    {
                    case Resource.Id.open_cam_btn:
                        icu.TakeCameraImage();
                        break;

                    case Resource.Id.choose_photo_btn:
                        icu.FetchImageFromGallery();
                        break;
                    }
                }
            }));

            doneBtn.Click += DoneBtn_Click;
            commentEt.EditText.TextChanged += EditText_TextChanged;
            Glide.With(this).SetDefaultRequestOptions(requestOptions).Load(profile_url).Into(profile_image_view);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            Window.SetFlags(WindowManagerFlags.LayoutNoLimits, WindowManagerFlags.LayoutNoLimits);

            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            MobileBarcodeScanner.Initialize(Application);
            SetContentView(Resource.Layout.activity_main);

            animationView = FindViewById <LottieAnimationView>(Resource.Id.animation);

            scanButton        = FindViewById <MaterialButton>(Resource.Id.button);
            scanButton.Click += OnScanButtonClicked;

            playButton        = FindViewById <MaterialButton>(Resource.Id.playbutton);
            playButton.Click += OnPlayButtonClicked;

            var background = FindViewById(Resource.Id.background);

            var whiteButton = FindViewById(Resource.Id.color_button_white);

            whiteButton.Click += (s, a) => background.SetBackgroundResource(Resource.Drawable.color_background_white);
            var blackButton = FindViewById(Resource.Id.color_button_black);

            blackButton.Click += (s, a) => background.SetBackgroundResource(Resource.Drawable.color_background_black);
            var transparentButton = FindViewById(Resource.Id.color_button_transparent);

            transparentButton.Click += (s, a) => background.SetBackgroundResource(Resource.Drawable.color_background_transparent);
        }
        private void ClickUser(object sender, RoutedEventArgs e)
        {
            if (sender != null)
            {
                MaterialButton materialButton = (MaterialButton)sender;
                string         name           = (string)materialButton.Tag;
                User           user           = mainWindow.Group.users.Find(x => x.name == name);

                userName.Text = name;

                var follows = user.following.Select(x => x.name);
                followsNames.ItemsSource = follows;
                followsLabel.Text        = string.Format(Localization.Get("Superstar.FollowsLabel"), follows.Count());

                IEnumerable <string> followers;
                if (!followersCache.ContainsKey(user))
                {
                    followersCache[user] = mainWindow.Group.users.Where(x => x.following.Contains(user)).Select(x => x.name);
                }
                followers = followersCache[user];
                followerNames.ItemsSource = followers;
                followersLabel.Text       = string.Format(Localization.Get("Superstar.FollowersLabel"), followers.Count());
            }
            else
            {
                userName.Text = "";

                string[] values = new string[0];
                followsNames.ItemsSource = values;
                followsLabel.Text        = string.Format(Localization.Get("Superstar.FollowsLabel"), 0);

                followerNames.ItemsSource = values;
                followersLabel.Text       = string.Format(Localization.Get("Superstar.FollowersLabel"), 0);
            }
        }
Esempio n. 6
0
 public static void UpdateStrokeColor(this MaterialButton nativeButton, IButtonStroke buttonStroke)
 {
     if (buttonStroke.StrokeColor is Color stroke)
     {
         nativeButton.StrokeColor = ColorStateListExtensions.CreateButton(stroke.ToNative());
     }
 }
Esempio n. 7
0
        public override void OnViewCreated(View view, Bundle savedInstanceState)
        {
            base.OnViewCreated(view, savedInstanceState);
            var fromTxt     = view.FindViewById <TextView>(Resource.Id.new_ride_frm_tv);
            var toTxt       = view.FindViewById <TextView>(Resource.Id.new_ride_to_tv);
            var distanceTxt = view.FindViewById <TextView>(Resource.Id.box1_tv);
            var durationTxt = view.FindViewById <TextView>(Resource.Id.box2_tv);
            var fareTxt     = view.FindViewById <TextView>(Resource.Id.box3_tv);

            acceptRideButton = (MaterialButton)view.FindViewById(Resource.Id.new_ride_acceptBtn);
            if (_rideDetails != null)
            {
                fromTxt.Text     = _rideDetails.PickupAddress;
                toTxt.Text       = _rideDetails.DestinationAddress;
                distanceTxt.Text = _rideDetails.Distance;
                durationTxt.Text = _rideDetails.Duration;
                fareTxt.Text     = _rideDetails.Fare;
            }
            else
            {
                return;
            }

            acceptRideButton.Click += (s1, e1) =>
            {
                RideAccepted?.Invoke(this, new EventArgs());
            };
        }
Esempio n. 8
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var ignored = base.OnCreateView(inflater, container, savedInstanceState);

            View view = inflater.Inflate(Resource.Layout.content_home, null);

            try
            {
                crudSettings = new CrudSettings();
                settings     = Settings.Instance;

                buttonOk        = view.FindViewById <MaterialButton>(Resource.Id.materialButton1);
                buttonOk.Click += HandlerClickButtonOk;

                buttonCancel        = view.FindViewById <MaterialButton>(Resource.Id.materialButton2);
                buttonCancel.Click += HandlerClickButtonCancel;

                return(view);
            }
            catch (System.Exception ex)
            {
                #region Logging
                LogRuntimeAttribute.InLogFiles(typeof(HomeFragment), ex);
                #endregion

                return(view);
            }
        }
Esempio n. 9
0
 public static void UpdateCornerRadius(this MaterialButton platformButton, IButtonStroke buttonStroke)
 {
     if (buttonStroke.CornerRadius >= 0)
     {
         platformButton.CornerRadius = (int)platformButton.Context.ToPixels(buttonStroke.CornerRadius);
     }
 }
Esempio n. 10
0
        protected override void OnElementChanged(ElementChangedEventArgs <Button> e)
        {
            base.OnElementChanged(e);

            if (this.Control == null)
            {
                return;
            }

            if (e?.OldElement != null)
            {
                _helper.Clean();
            }

            if (e?.NewElement == null)
            {
                return;
            }
            _materialButton = this.Element as MaterialButton;
            _helper         = new MaterialDrawableHelper(_materialButton, this.Control);
            _helper.UpdateDrawable();

            this.Control.SetMinimumWidth((int)MaterialHelper.ConvertToDp(64));
            this.Control.SetAllCaps(_materialButton != null && _materialButton.AllCaps);

            this.SetButtonIcon();
            this.SetTextColors();
            this.SetTextLetterSpacing();
        }
Esempio n. 11
0
        private MaterialButton CreateButton(string tval)
        {
            MaterialButton materialButton = new MaterialButton();

            materialButton.AutoSize                = false;
            materialButton.AutoSizeMode            = System.Windows.Forms.AutoSizeMode.GrowOnly;
            materialButton.Depth                   = 1;
            materialButton.DrawShadows             = true;
            materialButton.HighEmphasis            = true;
            materialButton.Location                = new System.Drawing.Point(filterbuttonoffset, 116);
            materialButton.Margin                  = new System.Windows.Forms.Padding(4, 6, 4, 6);
            materialButton.MouseState              = MaterialSkin.MouseState.HOVER;
            materialButton.Type                    = MaterialSkin.Controls.MaterialButton.MaterialButtonType.Contained;
            materialButton.UseAccentColor          = true;
            materialButton.UseVisualStyleBackColor = true;
            materialButton.Click                  += new System.EventHandler(this.deleteFilter_Click);

            materialButton.Name = "materialButton" + tval;
            materialButton.Text = tval;
            materialButton.Size = new System.Drawing.Size(TextWidth(materialButton, tval), 36);

            filterbuttonoffset += materialButton.Width + 10;

            return(materialButton);
        }
Esempio n. 12
0
 public static void UpdateStrokeColor(this MaterialButton platformButton, IButtonStroke buttonStroke)
 {
     if (buttonStroke.StrokeColor is Color stroke)
     {
         platformButton.StrokeColor = ColorStateListExtensions.CreateButton(stroke.ToPlatform());
     }
 }
Esempio n. 13
0
 public static void UpdateStrokeThickness(this MaterialButton platformButton, IButtonStroke buttonStroke)
 {
     if (buttonStroke.StrokeThickness >= 0)
     {
         platformButton.StrokeWidth = (int)platformButton.Context.ToPixels(buttonStroke.StrokeThickness);
     }
 }
Esempio n. 14
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.activityMain);

            _loadingLayout      = FindViewById <LinearLayout>(Resource.Id.layoutLoading);
            _emptyLayout        = FindViewById <LinearLayout>(Resource.Id.layoutEmpty);
            _disconnectedLayout = FindViewById <LinearLayout>(Resource.Id.layoutDisconnected);

            _retryButton        = FindViewById <MaterialButton>(Resource.Id.buttonRetry);
            _retryButton.Click += OnRetryClick;

            _authList = FindViewById <WearableRecyclerView>(Resource.Id.list);
            _authList.EdgeItemsCenteringEnabled = true;
            _authList.HasFixedSize = true;
            _authList.SetItemViewCacheSize(12);
            _authList.SetItemAnimator(null);

            var layoutCallback = new ScrollingListLayoutCallback(Resources.Configuration.IsScreenRound);

            _authList.SetLayoutManager(new WearableLinearLayoutManager(this, layoutCallback));

            _customIconCache = new CustomIconCache(this);

            _authListAdapter              = new AuthenticatorListAdapter(_customIconCache);
            _authListAdapter.ItemClick   += ItemClick;
            _authListAdapter.HasStableIds = true;
            _authList.SetAdapter(_authListAdapter);
        }
Esempio n. 15
0
        public int GetTimerButtonId(MaterialButton button)
        {
            int indexFirst = button.Text.IndexOf("[");
            int indexLast  = button.Text.IndexOf("]");

            return(Convert.ToInt32(button.Text.Substring(indexFirst, indexLast).Remove(0, 1)));
        }
Esempio n. 16
0
        public override async void OnViewCreated(View view, Bundle savedInstanceState)
        {
            ((IFragmentContainer)Activity).ShowLoadingView();
            ((IActionBarContainer)Activity).SetTitle(Resource.String.title_challenge);
            ((IActionBarContainer)Activity).Hide();

            _phoneTextView       = view.FindViewById <MaterialTextView>(Resource.Id.fragment_login_challenge_phone);
            _methodPhoneTextView = view.FindViewById <MaterialTextView>(Resource.Id.fragment_login_challenge_methods_phone);
            _methodEmailTextView = view.FindViewById <MaterialTextView>(Resource.Id.fragment_login_challenge_methods_email);

            _phoneInputLayout = view.FindViewById <TextInputLayout>(Resource.Id.fragment_login_challenge_phone_input_layout);
            _phoneEditText    = view.FindViewById <TextInputEditText>(Resource.Id.fragment_login_challenge_phone_input);

            _otpInputLayout = view.FindViewById <TextInputLayout>(Resource.Id.fragment_login_challenge_code_input_layout);
            _otpEditText    = view.FindViewById <TextInputEditText>(Resource.Id.fragment_login_challenge_code_input);

            _submitButton      = view.FindViewById <MaterialButton>(Resource.Id.fragment_login_challenge_submit);
            _resendButton      = view.FindViewById <MaterialButton>(Resource.Id.fragment_login_challenge_button_resend);
            _methodPhoneButton = view.FindViewById <MaterialButton>(Resource.Id.fragment_login_challenge_button_phone);
            _methodEmailButton = view.FindViewById <MaterialButton>(Resource.Id.fragment_login_challenge_button_email);

            _submitButton.Click      += SubmitButton_Click;
            _resendButton.Click      += ResendButton_Click;
            _methodPhoneButton.Click += PhoneButton_Click;
            _methodEmailButton.Click += EmailButton_Click;

            try
            {
                _challenge = await _account.StartChallengeAsync();

                if (_challenge.SubmitPhoneRequired)
                {
                    _submitButton.Visibility  = ViewStates.Visible;
                    _phoneTextView.Visibility = ViewStates.Visible;
                    return;
                }

                if (!string.IsNullOrEmpty(_challenge.StepData.PhoneNumber))
                {
                    _methodPhoneTextView.Text = GetString(Resource.String.msg_challenge_methods_phone,
                                                          _challenge.StepData.PhoneNumber);
                    _methodPhoneTextView.Visibility = ViewStates.Visible;
                    _methodPhoneButton.Visibility   = ViewStates.Visible;
                }

                if (!string.IsNullOrEmpty(_challenge.StepData.Email))
                {
                    _methodEmailTextView.Text = GetString(Resource.String.msg_challenge_methods_email,
                                                          _challenge.StepData.Email);
                    _methodEmailTextView.Visibility = ViewStates.Visible;
                    _methodEmailButton.Visibility   = ViewStates.Visible;
                }
            }
            catch (Exception ex)
            {
                ((IErrorHandler)Activity).ShowError(ex);
            }

            ((IFragmentContainer)Activity).ShowContentView();
        }
Esempio n. 17
0
        protected override void OnElementChanged(ElementChangedEventArgs <Button> e)
        {
            base.OnElementChanged(e);

            if (Control == null)
            {
                return;
            }

            if (e?.OldElement != null)
            {
                _helper.Clean();
            }

            if (e?.NewElement == null)
            {
                return;
            }

            _materialButton = (MaterialButton)Element;
            _helper         = new MaterialDrawableHelper(_materialButton, Control);
            _helper.UpdateDrawable();

            Control.SetMinimumWidth((int)MaterialHelper.ConvertDpToPx(64));
            Control.SetAllCaps(_materialButton != null && _materialButton.AllCaps);
            Control.SetMaxLines(1);

            SetTextColors();
        }
Esempio n. 18
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.ActivityActivity);

            list = FindViewById <RecyclerView>(Resource.Id.Activity);
            var lm = new LinearLayoutManager(this, LinearLayoutManager.Vertical, false);

            list.SetLayoutManager(lm);
            list.Visibility = ViewStates.Gone;

            adapter = new ActivityAdapter();
            list.SetAdapter(adapter);

            refresher            = FindViewById <SwipeRefreshLayout>(Resource.Id.Refresher);
            refresher.Refresh   += Refresher_Refresh;
            refresher.Refreshing = true;

            checkin            = FindViewById <MaterialButton>(Resource.Id.Checkin);
            checkin.Visibility = ViewStates.Gone;
            checkin.Click     += Checkin_Click;

            message = FindViewById <TextView>(Resource.Id.Message);

            GetData();

            StateHolder.Instance.OnCheckIn += () => GetData();
            StateHolder.Instance.OnNew     += () => GetData();
            StateHolder.Instance.OnRate    += ShowRate;
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var view = base.OnCreateView(inflater, container, savedInstanceState);

            SetupToolbar(view, Resource.String.prefPasswordTitle);

            _preferences = new PreferenceWrapper(Context);
            _hasPassword = _preferences.PasswordProtected;

            _progressBar = view.FindViewById <ProgressBar>(Resource.Id.appBarProgressBar);

            _setPasswordButton        = view.FindViewById <MaterialButton>(Resource.Id.buttonSetPassword);
            _setPasswordButton.Click += OnSetPasswordButtonClick;

            _passwordText              = view.FindViewById <TextInputEditText>(Resource.Id.editPassword);
            _passwordText.TextChanged += delegate { UpdateSetPasswordButton(); };

            _passwordConfirmLayout = view.FindViewById <TextInputLayout>(Resource.Id.editPasswordConfirmLayout);
            _passwordConfirmText   = view.FindViewById <TextInputEditText>(Resource.Id.editPasswordConfirm);
            TextInputUtil.EnableAutoErrorClear(_passwordConfirmLayout);

            _passwordConfirmText.EditorAction += (_, e) =>
            {
                if (_setPasswordButton.Enabled && e.ActionId == ImeAction.Done)
                {
                    OnSetPasswordButtonClick(null, null);
                }
            };

            _cancelButton        = view.FindViewById <MaterialButton>(Resource.Id.buttonCancel);
            _cancelButton.Click += delegate { Dismiss(); };

            UpdateSetPasswordButton();
            return(view);
        }
Esempio n. 20
0
        private MaterialButton CreateButton(string value)
        {
            var button = new MaterialButton(context);

            button.Text   = value;
            button.Click += Button_Click;
            return(button);
        }
Esempio n. 21
0
        public override void Draw(Canvas canvas)
        {
            MaterialButton materialButton = (MaterialButton)Element;

            Control.Elevation = materialButton.Elevation;

            base.Draw(canvas);
        }
Esempio n. 22
0
 private void ConnectViews(View view)
 {
     InputEmail         = view.FindViewById <TextInputEditText>(Resource.Id.InputEmail);
     BtnRegister        = view.FindViewById <MaterialButton>(Resource.Id.btnRegister);
     BtnLogin           = view.FindViewById <MaterialButton>(Resource.Id.BtnBackToLogin);
     BtnRegister.Click += BtnRegister_Click;
     BtnLogin.Click    += BtnLogin_Click;
 }
Esempio n. 23
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            MobileBarcodeScanner.Initialize(Application);

            Window.SetFlags(WindowManagerFlags.Secure, WindowManagerFlags.Secure);
            SetContentView(Resource.Layout.activityMain);

            if (savedInstanceState != null)
            {
                _isAuthenticated = savedInstanceState.GetBoolean("isAuthenticated");
                _pauseTime       = new DateTime(savedInstanceState.GetLong("pauseTime"));
            }
            else
            {
                _isAuthenticated = false;
                _pauseTime       = DateTime.MinValue;
            }

            _toolbar = FindViewById <MaterialToolbar>(Resource.Id.toolbar);
            SetSupportActionBar(_toolbar);
            SupportActionBar.SetTitle(Resource.String.categoryAll);

            var appBarLayout = FindViewById <AppBarLayout>(Resource.Id.appBarLayout);

            _bottomAppBar = FindViewById <BottomAppBar>(Resource.Id.bottomAppBar);
            _bottomAppBar.NavigationClick += OnBottomAppBarNavigationClick;
            _bottomAppBar.MenuItemClick   += delegate
            {
                _toolbar.Menu.FindItem(Resource.Id.actionSearch).ExpandActionView();
                appBarLayout.SetExpanded(true);
                _authList.SmoothScrollToPosition(0);
            };

            _coordinatorLayout = FindViewById <CoordinatorLayout>(Resource.Id.coordinatorLayout);
            _progressBar       = FindViewById <ProgressBar>(Resource.Id.appBarProgressBar);

            _addButton        = FindViewById <FloatingActionButton>(Resource.Id.buttonAdd);
            _addButton.Click += OnAddButtonClick;

            _authList               = FindViewById <RecyclerView>(Resource.Id.list);
            _emptyStateLayout       = FindViewById <LinearLayout>(Resource.Id.layoutEmptyState);
            _emptyMessageText       = FindViewById <TextView>(Resource.Id.textEmptyMessage);
            _viewGuideButton        = FindViewById <MaterialButton>(Resource.Id.buttonViewGuide);
            _viewGuideButton.Click += delegate { StartActivity(typeof(GuideActivity)); };

            _refreshOnActivityResume = false;

            DetectGoogleAPIsAvailability();

            var prefs       = PreferenceManager.GetDefaultSharedPreferences(this);
            var firstLaunch = prefs.GetBoolean("firstLaunch", true);

            if (firstLaunch)
            {
                StartActivity(typeof(IntroActivity));
            }
        }
Esempio n. 24
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var view = base.OnCreateView(inflater, container, savedInstanceState);

            SetupToolbar(view, Resource.String.prefAutoBackupTitle, true);

            _preferences = new PreferenceWrapper(Context);

            var selectLocationButton = view.FindViewById <LinearLayout>(Resource.Id.buttonSelectLocation);

            selectLocationButton.Click += OnSelectLocationClick;

            var setPasswordButton = view.FindViewById <LinearLayout>(Resource.Id.buttonSetPassword);

            setPasswordButton.Click += OnSetPasswordButtonClick;

            _locationStatusText = view.FindViewById <TextView>(Resource.Id.textLocationStatus);
            _passwordStatusText = view.FindViewById <TextView>(Resource.Id.textPasswordStatus);

            _backupNowButton        = view.FindViewById <MaterialButton>(Resource.Id.buttonBackupNow);
            _backupNowButton.Click += OnBackupNowButtonClick;

            _restoreNowButton        = view.FindViewById <MaterialButton>(Resource.Id.buttonRestoreNow);
            _restoreNowButton.Click += OnRestoreNowButtonClick;

            _okButton        = view.FindViewById <MaterialButton>(Resource.Id.buttonOk);
            _okButton.Click += delegate { Dismiss(); };

            void SwitchChecked(object sender, CompoundButton.CheckedChangeEventArgs args)
            {
                if (args.IsChecked)
                {
                    ShowBatteryOptimisationDialog();
                }
            }

            _backupEnabledSwitch = view.FindViewById <SwitchMaterial>(Resource.Id.switchBackupEnabled);
            _backupEnabledSwitch.CheckedChange += SwitchChecked;

            _restoreEnabledSwitch = view.FindViewById <SwitchMaterial>(Resource.Id.switchRestoreEnabled);
            _restoreEnabledSwitch.CheckedChange += SwitchChecked;

            UpdateLocationStatusText();
            UpdateSwitchesAndTriggerButton();

            if (_preferences.DatabasePasswordBackup)
            {
                setPasswordButton.Visibility = ViewStates.Gone;
            }
            else
            {
                UpdatePasswordStatusText();
            }

            return(view);
        }
 private void ConnectViews(View view)
 {
     context                = view.Context;
     SubmitAwareness        = view.FindViewById <MaterialButton>(Resource.Id.dlgBtnSubmiAwareness);
     AwarenessInput         = view.FindViewById <TextInputEditText>(Resource.Id.dlgInputAwareness);
     ImgAwareness           = view.FindViewById <ImageView>(Resource.Id.dlgImge);
     FabChoseImg            = view.FindViewById <FloatingActionButton>(Resource.Id.FabUploadImg);
     FabChoseImg.Click     += FabChoseImg_Click;
     SubmitAwareness.Click += SubmitAwareness_Click;
 }
Esempio n. 26
0
        public static void UpdateText(this MaterialButton platformButton, Button button)
        {
            var text = TextTransformUtilites.GetTransformedText(button.Text, button.TextTransform);

            platformButton.Text = text;

            // Content layout depends on whether or not the text is empty; changing the text means
            // we may need to update the content layout
            platformButton.UpdateContentLayout(button);
        }
Esempio n. 27
0
        public SecondPage()
        {
            InitializeComponent();
            MaterialButton btn = new MaterialButton {
                Text = "Welcome"
            };

            btn.Clicked += Btn_Clicked;
            stContainer.Children.Add(btn);
        }
Esempio n. 28
0
        public static void UpdateContentLayout(this MaterialButton materialButton, Button button)
        {
            var context = materialButton.Context;

            if (context == null)
            {
                return;
            }

            var icon = materialButton.Icon ??
                       TextViewCompat.GetCompoundDrawablesRelative(materialButton)[3];

            if (icon != null &&
                !String.IsNullOrEmpty(button.Text))
            {
                var contentLayout = button.ContentLayout;

                // IconPadding calls materialButton.CompoundDrawablePadding
                // Which is why we don't have to worry about calling setCompoundDrawablePadding
                // ourselves for our custom implemented IconGravityBottom
                materialButton.IconPadding = (int)context.ToPixels(contentLayout.Spacing);

                switch (contentLayout.Position)
                {
                case ButtonContentLayout.ImagePosition.Top:
                    materialButton.Icon        = icon;
                    materialButton.IconGravity = MaterialButton.IconGravityTop;
                    break;

                case ButtonContentLayout.ImagePosition.Bottom:
                    materialButton.Icon = null;
                    TextViewCompat.SetCompoundDrawablesRelative(materialButton, null, null, null, icon);
                    materialButton.IconGravity = MauiMaterialButton.IconGravityBottom;
                    break;

                case ButtonContentLayout.ImagePosition.Left:
                    materialButton.Icon        = icon;
                    materialButton.IconGravity = MaterialButton.IconGravityStart;
                    break;

                case ButtonContentLayout.ImagePosition.Right:
                    materialButton.Icon        = icon;
                    materialButton.IconGravity = MaterialButton.IconGravityEnd;
                    break;
                }
            }
            else
            {
                // Don't remove this otherwise the button occasionally measures wrong
                // on first load
                materialButton.Icon        = icon;
                materialButton.IconPadding = 0;
                materialButton.IconGravity = MaterialButton.IconGravityTextStart;
            }
        }
Esempio n. 29
0
#pragma warning restore 612, 618

        private async Task StartRadioAsync(string url, MaterialButton button, string notification)
        {
            var player = new RadioPlayer(this, url);
            await player.StartAsync();

            RadioService.SetPlayer(player, button.Id);
            StartService(_radioService);

            button.Icon = GetPlayerIcon(false);
            ShowNotification(notification);
        }
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activityUnlock);
            Window.SetSoftInputMode(SoftInput.AdjustPan);

            _preferences = new PreferenceWrapper(this);

            SetResult(Result.Canceled);

            _passwordLayout = FindViewById <TextInputLayout>(Resource.Id.editPasswordLayout);
            _passwordText   = FindViewById <TextInputEditText>(Resource.Id.editPassword);
            TextInputUtil.EnableAutoErrorClear(_passwordLayout);

            _passwordText.EditorAction += (_, e) =>
            {
                if (e.ActionId == ImeAction.Done)
                {
                    OnUnlockButtonClick(null, null);
                }
            };

            _passwordText.TextChanged += delegate
            {
                _unlockButton.Enabled = _passwordText.Text != "";
            };

            _unlockButton        = FindViewById <MaterialButton>(Resource.Id.buttonUnlock);
            _unlockButton.Click += OnUnlockButtonClick;

            var canUseBiometrics = false;

            if (_preferences.AllowBiometrics)
            {
                var biometricManager = BiometricManager.From(this);
                canUseBiometrics = biometricManager.CanAuthenticate() == BiometricManager.BiometricSuccess;
            }

            _useBiometricsButton         = FindViewById <MaterialButton>(Resource.Id.buttonUseBiometrics);
            _useBiometricsButton.Enabled = canUseBiometrics;
            _useBiometricsButton.Click  += delegate
            {
                ShowBiometricPrompt();
            };

            if (canUseBiometrics)
            {
                ShowBiometricPrompt();
            }
            else
            {
                await FocusPasswordText();
            }
        }