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

The following examples show how to use android.provider.Settings.Secure#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: PermissionManager.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public static boolean isLocationEnabled(Context context) {
    if (VERSION.SDK_INT >= 19) {
        try {
            if (Secure.getInt(context.getContentResolver(), "location_mode") != 0) {
                return true;
            }
            return false;
        } catch (SettingNotFoundException e) {
            e.printStackTrace();
            return false;
        }
    } else if (TextUtils.isEmpty(Secure.getString(context.getContentResolver(), "location_providers_allowed"))) {
        return false;
    } else {
        return true;
    }
}
 
Example 2
Source File: CaptioningManager.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
/**
 * @hide
 */
@NonNull
public static CaptionStyle getCustomStyle(ContentResolver cr) {
    final CaptionStyle defStyle = CaptionStyle.DEFAULT_CUSTOM;
    final int foregroundColor = Secure.getInt(
            cr, Secure.ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR, defStyle.foregroundColor);
    final int backgroundColor = Secure.getInt(
            cr, Secure.ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR, defStyle.backgroundColor);
    final int edgeType = Secure.getInt(
            cr, Secure.ACCESSIBILITY_CAPTIONING_EDGE_TYPE, defStyle.edgeType);
    final int edgeColor = Secure.getInt(
            cr, Secure.ACCESSIBILITY_CAPTIONING_EDGE_COLOR, defStyle.edgeColor);
    final int windowColor = Secure.getInt(
            cr, Secure.ACCESSIBILITY_CAPTIONING_WINDOW_COLOR, defStyle.windowColor);

    String rawTypeface = Secure.getString(cr, Secure.ACCESSIBILITY_CAPTIONING_TYPEFACE);
    if (rawTypeface == null) {
        rawTypeface = defStyle.mRawTypeface;
    }

    return new CaptionStyle(foregroundColor, backgroundColor, edgeType, edgeColor,
            windowColor, rawTypeface);
}
 
Example 3
Source File: DeviceInfo.java    From shinny-futures-android with GNU General Public License v3.0 5 votes vote down vote up
private String getAndCacheAmazonAdvertisingId() {
    ContentResolver cr = context.getContentResolver();

    limitAdTrackingEnabled = Secure.getInt(cr, SETTING_LIMIT_AD_TRACKING, 0) == 1;
    advertisingId = Secure.getString(cr, SETTING_ADVERTISING_ID);

    return advertisingId;
}
 
Example 4
Source File: CaptioningManager.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
/**
 * @return the user's preferred captioning enabled state
 */
public final boolean isEnabled() {
    return Secure.getInt(
            mContentResolver, Secure.ACCESSIBILITY_CAPTIONING_ENABLED, DEFAULT_ENABLED) == 1;
}
 
Example 5
Source File: CaptioningManager.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
/**
 * @return the raw preset number, or the first preset if not specified
 * @hide
 */
public int getRawUserStyle() {
    return Secure.getInt(
            mContentResolver, Secure.ACCESSIBILITY_CAPTIONING_PRESET, DEFAULT_PRESET);
}
 
Example 6
Source File: SettingsFragment.java    From openboard with GNU General Public License v3.0 4 votes vote down vote up
private static boolean isUserSetupComplete(final Activity activity) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        return true;
    }
    return Secure.getInt(activity.getContentResolver(), "user_setup_complete", 0) != 0;
}
 
Example 7
Source File: SettingsFragment.java    From Android-Keyboard with Apache License 2.0 4 votes vote down vote up
private static boolean isUserSetupComplete(final Activity activity) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        return true;
    }
    return Secure.getInt(activity.getContentResolver(), "user_setup_complete", 0) != 0;
}
 
Example 8
Source File: SettingsFragment.java    From AOSP-Kayboard-7.1.2 with Apache License 2.0 4 votes vote down vote up
private static boolean isUserSetupComplete(final Activity activity) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        return true;
    }
    return Secure.getInt(activity.getContentResolver(), "user_setup_complete", 0) != 0;
}
 
Example 9
Source File: Util.java    From Greyscale with Apache License 2.0 4 votes vote down vote up
public static boolean isGreyscaleEnable(Context context) {
    ContentResolver contentResolver = context.getContentResolver();
    return Secure.getInt(contentResolver, DISPLAY_DALTONIZER_ENABLED, 0) == 1
            && Secure.getInt(contentResolver, DISPLAY_DALTONIZER, 0) == 0;
}
 
Example 10
Source File: SettingsFragment.java    From Indic-Keyboard with Apache License 2.0 4 votes vote down vote up
private static boolean isUserSetupComplete(final Activity activity) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        return true;
    }
    return Secure.getInt(activity.getContentResolver(), "user_setup_complete", 0) != 0;
}
 
Example 11
Source File: FailoverTextToSpeech.java    From talkback with Apache License 2.0 2 votes vote down vote up
/**
 * Loads the default pitch adjustment from {@link Secure#TTS_DEFAULT_PITCH}. This will take effect
 * during the next call to {@link #trySpeak}.
 */
private void updateDefaultPitch() {
  mDefaultPitch = (Secure.getInt(mResolver, Secure.TTS_DEFAULT_PITCH, 100) / 100.0f);
}
 
Example 12
Source File: FailoverTextToSpeech.java    From talkback with Apache License 2.0 2 votes vote down vote up
/**
 * Loads the default rate adjustment from {@link Secure#TTS_DEFAULT_RATE}. This will take effect
 * during the next call to {@link #trySpeak}.
 */
private void updateDefaultRate() {
  mDefaultRate = (Secure.getInt(mResolver, Secure.TTS_DEFAULT_RATE, 100) / 100.0f);
}