More final keywords
This commit is contained in:
parent
d2ade5c69b
commit
c6c472402d
@ -165,13 +165,12 @@ public class AppDetails extends ActionBarActivity implements ProgressListener, A
|
|||||||
|
|
||||||
public ApkListAdapter(Context context, App app) {
|
public ApkListAdapter(Context context, App app) {
|
||||||
super(context, 0);
|
super(context, 0);
|
||||||
List<Apk> apks = ApkProvider.Helper.findByApp(context, app.id);
|
final List<Apk> apks = ApkProvider.Helper.findByApp(context, app.id);
|
||||||
for (Apk apk : apks) {
|
for (final Apk apk : apks) {
|
||||||
if (apk.compatible || Preferences.get().showIncompatibleVersions()) {
|
if (apk.compatible || Preferences.get().showIncompatibleVersions()) {
|
||||||
add(apk);
|
add(apk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getInstalledStatus(final Apk apk) {
|
private String getInstalledStatus(final Apk apk) {
|
||||||
|
@ -353,7 +353,7 @@ public class UpdateService extends IntentService implements ProgressListener {
|
|||||||
ArrayList<CharSequence> repoErrors = new ArrayList<CharSequence>();
|
ArrayList<CharSequence> repoErrors = new ArrayList<CharSequence>();
|
||||||
List<RepoUpdater.RepoUpdateRememberer> repoUpdateRememberers = new ArrayList<RepoUpdater.RepoUpdateRememberer>();
|
List<RepoUpdater.RepoUpdateRememberer> repoUpdateRememberers = new ArrayList<RepoUpdater.RepoUpdateRememberer>();
|
||||||
boolean changes = false;
|
boolean changes = false;
|
||||||
for (Repo repo : repos) {
|
for (final Repo repo : repos) {
|
||||||
|
|
||||||
if (!repo.inuse) {
|
if (!repo.inuse) {
|
||||||
disabledRepos.add(repo);
|
disabledRepos.add(repo);
|
||||||
@ -369,7 +369,7 @@ public class UpdateService extends IntentService implements ProgressListener {
|
|||||||
try {
|
try {
|
||||||
updater.update();
|
updater.update();
|
||||||
if (updater.hasChanged()) {
|
if (updater.hasChanged()) {
|
||||||
for (App app : updater.getApps()) {
|
for (final App app : updater.getApps()) {
|
||||||
appsToUpdate.put(app.id, app);
|
appsToUpdate.put(app.id, app);
|
||||||
}
|
}
|
||||||
apksToUpdate.addAll(updater.getApks());
|
apksToUpdate.addAll(updater.getApks());
|
||||||
@ -538,7 +538,7 @@ public class UpdateService extends IntentService implements ProgressListener {
|
|||||||
*/
|
*/
|
||||||
private List<String> getKnownAppIdsFromProvider(List<App> apps) {
|
private List<String> getKnownAppIdsFromProvider(List<App> apps) {
|
||||||
|
|
||||||
Uri uri = AppProvider.getContentUri(apps);
|
final Uri uri = AppProvider.getContentUri(apps);
|
||||||
String[] fields = new String[] { AppProvider.DataColumns.APP_ID };
|
String[] fields = new String[] { AppProvider.DataColumns.APP_ID };
|
||||||
Cursor cursor = getContentResolver().query(uri, fields, null, null, null);
|
Cursor cursor = getContentResolver().query(uri, fields, null, null, null);
|
||||||
|
|
||||||
@ -579,7 +579,7 @@ public class UpdateService extends IntentService implements ProgressListener {
|
|||||||
|
|
||||||
ArrayList<ContentProviderOperation> operations = new ArrayList<ContentProviderOperation>();
|
ArrayList<ContentProviderOperation> operations = new ArrayList<ContentProviderOperation>();
|
||||||
List<String> knownAppIds = getKnownAppIds(appsToUpdate);
|
List<String> knownAppIds = getKnownAppIds(appsToUpdate);
|
||||||
for (App a : appsToUpdate) {
|
for (final App a : appsToUpdate) {
|
||||||
boolean known = false;
|
boolean known = false;
|
||||||
for (String knownId : knownAppIds) {
|
for (String knownId : knownAppIds) {
|
||||||
if (knownId.equals(a.id)) {
|
if (knownId.equals(a.id)) {
|
||||||
@ -644,9 +644,9 @@ public class UpdateService extends IntentService implements ProgressListener {
|
|||||||
ArrayList<ContentProviderOperation> operations = new ArrayList<ContentProviderOperation>();
|
ArrayList<ContentProviderOperation> operations = new ArrayList<ContentProviderOperation>();
|
||||||
|
|
||||||
List<Apk> knownApks = getKnownApks(apksToUpdate);
|
List<Apk> knownApks = getKnownApks(apksToUpdate);
|
||||||
for (Apk apk : apksToUpdate) {
|
for (final Apk apk : apksToUpdate) {
|
||||||
boolean known = false;
|
boolean known = false;
|
||||||
for (Apk knownApk : knownApks) {
|
for (final Apk knownApk : knownApks) {
|
||||||
if (knownApk.id.equals(apk.id) && knownApk.vercode == apk.vercode) {
|
if (knownApk.id.equals(apk.id) && knownApk.vercode == apk.vercode) {
|
||||||
known = true;
|
known = true;
|
||||||
break;
|
break;
|
||||||
@ -671,13 +671,13 @@ public class UpdateService extends IntentService implements ProgressListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ContentProviderOperation updateExistingApk(Apk apk) {
|
private ContentProviderOperation updateExistingApk(final Apk apk) {
|
||||||
Uri uri = ApkProvider.getContentUri(apk);
|
Uri uri = ApkProvider.getContentUri(apk);
|
||||||
ContentValues values = apk.toContentValues();
|
ContentValues values = apk.toContentValues();
|
||||||
return ContentProviderOperation.newUpdate(uri).withValues(values).build();
|
return ContentProviderOperation.newUpdate(uri).withValues(values).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private ContentProviderOperation insertNewApk(Apk apk) {
|
private ContentProviderOperation insertNewApk(final Apk apk) {
|
||||||
ContentValues values = apk.toContentValues();
|
ContentValues values = apk.toContentValues();
|
||||||
Uri uri = ApkProvider.getContentUri();
|
Uri uri = ApkProvider.getContentUri();
|
||||||
return ContentProviderOperation.newInsert(uri).withValues(values).build();
|
return ContentProviderOperation.newInsert(uri).withValues(values).build();
|
||||||
@ -717,9 +717,9 @@ public class UpdateService extends IntentService implements ProgressListener {
|
|||||||
ApkProvider.DataColumns.VERSION,
|
ApkProvider.DataColumns.VERSION,
|
||||||
};
|
};
|
||||||
|
|
||||||
for (Repo repo : updatedRepos) {
|
for (final Repo repo : updatedRepos) {
|
||||||
List<Apk> existingApks = ApkProvider.Helper.findByRepo(this, repo, fields);
|
final List<Apk> existingApks = ApkProvider.Helper.findByRepo(this, repo, fields);
|
||||||
for (Apk existingApk : existingApks) {
|
for (final Apk existingApk : existingApks) {
|
||||||
if (!isApkToBeUpdated(existingApk, apksToUpdate)) {
|
if (!isApkToBeUpdated(existingApk, apksToUpdate)) {
|
||||||
toRemove.add(existingApk);
|
toRemove.add(existingApk);
|
||||||
}
|
}
|
||||||
@ -735,7 +735,7 @@ public class UpdateService extends IntentService implements ProgressListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isApkToBeUpdated(Apk existingApk, List<Apk> apksToUpdate) {
|
private static boolean isApkToBeUpdated(Apk existingApk, List<Apk> apksToUpdate) {
|
||||||
for (Apk apkToUpdate : apksToUpdate) {
|
for (final Apk apkToUpdate : apksToUpdate) {
|
||||||
if (apkToUpdate.vercode == existingApk.vercode && apkToUpdate.id.equals(existingApk.id)) {
|
if (apkToUpdate.vercode == existingApk.vercode && apkToUpdate.id.equals(existingApk.id)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -744,7 +744,7 @@ public class UpdateService extends IntentService implements ProgressListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void removeApksFromRepos(List<Repo> repos) {
|
private void removeApksFromRepos(List<Repo> repos) {
|
||||||
for (Repo repo : repos) {
|
for (final Repo repo : repos) {
|
||||||
Uri uri = ApkProvider.getRepoUri(repo.getId());
|
Uri uri = ApkProvider.getRepoUri(repo.getId());
|
||||||
int numDeleted = getContentResolver().delete(uri, null, null);
|
int numDeleted = getContentResolver().delete(uri, null, null);
|
||||||
Log.d("FDroid", "Removing " + numDeleted + " apks from repo " + repo.address);
|
Log.d("FDroid", "Removing " + numDeleted + " apks from repo " + repo.address);
|
||||||
|
@ -301,7 +301,7 @@ public class DBHelper extends SQLiteOpenHelper {
|
|||||||
}
|
}
|
||||||
db.execSQL("drop table " + TABLE_REPO);
|
db.execSQL("drop table " + TABLE_REPO);
|
||||||
db.execSQL(CREATE_TABLE_REPO);
|
db.execSQL(CREATE_TABLE_REPO);
|
||||||
for (Repo repo : oldrepos) {
|
for (final Repo repo : oldrepos) {
|
||||||
ContentValues values = new ContentValues();
|
ContentValues values = new ContentValues();
|
||||||
values.put("address", repo.address);
|
values.put("address", repo.address);
|
||||||
values.put("inuse", repo.inuse);
|
values.put("inuse", repo.inuse);
|
||||||
@ -373,7 +373,7 @@ public class DBHelper extends SQLiteOpenHelper {
|
|||||||
}
|
}
|
||||||
cursor.close();
|
cursor.close();
|
||||||
}
|
}
|
||||||
for (Repo repo : oldrepos) {
|
for (final Repo repo : oldrepos) {
|
||||||
ContentValues values = new ContentValues();
|
ContentValues values = new ContentValues();
|
||||||
values.put("fingerprint", Utils.calcFingerprint(repo.pubkey));
|
values.put("fingerprint", Utils.calcFingerprint(repo.pubkey));
|
||||||
db.update(TABLE_REPO, values, "address = ?", new String[] { repo.address });
|
db.update(TABLE_REPO, values, "address = ?", new String[] { repo.address });
|
||||||
|
@ -276,7 +276,7 @@ public class LocalRepoManager {
|
|||||||
|
|
||||||
public void copyIconsToRepo() {
|
public void copyIconsToRepo() {
|
||||||
ApplicationInfo appInfo;
|
ApplicationInfo appInfo;
|
||||||
for (App app : apps.values()) {
|
for (final App app : apps.values()) {
|
||||||
if (app.installedApk != null) {
|
if (app.installedApk != null) {
|
||||||
try {
|
try {
|
||||||
appInfo = pm.getApplicationInfo(app.id, PackageManager.GET_META_DATA);
|
appInfo = pm.getApplicationInfo(app.id, PackageManager.GET_META_DATA);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user