Java 类android.content.res.XModuleResources 实例源码

项目:GravityBox    文件:ModSettings.java   
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);
    }
}
项目:GravityBox    文件:StatusbarSignalCluster.java   
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"));
    }
}
项目:ToastUI    文件:SuperActivityToast.java   
/**
 * Public constructor for a SuperActivityToast.
 *
 * @param context An Activity Context
 * @param style The desired Style             
 * @param type The desired SuperActivityToast type    
 * @param viewGroupId The id of the ViewGroup to attach the SuperActivityToast to            
 */
public SuperActivityToast(@NonNull Context context, @NonNull Style style,
                          @Style.Type int type, @IdRes int viewGroupId,XModuleResources modRes) {
    super(context, style, type, viewGroupId,modRes);

    if (!(context instanceof Activity)) {
        throw new IllegalArgumentException("SuperActivityToast Context must be an Activity.");
    }

    this.mContext = context;
    this.mStyle = this.getStyle(); // Style is created in the super(context) call 

    // Try to find the ViewGroup id in the layout
    this.mViewGroup = (ViewGroup) ((Activity) context).findViewById(viewGroupId);
    if (this.mViewGroup == null) {
        Log.e(getClass().getName(), "Could not find a ViewGroup with id " + String.valueOf(viewGroupId));
        this.mViewGroup = (ViewGroup) ((Activity) context).findViewById(android.R.id.content);
    }
}
项目:ToastUI    文件:SuperToast.java   
/**
 * Protected constructor that is overridden by the SuperActivityToast class.         
 */
