capacitor-dex-editor 0.0.38 → 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.
Files changed (73) hide show
  1. package/android/src/main/AndroidManifest.xml +8 -0
  2. package/android/src/main/assets/availableSyntax.json +54 -0
  3. package/android/src/main/assets/c.json +42 -0
  4. package/android/src/main/assets/colors.json +21 -0
  5. package/android/src/main/assets/cpp.json +79 -0
  6. package/android/src/main/assets/dart.json +108 -0
  7. package/android/src/main/assets/java.json +46 -0
  8. package/android/src/main/assets/js.json +54 -0
  9. package/android/src/main/assets/json.json +33 -0
  10. package/android/src/main/assets/kotlin.json +53 -0
  11. package/android/src/main/assets/lua.json +54 -0
  12. package/android/src/main/assets/php.json +69 -0
  13. package/android/src/main/assets/python.json +87 -0
  14. package/android/src/main/assets/rust.json +139 -0
  15. package/android/src/main/assets/smali.json +131 -0
  16. package/android/src/main/assets/xml.json +96 -0
  17. package/android/src/main/java/com/aetherlink/dexeditor/DexEditorPluginPlugin.java +48 -0
  18. package/android/src/main/java/com/aetherlink/dexeditor/SmaliEditorActivity.java +205 -0
  19. package/android/src/main/java/com/aetherlink/dexeditor/editor/EditView.java +4022 -0
  20. package/android/src/main/java/com/aetherlink/dexeditor/editor/WordWrapLayout.java +275 -0
  21. package/android/src/main/java/com/aetherlink/dexeditor/editor/buffer/BufferCache.java +113 -0
  22. package/android/src/main/java/com/aetherlink/dexeditor/editor/buffer/GapBuffer.java +685 -0
  23. package/android/src/main/java/com/aetherlink/dexeditor/editor/component/ClipboardPanel.java +1380 -0
  24. package/android/src/main/java/com/aetherlink/dexeditor/editor/component/Magnifier.java +363 -0
  25. package/android/src/main/java/com/aetherlink/dexeditor/editor/highlight/Candidate.java +52 -0
  26. package/android/src/main/java/com/aetherlink/dexeditor/editor/highlight/CommentDef.java +47 -0
  27. package/android/src/main/java/com/aetherlink/dexeditor/editor/highlight/LineResult.java +49 -0
  28. package/android/src/main/java/com/aetherlink/dexeditor/editor/highlight/MHSyntaxHighlightEngine.java +841 -0
  29. package/android/src/main/java/com/aetherlink/dexeditor/editor/highlight/Rule.java +53 -0
  30. package/android/src/main/java/com/aetherlink/dexeditor/editor/highlight/Token.java +48 -0
  31. package/android/src/main/java/com/aetherlink/dexeditor/editor/listener/OnTextChangedListener.java +6 -0
  32. package/android/src/main/java/com/aetherlink/dexeditor/editor/treeObserver/OnComputeInternalInsetsListener.java +92 -0
  33. package/android/src/main/java/com/aetherlink/dexeditor/editor/treeObserver/ViewTreeObserverReflection.java +87 -0
  34. package/android/src/main/java/com/aetherlink/dexeditor/editor/utils/LinkChecker.java +28 -0
  35. package/android/src/main/java/com/aetherlink/dexeditor/editor/utils/Pair.java +80 -0
  36. package/android/src/main/java/com/aetherlink/dexeditor/editor/utils/ScreenUtils.java +63 -0
  37. package/android/src/main/java/com/aetherlink/dexeditor/editor/utils/menuUtils/MenuAction.java +49 -0
  38. package/android/src/main/java/com/aetherlink/dexeditor/editor/utils/menuUtils/MenuItemConfig.java +49 -0
  39. package/android/src/main/java/com/aetherlink/dexeditor/editor/utils/menuUtils/MenuItemData.java +49 -0
  40. package/android/src/main/java/com/aetherlink/dexeditor/editor/utils/menuUtils/ViewFader.java +76 -0
  41. package/android/src/main/res/drawable/abc_text_cursor_material.xml +9 -0
  42. package/android/src/main/res/drawable/abc_text_select_handle_left_mtrl.png +0 -0
  43. package/android/src/main/res/drawable/abc_text_select_handle_middle_mtrl.png +0 -0
  44. package/android/src/main/res/drawable/abc_text_select_handle_right_mtrl.png +0 -0
  45. package/android/src/main/res/drawable/ic_arrow_back.xml +12 -0
  46. package/android/src/main/res/drawable/ic_copy.xml +11 -0
  47. package/android/src/main/res/drawable/ic_cut.xml +10 -0
  48. package/android/src/main/res/drawable/ic_delete.xml +12 -0
  49. package/android/src/main/res/drawable/ic_edit_white_24dp.xml +10 -0
  50. package/android/src/main/res/drawable/ic_goto.xml +10 -0
  51. package/android/src/main/res/drawable/ic_launcher_background.xml +186 -0
  52. package/android/src/main/res/drawable/ic_look_white_24dp.xml +11 -0
  53. package/android/src/main/res/drawable/ic_more.xml +10 -0
  54. package/android/src/main/res/drawable/ic_open_link.xml +11 -0
  55. package/android/src/main/res/drawable/ic_paste.xml +11 -0
  56. package/android/src/main/res/drawable/ic_redo_white_24dp.xml +10 -0
  57. package/android/src/main/res/drawable/ic_select.xml +11 -0
  58. package/android/src/main/res/drawable/ic_select_all.xml +10 -0
  59. package/android/src/main/res/drawable/ic_share.xml +11 -0
  60. package/android/src/main/res/drawable/ic_toggle_comment.xml +12 -0
  61. package/android/src/main/res/drawable/ic_translate.xml +10 -0
  62. package/android/src/main/res/drawable/ic_undo_white_24dp.xml +11 -0
  63. package/android/src/main/res/drawable/magnifier_bg.xml +5 -0
  64. package/android/src/main/res/drawable/popup_background.xml +8 -0
  65. package/android/src/main/res/drawable/ripple_effect.xml +9 -0
  66. package/android/src/main/res/drawable/selection_menu_background.xml +5 -0
  67. package/android/src/main/res/layout/custom_selection_menu.xml +44 -0
  68. package/android/src/main/res/layout/expand_button.xml +23 -0
  69. package/android/src/main/res/layout/item_autocomplete.xml +25 -0
  70. package/android/src/main/res/layout/magnifier_popup.xml +17 -0
  71. package/android/src/main/res/layout/menu_item.xml +30 -0
  72. package/android/src/main/res/layout/text_selection_menu.xml +36 -0
  73. package/package.json +1 -1
