[Q] Replacing .png resources

Search This thread

benji

Senior Member
Jan 13, 2009
73
27
I am trying to create a module which replaces the stock Google Hangouts emoticons.

The problem I am facing is the Xposed log gives me a resource not found exception. So it's not replacing the image because it can't find it.
The emoticon resources have odd names, perhaps there is some obfuscation going on? Or maybe I'm just doing something wrong or missing something.

I started off trying to just change the icon of Hangouts, it's called ic_launcher_babel.png, but I had no luck with that either.

Here are my sources: https://github.com/bbbenji/HangoutsReplacer[1]

Here is a compiled .apk: https://github.com/bbbenji/HangoutsReplacer/blob/master/com.benji.hangoutsreplacer.apk[2]
 

alirazeen

New member
May 22, 2014
3
1
I am trying to create a module which replaces the stock Google Hangouts emoticons.

The problem I am facing is the Xposed log gives me a resource not found exception. So it's not replacing the image because it can't find it.
The emoticon resources have odd names, perhaps there is some obfuscation going on? Or maybe I'm just doing something wrong or missing something.

I started off trying to just change the icon of Hangouts, it's called ic_launcher_babel.png, but I had no luck with that either.

Here are my sources: https://github.com/bbbenji/HangoutsReplacer[1]

Here is a compiled .apk: https://github.com/bbbenji/HangoutsReplacer/blob/master/com.benji.hangoutsreplacer.apk[2]

As you pointed out on http://xdaforums.com/xposed/resource-package-necessarily-app-package-t2759965, this most likely is because you are searching for the resources at the package "com.google.android.talk." Look for them instead at "com.google.android.apps.babel" and you should find it.

(Note that resparam.packageName would still be "com.google.android.talk." That's fine because that refers to the application package name, as I noted in my thread.)
 
  • Like
Reactions: Quinny899

benji

Senior Member
Jan 13, 2009
73
27
As you pointed out on http://xdaforums.com/xposed/resource-package-necessarily-app-package-t2759965, this most likely is because you are searching for the resources at the package "com.google.android.talk." Look for them instead at "com.google.android.apps.babel" and you should find it.

(Note that resparam.packageName would still be "com.google.android.talk." That's fine because that refers to the application package name, as I noted in my thread.)

Great, that fixed the resource not found exception. But it's not replacing the actual resource. There are no errors, but no result. Do you, alirazeen, or anyone else have an idea what's going on?
 

alirazeen

New member
May 22, 2014
3
1
Great, that fixed the resource not found exception. But it's not replacing the actual resource. There are no errors, but no result. Do you, alirazeen, or anyone else have an idea what's going on?

Take a look at your logcat output. Are you getting any exceptions from XposedBridge? I think you should because you're trying to replace a drawable and if you look at the setReplacement method, you would see that it eventually leads to an exception (github.com/rovo89/XposedBridge/blob/master/src/android/content/res/XResources.java#L336).

At the bottom of the resource replacement tutorial (github.com/rovo89/XposedBridge/wiki/Replacing-resources), it says this:

HTML:
Replacing Drawables works similar. However, you can't just use a Drawable as replacement because this might result in the same instance of the Drawable being referenced by different ImageViews. Therefore, you need to use a wrapper:

Code:
resparam.res.setReplacement("com.android.systemui", "drawable", "status_bar_background", new XResources.DrawableLoader() {
    @Override
    public Drawable newDrawable(XResources res, int id) throws Throwable {
        return new ColorDrawable(Color.WHITE);
    }
});

Hopefully that helps you.
 

Top Liked Posts