Java Code Examples for android.app.AlertDialog#THEME_DEVICE_DEFAULT_DARK

The following examples show how to use android.app.AlertDialog#THEME_DEVICE_DEFAULT_DARK . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CustomiseActivity.java    From StepView with Apache License 2.0 6 votes vote down vote up
private void showColorPickerDialog(final ColorPickListener listener) {
    ColorPickerDialog.Builder builder = new ColorPickerDialog.Builder(CustomiseActivity.this, AlertDialog.THEME_DEVICE_DEFAULT_DARK);
    builder.setTitle("ColorPicker Dialog");
    builder.setPositiveButton(getString(R.string.confirm), new ColorEnvelopeListener() {
        @Override
        public void onColorSelected(ColorEnvelope envelope, boolean fromUser) {
            listener.onColorPicked(envelope.getHexCode());
        }
    });
    builder.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            dialogInterface.dismiss();
        }
    });
    builder.show();
}
 
Example 2
Source File: UIUtils.java    From rebootmenu with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 加载特定主题颜色的AlertDialog
 *
 * @param isWhite      是否白色主题
 * @param activityThis 当前activity的上下文
 * @return 已处理Builder对象
 */
@TargetApi(Build.VERSION_CODES.LOLLIPOP_MR1)
public static AlertDialog.Builder LoadDialog(boolean isWhite, Activity activityThis) {
    //在API级别23中,AlertDialog的主题定义被废弃。用在API级别22中新引入的Android默认主题格式代替。
    boolean isAndroidMPlus = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1;
    int themeCode;
    if (isWhite) {
        if (isAndroidMPlus)
            themeCode = android.R.style.Theme_DeviceDefault_Light_Dialog_Alert;
        else
            themeCode = AlertDialog.THEME_DEVICE_DEFAULT_LIGHT;
    } else {
        if (isAndroidMPlus)
            themeCode = android.R.style.Theme_DeviceDefault_Dialog_Alert;
        else
            themeCode = AlertDialog.THEME_DEVICE_DEFAULT_DARK;
    }
    new DebugLog("LoadDialog: themeCode=" + themeCode, DebugLog.LogLevel.V);
    return new AlertDialog.Builder(activityThis, themeCode);
}
 
Example 3
Source File: CustomDialog.java    From QNotified with GNU General Public License v3.0 4 votes vote down vote up
public static int themeIdForDialog() {
    return ResUtils.isInNightMode() ? AlertDialog.THEME_DEVICE_DEFAULT_DARK : AlertDialog.THEME_DEVICE_DEFAULT_LIGHT;
}
 
Example 4
Source File: CustomDialog.java    From QNotified with GNU General Public License v3.0 4 votes vote down vote up
public static CustomDialog createFailsafe(Context ctx) {
    CustomDialog ref = new CustomDialog();
    ref.failsafe = true;
    ref.mBuilder = new AlertDialog.Builder(ctx, ResUtils.isInNightMode() ? AlertDialog.THEME_DEVICE_DEFAULT_DARK : AlertDialog.THEME_DEVICE_DEFAULT_LIGHT);
    return ref;
}