@@ -0,0 +1,53 @@
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.highlight;
37
+
38
+ import java.util.Map;
39
+ import java.util.regex.Pattern;
40
+
41
+ /**
42
+ * Rule: Represents a single syntax highlighting rule. Each rule has a regex pattern, type (style
43
+ * name), optional group styles, and priority.
44
+ */
45
+ public class Rule {
46
+ public String type; // Style/type name (maps to color)
47
+ public Pattern pattern; // Regex pattern to match
48
+ public Map<Integer, String> groupStyles; // Map of capture group → style
49
+ public int priority; // Rule application priority
50
+
51
+ public String lineBackground; // Special case store line background color
52
+ public Integer lineBackgroundColor = null; // parsed int color (cached)
53
+ }
@@ -0,0 +1,48 @@
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.highlight;
37
+
38
+ /** Token: Represents a final colored text span after resolving overlaps. */
39
+ public class Token {
40
+ int start, end; // Character range
41
+ int color; // Color value
42
+
43
+ Token(int s, int e, int c) {
44
+ start = s;
45
+ end = e;
46
+ color = c;
47
+ }
48
+ }
@@ -0,0 +1,6 @@
1
+ package com.aetherlink.dexeditor.editor.listener;
2
+
3
+ @FunctionalInterface
4
+ public interface OnTextChangedListener {
5
+ void onTextChanged();
6
+ }
@@ -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,80 @@
1
+ /*
2
+ * Copyright (C) 2009 The Android Open Source Project
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ package com.aetherlink.dexeditor.editor.utils;
17
+
18
+ import java.util.Objects;
19
+
20
+ /**
21
+ * Container to ease passing around a tuple of two objects. This object provides a sensible
22
+ * implementation of equals(), returning true if equals() is true on each of the contained objects.
23
+ */
24
+ public class Pair<F, S> {
25
+ public F first; // first element
26
+ public S second; // second element
27
+
28
+ /**
29
+ * Constructor for a Pair.
30
+ *
31
+ * @param first the first object in the Pair
32
+ * @param second the second object in the pair
33
+ */
34
+ public Pair(F first, S second) {
35
+ this.first = first;
36
+ this.second = second;
37
+ }
38
+
39
+ /**
40
+ * Checks the two objects for equality by delegating to their respective {@link
41
+ * Object#equals(Object)} methods.
42
+ *
43
+ * @param o the {@link Pair} to which this one is to be checked for equality
44
+ * @return true if the underlying objects of the Pair are both considered equal
45
+ */
46
+ @Override
47
+ public boolean equals(Object o) {
48
+ if (!(o instanceof Pair)) {
49
+ return false;
50
+ }
51
+ Pair<?, ?> p = (Pair<?, ?>) o;
52
+ return Objects.equals(p.first, first) && Objects.equals(p.second, second);
53
+ }
54
+
55
+ /**
56
+ * Compute a hash code using the hash codes of the underlying objects
57
+ *
58
+ * @return a hashcode of the Pair
59
+ */
60
+ @Override
61
+ public int hashCode() {
62
+ return (first == null ? 0 : first.hashCode()) ^ (second == null ? 0 : second.hashCode());
63
+ }
64
+
65
+ @Override
66
+ public String toString() {
67
+ return "Pair{" + String.valueOf(first) + " " + String.valueOf(second) + "}";
68
+ }
69
+
70
+ /**
71
+ * Convenience method for creating an appropriately typed pair.
72
+ *
73
+ * @param a the first object in the Pair
74
+ * @param b the second object in the pair
75
+ * @return a Pair that is templatized with the types of a and b
76
+ */
77
+ public static <A, B> Pair<A, B> create(A a, B b) {
78
+ return new Pair<A, B>(a, b);
79
+ }
80
+ }
@@ -0,0 +1,63 @@
1
+ package com.aetherlink.dexeditor.editor.utils;
2
+
3
+ import android.content.Context;
4
+ import android.util.DisplayMetrics;
5
+ import android.util.TypedValue;
6
+ import android.app.Activity;
7
+ import java.lang.reflect.Field;
8
+
9
+ public final class ScreenUtils {
10
+
11
+ public static int getStatusBarHeight(Context context) {
12
+ int statusBarHeight = 0;
13
+ try {
14
+ Class<?> c = Class.forName("com.android.internal.R$dimen");
15
+ Object obj = c.newInstance();
16
+ Field field = c.getField("status_bar_height");
17
+ statusBarHeight = context.getResources().getDimensionPixelSize(Integer.parseInt(field.get(obj).toString()));
18
+ } catch (Exception e) {
19
+ e.printStackTrace();
20
+ }
21
+ return statusBarHeight;
22
+ }
23
+
24
+ public static int getActionBarHeight(Context context) {
25
+ TypedValue typedValue = new TypedValue();
26
+ int actionBarHeight = 0;
27
+ if (context.getTheme().resolveAttribute(android.R.attr.actionBarSize, typedValue, true)) {
28
+ actionBarHeight = TypedValue.complexToDimensionPixelSize(typedValue.data,
29
+ context.getResources().getDisplayMetrics());
30
+ }
31
+ return actionBarHeight;
32
+ }
33
+
34
+ public static int getScreenWidth(Context context) {
35
+ DisplayMetrics dm = new DisplayMetrics();
36
+ ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(dm);
37
+ return dm.widthPixels;
38
+ }
39
+
40
+ public static int getScreenHeight(Context context) {
41
+ DisplayMetrics dm = new DisplayMetrics();
42
+ ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(dm);
43
+ return dm.heightPixels;
44
+ }
45
+
46
+ public static int dip2px(Context context, float dpValue) {
47
+ final float scale = context.getResources().getDisplayMetrics().density;
48
+ return (int) (dpValue * scale + 0.5f);
49
+ }
50
+
51
+ public static int px2dip(Context context, float pxValue) {
52
+ final float scale = context.getResources().getDisplayMetrics().density;
53
+ return (int) (pxValue / scale + 0.5f);
54
+ }
55
+
56
+ public static int px2sp(float pxValue, float fontScale) {
57
+ return (int) (pxValue / fontScale + 0.5f);
58
+ }
59
+
60
+ public static int sp2px(float spValue, float fontScale) {
61
+ return (int) (spValue * fontScale + 0.5f);
62
+ }
63
+ }
@@ -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
+ }
@@ -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
+ }
@@ -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
+ }