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(); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { MyLog.Log(this, $"OnCreateView..."); swipeRefLayout = inflater.Inflate(Resource.Layout.main_offline_list, container, false) as SwipeRefreshLayout; swipeRefLayout.Refreshing = true; swipeRefLayout.Refresh += SwipeRefLayout_Refresh; swipeRefLayout.SetColorSchemeColors(new int[] { Android.Graphics.Color.ParseColor(website.Color).ToArgb() }); recyView = swipeRefLayout.FindViewById <RecyclerView>(Resource.Id.offlineRecyclerView); recyView.SetLayoutManager(recyLayoutManager = new LinearLayoutManager(this.Context, (int)Orientation.Vertical, false)); recyView.SetAdapter(adapter = new RecyclerViewAdpater(website)); adapter.OnItemClick += RecyclerView_OnItemClick; adapter.LoadNextPage += (sender, e) => LoadNextPage(); adapter.OnCategorySelected += OnCategorySelected; if (website.Categories == null) { MyLog.Log(this, $"Requesting index page data from analysisModule url {website.IndexPageLink}..."); browsingContext = OverviewType.IndexPage; analysisModule.ReadIndexPage(refreshingRequestUid = UidGenerator(), websiteKey, website.IndexPageLink, this); MyLog.Log(this, $"Requesting index page data from analysisModule url {website.IndexPageLink}...Done"); } else { MyLog.Log(this, $"Requesting index page data from analysisModule category {website?.Categories[0]?.Link}..."); browsingContext = OverviewType.Category; refreshingLink = website.Categories[0].Link; analysisModule.ReadCategory(refreshingRequestUid = UidGenerator(), websiteKey, website.Categories[0], this); MyLog.Log(this, $"Requesting index page data from analysisModule category {website?.Categories[0]?.Link}...Done"); } MyLog.Log(this, $"OnCreateView...Done"); return(swipeRefLayout); }