├── .gitignore
├── LICENSE
├── README.md
├── app
├── build.gradle
├── libs
│ ├── Hello.tx
│ ├── bin-zip.jar
│ ├── jet-brain.jar
│ └── pxb.jar
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── assets
│ └── provider
│ ├── java
│ └── mt
│ │ └── document
│ │ └── provider
│ │ └── injector
│ │ ├── MainActivity.java
│ │ ├── util
│ │ ├── DocumentInjector.java
│ │ └── ManifestEditor.java
│ │ └── view
│ │ └── AlertProgress.java
│ └── res
│ ├── drawable
│ ├── background.xml
│ ├── ic_launcher.png
│ └── ic_paste_board.png
│ ├── layout
│ ├── main.xml
│ └── progress.xml
│ └── values
│ ├── strings.xml
│ └── styles.xml
├── build.gradle
├── gradle.properties
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # MT-Document-Provider-Injector
2 | Technic used to Inject Document Provider in [MT Manager Mod](https://t.me/Modder_Hub/844)
3 | ## What you will learn
4 | - [x] Parsing & Modifying Android Manifest at binary level using [pxb-axml](https://github.com/Sable/axml)
5 | - [x] Usage of [bin-zip](https://github.com/L-JINBIN/ApkSignatureKiller/tree/master/mt/bin/zip)
6 | - [x] Step wise progress while processing
7 |
8 | ## Project build by
9 | - AIDE(Developing projects on Android)
10 | ## Special thanks to
11 | - [L-JinBin](https://github.com/L-JINBIN) for providing all such great projects. Without him i think, Iam not in this field 😂. But i am sorry 🙏
12 | - [Timscriptov](https://github.com/timscriptov) for modifying both [pxb-axml](https://github.com/timscriptov/axmlparser) and [bin-zip](https://github.com/timscriptov/apkparser)
13 | - [ChatGPT](https://chatgpt.com) for helping me to add comments in the code for better understanding ☺️
14 |
15 | ## This project is already used in MT Manager Mod
16 | - [Download MT Manager Mod](https://t.me/Modder_Hub/844)
17 |
18 | ## My work
19 | - [Download Modder Hub](https://modder-hub.blogspot.com)
20 |
21 | ## Join Telegram
22 | - [Coding Guys](https://t.me/coding_guys)
23 |
24 | # License
25 | Copyright (C) 2024 Krushna Chandra
26 |
27 | Licensed under the Apache License, Version 2.0 (the "License");
28 | you may not use this file except in compliance with the License.
29 | You may obtain a copy of the License at
30 |
31 | http://www.apache.org/licenses/LICENSE-2.0
32 |
33 | Unless required by applicable law or agreed to in writing, software
34 | distributed under the License is distributed on an "AS IS" BASIS,
35 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
36 | See the License for the specific language governing permissions and
37 | limitations under the License.
38 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.application'
3 | }
4 |
5 | android {
6 | compileSdk 34
7 |
8 | useLibrary 'org.apache.http.legacy'
9 |
10 | defaultConfig {
11 | applicationId "mt.document.provider.injector"
12 | namespace "mt.document.provider.injector"
13 | minSdkVersion 21
14 | targetSdkVersion 34
15 | versionCode 1
16 | versionName "1.0"
17 | }
18 |
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 | }
26 |
27 | dependencies {
28 | implementation fileTree(dir: 'libs', include: ['*.jar'])
29 | }
30 |
--------------------------------------------------------------------------------
/app/libs/Hello.tx:
--------------------------------------------------------------------------------
1 | Libs
2 |
--------------------------------------------------------------------------------
/app/libs/bin-zip.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/developer-krushna/MT-Document-Provider-Injector/c7350b0d91bd297a479b8a2ff400eaae521c35fa/app/libs/bin-zip.jar
--------------------------------------------------------------------------------
/app/libs/jet-brain.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/developer-krushna/MT-Document-Provider-Injector/c7350b0d91bd297a479b8a2ff400eaae521c35fa/app/libs/jet-brain.jar
--------------------------------------------------------------------------------
/app/libs/pxb.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/developer-krushna/MT-Document-Provider-Injector/c7350b0d91bd297a479b8a2ff400eaae521c35fa/app/libs/pxb.jar
--------------------------------------------------------------------------------
/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 C:\tools\adt-bundle-windows-x86_64-20131030\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 |
6 |
12 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/app/src/main/assets/provider:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/developer-krushna/MT-Document-Provider-Injector/c7350b0d91bd297a479b8a2ff400eaae521c35fa/app/src/main/assets/provider
--------------------------------------------------------------------------------
/app/src/main/java/mt/document/provider/injector/MainActivity.java:
--------------------------------------------------------------------------------
1 |
2 | /*
3 | * MT-Document-Provider-Injector
4 | * Copyright 2024, developer-krushna
5 | *
6 | * Redistribution and use in source and binary forms, with or without
7 | * modification, are permitted provided that the following conditions are
8 | * met:
9 | *
10 | * * Redistributions of source code must retain the above copyright
11 | * notice, this list of conditions and the following disclaimer.
12 | * * Redistributions in binary form must reproduce the above
13 | * copyright notice, this list of conditions and the following disclaimer
14 | * in the documentation and/or other materials provided with the
15 | * distribution.
16 | * * Neither the name of developer-krushna nor the names of its
17 | * contributors may be used to endorse or promote products derived from
18 | * this software without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 |
33 | * Please contact Krushna by email mt.modder.hub@gmail.com if you need
34 | * additional information or have any questions
35 | */
36 |
37 | package mt.document.provider.injector;
38 |
39 |
40 | import android.*;
41 | import android.app.*;
42 | import android.content.*;
43 | import android.content.pm.*;
44 | import android.graphics.*;
45 | import android.os.*;
46 | import android.view.*;
47 | import android.widget.*;
48 | import java.io.*;
49 | import mt.document.provider.injector.util.*;
50 | import mt.document.provider.injector.view.*;
51 | import android.annotation.*;
52 | import android.content.res.*;
53 | import android.graphics.drawable.*;
54 |
55 | /*
56 | Author @developer-krushna
57 | */
58 |
59 | public class MainActivity extends Activity {
60 | private EditText edit_path; // Input field for the file path
61 | private ImageView paste; // Button to paste content from the clipboard
62 | private Button Process; // Button to start processing the APK
63 | private LinearLayout main_linear; // Main layout for UI components
64 |
65 | @Override
66 | protected void onCreate(Bundle _savedInstanceState) {
67 | super.onCreate(_savedInstanceState);
68 | setContentView(R.layout.main); // Set the layout file for the activity
69 | initialize(_savedInstanceState); // Initialize the UI components
70 |
71 | // Check and request storage permissions
72 | if (Build.VERSION.SDK_INT >= 23) {
73 | if (checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_DENIED
74 | || checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_DENIED) {
75 | requestPermissions(new String[] {
76 | Manifest.permission.READ_EXTERNAL_STORAGE,
77 | Manifest.permission.WRITE_EXTERNAL_STORAGE
78 | }, 1000);
79 | } else {
80 | initializeLogic(); // Initialize additional logic if permissions are already granted
81 | }
82 | } else {
83 | initializeLogic(); // Initialize additional logic for older API versions
84 | }
85 | }
86 |
87 | @Override
88 | public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
89 | super.onRequestPermissionsResult(requestCode, permissions, grantResults);
90 | if (requestCode == 1000) {
91 | initializeLogic(); // Proceed with initialization after permissions are granted
92 | }
93 | }
94 |
95 | private void initialize(Bundle _savedInstanceState) {
96 | // Find and link UI components by their IDs
97 | edit_path = findViewById(R.id.edit_path);
98 | paste = findViewById(R.id.paste);
99 | Process = findViewById(R.id.Process);
100 | main_linear = findViewById(R.id.main_linear);
101 |
102 | // Set the click listener for the paste button
103 | paste.setOnClickListener(new View.OnClickListener() {
104 | @Override
105 | public void onClick(View _view) {
106 | edit_path.setText(getClipboard(MainActivity.this)); // Get text from clipboard and set it in edit_path
107 | }
108 | });
109 |
110 | // Set the click listener for the Process button
111 | Process.setOnClickListener(new View.OnClickListener() {
112 | @Override
113 | public void onClick(View _view) {
114 | start(MainActivity.this); // Start processing the APK
115 | }
116 | });
117 | }
118 |
119 | private void initializeLogic() {
120 | // Set ripple effect on the paste button
121 | ripple(paste, "#b2dfdb");
122 | // Apply rounded corners and a border to the main layout
123 | _RoundAndBorder(main_linear, "#FFFFFF", 3, "#F4386D", 8);
124 | }
125 |
126 | public void _RoundAndBorder(final View _view, final String _color1, final double _border, final String _color2, final double _round) {
127 | // Create a GradientDrawable to set background with rounded corners and a border
128 | android.graphics.drawable.GradientDrawable gd = new android.graphics.drawable.GradientDrawable();
129 | gd.setColor(Color.parseColor(_color1));
130 | gd.setCornerRadius((int) _round);
131 | gd.setStroke((int) _border, Color.parseColor(_color2));
132 | _view.setBackground(gd);
133 | }
134 |
135 | public void ripple(View _view, String _c) {
136 | // Apply ripple effect on a view
137 | ColorStateList clr = new ColorStateList(
138 | new int[][]{new int[]{}},
139 | new int[]{Color.parseColor(_c)}
140 | );
141 | RippleDrawable ripdr = new RippleDrawable(clr, null, null);
142 | _view.setBackground(ripdr);
143 | }
144 |
145 | public static String getClipboard(Context context) {
146 | try {
147 | // Retrieve text from the clipboard
148 | ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
149 | ClipData primaryClip = clipboard.getPrimaryClip();
150 | if (primaryClip != null && primaryClip.getItemCount() > 0) {
151 | return primaryClip.getItemAt(0).coerceToText(context).toString();
152 | }
153 | } catch (Exception e) {
154 | e.printStackTrace(); // Handle clipboard exceptions
155 | }
156 | return "";
157 | }
158 |
159 | public void start(final Activity activity) {
160 | // Create and show a progress dialog
161 | final AlertProgress progressDialog = new AlertProgress(activity);
162 | progressDialog.setTitle("Processing...");
163 | progressDialog.setMessage("AndroidManifest.xml");
164 | progressDialog.setIndeterminate(false);
165 | progressDialog.show();
166 |
167 | // Handler to update UI after background task completes
168 | final Handler mHandler = new Handler() {
169 | public void handleMessage(Message msg) {
170 | activity.runOnUiThread(new Runnable() {
171 | @Override
172 | public void run() {
173 | activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); // Reset screen-on flag
174 | progressDialog.dismiss(); // Dismiss the progress dialog
175 | }
176 | });
177 | }
178 | };
179 |
180 | activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); // Prevent screen from sleeping
181 | new Thread() {
182 | public void run() {
183 | Looper.prepare();
184 | String srcApk = edit_path.getText().toString(); // Get the APK path from the input field
185 | try {
186 | // Process the APK file using DocumentInjector
187 | DocumentInjector injector = new DocumentInjector(new DocumentInjector.DocumentInjectorCallBack() {
188 | @Override
189 | public void onMessage(final String msg) {
190 | activity.runOnUiThread(new Runnable() {
191 | @Override
192 | public void run() {
193 | progressDialog.setMessage(msg); // Update progress message
194 | }
195 | });
196 | }
197 |
198 | @Override
199 | public void onProgress(final int progress, final int total) {
200 | activity.runOnUiThread(new Runnable() {
201 | @Override
202 | public void run() {
203 | progressDialog.setProgress(progress, total); // Update progress percentage
204 | }
205 | });
206 | }
207 | });
208 | injector.setPath(srcApk); // Set the APK file path
209 | injector.ProcessApk(); // Start APK processing
210 | Toast.makeText(activity, "Success, Sign it yourself", Toast.LENGTH_SHORT).show(); // Show success message
211 | } catch (Exception e) {
212 | showError(activity, e); // Handle errors
213 | }
214 | mHandler.sendEmptyMessage(0); // Notify the handler to dismiss the progress dialog
215 | Looper.loop();
216 | }
217 | }.start();
218 | }
219 |
220 |
221 | public void showError(Context context, Exception e){
222 | try {
223 | final AlertDialog.Builder dlg = new AlertDialog.Builder(context);
224 | dlg.setTitle("Error");
225 | StringWriter sw = new StringWriter();
226 | PrintWriter pw = new PrintWriter(sw);
227 | e.printStackTrace(pw);
228 | String exceptionDetails = sw.toString();
229 | dlg.setMessage(exceptionDetails);
230 | dlg.setPositiveButton("Cancel", null);
231 |
232 | // Setting custom background
233 | int cornerRadius = 20;
234 | android.graphics.drawable.GradientDrawable gd = new android.graphics.drawable.GradientDrawable();
235 | gd.setColor(Color.parseColor("#FFFFFF"));
236 | gd.setCornerRadius(cornerRadius);
237 |
238 | final AlertDialog alert = dlg.create();
239 |
240 | // Set dialog width based on screen width percentage
241 | WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams();
242 | layoutParams.copyFrom(alert.getWindow().getAttributes());
243 | layoutParams.width = (int) (context.getResources().getDisplayMetrics().widthPixels * 0.8); // 80% of screen width
244 |
245 | alert.getWindow().setBackgroundDrawable(gd);
246 |
247 | alert.show();
248 |
249 | final TextView message = alert.findViewById(android.R.id.message);
250 | message.setTextIsSelectable(true);
251 | } catch (WindowManager.BadTokenException e2) {
252 | e2.printStackTrace();
253 | }
254 | }
255 | }
256 |
257 |
--------------------------------------------------------------------------------
/app/src/main/java/mt/document/provider/injector/util/DocumentInjector.java:
--------------------------------------------------------------------------------
1 |
2 | /*
3 | * MT-Document-Provider-Injector
4 | * Copyright 2024, developer-krushna
5 | *
6 | * Redistribution and use in source and binary forms, with or without
7 | * modification, are permitted provided that the following conditions are
8 | * met:
9 | *
10 | * * Redistributions of source code must retain the above copyright
11 | * notice, this list of conditions and the following disclaimer.
12 | * * Redistributions in binary form must reproduce the above
13 | * copyright notice, this list of conditions and the following disclaimer
14 | * in the documentation and/or other materials provided with the
15 | * distribution.
16 | * * Neither the name of developer-krushna nor the names of its
17 | * contributors may be used to endorse or promote products derived from
18 | * this software without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 |
33 | * Please contact Krushna by email mt.modder.hub@gmail.com if you need
34 | * additional information or have any questions
35 | */
36 |
37 | package mt.document.provider.injector.util;
38 |
39 | import android.content.*;
40 | import bin.zip.*;
41 | import java.io.*;
42 | import java.util.*;
43 |
44 | import pxb.android.axml.*;
45 |
46 | import bin.zip.ZipEntry;
47 | import bin.zip.ZipFile;
48 | import bin.zip.ZipOutputStream;
49 | import org.jetbrains.annotations.*;
50 | import android.widget.*;
51 |
52 | /*
53 | Author @developer-krushna
54 | Comments by ChatGPT
55 | */
56 |
57 | public class DocumentInjector {
58 | // Paths for APK files and temporary directory
59 | private String outApk; // Path for the output APK
60 | private String srcApk; // Path for the source APK
61 | private String tempApk; // Path for the temporary directory
62 | private DocumentInjectorCallBack mCallBack; // Callback interface for progress and messages
63 | private String AndroidManifest = "AndroidManifest.xml"; // Name of the AndroidManifest file
64 |
65 | // Constructor to initialize the callback
66 | public DocumentInjector(DocumentInjectorCallBack callback) {
67 | mCallBack = callback;
68 | }
69 |
70 | // Method to set paths for source APK, output APK, and temporary directory
71 | public void setPath(String input) {
72 | srcApk = input;
73 | outApk = input.replace(".apk", "_dp.apk"); // Output APK with "_dp" suffix
74 | tempApk = new File(srcApk).getParentFile().toString() + "/.temp"; // Temporary directory path
75 | }
76 |
77 | // Main method to process the APK
78 | public void ProcessApk() throws Exception {
79 | // Delete existing output APK file
80 | new File(outApk).delete();
81 |
82 | try (ZipFile zipFile = new ZipFile(srcApk)) { // Open source APK as a zip file
83 | // Retrieve AndroidManifest entry from the APK
84 | ZipEntry manifestEntry = zipFile.getEntry(AndroidManifest);
85 |
86 | // Modify the AndroidManifest binary XML data
87 | byte[] manifestData = getModifiedBinXmlData(zipFile.getInputStream(manifestEntry));
88 |
89 | // Prepare the temporary zip output stream
90 | ZipOutputStream zipOutputStream = new ZipOutputStream(new File(tempApk));
91 | zipOutputStream.setLevel(1); // Set compression level
92 | zipOutputStream.setMethod(ZipOutputStream.STORED); // Set storage method
93 |
94 | // Lists to track dex files and all files in the zip
95 | Enumeration entries = zipFile.getEntries();
96 | ArrayList dexList = new ArrayList<>();
97 | ArrayList totalFilesInZip = new ArrayList<>();
98 |
99 | // Copy specific entries to the temporary zip
100 | while (entries.hasMoreElements()) {
101 | ZipEntry nextElement = entries.nextElement();
102 | String name = nextElement.getName();
103 | totalFilesInZip.add(name);
104 |
105 | // Copy dex files and ignore other files
106 | if ((name.startsWith("classes") && name.endsWith("dex")) || name.startsWith("./")) {
107 | zipOutputStream.copyZipEntry(nextElement, zipFile);
108 | dexList.add(name);
109 | }
110 | }
111 | zipOutputStream.close();
112 |
113 | // Create the final output APK
114 | try (ZipOutputStream zos = new ZipOutputStream(new File(outApk))) {
115 | zos.setMethod(ZipOutputStream.DEFLATED);
116 |
117 | // Add the modified AndroidManifest to the output APK
118 | zos.putNextEntry(AndroidManifest);
119 | zos.write(manifestData);
120 | zos.closeEntry();
121 |
122 | // Process and add new dex file to the output APK
123 | byte[] dexData = processDex();
124 | zos.putNextEntry(new ZipEntry("classes" + (dexList.size() + 1) + ".dex"));
125 |
126 | // Write dex data with progress tracking
127 | ByteArrayInputStream bis = new ByteArrayInputStream(dexData);
128 | byte[] buffer = new byte[2048];
129 | int length;
130 | int totalBytes = dexData.length;
131 | int copiedBytes = 0;
132 | while ((length = bis.read(buffer)) > 0) {
133 | zos.write(buffer, 0, length);
134 | copiedBytes += length;
135 | mCallBack.onProgress(copiedBytes, totalBytes); // Update progress
136 | }
137 | zos.closeEntry();
138 |
139 | // Copy other files from the temporary zip to the final output APK
140 | Enumeration entry = zipFile.getEntries();
141 | int copiedFiles = 0;
142 | while (entry.hasMoreElements()) {
143 | ZipEntry newEntry = entry.nextElement();
144 | // Avoid duplicating the AndroidManifest and new dex file
145 | if (!newEntry.getName().equals(AndroidManifest) &&
146 | !newEntry.getName().equals(new ZipEntry("classes" + (dexList.size() + 1) + ".dex"))) {
147 | zos.copyZipEntry(newEntry, zipFile);
148 | copiedFiles++;
149 | mCallBack.onProgress(copiedFiles, totalFilesInZip.size()); // Update progress
150 | }
151 | }
152 |
153 | // Clean up the temporary directory
154 | new File(tempApk).delete();
155 | zipFile.close();
156 | }
157 | }
158 | }
159 |
160 | // Method to process and return new dex file data
161 | private byte[] processDex() throws Exception {
162 | byte[] dexBytes = readAllBytes(DocumentInjector.class.getResourceAsStream("/assets/provider"));
163 | return dexBytes;
164 | }
165 |
166 | // Utility method to read all bytes from an InputStream
167 | public static byte[] readAllBytes(InputStream is) throws IOException {
168 | ByteArrayOutputStream bos = new ByteArrayOutputStream();
169 | byte[] buffer = new byte[2048];
170 | int len;
171 | while ((len = is.read(buffer)) > 0)
172 | bos.write(buffer, 0, len);
173 | is.close();
174 | return bos.toByteArray();
175 | }
176 |
177 | // Method to modify AndroidManifest binary XML data
178 | public static byte[] getModifiedBinXmlData(InputStream input) throws IOException {
179 | Axml axml = new Axml();
180 | byte[] bytes = readAllBytes(input);
181 | new AxmlReader(bytes).accept(ManifestEditor.getNodeVisitor(axml));
182 | ManifestEditor.addDocumentProvider(axml); // Add custom document provider
183 | AxmlWriter aw = new AxmlWriter();
184 | axml.accept(aw);
185 | return aw.toByteArray();
186 | }
187 |
188 | // Callback interface for progress and messages
189 | public interface DocumentInjectorCallBack {
190 | void onProgress(int progress, int total); // Progress update method
191 | void onMessage(String name); // Message notification method
192 | }
193 | }
194 |
195 |
--------------------------------------------------------------------------------
/app/src/main/java/mt/document/provider/injector/util/ManifestEditor.java:
--------------------------------------------------------------------------------
1 |
2 | /*
3 | * MT-Document-Provider-Injector
4 | * Copyright 2024, developer-krushna
5 | *
6 | * Redistribution and use in source and binary forms, with or without
7 | * modification, are permitted provided that the following conditions are
8 | * met:
9 | *
10 | * * Redistributions of source code must retain the above copyright
11 | * notice, this list of conditions and the following disclaimer.
12 | * * Redistributions in binary form must reproduce the above
13 | * copyright notice, this list of conditions and the following disclaimer
14 | * in the documentation and/or other materials provided with the
15 | * distribution.
16 | * * Neither the name of developer-krushna nor the names of its
17 | * contributors may be used to endorse or promote products derived from
18 | * this software without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 |
33 | * Please contact Krushna by email mt.modder.hub@gmail.com if you need
34 | * additional information or have any questions
35 | */
36 | package mt.document.provider.injector.util;
37 |
38 | import java.util.*;
39 | import org.jetbrains.annotations.*;
40 | import pxb.android.axml.*;
41 | import pxb.android.axml.Axml.*;
42 | import pxb.android.axml.Axml.Node.*;
43 |
44 | /*
45 | Author @developer-krushna
46 | */
47 |
48 | public class ManifestEditor {
49 |
50 | private static final String NS_ANDROID = "http://schemas.android.com/apk/res/android";
51 |
52 | @Contract("null, _, _ -> null")
53 | private static Node findNodeByName(Axml axml, String name, String... attributes) {
54 | return axml != null ? findNodeByName(axml.firsts, name, attributes) : null;
55 | }
56 |
57 | @Contract("null, _, _ -> null")
58 | private static Node findNodeByName(Node node, String name, String... attributes) {
59 | return node != null ? findNodeByName(node.children, name, attributes) : null;
60 | }
61 |
62 | @Contract("null, _, _ -> null")
63 | private static Node findNodeByName(List nodes, String name, String... attributes) {
64 | if (!(nodes == null || nodes.isEmpty())) {
65 | int pos = name.indexOf(".");
66 | if (pos != -1) {
67 | String parentName = name.substring(0, pos);
68 | String childName = name.substring(pos + 1);
69 | for (Node node : nodes) {
70 | if (parentName.equals(node.name)) {
71 | Node childNode = findNodeByName(node, childName, attributes);
72 | if (childNode != null) {
73 | return childNode;
74 | }
75 | }
76 | }
77 | return null;
78 | }
79 | for (Node node2 : nodes) {
80 | if (name.equals(node2.name)) {
81 | if (attributes.length > 0) {
82 | boolean b = false;
83 | int n = 0;
84 | while (n < attributes.length) {
85 | for (Attr attr : node2.attrs) {
86 | if (attributes[n].equals(attr.name) && attributes[n + 1].equals(attr.value)) {
87 | b = true;
88 | break;
89 | }
90 | }
91 | n += 2;
92 | }
93 | }
94 | return node2;
95 | }
96 | }
97 | }
98 | return null;
99 | }
100 |
101 | @Nullable
102 | public static String getAttributeValue(@NotNull Node node, String name) {
103 | for (Attr attr : node.attrs) {
104 | if (attr.name.equals(name)) {
105 | if (attr.value != null) {
106 | return attr.value.toString();
107 | }
108 | return null;
109 | }
110 | }
111 | return null;
112 | }
113 |
114 | public static void addDocumentProvider(Axml axml) {
115 | Node applicationNode = findNodeByName(axml, "manifest.application", new String[0]);
116 | if (applicationNode != null) {
117 | /* Insert Activity Node */
118 | Node activityNode = new Node();
119 | activityNode.name = "activity";
120 | activityNode.attr(NS_ANDROID, "name", android.R.attr.name, 3, "bin.mt.file.content.MTDataFilesWakeUpActivity");
121 | activityNode.attr(NS_ANDROID, "exported", android.R.attr.exported, 3, "true");
122 | activityNode.attr(NS_ANDROID, "taskAffinity", android.R.attr.taskAffinity, 3, getPackageName(axml) + ".MTDataFilesWakeUp");
123 | activityNode.attr(NS_ANDROID, "excludeFromRecents", android.R.attr.excludeFromRecents, 3, "true");
124 | activityNode.attr(NS_ANDROID, "noHistory", android.R.attr.noHistory, 3, "true");
125 | applicationNode.children.add(activityNode);
126 |
127 | /* Insert Provider Node */
128 | Node providerNode = new Node();
129 | providerNode.name = "provider";
130 | providerNode.attr(NS_ANDROID, "name", android.R.attr.name, 3, "bin.mt.file.content.MTDataFilesProvider");
131 | providerNode.attr(NS_ANDROID, "permission", android.R.attr.permission, 3, "android.permission.MANAGE_DOCUMENTS");
132 | providerNode.attr(NS_ANDROID, "exported", android.R.attr.exported, 3, "true");
133 | providerNode.attr(NS_ANDROID, "authorities", android.R.attr.authorities, 3, getPackageName(axml) + ".MTDataFilesProvider");
134 | providerNode.attr(NS_ANDROID, "grantUriPermissions", android.R.attr.grantUriPermissions, 3, "true");
135 |
136 | /* Insert intentFilter node inside Provider node */
137 | Node intentFilterNode = new Node();
138 | intentFilterNode.name = "intent-filter";
139 | Node actionNode = new Node();
140 | actionNode.name = "action";
141 | actionNode.attr(NS_ANDROID, "name", android.R.attr.name, 3, "android.content.action.DOCUMENTS_PROVIDER");
142 | intentFilterNode.children.add(actionNode);
143 | providerNode.children.add(intentFilterNode);
144 |
145 | applicationNode.children.add(providerNode);
146 | }
147 | }
148 |
149 | /* Get Package name */
150 | public static String getPackageName(Axml axml) {
151 | Node manifestNode = findNodeByName(axml, "manifest", new String[0]);
152 | if (manifestNode != null) {
153 | return getAttributeValue(manifestNode, "package");
154 | }
155 | return null;
156 | }
157 |
158 |
159 |
160 | @NotNull
161 | @Contract("_ -> new")
162 | public static AxmlVisitor getNodeVisitor(NodeVisitor original) {
163 | return new AxmlVisitor(original) {
164 | public NodeVisitor child(String ns, String name) {
165 | return new NodeVisitor(super.child(ns, name)) {
166 | public NodeVisitor child(String ns, String name) {
167 | return name.equals("application") ? new NodeVisitor(super.child(ns, name)) {
168 | public NodeVisitor child(String ns, String name) {
169 | return name.equals("provider") ? new NodeVisitor(super.child(ns, name)) {
170 | public void attr(String ns, String name, int resourceId, int type, Object obj) {
171 | super.attr(ns, name, resourceId, type, obj);
172 | }
173 | } : super.child(ns, name);
174 | }
175 | } : super.child(ns, name);
176 | }
177 | };
178 | }
179 | };
180 | }
181 | }
182 |
--------------------------------------------------------------------------------
/app/src/main/java/mt/document/provider/injector/view/AlertProgress.java:
--------------------------------------------------------------------------------
1 |
2 | /*
3 | * MT-Document-Provider-Injector
4 | * Copyright 2024, developer-krushna
5 | *
6 | * Redistribution and use in source and binary forms, with or without
7 | * modification, are permitted provided that the following conditions are
8 | * met:
9 | *
10 | * * Redistributions of source code must retain the above copyright
11 | * notice, this list of conditions and the following disclaimer.
12 | * * Redistributions in binary form must reproduce the above
13 | * copyright notice, this list of conditions and the following disclaimer
14 | * in the documentation and/or other materials provided with the
15 | * distribution.
16 | * * Neither the name of developer-krushna nor the names of its
17 | * contributors may be used to endorse or promote products derived from
18 | * this software without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 |
33 | * Please contact Krushna by email mt.modder.hub@gmail.com if you need
34 | * additional information or have any questions
35 | */
36 |
37 | package mt.document.provider.injector.view;
38 |
39 |
40 | import android.content.Context;
41 | import android.view.*;
42 | import android.app.Activity;
43 | import android.widget.*;
44 | import android.graphics.Color;
45 | import android.app.AlertDialog.Builder;
46 | import android.graphics.drawable.GradientDrawable;
47 | import android.app.*;
48 | import mt.document.provider.injector.*;
49 |
50 | /*
51 | Author @developer-krushna
52 | */
53 |
54 | public class AlertProgress {
55 |
56 | Context context;
57 | Activity activity;
58 | AlertDialog.Builder process;
59 | AlertDialog alert;
60 | TextView textview_mesage;
61 | TextView textview_title;
62 | ProgressBar progress;
63 |
64 | public AlertProgress(Context mContext){
65 | this.context = mContext;
66 | this.activity = (Activity)context;
67 |
68 | process = new Builder(activity);
69 | // Inflate and set the layout for the dialog
70 | // Pass null as the parent view because its going in the dialog layout
71 | View view = View.inflate(context, R.layout.progress, null);
72 | textview_mesage = view.findViewById(R.id.message);
73 | progress = view.findViewById(R.id.progress);
74 | textview_title = view.findViewById(R.id.title);
75 |
76 | process.setCancelable(false);
77 | process.setView(view);
78 |
79 | alert = process.create();
80 |
81 | int cornerRadius = 20;
82 | GradientDrawable aa = new GradientDrawable();
83 | aa.setColor(Color.parseColor("#FFFFFF"));
84 | aa.setCornerRadius(cornerRadius);
85 | alert.setCancelable(false);
86 | alert.getWindow().setBackgroundDrawable(aa);
87 |
88 | }
89 |
90 |
91 |
92 |
93 |
94 |
95 | public void setTitle(final String title) {
96 |
97 | activity.runOnUiThread(new Runnable(){
98 | @Override
99 | public void run() {
100 | textview_title.setText(title);
101 | }
102 | });
103 | }
104 | public void setMessage(final String message){
105 |
106 | activity.runOnUiThread(new Runnable(){
107 | @Override
108 | public void run() {
109 |
110 | textview_mesage.setText(message);
111 |
112 | }
113 | });
114 | }
115 |
116 | public void setProgress(final int value, final int max) {
117 |
118 | activity.runOnUiThread(new Runnable(){
119 | @Override
120 | public void run() {
121 |
122 | progress.setVisibility(View.VISIBLE);
123 | progress.setProgress(value);
124 | progress.setMax(max);
125 | }
126 | });
127 | }
128 | public void setIndeterminate(final boolean bool){
129 |
130 | activity.runOnUiThread(new Runnable(){
131 | @Override
132 | public void run() {
133 | if(bool){
134 | progress.setIndeterminate(true);
135 | }else{
136 | progress.setIndeterminate(false);
137 | }
138 |
139 |
140 | }
141 | });
142 |
143 | }
144 |
145 |
146 | public void show() {
147 |
148 | activity.runOnUiThread(new Runnable(){
149 | @Override
150 | public void run() {
151 |
152 | alert.show();
153 | }
154 | });
155 | }
156 |
157 |
158 | public void dismiss(){
159 |
160 | activity.runOnUiThread(new Runnable(){
161 | @Override
162 | public void run() {
163 |
164 | alert.dismiss();
165 | }
166 | });
167 | }
168 |
169 |
170 |
171 |
172 | }
173 |
174 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/background.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
12 |
15 |
16 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/developer-krushna/MT-Document-Provider-Injector/c7350b0d91bd297a479b8a2ff400eaae521c35fa/app/src/main/res/drawable/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_paste_board.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/developer-krushna/MT-Document-Provider-Injector/c7350b0d91bd297a479b8a2ff400eaae521c35fa/app/src/main/res/drawable/ic_paste_board.png
--------------------------------------------------------------------------------
/app/src/main/res/layout/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
17 |
18 |
27 |
28 |
37 |
38 |
48 |
49 |
56 |
57 |
58 |
59 |
68 |
69 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/progress.xml:
--------------------------------------------------------------------------------
1 |
8 |
26 |
43 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | MT Document Provider Injector
5 | Hello world!
6 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 | buildscript {
3 | repositories {
4 | google()
5 | mavenCentral()
6 | jcenter()
7 | }
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:8.7.0'
10 | classpath 'com.google.gms:google-services:4.4.2'
11 | // NOTE: Do not place your application dependencies here; they belong
12 | // in the individual module build.gradle files
13 | }
14 | }
15 |
16 | allprojects {
17 | repositories {
18 | google()
19 | mavenCentral()
20 | jcenter()
21 | }
22 | }
23 |
24 | tasks.register("clean", Delete) {
25 | delete rootProject.buildDir
26 | }
27 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | android.enableR8.fullMode=false
2 | android.enableJetifier=true
3 | android.useAndroidX=true
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------