Skip to content

Commit

Permalink
ERR: Minor error catching issues fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
VishalNehra committed May 1, 2017
1 parent 124c4ca commit 0b26e29
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 46 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ android {
applicationId "com.amaze.filemanager"
minSdkVersion 14
targetSdkVersion 25
versionCode 56
versionName "3.1.2 RC2"
versionCode 57
versionName "3.1.2 RC3"
}

signingConfigs {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2580,7 +2580,7 @@ public void onNewIntent(Intent i) {
if (failedOps != null) {
mainActivityHelper.showFailedOperationDialog(failedOps, i.getBooleanExtra("move", false), this);
}
} else if (intent.getCategories().contains(CLOUD_AUTHENTICATOR_GDRIVE)) {
} else if (i.getCategories() != null && i.getCategories().contains(CLOUD_AUTHENTICATOR_GDRIVE)) {

// we used an external authenticator instead of APIs. Probably for Google Drive
CloudRail.setAuthenticationResponse(intent);
Expand Down
4 changes: 2 additions & 2 deletions src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.amaze.filemanager"
android:versionCode="56"
android:versionName="3.1.2 RC2">
android:versionCode="57"
android:versionName="3.1.2 RC3">

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,48 +204,61 @@ public boolean onPreferenceClick(Preference preference) {
masterPasswordPreference.setEnabled(false);
}

// finger print sensor
final FingerprintManager fingerprintManager = (FingerprintManager)
getActivity().getSystemService(Context.FINGERPRINT_SERVICE);
final KeyguardManager keyguardManager = (KeyguardManager)
getActivity().getSystemService(Context.KEYGUARD_SERVICE);

CheckBox checkBx = (CheckBox) findPreference(PREFERENCE_CRYPT_FINGERPRINT);
CheckBox checkBoxFingerprint = (CheckBox) findPreference(PREFERENCE_CRYPT_FINGERPRINT);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && fingerprintManager.isHardwareDetected()) {
try {

checkBx.setEnabled(true);
}
// finger print sensor
final FingerprintManager fingerprintManager = (FingerprintManager)
getActivity().getSystemService(Context.FINGERPRINT_SERVICE);

checkBx.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
final KeyguardManager keyguardManager = (KeyguardManager)
getActivity().getSystemService(Context.KEYGUARD_SERVICE);

@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {

if (ActivityCompat.checkSelfPermission(getActivity(),
Manifest.permission.USE_FINGERPRINT) != PackageManager.PERMISSION_GRANTED) {
Toast.makeText(getActivity(),
getResources().getString(R.string.crypt_fingerprint_no_permission),
Toast.LENGTH_LONG).show();
return false;
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&
!fingerprintManager.hasEnrolledFingerprints()) {
Toast.makeText(getActivity(),
getResources().getString(R.string.crypt_fingerprint_not_enrolled),
Toast.LENGTH_LONG).show();
return false;
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&
!keyguardManager.isKeyguardSecure()) {
Toast.makeText(getActivity(),
getResources().getString(R.string.crypt_fingerprint_no_security),
Toast.LENGTH_LONG).show();
return false;
}

masterPasswordPreference.setEnabled(false);
return true;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && fingerprintManager.isHardwareDetected()) {

checkBoxFingerprint.setEnabled(true);
}
});

checkBoxFingerprint.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {

@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {

if (ActivityCompat.checkSelfPermission(getActivity(),
Manifest.permission.USE_FINGERPRINT) != PackageManager.PERMISSION_GRANTED) {
Toast.makeText(getActivity(),
getResources().getString(R.string.crypt_fingerprint_no_permission),
Toast.LENGTH_LONG).show();
return false;
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&
!fingerprintManager.hasEnrolledFingerprints()) {
Toast.makeText(getActivity(),
getResources().getString(R.string.crypt_fingerprint_not_enrolled),
Toast.LENGTH_LONG).show();
return false;
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&
!keyguardManager.isKeyguardSecure()) {
Toast.makeText(getActivity(),
getResources().getString(R.string.crypt_fingerprint_no_security),
Toast.LENGTH_LONG).show();
return false;
}

masterPasswordPreference.setEnabled(false);
return true;
}
});
} catch (NoClassDefFoundError error) {
error.printStackTrace();

// fingerprint manager class not defined in the framework
checkBoxFingerprint.setEnabled(false);
}


}

public static void restartPC(final Activity activity) {
Expand Down
18 changes: 14 additions & 4 deletions src/main/java/com/amaze/filemanager/ui/icons/IconHolder.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.media.ThumbnailUtils;
import android.os.Build;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
Expand Down Expand Up @@ -104,10 +105,19 @@ private synchronized void processResult(LoadResult result) {
for (Map.Entry<ImageView, String> entry : mRequests.entrySet()) {
final ImageView imageView = entry.getKey();
final String fso = entry.getValue();
if (Objects.equals(fso, result.fso)) {
imageView.setImageBitmap(result.result);
mRequests.remove(imageView);
break;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
if (Objects.equals(fso, result.fso)) {
imageView.setImageBitmap(result.result);
mRequests.remove(imageView);
break;
}
} else {
if (fso.equals(result.fso)) {

imageView.setImageBitmap(result.result);
mRequests.remove(imageView);
break;
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/res/values/translators.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<string name="vietnamese_translation_summary" translable="false" translatable="false">ngoisaosang</string>
<string name="japanese_translation_summary" translatable="false">Naofumi Fukue</string>
<string name="tamil_translation_summary" translatable="false">Kuralarasi for StarsSoft</string>
<string name="app_version" translatable="false">v3.1.2 RC2</string>
<string name="app_version" translatable="false">v3.1.2 RC3</string>
<string name="author_1" translatable="false">Arpit Khurana</string>
<string name="author_2" translatable="false">Vishal Nehra</string>
<string name="github" translatable="false">GitHub</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ public void onCreate(Bundle savedInstanceState) {
mainActivityHelper = new MainActivityHelper(this);
initialiseFab();

// TODO: Create proper SQLite database handler class with calls to database from background thread
history = new HistoryManager(this, "Table2");
history.initializeTable(DataUtils.HISTORY, 0);
history.initializeTable(DataUtils.HIDDEN, 0);
Expand Down Expand Up @@ -2719,10 +2720,11 @@ public void onNewIntent(Intent i) {
if (failedOps != null) {
mainActivityHelper.showFailedOperationDialog(failedOps, i.getBooleanExtra("move", false), this);
}
} else if (intent.getCategories().contains(CLOUD_AUTHENTICATOR_GDRIVE)) {
} else if (i.getCategories() != null && i.getCategories().contains(CLOUD_AUTHENTICATOR_GDRIVE)) {

// we used an external authenticator instead of APIs. Probably for Google Drive
CloudRail.setAuthenticationResponse(intent);

} else if ((openProcesses = i.getBooleanExtra(KEY_INTENT_PROCESS_VIEWER, false))) {
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.content_frame, new ProcessViewer(), KEY_INTENT_PROCESS_VIEWER);
Expand Down

0 comments on commit 0b26e29

Please sign in to comment.