private int CurrentSelectedNavigation(SupportFragment currentFragment) { SupportActionBar ab = SupportActionBar;//instantiate actionbar int returnValue = 0; if (currentFragment == mCheckoutFragment) { ab.SetTitle(Resource.String.checkout_title);//set title of actionbar returnValue = Resource.Id.nav_checkout; } else if (currentFragment == mProductsFragment) { ab.SetTitle(Resource.String.products_title); returnValue = Resource.Id.nav_products; } else if (currentFragment == mCustomersFragment) { ab.SetTitle(Resource.String.customers_title); returnValue = Resource.Id.nav_customers; } else if (currentFragment == mTransactionsFragment) { ab.SetTitle(Resource.String.transactions_title); returnValue = Resource.Id.nav_transactions; } else if (currentFragment == mSettingsFragment) { ab.SetTitle(Resource.String.settings_title); returnValue = Resource.Id.nav_settings; } return(returnValue); }
private void SetUpDrawerContent(NavigationView navigationView) { navigationView.NavigationItemSelected += (object sender, NavigationView.NavigationItemSelectedEventArgs e) => { InvalidateOptionsMenu();//redraw toolbar Menu e.MenuItem.SetChecked(true); SupportActionBar ab = SupportActionBar; switch (e.MenuItem.ItemId) { case (Resource.Id.nav_checkout): ShowFragment(mCheckoutFragment); RefreshItemListOnCheckout(); ab.SetTitle(Resource.String.checkout_title); break; case (Resource.Id.nav_products): ShowFragment(mProductsFragment); var productlist = mProductsDataAccess.SelectTable(); int productCount = productlist != null ? productlist.Count : 0; ab.Title = "PRODUCTS (" + productCount.ToString() + ")"; break; case (Resource.Id.nav_customers): ShowFragment(mCustomersFragment); //refresh list here ab.SetTitle(Resource.String.customers_title); break; case (Resource.Id.nav_runners): ShowFragment(mRunnersFragment); //refresh list here ab.SetTitle(Resource.String.runners_title); break; case (Resource.Id.nav_transactions): ShowFragment(mTransactionsFragment); //refresh list here mTransactionsFragment.RedrawView(); ab.SetTitle(Resource.String.transactions_title); break; case (Resource.Id.nav_settings): ShowFragment(mSettingsFragment); ab.SetTitle(Resource.String.settings_title); break; } mDrawerLayout.CloseDrawers(); }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.checkout_fragment_cart); mToolBar = FindViewById <SupportToolbar>(Resource.Id.toolBarCheckoutCart); SetSupportActionBar(mToolBar); SupportActionBar actionBar = SupportActionBar; //actionBar.SetHomeAsUpIndicator(Resource.Drawable.left_icon_thin); actionBar.SetDisplayHomeAsUpEnabled(true); actionBar.SetDisplayShowHomeEnabled(true); actionBar.SetTitle(Resource.String.checkout_cart_title); //get screendensity mDpVal = this.Resources.DisplayMetrics.Density; lvCartItemList = FindViewById <ExpandableListView>(Resource.Id.lvCheckoutCartItemList); rlCheckoutCartButtonContainer = FindViewById <LinearLayout>(Resource.Id.rlCheckoutCartButtonContainer); mBtnCartTotal = FindViewById <Button>(Resource.Id.btnCheckoutCartTotal); mBtnCartTotal.Click += MBtnCartTotal_Click; SetCheckoutButtonTotal(mBtnCartTotal, this); mBtnMoreOptions = FindViewById <ImageButton>(Resource.Id.btnCheckoutCartClear); mBtnMoreOptions.Click += MBtnMoreOptions_Click; // Prepare list data FnGetListData(); FnSetUpListView(); FnClickEvents(); Window.DecorView.Post(() => { SetRecyclerViewLayoutHeight(lvCartItemList, mToolBar); }); }
protected override void OnCreate(Bundle savedInstanceState) { //Status Bar Color this.Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds); Console.WriteLine("Status Bar Color! "); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Main); drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); // Init toolbar var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.app_bar); SetSupportActionBar(toolbar); SupportActionBar.SetTitle(Resource.String.product_name); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetDisplayShowHomeEnabled(true); // Attach item selected handler to navigation view var navigationView = FindViewById <NavigationView>(Resource.Id.nav_view); navigationView.NavigationItemSelected += NavigationView_NavigationItemSelected; // Create ActionBarDrawerToggle button and add it to the toolbar var drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, Resource.String.open_drawer, Resource.String.close_drawer); //Linea corregida de Set a Add porque era obsoleta drawerLayout.AddDrawerListener(drawerToggle); drawerToggle.SyncState(); homeFragment = new HomeFragment(); writeFragment = new WriteFragment(); productsFragment = new ProductsFragment(); cartFragment = new CartFragment(); corridaFinancieraFragment = new CorridaFinancieraFragment(); mStackFragment = new Stack <Fragment>(); //load default home screen //var ft = FragmentManager.BeginTransaction(); //ft.AddToBackStack(null); //ft.Add(Resource.Id.HomeFrameLayout, new HomeFragment()); //ft.Commit(); var trans = FragmentManager.BeginTransaction(); //trans.AddToBackStack(null); trans.Add(Resource.Id.HomeFrameLayout, cartFragment, "Carrito Compras"); trans.Hide(cartFragment); trans.Add(Resource.Id.HomeFrameLayout, corridaFinancieraFragment, "Corrida Financiera"); trans.Hide(corridaFinancieraFragment); trans.Add(Resource.Id.HomeFrameLayout, homeFragment, "Home"); trans.Hide(homeFragment); trans.Add(Resource.Id.HomeFrameLayout, writeFragment, "pesan"); trans.Hide(writeFragment); trans.Add(Resource.Id.HomeFrameLayout, productsFragment, "Productos"); trans.Commit(); mCurrentFragment = productsFragment; }
//define action for navigation menu selection void NavigationView_NavigationItemSelected(object sender, NavigationView.NavigationItemSelectedEventArgs e) { switch (e.MenuItem.ItemId) { case (Resource.Id.nav_home): SupportActionBar.SetTitle(Resource.String.product_name); Toast.MakeText(this, "Home selected!", ToastLength.Short).Show(); ShowFragment(productsFragment); break; case (Resource.Id.nav_messages): SupportActionBar.SetTitle(Resource.String.cart_name); Toast.MakeText(this, "Cart Selected!", ToastLength.Short).Show(); ShowFragment(cartFragment); break; case (Resource.Id.nav_friends): // React on 'Friends' selection SupportActionBar.SetTitle(Resource.String.corrida_name); ShowFragment(corridaFinancieraFragment); break; } // Close drawer drawerLayout.CloseDrawers(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.frequently_asked_quest); mToolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolBar); mWebViewer = FindViewById <Android.Webkit.WebView>(Resource.Id.webView); mProgressbar = FindViewById <ProgressBar>(Resource.Id.progressBar); SetSupportActionBar(mToolbar); SupportActionBar ab = SupportActionBar; ab.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetTitle(Resource.String.menu_faq); // Makes Progress bar Visible var webclient = new MyClient(this); mWebViewer.SetWebViewClient(webclient); mWebViewer.ClearCache(true); mWebViewer.NestedScrollingEnabled = false; //mWebViewer. mWebViewer.Settings.JavaScriptEnabled = true; mWebViewer.LoadUrl("https://safari-shoppers.firebaseapp.com/faq.html"); }
private void GameButton_Click(object sender, NavigationView.NavigationItemSelectedEventArgs eventArgs) { SupportActionBar.SetTitle(Resource.String.game); GameFragment fragment = new GameFragment(); var fragmentTransaction = FragmentManager.BeginTransaction(); fragmentTransaction.Replace(Resource.Id.fragmentContainer, fragment); fragmentTransaction.Commit(); }
private void setUpToolbar() { mToolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolBar); mToolbar.InflateMenu(Resource.Menu.menu_shopping); SetSupportActionBar(mToolbar); SupportActionBar ab = SupportActionBar; ab.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetTitle(Resource.String.menu_categories); }
private void SetUpDrawerContent(NavigationView navigationView) { navigationView.NavigationItemSelected += (object sender, NavigationView.NavigationItemSelectedEventArgs e) => { InvalidateOptionsMenu();//redraw toolbar Menu e.MenuItem.SetChecked(true); SupportActionBar ab = SupportActionBar; switch (e.MenuItem.ItemId) { case (Resource.Id.nav_checkout): ShowFragment(mCheckoutFragment); ab.SetTitle(Resource.String.checkout_title); break; case (Resource.Id.nav_products): ShowFragment(mProductsFragment); ab.SetTitle(Resource.String.products_title); break; case (Resource.Id.nav_customers): ShowFragment(mCustomersFragment); ab.SetTitle(Resource.String.customers_title); break; case (Resource.Id.nav_transactions): ShowFragment(mTransactionsFragment); ab.SetTitle(Resource.String.transactions_title); break; case (Resource.Id.nav_settings): ShowFragment(mSettingsFragment); ab.SetTitle(Resource.String.settings_title); break; } mDrawerLayout.CloseDrawers(); }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); mCheckoutFragment = new CheckoutFragment(); mProductsFragment = new ProductsFragment(); mCustomersFragment = new CustomersFragment(); mTransactionsFragment = new TransactionsFragment(); mSettingsFragment = new SettingsFragment(); mStackFragment = new Stack <SupportFragment>(); SupportToolbar toolBar = FindViewById <SupportToolbar>(Resource.Id.main_toolbar); SetSupportActionBar(toolBar); SupportActionBar ab = SupportActionBar; ab.SetHomeAsUpIndicator(Resource.Drawable.menu_icon_small); ab.SetDisplayHomeAsUpEnabled(true); ab.SetTitle(Resource.String.checkout_title); mDrawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); NavigationView navigationView = FindViewById <NavigationView>(Resource.Id.nav_view); if (navigationView != null) { SetUpDrawerContent(navigationView); } var trans = SupportFragmentManager.BeginTransaction(); trans.Add(Resource.Id.fragmentContainer, mSettingsFragment, "SettingsFragment"); trans.Hide(mSettingsFragment); trans.Add(Resource.Id.fragmentContainer, mTransactionsFragment, "TransactionsFragment"); trans.Hide(mTransactionsFragment); trans.Add(Resource.Id.fragmentContainer, mCustomersFragment, "CustomersFragment"); trans.Hide(mCustomersFragment); trans.Add(Resource.Id.fragmentContainer, mProductsFragment, "ProductsFragment"); trans.Hide(mProductsFragment); trans.Add(Resource.Id.fragmentContainer, mCheckoutFragment, "CheckoutFragment"); trans.Commit(); mCurrentFragment = mCheckoutFragment; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.settings_fragment_devices_list); FnGetData(); mToolBar = FindViewById <SupportToolbar>(Resource.Id.toolBarPrinterList); SetSupportActionBar(mToolBar); SupportActionBar actionBar = SupportActionBar; //actionBar.SetHomeAsUpIndicator(Resource.Drawable.left_icon_thin); actionBar.SetDisplayHomeAsUpEnabled(true); actionBar.SetDisplayShowHomeEnabled(true); actionBar.SetTitle(Resource.String.settings_select_printer); mListViewPrinters = FindViewById <ListView>(Resource.Id.lvBluetoothDevicesList); mListViewPrinters.ItemClick += MListViewPrinters_ItemClick; LoadPrinterList(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.settings_fragment_selected_printer); FnGetData(); mToolBar = FindViewById <SupportToolbar>(Resource.Id.toolBarPrinterSelectedPrinter); SetSupportActionBar(mToolBar); SupportActionBar actionBar = SupportActionBar; //actionBar.SetHomeAsUpIndicator(Resource.Drawable.left_icon_thin); actionBar.SetDisplayHomeAsUpEnabled(true); actionBar.SetDisplayShowHomeEnabled(true); actionBar.SetTitle(Resource.String.settings_select_printer); mBtnTestPrint = FindViewById <Button>(Resource.Id.btnTestPrint); mBtnTestPrint.Click += new SingleClickListener(MBtnTestPrint_Click).OnClick; mTxtSelectedPrinterName = FindViewById <TextView>(Resource.Id.txtPrinterName); mTxtSelectedPrinterName.Text = mSettingsDataAccess.SelectTable()[0].ReceiptPrinterName; }
private void ShowFragment(SupportFragment fragment) { if (fragment.IsVisible) { return; } SupportActionBar.SetTitle(Resource.String.settingsDrawer); var trans = SupportFragmentManager.BeginTransaction(); trans.SetCustomAnimations(Resource.Animation.slide_right, Resource.Animation.slide_right, Resource.Animation.slide_right, Resource.Animation.slide_right); trans.Hide(mCurrentFragment); trans.Show(fragment); trans.AddToBackStack(null); trans.Commit(); mStackFragment.Push(mCurrentFragment); mCurrentFragment = fragment; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.notification_activity); mToolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolBar); mRecyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView); mProgressbar = FindViewById <ProgressBar>(Resource.Id.progressBar); SetSupportActionBar(mToolbar); SupportActionBar ab = SupportActionBar; ab.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetTitle(Resource.String.menu_notification); InitDecoration(); var notification = GetNotification(); InitRecyclerView(mRecyclerView, notification); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.AddEdit); //catch passed layout string mLoadView = Intent.Extras.Get("LoadView").ToString(); //catch passed if passedId = Convert.ToInt32(Intent.Extras.Get("PassedId").ToString()); SupportToolbar toolBar = FindViewById <SupportToolbar>(Resource.Id.toolBar); SetSupportActionBar(toolBar); SupportActionBar ab = SupportActionBar; ab.SetDisplayHomeAsUpEnabled(true); ab.SetHomeButtonEnabled(true); ab.SetDisplayShowTitleEnabled(true); ab.SetTitle(Resource.String.viewActivityTitle); //Get Fragment Title Holder mFragTitle = FindViewById <TextView>(Resource.Id.textFragmentTitle); //Get Fragment Holder mFrameLayout = Resource.Id.fragmentContainer; //instantiate fragments mViewShoppingItemFrag = new ViewShoppingItemFragment(); mStackFrag = new Stack <SupportFragment>(); LoadView(mLoadView); }