Beispiel #1
0
 protected override async void OnCreate(Bundle bundle)
 {
     base.OnCreate(bundle);
     SetContentView(Resource.Layout.MainPage);
     SetSupportActionBar(FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar));
     SupportActionBar.Title          = "OneEchan";
     _recyclerView                   = FindViewById <ExRecyclerView>(Resource.Id.MainPageRecyclerView);
     _layoutManager                  = new LinearLayoutManager(this);
     _recyclerView.ViewLayoutManager = _layoutManager;
     _recyclerView.LoadMore         += (sender, e) => LoadMore();
     _refresher = FindViewById <ScrollChildSwipeRefreshLayout>(Resource.Id.MainPageRefresher);
     _refresher.SetColorSchemeResources(Resource.Color.MediumVioletRed);
     _refresher.Refresh += async delegate { await Refresh(); };
     _refresher.Post(() => _refresher.Refreshing = true);
     await Refresh();
 }
Beispiel #2
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            _name = Intent.Extras.GetString("name");
            _id   = Intent.Extras.GetInt("id");
            SetContentView(Resource.Layout.MainPage);
            SetSupportActionBar(FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar));
            SupportActionBar.Title = _name;
            _exRecyclerView        = FindViewById <ExRecyclerView>(Resource.Id.MainPageRecyclerView);
            var disp = WindowManager.DefaultDisplay;
            var met  = new DisplayMetrics();

            disp.GetMetrics(met);
            var heightm = met.HeightPixels;
            var widthm  = met.WidthPixels;

            _exRecyclerView.ViewLayoutManager = new GridLayoutManager(this, heightm > widthm ? 2 : 3);
            _refresher = FindViewById <ScrollChildSwipeRefreshLayout>(Resource.Id.MainPageRefresher);
            _refresher.SetColorSchemeResources(Resource.Color.MediumVioletRed);
            _refresher.Refresh += async delegate { await Refresh(); };
            _refresher.Post(() => _refresher.Refreshing = true);
            await Refresh();
        }