[Xposed General] Mjuksel:
I'm having trouble replacing certain drawables, i've made a few work, some others just don't get replaced.

Here's a bit for a part that works.

package mjxl.xposed.cm11;

import android.content.res.XModuleResources;
import android.content.res.XResources;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import de.robv.android.xposed.IXposedHookInitPackageResources;
import de.robv.android.xposed.IXposedHookZygoteInit;
import de.robv.android.xposed.callbacks.XC_InitPackageResources.InitPackageResourcesParam;

public class CM11transparentstuff implements IXposedHookZygoteInit, IXposedHookInitPackageResources {
private static String MODULE_PATH = null;

@Override
public void initZygote(StartupParam startupParam) throws Throwable {
MODULE_PATH = startupParam.modulePath;
}

@Override
public void handleInitPackageResources(InitPackageResourcesParam resparam) throws Throwable {
XModuleResources modRes = XModuleResources.createInstance(MODULE_PATH, resparam.res);
resparam.res.setReplacement("android", "drawable", "overscroll_edge", new XResources.DrawableLoader() {

@Override
public Drawable newDrawable(XResources res, int id) throws Throwable {

return new ColorDrawable(Color.TRANSPARENT);

}
});
}
}

Now i want to replace the notification_bg_normal.9.png and notification_bg_normal_pressed.9.png with my versions.

Technically i should be able to add a line like this:

resparam.res.setReplacement("android", "drawable", "notification_bg_normal", modRes.fwd(R.drawable.not_bg_normal));

And ofcourse add the drawable (notification_bg_normal_BLA.9.png) in my folder (xhdpi in my case)

Then i've tried to do it in a different class like this, which fails aswell. :/

package mjxl.xposed.cm11;

import android.content.res.XModuleResources;
import android.content.res.XResources;
import de.robv.android.xposed.IXposedHookZygoteInit;

public class CM11notifications implements IXposedHookZygoteInit {

public void initZygote(StartupParam startupParam) throws Throwable {
XModuleResources modRes = XModuleResources.createInstance(startupParam.modulePath, null);
XResources.setSystemWideReplacement("android", "drawable", "notification_bg", modRes.fwd(R.drawable.notification_bg)); <<<<--- notification_bg.xml (doesnt work)
XResources.setSystemWideReplacement("android", "drawable", "notification_bg_normal", modRes.fwd(R.drawable.not_bg_normal)); <<<<---- notification_bg_normal.9.png (also does not work)
XResources.setSystemWideReplacement("android", "drawable", "notification_bg_normal_pressed", modRes.fwd(R.drawable.not_bg_normal_pressed));
}
}

Any help ? What am i missing ?

Just fyi, i don't have any Java programming experience.

I followed the steps on Github wiki, and i've made SOME stuff work.. Why don't these work ? :eek:

/added:

I also made this, it's in 'framework-res' aswell, but this one DOES seem to work.

package mjxl.xposed.cm11;

import android.content.res.XResources;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import de.robv.android.xposed.IXposedHookInitPackageResources;
import de.robv.android.xposed.IXposedHookZygoteInit;
import de.robv.android.xposed.callbacks.XC_InitPackageResources.InitPackageResourcesParam;

public class ts2 implements IXposedHookZygoteInit, IXposedHookInitPackageResources {

@Override
public void initZygote(StartupParam startupParam) throws Throwable {
}

@Override
public void handleInitPackageResources(InitPackageResourcesParam resparam) throws Throwable {

resparam.res.setReplacement("android", "drawable", "overscroll_glow", new XResources.DrawableLoader() {

@Override
public Drawable newDrawable(XResources res, int id) throws Throwable {

return new ColorDrawable(Color.TRANSPARENT);

}
});
resparam.res.setReplacement("android", "drawable", "overscroll_edge", new XResources.DrawableLoader() {

@Override
public Drawable newDrawable(XResources res, int id) throws Throwable {

return new ColorDrawable(Color.TRANSPARENT);

}
});
}
}