├── .gitignore
├── LICENSE
├── README.md
├── app
├── RootTools2.6.jar
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── dharmapoudel
│ │ └── samfix
│ │ ├── AnimatorDurationActivity.java
│ │ ├── AnimatorDurationUtil.java
│ │ ├── BootIntentReceiver.java
│ │ ├── MainActivity.java
│ │ ├── PermissionUtil.java
│ │ ├── Preferences.java
│ │ ├── SamFixAccessibilityService.java
│ │ ├── SettingsUpdateJobService.java
│ │ ├── Util.java
│ │ ├── autobackup
│ │ ├── BackupReceiver.java
│ │ └── BackupTask.java
│ │ └── tiles
│ │ ├── AnimatorDurationTileService.java
│ │ ├── DataToggleTileService.java
│ │ └── GreyscaleTileService.java
│ └── res
│ ├── drawable
│ ├── background_drawable.xml
│ ├── donate.png
│ ├── gradient.xml
│ ├── ic_animator_duration.xml
│ ├── ic_animator_duration_10x.xml
│ ├── ic_animator_duration_1_4x.xml
│ ├── ic_animator_duration_1_5x.xml
│ ├── ic_animator_duration_1x.xml
│ ├── ic_animator_duration_2x.xml
│ ├── ic_animator_duration_5x.xml
│ ├── ic_animator_duration_half_x.xml
│ ├── ic_animator_duration_off.xml
│ ├── star.xml
│ ├── support.xml
│ ├── telegram.xml
│ ├── tile_data.xml
│ ├── tile_greyscale.xml
│ ├── toggle_off.xml
│ └── toggle_on.xml
│ ├── layout
│ ├── activity_main.xml
│ └── select_scale_dialog.xml
│ ├── mipmap-xxhdpi
│ └── ic_icon2.png
│ ├── values
│ ├── colors.xml
│ ├── dimens.xml
│ ├── strings.xml
│ └── styles.xml
│ └── xml
│ └── accessibility_service_config.xml
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── screenshots
├── Screenshot_20200213-223500_SamFix.png
├── Screenshot_20200213-223641_SamFix.png
├── Screenshot_20200213-223649_SamFix.png
└── screenshot.jpg
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | local.properties
4 | .idea/
5 | .DS_Store
6 | build/
7 |
--------------------------------------------------------------------------------
/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 | #
SamFix
2 |
3 | Fix all annoyances on Samsung devices.
4 |
5 |
6 | ## Download :
7 |
8 | [
](https://labs.xda-developers.com/store/app/com.dharmapoudel.samfix)
11 |
12 | ## Target platforms :
13 |
14 | API 21 or later
15 |
16 | ## Features :
17 |
18 | - Disable max volume warning - needs device restart
19 | - Disable max brightness warning
20 | - Choose animation scale from the list - make your device snappier
21 | - Greyscale - turn on black and white mode, it's fun and saves power on AMOLEDs
22 | - Disable Bluetooth popup - needs accessibility permission
23 | - Disable Wifi popup - needs accessibility permission
24 | - Disable popup on auto sync - needs accessibility permission
25 | - Quick setting tiles for easy animation/greyscale/data toggling
26 | - ... more to come in the near future
27 |
28 | ## Screenshots :
29 |
30 |
31 |
--------------------------------------------------------------------------------
/app/RootTools2.6.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dharmapoudel/samfix/beb14d0a0abd25bc4ea6805fbded68f7dd00b99c/app/RootTools2.6.jar
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 28
5 | buildToolsVersion '28.0.3'
6 |
7 | lintOptions {
8 | checkReleaseBuilds false
9 | abortOnError false
10 | }
11 |
12 | packagingOptions {
13 | exclude 'META-INF/rxjava.properties'
14 | exclude 'META-INF/SearchFilter.properties'
15 | exclude 'META-INF/NOTICE'
16 | exclude 'META-INF/LICENSE'
17 | exclude 'META-INF/notice'
18 | exclude 'META-INF/notice.txt'
19 | exclude 'META-INF/license'
20 | exclude 'META-INF/license.txt'
21 | exclude 'META-INF/README.md'
22 | exclude 'META-INF/DEPENDENCIES.txt'
23 | exclude 'META-INF/DEPENDENCIES'
24 | exclude 'META-INF/dependencies.txt'
25 | exclude 'META-INF/LGPL2.1'
26 | }
27 |
28 | def formattedDate = new Date().format('MMddyyyy')
29 |
30 | defaultConfig {
31 | applicationId "com.dharmapoudel.samfix"
32 | minSdkVersion 21
33 | targetSdkVersion 28
34 | versionCode 22
35 | versionName "1.22"
36 | setProperty("archivesBaseName", "samfix-v" + versionCode + "(" + versionName + ")" + "_" + formattedDate)
37 | }
38 |
39 | signingConfigs {
40 | release {
41 | storeFile file(STORE_FILE_PATH)
42 | storePassword STORE_PASSWORD
43 | keyAlias KEY_ALIAS
44 | keyPassword KEY_PASSWORD
45 |
46 | }
47 | }
48 | buildTypes {
49 | debug {
50 | debuggable true
51 | minifyEnabled false
52 | shrinkResources false
53 | zipAlignEnabled true
54 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
55 | versionNameSuffix '-debug'
56 | }
57 | release {
58 | debuggable false
59 | minifyEnabled true
60 | shrinkResources true
61 | zipAlignEnabled true
62 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
63 | versionNameSuffix '-release'
64 | }
65 | }
66 |
67 | dependencies {
68 | implementation files('RootTools2.6.jar')
69 | implementation 'com.android.support:appcompat-v7:28.0.0'
70 | implementation 'com.android.support:cardview-v7:28.0.0'
71 | implementation 'com.anjlab.android.iab.v3:library:1.1.0'
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/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 /Users/fei/android-sdk-macosx/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 |
19 | -keepattributes *Annotation*
20 | -keep @**annotation** class * {*;}
21 |
22 | -dontusemixedcaseclassnames
23 | -dontskipnonpubliclibraryclasses
24 | -verbose
25 |
26 | -dontwarn okhttp3.internal.platform.*
27 | -dontwarn okio.*
28 | -dontwarn retrofit2.*
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
31 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
48 |
49 |
50 |
51 |
56 |
57 |
58 |
59 |
60 |
61 |
68 |
69 |
70 |
71 |
72 |
73 |
78 |
79 |
80 |
81 |
82 |
83 |
86 |
87 |
91 |
92 |
93 |
94 |
96 |
97 |
98 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dharmapoudel/samfix/AnimatorDurationActivity.java:
--------------------------------------------------------------------------------
1 |
2 | package com.dharmapoudel.samfix;
3 |
4 | import android.app.Activity;
5 | import android.os.Bundle;
6 | import android.support.annotation.NonNull;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.Checkable;
10 | import android.widget.CheckedTextView;
11 |
12 |
13 | public class AnimatorDurationActivity extends Activity {
14 |
15 | @Override
16 | protected void onCreate(Bundle savedInstanceState) {
17 | super.onCreate(savedInstanceState);
18 | setContentView(R.layout.select_scale_dialog);
19 | float scale = AnimatorDurationUtil.getAnimatorScale(this);
20 | ((Checkable) findViewById(AnimatorDurationUtil.getScaleItemId(scale))).setChecked(true);
21 | }
22 |
23 | public void scaleClick(View v) {
24 | uncheckAllChildren((ViewGroup) v.getParent());
25 | ((CheckedTextView) v).setChecked(true);
26 | AnimatorDurationUtil.setAnimatorScale(this, AnimatorDurationUtil.getScale(v.getId()));
27 | finishAfterTransition();
28 | }
29 |
30 | public void cancel(View v) {
31 | finishAfterTransition();
32 | }
33 |
34 | private void uncheckAllChildren(@NonNull ViewGroup vg) {
35 | for (int i = vg.getChildCount() - 1; i >= 0; i--) {
36 | View child = vg.getChildAt(i);
37 | if (child instanceof Checkable) {
38 | ((Checkable) child).setChecked(false);
39 | }
40 | }
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dharmapoudel/samfix/AnimatorDurationUtil.java:
--------------------------------------------------------------------------------
1 | package com.dharmapoudel.samfix;
2 |
3 | import android.content.Context;
4 | import android.provider.Settings;
5 | import android.support.annotation.FloatRange;
6 | import android.support.annotation.IdRes;
7 | import android.support.annotation.NonNull;
8 | import android.util.Log;
9 | import android.widget.Toast;
10 |
11 | public class AnimatorDurationUtil {
12 |
13 | private static final String TAG = "AnimatorDurationUtil";
14 |
15 |
16 | public static float[] scales = {0f, 0.25f, 0.5f, 1f, 1.5f, 2f, 5f, 10f};
17 | public static int[] scaleIcons = {
18 | R.drawable.ic_animator_duration_off,
19 | R.drawable.ic_animator_duration_1_4x,
20 | R.drawable.ic_animator_duration_half_x,
21 | R.drawable.ic_animator_duration_1x,
22 | R.drawable.ic_animator_duration_1_5x,
23 | R.drawable.ic_animator_duration_2x,
24 | R.drawable.ic_animator_duration_5x,
25 | R.drawable.ic_animator_duration_10x
26 | };
27 |
28 |
29 | public static int getIndex(float scale) {
30 | int index = 0;
31 | if (scale <= 0f) {
32 | index = 0;
33 | } else if (scale <= 0.25f) {
34 | index = 1;
35 | } else if (scale <= 0.5f) {
36 | index = 2;
37 | } else if (scale <= 1f) {
38 | index = 3;
39 | } else if (scale <= 1.5f) {
40 | index = 4;
41 | } else if (scale <= 2f) {
42 | index = 5;
43 | } else if (scale <= 5f) {
44 | index = 6;
45 | } else if (scale <= 10f) {
46 | index = 7;
47 | }
48 | return index;
49 | }
50 |
51 | public static float getScale(@IdRes int id) {
52 | switch (id) {
53 | case R.id.scale_off: return 0f;
54 | case R.id.scale_1_4: return 0.25f;
55 | case R.id.scale_0_5: return 0.5f;
56 | case R.id.scale_1: return 1.0f;
57 | case R.id.scale_1_5: return 1.5f;
58 | case R.id.scale_2: return 2f;
59 | case R.id.scale_5: return 5f;
60 | case R.id.scale_10: return 10f;
61 | default: return 1.0f;
62 | }
63 | }
64 |
65 | public static @IdRes int getScaleItemId(@FloatRange(from = 0.0, to = 10.0) float scale) {
66 | if (scale <= 0f) {
67 | return R.id.scale_off;
68 | } else if (scale <= 0.25f) {
69 | return R.id.scale_1_4;
70 | } else if (scale <= 0.5f) {
71 | return R.id.scale_0_5;
72 | } else if (scale <= 1f) {
73 | return R.id.scale_1;
74 | } else if (scale <= 1.5f) {
75 | return R.id.scale_1_5;
76 | } else if (scale <= 2f) {
77 | return R.id.scale_2;
78 | } else if (scale <= 5f) {
79 | return R.id.scale_5;
80 | } else {
81 | return R.id.scale_10;
82 | }
83 | }
84 |
85 | public static float getAnimatorScale(Context context) {
86 | float scale = 1f;
87 | try {
88 | scale = Settings.Global.getFloat(context.getContentResolver(), Settings.Global.ANIMATOR_DURATION_SCALE);
89 | } catch (Settings.SettingNotFoundException e) {
90 | Log.e(TAG, "Could not read Animator Duration Scale setting", e);
91 | }
92 | return scale;
93 | }
94 |
95 | public static boolean setAnimatorScale(@NonNull Context context, @FloatRange(from = 0.0, to = 10.0) float scale) {
96 | try {
97 |
98 | Settings.Global.putFloat(context.getContentResolver(), Settings.Global.ANIMATOR_DURATION_SCALE, scale);
99 | Settings.Global.putFloat(context.getContentResolver(), Settings.Global.TRANSITION_ANIMATION_SCALE, scale);
100 | Settings.Global.putFloat(context.getContentResolver(), Settings.Global.WINDOW_ANIMATION_SCALE, scale);
101 | return true;
102 |
103 | } catch (SecurityException se) {
104 |
105 | String message = context.getString(R.string.tips_title);
106 | Toast.makeText(context.getApplicationContext(), message, Toast.LENGTH_LONG).show();
107 | Log.d(TAG, message);
108 | return false;
109 |
110 | }
111 | }
112 |
113 | }
114 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dharmapoudel/samfix/BootIntentReceiver.java:
--------------------------------------------------------------------------------
1 | package com.dharmapoudel.samfix;
2 |
3 | import android.app.AlarmManager;
4 | import android.app.PendingIntent;
5 | import android.app.job.JobInfo;
6 | import android.app.job.JobScheduler;
7 | import android.content.BroadcastReceiver;
8 | import android.content.ComponentName;
9 | import android.content.Context;
10 | import android.content.Intent;
11 | import android.util.Log;
12 | import android.widget.Toast;
13 |
14 | import java.util.concurrent.TimeUnit;
15 |
16 | public class BootIntentReceiver extends BroadcastReceiver {
17 | @Override
18 | public void onReceive(Context context, Intent intent) {
19 |
20 | Preferences pref = new Preferences(context);
21 |
22 | String action = intent.getAction();
23 |
24 | //Toast.makeText(context, "Received boot completed " + action, Toast.LENGTH_SHORT).show();
25 |
26 | if (action == null) {
27 |
28 | if(pref.pref_disable_max_volume_warning )
29 | Util.toggleMaxVolumeWarning(context, false);
30 |
31 | //AnimatorDurationUtil.setAnimatorScale(context, pref.pref_animation_duration);
32 |
33 |
34 | } else if (action.equals(Intent.ACTION_BOOT_COMPLETED)) {
35 | //Toast.makeText(context, "----------------Received boot completed --------------", Toast.LENGTH_SHORT).show();
36 | Log.i("BootIntentReceiver", "Received boot completed ");
37 | Intent delayedIntent = new Intent(context, BootIntentReceiver.class);
38 | PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, delayedIntent, 0);
39 | AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
40 | alarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, 30000, pendingIntent);
41 |
42 | //schedule
43 | if(pref.pref_disable_max_volume_warning ) {
44 | scheduleSettingsUpdateJob(context);
45 | }
46 | }
47 | }
48 |
49 |
50 | public static void scheduleSettingsUpdateJob(Context context) {
51 | JobScheduler jobScheduler = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE);
52 | jobScheduler.cancelAll();
53 | jobScheduler.schedule(new JobInfo.Builder(0, new ComponentName(context, SettingsUpdateJobService.class))
54 | .setPersisted(false)
55 | .setPeriodic(TimeUnit.HOURS.toMillis(1))
56 | .setRequiresDeviceIdle(false)
57 | .setRequiresCharging(false)
58 | .build());
59 | }
60 |
61 | public static void unscheduleSettingsUpdateJob(Context context) {
62 | JobScheduler jobScheduler = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE);
63 | jobScheduler.cancelAll();
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dharmapoudel/samfix/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.dharmapoudel.samfix;
2 |
3 | import android.app.Dialog;
4 | import android.content.BroadcastReceiver;
5 | import android.content.Context;
6 | import android.content.DialogInterface;
7 | import android.content.Intent;
8 | import android.content.IntentFilter;
9 | import android.content.pm.PackageManager;
10 | import android.net.Uri;
11 | import android.os.Bundle;
12 | import android.support.v7.app.ActionBar;
13 | import android.support.v7.app.AppCompatActivity;
14 | import android.util.Log;
15 | import android.view.View;
16 | import android.widget.TextView;
17 | import android.widget.Toast;
18 |
19 | import com.dharmapoudel.samfix.autobackup.BackupReceiver;
20 |
21 | import static android.content.Intent.FLAG_RECEIVER_FOREGROUND;
22 | import static com.dharmapoudel.samfix.BootIntentReceiver.scheduleSettingsUpdateJob;
23 | import static com.dharmapoudel.samfix.BootIntentReceiver.unscheduleSettingsUpdateJob;
24 |
25 | public class MainActivity extends AppCompatActivity {
26 |
27 | private Preferences pref;
28 | private Context context;
29 | private static Context mContext;
30 |
31 | private SamFixBrightnessAddonBroadcastReceiver samFixBrightnessAddonBroadcastReceiver;
32 | private BackupReceiver backupReceiver;
33 | private PremiumCheckBroadcastReceiver premiumCheckReceiver;
34 | private static boolean licenseCheckBroadcastSent;
35 |
36 |
37 | private static View maxBrightnessToggle, data, backup, location_popup, bt_popup, wifi_popup, sync_popup;
38 |
39 |
40 | private static final String TAG = MainActivity.class.getSimpleName();
41 |
42 |
43 | @Override
44 | protected void onCreate(Bundle savedInstanceState) {
45 | super.onCreate(savedInstanceState);
46 | setContentView(R.layout.activity_main);
47 |
48 | //action bar settings
49 | ActionBar actionBar = getSupportActionBar();
50 | actionBar.setElevation(0);
51 | actionBar.hide();
52 |
53 |
54 | //register the samfix brightness addon broadcast receiver
55 | samFixBrightnessAddonBroadcastReceiver = new SamFixBrightnessAddonBroadcastReceiver();
56 | IntentFilter filter = new IntentFilter();
57 | filter.addAction(getResources().getString(R.string.samfix_brightness_broadcast_intent));
58 | registerReceiver(samFixBrightnessAddonBroadcastReceiver, filter);
59 |
60 | backupReceiver = new BackupReceiver();
61 | IntentFilter i = new IntentFilter();
62 | i.addAction("android.intent.action.PACKAGE_ADDED");
63 | registerReceiver(backupReceiver, i);
64 |
65 | premiumCheckReceiver = new PremiumCheckBroadcastReceiver();
66 | IntentFilter i2 = new IntentFilter();
67 | i2.addAction(getString(R.string.samfix_filter_action));
68 | registerReceiver(premiumCheckReceiver, i2);
69 |
70 |
71 | mContext = this;
72 | context = getApplicationContext();
73 | pref = new Preferences(context);
74 |
75 | licenseCheckBroadcastSent = false;
76 |
77 | }
78 |
79 | @Override
80 | protected void onResume() {
81 | super.onResume();
82 | mContext = this;
83 | context = getApplicationContext();
84 | pref = new Preferences(context);
85 |
86 | if (!Util.hasPermission(this)) {
87 |
88 | Dialog dialog = Util.createTipsDialog(this);
89 | dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
90 | @Override
91 | public void onDismiss(DialogInterface dialog) {
92 | finish();
93 | }
94 | });
95 | dialog.show();
96 |
97 | } else {
98 |
99 | sendLicenseCheckBroadCast();
100 |
101 | //Toast.makeText(getApplicationContext(), "Billing initialized!", Toast.LENGTH_SHORT).show();
102 | data = findViewById(R.id.data);
103 | backup = findViewById(R.id.backup);
104 | location_popup = findViewById(R.id.location_popup);
105 | bt_popup = findViewById(R.id.bt_popup);
106 | wifi_popup = findViewById(R.id.wifi_popup);
107 | sync_popup = findViewById(R.id.sync_popup);
108 |
109 | if(!pref.pref_license_check_broadcast_value){
110 | disableToggles();
111 | }
112 |
113 | //automatically add to accessibility services
114 | updateAccessibilityServices();
115 |
116 | //set grey scale switch
117 | if(pref.pref_enable_greyscale) {
118 | //Util.toggleMaxBrightnessWarning(context, false);
119 | View greyScaleToggle = findViewById(R.id.greyscale_toggle);
120 | greyScaleToggle.setBackground(getDrawable(R.drawable.toggle_on));
121 | }
122 |
123 | //set the data toggle switch
124 | if(Util.isDataToggled(context)) {
125 | Util.toggleData(context, false);
126 | View dataToggle = findViewById(R.id.data_toggle);
127 | dataToggle.setBackground(getDrawable(R.drawable.toggle_on));
128 | }
129 |
130 | //set max volume warning switch
131 | if(pref.pref_disable_max_volume_warning) {
132 | Util.toggleMaxVolumeWarning(context, false);
133 | View maxVolumeToggle = findViewById(R.id.max_volume_toggle);
134 | maxVolumeToggle.setBackground(getDrawable(R.drawable.toggle_on));
135 | }
136 |
137 | //set max brightness warning switch
138 | maxBrightnessToggle = findViewById(R.id.max_brightness_toggle);
139 | if(pref.pref_disable_max_brightness_warning ) {
140 | maxBrightnessToggle = findViewById(R.id.max_brightness_toggle);
141 | maxBrightnessToggle.setBackground(getDrawable(R.drawable.toggle_on));
142 | }
143 |
144 | View dataToggle, autoBackupToggle, btToggle, wifiToggle, locationToggle, syncToggle;
145 |
146 | //set the data toggle switch
147 | dataToggle = findViewById(R.id.data_toggle);
148 | if(Util.isDataToggled(context)) {
149 | Util.toggleData(context, false);
150 | dataToggle.setBackground(getDrawable(R.drawable.toggle_on));
151 | }
152 |
153 | //set app auto backup switch
154 | autoBackupToggle = findViewById(R.id.backup_toggle);
155 | if(pref.pref_auto_backup) {
156 | autoBackupToggle.setBackground(getDrawable(R.drawable.toggle_on));
157 | }
158 |
159 | //set bluetooth switch
160 | btToggle = findViewById(R.id.bt_popup_toggle);
161 | if(pref.pref_no_popup_on_bt) {
162 | btToggle.setBackground(getDrawable(R.drawable.toggle_on));
163 | }
164 |
165 | //set wifi switch
166 | wifiToggle = findViewById(R.id.wifi_popup_toggle);
167 | if(pref.pref_no_popup_on_wifi) {
168 | wifiToggle.setBackground(getDrawable(R.drawable.toggle_on));
169 | }
170 |
171 | //set sync switch
172 | syncToggle = findViewById(R.id.sync_popup_toggle);
173 | if(pref.pref_no_popup_on_sync) {
174 | syncToggle.setBackground(getDrawable(R.drawable.toggle_on));
175 | }
176 |
177 | //set the location switch
178 | locationToggle = findViewById(R.id.location_popup_toggle);
179 | if(pref.pref_no_popup_gm_location) {
180 | locationToggle.setBackground(getDrawable(R.drawable.toggle_on));
181 | }
182 | }
183 |
184 | addRateAppTouchListener();
185 | addSendEmailTouchListener();
186 | addSupportDevelopmentTouchListener();
187 | updateAnimationScale();
188 |
189 | }
190 |
191 | @Override
192 | protected void onDestroy() {
193 | super.onDestroy();
194 | if(samFixBrightnessAddonBroadcastReceiver != null)
195 | unregisterReceiver(samFixBrightnessAddonBroadcastReceiver);
196 |
197 | if(backupReceiver!= null)
198 | unregisterReceiver(backupReceiver);
199 |
200 | if(premiumCheckReceiver != null)
201 | unregisterReceiver(premiumCheckReceiver);
202 | }
203 |
204 | private void updateAnimationScale(){
205 | float animationScale = AnimatorDurationUtil.getAnimatorScale(getApplicationContext());
206 | View animationScaleToggle = findViewById(R.id.animation_scale_toggle);
207 | animationScaleToggle.setBackground(getDrawable((animationScale != 0f)? R.drawable.toggle_on: R.drawable.toggle_off));
208 | ((TextView)findViewById(R.id.animation_scale_description)).setText("Animation scale is set to " + animationScale);
209 | }
210 |
211 | private void addSendEmailTouchListener() {
212 | findViewById(R.id.email).setOnClickListener(new View.OnClickListener(){
213 | @Override
214 | public void onClick(View v) {
215 | Intent i = new Intent(Intent.ACTION_SEND);
216 | i.setType("message/rfc822");
217 | i.putExtra(Intent.EXTRA_EMAIL , new String[]{"dharmapoudel1@gmail.com"});
218 | i.putExtra(Intent.EXTRA_SUBJECT, "SamFix");
219 | try {
220 | startActivity(Intent.createChooser(i, "Send Email..."));
221 | } catch (android.content.ActivityNotFoundException ex) {
222 | Toast.makeText(MainActivity.this, "There are no email clients installed.", Toast.LENGTH_SHORT).show();
223 | }
224 | }
225 | });
226 |
227 | }
228 |
229 | private void addSupportDevelopmentTouchListener() {
230 | findViewById(R.id.support).setOnClickListener(new View.OnClickListener(){
231 | @Override
232 | public void onClick(View v) {
233 | /*boolean isBillingProcessorAvailable = bp.isIabServiceAvailable(MainActivity.this);
234 | boolean isOneTimePurchaseSupported = bp.isOneTimePurchaseSupported();
235 | if (isBillingProcessorAvailable && isOneTimePurchaseSupported) {
236 | bp.purchase(MainActivity.this, PRODUCT_ID, null);
237 | }*/
238 | }
239 | });
240 | }
241 |
242 | private void addRateAppTouchListener() {
243 | findViewById(R.id.rate).setOnClickListener(new View.OnClickListener(){
244 | @Override
245 | public void onClick(View v) {
246 | Intent intent = new Intent(Intent.ACTION_VIEW);
247 | intent.setData(Uri.parse("https://labs.xda-developers.com/store/app/com.dharmapoudel.samfix"));
248 | startActivity(intent);
249 | }
250 | });
251 |
252 | }
253 |
254 | public void toggleGreyScale(View v){
255 | Context context = getApplicationContext();
256 | Preferences pref = new Preferences(context);
257 | pref.savePreference("pref_enable_greyscale", !pref.pref_enable_greyscale);
258 |
259 | View greyScaleToggle = v.findViewById(R.id.greyscale_toggle);
260 | greyScaleToggle.setBackground(getDrawable(!pref.pref_enable_greyscale? R.drawable.toggle_on: R.drawable.toggle_off));
261 | Util.toggleGreyScale(this, pref.pref_enable_greyscale);
262 |
263 | }
264 |
265 | public void toggleMaxVolume(View v){
266 | Context context = getApplicationContext();
267 | Preferences pref = new Preferences(context);
268 | pref.savePreference("pref_disable_max_volume_warning", !pref.pref_disable_max_volume_warning);
269 |
270 | View maxVolumeToggle = v.findViewById(R.id.max_volume_toggle);
271 | maxVolumeToggle.setBackground(getDrawable(pref.pref_disable_max_volume_warning? R.drawable.toggle_off: R.drawable.toggle_on));
272 | Util.toggleMaxVolumeWarning(this, pref.pref_disable_max_volume_warning);
273 |
274 | if(pref.pref_disable_max_volume_warning)
275 | unscheduleSettingsUpdateJob(context);
276 | else
277 | scheduleSettingsUpdateJob(context);
278 | }
279 |
280 | public void toggleMaxBrightness(View v){
281 | PackageManager pm = context.getPackageManager();
282 | boolean isInstalled = Util.isPackageInstalled("com.dharmapoudel.samfix.addon", pm);
283 | if(isInstalled) {
284 | Preferences pref = new Preferences(context);
285 | pref.savePreference("pref_disable_max_brightness_warning", !pref.pref_disable_max_brightness_warning);
286 |
287 | View maxBrightnessToggle = v.findViewById(R.id.max_brightness_toggle);
288 | maxBrightnessToggle.setBackground(getDrawable(!pref.pref_disable_max_brightness_warning? R.drawable.toggle_on: R.drawable.toggle_off));
289 | Util.toggleMaxBrightnessWarning(this, pref.pref_disable_max_brightness_warning);
290 | } else {
291 | Toast.makeText(context, "Install SamFix Addon to enable this feature", Toast.LENGTH_SHORT).show();
292 | Intent intent = new Intent(Intent.ACTION_VIEW);
293 | intent.setData(Uri.parse("https://labs.xda-developers.com/store/app/com.dharmapoudel.samfix.addon"));
294 | context.startActivity(intent);
295 | }
296 | }
297 |
298 | public void setAnimationScale(View v){
299 | Intent intent = new Intent(this, AnimatorDurationActivity.class);
300 | startActivity(intent);
301 |
302 | }
303 |
304 | public void checkLicense(){
305 | PackageManager pm = context.getPackageManager();
306 | boolean isInstalled = Util.isPackageInstalled("com.dharmapoudel.proapp", pm);
307 | if(isInstalled) {
308 | if(!licenseCheckBroadcastSent) {
309 | //pref.savePreference("license_check_broadcast_sent", true);
310 | licenseCheckBroadcastSent = true;
311 | Intent intent = new Intent(getApplicationContext().getString(R.string.pro_app_filter_action));
312 | intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
313 | intent.setFlags(FLAG_RECEIVER_FOREGROUND);
314 | context.sendBroadcast(intent);
315 | Log.e(Util.class.getSimpleName(), "Samfix License Check Brightness broadcast sent!");
316 | }
317 | }else {
318 | Preferences pref = new Preferences(context);
319 | pref.savePreference("pref_license_check_broadcast_value", false);
320 | licenseCheckBroadcastSent = false;
321 |
322 | Toast.makeText(context, "Install Pro Key to enable this feature", Toast.LENGTH_SHORT).show();
323 | Intent intent = new Intent(Intent.ACTION_VIEW);
324 | intent.setData(Uri.parse("https://play.google.com/store/apps/details?id=com.dharmapoudel.proapp"));
325 | context.startActivity(intent);
326 | }
327 | }
328 | public void sendLicenseCheckBroadCast(){
329 | PackageManager pm = getApplicationContext().getPackageManager();
330 | boolean isInstalled = Util.isPackageInstalled("com.dharmapoudel.proapp", pm);
331 | if(isInstalled) {
332 | if(!licenseCheckBroadcastSent) {
333 | //pref.savePreference("license_check_broadcast_sent", true);
334 | licenseCheckBroadcastSent = true;
335 | Intent intent = new Intent(getApplicationContext().getString(R.string.pro_app_filter_action));
336 | intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
337 | intent.addFlags(FLAG_RECEIVER_FOREGROUND);
338 | intent.setFlags(FLAG_RECEIVER_FOREGROUND);
339 | context.sendBroadcast(intent);
340 | Log.e(Util.class.getSimpleName(), "Samfix License Check Brightness broadcast sent!");
341 | }
342 | } else {
343 | licenseCheckBroadcastSent = false;
344 | Preferences pref = new Preferences(context);
345 | pref.savePreference("pref_license_check_broadcast_value", false);
346 | }
347 | }
348 |
349 | public void toggleData(View v){
350 | Preferences pref = new Preferences(v.getContext());
351 | if(pref.pref_license_check_broadcast_value) {
352 | boolean dataOn = Util.isDataToggled(this);
353 | View dataToggle = v.findViewById(R.id.data_toggle);
354 | dataToggle.setBackground(getDrawable(dataOn ? R.drawable.toggle_off : R.drawable.toggle_on));
355 | Util.toggleData(this, dataOn);
356 | } else {
357 | checkLicense();
358 | //Toast.makeText(context, "Please scroll to the bottom and donate to enable", Toast.LENGTH_SHORT).show();
359 | }
360 | }
361 |
362 | public void toggleAutoBackup(View v){
363 | Preferences pref = new Preferences(v.getContext());
364 | if(pref.pref_license_check_broadcast_value) {
365 | pref.savePreference("pref_auto_backup", !pref.pref_auto_backup);
366 |
367 | PermissionUtil.askForPermission(this);
368 |
369 | boolean autoBackupEnabled = pref.pref_auto_backup;
370 |
371 | View toggle = v.findViewById(R.id.backup_toggle);
372 | toggle.setBackground(getDrawable(!autoBackupEnabled ? R.drawable.toggle_on : R.drawable.toggle_off));
373 | } else {
374 | checkLicense();
375 | //Toast.makeText(context, "Please scroll to the bottom and donate to enable", Toast.LENGTH_SHORT).show();
376 | }
377 | }
378 |
379 | public void toggleBTPopup(View v){
380 | Preferences pref = new Preferences(v.getContext());
381 | if(pref.pref_license_check_broadcast_value) {
382 | pref.savePreference("pref_no_popup_on_bt", !pref.pref_no_popup_on_bt);
383 |
384 | View toggle = v.findViewById(R.id.bt_popup_toggle);
385 | toggle.setBackground(getDrawable(!pref.pref_no_popup_on_bt ? R.drawable.toggle_on : R.drawable.toggle_off));
386 | } else {
387 | checkLicense();
388 | //Toast.makeText(context, "Please scroll to the bottom and donate to enable", Toast.LENGTH_SHORT).show();
389 | }
390 | }
391 |
392 | public void toggleWifiPopup(View v){
393 | Preferences pref = new Preferences(v.getContext());
394 | if(pref.pref_license_check_broadcast_value) {
395 | pref.savePreference("pref_no_popup_on_wifi", !pref.pref_no_popup_on_wifi);
396 |
397 | View toggle = v.findViewById(R.id.wifi_popup_toggle);
398 | toggle.setBackground(getDrawable(!pref.pref_no_popup_on_wifi ? R.drawable.toggle_on : R.drawable.toggle_off));
399 | } else {
400 | checkLicense();
401 | //Toast.makeText(context, "Please scroll to the bottom and donate to enable", Toast.LENGTH_SHORT).show();
402 | }
403 | }
404 |
405 | public void toggleSyncPopup(View v){
406 | if(pref.pref_license_check_broadcast_value) {
407 | Context context = getApplicationContext();
408 | Preferences pref = new Preferences(context);
409 | pref.savePreference("pref_no_popup_on_sync", !pref.pref_no_popup_on_sync);
410 |
411 | View toggle = v.findViewById(R.id.sync_popup_toggle);
412 | toggle.setBackground(getDrawable(!pref.pref_no_popup_on_sync ? R.drawable.toggle_on : R.drawable.toggle_off));
413 | } else {
414 | checkLicense();
415 | //Toast.makeText(context, "Please scroll to the bottom and donate to enable", Toast.LENGTH_SHORT).show();
416 | }
417 | }
418 |
419 | public void toggleLocationPopup(View v){
420 | if(pref.pref_license_check_broadcast_value) {
421 | Context context = getApplicationContext();
422 | Preferences pref = new Preferences(context);
423 | pref.savePreference("pref_no_popup_gm_location", !pref.pref_no_popup_gm_location);
424 |
425 | View greyScaleToggle = v.findViewById(R.id.location_popup_toggle);
426 | greyScaleToggle.setBackground(getDrawable(!pref.pref_no_popup_gm_location ? R.drawable.toggle_on : R.drawable.toggle_off));
427 | } else {
428 | checkLicense();
429 | //Toast.makeText(context, "Please scroll to the bottom and donate to enable", Toast.LENGTH_SHORT).show();
430 | }
431 | }
432 |
433 |
434 | public static void enableToggles() {
435 |
436 | data.setAlpha(1.0f);
437 | backup.setAlpha(1.0f);
438 | location_popup.setAlpha(1.0f);
439 | bt_popup.setAlpha(1.0f);
440 | wifi_popup.setAlpha(1.0f);
441 | sync_popup.setAlpha(1.0f);
442 | }
443 |
444 | public static void disableToggles() {
445 | data.setAlpha(0.5f);
446 | backup.setAlpha(0.5f);
447 | location_popup.setAlpha(0.5f);
448 | bt_popup.setAlpha(0.5f);
449 | wifi_popup.setAlpha(0.5f);
450 | sync_popup.setAlpha(0.5f);
451 | }
452 |
453 | public static void resetToggles(Context context){
454 | Preferences pref = new Preferences(context);
455 | pref.savePreference("pref_auto_backup", false);
456 | pref.savePreference("pref_no_popup_gm_location", false);
457 | pref.savePreference("pref_no_popup_on_sync", false);
458 | pref.savePreference("pref_no_popup_on_wifi", false);
459 | pref.savePreference("pref_no_popup_on_bt", false);
460 | pref.savePreference("pref_license_check_broadcast_value", false);
461 | }
462 |
463 |
464 |
465 | /*public void onAccessibilityEnableClick(View v) {
466 | Intent intent = new Intent(android.provider.Settings.ACTION_ACCESSIBILITY_SETTINGS);
467 | startActivity(intent);
468 | }*/
469 |
470 | public void updateAccessibilityServices() {
471 |
472 | String enabledServices = Util.getEnabledAccessibilityServices(context);
473 | if(!enabledServices.contains("samfix")){
474 | enabledServices += ":com.dharmapoudel.samfix/com.dharmapoudel.samfix.SamFixAccessibilityService";
475 | Util.setEnabledAccessibilityServices(context, enabledServices);
476 | }
477 |
478 |
479 | /*AccessibilityManager am = (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE);
480 | List runningServices = am.getInstalledAccessibilityServiceList();
481 | for (AccessibilityServiceInfo service : runningServices) {
482 | Log.i(TAG, service.getId());
483 | }*/
484 | }
485 |
486 | public static Context getContext(){
487 | return mContext;
488 | }
489 |
490 |
491 |
492 | public static class SamFixBrightnessAddonBroadcastReceiver extends BroadcastReceiver {
493 |
494 | @Override
495 | public void onReceive(Context context, Intent intent) {
496 | String act = intent.getAction();
497 | if(act != null && act.equals(context.getResources().getString(R.string.samfix_brightness_broadcast_intent)) ) {
498 | boolean value = intent.getBooleanExtra("brightness_value", false);
499 |
500 | //save the value to the preferences
501 | Preferences pref = new Preferences(context);
502 | pref.savePreference("pref_disable_max_brightness_warning", value);
503 |
504 |
505 | if(maxBrightnessToggle != null) {
506 | maxBrightnessToggle.setBackground(getContext().getDrawable(pref.pref_disable_max_brightness_warning ? R.drawable.toggle_on : R.drawable.toggle_off));
507 | }
508 |
509 | Log.i(SamFixBrightnessAddonBroadcastReceiver.class.getSimpleName(), "SamFix brightness broadcast sent from addon is received with value : " + value);
510 | }
511 | }
512 | }
513 |
514 |
515 | public static class PremiumCheckBroadcastReceiver extends BroadcastReceiver {
516 |
517 | @Override
518 | public void onReceive(Context context, Intent intent) {
519 | String act = intent.getAction();
520 | if(act != null && act.equals(context.getResources().getString(R.string.samfix_filter_action)) ) {
521 | boolean value = "true".equalsIgnoreCase(intent.getStringExtra("calibration_value"));
522 |
523 | //save the value to the preferences
524 | Preferences pref = new Preferences(context);
525 | pref.savePreference("pref_license_check_broadcast_value", value);
526 | licenseCheckBroadcastSent = false;
527 |
528 | if(value){
529 | enableToggles();
530 | } else {
531 | disableToggles();
532 | resetToggles(context);
533 | }
534 |
535 | Log.i(PremiumCheckBroadcastReceiver.class.getSimpleName(), "SamFix license checked broadcast sent from pro is received with value : " + value);
536 | }
537 | }
538 | }
539 | }
540 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dharmapoudel/samfix/PermissionUtil.java:
--------------------------------------------------------------------------------
1 | package com.dharmapoudel.samfix;
2 |
3 | import android.Manifest;
4 | import android.app.Activity;
5 | import android.content.Context;
6 | import android.content.pm.PackageManager;
7 | import android.support.v4.app.ActivityCompat;
8 | import android.support.v4.content.ContextCompat;
9 |
10 | public final class PermissionUtil {
11 |
12 | final static int WRITE_EXTERNAL = 25;
13 |
14 | final static String[] storagePermissions = new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE};
15 |
16 |
17 | public static boolean isStoragePermissionAvailable(Context context){
18 | return checkPermissions(context, storagePermissions);
19 | }
20 |
21 |
22 | private static boolean checkPermissions(Context context, String... permissions) {
23 | for (String permission : permissions) {
24 | if (!checkPermission(context, permission)) {
25 | return false;
26 | }
27 | }
28 | return true;
29 | }
30 |
31 | private static boolean checkPermission(Context context, String permission) {
32 | return ContextCompat.checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED;
33 | }
34 |
35 | public static void requestPermissions(Activity activity, int permissionId) {
36 | ActivityCompat.requestPermissions(activity, storagePermissions, permissionId);
37 | }
38 |
39 | public static void askForPermission(final Activity activity) {
40 | if (!PermissionUtil.isStoragePermissionAvailable(activity)) {
41 | PermissionUtil.requestPermissions(activity, WRITE_EXTERNAL);
42 | }
43 | }
44 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/dharmapoudel/samfix/Preferences.java:
--------------------------------------------------------------------------------
1 | package com.dharmapoudel.samfix;
2 |
3 | import android.content.Context;
4 | import android.content.SharedPreferences;
5 | import android.preference.PreferenceManager;
6 |
7 | public class Preferences {
8 |
9 | SharedPreferences mSharedPreferences;
10 |
11 | public boolean pref_disable_max_volume_warning;
12 | public boolean pref_disable_max_brightness_warning;
13 | public boolean pref_enable_greyscale;
14 | public boolean pref_auto_backup;
15 | public boolean pref_no_popup_on_bt;
16 | public boolean pref_no_popup_on_wifi;
17 | public boolean pref_no_popup_on_sync;
18 | public boolean pref_no_popup_gm_location;
19 | //public boolean supportEnabled;
20 | public boolean pref_license_check_broadcast_value, license_check_broadcast_sent;
21 |
22 | public float pref_animation_duration = 0.50f;
23 |
24 | public Preferences(Context context) {
25 | mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
26 | loadSavedPreferences();
27 | }
28 |
29 | private void loadSavedPreferences() {
30 | pref_disable_max_volume_warning = mSharedPreferences.getBoolean("pref_disable_max_volume_warning", false);
31 | pref_disable_max_brightness_warning = mSharedPreferences.getBoolean("pref_disable_max_brightness_warning", false);
32 | pref_enable_greyscale = mSharedPreferences.getBoolean("pref_enable_greyscale", false);
33 | pref_animation_duration = mSharedPreferences.getFloat("pref_animation_duration", pref_animation_duration);
34 |
35 | pref_auto_backup = mSharedPreferences.getBoolean("pref_auto_backup", false);
36 | pref_no_popup_on_bt = mSharedPreferences.getBoolean("pref_no_popup_on_bt", false);
37 | pref_no_popup_on_wifi = mSharedPreferences.getBoolean("pref_no_popup_on_wifi", false);
38 | pref_no_popup_on_sync = mSharedPreferences.getBoolean("pref_no_popup_on_sync", false);
39 | pref_no_popup_gm_location = mSharedPreferences.getBoolean("pref_no_popup_gm_location", false);
40 | //supportEnabled = mSharedPreferences.getBoolean("samfix", false);
41 | pref_license_check_broadcast_value = mSharedPreferences.getBoolean("pref_license_check_broadcast_value", false);
42 | license_check_broadcast_sent = mSharedPreferences.getBoolean("license_check_broadcast_sent", false);
43 | }
44 |
45 | public void savePreference(String key, boolean value){
46 | SharedPreferences.Editor editor = mSharedPreferences.edit();
47 | editor.putBoolean(key, value);
48 | editor.apply();
49 | }
50 |
51 | public SharedPreferences.Editor getEditor(){
52 | return mSharedPreferences.edit();
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dharmapoudel/samfix/SamFixAccessibilityService.java:
--------------------------------------------------------------------------------
1 | package com.dharmapoudel.samfix;
2 |
3 | import android.accessibilityservice.AccessibilityService;
4 | import android.content.Intent;
5 | import android.util.Log;
6 | import android.view.accessibility.AccessibilityEvent;
7 | import android.view.accessibility.AccessibilityNodeInfo;
8 |
9 | import java.util.List;
10 |
11 | public class SamFixAccessibilityService extends AccessibilityService {
12 |
13 | private Preferences mPrefs;
14 |
15 | private static final String TAG = SamFixAccessibilityService.class.getSimpleName();
16 |
17 | @Override
18 | protected void onServiceConnected() {
19 | super.onServiceConnected();
20 | mPrefs = new Preferences(this);
21 | }
22 |
23 | @Override
24 | public void onAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
25 | Log.i(TAG, accessibilityEvent.toString());
26 | mPrefs = new Preferences(this);
27 |
28 | if (accessibilityEvent.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
29 | String accessibilityEventPackageName = (String) accessibilityEvent.getPackageName();
30 |
31 | if (mPrefs.pref_no_popup_on_bt) {
32 | if (accessibilityEventPackageName.equals("com.android.settings")) {
33 | if (accessibilityEvent.getClassName().toString().equals("android.app.Dialog")) {
34 | List texts = accessibilityEvent.getText();
35 | if (texts.get(0) != null && texts.get(0).toString().toLowerCase().equals("bluetooth")) {
36 | List nodeInfos = getRootInActiveWindow().findAccessibilityNodeInfosByViewId("android:id/button1");
37 | for (AccessibilityNodeInfo nodeInfo : nodeInfos)
38 | nodeInfo.performAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_CLICK.getId());
39 | }
40 | }
41 | }
42 | }
43 |
44 | if (mPrefs.pref_no_popup_on_wifi) {
45 | if (accessibilityEventPackageName.equals("com.android.settings")) {
46 | if (accessibilityEvent.getClassName().toString().equals("com.samsung.android.settings.wifi.WifiPickerDialog")) {
47 | List texts = accessibilityEvent.getText();
48 | if (texts.get(0) != null && texts.get(0).toString().toLowerCase().equals("wi-fi")) {
49 | List nodeInfos = getRootInActiveWindow().findAccessibilityNodeInfosByViewId("com.android.settings:id/wifi_picker_dialog_cancel");
50 | for (AccessibilityNodeInfo nodeInfo : nodeInfos)
51 | nodeInfo.performAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_CLICK.getId());
52 | }
53 | }
54 | }
55 | }
56 |
57 | if (mPrefs.pref_no_popup_on_sync) {
58 | if (accessibilityEventPackageName.equals("com.android.settings")) {
59 | if (accessibilityEvent.getClassName().toString().equals("android.app.AlertDialog")) {
60 | final List nodeInfos = getRootInActiveWindow().findAccessibilityNodeInfosByText("OK");
61 | for (AccessibilityNodeInfo nodeInfo : nodeInfos) {
62 | if(nodeInfo.getViewIdResourceName().equalsIgnoreCase("android:id/button1"))
63 | nodeInfo.performAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_CLICK.getId());
64 | }
65 | }
66 | }
67 | }
68 |
69 | if (mPrefs.pref_no_popup_gm_location) {
70 | if (accessibilityEvent.getClassName().toString().equals("com.google.android.location.settings.LocationSettingsCheckerActivity")) {
71 | clickButton("android:id/button2");
72 | } else if (accessibilityEvent.getClassName().toString().equals("com.google.android.location.network.ConfirmAlertActivity")) {
73 | clickButton("android:id/button1");
74 | }
75 | }
76 |
77 | }
78 |
79 | }
80 |
81 | void clickButton(final String viewId) {
82 | final List nodeInfos = getRootInActiveWindow().findAccessibilityNodeInfosByViewId(viewId);
83 | for (AccessibilityNodeInfo nodeInfo : nodeInfos)
84 | nodeInfo.performAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_CLICK.getId());
85 | }
86 |
87 | @Override
88 | public void onInterrupt() {
89 |
90 | }
91 |
92 | @Override
93 | public int onStartCommand(Intent intent, int flags, int startId) {
94 | Log.i(TAG , "onStartCommand");
95 | mPrefs = new Preferences(this);
96 | return super.onStartCommand(intent, flags, startId);
97 | }
98 |
99 | }
100 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dharmapoudel/samfix/SettingsUpdateJobService.java:
--------------------------------------------------------------------------------
1 | package com.dharmapoudel.samfix;
2 |
3 | import android.app.job.JobParameters;
4 | import android.app.job.JobService;
5 | import android.content.Context;
6 | import android.widget.Toast;
7 |
8 | public class SettingsUpdateJobService extends JobService {
9 |
10 | @Override
11 | public boolean onStartJob(final JobParameters params) {
12 | Context context = this.getApplicationContext();
13 | Preferences pref = new Preferences(context);
14 |
15 | //Toast.makeText(context, "Running scheduled job", Toast.LENGTH_SHORT).show();
16 |
17 |
18 | if(pref.pref_disable_max_volume_warning )
19 | Util.toggleMaxVolumeWarning(context, false);
20 |
21 | //AnimatorDurationUtil.setAnimatorScale(context, pref.pref_animation_duration);
22 |
23 |
24 | return true;
25 | }
26 |
27 | @Override
28 | public boolean onStopJob(JobParameters params) {
29 | return false;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dharmapoudel/samfix/Util.java:
--------------------------------------------------------------------------------
1 | package com.dharmapoudel.samfix;
2 |
3 | import android.app.AlertDialog;
4 | import android.app.Dialog;
5 | import android.app.Service;
6 | import android.content.ClipData;
7 | import android.content.ClipboardManager;
8 | import android.content.ContentResolver;
9 | import android.content.Context;
10 | import android.content.DialogInterface;
11 | import android.content.Intent;
12 | import android.content.pm.PackageManager;
13 | import android.provider.Settings;
14 | import android.provider.Settings.Global;
15 | import android.provider.Settings.Secure;
16 | import android.util.Log;
17 | import android.widget.Toast;
18 | import com.stericson.RootTools.RootTools;
19 |
20 | import java.io.File;
21 |
22 | public class Util {
23 |
24 | private static final String PERMISSION = "android.permission.WRITE_SECURE_SETTINGS";
25 | private static final String COMMAND = "adb shell pm grant " + BuildConfig.APPLICATION_ID + " " + PERMISSION;
26 | private static final String SU_COMMAND = "su -c pm grant " + BuildConfig.APPLICATION_ID + " " + PERMISSION + "";
27 |
28 | private static final String DISPLAY_DALTONIZER_ENABLED = "accessibility_display_daltonizer_enabled";
29 | private static final String DISPLAY_DALTONIZER = "accessibility_display_daltonizer";
30 | private static final String AUDIO_SAFE_VOLUME_STATE = "audio_safe_volume_state";
31 |
32 | public static boolean hasPermission(Context context) {
33 | return context.checkCallingOrSelfPermission(PERMISSION) == PackageManager.PERMISSION_GRANTED;
34 | }
35 |
36 | public static Dialog createTipsDialog(final Context context) {
37 | return new AlertDialog.Builder(context, android.R.style.Theme_Material_Light_Dialog_Alert)
38 | .setTitle(R.string.tips_title)
39 | .setMessage(context.getString(R.string.tips, COMMAND))
40 | .setNegativeButton(R.string.tips_ok, null)
41 | .setPositiveButton(R.string.tips_copy, new DialogInterface.OnClickListener() {
42 | @Override
43 | public void onClick(DialogInterface dialog, int which) {
44 | ClipData clipData = ClipData.newPlainText(COMMAND, COMMAND);
45 | ClipboardManager manager = (ClipboardManager) context.getSystemService(Service.CLIPBOARD_SERVICE);
46 | manager.setPrimaryClip(clipData);
47 | Toast.makeText(context, R.string.copy_done, Toast.LENGTH_SHORT).show();
48 | }
49 | })
50 | /*.setNeutralButton("root", new DialogInterface.OnClickListener() {
51 | @Override
52 | public void onClick(DialogInterface dialog, int which) {
53 |
54 | //boolean systemlessRoot = new File("/su").exists();
55 | //if (!systemlessRoot && !RootTools.isRootAvailable()){
56 | final boolean root = RootTools.isRootAvailable() || RootTools.isAccessGiven();
57 |
58 | if(root){
59 | try {
60 | Runtime.getRuntime().exec(SU_COMMAND).waitFor();
61 | //toggleGreyScale(context, !isGreyScaleEnabled(context));
62 | } catch (Exception e) {
63 | //Toast.makeText(context, R.string.root_failure, Toast.LENGTH_SHORT).show();
64 | e.printStackTrace();
65 | }
66 | }
67 | //}
68 |
69 | }
70 | })*/
71 | .create();
72 | }
73 |
74 | public static boolean isGreyScaleEnabled(Context context) {
75 | ContentResolver contentResolver = context.getContentResolver();
76 | return Secure.getInt(contentResolver, DISPLAY_DALTONIZER_ENABLED, 0) == 1
77 | && Secure.getInt(contentResolver, DISPLAY_DALTONIZER, 0) == 0;
78 | }
79 |
80 | public static void toggleGreyScale(Context context, boolean value) {
81 | ContentResolver contentResolver = context.getContentResolver();
82 | Secure.putInt(contentResolver, DISPLAY_DALTONIZER_ENABLED, value ? 0 : 1);
83 | Secure.putInt(contentResolver, DISPLAY_DALTONIZER, value ? -1 : 0);
84 | }
85 |
86 | public static void toggleMaxVolumeWarning(Context context, boolean value) {
87 | Global.putInt(context.getContentResolver(), AUDIO_SAFE_VOLUME_STATE, value ? 3 : 2);
88 | }
89 |
90 | public static void toggleMaxBrightnessWarning(Context context, boolean value) {
91 | Intent intent = new Intent("com.dharmapoudel.samfix.addon.Brightness");
92 | intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
93 | context.sendBroadcast(intent);
94 | Log.e(Util.class.getSimpleName(), "SamFix Brightness broadcast sent!");
95 | }
96 |
97 | public static boolean isPackageInstalled(String packageName, PackageManager packageManager) {
98 | boolean found = true;
99 | try {
100 | packageManager.getPackageInfo(packageName, 0);
101 | } catch (PackageManager.NameNotFoundException e) {
102 | found = false;
103 | }
104 | return found;
105 | }
106 |
107 | public static void toggleData(Context context, boolean value) {
108 | Settings.Global.putInt(context.getContentResolver(), "mobile_data", value ? 0 : 1);
109 | }
110 |
111 | public static boolean isDataToggled(Context context) {
112 | return Settings.Global.getInt(context.getContentResolver(), "mobile_data", 0) == 1;
113 | }
114 |
115 | public static String getEnabledAccessibilityServices(Context context) {
116 | return Settings.Secure.getString(context.getContentResolver(), "enabled_accessibility_services") ;
117 | }
118 | public static void setEnabledAccessibilityServices(Context context, String value) {
119 | Settings.Secure.putString(context.getContentResolver(), "enabled_accessibility_services", value) ;
120 | }
121 | }
122 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dharmapoudel/samfix/autobackup/BackupReceiver.java:
--------------------------------------------------------------------------------
1 | package com.dharmapoudel.samfix.autobackup;
2 |
3 | import android.content.BroadcastReceiver;
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.util.Log;
7 |
8 | import com.dharmapoudel.samfix.Preferences;
9 |
10 | public class BackupReceiver extends BroadcastReceiver {
11 |
12 | @Override
13 | public void onReceive(Context context, Intent intent) {
14 | Preferences pref = new Preferences(context);
15 | if (pref.pref_auto_backup) {
16 | String pkg = intent.getData().getSchemeSpecificPart();
17 | Log.i("BackupReeciver", pkg);
18 |
19 | BackupTask backupTask = new BackupTask(context);
20 | backupTask.execute(pkg);
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dharmapoudel/samfix/autobackup/BackupTask.java:
--------------------------------------------------------------------------------
1 | package com.dharmapoudel.samfix.autobackup;
2 |
3 | import android.content.Context;
4 | import android.content.pm.ApplicationInfo;
5 | import android.content.pm.PackageInfo;
6 | import android.content.pm.PackageManager;
7 | import android.os.AsyncTask;
8 | import android.os.Environment;
9 |
10 | import java.io.File;
11 | import java.io.FileInputStream;
12 | import java.io.FileOutputStream;
13 | import java.io.IOException;
14 | import java.io.InputStream;
15 | import java.util.List;
16 |
17 | public class BackupTask extends AsyncTask {
18 |
19 |
20 | private final Context mContext;
21 | private PackageManager mPackageManager;
22 | private static final String APP_DIR = "backups/apps/";
23 |
24 | public BackupTask(Context context) {
25 | mContext = context.getApplicationContext();
26 | mPackageManager = mContext.getPackageManager();
27 | createDirectory();
28 | }
29 |
30 | @Override
31 | protected Boolean doInBackground(final String... pkgs) {
32 | if (pkgs == null || pkgs.length < 1)
33 | return backupApps();
34 | else {
35 | backupApp(pkgs[0]);
36 | return true;
37 | }
38 | }
39 |
40 | private static void createDirectory(){
41 | String fileName = ".nomedia";
42 | File f1 = new File(Environment.getExternalStorageDirectory() + File.separator + APP_DIR, fileName);
43 | if (!f1.exists()) {
44 | f1.mkdirs();
45 | }
46 | }
47 |
48 |
49 | private boolean backupApps() {
50 | List packageInfos = mPackageManager.getInstalledPackages(0);
51 | for (PackageInfo packageInfo : packageInfos) {
52 | backupApp(packageInfo);
53 | }
54 | return true;
55 | }
56 |
57 | private void backupApp(PackageInfo packageInfo) {
58 | ApplicationInfo applicationInfo = packageInfo.applicationInfo;
59 |
60 | if ((applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0 &&
61 | (applicationInfo.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) == 0) {
62 | return;
63 | }
64 |
65 | final String name = applicationInfo.loadLabel(mPackageManager).toString().trim();
66 | final String pkg = applicationInfo.packageName.trim();
67 | final String version = packageInfo.versionName.trim();
68 |
69 | String filename = (name + "-" + pkg + "-" + version + ".apk").replaceAll("[?<>\\:*|\"]", "_");
70 | File output = new File(Environment.getExternalStorageDirectory() + File.separator + APP_DIR, filename);
71 | File input = new File(applicationInfo.publicSourceDir);
72 |
73 | try {
74 | copy(input, output);
75 | } catch (IOException e) {
76 | e.printStackTrace();
77 | }
78 | }
79 |
80 | private void backupApp(String pkg) {
81 | try {
82 | backupApp(mPackageManager.getPackageInfo(pkg, 0));
83 | } catch (PackageManager.NameNotFoundException e) {
84 | e.printStackTrace();
85 | }
86 | }
87 |
88 | private void copy(File input, File output) throws IOException {
89 | FileOutputStream outStream = new FileOutputStream(output.getAbsolutePath());
90 | InputStream inStream = new FileInputStream(input);
91 |
92 | byte[] buf = new byte[16 * 1024];
93 | int size;
94 | while ((size = inStream.read(buf)) != -1) {
95 | outStream.write(buf, 0, size);
96 | }
97 | }
98 |
99 | }
100 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dharmapoudel/samfix/tiles/AnimatorDurationTileService.java:
--------------------------------------------------------------------------------
1 | package com.dharmapoudel.samfix.tiles;
2 |
3 | import android.annotation.TargetApi;
4 | import android.graphics.drawable.Icon;
5 | import android.os.Build;
6 | import android.service.quicksettings.Tile;
7 | import android.service.quicksettings.TileService;
8 |
9 | import com.dharmapoudel.samfix.AnimatorDurationUtil;
10 |
11 |
12 | @TargetApi(Build.VERSION_CODES.N)
13 | public class AnimatorDurationTileService extends TileService {
14 |
15 | public AnimatorDurationTileService() { }
16 |
17 |
18 | @Override
19 | public void onClick() {
20 | int index = (AnimatorDurationUtil.getIndex(AnimatorDurationUtil.getAnimatorScale(this)) + 1) % 7;
21 | AnimatorDurationUtil.setAnimatorScale(this, AnimatorDurationUtil.scales[index]);
22 | setState();
23 | }
24 |
25 | private void setState() {
26 | int index = AnimatorDurationUtil.getIndex(AnimatorDurationUtil.getAnimatorScale(this));
27 |
28 | final Tile tile = getQsTile();
29 | tile.setIcon(Icon.createWithResource(getApplicationContext(), AnimatorDurationUtil.scaleIcons[index]));
30 | tile.updateTile();
31 | }
32 |
33 | @Override
34 | public void onStartListening() {
35 | super.onStartListening();
36 | setState();
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dharmapoudel/samfix/tiles/DataToggleTileService.java:
--------------------------------------------------------------------------------
1 | package com.dharmapoudel.samfix.tiles;
2 |
3 | import android.annotation.TargetApi;
4 | import android.content.SharedPreferences;
5 | import android.os.Build;
6 | import android.preference.PreferenceManager;
7 | import android.service.quicksettings.Tile;
8 | import android.service.quicksettings.TileService;
9 | import android.widget.Toast;
10 |
11 | import com.dharmapoudel.samfix.Preferences;
12 | import com.dharmapoudel.samfix.Util;
13 |
14 | @TargetApi(Build.VERSION_CODES.N)
15 | public class DataToggleTileService extends TileService {
16 |
17 | private SharedPreferences mSharedPreferences;
18 | private Preferences preferences;
19 |
20 | @Override
21 | public void onClick() {
22 | super.onClick();
23 |
24 | preferences = new Preferences(getApplicationContext());
25 | if(preferences.pref_license_check_broadcast_value) {
26 |
27 | if (!Util.hasPermission(this)) {
28 | showDialog(Util.createTipsDialog(this));
29 | return;
30 | }
31 |
32 | int oldState = getQsTile().getState();
33 | if (oldState == Tile.STATE_ACTIVE) {
34 | setState(Tile.STATE_INACTIVE);
35 | } else {
36 | setState(Tile.STATE_ACTIVE);
37 | }
38 |
39 | Util.toggleData(this, oldState == Tile.STATE_ACTIVE);
40 | } else {
41 | Toast.makeText(getApplicationContext(), "Only available after supporting!", Toast.LENGTH_SHORT).show();
42 | }
43 | }
44 |
45 | private void setState(int state) {
46 | Tile tile = getQsTile();
47 | tile.setState(state);
48 | tile.updateTile();
49 | }
50 |
51 | @Override
52 | public void onStartListening() {
53 | super.onStartListening();
54 | mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
55 | boolean supportEnabled = mSharedPreferences.getBoolean("samfix", false);
56 | if(supportEnabled) {
57 | boolean dataOn = Util.isDataToggled(this);
58 | setState(dataOn ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE);
59 | }
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dharmapoudel/samfix/tiles/GreyscaleTileService.java:
--------------------------------------------------------------------------------
1 | package com.dharmapoudel.samfix.tiles;
2 |
3 | import android.annotation.TargetApi;
4 | import android.os.Build;
5 | import android.service.quicksettings.Tile;
6 | import android.service.quicksettings.TileService;
7 |
8 | import com.dharmapoudel.samfix.Util;
9 |
10 | @TargetApi(Build.VERSION_CODES.N)
11 | public class GreyscaleTileService extends TileService {
12 |
13 | @Override
14 | public void onClick() {
15 | super.onClick();
16 |
17 | if (!Util.hasPermission(this)) {
18 | showDialog(Util.createTipsDialog(this));
19 | return;
20 | }
21 |
22 | int oldState = getQsTile().getState();
23 | if (oldState == Tile.STATE_ACTIVE) {
24 | setState(Tile.STATE_INACTIVE);
25 | } else {
26 | setState(Tile.STATE_ACTIVE);
27 | }
28 |
29 | Util.toggleGreyScale(this, oldState == Tile.STATE_ACTIVE);
30 | }
31 |
32 |
33 | private void setState(int state) {
34 | Tile tile = getQsTile();
35 | tile.setState(state);
36 | tile.updateTile();
37 | }
38 |
39 | @Override
40 | public void onStartListening() {
41 | super.onStartListening();
42 | boolean greyScaleEnable = Util.isGreyScaleEnabled(this);
43 | setState(greyScaleEnable ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/background_drawable.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/donate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dharmapoudel/samfix/beb14d0a0abd25bc4ea6805fbded68f7dd00b99c/app/src/main/res/drawable/donate.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/gradient.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_animator_duration.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
24 |
25 |
29 |
30 |
34 |
35 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_animator_duration_10x.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
24 |
25 |
29 |
30 |
34 |
35 |
38 |
39 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_animator_duration_1_4x.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
15 |
21 |
26 |
27 |
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_animator_duration_1_5x.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
24 |
25 |
29 |
30 |
34 |
35 |
38 |
39 |
42 |
43 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_animator_duration_1x.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
24 |
25 |
29 |
30 |
34 |
35 |
38 |
39 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_animator_duration_2x.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
24 |
25 |
29 |
30 |
34 |
35 |
38 |
39 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_animator_duration_5x.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
24 |
25 |
29 |
30 |
34 |
35 |
38 |
39 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_animator_duration_half_x.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
24 |
25 |
29 |
30 |
34 |
35 |
38 |
39 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_animator_duration_off.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
24 |
25 |
29 |
30 |
34 |
35 |
39 |
40 |
44 |
45 |
49 |
50 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/star.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/support.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/telegram.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
12 |
13 |
20 |
26 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/tile_data.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
12 |
13 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/tile_greyscale.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/toggle_off.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/toggle_on.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
16 |
17 |
22 |
23 |
32 |
33 |
43 |
44 |
45 |
46 |
49 |
50 |
54 |
55 |
66 |
67 |
71 |
72 |
79 |
80 |
81 |
92 |
93 |
100 |
101 |
107 |
108 |
113 |
114 |
119 |
120 |
126 |
127 |
128 |
129 |
130 |
131 |
142 |
143 |
150 |
151 |
157 |
158 |
163 |
164 |
169 |
170 |
176 |
177 |
178 |
179 |
180 |
181 |
192 |
193 |
200 |
201 |
207 |
208 |
213 |
214 |
219 |
220 |
226 |
227 |
228 |
229 |
230 |
231 |
242 |
243 |
250 |
251 |
257 |
258 |
263 |
264 |
269 |
270 |
271 |
272 |
273 |
284 |
285 |
292 |
293 |
299 |
300 |
305 |
306 |
311 |
312 |
318 |
319 |
320 |
321 |
322 |
323 |
334 |
335 |
342 |
343 |
349 |
350 |
355 |
356 |
361 |
362 |
368 |
369 |
370 |
371 |
372 |
383 |
384 |
391 |
392 |
398 |
399 |
404 |
405 |
411 |
412 |
413 |
414 |
415 |
426 |
427 |
434 |
435 |
441 |
442 |
447 |
448 |
453 |
454 |
455 |
456 |
457 |
468 |
469 |
476 |
477 |
483 |
484 |
489 |
490 |
495 |
496 |
502 |
503 |
504 |
505 |
506 |
517 |
518 |
525 |
526 |
532 |
533 |
538 |
539 |
544 |
545 |
551 |
552 |
553 |
554 |
555 |
556 |
557 |
568 |
569 |
573 |
574 |
581 |
582 |
592 |
593 |
594 |
600 |
601 |
607 |
608 |
613 |
614 |
619 |
620 |
621 |
622 |
623 |
624 |
633 |
634 |
638 |
639 |
646 |
647 |
657 |
658 |
659 |
665 |
666 |
672 |
673 |
678 |
679 |
684 |
685 |
686 |
687 |
697 |
698 |
705 |
706 |
712 |
713 |
718 |
719 |
724 |
725 |
726 |
727 |
728 |
729 |
730 |
731 |
732 |
733 |
734 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/select_scale_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
13 |
14 |
19 |
20 |
21 |
22 |
34 |
35 |
47 |
48 |
60 |
61 |
73 |
74 |
86 |
87 |
99 |
100 |
112 |
113 |
125 |
126 |
127 |
128 |
129 |
130 |
141 |
142 |
143 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_icon2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dharmapoudel/samfix/beb14d0a0abd25bc4ea6805fbded68f7dd00b99c/app/src/main/res/mipmap-xxhdpi/ic_icon2.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #4B5F83
4 | #4B5F83
5 | #820d3240
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 8dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | SamFix
3 | Fix all annoying things on Samsung!
4 |
5 | Need Permission!
6 | OK
7 | COPY
8 | Copy Success
9 | You need to use adb tools to grant permission, copy below command and exec it on a PC:\n\n%1$s\n\n
10 | root permission not granted
11 |
12 | Toggle Settings
13 |
14 | Greyscale
15 | Turn on black and white mode
16 |
17 | Max Volume
18 | Disable max volume warning
19 |
20 | Max Brightness
21 | Disable max brightness warning
22 |
23 | Animation Scale
24 | Change animation scale to .25
25 |
26 |
27 | Support
28 | Support Development
29 | Show your support and enable all options
30 |
31 | Rate App
32 | Happy with the app? Give us 5 star review
33 |
34 | Send Email
35 | Bugs? Feature request? Send us an email
36 |
37 | Thank you for supporting!
38 | Appreciate your intention. Next time perhaps!
39 |
40 | Animation off
41 | Animation scale 0.25x
42 | Animation scale .5x
43 | Animation scale 1x
44 | Animation scale 1.5x
45 | Animation scale 2x
46 | Animation scale 5x
47 | Animation scale 10x
48 | Animator duration
49 |
50 | App Backup
51 | Automatically backup newly installed apps
52 |
53 | No Bluetooth popup
54 | Disable popup on bluetooth
55 |
56 | No Wifi popup
57 | Disable popup on wifi
58 |
59 | No Sync popup
60 | Disable popup on auto sync
61 |
62 |
63 | No location dialog
64 | Disable location dialog in GM
65 |
66 | turn on \'SamFix\' in settings > accessibility
67 |
68 | backus are located in backups/apps
69 | Needs device restart
70 | Samfix uses accessibility service to provide an easy way to get rid of annoying windows and popups. No data is collected whatsoever!
71 |
72 | Mobile data
73 | Toggle data
74 | toggle data directly from quick settings tile
75 |
76 | com.dharmapoudel.samfix.Brightness
77 | com.dharmapoudel.proapp.action.PREMIUM_CHECK
78 | com.dharmapoudel.samfix.action.PREMIUM_CHECK
79 |
80 | Failed to verify license check
81 | License verified successfully.
82 |
83 |
84 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
27 |
28 |
32 |
33 |
34 |
35 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/accessibility_service_config.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | google()
6 | jcenter()
7 | google()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.5.3'
11 |
12 | // NOTE: Do not place your application dependencies here; they belong
13 | // in the individual module build.gradle files
14 | }
15 | }
16 |
17 | allprojects {
18 | repositories {
19 | google()
20 | jcenter()
21 | google()
22 | }
23 | }
24 |
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
28 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | #org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
19 | STORE_FILE_PATH = STORE_FILE_PATH
20 | STORE_PASSWORD = STORE_PASSWORD
21 | KEY_ALIAS = KEY_ALIAS
22 | KEY_PASSWORD = KEY_PASSWORD
23 | android.enableR8=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dharmapoudel/samfix/beb14d0a0abd25bc4ea6805fbded68f7dd00b99c/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Thu Feb 13 22:02:44 EST 2020
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/screenshots/Screenshot_20200213-223500_SamFix.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dharmapoudel/samfix/beb14d0a0abd25bc4ea6805fbded68f7dd00b99c/screenshots/Screenshot_20200213-223500_SamFix.png
--------------------------------------------------------------------------------
/screenshots/Screenshot_20200213-223641_SamFix.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dharmapoudel/samfix/beb14d0a0abd25bc4ea6805fbded68f7dd00b99c/screenshots/Screenshot_20200213-223641_SamFix.png
--------------------------------------------------------------------------------
/screenshots/Screenshot_20200213-223649_SamFix.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dharmapoudel/samfix/beb14d0a0abd25bc4ea6805fbded68f7dd00b99c/screenshots/Screenshot_20200213-223649_SamFix.png
--------------------------------------------------------------------------------
/screenshots/screenshot.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dharmapoudel/samfix/beb14d0a0abd25bc4ea6805fbded68f7dd00b99c/screenshots/screenshot.jpg
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------