Java Code Examples for android.provider.Settings.System#getInt()

The following examples show how to use android.provider.Settings.System#getInt() . 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: UIsUtils.java    From letv with Apache License 2.0 6 votes vote down vote up
@Nullable
private static int getMeizuNaviogationBarHeight(Context context) {
    int dimensionPixelSize;
    boolean autoHideSmartBar = true;
    boolean z = false;
    boolean isMeiZu = Build.MANUFACTURER.equals("Meizu");
    if (System.getInt(context.getContentResolver(), "mz_smartbar_auto_hide", z) != 1) {
        autoHideSmartBar = z;
    }
    if (isMeiZu && !autoHideSmartBar) {
        try {
            Class c = Class.forName("com.android.internal.R$dimen");
            dimensionPixelSize = context.getResources().getDimensionPixelSize(
                    Integer.parseInt(c.getField("mz_action_button_min_height")
                            .get(c.newInstance()).toString()));
        } catch (Throwable th) {
        }
    }
    return dimensionPixelSize;
}
 
Example 2
Source File: TextKeyListener.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private void updatePrefs(ContentResolver resolver) {
    boolean cap = System.getInt(resolver, System.TEXT_AUTO_CAPS, 1) > 0;
    boolean text = System.getInt(resolver, System.TEXT_AUTO_REPLACE, 1) > 0;
    boolean period = System.getInt(resolver, System.TEXT_AUTO_PUNCTUATE, 1) > 0;
    boolean pw = System.getInt(resolver, System.TEXT_SHOW_PASSWORD, 1) > 0;

    mPrefs = (cap ? AUTO_CAP : 0) |
             (text ? AUTO_TEXT : 0) |
             (period ? AUTO_PERIOD : 0) |
             (pw ? SHOW_PASSWORD : 0);
}
 
Example 3
Source File: AlbumGestureController.java    From letv with Apache License 2.0 5 votes vote down vote up
private int getScreenBrightness() {
    int screenBrightness = 255;
    try {
        screenBrightness = System.getInt(this.mActivity.getContentResolver(), "screen_brightness");
    } catch (Exception exception) {
        exception.printStackTrace();
    }
    return screenBrightness;
}
 
Example 4
Source File: BasePlayController.java    From letv with Apache License 2.0 5 votes vote down vote up
private int getScreenBrightness() {
    int screenBrightness = 255;
    try {
        screenBrightness = System.getInt(getActivity().getContentResolver(), "screen_brightness");
    } catch (SettingNotFoundException e) {
    }
    return screenBrightness;
}
 
Example 5
Source File: ModRotationFix.java    From SwipeBack with GNU General Public License v3.0 5 votes vote down vote up
static void fixOnActivityCreate(Activity activity) {
	boolean isRotationLocked = System.getInt(activity.getContentResolver(), System.ACCELEROMETER_ROTATION, 0) == 0;
	if (!isRotationLocked) {
		activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
	}
	ContentObserver observer = new RotateObserver(activity, new RotateHandler(activity));
	activity.getContentResolver().registerContentObserver(System.getUriFor(System.ACCELEROMETER_ROTATION), false, observer);
	setAdditionalInstanceField(activity, "rotateObserver", observer);
}
 
Example 6
Source File: ModRotationFix.java    From SwipeBack with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onChange(boolean selfChange) {
	boolean isRotationLocked = (System.getInt(mActivity.getContentResolver(), System.ACCELEROMETER_ROTATION, 0) == 0);
	mHandler.sendMessage(mHandler.obtainMessage(0, isRotationLocked));
}