Search in sources :

Example 1 with BulkVideosDownloadStartedEvent

use of org.edx.mobile.module.storage.BulkVideosDownloadStartedEvent in project edx-app-android by edx.

the class VideoDownloadHelper method showDownloadSizeExceedDialog.

// Dialog fragment to display message to user regarding
private void showDownloadSizeExceedDialog(final ArrayList<DownloadEntry> de, final int noOfDownloads, final FragmentActivity activity, final DownloadManagerCallback callback) {
    Map<String, String> dialogMap = new HashMap<String, String>();
    dialogMap.put("title", activity.getString(R.string.download_exceed_title));
    dialogMap.put("message_1", activity.getString(R.string.download_exceed_message));
    downloadFragment = DownloadSizeExceedDialog.newInstance(dialogMap, new IDialogCallback() {

        @Override
        public void onPositiveClicked() {
            if (!de.isEmpty()) {
                startDownload(de, activity, callback);
                final DownloadEntry downloadEntry = de.get(0);
                analyticsRegistry.trackSubSectionBulkVideoDownload(downloadEntry.getSectionName(), downloadEntry.getChapterName(), downloadEntry.getEnrollmentId(), noOfDownloads);
                EventBus.getDefault().post(new BulkVideosDownloadStartedEvent());
            }
        }

        @Override
        public void onNegativeClicked() {
            // updateList();
            downloadFragment.dismiss();
            EventBus.getDefault().post(new BulkVideosDownloadCancelledEvent());
        }
    });
    downloadFragment.setStyle(DialogFragment.STYLE_NO_TITLE, 0);
    downloadFragment.show(activity.getSupportFragmentManager(), "dialog");
    downloadFragment.setCancelable(false);
}
Also used : HashMap(java.util.HashMap) BulkVideosDownloadCancelledEvent(org.edx.mobile.module.storage.BulkVideosDownloadCancelledEvent) IDialogCallback(org.edx.mobile.view.dialog.IDialogCallback) HasDownloadEntry(org.edx.mobile.model.course.HasDownloadEntry) DownloadEntry(org.edx.mobile.model.db.DownloadEntry) BulkVideosDownloadStartedEvent(org.edx.mobile.module.storage.BulkVideosDownloadStartedEvent)

Aggregations

HashMap (java.util.HashMap)1 HasDownloadEntry (org.edx.mobile.model.course.HasDownloadEntry)1 DownloadEntry (org.edx.mobile.model.db.DownloadEntry)1 BulkVideosDownloadCancelledEvent (org.edx.mobile.module.storage.BulkVideosDownloadCancelledEvent)1 BulkVideosDownloadStartedEvent (org.edx.mobile.module.storage.BulkVideosDownloadStartedEvent)1 IDialogCallback (org.edx.mobile.view.dialog.IDialogCallback)1