protected async override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.view_expenses); var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); //Toolbar will now take on default actionbar characteristics SetSupportActionBar(toolbar); refresher = FindViewById <SwipeRefreshLayout>(Resource.Id.refresher); refresher.SetProgressBackgroundColorSchemeResource(Resource.Color.pop); refresher.Refresh += async delegate { if (viewModel.IsBusy) { return; } await viewModel.ExecuteLoadExpensesCommand(); RunOnUiThread(listAdapter.NotifyDataSetChanged); }; viewModel = ServiceContainer.Resolve <ExpensesViewModel>(); viewModel.IsBusyChanged = (busy) => { refresher.Refreshing = busy; }; listView = FindViewById <ListView>(Resource.Id.list); listAdapter = new ExpenseAdapter(this, viewModel); listView.Adapter = listAdapter; listView.ItemLongClick += async(sender, args) => { await viewModel.ExecuteDeleteExpenseCommand(viewModel.Expenses[args.Position]); RunOnUiThread(listAdapter.NotifyDataSetChanged); }; listView.ItemClick += OnListViewItemClick; var typed_value = new TypedValue(); Theme.ResolveAttribute(Resource.Attribute.actionBarSize, typed_value, true); refresher.SetProgressViewOffset(false, 0, Resources.GetDimensionPixelSize(typed_value.ResourceId)); await Authenticate(); await viewModel.ExecuteLoadExpensesCommand(); RunOnUiThread(listAdapter.NotifyDataSetChanged); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use this to return your custom view for this Fragment var view = LayoutInflater.Inflate(Resource.Layout.main_tab_content, container, false); recyclerView = view.FindViewById <RecyclerView>(Resource.Id.main_tab_rv); layoutManager = new CachingLayoutManager(view.Context); recyclerView.SetLayoutManager(layoutManager); recyclerView.ClearOnScrollListeners(); emptyView = view.FindViewById <AppCompatTextView>(Resource.Id.main_tab_emptytext); refreshView = view.FindViewById <SwipeRefreshLayout>(Resource.Id.main_tab_content_refresh); refreshView.SetProgressBackgroundColorSchemeResource(Resource.Color.colorPrimaryDark); if (tabType == DataEnum.DataType.TVSchedule) { refreshView.Refresh += delegate { (Activity as TVScheduleActivity).SetupScheduleData(refreshView); }; } else { refreshView.Refresh += (s, e) => { ReloadCurrentData(); }; } //AnimHelper.FadeContents(view, true, false, null); return(view); }