android.app.AlertDialog#THEME_DEVICE_DEFAULT_DARK源码实例Demo

下面列出了android.app.AlertDialog#THEME_DEVICE_DEFAULT_DARK 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: StepView   文件: CustomiseActivity.java
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();
}
 
源代码2 项目: rebootmenu   文件: UIUtils.java
/**
 * 加载特定主题颜色的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);
}
 
源代码3 项目: QNotified   文件: CustomDialog.java
public static int themeIdForDialog() {
    return ResUtils.isInNightMode() ? AlertDialog.THEME_DEVICE_DEFAULT_DARK : AlertDialog.THEME_DEVICE_DEFAULT_LIGHT;
}
 
源代码4 项目: QNotified   文件: CustomDialog.java
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;
}