-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
09f5442
commit f6890c4
Showing
4 changed files
with
104 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/build | ||
/.gradle/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package aweme; | ||
|
||
import android.app.Activity; | ||
import android.os.Bundle; | ||
import android.widget.FrameLayout; | ||
|
||
import de.robv.android.xposed.XC_MethodHook; | ||
import de.robv.android.xposed.XposedHelpers; | ||
import log.Vlog; | ||
|
||
/** | ||
* Created by javaer on 2018/7/5. | ||
*/ | ||
|
||
public class AwemeUI { | ||
public static Activity globalActivity; | ||
public static void hookUI(ClassLoader classLoader){ | ||
XposedHelpers.findAndHookMethod(Activity.class, | ||
"onResume", | ||
new XC_MethodHook() { | ||
@Override | ||
protected void afterHookedMethod(MethodHookParam param) throws Throwable { | ||
globalActivity = (Activity) param.thisObject; | ||
} | ||
} | ||
); | ||
XposedHelpers.findAndHookMethod("com.douyin.baseshare.a.a", | ||
classLoader, | ||
"onCreate", | ||
Bundle.class, | ||
new XC_MethodHook() { | ||
@Override | ||
protected void afterHookedMethod(MethodHookParam param) throws Throwable { | ||
Vlog.log("com.douyin.baseshare.a.a>>>>onCreate"); | ||
FrameLayout r = (FrameLayout) | ||
XposedHelpers.getObjectField(param.thisObject, "r"); | ||
// TextView textView = new TextView(globalActivity); | ||
// textView.setText("注入文字2"); | ||
// textView.setTextColor(Color.RED); | ||
// r.addView(textView, 0); | ||
// Vlog.log("注入完毕2"); | ||
MyLinear myLinear = new MyLinear(globalActivity); | ||
r.addView(myLinear); | ||
Vlog.log("add view success"); | ||
} | ||
} | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package aweme; | ||
|
||
import android.content.Context; | ||
import android.graphics.Color; | ||
import android.view.Gravity; | ||
import android.view.View; | ||
import android.widget.LinearLayout; | ||
import android.widget.TextView; | ||
|
||
import log.Vlog; | ||
|
||
/** | ||
* Created by javaer on 2018/7/5. | ||
*/ | ||
|
||
public class MyLinear extends LinearLayout{ | ||
private Context mContext; | ||
public MyLinear(Context context) { | ||
super(context); | ||
this.mContext = context; | ||
init(); | ||
} | ||
private void init(){ | ||
LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); | ||
layoutParams.setMargins(dp2px(10), dp2px(5), dp2px(10), dp2px(5)); | ||
this.setLayoutParams(layoutParams); | ||
|
||
LayoutParams tv_p = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); | ||
tv_p.setMargins(dp2px(10), dp2px(10), dp2px(10), dp2px(0)); | ||
TextView textView = new TextView(mContext); | ||
textView.setGravity(Gravity.CENTER_HORIZONTAL); | ||
textView.setTextColor(Color.RED); | ||
textView.setText("抖音助手-小璇出品"); | ||
textView.setTextSize(18); | ||
textView.setLayoutParams(tv_p); | ||
textView.setOnClickListener(new OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
Vlog.log("抖音助手"); | ||
} | ||
}); | ||
|
||
this.addView(textView); | ||
} | ||
|
||
private int dp2px(float value){ | ||
final float scale = mContext.getResources().getDisplayMetrics().density; | ||
return (int) (scale * value + 0.5); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters