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

View File

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

View File

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

View File

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