protected SuperToast(@NonNull Context context,  @NonNull Style style, @Style.Type int type, @IdRes int viewGroupID, XModuleResources modRes) {
    this.mContext = context;
    this.mStyle = style;
    this.mStyle.type = type;

    // TYPE_BUTTON styles are the only ones that look different from the styles set by the Style() constructor
    if (type == Style.TYPE_BUTTON) {
        this.mStyle.yOffset = BackgroundUtils.convertToDIP(24);
        this.mStyle.width = FrameLayout.LayoutParams.MATCH_PARENT;
    }

    final LayoutInflater layoutInflater = (LayoutInflater) context
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    this.mView = onCreateView(context, layoutInflater, type, modRes);
    this.mTextView = (TextView) this.mView.findViewById(R.id.message);
    this.mImageView = (ImageView) this.mView.findViewById(R.id.toasticon);
}
项目:LenovoMultiWindowMod    文件:LenovoMultiWinMod.java   
@Override
public void handleInitPackageResources(InitPackageResourcesParam resparam) throws Throwable {
    if (!resparam.packageName.equals("com.lenovo.multiwindow"))
        return;
    String appString = prefs.getString(Common.PREF_APPS, null);
    XposedBridge.log("---> hooking multiwindow");
    XModuleResources modRes = XModuleResources.createInstance(MODULE_PATH, resparam.res);
    if (appString == null || appString == "") {
        resparam.res.setReplacement("com.lenovo.multiwindow", "array", "whitelist_package", modRes.fwd(de.testroid.xposed.lenovomultiwinmod.R.array.new_array));
        resparam.res.setReplacement("com.lenovo.multiwindow", "array", "whitelist_class", modRes.fwd(de.testroid.xposed.lenovomultiwinmod.R.array.new_array));
        XposedBridge.log("---> replacement w/ static new_array done");
    } else {
        String[] newString = convertToArray(appString);
        resparam.res.setReplacement("com.lenovo.multiwindow", "array", "whitelist_package", newString);
        resparam.res.setReplacement("com.lenovo.multiwindow", "array", "whitelist_class", newString);
        XposedBridge.log("---> replacement w/ dynamic arrAppList done");
    }
}
项目:Parallel    文件:ParallelMain.java   
@Override
public void initZygote(StartupParam startupParam) throws Throwable {


    sMainPref = new XSharedPreferences(Common.PACKAGE_PER_FONTS, Common.PEFERENCE_MAIN);
    sAppPref = new XSharedPreferences(Common.PACKAGE_PER_FONTS, Common.PEFERENCE_APP);
    sForcePref = new XSharedPreferences(Common.PACKAGE_PER_FONTS, Common.PEFERENCE_FORCE);

    MODULE_PATH = startupParam.modulePath;
    sModuleResources = XModuleResources.createInstance(MODULE_PATH, null);

    sFontLoader = new FontLoader(sMainPref);
    sEnableAllApps = sMainPref.getBoolean(Common.KEY_ENABLE_ALL_APPS, false);

    // MIUI INIT
    MiHook.drmManager();
}
项目:MinMinGuard    文件:Main.java   
@Override
public void initZygote(StartupParam startupParam) throws Throwable {

    pref = new XSharedPreferences(MY_PACKAGE_NAME);
    Util.pref = pref;

    MODULE_PATH = startupParam.modulePath;

    res = XModuleResources.createInstance(MODULE_PATH, null);
    byte[] array = XposedHelpers.assetAsByteArray(res, "host/output_file");
    String decoded = new String(array);
    String[] sUrls = decoded.split("\n");

    urls = new HashSet<>();
    for(String url : sUrls) {
        urls.add(url);
    }
}
项目:HtcOneTweaker    文件:Messaging.java   
public static void hookUnread(final LoadPackageParam paramLoadPackageParam, String packageName)
{
    findAndHookMethod(packageName + ".ui.ConversationListBaseAdapter", paramLoadPackageParam.classLoader, "bind", "android.view.View", "android.content.Context", packageName + ".ui.ConversationHeader", new XC_MethodHook()
    {
        protected void afterHookedMethod(MethodHookParam param) throws Throwable
        {
            boolean isRead = (Boolean) XposedHelpers.callMethod(param.args[2], "isRead");
            View row = (View) param.args[0];

            if (Background == null) {
                Background = row.getBackground();
                if (Background == null) {
                    Background = new ColorDrawable(row.getContext().getResources().getColor(android.R.color.transparent));
                }
            }

            if (isRead == false) {
                XModuleResources modRes = XModuleResources.createInstance(XMain.MODULE_PATH, null);

                row.setBackgroundDrawable(modRes.getDrawable(R.drawable.list_background_unread));
            } else {
                row.setBackgroundDrawable(Background);
            }
        }
    });
}
项目:HtcOneTweaker    文件:Keyboard.java   
public static void handlePopup(InitPackageResourcesParam resparam, String path)
{
    XModuleResources modRes = XModuleResources.createInstance(path, resparam.res);

    if (Misc.isSense6())
    {
        resparam.res.setReplacement(resparam.packageName, "xml", "qwerty_rus", modRes.fwd(R.xml.qwerty_rus_sense6));
        resparam.res.setReplacement(resparam.packageName, "xml", "land_qwerty_rus", modRes.fwd(R.xml.land_qwerty_rus_sense6));
    } 
    else
    {
        resparam.res.setReplacement(resparam.packageName, "xml", "qwerty_rus", modRes.fwd(R.xml.qwerty_rus));
        resparam.res.setReplacement(resparam.packageName, "xml", "row_rus1", modRes.fwd(R.xml.row_rus1));
        resparam.res.setReplacement(resparam.packageName, "xml", "row_rus3", modRes.fwd(R.xml.row_rus3));
        resparam.res.setReplacement(resparam.packageName, "xml", "row_rus5", modRes.fwd(R.xml.row_rus5));

        resparam.res.setReplacement(resparam.packageName, "xml", "land_qwerty_rus", modRes.fwd(R.xml.land_qwerty_rus));
        resparam.res.setReplacement(resparam.packageName, "xml", "row_land_rus1", modRes.fwd(R.xml.row_land_rus1));
        resparam.res.setReplacement(resparam.packageName, "xml", "row_land_rus3", modRes.fwd(R.xml.row_land_rus3));
        resparam.res.setReplacement(resparam.packageName, "xml", "row_land_rus5", modRes.fwd(R.xml.row_land_rus5));
    }
}
项目:NyanNyanGuard    文件:Main.java   
@Override
public void initZygote(StartupParam startupParam) throws Throwable {

    pref = new XSharedPreferences(MY_PACKAGE_NAME);
    Util.pref = pref;

    MODULE_PATH = startupParam.modulePath;

    res = XModuleResources.createInstance(MODULE_PATH, null);
    byte[] array = XposedHelpers.assetAsByteArray(res, "host/output_file");
    String decoded = new String(array);
    String[] sUrls = decoded.split("\n");

    urls = new HashSet<String>();
    for(String url : sUrls) {
        urls.add(url);
    }
}
项目:ViewInPlay    文件:XposedInit.java   
@Override
public void initZygote(StartupParam startupParam) throws Throwable {
    mPref = new XSharedPreferences(Common.THIS_PACKAGE_NAME, Common.PREFERENCE_MAIN_FILE);
    MODULE_PATH = startupParam.modulePath;
    sModRes = XModuleResources.createInstance(MODULE_PATH, null);
    RecentTaskHook.initZygote(sModRes);
    AppInfoHook.initZygote(sModRes);

    KEY_DIRECTLY_SHOW_IN_PLAY = sModRes.getString(R.string.key_directly_show_in_play);
    KEY_SHOW_IN_RECENT_PANEL = sModRes.getString(R.string.key_show_in_recent_panel);
    KEY_SHOW_IN_APP_INFO = sModRes.getString(R.string.key_show_in_app_info);
    KEY_SHOW_IN_NOTIFICATION = sModRes.getString(R.string.key_show_in_notification);
    KEY_TWO_FINGER_IN_RECENT_PANEL = sModRes.getString(R.string.key_two_finger_in_recent_panel);
    KEY_COMPAT_XHALO = sModRes.getString(R.string.key_compat_xhalo);
    KEY_COMPAT_FLOATING = sModRes.getString(R.string.key_compat_floating);
    KEY_DEBUG_LOGS = sModRes.getString(R.string.key_debug_logs);
    // add for browser-store switch 
    KEY_USE_BROWSER = sModRes.getString(R.string.key_use_browser);

    notStockApp = Arrays.asList(sModRes.getStringArray(R.array.not_stock_app));
    stockAndroidApp = Arrays.asList(sModRes.getStringArray(R.array.stock_android_app));

    XposedBridge.log(TAG + "[]init done");
}
项目:Xposed-PerAppFonts    文件:MainXposed.java   
@Override
public void initZygote(StartupParam startupParam) throws Throwable {
    sMainPref = new XSharedPreferences(Common.PACKAGE_PER_APP_FONTS, Common.PREFERENCE_MAIN);
    sAppPref = new XSharedPreferences(Common.PACKAGE_PER_APP_FONTS, Common.PREFERENCE_APPS);
    sForcePref = new XSharedPreferences(Common.PACKAGE_PER_APP_FONTS, Common.PREFERENCE_FORCE);
    MODULE_PATH = startupParam.modulePath;
    sModuleRes = XModuleResources.createInstance(MODULE_PATH, null);

    sFontLoader = new FontLoader(sMainPref);
    /*
     * Why did I preload all fonts instead of on demand? It's because Google introduced
     * READ_EXTERNAL_STORAGE permission.
     * 
     * Everything in handleLoadPackage is actually in the app context itself. So we hold
     * their permissions. Some apps don't have READ/WRITE_EXTERNAL_STORAGE so we have to
     * use a work-around. (preloading it on boot)
     * 
     * Also, everything "static" that's in handleLoadPackage cannot be passed to another
     * handleLoadPackage process. Retrieved Context (with the permission) from the System
     * won't be passed to another app.
     * 
     * I did this as my last resort. If anyone finds a more efficient method, please
     * inform me(zst123).
     */
    sEveryAppFontEnabled = sMainPref.getBoolean(Common.KEY_ENABLE_EVERY_APP, false);
}
项目:AllHuaji    文件:XposedInit.java   
@Override
public void initZygote(IXposedHookZygoteInit.StartupParam startupParam) throws Throwable {
//    XResources.setSystemWideReplacement("android", "bool", "config_unplugTurnsOnScreen", false);
    MODULE_PATH = startupParam.modulePath;
       sModRes = XModuleResources.createInstance(MODULE_PATH, null);

}
项目:GravityBox    文件:ModVolumePanel.java   
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));
}
项目:GravityBox    文件:ModQsTiles.java   
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);
    }
}
项目:AdBlocker_Reborn    文件:BlocklistInitUtils.java   
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);
}
项目:ToastUI    文件:SuperActivityToast.java   
/**
 * Public constructor for a SuperActivityToast.
 *
 * @param context An Activity Context
 */
