Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,56 +8,40 @@
import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam;
import tw.fatminmin.xposed.minminguard.blocker.Util;

//TODO Fix formatting
final class Train
{
final class Train {

private static String pkg = "idv.nightgospel.TWRailScheduleLookUp";

private Train() throws InstantiationException
{
private Train() throws InstantiationException {
throw new InstantiationException("This class is not for instantiation");
}

public static void handleLoadPackage(LoadPackageParam lpparam)
{
if (!lpparam.packageName.equals(pkg))
{
public static void handleLoadPackage(LoadPackageParam lpparam) {
if (!lpparam.packageName.equals(pkg)) {
return;
}

XposedHelpers.findAndHookMethod("com.waystorm.ads.WSAdBanner", lpparam.classLoader, "setWSAdListener", "com.waystorm.ads.WSAdListener", new XC_MethodHook()
{
XposedHelpers.findAndHookMethod("com.waystorm.ads.WSAdBanner", lpparam.classLoader, "setWSAdListener", "com.waystorm.ads.WSAdListener", new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param)
{

protected void beforeHookedMethod(MethodHookParam param) {
Util.log(pkg, "Prevent WSAdBanner setWSAdListener " + pkg);

param.setResult(new Object());
param.setResult(null); // return null as safe default
Util.notifyRemoveAdView(null, pkg, 1);
}
});
}

public static void handleInitPackageResources(InitPackageResourcesParam resparam)
{
if (!resparam.packageName.equals(pkg))
{
public static void handleInitPackageResources(InitPackageResourcesParam resparam) {
if (!resparam.packageName.equals(pkg)) {
return;
}

resparam.res.hookLayout(pkg, "layout", "adlayout", new XC_LayoutInflated()
{

resparam.res.hookLayout(pkg, "layout", "adlayout", new XC_LayoutInflated() {
@Override
public void handleLayoutInflated(LayoutInflatedParam liparam)
{

public void handleLayoutInflated(LayoutInflatedParam liparam) {
Util.log(pkg, "Handle train ad layout");

View ad = liparam.view.findViewById(liparam.res.getIdentifier("adLayout", "id", pkg));

ad.setVisibility(View.GONE);
tw.fatminmin.xposed.minminguard.blocker.ViewBlocking.removeAdView(pkg, ad);
}
});
}
Expand Down