use of com.android.systemui.statusbar.phone.SystemUIDialog in project android_frameworks_base by AOSPA.
the class PowerNotificationWarnings method showStartSaverConfirmation.
private void showStartSaverConfirmation() {
if (mSaverConfirmation != null)
return;
final SystemUIDialog d = new SystemUIDialog(mContext);
d.setTitle(R.string.battery_saver_confirmation_title);
d.setMessage(com.android.internal.R.string.battery_saver_description);
d.setNegativeButton(android.R.string.cancel, null);
d.setPositiveButton(R.string.battery_saver_confirmation_ok, mStartSaverMode);
d.setShowForAllUsers(true);
d.setOnDismissListener(new OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
mSaverConfirmation = null;
}
});
d.show();
mSaverConfirmation = d;
}
use of com.android.systemui.statusbar.phone.SystemUIDialog in project android_frameworks_base by crdroidandroid.
the class DataSaverTile method handleClick.
@Override
protected void handleClick() {
if (mState.value || Prefs.getBoolean(mContext, Prefs.Key.QS_DATA_SAVER_DIALOG_SHOWN, false)) {
// Do it right away.
toggleDataSaver();
return;
}
// Shows dialog first
SystemUIDialog dialog = new SystemUIDialog(mContext);
dialog.setTitle(com.android.internal.R.string.data_saver_enable_title);
dialog.setMessage(com.android.internal.R.string.data_saver_description);
dialog.setPositiveButton(com.android.internal.R.string.data_saver_enable_button, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
toggleDataSaver();
}
});
dialog.setNegativeButton(com.android.internal.R.string.cancel, null);
dialog.setShowForAllUsers(true);
dialog.show();
Prefs.putBoolean(mContext, Prefs.Key.QS_DATA_SAVER_DIALOG_SHOWN, true);
}
use of com.android.systemui.statusbar.phone.SystemUIDialog in project android_frameworks_base by crdroidandroid.
the class TunerService method showResetRequest.
public static final void showResetRequest(final Context context, final Runnable onDisabled) {
SystemUIDialog dialog = new SystemUIDialog(context);
dialog.setShowForAllUsers(true);
dialog.setMessage(R.string.remove_from_settings_prompt);
dialog.setButton(DialogInterface.BUTTON_NEGATIVE, context.getString(R.string.cancel), (OnClickListener) null);
dialog.setButton(DialogInterface.BUTTON_POSITIVE, context.getString(R.string.guest_exit_guest_dialog_remove), new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// Tell the tuner (in main SysUI process) to clear all its settings.
context.sendBroadcast(new Intent(TunerService.ACTION_CLEAR));
// Disable access to tuner.
TunerService.setTunerEnabled(context, false);
// Make them sit through the warning dialog again.
Settings.Secure.putInt(context.getContentResolver(), TunerFragment.SETTING_SEEN_TUNER_WARNING, 0);
if (onDisabled != null) {
onDisabled.run();
}
}
});
dialog.show();
}
use of com.android.systemui.statusbar.phone.SystemUIDialog in project android_frameworks_base by crdroidandroid.
the class QSFooter method createDialog.
private void createDialog() {
final String deviceOwnerPackage = mSecurityController.getDeviceOwnerName();
final String profileOwnerPackage = mSecurityController.getProfileOwnerName();
final boolean isNetworkLoggingEnabled = mSecurityController.isNetworkLoggingEnabled();
final String primaryVpn = mSecurityController.getPrimaryVpnName();
final String profileVpn = mSecurityController.getProfileVpnName();
boolean hasProfileOwner = mSecurityController.hasProfileOwner();
boolean isBranded = deviceOwnerPackage == null && mSecurityController.isVpnBranded();
mDialog = new SystemUIDialog(mContext);
if (!isBranded) {
mDialog.setTitle(getTitle(deviceOwnerPackage));
}
CharSequence msg = getMessage(deviceOwnerPackage, profileOwnerPackage, primaryVpn, profileVpn, hasProfileOwner, isBranded);
if (deviceOwnerPackage == null) {
mDialog.setMessage(msg);
if (mSecurityController.isVpnEnabled() && !mSecurityController.isVpnRestricted()) {
mDialog.setButton(DialogInterface.BUTTON_NEGATIVE, getSettingsButton(), this);
}
} else {
View dialogView = LayoutInflater.from(mContext).inflate(R.layout.quick_settings_footer_dialog, null, false);
mDialog.setView(dialogView);
TextView deviceOwnerWarning = (TextView) dialogView.findViewById(R.id.device_owner_warning);
deviceOwnerWarning.setText(msg);
// Make the link "learn more" clickable.
deviceOwnerWarning.setMovementMethod(new LinkMovementMethod());
if (primaryVpn == null) {
dialogView.findViewById(R.id.vpn_icon).setVisibility(View.GONE);
dialogView.findViewById(R.id.vpn_subtitle).setVisibility(View.GONE);
dialogView.findViewById(R.id.vpn_warning).setVisibility(View.GONE);
} else {
final SpannableStringBuilder message = new SpannableStringBuilder();
message.append(mContext.getString(R.string.monitoring_description_do_body_vpn, primaryVpn));
if (!mSecurityController.isVpnRestricted()) {
message.append(mContext.getString(R.string.monitoring_description_vpn_settings_separator));
message.append(mContext.getString(R.string.monitoring_description_vpn_settings), new VpnSpan(), 0);
}
TextView vpnWarning = (TextView) dialogView.findViewById(R.id.vpn_warning);
vpnWarning.setText(message);
// Make the link "Open VPN Settings" clickable.
vpnWarning.setMovementMethod(new LinkMovementMethod());
}
if (!isNetworkLoggingEnabled) {
dialogView.findViewById(R.id.network_logging_icon).setVisibility(View.GONE);
dialogView.findViewById(R.id.network_logging_subtitle).setVisibility(View.GONE);
dialogView.findViewById(R.id.network_logging_warning).setVisibility(View.GONE);
}
}
mDialog.setButton(DialogInterface.BUTTON_POSITIVE, getPositiveButton(isBranded), this);
mDialog.show();
mDialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
}
use of com.android.systemui.statusbar.phone.SystemUIDialog in project android_frameworks_base by crdroidandroid.
the class PowerNotificationWarnings method showTemperatureDialog.
private void showTemperatureDialog() {
if (mHighTempDialog != null)
return;
final SystemUIDialog d = new SystemUIDialog(mContext);
d.setIconAttribute(android.R.attr.alertDialogIcon);
d.setTitle(R.string.high_temp_title);
d.setMessage(R.string.high_temp_dialog_message);
d.setPositiveButton(com.android.internal.R.string.ok, null);
d.setShowForAllUsers(true);
d.setOnDismissListener(dialog -> mHighTempDialog = null);
d.show();
mHighTempDialog = d;
}
Aggregations