public TermsAndPrivacyRenderer(Context context) : base(context) { mainActivity = (MainActivity)Context; _androidCoordinatorLayout = (CoordinatorLayout)mainActivity.LayoutInflater.Inflate(Resource.Layout.TermsAndPrivacy, null); _androidAppBarLayout = _androidCoordinatorLayout.FindViewById <AppBarLayout>(Resource.Id.termsAppBar); toolbar = _androidAppBarLayout.FindViewById <Toolbar>(Resource.Id.termsToolBar); mainActivity?.SetSupportActionBar(toolbar); ActionBar actionBar = mainActivity?.SupportActionBar; if (actionBar != null) { actionBar.SetDisplayHomeAsUpEnabled(true); actionBar.SetDisplayShowHomeEnabled(true); actionBar.SetDisplayShowTitleEnabled(false); } viewPager = _androidCoordinatorLayout.FindViewById <ViewPager>(Resource.Id.pager); tabLayout = _androidAppBarLayout.FindViewById <TabLayout>(Resource.Id.tabLayout1); tabLayout.SetupWithViewPager(viewPager); }
void SetMainPage() { //FOR TESTING PURPOSES new Thread(() => { DataBase.CreateItems(); GeneralInfo.FillDatas("softsam"); }).Start(); Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab); fab.Click += FabOnClick; DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, Resource.String.navigation_drawer_open, Resource.String.navigation_drawer_close); drawer.AddDrawerListener(toggle); toggle.SyncState(); NavigationView navigationView = FindViewById <NavigationView>(Resource.Id.nav_view); var header = navigationView.GetHeaderView(0); TextView lblName = header.FindViewById <TextView>(Resource.Id.lblUserName); TextView lblemail = header.FindViewById <TextView>(Resource.Id.lblUserEmail); if (GeneralInfo.UserConnected) { lblName.Text = GeneralInfo.customerAccount.UserName; lblemail.Text = GeneralInfo.customerAccount.EMail; Toast.MakeText(this, "User connected...", ToastLength.Short); } else { lblName.Text = "No User"; lblemail.Text = "No User"; Toast.MakeText(this, "User did not connected...", ToastLength.Short); } navigationView.SetNavigationItemSelectedListener(this); CoordinatorLayout appBarMain = FindViewById <CoordinatorLayout>(Resource.Id.appBarMain); RelativeLayout contentMainLayout = appBarMain.FindViewById <RelativeLayout>(Resource.Id.contentMain); ScrollView scrollViewContent = contentMainLayout.FindViewById <ScrollView>(Resource.Id.gridContentInc); GridLayout gridLayout = scrollViewContent.FindViewById <GridLayout>(Resource.Id.gridContent); LinearLayout _template = gridLayout.FindViewById <LinearLayout>(Resource.Id.basicCart); mainLayout = gridLayout; template = _template; connection = DataBase.CheckConnection(); var products = connection.Table <Product>(); CreateItems(products); }