public SuperActivityToast(@NonNull Context context,XModuleResources modRes) {
    super(context,modRes);

    if (!(context instanceof Activity)) {
        throw new IllegalArgumentException("SuperActivityToast Context must be an Activity.");
    }

    this.mContext = context;
    this.mStyle = this.getStyle(); // Style is created in the super(context) call

    // Set the default ViewGroup as the Activity's content
    this.mViewGroup = (ViewGroup) ((Activity) context).findViewById(android.R.id.content);
}
项目:ToastUI    文件:SuperActivityToast.java   
/**
 * Public constructor for a SuperActivityToast.
 *
 * @param context An Activity Context
 * @param style The desired Style             
 */
public SuperActivityToast(@NonNull Context context, @NonNull Style style,XModuleResources modRes) {
    super(context, style,modRes);

    if (!(context instanceof Activity)) {
        throw new IllegalArgumentException("SuperActivityToast Context must be an Activity.");
    }

    this.mContext = context;
    this.mStyle = style;

    // Set the default ViewGroup as the Activity's content
    this.mViewGroup = (ViewGroup) ((Activity) context).findViewById(android.R.id.content);
}
项目:ToastUI    文件:SuperActivityToast.java   
/**
 * Public constructor for a SuperActivityToast.
 * 
 * @param context An Activity Context
 * @param type The desired SuperActivityToast type             
 */
