Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

[Q] Replacing .png resources

OP pandaweb

23rd May 2014, 10:28 AM   |  #1  
OP Member
Thanks Meter: 22
 
65 posts
Join Date:Joined: Jan 2009
More
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/HangoutsR...tsreplacer.apk[2]
23rd May 2014, 02:59 PM   |  #2  
Junior Member
Thanks Meter: 0
 
3 posts
Join Date:Joined: May 2014
Quote:
Originally Posted by pandaweb

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/HangoutsR...tsreplacer.apk[2]

As you pointed out on http://forum.xda-developers.com/xpos...ckage-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.)
23rd May 2014, 11:46 PM   |  #3  
OP Member
Thanks Meter: 22
 
65 posts
Join Date:Joined: Jan 2009
More
Quote:
Originally Posted by alirazeen

As you pointed out on http://forum.xda-developers.com/xpos...ckage-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?
24th May 2014, 12:32 AM   |  #4  
Junior Member
Thanks Meter: 0
 
3 posts
Join Date:Joined: May 2014
Quote:
Originally Posted by pandaweb

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 Code:
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.
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes