capacitor-dex-editor 0.0.39 → 0.0.40
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.
- package/android/src/main/java/com/aetherlink/dexeditor/SmaliEditorActivity.java +2 -2
- package/android/src/main/java/com/aetherlink/dexeditor/editor/WordWrapLayout.java +1 -1
- package/android/src/main/java/com/aetherlink/dexeditor/editor/treeObserver/OnComputeInternalInsetsListener.java +92 -0
- package/android/src/main/java/com/aetherlink/dexeditor/editor/treeObserver/ViewTreeObserverReflection.java +87 -0
- package/android/src/main/java/com/aetherlink/dexeditor/editor/utils/LinkChecker.java +28 -0
- package/android/src/main/java/com/aetherlink/dexeditor/editor/utils/menuUtils/MenuAction.java +49 -0
- package/android/src/main/java/com/aetherlink/dexeditor/editor/utils/menuUtils/MenuItemConfig.java +49 -0
- package/android/src/main/java/com/aetherlink/dexeditor/editor/utils/menuUtils/MenuItemData.java +49 -0
- package/android/src/main/java/com/aetherlink/dexeditor/editor/utils/menuUtils/ViewFader.java +76 -0
- package/package.json +1 -1
|
@@ -170,7 +170,7 @@ public class SmaliEditorActivity extends Activity {
|
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
private void handleBack() {
|
|
173
|
-
String currentContent = editView.
|
|
173
|
+
String currentContent = editView.getBuffer().toString();
|
|
174
174
|
if (!currentContent.equals(originalContent)) {
|
|
175
175
|
// 有修改,询问是否保存
|
|
176
176
|
new android.app.AlertDialog.Builder(this)
|
|
@@ -190,7 +190,7 @@ public class SmaliEditorActivity extends Activity {
|
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
private void saveAndFinish() {
|
|
193
|
-
String currentContent = editView.
|
|
193
|
+
String currentContent = editView.getBuffer().toString();
|
|
194
194
|
Intent result = new Intent();
|
|
195
195
|
result.putExtra(RESULT_CONTENT, currentContent);
|
|
196
196
|
result.putExtra(RESULT_MODIFIED, !currentContent.equals(originalContent));
|
|
@@ -37,7 +37,7 @@ package com.aetherlink.dexeditor.editor;
|
|
|
37
37
|
|
|
38
38
|
import android.util.Log;
|
|
39
39
|
import com.aetherlink.dexeditor.editor.EditView;
|
|
40
|
-
import com.aetherlink.dexeditor.editor.GapBuffer;
|
|
40
|
+
import com.aetherlink.dexeditor.editor.buffer.GapBuffer;
|
|
41
41
|
import java.util.ArrayList;
|
|
42
42
|
import java.util.List;
|
|
43
43
|
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* MH-TextEditor - An Advanced and optimized TextEditor for android
|
|
3
|
+
* Copyright 2025, developer-krushna
|
|
4
|
+
*
|
|
5
|
+
* Redistribution and use in source and binary forms, with or without
|
|
6
|
+
* modification, are permitted provided that the following conditions are
|
|
7
|
+
* met:
|
|
8
|
+
*
|
|
9
|
+
* * Redistributions of source code must retain the above copyright
|
|
10
|
+
* notice, this list of conditions and the following disclaimer.
|
|
11
|
+
* * Redistributions in binary form must reproduce the above
|
|
12
|
+
* copyright notice, this list of conditions and the following disclaimer
|
|
13
|
+
* in the documentation and/or other materials provided with the
|
|
14
|
+
* distribution.
|
|
15
|
+
* * Neither the name of developer-krushna nor the names of its
|
|
16
|
+
* contributors may be used to endorse or promote products derived from
|
|
17
|
+
* this software without specific prior written permission.
|
|
18
|
+
*
|
|
19
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
20
|
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
21
|
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
22
|
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
23
|
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
24
|
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
25
|
+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
26
|
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
27
|
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
28
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
* Please contact Krushna by email modder-hub@zohomail.in if you need
|
|
33
|
+
* additional information or have any questions
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
package com.aetherlink.dexeditor.editor.treeObserver;
|
|
37
|
+
|
|
38
|
+
import android.graphics.Region;
|
|
39
|
+
import android.inputmethodservice.InputMethodService;
|
|
40
|
+
|
|
41
|
+
import java.lang.reflect.Field;
|
|
42
|
+
import java.lang.reflect.InvocationHandler;
|
|
43
|
+
import java.lang.reflect.Method;
|
|
44
|
+
import java.lang.reflect.Proxy;
|
|
45
|
+
|
|
46
|
+
/** Created by max on 2019/2/22.<br> */
|
|
47
|
+
public class OnComputeInternalInsetsListener implements InvocationHandler {
|
|
48
|
+
|
|
49
|
+
private Region touchRegion = null;
|
|
50
|
+
|
|
51
|
+
public Object getListener() {
|
|
52
|
+
Object target = null;
|
|
53
|
+
try {
|
|
54
|
+
Class class1 = Class.forName("android.view.ViewTreeObserver$OnComputeInternalInsetsListener");
|
|
55
|
+
target = Proxy.newProxyInstance(OnComputeInternalInsetsListener.class.getClassLoader(),
|
|
56
|
+
new Class[]{class1}, this);
|
|
57
|
+
} catch (Exception e) {
|
|
58
|
+
e.printStackTrace();
|
|
59
|
+
}
|
|
60
|
+
return target;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
public Region getTouchRegion() {
|
|
64
|
+
return touchRegion;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
public void setTouchRegion(Region touchRegion) {
|
|
68
|
+
this.touchRegion = touchRegion;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@Override
|
|
72
|
+
public Object invoke(Object proxy, Method method, Object[] args) {
|
|
73
|
+
try {
|
|
74
|
+
Field regionField = args[0].getClass()
|
|
75
|
+
.getDeclaredField("touchableRegion");
|
|
76
|
+
regionField.setAccessible(true);
|
|
77
|
+
Field insetField = args[0].getClass()
|
|
78
|
+
.getDeclaredField("mTouchableInsets");
|
|
79
|
+
insetField.setAccessible(true);
|
|
80
|
+
if (touchRegion != null) {
|
|
81
|
+
Region region = (Region) regionField.get(args[0]);
|
|
82
|
+
region.set(touchRegion);
|
|
83
|
+
insetField.set(args[0], InputMethodService.Insets.TOUCHABLE_INSETS_REGION);
|
|
84
|
+
} else {
|
|
85
|
+
insetField.set(args[0], InputMethodService.Insets.TOUCHABLE_INSETS_FRAME);
|
|
86
|
+
}
|
|
87
|
+
} catch (Exception e) {
|
|
88
|
+
e.printStackTrace();
|
|
89
|
+
}
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* MH-TextEditor - An Advanced and optimized TextEditor for android
|
|
3
|
+
* Copyright 2025, developer-krushna
|
|
4
|
+
*
|
|
5
|
+
* Redistribution and use in source and binary forms, with or without
|
|
6
|
+
* modification, are permitted provided that the following conditions are
|
|
7
|
+
* met:
|
|
8
|
+
*
|
|
9
|
+
* * Redistributions of source code must retain the above copyright
|
|
10
|
+
* notice, this list of conditions and the following disclaimer.
|
|
11
|
+
* * Redistributions in binary form must reproduce the above
|
|
12
|
+
* copyright notice, this list of conditions and the following disclaimer
|
|
13
|
+
* in the documentation and/or other materials provided with the
|
|
14
|
+
* distribution.
|
|
15
|
+
* * Neither the name of developer-krushna nor the names of its
|
|
16
|
+
* contributors may be used to endorse or promote products derived from
|
|
17
|
+
* this software without specific prior written permission.
|
|
18
|
+
*
|
|
19
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
20
|
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
21
|
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
22
|
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
23
|
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
24
|
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
25
|
+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
26
|
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
27
|
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
28
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
* Please contact Krushna by email modder-hub@zohomail.in if you need
|
|
33
|
+
* additional information or have any questions
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
package com.aetherlink.dexeditor.editor.treeObserver;
|
|
37
|
+
|
|
38
|
+
import android.view.ViewTreeObserver;
|
|
39
|
+
|
|
40
|
+
import java.lang.reflect.Field;
|
|
41
|
+
import java.lang.reflect.Method;
|
|
42
|
+
import java.util.ArrayList;
|
|
43
|
+
|
|
44
|
+
/** Created by max on 2019/2/22.<br> */
|
|
45
|
+
public class ViewTreeObserverReflection {
|
|
46
|
+
|
|
47
|
+
private ViewTreeObserverReflection() {}
|
|
48
|
+
|
|
49
|
+
public static void removeOnComputeInternalInsetsListener(ViewTreeObserver viewTree) {
|
|
50
|
+
if (viewTree == null) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
Class<?> clazz = Class.forName("android.view.ViewTreeObserver");
|
|
55
|
+
Field field = viewTree.getClass().getDeclaredField("mOnComputeInternalInsetsListeners");
|
|
56
|
+
field.setAccessible(true);
|
|
57
|
+
Object listenerList = field.get(viewTree);
|
|
58
|
+
Method method = listenerList.getClass().getDeclaredMethod("getArray");
|
|
59
|
+
method.setAccessible(true);
|
|
60
|
+
ArrayList<Object> list = (ArrayList<Object>) method.invoke(listenerList);
|
|
61
|
+
Class<?> classes
|
|
62
|
+
[] = {Class.forName("android.view.ViewTreeObserver$OnComputeInternalInsetsListener")};
|
|
63
|
+
if (list != null && list.size() > 0) {
|
|
64
|
+
clazz.getDeclaredMethod("removeOnComputeInternalInsetsListener", classes).invoke(viewTree,
|
|
65
|
+
list.get(0));
|
|
66
|
+
}
|
|
67
|
+
} catch (Exception e) {
|
|
68
|
+
e.printStackTrace();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
public static void addOnComputeInternalInsetsListener(ViewTreeObserver viewTree, Object object) {
|
|
73
|
+
if (viewTree == null) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
try {
|
|
77
|
+
Class<?> classes
|
|
78
|
+
[] = {Class.forName("android.view.ViewTreeObserver$OnComputeInternalInsetsListener")};
|
|
79
|
+
Class<?> clazz = Class.forName("android.view.ViewTreeObserver");
|
|
80
|
+
clazz.getDeclaredMethod("addOnComputeInternalInsetsListener", classes).invoke(viewTree,
|
|
81
|
+
object);
|
|
82
|
+
} catch (Exception e) {
|
|
83
|
+
e.printStackTrace();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
package com.aetherlink.dexeditor.editor.utils;
|
|
2
|
+
|
|
3
|
+
import android.content.Context;
|
|
4
|
+
import android.content.Intent;
|
|
5
|
+
import android.net.Uri;
|
|
6
|
+
import android.util.Patterns;
|
|
7
|
+
|
|
8
|
+
public class LinkChecker {
|
|
9
|
+
|
|
10
|
+
public static boolean isLink(String text) {
|
|
11
|
+
if (text == null || text.isEmpty()) return false;
|
|
12
|
+
return Patterns.WEB_URL.matcher(text.trim()).matches();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
public static void openLinkInBrowser(Context context, String url) {
|
|
16
|
+
try {
|
|
17
|
+
String trimmedUrl = url.trim();
|
|
18
|
+
if (!trimmedUrl.startsWith("http://") && !trimmedUrl.startsWith("https://")) {
|
|
19
|
+
trimmedUrl = "https://" + trimmedUrl;
|
|
20
|
+
}
|
|
21
|
+
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(trimmedUrl));
|
|
22
|
+
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
23
|
+
context.startActivity(intent);
|
|
24
|
+
} catch (Exception e) {
|
|
25
|
+
e.printStackTrace();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* MH-TextEditor - An Advanced and optimized TextEditor for android
|
|
3
|
+
* Copyright 2025, developer-krushna
|
|
4
|
+
*
|
|
5
|
+
* Redistribution and use in source and binary forms, with or without
|
|
6
|
+
* modification, are permitted provided that the following conditions are
|
|
7
|
+
* met:
|
|
8
|
+
*
|
|
9
|
+
* * Redistributions of source code must retain the above copyright
|
|
10
|
+
* notice, this list of conditions and the following disclaimer.
|
|
11
|
+
* * Redistributions in binary form must reproduce the above
|
|
12
|
+
* copyright notice, this list of conditions and the following disclaimer
|
|
13
|
+
* in the documentation and/or other materials provided with the
|
|
14
|
+
* distribution.
|
|
15
|
+
* * Neither the name of developer-krushna nor the names of its
|
|
16
|
+
* contributors may be used to endorse or promote products derived from
|
|
17
|
+
* this software without specific prior written permission.
|
|
18
|
+
*
|
|
19
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
20
|
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
21
|
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
22
|
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
23
|
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
24
|
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
25
|
+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
26
|
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
27
|
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
28
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
* Please contact Krushna by email modder-hub@zohomail.in if you need
|
|
33
|
+
* additional information or have any questions
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
package com.aetherlink.dexeditor.editor.utils.menuUtils;
|
|
37
|
+
|
|
38
|
+
// Enum for menu actions
|
|
39
|
+
public enum MenuAction {
|
|
40
|
+
SELECT,
|
|
41
|
+
COPY,
|
|
42
|
+
CUT,
|
|
43
|
+
PASTE,
|
|
44
|
+
SELECT_ALL,
|
|
45
|
+
SHARE,
|
|
46
|
+
GOTO,
|
|
47
|
+
DELETE,
|
|
48
|
+
TRANSLATE
|
|
49
|
+
}
|
package/android/src/main/java/com/aetherlink/dexeditor/editor/utils/menuUtils/MenuItemConfig.java
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* MH-TextEditor - An Advanced and optimized TextEditor for android
|
|
3
|
+
* Copyright 2025, developer-krushna
|
|
4
|
+
*
|
|
5
|
+
* Redistribution and use in source and binary forms, with or without
|
|
6
|
+
* modification, are permitted provided that the following conditions are
|
|
7
|
+
* met:
|
|
8
|
+
*
|
|
9
|
+
* * Redistributions of source code must retain the above copyright
|
|
10
|
+
* notice, this list of conditions and the following disclaimer.
|
|
11
|
+
* * Redistributions in binary form must reproduce the above
|
|
12
|
+
* copyright notice, this list of conditions and the following disclaimer
|
|
13
|
+
* in the documentation and/or other materials provided with the
|
|
14
|
+
* distribution.
|
|
15
|
+
* * Neither the name of developer-krushna nor the names of its
|
|
16
|
+
* contributors may be used to endorse or promote products derived from
|
|
17
|
+
* this software without specific prior written permission.
|
|
18
|
+
*
|
|
19
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
20
|
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
21
|
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
22
|
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
23
|
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
24
|
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
25
|
+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
26
|
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
27
|
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
28
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
* Please contact Krushna by email modder-hub@zohomail.in if you need
|
|
33
|
+
* additional information or have any questions
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
package com.aetherlink.dexeditor.editor.utils.menuUtils;
|
|
37
|
+
|
|
38
|
+
// Config class for menu items
|
|
39
|
+
public class MenuItemConfig {
|
|
40
|
+
public String title;
|
|
41
|
+
public int iconRes;
|
|
42
|
+
public MenuAction action;
|
|
43
|
+
|
|
44
|
+
public MenuItemConfig(String title, int iconRes, MenuAction action) {
|
|
45
|
+
this.title = title;
|
|
46
|
+
this.iconRes = iconRes;
|
|
47
|
+
this.action = action;
|
|
48
|
+
}
|
|
49
|
+
}
|
package/android/src/main/java/com/aetherlink/dexeditor/editor/utils/menuUtils/MenuItemData.java
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* MH-TextEditor - An Advanced and optimized TextEditor for android
|
|
3
|
+
* Copyright 2025, developer-krushna
|
|
4
|
+
*
|
|
5
|
+
* Redistribution and use in source and binary forms, with or without
|
|
6
|
+
* modification, are permitted provided that the following conditions are
|
|
7
|
+
* met:
|
|
8
|
+
*
|
|
9
|
+
* * Redistributions of source code must retain the above copyright
|
|
10
|
+
* notice, this list of conditions and the following disclaimer.
|
|
11
|
+
* * Redistributions in binary form must reproduce the above
|
|
12
|
+
* copyright notice, this list of conditions and the following disclaimer
|
|
13
|
+
* in the documentation and/or other materials provided with the
|
|
14
|
+
* distribution.
|
|
15
|
+
* * Neither the name of developer-krushna nor the names of its
|
|
16
|
+
* contributors may be used to endorse or promote products derived from
|
|
17
|
+
* this software without specific prior written permission.
|
|
18
|
+
*
|
|
19
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
20
|
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
21
|
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
22
|
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
23
|
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
24
|
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
25
|
+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
26
|
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
27
|
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
28
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
* Please contact Krushna by email modder-hub@zohomail.in if you need
|
|
33
|
+
* additional information or have any questions
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
package com.aetherlink.dexeditor.editor.utils.menuUtils;
|
|
37
|
+
|
|
38
|
+
// Data class for menu items
|
|
39
|
+
public class MenuItemData {
|
|
40
|
+
public String title;
|
|
41
|
+
public int iconRes;
|
|
42
|
+
public MenuAction action;
|
|
43
|
+
|
|
44
|
+
public MenuItemData(String title, int iconRes, MenuAction action) {
|
|
45
|
+
this.title = title;
|
|
46
|
+
this.iconRes = iconRes;
|
|
47
|
+
this.action = action;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* MH-TextEditor - An Advanced and optimized TextEditor for android
|
|
3
|
+
* Copyright 2025, developer-krushna
|
|
4
|
+
*
|
|
5
|
+
* Redistribution and use in source and binary forms, with or without
|
|
6
|
+
* modification, are permitted provided that the following conditions are
|
|
7
|
+
* met:
|
|
8
|
+
*
|
|
9
|
+
* * Redistributions of source code must retain the above copyright
|
|
10
|
+
* notice, this list of conditions and the following disclaimer.
|
|
11
|
+
* * Redistributions in binary form must reproduce the above
|
|
12
|
+
* copyright notice, this list of conditions and the following disclaimer
|
|
13
|
+
* in the documentation and/or other materials provided with the
|
|
14
|
+
* distribution.
|
|
15
|
+
* * Neither the name of developer-krushna nor the names of its
|
|
16
|
+
* contributors may be used to endorse or promote products derived from
|
|
17
|
+
* this software without specific prior written permission.
|
|
18
|
+
*
|
|
19
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
20
|
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
21
|
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
22
|
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
23
|
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
24
|
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
25
|
+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
26
|
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
27
|
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
28
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
* Please contact Krushna by email modder-hub@zohomail.in if you need
|
|
33
|
+
* additional information or have any questions
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
package com.aetherlink.dexeditor.editor.utils.menuUtils;
|
|
37
|
+
|
|
38
|
+
import android.view.View;
|
|
39
|
+
|
|
40
|
+
/** A helper for fading in or out a view. */
|
|
41
|
+
|
|
42
|
+
/** Idea Copied from @Android open source class com/android/internal/widget/FloatingToolbar.java */
|
|
43
|
+
public class ViewFader {
|
|
44
|
+
public static final int FADE_OUT_DURATION = 250;
|
|
45
|
+
public static final int FADE_IN_DURATION = 150;
|
|
46
|
+
|
|
47
|
+
public final View mView;
|
|
48
|
+
public final android.animation.ObjectAnimator mFadeOutAnimation;
|
|
49
|
+
public final android.animation.ObjectAnimator mFadeInAnimation;
|
|
50
|
+
|
|
51
|
+
public ViewFader(View view) {
|
|
52
|
+
mView = view;
|
|
53
|
+
mFadeOutAnimation = android.animation.ObjectAnimator.ofFloat(view, View.ALPHA, 1, 0)
|
|
54
|
+
.setDuration(FADE_OUT_DURATION);
|
|
55
|
+
mFadeInAnimation = android.animation.ObjectAnimator.ofFloat(view, View.ALPHA, 0, 1)
|
|
56
|
+
.setDuration(FADE_IN_DURATION);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
public void fadeIn(boolean animate) {
|
|
60
|
+
mFadeOutAnimation.cancel();
|
|
61
|
+
if (animate) {
|
|
62
|
+
mFadeInAnimation.start();
|
|
63
|
+
} else {
|
|
64
|
+
mView.setAlpha(1);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
public void fadeOut(boolean animate) {
|
|
69
|
+
mFadeInAnimation.cancel();
|
|
70
|
+
if (animate) {
|
|
71
|
+
mFadeOutAnimation.start();
|
|
72
|
+
} else {
|
|
73
|
+
mView.setAlpha(0);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|