use of org.edx.mobile.view.dialog.NetworkCheckDialogFragment in project edx-app-android by edx.
the class MediaConsentUtils method showLeavingAppDataDialog.
public static void showLeavingAppDataDialog(final FragmentActivity activity, final IDialogCallback consentCallback) {
boolean connectedToWifi = NetworkUtil.isConnectedWifi(activity);
if (connectedToWifi) {
consentCallback.onPositiveClicked();
} else {
CharSequence platformName = activity.getString(R.string.platform_name);
String title = ResourceUtil.getFormattedString(activity.getResources(), R.string.leaving_app_data_title, "platform_name", platformName).toString();
String message = ResourceUtil.getFormattedString(activity.getResources(), R.string.leaving_app_data_message, "platform_name", platformName).toString();
String positiveLabel = activity.getString(R.string.label_ok);
String negativeLabel = activity.getString(R.string.label_cancel);
NetworkCheckDialogFragment dialogFragment = NetworkCheckDialogFragment.newInstance(title, message, positiveLabel, negativeLabel, consentCallback);
showDialog(activity, dialogFragment, DIALOG_TAG_CONFIRM_LEAVING_APP);
}
}
use of org.edx.mobile.view.dialog.NetworkCheckDialogFragment 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");
}
Aggregations