protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.MyHealth_Main); //toolbar = (Toolbar)FindViewById (Resource.Id.tool_bar); //SetActionBar (toolbar); /*listData = new ListDataHolder (); recyclerView = FindViewById <RecyclerView> (Resource.Id.recyclerView); mLayoutManager = new LinearLayoutManager (this); recyclerView.SetLayoutManager (mLayoutManager); recyclerAdapter = new RecyclerViewAdapter (this, listData); recyclerView.SetAdapter (recyclerAdapter);*/ adapter = new MyHealth_ViewPagerAdapter (SupportFragmentManager); pager = FindViewById <ViewPager> (Resource.Id.pager); pager.Adapter = adapter; tabs = FindViewById<MyHealth_SlidingTabScrollView> (Resource.Id.tabs); tabs.ViewPager = pager; toolbar = FindViewById<Android.Support.V7.Widget.Toolbar> (Resource.Id.app_bar); toolbar.SetBackgroundColor (Color.ParseColor ("#009688")); SetSupportActionBar (toolbar); }
/* * 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); }
private void OnCollapsed(int verticalOffset) { if (appbarLayout.TotalScrollRange + verticalOffset == 0) { toolbar.SetBackgroundColor(Resources.GetColor(Resource.Color.primary, default(Android.Content.Res.Resources.Theme))); } else { toolbar.SetBackgroundColor(Color.Transparent); } if (isCollapsed) { return; } isInAnimation = true; titleAnimator.AnimateHide(Resources.GetString(Resource.String.application_name), OnEvaluated); accountFabAnimator.AnimateHide(); adAnimator.AnimateHide(); isCollapsed = true; isInAnimation = false; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.overview); //ActionBar.Hide(); if (Intent.Extras != null && Intent.Extras.ContainsKey(PassWebsiteKey)) { currentWebsite = Config.GetWebsite(currentWebsiteKey = Intent.Extras.GetString(PassWebsiteKey)); } browsingContext = OverviewType.IndexPage; analysisModule.ReadIndexPage(UidGenerator(), currentWebsiteKey, refreshingLink = currentWebsite.IndexPageLink, this); //make the request ChangeStatusBarColor(Window, currentWebsite.Color); toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.overviewToolbar); appBarLayout = FindViewById <AppBarLayout>(Resource.Id.overviewAppbar); toolbar.SetBackgroundColor(Android.Graphics.Color.ParseColor(currentWebsite.Color)); appBarLayout.SetBackgroundColor(Android.Graphics.Color.ParseColor(currentWebsite.Color)); toolbar.Title = currentWebsite.Name; swipeRefLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.swiperefresh); swipeRefLayout.Refresh += SwipeRefLayout_Refresh; swipeRefLayout.SetColorSchemeColors(new int[] { Android.Graphics.Color.ParseColor(currentWebsite.Color).ToArgb() }); drawerLayout = FindViewById <DrawerLayout>(Resource.Id.overviewDrawerLayout); navListview = FindViewById <ListView>(Resource.Id.navigationDrawerListView); navData = new string[currentWebsite.Categories.Length]; int index = 0; foreach (var item in currentWebsite.Categories) { navData[index++] = item.Name; } navAdapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, navData); navListview.Adapter = navAdapter; navListview.ItemClick += NavListview_ItemClick; recyView = FindViewById <RecyclerView>(Resource.Id.overviewRecyclerView); recyView.SetLayoutManager(recyLayoutManager = new LinearLayoutManager(this, (int)Orientation.Vertical, false)); recyView.SetAdapter(adapter = new RecyclerViewAdpater(currentWebsite)); adapter.OnItemClick += RecyclerView_OnItemClick; adapter.LoadNextPage += (sender, e) => LoadNextPage(); }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.MySoal_MainPager); adapter = new MySoal_ViewPagerAdapter (SupportFragmentManager); mDrawerLayout = FindViewById<DrawerLayout> (Resource.Id.myDrawer); mDrawerToggle = new Android.Support.V7.App.ActionBarDrawerToggle (this, mDrawerLayout, Resource.String.open_drawer, Resource.String.close_drawer); mDrawerLayout.SetDrawerListener (mDrawerToggle); leftListView = (LinearLayout)FindViewById (Resource.Id.leftListView); lvMMLListed = (ListView)FindViewById (Resource.Id.lvMMLListed); pager = FindViewById <ViewPager> (Resource.Id.pager); pager.Adapter = adapter; tabs = FindViewById<MySoal_SlidingTabScrollView> (Resource.Id.tabs); tabs.ViewPager = pager; toolbar = FindViewById<Android.Support.V7.Widget.Toolbar> (Resource.Id.app_bar); toolbar.SetBackgroundColor (Color.ParseColor ("#F44336")); SetSupportActionBar (toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled (true); SupportActionBar.SetHomeButtonEnabled (true); SupportActionBar.SetDisplayShowTitleEnabled (true); MenuListItem = new List<LeftMenuListItems> (); MenuListItem.Add (new LeftMenuListItems(){ LeftMenuDrawerLabel = "Dashboard", LeftMenuDrawerIconID = Resource.Drawable.home3 }); MenuListItem.Add (new LeftMenuListItems(){ LeftMenuDrawerLabel = "My Soal", LeftMenuDrawerIconID = Resource.Drawable.cup2 }); MenuListItem.Add (new LeftMenuListItems(){ LeftMenuDrawerLabel = "My Health", LeftMenuDrawerIconID = Resource.Drawable.heart2 }); MenuListItem.Add (new LeftMenuListItems(){ LeftMenuDrawerLabel = "My Skool", LeftMenuDrawerIconID = Resource.Drawable.shield2 }); lvMMLListed.Adapter = new MainActivityAdapters (this, MenuListItem); }
private void My_sensors_ItemLongClick(object sender, AdapterView.ItemLongClickEventArgs e) { selected = my_sensors.GetItemAtPosition(e.Position).ToString(); Toast.MakeText(this, "Длинное нажатие", ToastLength.Short).Show(); LinearLayout.LayoutParams toolBarParams = new LinearLayout.LayoutParams(V7ToolBar.LayoutParams.MatchParent, 150); LinearLayout.LayoutParams appBarParams = new LinearLayout.LayoutParams(BarLayout.LayoutParams.MatchParent, Resource.Attribute.actionBarSize); toolBar = new V7ToolBar(this); toolBar.LayoutParameters = toolBarParams; toolBar.SetBackgroundColor(Color.Black); toolBar.SetTitle(Resource.String.my_sensors_toolbar_title); toolBar.SetTitleTextColor(Color.White); toolBar.Visibility = ViewStates.Visible; toolBar.PopupTheme = Resource.Style.AppTheme_PopupOverlay; barLayout.AddView(toolBar, 0); SetSupportActionBar(toolBar); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.offline); recyclerView = FindViewById <RecyclerView>(Resource.Id.offlineRecyclerView); recyclerView.SetLayoutManager(recyLayoutManager = new LinearLayoutManager(this, (int)Orientation.Vertical, false)); recyclerView.SetAdapter(adapter = new RecyAdapter()); adapter.OnItemClick += Adapter_OnItemClick; toolbar = FindViewById <widget.Toolbar>(Resource.Id.offlineToolbar); toolbar.Title = "Offline"; toolbar.SetBackgroundColor(Android.Graphics.Color.ParseColor("#4CAF50")); toolbar.SetTitleTextColor(Android.Graphics.Color.ParseColor("#ffffff")); MyGlobal.ChangeStatusBarColor(Window, "#4CAF50"); MyGlobal.database.GetAllOfflineArticalList(MyGlobal.UidGenerator(), this); }
// Set up the Activity's Views public void SetUpVariables() { progressBar = FindViewById <ProgressBar>(Resource.Id.progress_bar_portfolio_summary); progressBar.Visibility = ViewStates.Visible; mRecyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerview_ps); mLayoutManager = new LinearLayoutManager(this); swipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.swipe_to_refresh_portfolio_summary); swipeRefreshLayout.SetColorSchemeResources(Resource.Color.blue, Resource.Color.purple, Resource.Color.red, Resource.Color.green); swipeRefreshLayout.Refresh += delegate { Task.Run(async() => { try { items = await MKFApp.Current.GetRiskSummary(); this.RunOnUiThread(() => DisplayRefresher()); } catch (Exception e) { this.RunOnUiThread(() => DismissRefresher()); } }); }; Task.Run(async() => { try { items = await MKFApp.Current.GetRiskSummary(); this.RunOnUiThread(() => Display()); } catch (Exception e) { Console.Write(e); this.RunOnUiThread(() => Dismiss()); } }); linearLayout = FindViewById <LinearLayout>(lucid.Resource.Id.home_linear_layout); drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); // Create ActionBarDrawerToggle button and add it to the toolbar V7Toolbar toolbar = FindViewById <V7Toolbar>(Resource.Id.toolbar); toolbar.SetBackgroundColor(MainActivity.TOOLBAR_COLOR); SetSupportActionBar(toolbar); var drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, Resource.String.drawer_open, Resource.String.drawer_close); drawerLayout.AddDrawerListener(drawerToggle); drawerToggle.SyncState(); navigationView = FindViewById <NavigationView>(Resource.Id.nav_view); View headerView = navigationView.GetHeaderView(0); headerView.SetBackgroundColor(MainActivity.TOOLBAR_COLOR); username = headerView.FindViewById <TextView>(Resource.Id.header_username); username.Text = Intent.GetStringExtra("username") ?? "Username not Found"; SetupDrawerContent(navigationView); //Calling Function Task.Run(() => { timer = new Timer(INTERVAL); COUNTDOWN = INITIAL; timer.Elapsed += Timer_Elapsed; timer.Start(); }); }
public static void SetTheme(this Toolbar toolbar, string backgroundColor, int todo) { toolbar.SetBackgroundColor(_theme.Colors[backgroundColor]); }