use of android.content.DialogInterface.OnDismissListener in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ZenModeScheduleRuleSettings method showDaysDialog.
private void showDaysDialog() {
new AlertDialog.Builder(mContext).setTitle(R.string.zen_mode_schedule_rule_days).setView(new ZenModeScheduleDaysSelection(mContext, mSchedule.days) {
@Override
protected void onChanged(final int[] days) {
if (mDisableListeners)
return;
if (Arrays.equals(days, mSchedule.days))
return;
if (DEBUG)
Log.d(TAG, "days.onChanged days=" + Arrays.asList(days));
mSchedule.days = days;
updateRule(ZenModeConfig.toScheduleConditionId(mSchedule));
}
}).setOnDismissListener(new OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
updateDays();
}
}).setPositiveButton(R.string.done_button, null).show();
}
use of android.content.DialogInterface.OnDismissListener in project android_frameworks_base by crdroidandroid.
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 android.content.DialogInterface.OnDismissListener in project gene-rate by Pixplicity.
the class Rate method showRatingDialog.
private void showRatingDialog() {
LayoutInflater inflater;
if (mContext instanceof Activity) {
inflater = ((Activity) mContext).getLayoutInflater();
} else {
inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
assert inflater != null;
@SuppressLint("InflateParams") final ViewGroup layout = (ViewGroup) inflater.inflate(R.layout.in_dialog, null);
final CheckBox checkBox = layout.findViewById(R.id.cb_never);
checkBox.setText(mTextNever);
checkBox.setChecked(DEFAULT_CHECKED);
final Button btFeedback = layout.findViewById(R.id.bt_negative);
btFeedback.setPaintFlags(btFeedback.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
// Build dialog with positive and cancel buttons
final AlertDialog.Builder builder = new AlertDialog.Builder(mContext).setMessage(mMessage).setView(layout).setCancelable(false).setPositiveButton(mTextPositive, new OnClickListener() {
@Override
public void onClick(DialogInterface anInterface, int i) {
openPlayStore();
saveAsked();
anInterface.dismiss();
mFeedbackAction.onRateTapped();
}
}).setNeutralButton(mTextCancel, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int i) {
if (checkBox.isChecked()) {
saveAsked();
}
dialog.dismiss();
mFeedbackAction.onRequestDismissed(checkBox.isChecked());
}
});
// If possible, make dialog cancelable and remember checkbox state on cancel
if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN_MR1) {
builder.setCancelable(true).setOnDismissListener(new OnDismissListener() {
@Override
public void onDismiss(DialogInterface anInterface) {
if (checkBox.isChecked()) {
saveAsked();
}
mFeedbackAction.onRequestDismissed(checkBox.isChecked());
}
});
}
// Create dialog before we can continue
final AlertDialog dialog = builder.create();
// If negative button action is set, add negative button
if (mFeedbackAction != null) {
// Nooope -> redirect to feedback form
btFeedback.setText(mTextNegative);
btFeedback.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (checkBox.isChecked()) {
saveAsked();
}
dialog.dismiss();
mFeedbackAction.onFeedbackTapped();
}
});
}
// Go go go!
dialog.show();
}
Aggregations