public SuperActivityToast(@NonNull Context context, @Style.Type int type,XModuleResources modRes) {
    super(context, type,modRes);

    if (!(context instanceof Activity)) {
        throw new IllegalArgumentException("SuperActivityToast Context must be an Activity.");
    }

    this.mContext = context;
    this.mStyle = this.getStyle(); // Style is created in the super(context) call 

    // Set the default ViewGroup as the Activity's content
    this.mViewGroup = (ViewGroup) ((Activity) context).findViewById(android.R.id.content);
}
项目:ToastUI    文件:SuperActivityToast.java   
/**
 * Public constructor for a SuperActivityToast.
 *
 * @param context An Activity Context
 * @param style The desired Style             
 * @param type The desired SuperActivityToast type             
 */
public SuperActivityToast(@NonNull Context context, @NonNull Style style, @Style.Type int type,XModuleResources modRes) {
    super(context, style, type,modRes);

    if (!(context instanceof Activity)) {
        throw new IllegalArgumentException("SuperActivityToast Context must be an Activity.");
    }

    this.mContext = context;
    this.mStyle = this.getStyle(); // Style is created in the super(context) call 

    // Set the default ViewGroup as the Activity's content
    this.mViewGroup = (ViewGroup) ((Activity) context).findViewById(android.R.id.content);
}
项目:ToastUI    文件:SuperActivityToast.java   
/**
 * Restores the state of all SuperToasts that were showing and/or pending.
 *
 * This should be called in the {@link Activity#onCreate(Bundle)}
 * method of your Activity.
 *
 * @param context The Activity Context
 * @param bundle The Bundle provided in onCreate()
 */
