protected override void OnCreate(Bundle savedInstanceState) { AndroidApplication = Application as AndroidApplication; AndroidApplication.Logger.Debug(() => $"DownloadActivity:OnCreate"); base.OnCreate(savedInstanceState); // Set our view from the layout resource SetContentView(Resource.Layout.activity_download); RvDownloads = FindViewById <EmptyRecyclerView>(Resource.Id.rvDownloads); ProgressSpinner = FindViewById <ProgressSpinnerView>(Resource.Id.progressBar); NoDataView = FindViewById <LinearLayout>(Resource.Id.layNoData); RvDownloads.SetLayoutManager(new LinearLayoutManager(this)); RvDownloads.AddItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.Vertical)); RvDownloads.SetEmptyView(NoDataView); Adapter = new SyncItemRecyclerAdapter(this); RvDownloads.SetAdapter(Adapter); var factory = AndroidApplication.IocContainer.Resolve <ViewModelFactory>(); ViewModel = new ViewModelProvider(this, factory).Get(Java.Lang.Class.FromType(typeof(DownloadViewModel))) as DownloadViewModel; Lifecycle.AddObserver(ViewModel); SetupViewModelObservers(); ViewModel.Initialise(AndroidApplication.ControlFile); Task.Run(() => ViewModel.FindEpisodesToDownload()); AndroidApplication.Logger.Debug(() => $"DownloadActivity:OnCreate - end"); }
protected override void OnCreate(Bundle savedInstanceState) { AndroidApplication = Application as AndroidApplication; AndroidApplication.Logger.Debug(() => $"DownloadActivity:OnCreate"); base.OnCreate(savedInstanceState); // Set our view from the layout resource SetContentView(Resource.Layout.activity_download); RvDownloads = FindViewById <EmptyRecyclerView>(Resource.Id.rvDownloads); NoDataView = FindViewById <LinearLayout>(Resource.Id.layNoData); NoDataText = FindViewById <TextView>(Resource.Id.txtNoData); ProgressSpinner = FindViewById <ProgressSpinnerView>(Resource.Id.progressBar); DownloadButton = FindViewById <FloatingActionButton>(Resource.Id.fab_download); RvDownloads.SetLayoutManager(new LinearLayoutManager(this)); RvDownloads.AddItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.Vertical)); RvDownloads.SetEmptyView(NoDataView); var factory = AndroidApplication.IocContainer.Resolve <ViewModelFactory>(); ViewModel = new ViewModelProvider(this, factory).Get(Java.Lang.Class.FromType(typeof(DownloadViewModel))) as DownloadViewModel; Adapter = new DownloadRecyclerItemAdapter(this, ViewModel); RvDownloads.SetAdapter(Adapter); Lifecycle.AddObserver(ViewModel); SetupViewModelObservers(); ViewModel.Initialise(); Task.Run(() => ViewModel.FindEpisodesToDownload()); DownloadButton.Click += (sender, e) => ViewModel.DownloadAllPodcastsWithNetworkCheck(); ExitPromptDialogFragment = SupportFragmentManager.FindFragmentByTag(EXIT_PROMPT_TAG) as OkCancelDialogFragment; SetupFragmentObservers(ExitPromptDialogFragment); NetworkPromptDialogFragment = SupportFragmentManager.FindFragmentByTag(NETWORK_PROMPT_TAG) as OkCancelDialogFragment; SetupFragmentObservers(NetworkPromptDialogFragment); AndroidApplication.Logger.Debug(() => $"DownloadActivity:OnCreate - end"); }