Skip to content

Commit

Permalink
removed google library, minor bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
marcolettieri committed Jan 4, 2021
1 parent 83439b6 commit 28096fc
Show file tree
Hide file tree
Showing 15 changed files with 51 additions and 88 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,3 @@ local.properties
ehthumbs.db
Thumbs.db
cert
keystore.properties
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
10 changes: 3 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ android {
signingConfigs {
config {
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
}
}
compileSdkVersion 30
Expand All @@ -22,8 +20,8 @@ android {
applicationId "com.ml.proximitysensorfix"
minSdkVersion 16
targetSdkVersion 30
versionCode 24
versionName "1.0.2"
versionCode 26
versionName "1.0.4"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
signingConfig signingConfigs.config
Expand All @@ -42,16 +40,14 @@ android {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.navigation:navigation-fragment:2.3.2'
implementation 'androidx.navigation:navigation-ui:2.3.2'
implementation 'com.stepstone.stepper:material-stepper:4.3.1'
implementation 'com.google.android.play:core:1.9.0'
implementation 'com.google.android.play:core-ktx:1.8.1'
implementation 'com.github.judemanutd:autostarter:1.0.8'
}
repositories {
mavenCentral()
Expand Down
Binary file modified app/release/app-release.apk
Binary file not shown.
4 changes: 2 additions & 2 deletions app/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"properties": [],
"versionCode": 24,
"versionName": "1.0.2",
"versionCode": 26,
"versionName": "1.0.4",
"enabled": true,
"outputFile": "app-release.apk"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,17 @@
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
import android.widget.Button;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.AppCompatCheckBox;
import androidx.appcompat.widget.Toolbar;

import com.google.android.play.core.review.ReviewInfo;
import com.google.android.play.core.review.ReviewManager;
import com.google.android.play.core.review.ReviewManagerFactory;
import com.google.android.play.core.tasks.OnCompleteListener;
import com.google.android.play.core.tasks.Task;
import com.ml.proximitysensorfix.service.LockAccessibilityService;
import com.ml.proximitysensorfix.service.ProximitySensorService;
import com.ml.proximitysensorfix.R;
import com.ml.proximitysensorfix.receiver.AdminReceiver;
import com.ml.proximitysensorfix.service.ProximitySensorService;

public class MainActivity extends AppCompatActivity {
private static boolean isIntentResolved(Context ctx, Intent intent) {
Expand Down Expand Up @@ -125,57 +117,26 @@ public boolean onCreateOptionsMenu(Menu menu) {

private void askForReview(){
try {
if(System.currentTimeMillis()-prefs.getLong("lastAskReview",0L)>(7*24*60*60*1000)) {
if(!prefs.getBoolean("hasReviewed",false) && System.currentTimeMillis()-prefs.getLong("lastAskReview",0L)>(7*24*60*60*1000)) {
prefs.edit().putLong("lastAskReview", System.currentTimeMillis()).apply();
final ReviewManager manager = ReviewManagerFactory.create(this);
Task<ReviewInfo> request = manager.requestReviewFlow();
request.addOnCompleteListener(new OnCompleteListener<ReviewInfo>() {
@Override
public void onComplete(@NonNull Task<ReviewInfo> task) {
try {
if (task.isSuccessful()) {
// We can get the ReviewInfo object
ReviewInfo reviewInfo = task.getResult();
Task<Void> flow = manager.launchReviewFlow(MainActivity.this, reviewInfo);
flow.addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
runOnUiThread(new Runnable() {
@Override
public void run() {
try {
final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(MainActivity.this);
// set title
alertDialogBuilder.setTitle("Thanks!!!");
// set dialog message
alertDialogBuilder
.setCancelable(false)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {

}
});
alertDialogBuilder.show();
} catch (Exception ignored) {

}
}
});
}
});
} else {
if (task.getException() != null)
task.getException().printStackTrace();
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(MainActivity.this);
alertDialogBuilder.setTitle(R.string.reviewApp);
alertDialogBuilder
.setCancelable(false)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
OpenAppInPlayStore();
prefs.edit().putBoolean("hasReviewed", true).apply();
}
} catch (Exception ex) {
ex.printStackTrace();
}
}).setNeutralButton(R.string.annulla, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
alertDialogBuilder.show();
}
}catch (Exception ignored){
OpenAppInPlayStore();

}
}
public boolean onOptionsItemSelected(MenuItem item) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import android.widget.Button;
import android.widget.TextView;

import com.judemanutd.autostarter.AutoStartPermissionHelper;
import com.ml.proximitysensorfix.R;
import com.ml.proximitysensorfix.utils.RomUtils;
import com.ml.proximitysensorfix.activity.MainActivity;
Expand Down Expand Up @@ -106,7 +107,7 @@ public void onClick(View v) {

}
});
} else {
} else {
stepText.setText(R.string.admin_description);
stepButton.setOnClickListener(new View.OnClickListener() {
@Override
Expand All @@ -128,9 +129,10 @@ public void onClick(View v) {
stepButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

try {
if(Build.BRAND.equalsIgnoreCase("xiaomi") || MainActivity.isMIUI(getActivity())){
if(AutoStartPermissionHelper.getInstance().isAutoStartPermissionAvailable(getActivity())){
AutoStartPermissionHelper.getInstance().getAutoStartPermission(getActivity());
} else if(Build.BRAND.equalsIgnoreCase("xiaomi") || MainActivity.isMIUI(getActivity())){
Intent intent = new Intent();
intent.setComponent(new ComponentName("com.miui.securitycenter", "com.miui.permcenter.autostart.AutoStartManagementActivity"));
startActivityForResult(intent, 2);
Expand Down Expand Up @@ -163,22 +165,22 @@ else if(Build.BRAND.equalsIgnoreCase("Honor")){
stepButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
if(getContext()!=null) {
Intent intent = new Intent();
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
Uri uri = Uri.fromParts("package", getContext().getPackageName(), null);
intent.setData(uri);
startActivity(intent);
}
verified=true;
PermissionsActivity.goNext();

} catch (Exception e) {
e.printStackTrace();
verified=true;
PermissionsActivity.goNext();
}
try {
if(getContext()!=null) {
Intent intent = new Intent();
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
Uri uri = Uri.fromParts("package", getContext().getPackageName(), null);
intent.setData(uri);
startActivity(intent);
}
verified=true;
PermissionsActivity.goNext();

} catch (Exception e) {
e.printStackTrace();
verified=true;
PermissionsActivity.goNext();
}

}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ private void lockNow() {
event.setClassName(LockAccessibilityService.class.getName());
event.getText().add(getString(R.string.accessibility_service_text));
accessibilityService.sendAccessibilityEvent(event);
} else {
} else if(devicePolicyManager.isAdminActive(new ComponentName(this, AdminReceiver.class))){
devicePolicyManager.lockNow();
}
}
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-it-rIT/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@
<string name="retry">Riprova</string>
<string name="disable_battery_optimization">Disabilita le ottimizzazioni della batteria per evitare che il sistema operativo chiuda l\'app in background</string>
<string name="accesibilty_description">Questa app necessita dell\'autorizzazione all\'accessibilità per bloccare lo schermo durante la chiamata, scegli ProximitySensorFix dall\'elenco e abilita le funzionalità di Accessibilità</string>
<string name="annulla">Annulla</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@
<string name="disable_battery_optimization">Disable MIUI battery optimization to prevent the app is closed from OS</string>
<string name="accessibility_service_text" translatable="false">WaveUp Lock Command</string>
<string name="accesibilty_description" >This app need accessibility permission to block screen during call, select ProximitySensorFix from the list and enable Accessibility features</string>
<string name="annulla">Not Now</string>
</resources>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<androidx.constraintlayout>
<constraintlayout-solver versions="1.1.0,1.1.1,1.1.2,1.1.3,2.0.0-alpha1,2.0.0-alpha2,2.0.0-alpha3,2.0.0-alpha4,2.0.0-alpha5,2.0.0-beta1,2.0.0-beta2,2.0.0-beta3,2.0.0-beta4,2.0.0-beta5,2.0.0-beta6,2.0.0-beta7,2.0.0-beta8,2.0.0-rc1,2.0.0,2.0.1,2.0.2,2.0.3,2.0.4"/>
<constraintlayout versions="1.1.0,1.1.1,1.1.2,1.1.3,2.0.0-alpha1,2.0.0-alpha2,2.0.0-alpha3,2.0.0-alpha4,2.0.0-alpha5,2.0.0-beta1,2.0.0-beta2,2.0.0-beta3,2.0.0-beta4,2.0.0-beta5,2.0.0-beta6,2.0.0-beta7,2.0.0-beta8,2.0.0-rc1,2.0.0,2.0.1,2.0.2,2.0.3,2.0.4,2.1.0-alpha1"/>
<constraintlayout-core versions="1.0.0-alpha1,1.0.0-alpha2"/>
<constraintlayout versions="1.1.0,1.1.1,1.1.2,1.1.3,2.0.0-alpha1,2.0.0-alpha2,2.0.0-alpha3,2.0.0-alpha4,2.0.0-alpha5,2.0.0-beta1,2.0.0-beta2,2.0.0-beta3,2.0.0-beta4,2.0.0-beta5,2.0.0-beta6,2.0.0-beta7,2.0.0-beta8,2.0.0-rc1,2.0.0,2.0.1,2.0.2,2.0.3,2.0.4,2.1.0-alpha1,2.1.0-alpha2"/>
<constraintlayout-core versions="1.0.0-alpha1,1.0.0-alpha2,1.0.0-alpha3"/>
</androidx.constraintlayout>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<androidx.navigation>
<navigation-common versions="2.0.0-rc02,2.0.0,2.1.0-alpha01,2.1.0-alpha02,2.1.0-alpha03,2.1.0-alpha04,2.1.0-alpha05,2.1.0-alpha06,2.1.0-beta01,2.1.0-beta02,2.1.0-rc01,2.1.0,2.2.0-alpha01,2.2.0-alpha02,2.2.0-alpha03,2.2.0-beta01,2.2.0-rc01,2.2.0-rc02,2.2.0-rc03,2.2.0-rc04,2.2.0,2.2.1,2.2.2,2.3.0-alpha01,2.3.0-alpha02,2.3.0-alpha03,2.3.0-alpha04,2.3.0-alpha05,2.3.0-alpha06,2.3.0-beta01,2.3.0-rc01,2.3.0,2.3.1,2.3.2"/>
<navigation-common-ktx versions="2.0.0-rc02,2.0.0,2.1.0-alpha01,2.1.0-alpha02,2.1.0-alpha03,2.1.0-alpha04,2.1.0-alpha05,2.1.0-alpha06,2.1.0-beta01,2.1.0-beta02,2.1.0-rc01,2.1.0,2.2.0-alpha01,2.2.0-alpha02,2.2.0-alpha03,2.2.0-beta01,2.2.0-rc01,2.2.0-rc02,2.2.0-rc03,2.2.0-rc04,2.2.0,2.2.1,2.2.2,2.3.0-alpha01,2.3.0-alpha02,2.3.0-alpha03,2.3.0-alpha04,2.3.0-alpha05,2.3.0-alpha06,2.3.0-beta01,2.3.0-rc01,2.3.0,2.3.1,2.3.2"/>
<navigation-compose versions="1.0.0-alpha01,1.0.0-alpha02,1.0.0-alpha03"/>
<navigation-compose versions="1.0.0-alpha01,1.0.0-alpha02,1.0.0-alpha03,1.0.0-alpha04"/>
<navigation-dynamic-features-fragment versions="2.3.0-alpha01,2.3.0-alpha02,2.3.0-alpha03,2.3.0-alpha04,2.3.0-alpha05,2.3.0-alpha06,2.3.0-beta01,2.3.0-rc01,2.3.0,2.3.1,2.3.2"/>
<navigation-dynamic-features-runtime versions="2.3.0-alpha01,2.3.0-alpha02,2.3.0-alpha03,2.3.0-alpha04,2.3.0-alpha05,2.3.0-alpha06,2.3.0-beta01,2.3.0-rc01,2.3.0,2.3.1,2.3.2"/>
<navigation-fragment versions="2.0.0-rc02,2.0.0,2.1.0-alpha01,2.1.0-alpha02,2.1.0-alpha03,2.1.0-alpha04,2.1.0-alpha05,2.1.0-alpha06,2.1.0-beta01,2.1.0-beta02,2.1.0-rc01,2.1.0,2.2.0-alpha01,2.2.0-alpha02,2.2.0-alpha03,2.2.0-beta01,2.2.0-rc01,2.2.0-rc02,2.2.0-rc03,2.2.0-rc04,2.2.0,2.2.1,2.2.2,2.3.0-alpha01,2.3.0-alpha02,2.3.0-alpha03,2.3.0-alpha04,2.3.0-alpha05,2.3.0-alpha06,2.3.0-beta01,2.3.0-rc01,2.3.0,2.3.1,2.3.2"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
<com.google.android.material>
<compose-theme-adapter versions="0.1.0-dev16,0.1.0-dev17,1.0.0-alpha01,1.0.0-alpha02,1.0.0-alpha03,1.0.0-alpha04,1.0.0-alpha05,1.0.0-alpha06,1.0.0-alpha07,1.0.0-alpha08"/>
<material versions="1.0.0-alpha1,1.0.0-alpha3,1.0.0-beta01,1.0.0-rc01,1.0.0-rc02,1.0.0,1.1.0-alpha01,1.1.0-alpha02,1.1.0-alpha03,1.1.0-alpha04,1.1.0-alpha05,1.1.0-alpha06,1.1.0-alpha07,1.1.0-alpha08,1.1.0-alpha09,1.1.0-alpha10,1.1.0-beta01,1.1.0-beta02,1.1.0-rc01,1.1.0-rc02,1.1.0,1.2.0-alpha01,1.2.0-alpha02,1.2.0-alpha03,1.2.0-alpha04,1.2.0-alpha05,1.2.0-alpha06,1.2.0-beta01,1.2.0-rc01,1.2.0,1.2.1,1.3.0-alpha01,1.3.0-alpha02,1.3.0-alpha03,1.3.0-alpha04"/>
<compose-theme-adapter versions="0.1.0-dev16,0.1.0-dev17,1.0.0-alpha01,1.0.0-alpha02,1.0.0-alpha03,1.0.0-alpha04,1.0.0-alpha05,1.0.0-alpha06,1.0.0-alpha07,1.0.0-alpha08,1.0.0-alpha09"/>
<material versions="1.0.0-alpha1,1.0.0-alpha3,1.0.0-beta01,1.0.0-rc01,1.0.0-rc02,1.0.0,1.1.0-alpha01,1.1.0-alpha02,1.1.0-alpha03,1.1.0-alpha04,1.1.0-alpha05,1.1.0-alpha06,1.1.0-alpha07,1.1.0-alpha08,1.1.0-alpha09,1.1.0-alpha10,1.1.0-beta01,1.1.0-beta02,1.1.0-rc01,1.1.0-rc02,1.1.0,1.2.0-alpha01,1.2.0-alpha02,1.2.0-alpha03,1.2.0-alpha04,1.2.0-alpha05,1.2.0-alpha06,1.2.0-beta01,1.2.0-rc01,1.2.0,1.2.1,1.3.0-alpha01,1.3.0-alpha02,1.3.0-alpha03,1.3.0-alpha04,1.3.0-beta01"/>
</com.google.android.material>
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
<com.google.ads.interactivemedia.v3/>
<com.google.android.ads/>
<com.google.android.ads.consent/>
<com.google.android.apps.common.testing.accessibility.framework/>
<com.google.android.datatransport/>
<com.google.android.games/>
<com.google.android.gms/>
Expand Down
2 changes: 2 additions & 0 deletions keystore.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
storeFile=../cert
keyAlias =proximitysensorfix

0 comments on commit 28096fc

Please sign in to comment.