public static void onRestoreState(Context context, Bundle bundle,XModuleResources modRes) {
    // The Bundle will be null sometimes
    if (bundle == null)  return;

    // Get the List created in onSaveState()
    final ArrayList<Style> styleList = bundle.getParcelableArrayList(BUNDLE_KEY);

    if (styleList == null) {
        Log.e(SuperActivityToast.class.getName(), "Cannot recreate " +
                "SuperActivityToasts onRestoreState(). Was onSaveState() called?");
        return;
    }

    // Create a flag that knows if the SuperActivityToast is first in the List or not
    boolean firstInList = true;
    for (Style style : styleList) {
        if (!style.isSuperActivityToast) new SuperToast(context, style,modRes).show();
        else {
            // This SuperActivityToast was most likely showing before the orientation change so ignore the show animation
            if (firstInList)
                new SuperActivityToast(context, style,modRes).fromOrientationChange().show();
            else new SuperActivityToast(context, style,modRes).show();
        }
        firstInList = false;
    }
}
项目:ToastUI    文件:SuperToast.java   
/**
 * Public constructor for a SuperToast.
 *
 * @param context A valid Context
 */
public SuperToast(@NonNull Context context, XModuleResources modRes) {
    this.mContext = context;
    this.mStyle = new Style();
    this.mStyle.type = Style.TYPE_STANDARD;

    final LayoutInflater layoutInflater = (LayoutInflater) context
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    this.mView = onCreateView(context, layoutInflater, Style.TYPE_STANDARD,modRes);
    this.mTextView = (TextView) this.mView.findViewById(R.id.message);
    this.mImageView = (ImageView) this.mView.findViewById(R.id.toasticon);
}
项目:ToastUI    文件:SuperToast.java   
/**
 * Public constructor for a SuperToast.
 *
 * @param context A valid Context
 * @param style The desired Style             
 */
public SuperToast(@NonNull Context context, @NonNull Style style, XModuleResources modRes) {
    this.mContext = context;
    this.mStyle = style;

    final LayoutInflater layoutInflater = (LayoutInflater) context
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    this.mView = onCreateView(context, layoutInflater, this.mStyle.type, modRes);
    this.mTextView = (TextView) this.mView.findViewById(R.id.message);
    this.mImageView = (ImageView) this.mView.findViewById(R.id.toasticon);
}
项目:ToastUI    文件:SuperToast.java   
/**
 * Protected constructor that is overridden by the SuperActivityToast class.         
 */
protected SuperToast(@NonNull Context context, @Style.Type int type, XModuleResources modRes) {
    this.mContext = context;
    this.mStyle = new Style();
    this.mStyle.type = type;

    final LayoutInflater layoutInflater = (LayoutInflater) context
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    this.mView = onCreateView(context, layoutInflater, type, modRes);
    this.mTextView = (TextView) this.mView.findViewById(R.id.message);
    this.mImageView = (ImageView) this.mView.findViewById(R.id.toasticon);
}
项目:ToastUI    文件:SuperToast.java   
/**
 * Protected constructor that is overridden by the SuperActivityToast class.         
 */
