capacitor-dex-editor 0.0.43 → 0.0.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<application>
|
|
3
3
|
<activity
|
|
4
4
|
android:name=".SmaliEditorActivity"
|
|
5
|
-
android:theme="@
|
|
5
|
+
android:theme="@style/Theme.AppCompat.NoActionBar"
|
|
6
6
|
android:configChanges="orientation|screenSize|keyboardHidden"
|
|
7
7
|
android:windowSoftInputMode="adjustResize"
|
|
8
8
|
android:exported="false" />
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
package com.aetherlink.dexeditor;
|
|
2
2
|
|
|
3
|
-
import android.app.Activity;
|
|
4
3
|
import android.content.Intent;
|
|
5
4
|
import android.graphics.Color;
|
|
6
5
|
import android.graphics.Typeface;
|
|
6
|
+
import android.os.Build;
|
|
7
7
|
import android.os.Bundle;
|
|
8
8
|
import android.view.View;
|
|
9
9
|
import android.view.ViewGroup;
|
|
@@ -15,9 +15,15 @@ import android.widget.LinearLayout;
|
|
|
15
15
|
import android.widget.TextView;
|
|
16
16
|
import android.widget.Toast;
|
|
17
17
|
|
|
18
|
+
import androidx.appcompat.app.AppCompatActivity;
|
|
19
|
+
import androidx.core.graphics.Insets;
|
|
20
|
+
import androidx.core.view.ViewCompat;
|
|
21
|
+
import androidx.core.view.WindowCompat;
|
|
22
|
+
import androidx.core.view.WindowInsetsCompat;
|
|
23
|
+
|
|
18
24
|
import com.aetherlink.dexeditor.editor.EditView;
|
|
19
25
|
|
|
20
|
-
public class SmaliEditorActivity extends
|
|
26
|
+
public class SmaliEditorActivity extends AppCompatActivity {
|
|
21
27
|
|
|
22
28
|
public static final String EXTRA_CONTENT = "content";
|
|
23
29
|
public static final String EXTRA_TITLE = "title";
|
|
@@ -29,17 +35,20 @@ public class SmaliEditorActivity extends Activity {
|
|
|
29
35
|
private EditView editView;
|
|
30
36
|
private String originalContent;
|
|
31
37
|
private boolean readOnly = false;
|
|
38
|
+
private LinearLayout root;
|
|
39
|
+
private View topSpacer;
|
|
40
|
+
private View bottomSpacer;
|
|
32
41
|
|
|
33
42
|
@Override
|
|
34
43
|
protected void onCreate(Bundle savedInstanceState) {
|
|
35
44
|
super.onCreate(savedInstanceState);
|
|
36
45
|
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
46
|
+
// Edge-to-Edge 模式
|
|
47
|
+
WindowCompat.setDecorFitsSystemWindows(getWindow(), false);
|
|
48
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
|
49
|
+
getWindow().setStatusBarColor(Color.TRANSPARENT);
|
|
50
|
+
getWindow().setNavigationBarColor(Color.TRANSPARENT);
|
|
51
|
+
}
|
|
43
52
|
|
|
44
53
|
// 获取参数
|
|
45
54
|
Intent intent = getIntent();
|
|
@@ -52,10 +61,16 @@ public class SmaliEditorActivity extends Activity {
|
|
|
52
61
|
if (title == null) title = "Smali Editor";
|
|
53
62
|
|
|
54
63
|
// 创建布局
|
|
55
|
-
|
|
64
|
+
root = new LinearLayout(this);
|
|
56
65
|
root.setOrientation(LinearLayout.VERTICAL);
|
|
57
66
|
root.setBackgroundColor(Color.parseColor("#1E1E1E"));
|
|
58
67
|
|
|
68
|
+
// 顶部安全区域占位
|
|
69
|
+
topSpacer = new View(this);
|
|
70
|
+
topSpacer.setBackgroundColor(Color.parseColor("#2D2D2D"));
|
|
71
|
+
root.addView(topSpacer, new LinearLayout.LayoutParams(
|
|
72
|
+
ViewGroup.LayoutParams.MATCH_PARENT, 0));
|
|
73
|
+
|
|
59
74
|
// 工具栏
|
|
60
75
|
LinearLayout toolbar = createToolbar(title, className);
|
|
61
76
|
root.addView(toolbar);
|
|
@@ -63,17 +78,39 @@ public class SmaliEditorActivity extends Activity {
|
|
|
63
78
|
// 编辑器
|
|
64
79
|
editView = new EditView(this);
|
|
65
80
|
editView.setLayoutParams(new LinearLayout.LayoutParams(
|
|
66
|
-
ViewGroup.LayoutParams.MATCH_PARENT,
|
|
67
|
-
ViewGroup.LayoutParams.MATCH_PARENT
|
|
81
|
+
ViewGroup.LayoutParams.MATCH_PARENT, 0, 1
|
|
68
82
|
));
|
|
69
83
|
editView.setText(originalContent);
|
|
70
84
|
editView.setSyntaxLanguageFileName("smali.json");
|
|
71
85
|
editView.setEditedMode(!readOnly);
|
|
72
86
|
editView.setTypeface(Typeface.MONOSPACE);
|
|
73
87
|
editView.setTextSize(14);
|
|
74
|
-
|
|
75
88
|
root.addView(editView);
|
|
89
|
+
|
|
90
|
+
// 底部安全区域占位
|
|
91
|
+
bottomSpacer = new View(this);
|
|
92
|
+
bottomSpacer.setBackgroundColor(Color.parseColor("#1E1E1E"));
|
|
93
|
+
root.addView(bottomSpacer, new LinearLayout.LayoutParams(
|
|
94
|
+
ViewGroup.LayoutParams.MATCH_PARENT, 0));
|
|
95
|
+
|
|
76
96
|
setContentView(root);
|
|
97
|
+
|
|
98
|
+
// 处理安全区域
|
|
99
|
+
ViewCompat.setOnApplyWindowInsetsListener(root, (v, windowInsets) -> {
|
|
100
|
+
Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars());
|
|
101
|
+
|
|
102
|
+
// 更新顶部占位高度
|
|
103
|
+
ViewGroup.LayoutParams topParams = topSpacer.getLayoutParams();
|
|
104
|
+
topParams.height = insets.top;
|
|
105
|
+
topSpacer.setLayoutParams(topParams);
|
|
106
|
+
|
|
107
|
+
// 更新底部占位高度
|
|
108
|
+
ViewGroup.LayoutParams bottomParams = bottomSpacer.getLayoutParams();
|
|
109
|
+
bottomParams.height = insets.bottom;
|
|
110
|
+
bottomSpacer.setLayoutParams(bottomParams);
|
|
111
|
+
|
|
112
|
+
return WindowInsetsCompat.CONSUMED;
|
|
113
|
+
});
|
|
77
114
|
}
|
|
78
115
|
|
|
79
116
|
private LinearLayout createToolbar(String title, String className) {
|