public void OnRefresh() { try { LatestSongsAdapter.SoundsList.Clear(); LatestSongsAdapter.NotifyDataSetChanged(); TopSongsAdapter.SoundsList.Clear(); TopSongsAdapter.NotifyDataSetChanged(); AlbumsAdapter.AlbumsList.Clear(); AlbumsAdapter.NotifyDataSetChanged(); StoreAdapter.SoundsList.Clear(); StoreAdapter.NotifyDataSetChanged(); ActivitiesAdapter.ActivityList.Clear(); ActivitiesAdapter.NotifyDataSetChanged(); EmptyStateLayout.Visibility = ViewStates.Gone; new Handler(Looper.MainLooper).Post(new Runnable(Run)); } catch (Exception e) { Console.WriteLine(e); } }
async Task GetData() { adapter.Activity = await StateHolder.Instance.GetActivity(); RunOnUiThread(() => { if (adapter.Activity != null) { list.Visibility = ViewStates.Visible; message.Visibility = ViewStates.Gone; if (DateTimeOffset.UtcNow > adapter.Activity.Time + TimeSpan.FromMinutes(2)) { checkin.Visibility = ViewStates.Visible; } else { checkin.Visibility = ViewStates.Gone; } } else { list.Visibility = ViewStates.Gone; message.Visibility = ViewStates.Visible; } adapter.NotifyDataSetChanged(); refresher.Refreshing = false; }); }