protected SuperToast(@NonNull Context context,  @NonNull Style style, @Style.Type int type, XModuleResources modRes) {
    this.mContext = context;
    this.mStyle = style;
    this.mStyle.type = type;

    final LayoutInflater layoutInflater = (LayoutInflater) context
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    this.mView = onCreateView(context, layoutInflater, type, modRes);
    this.mTextView = (TextView) this.mView.findViewById(R.id.message);
    this.mImageView = (ImageView) this.mView.findViewById(R.id.toasticon);
}
项目:ZhaMod    文件:WeiboHook.java   
@Override
public void handleInitPackageResources(XC_InitPackageResources.InitPackageResourcesParam initPackageResourcesParam) throws Throwable {
    if (!initPackageResourcesParam.packageName.equals(PACKAGE_NAME)) {
        return;
    }
    mModRes= XModuleResources.createInstance(MODULE_PATH, initPackageResourcesParam.res);
}
项目:DisableSamsungClipboard    文件:XposedMod.java   
@Override
public void handleInitPackageResources(InitPackageResourcesParam resparam) throws Throwable
{
    if (msgClipboardCleared == null && resparam.packageName.equals(PACKAGE_ANDROID))
    {
        XModuleResources modRes = XModuleResources.createInstance(modulePath, resparam.res);
        msgClipboardCleared = modRes.getString(R.string.msg_clipboard_cleared);
    }
}
项目:HtcOneTweaker    文件:Contacts.java   
public static void handleCallDirections(InitPackageResourcesParam resparam, String path)
{
    XModuleResources modRes = XModuleResources.createInstance(path, resparam.res);

    resparam.res.setReplacement(resparam.packageName, "drawable", "icon_indicator_incoming_light_s", modRes.fwd(R.drawable.icon_indicator_incoming_light_s));
    resparam.res.setReplacement(resparam.packageName, "drawable", "icon_indicator_outgoing_light_s", modRes.fwd(R.drawable.icon_indicator_outgoing_light_s));
}
项目:HtcOneTweaker    文件:Dialer.java   
public static void handleCallDirections(InitPackageResourcesParam resparam, String path)
{
    XModuleResources modRes = XModuleResources.createInstance(path, resparam.res);

    resparam.res.setReplacement(resparam.packageName, "drawable", "icon_indicator_incoming_dark_s", modRes.fwd(R.drawable.icon_indicator_incoming_light_s));
    resparam.res.setReplacement(resparam.packageName, "drawable", "icon_indicator_outgoing_dark_s", modRes.fwd(R.drawable.icon_indicator_outgoing_light_s));
}
项目:HtcOneTweaker    文件:Weather.java   
public static boolean hookWeatherBitmapPreload()
{
    if (!XMain.pref.getBoolean(Const.TWEAK_COLORED_WEATHER, false)) {
        Misc.x("TWEAK_COLORED_WEATHER is false");
        return false;
    }
    if (XMain.weather_apk == null) {
        Misc.x("weather_apk is null");
        return false;
    }
    try {
        mapTweak = new HashMap<String, Integer>();
        mapWeather = new HashMap<Integer, String>();

        XModuleResources weatherRes = XModuleResources.createInstance("/system/framework/com.htc.android.home.res.apk", null);
        XModuleResources tweakRes = XModuleResources.createInstance(XMain.weather_apk, null);

        for (String item : Const.weather) {
            mapTweak.put(item, tweakRes.getIdentifier(item, "drawable", Const.WEATHER_PACKAGE_NAME));
            mapWeather.put(weatherRes.getIdentifier(item, "drawable", "com.htc.android.home.res"), item);
        }
    } catch (Throwable t) {
        Misc.x("hookWeatherBitmapPreload fault");
        return false;
    }

    return true;
}
项目:HtcOneTweaker    文件:Weather.java   
public static void hookWeatherBitmap()
{
    final XModuleResources tweakRes = XModuleResources.createInstance(XMain.weather_apk, null);

    final Class<?> traceClass = XposedHelpers.findClass("android.graphics.BitmapFactory", null);

    XposedHelpers.findAndHookMethod(traceClass, "decodeResource", "android.content.res.Resources", "int", "android.graphics.BitmapFactory.Options", new XC_MethodHook()
    {
        @Override
        protected void afterHookedMethod(MethodHookParam param) throws Throwable
        {
            try {
                int drwbl = (Integer) param.args[1];

                if (mapWeather.containsKey(drwbl)) {
                    StackTraceElement[] stacktrace = Thread.currentThread().getStackTrace();

                    if (stacktrace[6].getClassName().contains("com.htc.android.animation.timeline.weather")) {
                        Drawable replace = tweakRes.getDrawable(mapTweak.get(mapWeather.get(drwbl)));
                        if (replace != null)
                            param.setResult(((BitmapDrawable) replace).getBitmap());
                        else
                            Misc.x("replace is null");
                    }
                } else {
                    Misc.x("drwbl is not weather");
                }
            } catch (Throwable t) {
                Misc.x(t);
            }
        }
    });
}
项目:HtcOneTweaker    文件:Recorder.java   
private static void updateRecordButton(Object button, boolean startRecordState, XModuleResources modRes)
{
    if (startRecordState) {
        XposedHelpers.callMethod(button, "setPressed", false);
        XposedHelpers.callMethod(button, "setColorOn", false);
        XposedHelpers.callMethod(button, "setText", modRes.getString(R.string.menu_start_record));
        XposedHelpers.callMethod(button, "setIconDrawable", modRes.getDrawable(R.drawable.icon_btn_recorder_on_dark));

    } else {
        XposedHelpers.callMethod(button, "setPressed", true);
        XposedHelpers.callMethod(button, "setColorOn", true);
        XposedHelpers.callMethod(button, "setText", modRes.getString(R.string.menu_stop_record));
        XposedHelpers.callMethod(button, "setIconDrawable", modRes.getDrawable(R.drawable.icon_btn_recorder_stop_on_dark));
    }
}
项目:xposed-keep-trash    文件:XposedKeepTrash.java   
@Override
public void handleInitPackageResources(final XC_InitPackageResources.InitPackageResourcesParam resParam) throws Throwable {

    // If package is not com.google.android.keep, return to not execute further
    if (!resParam.packageName.equals(GOOGLE_KEEP)) {
        return;
    }

    XSharedPreferences mXSharedPreferences = new XSharedPreferences(PACKAGE_NAME);
    modRes = XModuleResources.createInstance(MODULE_PATH, resParam.res);

    // "Note Selected" preferences
    mShowArchive = mXSharedPreferences.getBoolean("show_archive_switch_preference", true);
    mShowDelete = mXSharedPreferences.getBoolean("show_delete_switch_preference", true);
    mShowShare = mXSharedPreferences.getBoolean("show_share_switch_preference", true);
    mShowColorChanger = mXSharedPreferences.getBoolean("show_color_changer_switch_preference", true);
    mShowLabel = mXSharedPreferences.getBoolean("show_add_label_switch_preference", true);
    mShowReminder = mXSharedPreferences.getBoolean("show_add_reminder_switch_preference", true);

    mKeepMenuArchive = resParam.res.getIdentifier("menu_archive", "id", GOOGLE_KEEP);
    mKeepMenuUnarchive = resParam.res.getIdentifier("menu_unarchive", "id", GOOGLE_KEEP);
    mKeepMenuDelete = resParam.res.getIdentifier("menu_delete", "id", GOOGLE_KEEP);
    mKeepMenuShare = resParam.res.getIdentifier("menu_send", "id", GOOGLE_KEEP);
    mKeepMenuColorChanger = resParam.res.getIdentifier("menu_color_picker", "id", GOOGLE_KEEP);
    mKeepMenuLabel = resParam.res.getIdentifier("menu_change_labels", "id", GOOGLE_KEEP);
    mKeepMenuReminder = resParam.res.getIdentifier("menu_add_reminder", "id", GOOGLE_KEEP);
}
项目:xsbm_sgs    文件:InvisBattery.java   
public static void initPackageResources(final XSharedPreferences paramPrefs, XModuleResources modRes, XC_InitPackageResources.InitPackageResourcesParam resParam) {
    resParam.res.hookLayout("com.android.systemui", "layout", "super_status_bar", new XC_LayoutInflated() {
        @Override
        public void handleLayoutInflated(LayoutInflatedParam liparam) throws Throwable {
            try {
                ImageView batt = (ImageView) liparam.view.findViewById(liparam.res.getIdentifier("battery", "id", "com.android.systemui"));
                batt.setVisibility(8);
            } catch (Throwable t) { XposedBridge.log(t); }
        }
    }); 
}
项目:xsbm_sgs    文件:BatteryTextColor.java   
public static void initPackageResources(final XSharedPreferences paramPrefs, XModuleResources modRes, XC_InitPackageResources.InitPackageResourcesParam resParam) {
    resParam.res.hookLayout("com.android.systemui", "layout", "super_status_bar", new XC_LayoutInflated() {
        @Override
        public void handleLayoutInflated(LayoutInflatedParam liparam) throws Throwable {
            try {
                final int btcolor = paramPrefs.getInt("batt_text_color", 0xff35b5e5);
                TextView battext = (TextView) liparam.view.findViewById(liparam.res.getIdentifier("battery_text", "id", "com.android.systemui"));
                battext.setTextColor(btcolor);
            } catch (Throwable t) { XposedBridge.log(t); }
        }
    });   
}
项目:xStatusbarLunarDate    文件:Main.java   
@Override
public void handleInitPackageResources(InitPackageResourcesParam resparam){
    if (!resparam.packageName.equals(PACKAGE_NAME))
        return; //如果不是UI则跳过

    //这里将自带的图标资源插入到systemui中,并获取到一个资源id
    XModuleResources modRes = XModuleResources.createInstance(MODULE_PATH, resparam.res); //创建一个插入资源的实例
    ic_toast_bg_fest = resparam.res.addResource(modRes, R.drawable.ic_toast_bg_fest);
    ic_toast_bg      = resparam.res.addResource(modRes, R.drawable.ic_toast_bg);
}
项目:ColoredNetLoad    文件:ColoredNetLoad.java   
@Override
   public void handleInitPackageResources(InitPackageResourcesParam resparam) throws Throwable {
if (!resparam.packageName.equals(PKG_NAME_SYSTEM_UI))
    return;
XModuleResources modRes = XModuleResources.createInstance(MODULE_PATH, resparam.res);
replaceWifiSignalization(resparam, modRes);
replaceMobileSignalization(resparam, modRes);
   }
