本文整理汇总了Java中android.content.res.XResources类的典型用法代码示例。如果您正苦于以下问题:Java XResources类的具体用法?Java XResources怎么用?Java XResources使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XResources类属于android.content.res包,在下文中一共展示了XResources类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initResources
import android.content.res.XResources; //导入依赖的package包/类
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"));
}
}
示例2: handleInitPackageResources
import android.content.res.XResources; //导入依赖的package包/类
@Override
public void handleInitPackageResources(XC_InitPackageResources.InitPackageResourcesParam initPackageResourcesParam) throws Throwable {
if (!HookEntry.PKG_COOLAPK.equals(initPackageResourcesParam.packageName))
return;
// 替换图标
final String PATH_CURRENT_ICON = prefs.getString(PREFS_ICON_SAVE_PATH, null);
if (PATH_CURRENT_ICON == null) {
XposedBridge.log(TAG + "Replace icon disabled, skipping");
return;
}
final File file = new File(PATH_CURRENT_ICON);
if (!file.exists()) {
XposedBridge.log(TAG + "Replace icon disabled, skipping");
} else {
XposedBridge.log(TAG + "Replacing icon...");
initPackageResourcesParam.res.setReplacement(HookEntry.PKG_COOLAPK, "mipmap", "ic_launcher", new XResources.DrawableLoader() {
@Override
public Drawable newDrawable(XResources xResources, int i) throws Throwable {
return BitmapDrawable.createFromPath(PATH_CURRENT_ICON);
}
});
}
}
示例3: createInstance
import android.content.res.XResources; //导入依赖的package包/类
public static ModuleResources createInstance(String modulePath, XResources origRes)
{
if(modulePath == null)
throw new IllegalArgumentException("modulePath must not be null");
AssetManager assets = (AssetManager)newInstance(AssetManager.class);
callMethod(assets, "addAssetPath", modulePath);
ModuleResources res;
if(origRes != null)
res = new ModuleResources(assets, origRes.getDisplayMetrics(), origRes.getConfiguration());
else
res = new ModuleResources(assets, null, null);
AndroidAppHelper.addActiveResource(modulePath, res.hashCode(), false, res);
return res;
}
示例4: initZygote
import android.content.res.XResources; //导入依赖的package包/类
@Override
public void initZygote(IXposedHookZygoteInit.StartupParam startupParam) throws Throwable {
XposedBridge.log("CleanLockscreen initZygote");
if(android.os.Build.VERSION.SDK_INT<=20)
packageName = "com.android.keyguard";
else
packageName = "com.android.systemui";
MODULE_PATH = startupParam.modulePath;
if(MODULE_PATH == null){
XposedBridge.log("CleanLockscreen modulePath is null!");
}
prefs = new XSharedPreferences(CleanLockscreen.class.getPackage().getName());
// Remove emergency call text
if (prefs.getBoolean("remove_emergency", false)) {
XResources.setSystemWideReplacement("android:string/lockscreen_emergency_call", "");
}
XposedBridge.log("CleanLockscreen initZygote complete");
}
示例5: themeListItemView
import android.content.res.XResources; //导入依赖的package包/类
private static void themeListItemView(XResources res, String layoutName, final boolean extraLine) {
res.hookLayout(HANGOUTS_RES_PKG_NAME, "layout", layoutName, new XC_LayoutInflated() {
public void handleLayoutInflated(LayoutInflatedParam liparam) throws Throwable {
((LinearLayout) liparam.view.findViewById(liparam.res.getIdentifier("icon", "id",
HANGOUTS_RES_PKG_NAME)).getParent()).setBackgroundColor(COLOR_GROUP_5);
((ImageView) liparam.view.findViewById(liparam.res.getIdentifier("icon", "id",
HANGOUTS_RES_PKG_NAME))).setColorFilter(COLOR_GROUP_1, PorterDuff.Mode.SRC_IN);
((TextView) liparam.view.findViewById(liparam.res.getIdentifier("text", "id",
HANGOUTS_RES_PKG_NAME))).setTextColor(COLOR_GROUP_1);
if (extraLine) {
((TextView) liparam.view.findViewById(liparam.res.getIdentifier("byline", "id",
HANGOUTS_RES_PKG_NAME))).setTextColor(COLOR_GROUP_2);
}
}
});
}
示例6: initZygote
import android.content.res.XResources; //导入依赖的package包/类
@InitZygote(summary = "自動輝度調整")
public static void initZygote(StartupParam startupParam,
ModBrightnessSettingsGen mBrightnessSettings) throws Throwable {
// 自動輝度調整
if (StringUtils.isNotEmpty(mBrightnessSettings.configAutoBrightnessLevels)
&& StringUtils
.isNotEmpty(mBrightnessSettings.configAutoBrightnessLcdBacklightValues)) {
int[] autoBrightnessLevels = makeIntArray(mBrightnessSettings.configAutoBrightnessLevels);
int[] autoBrightnessLcdBacklightValues = makeIntArray(mBrightnessSettings.configAutoBrightnessLcdBacklightValues);
if ((autoBrightnessLevels.length + 1) != autoBrightnessLcdBacklightValues.length) {
throw new IllegalArgumentException("パラメータ数エラー");
}
XResources.setSystemWideReplacement("android", "array",
"config_autoBrightnessLevels",
autoBrightnessLevels);
XResources.setSystemWideReplacement("android", "array",
"config_autoBrightnessLcdBacklightValues",
autoBrightnessLcdBacklightValues);
XResources.setSystemWideReplacement("android", "bool",
"config_automatic_brightness_available", true);
}
}
示例7: initResources
import android.content.res.XResources; //导入依赖的package包/类
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));
}
示例8: replaceRecoveryMessage
import android.content.res.XResources; //导入依赖的package包/类
private static void replaceRecoveryMessage() {
try {
Resources res = XResources.getSystem();
XResources.setSystemWideReplacement(
res.getIdentifier("reboot_to_reset_title", "string", "android"),
mRecoveryStr);
} catch (Throwable t) { /* ignore */ }
}
示例9: hasTelephonySupport
import android.content.res.XResources; //导入依赖的package包/类
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;
}
}
示例10: initZygote
import android.content.res.XResources; //导入依赖的package包/类
@Override
public void initZygote(IXposedHookZygoteInit.StartupParam startupParam) throws Throwable {
loadPrefs();
/*
// Tried changing dark theme as white, didn't work
XResources.setSystemWideReplacement("android", "color", "primary_text_default_material_dark", Color.parseColor("#de000000"));
XResources.setSystemWideReplacement("android", "color", "secondary_text_default_material_dark", Color.parseColor("#8a000000"));
*/
if(DISABLE_EUI) {
XResources.setSystemWideReplacement("android", "dimen", "status_bar_icon_size", new XResources.DimensionReplacement(20, TypedValue.COMPLEX_UNIT_DIP));
}
}
示例11: handleInitPackageResources
import android.content.res.XResources; //导入依赖的package包/类
@Override
public void handleInitPackageResources(XC_InitPackageResources.InitPackageResourcesParam resParam) throws Throwable {
XResources r = resParam.res;
navBarString = r.getString(r.getIdentifier("nav_bar", "string", SYSUI_PKG_NAME));
colorAppearanceString = r.getString(r.getIdentifier("color_and_appearance", "string", SYSUI_PKG_NAME));
useDarkThemeString = r.getString(r.getIdentifier("use_dark_theme", "string", SYSUI_PKG_NAME));
nightModeDisclaimer = r.getString(r.getIdentifier("night_mode_disclaimer", "string", SYSUI_PKG_NAME));
}
示例12: replaceSystemWideThemes
import android.content.res.XResources; //导入依赖的package包/类
private void replaceSystemWideThemes() {
Logger.v("Replacing system-wide Theme resources.");
Logger.logTheme(mSettings);
XResources.setSystemWideReplacement("android", "color", "material_blue_grey_900",
mSettings.getPrimaryColor());
XResources.setSystemWideReplacement("android", "color", "primary_material_dark",
mSettings.getPrimaryColor());
// XResources.setSystemWideReplacement("android", "color", "primary_material_light",
// Common.enlightColor(mSettings.getPrimaryColor(), 2.25f));
XResources.setSystemWideReplacement("android", "color", "material_blue_grey_950",
mSettings.getPrimaryDarkColor());
XResources.setSystemWideReplacement("android", "color", "primary_dark_material_dark",
mSettings.getPrimaryDarkColor());
// XResources.setSystemWideReplacement("android", "color", "primary_dark_material_light",
// Common.enlightColor(mSettings.getPrimaryColor(), 1.65f));
XResources.setSystemWideReplacement("android", "color", "material_deep_teal_500",
mSettings.getAccentColor());
XResources.setSystemWideReplacement("android", "color", "accent_material_dark",
mSettings.getAccentColor());
XResources.setSystemWideReplacement("android", "color", "accent_material_light",
mSettings.getAccentColor());
XResources.setSystemWideReplacement("android", "color", "material_deep_teal_200",
Common.enlightColor(mSettings.getAccentColor(), 1.5f));
Logger.v("Theme resources replaced.");
}
示例13: initZygote
import android.content.res.XResources; //导入依赖的package包/类
@Override
public void initZygote(StartupParam startupParam) throws Throwable {
prefs = new XSharedPreferences(LollipopPowerMenu.class.getPackage()
.getName());
prefs.makeWorldReadable();
ArrayList<String> itemsList = new ArrayList<String>();
if (isEnabled(GLOBAL_ACTION_KEY_POWER, true)) {
itemsList.add(GLOBAL_ACTION_KEY_POWER);
}
if (isEnabled(GLOBAL_ACTION_KEY_AIRPLANE, false)) {
itemsList.add(GLOBAL_ACTION_KEY_AIRPLANE);
}
if (isEnabled(GLOBAL_ACTION_KEY_SILENT, false)) {
itemsList.add(GLOBAL_ACTION_KEY_SILENT);
}
if (isEnabled(GLOBAL_ACTION_KEY_USERS, false)) {
itemsList.add(GLOBAL_ACTION_KEY_USERS);
}
if (isEnabled(GLOBAL_ACTION_KEY_SETTINGS, false)) {
itemsList.add(GLOBAL_ACTION_KEY_SETTINGS);
}
if (isEnabled(GLOBAL_ACTION_KEY_LOCKDOWN, false)) {
itemsList.add(GLOBAL_ACTION_KEY_LOCKDOWN);
}
String[] powerMenuItems = itemsList
.toArray(new String[itemsList.size()]);
XResources.setSystemWideReplacement("android", "array",
"config_globalActionsList", powerMenuItems);
}
示例14: initZygote
import android.content.res.XResources; //导入依赖的package包/类
@Override
public void initZygote(IXposedHookZygoteInit.StartupParam param) throws Throwable
{
SystemUIResources.initFlags();
MODULE_PATH = param.modulePath;
prefs = new XSharedPreferences(XposedMain.class.getPackage().getName());
prefs.makeWorldReadable();
if(JELLYBEAN && prefs.getBoolean("key_hide_shortcuts", false))
{
XResources.setSystemWideReplacement("android", "drawable", "ic_lockscreen_camera_hint", 0);
XResources.setSystemWideReplacement("android", "drawable", "ic_lockscreen_other_widgets_hint", 0);
}
}
示例15: handleInitPackageResources
import android.content.res.XResources; //导入依赖的package包/类
@Override
public void handleInitPackageResources(XC_InitPackageResources.InitPackageResourcesParam resParam) throws Throwable {
if(!resParam.packageName.equals("com.lge.appwidget.clock") && !resParam.packageName.equals("com.lge.clock"))
return;
final String moduleName = QuickcirclemodSettings.class.getPackage().getName();
final Clock c = getActiveClock();
if(c == null)
return;
String resourcetype;
if(Build.DEVICE.equals("g2")) {
resourcetype = "drawable";
} else {
resourcetype = "raw";
}
for(final String file : c.getFiles()) {
try {
resParam.res.setReplacement(resParam.packageName, resourcetype, removeExtension(file), new XResources.DrawableLoader() {
@Override
public Drawable newDrawable(XResources xResources, int i) throws Throwable {
BitmapDrawable drawable = new BitmapDrawable("/data/data/" + moduleName + "/files/" + c.getId() + "/" + file);
drawable.setTargetDensity(c.getDevice() == Clock.Device.G2 ? 480 : 640);
return drawable;
}
});
} catch (Throwable ex) {
XposedBridge.log(ex);
}
}
}