当前位置: 首页>>代码示例>>Java>>正文


Java XResources类代码示例

本文整理汇总了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"));
    }
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:27,代码来源:StatusbarSignalCluster.java

示例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);
            }
        });
    }
}
 
开发者ID:Trumeet,项目名称:CoolApkToolbox,代码行数:24,代码来源:HookClass.java

示例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;
}
 
开发者ID:greg2001,项目名称:GemXperiaXposed,代码行数:18,代码来源:ModuleResources.java

示例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");
}
 
开发者ID:indecisivemal,项目名称:CleanLockscreen,代码行数:23,代码来源:CleanLockscreen.java

示例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);
            }
        }
    });
}
 
开发者ID:kmark,项目名称:XHangouts,代码行数:17,代码来源:UiColorize.java

示例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);
    }
}
 
开发者ID:75py,项目名称:XUtilities,代码行数:24,代码来源:ModBrightness.java

示例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));
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:9,代码来源:ModVolumePanel.java

示例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 */ }
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:9,代码来源:ModPowerMenu.java

示例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;
    }
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:10,代码来源:Utils.java

示例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));
        }

    }
 
开发者ID:aruncodes,项目名称:eui_moder,代码行数:15,代码来源:MainClass.java

示例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));
}
 
开发者ID:DVDAndroid,项目名称:Xposed-NougatSystemUITunerExtender,代码行数:10,代码来源:XposedMod.java

示例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.");
    }
 
开发者ID:woalk,项目名称:HTCAuthorizer,代码行数:28,代码来源:X_Mod.java

示例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);
}
 
开发者ID:pylerSM,项目名称:LollipopPowerMenu,代码行数:30,代码来源:LollipopPowerMenu.java

示例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);
  }
}
 
开发者ID:greg2001,项目名称:GemXperiaXposed,代码行数:16,代码来源:XposedMain.java

示例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);
           }
       }
}
 
开发者ID:BigBoot,项目名称:qcthemer,代码行数:36,代码来源:Module.java


注:本文中的android.content.res.XResources类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。