项目:Identiconizer    文件:XposedMod.java   
@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);
}
项目:ViewInPlay    文件:RecentTaskHook.java   
public static void initZygote(XModuleResources module_res) {
    TEXT_APP_INFO = module_res.getString(R.string.recents_app_info);
    // re-open it
    TEXT_OPEN_IN_XHALO = module_res.getString(R.string.recents_open_halo);
    TEXT_REMOVE_FROM_LIST = module_res.getString(R.string.recents_remove_from_list);
    TEXT_VIEW_IN_PLAY = module_res.getString(R.string.view_in_play);
    TEXT_NO_PLAY = module_res.getString(R.string.no_play_on_the_phone);
    TEXT_STOCK_APP = module_res.getString(R.string.stock_app);
    TEXT_LAUNCH_FLOATING = module_res.getString(R.string.recents_launch_floating);
    // TEXT_CANT_OPEN_IN_XHALO =
    // module_res.getString(R.string.cant_open_in_xhalo);
}
项目:ViewInPlay    文件:AppInfoHook.java   
public static void initZygote(XModuleResources module_res) {
    // TEXT_APP_INFO = module_res.get
    // // TEXT_OPEN_IN_HALO =
    // module_res.getString(R.string.recents_open_halo);
    // TEXT_REMOVE_FROM_LIST =
    // module_res.getString(R.string.recents_remove_from_list);
    // TEXT_VIEW_IN_PLAY = module_res.getString(R.string.view_in_play);
}