Beispiel #1
0
        /*
         *      private void OnButtonClick(object sender, EventArgs e)
         *      {
         *          if (sender is AppCompatImageButton imgButton)
         *              Toast.MakeText(this, (string)imgButton.Tag, ToastLength.Short).Show();
         *
         *      }
         */


        private void SetUpToolbar()
        {
            // Not having raised AppBar area, so don't set SupportActionBar
            //SetSupportActionBar(_toolbar);

            // Set the page Title - Required because of the way that Android sets up app asset names
            _toolbar.Title = null;  // using the custom title so it can be centered
            SetToolbarCustomTitle(ViewModel.Response.Name);
            // Set the subtitle
            //            SetToolbarCustomSubtitle("Subtitle");
            //            _toolbar.Subtitle = "Subtitle";
            var closeIcon = ResourcesCompat.GetDrawable(Resources, Resource.Drawable.lclose, null).Mutate();

            DrawableCompat.SetTint(closeIcon, Color.White);
            _toolbar.NavigationIcon = closeIcon;

            var toolbarColor = Constants.GetIconSettingsFromTitle(this, ViewModel.Response.Name).Item2;

            Window.SetStatusBarColor(toolbarColor);
            _toolbar.SetBackgroundColor(toolbarColor);

            // Set toolbar title colors
            _toolbar.SetTitleTextColor(Color.White);
            _toolbar.SetSubtitleTextColor(Color.White);
            SetToolbarCustomTitleColor(Color.White);
            SetToolbarCustomSubtitleColor(Color.White);
        }
Beispiel #2
0
        private void InitToolbar()
        {
            try
            {
                TopChatToolBar = FindViewById <Toolbar>(Resource.Id.toolbar);
                if (TopChatToolBar != null)
                {
                    TopChatToolBar.SetTitleTextColor(AppSettings.SetTabDarkTheme ? Color.White : Color.Black);
                    TopChatToolBar.SetSubtitleTextColor(AppSettings.SetTabDarkTheme ? Color.White : Color.Black);
                    SetSupportActionBar(TopChatToolBar);
                    SupportActionBar.SetDisplayShowCustomEnabled(true);
                    SupportActionBar.SetDisplayHomeAsUpEnabled(true);
                    SupportActionBar.SetHomeButtonEnabled(true);
                    SupportActionBar.SetDisplayShowHomeEnabled(true);

                    TopChatToolBar.SetBackgroundResource(AppSettings.SetTabDarkTheme ? Resource.Drawable.linear_gradient_drawable_Dark : Resource.Drawable.linear_gradient_drawable);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Beispiel #3
0
/*
 *      private void OnButtonClick(object sender, EventArgs e)
 *      {
 *          if (sender is AppCompatImageButton imgButton)
 *              Toast.MakeText(this, (string)imgButton.Tag, ToastLength.Short).Show();
 *
 *      }
 */


        private void SetUpToolbar()
        {
            // Not having raised AppBar area, so don't set SupportActionBar
            //SetSupportActionBar(_toolbar);

            // Set the page Title - Required because of the way that Android sets up app asset names
            _toolbar.Title = null;  // using the custom title so it can be centered
            SetToolbarCustomTitle(Resources.GetString(Resource.String.app_name));
            // Set the subtitle
//            SetToolbarCustomSubtitle("Subtitle");
//            _toolbar.Subtitle = "Subtitle";

            //Set toolbar title colors
            Color col = new Color(ContextCompat.GetColor(this, Resource.Color.app_blue));

            _toolbar.SetTitleTextColor(col);
            _toolbar.SetSubtitleTextColor(col);
            SetToolbarCustomTitleColor(col);
            SetToolbarCustomSubtitleColor(col);

            // Manually add the menu to the toolbar and set the menu item click event(not done automatically because not setting SupportActionBar)
            OnCreateOptionsMenu(_toolbar.Menu);
        }