Java Code Examples for android.content.res.XModuleResources#createInstance()
The following examples show how to use
android.content.res.XModuleResources#createInstance() .
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: ModSettings.java From GravityBox with Apache License 2.0 | 6 votes |
public static void initPackageResources(final XSharedPreferences prefs, final InitPackageResourcesParam resparam) { try { XModuleResources modRes = XModuleResources.createInstance(GravityBox.MODULE_PATH, resparam.res); resparam.res.setReplacement(PACKAGE_NAME, "array", "window_animation_scale_entries", modRes.fwd(R.array.window_animation_scale_entries)); resparam.res.setReplacement(PACKAGE_NAME, "array", "window_animation_scale_values", modRes.fwd(R.array.window_animation_scale_values)); resparam.res.setReplacement(PACKAGE_NAME, "array", "transition_animation_scale_entries", modRes.fwd(R.array.transition_animation_scale_entries)); resparam.res.setReplacement(PACKAGE_NAME, "array", "transition_animation_scale_values", modRes.fwd(R.array.transition_animation_scale_values)); resparam.res.setReplacement(PACKAGE_NAME, "array", "animator_duration_scale_entries", modRes.fwd(R.array.animator_duration_scale_entries)); resparam.res.setReplacement(PACKAGE_NAME, "array", "animator_duration_scale_values", modRes.fwd(R.array.animator_duration_scale_values)); } catch (Throwable t) { XposedBridge.log(t); } }
Example 2
Source File: StatusbarSignalCluster.java From GravityBox with Apache License 2.0 | 6 votes |
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 3
Source File: Main.java From MinMinGuard with GNU General Public License v3.0 | 6 votes |
private void UnpackResources() { try { resources = XModuleResources.createInstance(MODULE_PATH, null); byte[] array = XposedHelpers.assetAsByteArray(resources, "host/output_file"); String decoded = new String(array); String[] sUrls = decoded.split("\n"); Collections.addAll(patterns, sUrls); array = XposedHelpers.assetAsByteArray(resources, "host/mmg_pattern"); decoded = new String(array); sUrls = decoded.split("\n"); Collections.addAll(patterns, sUrls); } catch (Exception e) { } }
Example 4
Source File: ModVolumePanel.java From GravityBox with Apache License 2.0 | 5 votes |
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 5
Source File: ModQsTiles.java From GravityBox with Apache License 2.0 | 5 votes |
public static void initResources(final InitPackageResourcesParam resparam) { XModuleResources modRes = XModuleResources.createInstance(GravityBox.MODULE_PATH, resparam.res); RES_IDS.NM_TITLE = resparam.res.addResource(modRes, R.string.qs_tile_network_mode); RES_IDS.RM_TITLE = resparam.res.addResource(modRes, R.string.qs_tile_ringer_mode); RES_IDS.SA_TITLE = resparam.res.addResource(modRes, R.string.qs_tile_stay_awake); if (Utils.isXperiaDevice()) { resparam.res.setReplacement(PACKAGE_NAME, "integer", "config_maxToolItems", 60); } }
Example 6
Source File: BlocklistInitUtils.java From AdBlocker_Reborn with GNU General Public License v3.0 | 5 votes |
public void init(IXposedHookZygoteInit.StartupParam startupParam, String resName, HashSet blocklistName) throws IOException { String MODULE_PATH = startupParam.modulePath; Resources res = XModuleResources.createInstance(MODULE_PATH, null); byte[] array = XposedHelpers.assetAsByteArray(res, resName); String decoded = decodeString(resName, array); String[] sUrls = decoded.split("\n"); Collections.addAll(blocklistName, sUrls); }
Example 7
Source File: XposedMod.java From Identiconizer with Apache License 2.0 | 5 votes |
@Override public void handleInitPackageResources(XC_InitPackageResources.InitPackageResourcesParam resparam) throws Throwable { if (!resparam.packageName.equals("com.android.providers.contacts")) return; Resources res = XModuleResources.createInstance(MODULE_PATH, resparam.res); NOTIF_ICON_RES_ID = resparam.res.addResource(res, R.drawable.ic_settings_identicons); }
Example 8
Source File: AppOpsXposed.java From AppOpsXposed with GNU General Public License v3.0 | 5 votes |
@Override public void initZygote(StartupParam startupParam) throws Throwable { mModPath = startupParam.modulePath; Res.modRes = XModuleResources.createInstance(mModPath, null); Res.modPrefs = new XSharedPreferences(AppOpsXposed.class.getPackage().getName()); Res.modPrefs.makeWorldReadable(); }
Example 9
Source File: DataHook.java From XposedNavigationBar with GNU General Public License v3.0 | 4 votes |
public static void init(IXposedHookZygoteInit.StartupParam startupParam) throws Throwable { XSharedPreferences pre = new XSharedPreferences(BuildConfig.APPLICATION_ID, "xpnavbar"); pre.makeWorldReadable(); String json = pre.getString(ConstantStr.SHORT_CUT_DATA, ""); XpLog.i("short_cut_data " + json); expandStatusBarWithRoot = pre.getBoolean(SPUtil.ROOT_DOWN, false); clearMenLevel = pre.getInt(SPUtil.CLEAR_MEM_LEVEL, 200); //获取主导行栏小点的位置 homePointPosition = pre.getInt(ConstantStr.HOME_POINT, 0); chameleonNavbar = pre.getBoolean(SPUtil.CHAMELEON_NAVBAR, false); rootDown = pre.getBoolean(SPUtil.ROOT_DOWN, false); vibrate = pre.getBoolean(SPUtil.NAVBAR_VIBRATE, false); //获取快捷按钮设置数据 Gson gson = new Gson(); //在第一次激活重新启动的时候,可能因为没有设置任何快捷按钮,导致这里报错 try { shortCutList = gson.fromJson(json, ShortCutData.class).getData(); } catch (Exception e) { shortCutList = new ArrayList<>(); } //获取图片缩放大小 iconScale = pre.getInt(ConstantStr.ICON_SIZE, 40); navbarHeight = pre.getInt(SPUtil.NAVBAR_HEIGHT, 100); navbarOpt = pre.getBoolean(SPUtil.NAVBAR_HEIGHT_OPT, false); goHomeAfterClick = pre.getBoolean(SPUtil.GO_HOME_AFTER_CLICK, false); //加载图片资源文件 Resources res = XModuleResources.createInstance(startupParam.modulePath, null); byte[] backImg = XposedHelpers.assetAsByteArray(res, "back.png"); byte[] clearMenImg = XposedHelpers.assetAsByteArray(res, "clear_mem.png"); byte[] clearNotificationImg = XposedHelpers.assetAsByteArray(res, "clear_notification.png"); byte[] downImg = XposedHelpers.assetAsByteArray(res, "down.png"); byte[] lightImg = XposedHelpers.assetAsByteArray(res, "light.png"); byte[] quickNoticesImg = XposedHelpers.assetAsByteArray(res, "quick_notices.png"); byte[] screenOffImg = XposedHelpers.assetAsByteArray(res, "screenoff.png"); // byte[] upImg = XposedHelpers.assetAsByteArray(res, "up.png"); byte[] volume = XposedHelpers.assetAsByteArray(res, "volume.png"); byte[] smallPonit = XposedHelpers.assetAsByteArray(res, "small_point.png"); byte[] home = XposedHelpers.assetAsByteArray(res, "ic_home.png"); byte[] startActs = XposedHelpers.assetAsByteArray(res, "start_acts.png"); byte[] playMusic = XposedHelpers.assetAsByteArray(res, "ic_music.png"); byte[] pauseMusic = XposedHelpers.assetAsByteArray(res, "ic_pause.png"); byte[] previousMusic = XposedHelpers.assetAsByteArray(res, "ic_previous.png"); byte[] nextMusic = XposedHelpers.assetAsByteArray(res, "ic_next.png"); byte[] scanWeChat = XposedHelpers.assetAsByteArray(res, "wechat_qr.png"); byte[] scanAlipay = XposedHelpers.assetAsByteArray(res, "alipay_qr.png"); byte[] screenshot = XposedHelpers.assetAsByteArray(res, "ic_image.png"); byte[] navBack = XposedHelpers.assetAsByteArray(res, "ic_sysbar_back.png"); byte[] navHome = XposedHelpers.assetAsByteArray(res, "ic_sysbar_home.png"); byte[] navRecent = XposedHelpers.assetAsByteArray(res, "ic_sysbar_recent.png"); byte[] clipBoard = XposedHelpers.assetAsByteArray(res, "ic_clipboard.png"); byte[] command = XposedHelpers.assetAsByteArray(res, "ic_command.png"); byte[] navHide = XposedHelpers.assetAsByteArray(res, "ic_nav_down.png"); mapImgRes.put(ConstantStr.FUNC_BACK_CODE, backImg); mapImgRes.put(ConstantStr.FUNC_CLEAR_MEM_CODE, clearMenImg); mapImgRes.put(ConstantStr.FUNC_CLEAR_NOTIFICATION_CODE, clearNotificationImg); mapImgRes.put(ConstantStr.FUNC_DOWN_CODE, downImg); mapImgRes.put(ConstantStr.FUNC_LIGHT_CODE, lightImg); mapImgRes.put(ConstantStr.FUNC_QUICK_NOTICE_CODE, quickNoticesImg); mapImgRes.put(ConstantStr.FUNC_SCREEN_OFF_CODE, screenOffImg); // mapImgRes.put(ConstantStr.UP, upImg); mapImgRes.put(ConstantStr.FUNC_VOLUME_CODE, volume); mapImgRes.put(ConstantStr.FUNC_SMALL_POINT_CODE, smallPonit); mapImgRes.put(ConstantStr.FUNC_HOME_CODE, home); mapImgRes.put(ConstantStr.FUNC_START_ACTS_CODE, startActs); mapImgRes.put(ConstantStr.FUNC_PLAY_MUSIC_CODE, playMusic); mapImgRes.put(ConstantStr.FUNC_NEXT_PLAY_CODE, nextMusic); mapImgRes.put(ConstantStr.FUNC_PREVIOUS_PLAY_CODE, previousMusic); mapImgRes.put(ConstantStr.FUNC_WECHAT_SACNNER_CODE, scanWeChat); mapImgRes.put(ConstantStr.FUNC_ALIPAY_SACNNER_CODE, scanAlipay); mapImgRes.put(ConstantStr.FUNC_SCREEN_SHOT_CODE, screenshot); mapImgRes.put(ConstantStr.FUNC_NAV_BACK_CODE, navBack); mapImgRes.put(ConstantStr.FUNC_NAV_HOME_CODE, navHome); mapImgRes.put(ConstantStr.FUNC_NAV_RECENT_CODE, navRecent); mapImgRes.put(ConstantStr.FUNC_CLIPBOARD_CODE, clipBoard); mapImgRes.put(ConstantStr.FUNC_COMMAND_CODE, command); mapImgRes.put(ConstantStr.FUNC_NAV_HIDE_CODE, navHide); }