Search in sources :

Example 1 with DownloadEntryAdapter

use of org.edx.mobile.view.adapters.DownloadEntryAdapter in project edx-app-android by edx.

the class DownloadListActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_downloads_list);
    super.setToolbarAsActionBar();
    environment.getAnalyticsRegistry().trackScreenView(Analytics.Screens.DOWNLOADS);
    adapter = new DownloadEntryAdapter(this, environment) {

        @Override
        public void onItemClicked(DownloadEntryAdapter.Item model) {
        // nothing to do here
        }

        @Override
        public void onDeleteClicked(DownloadEntryAdapter.Item item) {
            assert adapter != null;
            final VideoModel videoModel = ((DownloadItem) item).model;
            if (environment.getStorage().removeDownload(videoModel) >= 1) {
                adapter.remove(item);
            }
        }
    };
    loadingIndicator = findViewById(R.id.loading_indicator);
    downloadListView = (ListView) findViewById(R.id.my_downloads_list);
    downloadListView.setAdapter(adapter);
    loadingIndicator.setVisibility(View.VISIBLE);
    downloadListView.setVisibility(View.GONE);
}
Also used : DownloadEntryAdapter(org.edx.mobile.view.adapters.DownloadEntryAdapter) VideoModel(org.edx.mobile.model.VideoModel)

Aggregations

VideoModel (org.edx.mobile.model.VideoModel)1 DownloadEntryAdapter (org.edx.mobile.view.adapters.DownloadEntryAdapter)1