├── .gitignore
├── .idea
└── markdown-navigator.xml
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── assets
│ └── xposed_init
│ ├── java
│ └── com
│ │ └── bolex
│ │ └── apptrack
│ │ ├── HookMain.java
│ │ ├── MainActivity.java
│ │ ├── config
│ │ └── Config.java
│ │ ├── hook
│ │ ├── LifeHook.java
│ │ └── NetHook.java
│ │ └── ui
│ │ ├── FloatViewLayout.java
│ │ └── ViewHelp.java
│ └── res
│ ├── layout
│ └── activity_main.xml
│ ├── mipmap-hdpi
│ └── ic_launcher.png
│ ├── mipmap-mdpi
│ └── ic_launcher.png
│ ├── mipmap-xhdpi
│ └── ic_launcher.png
│ ├── mipmap-xxhdpi
│ └── ic_launcher.png
│ ├── mipmap-xxxhdpi
│ └── ic_launcher.png
│ ├── values-w820dp
│ └── dimens.xml
│ └── values
│ ├── colors.xml
│ ├── dimens.xml
│ ├── strings.xml
│ └── styles.xml
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── mi.gif
├── settings.gradle
└── taday.gif
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/.idea/markdown-navigator.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # APPTrack
2 | Xposed Module APP动态逆向跟踪分析工具,跟踪Activity&Fragment启动信息、http请求、sharedpreferences数据等
3 |
4 | 项目正在完善中。。。
5 |
6 | **已实现功能:**
7 |
8 | - Activty&fragment信息跟踪
9 | - 控制面板拖动悬浮隐藏
10 |
11 |
12 | **待实现功能:**
13 | - 日志导出
14 | - HTTP信息跟踪
15 | - sp数据
16 | - 单应用独立跟踪
17 |
18 |
19 |  
20 |
21 |
22 |
23 | ```
24 | # 微信
25 | 12-08 14:56:41.450 5969-5969/com.tencent.mm I/Xposed: TrackLog: 源=[com.tencent.mm]目标=[com.tencent.mm.ui.LauncherUI]
26 | 12-08 14:56:41.651 5969-5969/com.tencent.mm I/Xposed: TrackLog: 当前Fragmnet=[com.tencent.mm.ui.conversation.j]
27 | 12-08 14:56:41.768 5969-5969/com.tencent.mm I/Xposed: TrackLog: 当前Fragmnet=[com.tencent.mm.ui.contact.AddressUI$a]
28 | 12-08 14:56:41.771 5969-5969/com.tencent.mm I/Xposed: TrackLog: 当前Fragmnet=[com.tencent.mm.ui.h]
29 | 12-08 14:56:41.774 5969-5969/com.tencent.mm I/Xposed: TrackLog: 当前Fragmnet=[com.tencent.mm.ui.y]
30 | 12-08 14:56:42.248 1068-1068/com.tencent.mm:appbrand0 I/Xposed: TrackLog: Package=[com.tencent.mm]
31 | 12-08 14:56:42.400 5969-5969/com.tencent.mm I/Xposed: TrackLog: 当前Fragmnet=[com.tencent.mm.ui.chatting.En_5b8fbb1e$a]
32 | 12-08 14:56:45.488 1221-1221/com.tencent.mm:tools I/Xposed: TrackLog: Package=[com.tencent.mm]
33 | 12-08 14:56:54.462 5969-5969/com.tencent.mm I/Xposed: TrackLog: 源=[com.tencent.mm]目标=[com.tencent.mm.plugin.sns.ui.En_424b8e16]
34 | 12-08 14:56:59.677 5969-5969/com.tencent.mm I/Xposed: TrackLog: 源=[com.tencent.mm]目标=[com.tencent.mm.ui.LauncherUI]
35 | 12-08 14:56:59.686 5969-5969/com.tencent.mm I/Xposed: TrackLog: 当前Fragmnet=[com.tencent.mm.ui.contact.AddressUI$a]
36 | 12-08 14:56:59.697 5969-5969/com.tencent.mm I/Xposed: TrackLog: 当前Fragmnet=[com.tencent.mm.ui.h]
37 | 12-08 14:56:59.725 5969-5969/com.tencent.mm I/Xposed: TrackLog: 当前Fragmnet=[com.tencent.mm.ui.y]
38 | 12-08 14:56:59.728 5969-5969/com.tencent.mm I/Xposed: TrackLog: 当前Fragmnet=[com.tencent.mm.ui.conversation.j]
39 | 12-08 14:56:59.730 5969-5969/com.tencent.mm I/Xposed: TrackLog: 当前Fragmnet=[com.tencent.mm.ui.chatting.En_5b8fbb1e$a]
40 |
41 | ```
42 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 26
5 | buildToolsVersion "25.0.3"
6 | defaultConfig {
7 | applicationId "com.bolex.apptrack"
8 | minSdkVersion 14
9 | targetSdkVersion 26
10 | versionCode 1
11 | versionName "1.0"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | }
20 |
21 | dependencies {
22 | compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
23 | testCompile 'junit:junit:4.12'
24 | provided 'de.robv.android.xposed:api:82'
25 | provided 'com.squareup.okhttp3:okhttp:3.9.1'
26 | }
27 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in D:\Android_sdk\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
12 |
15 |
18 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/assets/xposed_init:
--------------------------------------------------------------------------------
1 | com.bolex.apptrack.HookMain
--------------------------------------------------------------------------------
/app/src/main/java/com/bolex/apptrack/HookMain.java:
--------------------------------------------------------------------------------
1 | package com.bolex.apptrack;
2 |
3 |
4 | import com.bolex.apptrack.hook.LifeHook;
5 | import com.bolex.apptrack.hook.NetHook;
6 |
7 | import de.robv.android.xposed.IXposedHookLoadPackage;
8 | import de.robv.android.xposed.XposedBridge;
9 | import de.robv.android.xposed.callbacks.XC_LoadPackage;
10 |
11 | /**
12 | * Created by Bolex on 2017/12/7.
13 | */
14 |
15 | public class HookMain implements IXposedHookLoadPackage {
16 |
17 | @Override
18 | public void handleLoadPackage(XC_LoadPackage.LoadPackageParam loadPackageParam) throws Throwable {
19 | XposedBridge.log("TrackLog: Package=[" + loadPackageParam.packageName + "]");
20 | LifeHook lifeHook = new LifeHook();
21 | NetHook netHook = new NetHook();
22 | lifeHook.hookFragment(loadPackageParam);
23 | lifeHook.hookV4Fragment(loadPackageParam);
24 | lifeHook.hookActivity(loadPackageParam);
25 | netHook.hookNet(loadPackageParam);
26 | }
27 |
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/app/src/main/java/com/bolex/apptrack/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.bolex.apptrack;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 |
6 | public class MainActivity extends AppCompatActivity {
7 |
8 | @Override
9 | protected void onCreate(Bundle savedInstanceState) {
10 | super.onCreate(savedInstanceState);
11 | setContentView(R.layout.activity_main);
12 | }
13 |
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/app/src/main/java/com/bolex/apptrack/config/Config.java:
--------------------------------------------------------------------------------
1 | package com.bolex.apptrack.config;
2 |
3 | /**
4 | * Created by liushenen on 2017/12/8.
5 | */
6 |
7 | public class Config {
8 |
9 | public static boolean isTrack=false;
10 | }
11 |
--------------------------------------------------------------------------------
/app/src/main/java/com/bolex/apptrack/hook/LifeHook.java:
--------------------------------------------------------------------------------
1 | package com.bolex.apptrack.hook;
2 |
3 | import android.app.Activity;
4 | import android.content.ComponentName;
5 | import android.content.Intent;
6 | import android.view.View;
7 | import android.widget.FrameLayout;
8 | import android.widget.TextView;
9 |
10 | import com.bolex.apptrack.ui.ViewHelp;
11 |
12 | import de.robv.android.xposed.XC_MethodHook;
13 | import de.robv.android.xposed.XposedBridge;
14 | import de.robv.android.xposed.XposedHelpers;
15 | import de.robv.android.xposed.callbacks.XC_LoadPackage;
16 |
17 | /**
18 | * Created by liushenen on 2017/12/12.
19 | */
20 |
21 | public class LifeHook {
22 |
23 |
24 | private TextView msgTextView;
25 | private static String msg = "";
26 | private String TAG = "TrackLog-life:";
27 |
28 | public void hookActivity(XC_LoadPackage.LoadPackageParam loadPackageParam) {
29 | XposedHelpers.findAndHookMethod("android.app.Activity", loadPackageParam.classLoader, "onResume",
30 | new XC_MethodHook() {
31 | @Override
32 | protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
33 | super.beforeHookedMethod(param);
34 | Activity mActivity = (Activity) param.thisObject;
35 | View view = ViewHelp.creactMsgView(mActivity);
36 | msgTextView = ViewHelp.getMsgTextView();
37 | setMsgView(mActivity, view);
38 | Intent intent = mActivity.getIntent();
39 | ComponentName component = intent.getComponent();
40 | String className = component.getClassName();
41 | String packageName = component.getPackageName();
42 | printActivityMsg(className, packageName);
43 | }
44 |
45 |
46 | });
47 | }
48 |
49 | public void hookFragment(XC_LoadPackage.LoadPackageParam loadPackageParam) {
50 | XposedHelpers.findAndHookMethod("android.app.Fragment", loadPackageParam.classLoader, "onResume",
51 | new XC_MethodHook() {
52 | @Override
53 | protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
54 | super.beforeHookedMethod(param);
55 | String fragmentName = param.thisObject.getClass().getName();
56 | printFragmentMsg(fragmentName);
57 | }
58 | });
59 | }
60 |
61 | public void hookV4Fragment(XC_LoadPackage.LoadPackageParam loadPackageParam) {
62 | XposedHelpers.findAndHookMethod("android.support.v4.app.Fragment", loadPackageParam.classLoader, "onResume",
63 | new XC_MethodHook() {
64 | @Override
65 | protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
66 | super.beforeHookedMethod(param);
67 | String fragmentName = param.thisObject.getClass().getName();
68 | printFragmentMsg(fragmentName);
69 | }
70 | });
71 | }
72 |
73 |
74 | public void setMsgView(Activity mActivity, final View mView) {
75 | View decorView = mActivity.getWindow().getDecorView();
76 | if (decorView instanceof FrameLayout) {
77 | FrameLayout decorViewParent = (FrameLayout) decorView;
78 | if (decorView.findViewWithTag(ViewHelp.getLogViewid()) == null) {
79 | decorViewParent.addView(mView);
80 |
81 | }
82 | // 修复微信重新加载层级问题
83 | mView.postDelayed(new Runnable() {
84 | @Override
85 | public void run() {
86 | mView.bringToFront();
87 | }
88 | }, 3000);
89 |
90 | }
91 |
92 | }
93 |
94 |
95 | private void printFragmentMsg(String fragmentName) {
96 | XposedBridge.log(TAG + " 当前Fragmnet=[" + fragmentName + "]");
97 | setViewMsg(msg += "\n fra =" + fragmentName);
98 | }
99 |
100 | private void printActivityMsg(String className, String packageName) {
101 |
102 |
103 | XposedBridge.log(TAG + " 源=[" + packageName + "]目标=[" + className + "]");
104 | setViewMsg(msg += "\n [" + packageName + "]=>[" + className + "]");
105 | }
106 |
107 | private void setViewMsg(String msg) {
108 | if (msgTextView != null) {
109 | msgTextView.setText(msg);
110 | }
111 | }
112 | }
113 |
--------------------------------------------------------------------------------
/app/src/main/java/com/bolex/apptrack/hook/NetHook.java:
--------------------------------------------------------------------------------
1 | package com.bolex.apptrack.hook;
2 |
3 | import android.os.Build;
4 |
5 | import java.io.ByteArrayInputStream;
6 | import java.io.ByteArrayOutputStream;
7 | import java.io.FilterInputStream;
8 | import java.io.FilterOutputStream;
9 | import java.io.IOException;
10 | import java.io.InputStream;
11 | import java.io.OutputStream;
12 | import java.net.HttpURLConnection;
13 | import java.net.URL;
14 |
15 | import de.robv.android.xposed.XC_MethodHook;
16 | import de.robv.android.xposed.XposedBridge;
17 | import de.robv.android.xposed.XposedHelpers;
18 | import de.robv.android.xposed.callbacks.XC_LoadPackage;
19 |
20 |
21 | /**
22 | * Created by liushenen on 2017/12/12.
23 | */
24 |
25 | public class NetHook {
26 | public static final String TAG = "TrackLog-http:";
27 |
28 | public void hookNet(XC_LoadPackage.LoadPackageParam loadPackageParam) {
29 | communicationHook(loadPackageParam);
30 | }
31 |
32 | private void communicationHook(XC_LoadPackage.LoadPackageParam loadPackageParam) {
33 | final Class> http = XposedHelpers.findClass(getHttpUrlConnection(), loadPackageParam.classLoader);
34 | if (http == null) {
35 | XposedBridge.log(TAG+"Cannot find HttpURLConnection class");
36 | return;
37 | }
38 |
39 | try {
40 | hookHttpUrlConnection(loadPackageParam);
41 | } catch (Exception e) {
42 | XposedBridge.log(e.toString());
43 | e.printStackTrace();
44 | }
45 | }
46 |
47 | private void hookHttpUrlConnection(XC_LoadPackage.LoadPackageParam lpparam) throws Exception {
48 | XposedHelpers.findAndHookMethod(URL.class, "openConnection", new XC_MethodHook() {
49 | @Override
50 | protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
51 | URL url = (URL) param.thisObject;
52 | XposedBridge.log(TAG+"Request with HttpURLConnection: " + url.toString());
53 | }
54 | });
55 | XposedHelpers.findAndHookMethod(getHttpUrlConnection(), lpparam.classLoader, "setRequestMethod", String.class, new XC_MethodHook() {
56 | @Override
57 | protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
58 | XposedBridge.log(TAG+"URL: " + ((HttpURLConnection) param.thisObject).getURL().toString() + "\r\n Method: " + param.args[0]);
59 | }
60 | });
61 | XposedHelpers.findAndHookMethod(getHttpUrlConnection(), lpparam.classLoader, "setRequestProperty", String.class, String.class, new XC_MethodHook() {
62 | @Override
63 | protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
64 | XposedBridge.log(TAG+"Header: " + param.args[0] + "=" + param.args[1]);
65 | }
66 | });
67 | XposedHelpers.findAndHookMethod(getHttpUrlConnection(), null, "getOutputStream", new XC_MethodHook() {
68 | @Override
69 | protected void afterHookedMethod(MethodHookParam param) throws Throwable {
70 | param.setResult(new LoggedOutStream((OutputStream) param.getResult()));
71 | }
72 | });
73 | XposedHelpers.findAndHookMethod(getHttpUrlConnection(), null, "getInputStream", new XC_MethodHook() {
74 | @Override
75 | protected void afterHookedMethod(MethodHookParam param) throws Throwable {
76 | param.setResult(new LoggedInStream((InputStream) param.getResult()));
77 | }
78 | });
79 | }
80 |
81 |
82 | private String getHttpUrlConnection() {
83 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
84 | return "com.android.okhttp.internal.huc.HttpURLConnectionImpl";
85 | } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
86 | return "com.android.okhttp.internal.http.HttpURLConnectionImpl";
87 | } else {
88 | return "libcore.net.http.HttpURLConnectionImpl";
89 | }
90 | }
91 |
92 | static class LoggedInStream extends FilterInputStream {
93 | public LoggedInStream(InputStream origin) throws IOException {
94 | super(null);
95 | byte[] bytes = read(origin);
96 | ByteArrayInputStream in = new ByteArrayInputStream(bytes);
97 | super.in = in;
98 | XposedBridge.log(TAG+"received:" + new String(bytes, "UTF-8"));
99 | }
100 |
101 | private byte[] read(InputStream in) throws IOException {
102 | ByteArrayOutputStream out = new ByteArrayOutputStream();
103 | byte[] buffer = new byte[128];
104 | int read = 0;
105 | while ((read = in.read(buffer)) > 0) {
106 | out.write(buffer, 0, read);
107 | }
108 | in.close();
109 | return out.toByteArray();
110 | }
111 | }
112 |
113 | static class LoggedOutStream extends FilterOutputStream {
114 | ByteArrayOutputStream bytes = new ByteArrayOutputStream();
115 |
116 | public LoggedOutStream(OutputStream out) {
117 | super(out);
118 | }
119 |
120 | @Override
121 | public void write(byte[] buffer) throws IOException {
122 | super.write(buffer);
123 | bytes.write(buffer);
124 | XposedBridge.log(TAG+"out: " + new String(buffer,"UTF-8"));
125 | }
126 |
127 | @Override
128 | public void write(byte[] buffer, int offset, int count) throws IOException {
129 | super.write(buffer, offset, count);
130 | bytes.write(buffer, offset, count);
131 | XposedBridge.log(TAG+"out: " + new String(buffer, offset, count));
132 | }
133 |
134 | @Override
135 | public void write(int i) throws IOException {
136 | super.write(i);
137 | bytes.write(i);
138 | XposedBridge.log(String.valueOf((char) i));
139 | }
140 |
141 | @Override
142 | public void close() throws IOException {
143 | super.close();
144 | XposedBridge.log(TAG+"sent" + bytes.toString("UTF-8"));
145 | }
146 |
147 | @Override
148 | public void flush() throws IOException {
149 | super.flush();
150 | XposedBridge.log(TAG+"sent" + bytes.toString("UTF-8"));
151 | }
152 | }
153 |
154 |
155 | }
156 |
--------------------------------------------------------------------------------
/app/src/main/java/com/bolex/apptrack/ui/FloatViewLayout.java:
--------------------------------------------------------------------------------
1 | package com.bolex.apptrack.ui;
2 |
3 | import android.content.Context;
4 | import android.support.v4.widget.ViewDragHelper;
5 | import android.util.AttributeSet;
6 | import android.view.MotionEvent;
7 | import android.view.View;
8 | import android.widget.Button;
9 | import android.widget.LinearLayout;
10 |
11 |
12 | public class FloatViewLayout extends LinearLayout {
13 |
14 | private static final String TAG = FloatViewLayout.class.getSimpleName();
15 | private ViewDragHelper viewDragHelper;
16 | private float offset = 0.0f;
17 | private View targetView;
18 | private boolean isFirstStart = false;
19 |
20 | public FloatViewLayout(Context context) {
21 | this(context, null);
22 | }
23 |
24 | public FloatViewLayout(Context context, AttributeSet attrs) {
25 | super(context, attrs);
26 | init();
27 | }
28 |
29 | private void init() {
30 | viewDragHelper = ViewDragHelper.create(this, new ViewDragHelper.Callback() {
31 | @Override
32 | public boolean tryCaptureView(View child, int pointerId) {
33 | return child instanceof Button;
34 | }
35 |
36 | @Override
37 | public int clampViewPositionHorizontal(View child, int left, int dx) {
38 | return left;
39 | }
40 |
41 | @Override
42 | public int clampViewPositionVertical(View child, int top, int dy) {
43 | return top;
44 | }
45 |
46 | @Override
47 | public void onViewReleased(View child, float xvel, float yvel) {
48 | int top;
49 | int parentCenterX = getWidth() / 2;
50 | int childCenterX = (child.getRight() + child.getLeft()) / 2;
51 | if (child.getTop() < 0) {
52 | top = 0;
53 | } else if (child.getBottom() > getBottom()) {
54 | top = getBottom() - child.getHeight();
55 | } else {
56 | top = child.getTop();
57 | }
58 | if (childCenterX < parentCenterX) {
59 | viewDragHelper.settleCapturedViewAt((int) (0 - child.getWidth() * offset), top);
60 | } else {
61 | viewDragHelper.settleCapturedViewAt((int) (getWidth() - child.getWidth() + child.getWidth() * offset), top);
62 | }
63 | invalidate();
64 | }
65 |
66 | @Override
67 | public int getViewVerticalDragRange(View child) {
68 | return getHeight();
69 | }
70 | });
71 | }
72 |
73 | @Override
74 | protected void onLayout(boolean changed, int l, int t, int r, int b) {
75 | super.onLayout(changed, l, t, r, b);
76 | if (!isFirstStart) {
77 | synchronized (this) {
78 | if (!isFirstStart) {
79 | isFirstStart = true;
80 | targetView = getChildAt(0);
81 | replaceTargetView();
82 | }
83 | }
84 | }
85 | }
86 |
87 | private void replaceTargetView() {
88 | int left, top;
89 | int parentCenterX = getWidth() / 2;
90 | int childCenterX = (targetView.getRight() + targetView.getLeft()) / 2;
91 | if (targetView.getTop() < 0) {
92 | top = 0;
93 | } else if (targetView.getBottom() > getBottom()) {
94 | top = getBottom() - targetView.getHeight();
95 | } else {
96 | top = targetView.getTop();
97 | }
98 | if (childCenterX < parentCenterX) {
99 | left = (int) (0 - targetView.getWidth() * offset);
100 | } else {
101 | left = (int) (getWidth() - targetView.getWidth() + targetView.getWidth() * offset);
102 | }
103 | targetView.layout(left, top, left + targetView.getWidth(), top + targetView.getHeight());
104 | }
105 |
106 | @Override
107 | public void computeScroll() {
108 | viewDragHelper.continueSettling(true);
109 | invalidate();
110 | }
111 |
112 | @Override
113 | public boolean onInterceptTouchEvent(MotionEvent ev) {
114 | return viewDragHelper.shouldInterceptTouchEvent(ev);
115 | }
116 |
117 | @Override
118 | public boolean onTouchEvent(MotionEvent event) {
119 | viewDragHelper.processTouchEvent(event);
120 | return false;
121 | }
122 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/bolex/apptrack/ui/ViewHelp.java:
--------------------------------------------------------------------------------
1 | package com.bolex.apptrack.ui;
2 |
3 | import android.app.Activity;
4 | import android.graphics.Color;
5 | import android.view.Gravity;
6 | import android.view.View;
7 | import android.widget.Button;
8 | import android.widget.FrameLayout;
9 | import android.widget.LinearLayout;
10 | import android.widget.ScrollView;
11 | import android.widget.TextView;
12 |
13 | import com.bolex.apptrack.config.Config;
14 |
15 | /**
16 | * Created by liushenen on 2017/12/8.
17 | */
18 |
19 | public class ViewHelp {
20 |
21 | static int logViewid = 0x7722648;
22 | private static TextView msgTextView;
23 |
24 | public static View creactMsgView(Activity mActivity) {
25 |
26 | FloatViewLayout logView = new FloatViewLayout(mActivity);
27 |
28 | logView.setTag(logViewid);
29 | logView.setOrientation(LinearLayout.VERTICAL);
30 | logView.setLayoutParams(new FrameLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
31 | LinearLayout.LayoutParams.MATCH_PARENT));
32 |
33 | final ScrollView msgScrollView = new ScrollView(mActivity);
34 | msgScrollView.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
35 | 350));
36 | msgScrollView.setBackgroundColor(Color.parseColor("#88000000"));
37 | msgTextView = new TextView(mActivity);
38 | msgTextView.setTextColor(Color.WHITE);
39 | msgTextView.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
40 | FrameLayout.LayoutParams.MATCH_PARENT));
41 | msgTextView.setBackgroundColor(Color.parseColor("#88000000"));
42 | msgTextView.setTextSize(10f);
43 |
44 | final Button btLog = new Button(mActivity);
45 | btLog.setText(Config.isTrack ? "关闭" : "跟踪");
46 | btLog.setTextColor(Color.WHITE);
47 | btLog.setBackgroundColor(Color.RED);
48 | FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT,
49 | FrameLayout.LayoutParams.WRAP_CONTENT);
50 | layoutParams.gravity = Gravity.CENTER_HORIZONTAL;
51 | btLog.setLayoutParams(layoutParams);
52 | TextView title = new TextView(mActivity);
53 | title.setText("Track");
54 | title.setGravity(Gravity.CENTER_HORIZONTAL);
55 | title.setTextColor(Color.WHITE);
56 | title.setBackgroundColor(Color.parseColor("#88000000"));
57 |
58 | msgScrollView.addView(msgTextView);
59 | logView.addView(title);
60 | logView.addView(msgScrollView);
61 | logView.addView(btLog);
62 | msgScrollView.setVisibility(Config.isTrack ? View.VISIBLE : View.GONE);
63 | btLog.setOnClickListener(new View.OnClickListener() {
64 | @Override
65 | public void onClick(View view) {
66 | if (msgScrollView.getVisibility() == View.GONE) {
67 | msgScrollView.setVisibility(View.VISIBLE);
68 | Config.isTrack = true;
69 | btLog.setText("关闭");
70 |
71 | } else {
72 | msgScrollView.setVisibility(View.GONE);
73 | Config.isTrack = false;
74 | btLog.setText("跟踪");
75 | }
76 | }
77 | });
78 |
79 |
80 | return logView;
81 | }
82 |
83 | public static TextView getMsgTextView() {
84 | return msgTextView;
85 | }
86 |
87 | public static int getLogViewid() {
88 | return logViewid;
89 | }
90 |
91 |
92 | }
93 |
94 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BolexLiu/APPTrack/03af7c8ca4a3f9383726d1bd99528ffbe5fad887/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BolexLiu/APPTrack/03af7c8ca4a3f9383726d1bd99528ffbe5fad887/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BolexLiu/APPTrack/03af7c8ca4a3f9383726d1bd99528ffbe5fad887/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BolexLiu/APPTrack/03af7c8ca4a3f9383726d1bd99528ffbe5fad887/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BolexLiu/APPTrack/03af7c8ca4a3f9383726d1bd99528ffbe5fad887/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | APPTrack
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.2.3'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | ## Project-wide Gradle settings.
2 | #
3 | # For more details on how to configure your build environment visit
4 | # http://www.gradle.org/docs/current/userguide/build_environment.html
5 | #
6 | # Specifies the JVM arguments used for the daemon process.
7 | # The setting is particularly useful for tweaking memory settings.
8 | # Default value: -Xmx1024m -XX:MaxPermSize=256m
9 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
10 | #
11 | # When configured, Gradle will run in incubating parallel mode.
12 | # This option should only be used with decoupled projects. More details, visit
13 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
14 | # org.gradle.parallel=true
15 | #Thu Dec 07 23:51:20 CST 2017
16 | systemProp.http.proxyHost=127.0.0.1
17 | org.gradle.jvmargs=-Xmx1536m
18 | systemProp.http.proxyPort=1080
19 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BolexLiu/APPTrack/03af7c8ca4a3f9383726d1bd99528ffbe5fad887/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Dec 28 10:00:20 PST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/mi.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BolexLiu/APPTrack/03af7c8ca4a3f9383726d1bd99528ffbe5fad887/mi.gif
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/taday.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BolexLiu/APPTrack/03af7c8ca4a3f9383726d1bd99528ffbe5fad887/taday.gif
--------------------------------------------------------------------------------