android.content.res.XResources Java Examples

The following examples show how to use android.content.res.XResources. 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: StatusbarSignalCluster.java    From GravityBox with Apache License 2.0 6 votes vote down vote up
public static void initResources(XSharedPreferences prefs, InitPackageResourcesParam resparam) {
    XModuleResources modRes = XModuleResources.createInstance(GravityBox.MODULE_PATH, resparam.res);

    if (prefs.getBoolean(GravityBoxSettings.PREF_KEY_SIGNAL_CLUSTER_HPLUS, false) &&
            !Utils.isMtkDevice() && !Utils.isOxygenOs35Rom()) {

        sQsHpResId = XResources.getFakeResId(modRes, R.drawable.ic_qs_signal_hp);
        sSbHpResId = XResources.getFakeResId(modRes, R.drawable.stat_sys_data_fully_connected_hp);

        resparam.res.setReplacement(sQsHpResId, modRes.fwd(R.drawable.ic_qs_signal_hp));
        resparam.res.setReplacement(sSbHpResId, modRes.fwd(R.drawable.stat_sys_data_fully_connected_hp));

        DATA_HP = new int[][]{
                {sSbHpResId, sSbHpResId, sSbHpResId, sSbHpResId},
                {sSbHpResId, sSbHpResId, sSbHpResId, sSbHpResId}
        };
        QS_DATA_HP = new int[]{sQsHpResId, sQsHpResId};
        if (DEBUG) log("H+ icon resources initialized");
    }

    String lteStyle = prefs.getString(GravityBoxSettings.PREF_KEY_SIGNAL_CLUSTER_LTE_STYLE, "DEFAULT");
    if (!lteStyle.equals("DEFAULT")) {
        resparam.res.setReplacement(ModStatusBar.PACKAGE_NAME, "bool", "config_show4GForLTE",
                lteStyle.equals("4G"));
    }
}
 
Example #2
Source File: ModVolumePanel.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
public static void initResources(XSharedPreferences prefs, InitPackageResourcesParam resparam) {
    XModuleResources modRes = XModuleResources.createInstance(GravityBox.MODULE_PATH, resparam.res);

    mIconNotifResId = XResources.getFakeResId(modRes, R.drawable.ic_audio_notification);
    resparam.res.setReplacement(mIconNotifResId, modRes.fwd(R.drawable.ic_audio_notification));
    mIconNotifMuteResId = XResources.getFakeResId(modRes, R.drawable.ic_audio_notification_mute);
    resparam.res.setReplacement(mIconNotifMuteResId, modRes.fwd(R.drawable.ic_audio_notification_mute));
}
 
Example #3
Source File: ModPowerMenu.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
private static void replaceRecoveryMessage() {
    try {
        Resources res = XResources.getSystem();
        XResources.setSystemWideReplacement(
                res.getIdentifier("reboot_to_reset_title", "string", "android"),
                mRecoveryStr);
    } catch (Throwable t) { /* ignore */ }
}
 
Example #4
Source File: Utils.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
public static boolean hasTelephonySupport() {
    try {
        Resources res = XResources.getSystem();
        return res.getBoolean(res.getIdentifier("config_voice_capable", "bool", "android"));
    } catch (Throwable t) {
        log("hasTelephonySupport(): " + t.getMessage());
        return false;
    }
}
 
Example #5
Source File: SystemWideResources.java    From GravityBox with Apache License 2.0 4 votes vote down vote up
public static void initResources(final XSharedPreferences prefs) {
    try {
        Resources systemRes = XResources.getSystem();

        int translucentDecor = Integer.valueOf(prefs.getString(GravityBoxSettings.PREF_KEY_TRANSLUCENT_DECOR, "0"));
        if (translucentDecor != 0) {
            XResources.setSystemWideReplacement("android", "bool", "config_enableTranslucentDecor", translucentDecor == 1);
        }

        if (prefs.getBoolean(GravityBoxSettings.PREF_KEY_NAVBAR_OVERRIDE, false)) {
            XResources.setSystemWideReplacement("android", "bool", "config_showNavigationBar",
                    prefs.getBoolean(GravityBoxSettings.PREF_KEY_NAVBAR_ENABLE,
                            SystemPropertyProvider.getSystemConfigBool(systemRes,
                                    "config_showNavigationBar")));
        }

        XResources.setSystemWideReplacement("android", "bool", "config_unplugTurnsOnScreen",
                prefs.getBoolean(GravityBoxSettings.PREF_KEY_UNPLUG_TURNS_ON_SCREEN,
                        SystemPropertyProvider.getSystemConfigBool(systemRes,
                                "config_unplugTurnsOnScreen")));

        if (!Utils.isVerneeApolloDevice()) {
            int pulseNotificationDelay = prefs.getInt(GravityBoxSettings.PREF_KEY_PULSE_NOTIFICATION_DELAY, -1);
            if (pulseNotificationDelay != -1) {
                XResources.setSystemWideReplacement("android", "integer", "config_defaultNotificationLedOff",
                        (pulseNotificationDelay));;
            }
        }

        XResources.setSystemWideReplacement("android", "bool", "config_sip_wifi_only", false);

        if (prefs.getBoolean(GravityBoxSettings.PREF_KEY_BRIGHTNESS_MASTER_SWITCH, false)) {
            int brightnessMin = prefs.getInt(GravityBoxSettings.PREF_KEY_BRIGHTNESS_MIN, 20);
            XResources.setSystemWideReplacement(
                "android", "integer", "config_screenBrightnessSettingMinimum", brightnessMin);
            if (DEBUG) log("Minimum brightness value set to: " + brightnessMin);

            int screenDim = prefs.getInt(GravityBoxSettings.PREF_KEY_SCREEN_DIM_LEVEL, 10);
            XResources.setSystemWideReplacement(
                    "android", "integer", "config_screenBrightnessDim", screenDim);
            if (DEBUG) log("Screen dim level set to: " + screenDim);
        }

        // Safe media volume
        Utils.TriState triState = Utils.TriState.valueOf(prefs.getString(
                GravityBoxSettings.PREF_KEY_SAFE_MEDIA_VOLUME, "DEFAULT"));
        if (DEBUG) log(GravityBoxSettings.PREF_KEY_SAFE_MEDIA_VOLUME + ": " + triState);
        if (triState != Utils.TriState.DEFAULT) {
            XResources.setSystemWideReplacement("android", "bool", "config_safe_media_volume_enabled",
                    triState == Utils.TriState.ENABLED);
            if (DEBUG) log("config_safe_media_volume_enabled: " + (triState == Utils.TriState.ENABLED));
        }
    } catch (Throwable t) {
        XposedBridge.log(t);
    }
}
 
Example #6
Source File: XposedModule.java    From ForceDoze with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void initZygote(IXposedHookZygoteInit.StartupParam startupParam) throws Throwable {
    XResources.setSystemWideReplacement("android", "bool", "config_enableAutoPowerModes", true);
}
 
Example #7
Source File: XC_LayoutInflated.java    From xposed-art with Apache License 2.0 4 votes vote down vote up
@Override
public void unhook() {
	XResources.unhookLayout(resDir, id, XC_LayoutInflated.this);
}