private void SetRecyclerViewAdapters(View view) { try { MoreRecylerView = (RecyclerView)view.FindViewById(Resource.Id.Recyler); MoreRecylerView.NestedScrollingEnabled = true; if (AppSettings.MoreTheme == MoreTheme.BeautyTheme) { var layoutManager = new GridLayoutManager(Activity, 4); MoreSectionAdapterTheme2 = new MoreSectionAdapterTheme2(Activity); var countListFirstRow = MoreSectionAdapterTheme2.SectionList.Where(q => q.StyleRow == 0).ToList().Count; layoutManager.SetSpanSizeLookup(new MySpanSizeLookup2(countListFirstRow, 1, 4));//20, 1, 4 MoreRecylerView.SetLayoutManager(layoutManager); MoreRecylerView.SetAdapter(MoreSectionAdapterTheme2); } else { MoreRecylerView.SetLayoutManager(new LinearLayoutManager(Activity)); MoreSectionAdapter = new MoreSectionAdapter(Activity); MoreRecylerView.SetAdapter(MoreSectionAdapter); } //MoreRecylerView.HasFixedSize = true; MoreRecylerView.SetItemViewCacheSize(50); MoreRecylerView.GetLayoutManager().ItemPrefetchEnabled = true; } catch (Exception e) { Console.WriteLine(e); } }
private void SetRecyclerViewAdapters() { try { MAdapter = new MoreSectionAdapter(this); LayoutManager = new LinearLayoutManager(this); MRecycler.SetLayoutManager(LayoutManager); MRecycler.HasFixedSize = true; MRecycler.SetItemViewCacheSize(10); MRecycler.GetLayoutManager().ItemPrefetchEnabled = true; MRecycler.SetAdapter(MAdapter); } catch (Exception e) { Console.WriteLine(e); } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { try { var view = MyContextWrapper.GetContentView(Context, Settings.Lang, Resource.Layout.Tab_More_Layout); if (view == null) { view = inflater.Inflate(Resource.Layout.Tab_More_Layout, container, false); } MoreRecylerView = (RecyclerView)view.FindViewById(Resource.Id.Recyler); MoreRecylerView.SetLayoutManager(new LinearLayoutManager(Activity)); MoreSectionAdapter = new MoreSectionAdapter(Activity); MoreRecylerView.SetAdapter(MoreSectionAdapter); MoreRecylerView.NestedScrollingEnabled = true; if (!Settings.SetTabOnButton) { var parasms = (LinearLayout.LayoutParams)MoreRecylerView.LayoutParameters; // Check if we're running on Android 5.0 or higher if ((int)Build.VERSION.SdkInt < 23) { parasms.TopMargin = 130; } else { parasms.TopMargin = 270; } MoreRecylerView.LayoutParameters = parasms; MoreRecylerView.SetPadding(0, 0, 0, 0); } return(view); } catch (Exception exception) { Crashes.TrackError(exception); return(null); } }
private void SetRecyclerViewAdapters(View view) { try { MoreRecylerView = (RecyclerView)view.FindViewById(Resource.Id.Recyler); MoreRecylerView.NestedScrollingEnabled = true; MoreSectionAdapter = new MoreSectionAdapter(Activity); switch (AppSettings.MoreTheme) { case MoreTheme.BeautyTheme: { var layoutManager = new GridLayoutManager(Activity, 4); var countListFirstRow = MoreSectionAdapter.SectionList.Where(q => q.StyleRow == 0).ToList().Count; layoutManager.SetSpanSizeLookup(new MySpanSizeLookup2(countListFirstRow, 1, 4)); //20, 1, 4 MoreRecylerView.SetLayoutManager(layoutManager); MoreRecylerView.SetAdapter(MoreSectionAdapter); break; } default: MoreRecylerView.SetLayoutManager(new LinearLayoutManager(Activity)); MoreRecylerView.SetAdapter(MoreSectionAdapter); break; } //MoreRecylerView.HasFixedSize = true; MoreRecylerView.SetItemViewCacheSize(50); MoreRecylerView.GetLayoutManager().ItemPrefetchEnabled = true; MAdView = view.FindViewById <AdView>(Resource.Id.adView); AdsGoogle.InitAdView(MAdView, MoreRecylerView); } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
//Event Open Intent Activity private void MoreSection_OnItemClick(object sender, MoreSectionAdapterClickEventArgs adapterClickEvents) { try { var position = adapterClickEvents.Position; if (position >= 0) { var item = MoreSectionAdapter.GetItem(position); if (item != null) { if (item.ID == 1) // My Profile { var intent = new Intent(Context, typeof(MyProfile_Activity)); StartActivity(intent); } else if (item.ID == 2) // Messages { IMethods.IApp.OpenApp_BypackageName(Context, Settings.Messenger_Package_Name); } else if (item.ID == 3) // Contacts { var intent = new Intent(Context, typeof(MyContacts_Activity)); intent.PutExtra("ContactsType", "Following"); StartActivity(intent); } else if (item.ID == 4) // Albums { var intent = new Intent(Context, typeof(MyPhotosActivity)); intent.PutExtra("UserId", UserDetails.User_id); StartActivity(intent); } else if (item.ID == 5) // Saved Posts { var intent = new Intent(Context, typeof(HyberdPostViewer_Activity)); intent.PutExtra("Type", "Saved Post"); intent.PutExtra("Id", UserDetails.User_id); intent.PutExtra("Title", this.Context.GetString(Resource.String.Lbl_Saved_Posts)); StartActivity(intent); } else if (item.ID == 6) // Groups { var intent = new Intent(Context, typeof(Groups_Activity)); intent.PutExtra("GroupsType", "Manage_MyGroups"); intent.PutExtra("UserID", UserDetails.User_id); StartActivity(intent); } else if (item.ID == 7) // Pages { var intent = new Intent(Context, typeof(Pages_Activity)); intent.PutExtra("PagesType", "Manage_MyPages"); intent.PutExtra("UserID", UserDetails.User_id); StartActivity(intent); } else if (item.ID == 8) // Blogs { StartActivity(new Intent(Context, typeof(ArticlesActivity))); } else if (item.ID == 9) // Market { StartActivity(new Intent(Context, typeof(TabbedMarket_Activity))); } else if (item.ID == 10) // Events { var intent = new Intent(Context, typeof(EventMain_Activity)); StartActivity(intent); } else if (item.ID == 11) // Find Friends { var intent = new Intent(Context, typeof(PeopleNearByActivity)); StartActivity(intent); } else if (item.ID == 12) // Movies { var intent = new Intent(Context, typeof(Movies_Activity)); StartActivity(intent); } //Settings Page else if (item.ID == 13) // General Account { var Intent = new Intent(Context, typeof(GeneralAccount_Activity)); StartActivity(Intent); } else if (item.ID == 14) // Privacy { var Intent = new Intent(Context, typeof(Privacy_Activity)); StartActivity(Intent); } else if (item.ID == 15) // Notification { var Intent = new Intent(Context, typeof(MessegeNotification_Activity)); StartActivity(Intent); } else if (item.ID == 16) // Tell a Friends { var Intent = new Intent(Context, typeof(TellFriend_Activity)); StartActivity(Intent); } else if (item.ID == 17) // clear Cache { } else if (item.ID == 18) // Help & Support { var Intent = new Intent(Context, typeof(Support_Activity)); StartActivity(Intent); } else if (item.ID == 19) // Logout { var dialog = new MaterialDialog.Builder(Context); dialog.Title(Resource.String.Lbl_Warning); dialog.Content(Context.GetText(Resource.String.Lbl_Are_you_logout)); dialog.PositiveText(Context.GetText(Resource.String.Lbl_Ok)).OnPositive(this); dialog.NegativeText(Context.GetText(Resource.String.Lbl_Cancel)).OnNegative(this); dialog.AlwaysCallSingleChoiceCallback(); dialog.ItemsCallback(this).Build().Show(); } } } } catch (Exception exception) { Crashes.TrackError(exception); } }