private async void SetupContent() { try { bool success = await AndroidUtils.PrepActivityFiles(this, learningActivity); if (!success) { Toast.MakeText(this, $"{GetString(Resource.String.ConnectionError)}", ToastLength.Long).Show(); Finish(); return; } } catch (Exception e) { Toast.MakeText(this, $"{GetString(Resource.String.ErrorTitle)}: {e.Message}", ToastLength.Long).Show(); Finish(); return; } recyclerView.SetAdapter(adapter); layoutManager = new LinearLayoutManager(this); recyclerView.SetLayoutManager(layoutManager); ChildItemDecoration childDecoration = new ChildItemDecoration(this, 20); recyclerView.AddItemDecoration(childDecoration); }
private async Task DownloadActivities() { foreach (LearningActivity act in collection.Activities) { try { bool success = await AndroidUtils.PrepActivityFiles(this, act).ConfigureAwait(false); if (!success) { RunOnUiThread(() => Toast.MakeText(this, $"{GetString(Resource.String.ConnectionError)}", ToastLength.Long).Show()); return; } } catch (Exception e) { RunOnUiThread(() => Toast.MakeText(this, $"{GetString(Resource.String.ErrorTitle)}: {e.Message}", ToastLength.Long).Show()); return; } } }