Java Code Examples for android.app.AlertDialog#THEME_DEVICE_DEFAULT_LIGHT

The following examples show how to use android.app.AlertDialog#THEME_DEVICE_DEFAULT_LIGHT . 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: 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 2
Source File: Notification.java    From reader with MIT License 5 votes vote down vote up
@SuppressLint("NewApi")
private AlertDialog.Builder createDialog(CordovaInterface cordova) {
    int currentapiVersion = android.os.Build.VERSION.SDK_INT;
    if (currentapiVersion >= android.os.Build.VERSION_CODES.HONEYCOMB) {
        return new AlertDialog.Builder(cordova.getActivity(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT);
    } else {
        return new AlertDialog.Builder(cordova.getActivity());
    }
}
 
Example 3
Source File: Notification.java    From jpHolo with MIT License 5 votes vote down vote up
/**
 * Show the progress dialog.
 *
 * @param title     Title of the dialog
 * @param message   The message of the dialog
 */
public synchronized void progressStart(final String title, final String message) {
    if (this.progressDialog != null) {
        this.progressDialog.dismiss();
        this.progressDialog = null;
    }
    final Notification notification = this;
    final CordovaInterface cordova = this.cordova;
    Runnable runnable = new Runnable() {
        public void run() {
            notification.progressDialog = new ProgressDialog(cordova.getActivity(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT);
            notification.progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
            notification.progressDialog.setTitle(title);
            notification.progressDialog.setMessage(message);
            notification.progressDialog.setCancelable(true);
            notification.progressDialog.setMax(100);
            notification.progressDialog.setProgress(0);
            notification.progressDialog.setOnCancelListener(
                    new DialogInterface.OnCancelListener() {
                        public void onCancel(DialogInterface dialog) {
                            notification.progressDialog = null;
                        }
                    });
            notification.progressDialog.show();
        }
    };
    this.cordova.getActivity().runOnUiThread(runnable);
}
 
Example 4
Source File: Notification.java    From reader with MIT License 5 votes vote down vote up
@SuppressLint("InlinedApi")
private ProgressDialog createProgressDialog(CordovaInterface cordova) {
    int currentapiVersion = android.os.Build.VERSION.SDK_INT;
    if (currentapiVersion >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        return new ProgressDialog(cordova.getActivity(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT);
    } else {
        return new ProgressDialog(cordova.getActivity());
    }
}
 
Example 5
Source File: Notification.java    From reader with MIT License 5 votes vote down vote up
@SuppressLint("NewApi")
private AlertDialog.Builder createDialog(CordovaInterface cordova) {
    int currentapiVersion = android.os.Build.VERSION.SDK_INT;
    if (currentapiVersion >= android.os.Build.VERSION_CODES.HONEYCOMB) {
        return new AlertDialog.Builder(cordova.getActivity(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT);
    } else {
        return new AlertDialog.Builder(cordova.getActivity());
    }
}
 
Example 6
Source File: Notification.java    From reader with MIT License 5 votes vote down vote up
@SuppressLint("InlinedApi")
private ProgressDialog createProgressDialog(CordovaInterface cordova) {
    int currentapiVersion = android.os.Build.VERSION.SDK_INT;
    if (currentapiVersion >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        return new ProgressDialog(cordova.getActivity(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT);
    } else {
        return new ProgressDialog(cordova.getActivity());
    }
}
 
Example 7
Source File: Notification.java    From reader with MIT License 5 votes vote down vote up
@SuppressLint("NewApi")
private AlertDialog.Builder createDialog(CordovaInterface cordova) {
    int currentapiVersion = android.os.Build.VERSION.SDK_INT;
    if (currentapiVersion >= android.os.Build.VERSION_CODES.HONEYCOMB) {
        return new AlertDialog.Builder(cordova.getActivity(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT);
    } else {
        return new AlertDialog.Builder(cordova.getActivity());
    }
}
 
Example 8
Source File: Notification.java    From reader with MIT License 5 votes vote down vote up
@SuppressLint("InlinedApi")
private ProgressDialog createProgressDialog(CordovaInterface cordova) {
    int currentapiVersion = android.os.Build.VERSION.SDK_INT;
    if (currentapiVersion >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        return new ProgressDialog(cordova.getActivity(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT);
    } else {
        return new ProgressDialog(cordova.getActivity());
    }
}
 
Example 9
Source File: Notification.java    From reader with MIT License 5 votes vote down vote up
@SuppressLint("NewApi")
private AlertDialog.Builder createDialog(CordovaInterface cordova) {
    int currentapiVersion = android.os.Build.VERSION.SDK_INT;
    if (currentapiVersion >= android.os.Build.VERSION_CODES.HONEYCOMB) {
        return new AlertDialog.Builder(cordova.getActivity(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT);
    } else {
        return new AlertDialog.Builder(cordova.getActivity());
    }
}
 
Example 10
Source File: Notification.java    From reader with MIT License 5 votes vote down vote up
@SuppressLint("InlinedApi")
private ProgressDialog createProgressDialog(CordovaInterface cordova) {
    int currentapiVersion = android.os.Build.VERSION.SDK_INT;
    if (currentapiVersion >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        return new ProgressDialog(cordova.getActivity(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT);
    } else {
        return new ProgressDialog(cordova.getActivity());
    }
}
 
Example 11
Source File: Notification.java    From showCaseCordova with Apache License 2.0 5 votes vote down vote up
@SuppressLint("InlinedApi")
private ProgressDialog createProgressDialog(CordovaInterface cordova) {
    int currentapiVersion = android.os.Build.VERSION.SDK_INT;
    if (currentapiVersion >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        return new ProgressDialog(cordova.getActivity(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT);
    } else {
        return new ProgressDialog(cordova.getActivity());
    }
}
 
Example 12
Source File: Notification.java    From showCaseCordova with Apache License 2.0 5 votes vote down vote up
@SuppressLint("NewApi")
private AlertDialog.Builder createDialog(CordovaInterface cordova) {
    int currentapiVersion = android.os.Build.VERSION.SDK_INT;
    if (currentapiVersion >= android.os.Build.VERSION_CODES.HONEYCOMB) {
        return new AlertDialog.Builder(cordova.getActivity(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT);
    } else {
        return new AlertDialog.Builder(cordova.getActivity());
    }
}
 
Example 13
Source File: Notification.java    From reacteu-app with MIT License 5 votes vote down vote up
@SuppressLint("InlinedApi")
private ProgressDialog createProgressDialog(CordovaInterface cordova) {
    int currentapiVersion = android.os.Build.VERSION.SDK_INT;
    if (currentapiVersion >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        return new ProgressDialog(cordova.getActivity(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT);
    } else {
        return new ProgressDialog(cordova.getActivity());
    }
}
 
Example 14
Source File: Notification.java    From reacteu-app with MIT License 5 votes vote down vote up
@SuppressLint("NewApi")
private AlertDialog.Builder createDialog(CordovaInterface cordova) {
    int currentapiVersion = android.os.Build.VERSION.SDK_INT;
    if (currentapiVersion >= android.os.Build.VERSION_CODES.HONEYCOMB) {
        return new AlertDialog.Builder(cordova.getActivity(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT);
    } else {
        return new AlertDialog.Builder(cordova.getActivity());
    }
}
 
Example 15
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 16
Source File: DialogGPS.java    From cordova-dialog-gps with MIT License 4 votes vote down vote up
/**
 *  Method that create a new Dialog.   
 *
 *   @param cordova     CordovaInterface to append the dialog created. 
 *                      the dialog is forced to display with the theme light default
 **/
@SuppressLint( "NewApi" )
private AlertDialog.Builder newDialog(CordovaInterface cordova,final String title,final String message, final String description) {
    final Context context = cordova.getActivity().getApplicationContext();
    final String packageName = context.getPackageName();
    AlertDialog.Builder builder;
    int dpi = context.getResources().getDisplayMetrics().densityDpi;
    int currentapiVersion = android.os.Build.VERSION.SDK_INT;
    
    
    if (currentapiVersion >= android.os.Build.VERSION_CODES.HONEYCOMB) {
       builder = new AlertDialog.Builder(cordova.getActivity(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT);
    } else {
       builder = new AlertDialog.Builder(cordova.getActivity());
    }
    
    builder.setMessage(message);
    builder.setTitle(title);
    
    LinearLayout _layout = new LinearLayout(context);
    LinearLayout.LayoutParams _layout_params  = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT);
    _layout.setLayoutParams(_layout_params);
    _layout.setPadding(0, dpToPixels(20,dpi),dpToPixels(24,dpi),0);
    _layout.setOrientation(LinearLayout.HORIZONTAL);

    ImageView  _icon = new ImageView(context);
    _icon.setImageResource(cordova.getActivity().getResources().getIdentifier("ic_location","drawable",packageName));
    TextView _description = new TextView(context);
    
    _icon.setLayoutParams(new LinearLayout.LayoutParams(dpToPixels(72,dpi),dpToPixels(72,dpi)));
    _description.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,dpToPixels(72,dpi)));

    _icon.setContentDescription("Location Icon");
    _icon.setPadding(dpToPixels(24,dpi),0,dpToPixels(24,dpi),dpToPixels(24,dpi));
    _icon.setColorFilter(Color.argb(139,0,0,0));
    
    _description.setTextSize(16);
    _description.setText(description);
    _description.setTextColor(Color.argb(139,0,0,0));
    
    _layout.addView(_icon);
    _layout.addView(_description);
    builder.setView(_layout);
    
    return builder;
}
 
Example 17
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;
}