更新
This commit is contained in:
parent
c0507cd803
commit
7dec34f076
@ -29,7 +29,6 @@ android {
|
||||
|
||||
}
|
||||
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||||
@ -39,4 +38,6 @@ dependencies {
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
||||
compileOnly 'de.robv.android.xposed:api:82'
|
||||
implementation 'com.github.princekin-f:EasyFloat:2.0.4'
|
||||
|
||||
}
|
@ -27,14 +27,14 @@
|
||||
android:value="true" />
|
||||
<meta-data
|
||||
android:name="xposeddescription"
|
||||
android:value="Easy example which makes the status bar clock red and adds a smiley" />
|
||||
android:value="解决傻逼APP在挖孔屏下遮挡问题" />
|
||||
<meta-data
|
||||
android:name="xposedminversion"
|
||||
android:value="53" />
|
||||
|
||||
<meta-data
|
||||
<!-- <meta-data
|
||||
android:name="xposedscope"
|
||||
android:resource="@array/scope" />
|
||||
android:resource="@array/scope" />-->
|
||||
</application>
|
||||
|
||||
</manifest>
|
@ -1,13 +1,26 @@
|
||||
package com.yutou.myxposed;
|
||||
|
||||
import static android.view.View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.widget.TextView;
|
||||
import android.view.DisplayCutout;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.WindowInsets;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.lzf.easyfloat.EasyFloat;
|
||||
import com.lzf.easyfloat.enums.ShowPattern;
|
||||
|
||||
import de.robv.android.xposed.IXposedHookLoadPackage;
|
||||
import de.robv.android.xposed.XC_MethodHook;
|
||||
import de.robv.android.xposed.XposedBridge;
|
||||
@ -18,24 +31,117 @@ public class Model implements IXposedHookLoadPackage {
|
||||
@Override
|
||||
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {
|
||||
System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
XposedBridge.log("Loaded app: " + lpparam.packageName);
|
||||
if(!lpparam.packageName.equals("com.yutou.myapplication"))return;
|
||||
Class<?> aClass = XposedHelpers.findClass("com.yutou.myapplication.MainActivity", lpparam.classLoader);
|
||||
XposedHelpers.findAndHookMethod(aClass,"onCreate", Bundle.class,new XC_MethodHook(){
|
||||
XposedBridge.log("Loaded_app: " + lpparam.packageName + "|" + lpparam.appInfo.className);
|
||||
if (lpparam.isFirstApplication) {
|
||||
if (lpparam.appInfo.className != null) {
|
||||
hook(lpparam);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void hook(XC_LoadPackage.LoadPackageParam lpparam) {
|
||||
XposedBridge.log("注入: " + lpparam.appInfo.className);
|
||||
String className = "android.app.Application";
|
||||
// className="tv.danmaku.bili.MainActivityV2";
|
||||
Class<?> aClass = XposedHelpers.findClass(className, lpparam.classLoader);
|
||||
XposedHelpers.findAndHookMethod(aClass, "onCreate", new XC_MethodHook() {
|
||||
@Override
|
||||
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
|
||||
super.beforeHookedMethod(param);
|
||||
// afterHookedMethod(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
|
||||
super.afterHookedMethod(param);
|
||||
Toast.makeText((Context) param.thisObject,"Yes3",Toast.LENGTH_LONG).show();
|
||||
Activity activity = (Activity) param.thisObject;
|
||||
activity.getWindow().clearFlags(SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
|
||||
int textView = activity.getResources().getIdentifier("textView", "id", activity.getPackageName());
|
||||
((TextView)activity.findViewById(textView)).setText("!!!!");
|
||||
Application context = (Application) param.thisObject;
|
||||
|
||||
context.registerActivityLifecycleCallbacks(new Application.ActivityLifecycleCallbacks() {
|
||||
@Override
|
||||
public void onActivityCreated(@NonNull Activity activity, @Nullable Bundle savedInstanceState) {
|
||||
if (lpparam.packageName.equals("tv.danmaku.bilibilihd")) {
|
||||
if (activity.getClass().getName().contains("MainActivityV2")) {
|
||||
set(activity);
|
||||
}
|
||||
} else {
|
||||
set(activity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityStarted(@NonNull Activity activity) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResumed(@NonNull Activity activity) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityPaused(@NonNull Activity activity) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityStopped(@NonNull Activity activity) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivitySaveInstanceState(@NonNull Activity activity, @NonNull Bundle outState) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityDestroyed(@NonNull Activity activity) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void set(Activity activity) {
|
||||
activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
|
||||
activity.getWindow().getDecorView().setBackgroundColor(Color.BLACK);
|
||||
View view = activity.getWindow().getDecorView().findViewById(android.R.id.content);
|
||||
view.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
|
||||
@NonNull
|
||||
@Override
|
||||
public WindowInsets onApplyWindowInsets(@NonNull View v, @NonNull WindowInsets insets) {
|
||||
DisplayCutout cutout = null;
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.Q) {
|
||||
cutout = activity.getWindowManager().getDefaultDisplay().getCutout();
|
||||
int left = cutout.getSafeInsetLeft();
|
||||
int top = 0;
|
||||
int right = cutout.getSafeInsetRight();
|
||||
int bottom = 0;
|
||||
v.setPadding(left, top, right, bottom);
|
||||
}
|
||||
return insets;
|
||||
}
|
||||
});
|
||||
activity.getWindow().getDecorView().setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
|
||||
@NonNull
|
||||
@Override
|
||||
public WindowInsets onApplyWindowInsets(@NonNull View v, @NonNull WindowInsets insets) {
|
||||
return insets;
|
||||
}
|
||||
});
|
||||
WindowManager.LayoutParams lp = activity.getWindow().getAttributes();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
lp.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER;
|
||||
}
|
||||
activity.getWindow().setAttributes(lp);
|
||||
|
||||
}
|
||||
|
||||
public void showDialog(Context context, String str) {
|
||||
new AlertDialog.Builder(context)
|
||||
.setTitle("出错了")
|
||||
.setMessage(str)
|
||||
.show();
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,3 @@
|
||||
<resources>
|
||||
<string name="app_name">My Xposed</string>
|
||||
<string name="app_name">傻逼挖孔屏</string>
|
||||
</resources>
|
@ -5,6 +5,7 @@ buildscript {
|
||||
google()
|
||||
mavenCentral()
|
||||
maven { url 'https://maven.aliyun.com/repository/public/' }
|
||||
maven { url 'https://jitpack.io' }
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.0.2'
|
||||
|
@ -22,5 +22,5 @@ android.nonTransitiveRClass=true
|
||||
|
||||
systemProp.http.proxyHost=127.0.0.1
|
||||
systemProp.https.proxyHost=127.0.0.1
|
||||
systemProp.https.proxyPort=7890
|
||||
systemProp.http.proxyPort=7890
|
||||
systemProp.https.proxyPort=10809
|
||||
systemProp.http.proxyPort=10809
|
@ -4,6 +4,7 @@ pluginManagement {
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
maven { url 'https://maven.aliyun.com/repository/public/' }
|
||||
maven { url 'https://jitpack.io' }
|
||||
}
|
||||
}
|
||||
dependencyResolutionManagement {
|
||||
@ -12,7 +13,7 @@ dependencyResolutionManagement {
|
||||
google()
|
||||
mavenCentral()
|
||||
maven { url 'https://maven.aliyun.com/repository/public/' }
|
||||
|
||||
maven { url 'https://jitpack.io' }
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user