Search in sources :

Example 51 with Resources

use of android.content.res.Resources in project android_frameworks_base by ParanoidAndroid.

the class DisplayPowerController method updateAutomaticBrightnessSettings.

private void updateAutomaticBrightnessSettings() {
    int[] lux = getIntArrayForSetting(Settings.System.AUTO_BRIGHTNESS_LUX);
    int[] values = getIntArrayForSetting(Settings.System.AUTO_BRIGHTNESS_BACKLIGHT);
    Resources res = mContext.getResources();
    mScreenAutoBrightnessSpline = null;
    mUseSoftwareAutoBrightnessConfig = true;
    if (lux != null && values != null) {
        mScreenAutoBrightnessSpline = createAutoBrightnessSpline(lux, values);
        if (mScreenAutoBrightnessSpline == null) {
            Slog.w(TAG, "Found invalid auto-brightness configuration, falling back to default");
        }
    }
    if (mScreenAutoBrightnessSpline == null) {
        lux = res.getIntArray(com.android.internal.R.array.config_autoBrightnessLevels);
        values = res.getIntArray(com.android.internal.R.array.config_autoBrightnessLcdBacklightValues);
        mScreenAutoBrightnessSpline = createAutoBrightnessSpline(lux, values);
    }
    if (mScreenAutoBrightnessSpline == null) {
        Slog.e(TAG, "Error in config.xml.  config_autoBrightnessLcdBacklightValues " + "(size " + values.length + ") " + "must be monotic and have exactly one more entry than " + "config_autoBrightnessLevels (size " + lux.length + ") " + "which must be strictly increasing.  " + "Auto-brightness will be disabled.");
        mUseSoftwareAutoBrightnessConfig = false;
        return;
    }
}
Also used : Resources(android.content.res.Resources)

Example 52 with Resources

use of android.content.res.Resources in project android_frameworks_base by ParanoidAndroid.

the class PowerManagerService method readConfigurationLocked.

private void readConfigurationLocked() {
    final Resources resources = mContext.getResources();
    mWakeUpWhenPluggedOrUnpluggedConfig = resources.getBoolean(com.android.internal.R.bool.config_unplugTurnsOnScreen);
    mDreamsSupportedConfig = resources.getBoolean(com.android.internal.R.bool.config_dreamsSupported);
    mDreamsEnabledByDefaultConfig = resources.getBoolean(com.android.internal.R.bool.config_dreamsEnabledByDefault);
    mDreamsActivatedOnSleepByDefaultConfig = resources.getBoolean(com.android.internal.R.bool.config_dreamsActivatedOnSleepByDefault);
    mDreamsActivatedOnDockByDefaultConfig = resources.getBoolean(com.android.internal.R.bool.config_dreamsActivatedOnDockByDefault);
}
Also used : Resources(android.content.res.Resources)

Example 53 with Resources

use of android.content.res.Resources in project android_frameworks_base by ParanoidAndroid.

the class MountServiceTests method copyRawToFile.

private void copyRawToFile(int rawResId, File outFile) {
    Resources res = mContext.getResources();
    InputStream is = null;
    try {
        is = res.openRawResource(rawResId);
    } catch (NotFoundException e) {
        fail("Failed to load resource with id: " + rawResId);
    }
    FileUtils.setPermissions(outFile.getPath(), FileUtils.S_IRWXU | FileUtils.S_IRWXG | FileUtils.S_IRWXO, -1, -1);
    assertTrue(FileUtils.copyToFile(is, outFile));
    FileUtils.setPermissions(outFile.getPath(), FileUtils.S_IRWXU | FileUtils.S_IRWXG | FileUtils.S_IRWXO, -1, -1);
}
Also used : InputStream(java.io.InputStream) NotFoundException(android.content.res.Resources.NotFoundException) Resources(android.content.res.Resources)

Example 54 with Resources

use of android.content.res.Resources in project android_frameworks_base by ParanoidAndroid.

the class GsmAlphabet method enableCountrySpecificEncodings.

/**
     * Enable country-specific language tables from MCC-specific overlays.
     * @context the context to use to get the TelephonyManager
     */
private static void enableCountrySpecificEncodings() {
    Resources r = Resources.getSystem();
    // See comments in frameworks/base/core/res/res/values/config.xml for allowed values
    sEnabledSingleShiftTables = r.getIntArray(R.array.config_sms_enabled_single_shift_tables);
    sEnabledLockingShiftTables = r.getIntArray(R.array.config_sms_enabled_locking_shift_tables);
    if (sEnabledSingleShiftTables.length > 0) {
        sHighestEnabledSingleShiftCode = sEnabledSingleShiftTables[sEnabledSingleShiftTables.length - 1];
    } else {
        sHighestEnabledSingleShiftCode = 0;
    }
}
Also used : Resources(android.content.res.Resources)

Example 55 with Resources

use of android.content.res.Resources in project android_frameworks_base by ParanoidAndroid.

the class Summarizer method getWebKitVersionFromUserAgentString.

private String getWebKitVersionFromUserAgentString() {
    Resources resources = new Resources(new AssetManager(), new DisplayMetrics(), new Configuration());
    String userAgent = resources.getString(com.android.internal.R.string.web_user_agent);
    Matcher matcher = Pattern.compile("AppleWebKit/([0-9]+?\\.[0-9])").matcher(userAgent);
    if (matcher.find()) {
        return matcher.group(1);
    }
    return "unknown";
}
Also used : AssetManager(android.content.res.AssetManager) Configuration(android.content.res.Configuration) Matcher(java.util.regex.Matcher) Resources(android.content.res.Resources) DisplayMetrics(android.util.DisplayMetrics)

Aggregations

Resources (android.content.res.Resources)3268 Context (android.content.Context)304 Intent (android.content.Intent)286 View (android.view.View)239 TextView (android.widget.TextView)217 PackageManager (android.content.pm.PackageManager)216 IOException (java.io.IOException)212 Drawable (android.graphics.drawable.Drawable)199 NameNotFoundException (android.content.pm.PackageManager.NameNotFoundException)179 Paint (android.graphics.Paint)179 DisplayMetrics (android.util.DisplayMetrics)175 Bitmap (android.graphics.Bitmap)174 Configuration (android.content.res.Configuration)154 Point (android.graphics.Point)153 XmlPullParserException (org.xmlpull.v1.XmlPullParserException)139 ArrayList (java.util.ArrayList)137 XmlResourceParser (android.content.res.XmlResourceParser)133 TypedArray (android.content.res.TypedArray)132 Test (org.junit.Test)127 PendingIntent (android.app.PendingIntent)123