Merge branch 'pmd-fixes' into 'master'

Pmd fixes



See merge request !188
This commit is contained in:
Peter Serwylo 2016-01-05 07:10:11 +00:00
commit 4ae5045568
4 changed files with 20 additions and 23 deletions

View File

@ -185,8 +185,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
return getString(R.string.app_not_installed); return getString(R.string.app_not_installed);
} }
// Definitely installed this version. // Definitely installed this version.
if (app.installedSig != null && apk.sig != null if (apk.sig != null && apk.sig.equals(app.installedSig)) {
&& apk.sig.equals(app.installedSig)) {
return getString(R.string.app_installed); return getString(R.string.app_installed);
} }
// Installed the same version, but from someplace else. // Installed the same version, but from someplace else.
@ -561,12 +560,10 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
@Override @Override
protected void onDestroy() { protected void onDestroy() {
if (downloadHandler != null) { if (downloadHandler != null && !inProcessOfChangingConfiguration) {
if (!inProcessOfChangingConfiguration) {
downloadHandler.cancel(false); downloadHandler.cancel(false);
cleanUpFinishedDownload(); cleanUpFinishedDownload();
} }
}
inProcessOfChangingConfiguration = false; inProcessOfChangingConfiguration = false;
super.onDestroy(); super.onDestroy();
} }
@ -1600,13 +1597,11 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
public void onClick(View v) { public void onClick(View v) {
App app = getApp(); App app = getApp();
AppDetails activity = (AppDetails) getActivity(); AppDetails activity = (AppDetails) getActivity();
if (updateWanted) { if (updateWanted && app.suggestedVercode > 0) {
if (app.suggestedVercode > 0) { Apk apkToInstall = ApkProvider.Helper.find(activity, app.packageName, app.suggestedVercode);
final Apk apkToInstall = ApkProvider.Helper.find(activity, app.packageName, app.suggestedVercode);
activity.install(apkToInstall); activity.install(apkToInstall);
return; return;
} }
}
if (installed) { if (installed) {
// If installed // If installed
if (activity.mPm.getLaunchIntentForPackage(app.packageName) != null) { if (activity.mPm.getLaunchIntentForPackage(app.packageName) != null) {

View File

@ -29,11 +29,10 @@ public class AppFilter {
return false; return false;
} }
if (!Preferences.get().filterAppsRequiringRoot()) { if (!Preferences.get().filterAppsRequiringRoot() &&
if (app.requirements.contains("root")) { app.requirements.contains("root")) {
return true; return true;
} }
}
return false; return false;
} }

View File

@ -662,14 +662,17 @@ public final class Utils {
} }
for (File f : files) { for (File f : files) {
if ((startsWith != null && f.getName().startsWith(startsWith)) if (startsWith != null && f.getName().startsWith(startsWith)) {
|| (endsWith != null && f.getName().endsWith(endsWith))) { continue;
}
if (endsWith != null && f.getName().endsWith(endsWith)) {
continue;
}
if (!f.delete()) { if (!f.delete()) {
Log.w(TAG, "Couldn't delete cache file " + f); Log.w(TAG, "Couldn't delete cache file " + f);
} }
} }
} }
}
public static void debugLog(String tag, String msg) { public static void debugLog(String tag, String msg) {
if (BuildConfig.DEBUG) { if (BuildConfig.DEBUG) {

View File

@ -146,7 +146,7 @@ public class Apk extends ValueObject implements Comparable<Apk> {
@Override @Override
public int compareTo(Apk apk) { public int compareTo(Apk apk) {
return Integer.valueOf(vercode).compareTo(apk.vercode); return Integer.compare(vercode, apk.vercode);
} }
} }