public void Refresh() { currentDataIndex = 0; adapter = new ActivityItemAdapter(Activity); RetrieveActivityData(adapter); ListAdapter = adapter; }
void RetrieveActivityData(ActivityItemAdapter adapter) { int count = currentDataIndex == 0 ? 5 : 10; var query = CreateQuery(skip: currentDataIndex, limit: count); if (currentDataIndex == 0) { loadingBar.Visibility = ViewStates.Visible; noContent.Visibility = ViewStates.Gone; } query.FindInBackground(new TabFindCallback((ps, e) => { if (e == null) { if (ps.Count == 0) { if (currentDataIndex == 0) { loadingBar.Visibility = ViewStates.Gone; noContent.Visibility = ViewStates.Visible; } return; } var tabObjects = ps.Select(TabObject.FromParse).ToList(); adapter.FeedData(tabObjects); currentDataIndex += count; loading = false; } else { Log.Error("ActivityRetriever", e.ToString()); loading = false; } })); }
public override void OnAttach(Activity activity) { base.OnAttach(activity); adapter = new ActivityItemAdapter(activity); currentDataIndex = 0; ListAdapter = adapter; }
public override void OnAttach(Activity activity) { base.OnAttach (activity); adapter = new ActivityItemAdapter (activity); currentDataIndex = 0; ListAdapter = adapter; }
public void Refresh() { currentDataIndex = 0; adapter = new ActivityItemAdapter (Activity); RetrieveActivityData (adapter); ListAdapter = adapter; }
void RetrieveActivityData(ActivityItemAdapter adapter) { int count = currentDataIndex == 0 ? 5 : 10; var query = CreateQuery (skip: currentDataIndex, limit: count); if (currentDataIndex == 0) { loadingBar.Visibility = ViewStates.Visible; noContent.Visibility = ViewStates.Gone; } query.FindInBackground (new TabFindCallback ((ps, e) => { if (e == null) { if (ps.Count == 0) { if (currentDataIndex == 0) { loadingBar.Visibility = ViewStates.Gone; noContent.Visibility = ViewStates.Visible; } return; } var tabObjects = ps.Select (TabObject.FromParse).ToList (); adapter.FeedData (tabObjects); currentDataIndex += count; loading = false; } else { Log.Error ("ActivityRetriever", e.ToString ()); loading = false; } })); }