From 467e8d715fb00b87909cfd8e5075a733efd45710 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20D=C3=ADaz?= Date: Sun, 25 Sep 2016 18:34:08 -0400 Subject: [PATCH] Included TextView successfully --- .../com/icecream/snorlax/module/Snorlax.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/app/src/main/java/com/icecream/snorlax/module/Snorlax.java b/app/src/main/java/com/icecream/snorlax/module/Snorlax.java index ca21b84..1d86d5d 100644 --- a/app/src/main/java/com/icecream/snorlax/module/Snorlax.java +++ b/app/src/main/java/com/icecream/snorlax/module/Snorlax.java @@ -19,6 +19,12 @@ import javax.inject.Inject; import android.app.Application; +import android.content.ContextWrapper; +import android.util.TypedValue; +import android.view.Gravity; +import android.view.ViewGroup; +import android.widget.FrameLayout; +import android.widget.TextView; import com.icecream.snorlax.BuildConfig; import com.icecream.snorlax.app.SnorlaxApp; @@ -83,6 +89,26 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable { FeatureHelper.unsubscribe(mMitm, mMock, mCapture, mEncounter); } }); + //~~~~~~~~~~~~~~~~~~~~~~ + XposedHelpers.findAndHookConstructor("com.unity3d.player.UnityPlayer", classLoader, ContextWrapper.class, new XC_MethodHook() { + @Override + protected void afterHookedMethod(MethodHookParam param) throws Throwable { + FrameLayout frameLayout = (FrameLayout) param.thisObject; + + TextView textView = new TextView(frameLayout.getContext()); + textView.setText("HOLAAAA"); + textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20.0f); + + FrameLayout.LayoutParams params = new FrameLayout.LayoutParams( + ViewGroup.LayoutParams.WRAP_CONTENT, + ViewGroup.LayoutParams.WRAP_CONTENT + ); + params.gravity = Gravity.CENTER; + + frameLayout.addView(textView, params); + } + }); + //~~~~~~~~~~~~~~~~~~~~~~ } private void handleSnorlaxLoadPackage(final ClassLoader classLoader) {