Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,770,988 Members 44,487 Now Online
XDA Developers Android and Mobile Development Forum

[Q] Replacing .png resources

Tip us?
 
pandaweb
Old
#1  
Member - OP
Thanks Meter 21
Posts: 63
Join Date: Jan 2009
Default [Q] Replacing .png resources

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]
aka pandroid
aka bbbenji

The Germ Series, DroidMod & HelloDroid bootanimations
benji.so
 
alirazeen
Old
#2  
Junior Member
Thanks Meter 0
Posts: 3
Join Date: May 2014
Quote:
Originally Posted by pandaweb View Post
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.)
 
pandaweb
Old
#3  
Member - OP
Thanks Meter 21
Posts: 63
Join Date: Jan 2009
Quote:
Originally Posted by alirazeen View Post
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?
aka pandroid
aka bbbenji

The Germ Series, DroidMod & HelloDroid bootanimations
benji.so
 
alirazeen
Old
#4  
Junior Member
Thanks Meter 0
Posts: 3
Join Date: May 2014
Quote:
Originally Posted by pandaweb View Post
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.
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes