protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); //intialize facebook sdk before setcontentview() FacebookSdk.SdkInitialize(this.ApplicationContext); mProfileTracker = new MyProfileTracker(); mProfileTracker.mOnProfileChanged += MProfileTracker_mOnProfileChanged; //start listenning to the profile mProfileTracker.StartTracking(); // checking user is loged in with facebook in android if (AccessToken.CurrentAccessToken != null && Xamarin.Facebook.Profile.CurrentProfile != null) { // the user is loged in by face book StartActivity(typeof(HomePage)); this.Finish(); } SetContentView(Resource.Layout.user_login); SupportActionBar.Title = "Login"; SupportActionBar.SetDisplayHomeAsUpEnabled(true); //login button RoadWheels roadWheelsUserLoginBTN = FindViewById <Button>(Resource.Id.loginSubmitBtn); //facebook login Button myFacebookLoginBtn = FindViewById <Button>(Resource.Id.loginFacebookBtn); //edit text for email and mobile number emailOrMobNumber = FindViewById <EditText>(Resource.Id.userEmailIdOrPhone); passwordEditText = FindViewById <EditText>(Resource.Id.userPassord); roadWheelsUserLoginBTN.Click += RoadWheelsUserLoginBTN_Click; mCallbackManager = CallbackManagerFactory.Create(); LoginManager.Instance.RegisterCallback(mCallbackManager, this); myFacebookLoginBtn.Click += MyFacebookLoginBtn_Click; }
private void IntializeUI(Bundle savestate) { EnableLocationDialog(); FacebookSdk.SdkInitialize(this.ApplicationContext); mProfileTracker = new MyProfileTracker(); SetContentView(Resource.Layout.home_page); toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.Title = "HOME"; var navigationView = FindViewById <NavigationView>(Resource.Id.nav_views); View headerview = navigationView.InflateHeaderView(Resource.Layout.drawer_header); UserName = headerview.FindViewById <TextView>(Resource.Id.userName); UserImage = headerview.FindViewById <ImageView>(Resource.Id.userImage); ISharedPreferences prefs = this.GetSharedPreferences("MYPROFILE", FileCreationMode.Private); if (prefs.GetString("username", "") != null && prefs.GetString("profilePic", "") != null) { UserImage.Visibility = ViewStates.Gone; ProfilePictureView fbProfilePicture = headerview.FindViewById <ProfilePictureView>(Resource.Id.facebook_profile_pic); fbProfilePicture.Visibility = ViewStates.Visible; string name = prefs.GetString("username", ""); string profilePic = prefs.GetString("profilepic", ""); UserName.Text = name; fbProfilePicture.ProfileId = profilePic; } TextView userLocationView = headerview.FindViewById <TextView>(Resource.Id.userLocation); userLocationView.Click += UserLocationView_Click; drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawerLayout); var drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, Resource.String.drawer_open, Resource.String.drawer_close); drawerLayout.AddDrawerListener(drawerToggle); drawerToggle.SyncState(); //SupportActionBar.Show(); // FindViewById<Button>(Resource.Id.button1).Click += HomePage_Click; iconList.Add(Resource.Raw.ic_bike); iconList.Add(Resource.Raw.ic_bike); iconList.Add(Resource.Raw.ic_service); iconList.Add(Resource.Raw.ic_gallery); dotslayout = FindViewById <LinearLayout>(Resource.Id.HomePageDotsContainer); imagePager = FindViewById <ViewPager>(Resource.Id.homePageImagePagerContainer); homeRView = FindViewById <RecyclerView>(Resource.Id.homePageRView); _layoutManager = new GridLayoutManager(this, 2); homeRView.SetLayoutManager(_layoutManager); RecycleHomeIconAdapter RVadapter = new RecycleHomeIconAdapter(this, iconList, iconNameList); homeRView.SetAdapter(RVadapter); RVadapter.ItemClick += RVadapter_ItemClick; imageList.Add(Resource.Raw.image1); imageList.Add(Resource.Raw.image4); imageList.Add(Resource.Raw.image2); PageImageAdapter adapter = new PageImageAdapter(this, imageList); imagePager.Adapter = adapter; imagePager.SetCurrentItem(0, true); imagePager.AddOnPageChangeListener(this); setUiPageViewController(); Bundle savestates = new Bundle(); // _bottomNavBar = BottomBar.Attach(this, bundle); _bottomNavBar = BottomBar.AttachShy((CoordinatorLayout)FindViewById(Resource.Id.homePageCoordinatorLayout), FindViewById(Resource.Id.homePageScrollingContent), savestates); _bottomNavBar.SetItems(Resource.Menu.bottomMenuBar); _bottomNavBar.SetOnMenuTabClickListener(this); navigationView.NavigationItemSelected += NavigationView_NavigationItemSelected; }