Search in sources :

Example 6 with IDialogCallback

use of org.edx.mobile.view.dialog.IDialogCallback in project edx-app-android by edx.

the class SettingsFragment method showWifiDialog.

protected void showWifiDialog() {
    final NetworkCheckDialogFragment newFragment = NetworkCheckDialogFragment.newInstance(getString(R.string.wifi_dialog_title_help), getString(R.string.wifi_dialog_message_help), new IDialogCallback() {

        @Override
        public void onPositiveClicked() {
            try {
                PrefManager wifiPrefManager = new PrefManager(getActivity().getBaseContext(), PrefManager.Pref.WIFI);
                wifiPrefManager.put(PrefManager.Key.DOWNLOAD_ONLY_ON_WIFI, false);
                updateWifiSwitch();
            } catch (Exception ex) {
                logger.error(ex);
            }
        }

        @Override
        public void onNegativeClicked() {
            try {
                PrefManager wifiPrefManager = new PrefManager(getActivity().getBaseContext(), PrefManager.Pref.WIFI);
                wifiPrefManager.put(PrefManager.Key.DOWNLOAD_ONLY_ON_WIFI, true);
                wifiPrefManager.put(PrefManager.Key.DOWNLOAD_OFF_WIFI_SHOW_DIALOG_FLAG, true);
                updateWifiSwitch();
            } catch (Exception ex) {
                logger.error(ex);
            }
        }
    });
    newFragment.setCancelable(false);
    newFragment.show(getActivity().getSupportFragmentManager(), "dialog");
}
Also used : NetworkCheckDialogFragment(org.edx.mobile.view.dialog.NetworkCheckDialogFragment) IDialogCallback(org.edx.mobile.view.dialog.IDialogCallback) PrefManager(org.edx.mobile.module.prefs.PrefManager)

Aggregations

IDialogCallback (org.edx.mobile.view.dialog.IDialogCallback)6 HashMap (java.util.HashMap)2 BulkVideosDownloadCancelledEvent (org.edx.mobile.module.storage.BulkVideosDownloadCancelledEvent)2 HasDownloadEntry (org.edx.mobile.model.course.HasDownloadEntry)1 DownloadEntry (org.edx.mobile.model.db.DownloadEntry)1 PrefManager (org.edx.mobile.module.prefs.PrefManager)1 BulkVideosDownloadStartedEvent (org.edx.mobile.module.storage.BulkVideosDownloadStartedEvent)1 EnrollmentFailureDialogFragment (org.edx.mobile.view.dialog.EnrollmentFailureDialogFragment)1 NetworkCheckDialogFragment (org.edx.mobile.view.dialog.NetworkCheckDialogFragment)1