Add some more final keywords

This commit is contained in:
Daniel Martí 2015-04-21 17:24:19 +02:00
parent cf4a1a436f
commit b84e8ef7d6
3 changed files with 19 additions and 19 deletions
F-Droid/src/org/fdroid/fdroid/data

@ -54,19 +54,19 @@ public class ApkProvider extends FDroidProvider {
public static int deleteApksByRepo(Context context, Repo repo) {
ContentResolver resolver = context.getContentResolver();
Uri uri = getRepoUri(repo.getId());
final Uri uri = getRepoUri(repo.getId());
return resolver.delete(uri, null, null);
}
public static void deleteApksByApp(Context context, App app) {
ContentResolver resolver = context.getContentResolver();
Uri uri = getAppUri(app.id);
final Uri uri = getAppUri(app.id);
resolver.delete(uri, null, null);
}
public static void deleteApks(Context context, List<Apk> apks) {
ContentResolver resolver = context.getContentResolver();
Uri uri = getContentUri(apks);
final Uri uri = getContentUri(apks);
resolver.delete(uri, null, null);
}
@ -76,7 +76,7 @@ public class ApkProvider extends FDroidProvider {
public static Apk find(Context context, String id, int versionCode, String[] projection) {
ContentResolver resolver = context.getContentResolver();
Uri uri = getContentUri(id, versionCode);
final Uri uri = getContentUri(id, versionCode);
Cursor cursor = resolver.query(uri, projection, null, null, null);
Apk apk = null;
if (cursor != null) {
@ -96,8 +96,8 @@ public class ApkProvider extends FDroidProvider {
public static List<Apk> findByApp(Context context,
String appId, String[] projection) {
ContentResolver resolver = context.getContentResolver();
Uri uri = getAppUri(appId);
String sort = ApkProvider.DataColumns.VERSION_CODE + " DESC";
final Uri uri = getAppUri(appId);
final String sort = ApkProvider.DataColumns.VERSION_CODE + " DESC";
Cursor cursor = resolver.query(uri, projection, null, null, sort);
return cursorToList(cursor);
}
@ -112,14 +112,14 @@ public class ApkProvider extends FDroidProvider {
return new ArrayList<>();
}
ContentResolver resolver = context.getContentResolver();
Uri uri = getContentUri(apks);
final Uri uri = getContentUri(apks);
Cursor cursor = resolver.query(uri, fields, null, null, null);
return cursorToList(cursor);
}
public static List<Apk> findByRepo(Context context, Repo repo, String[] fields) {
ContentResolver resolver = context.getContentResolver();
Uri uri = getRepoUri(repo.getId());
final Uri uri = getRepoUri(repo.getId());
Cursor cursor = resolver.query(uri, fields, null, null, null);
return cursorToList(cursor);
}
@ -244,7 +244,7 @@ public class ApkProvider extends FDroidProvider {
if (i != 0) {
builder.append(',');
}
Apk a = apks.get(i);
final Apk a = apks.get(i);
builder.append(a.id).append(':').append(a.vercode);
}
return getContentUri().buildUpon()
@ -392,7 +392,7 @@ public class ApkProvider extends FDroidProvider {
private static void removeRepoFields(ContentValues values) {
for (Map.Entry<String,String> repoField : REPO_FIELDS.entrySet()) {
String field = repoField.getKey();
final String field = repoField.getKey();
if (values.containsKey(field)) {
Log.i(TAG, "Cannot insert/update '" + field + "' field " +
"on apk table, as it belongs to the repo table. " +

@ -259,7 +259,7 @@ public class App extends ValueObject implements Comparable<App> {
this.name = (String) appInfo.loadLabel(pm);
SanitizedFile apkFile = SanitizedFile.knownSanitized(appInfo.publicSourceDir);
Apk apk = new Apk();
final Apk apk = new Apk();
apk.version = packageInfo.versionName;
apk.vercode = packageInfo.versionCode;
apk.hashType = "sha256";

@ -522,10 +522,10 @@ public class AppProvider extends FDroidProvider {
protected UriMatcher getMatcher() { return matcher; }
private AppQuerySelection queryCanUpdate() {
String ignoreCurrent = " fdroid_app.ignoreThisUpdate != fdroid_app.suggestedVercode ";
String ignoreAll = " fdroid_app.ignoreAllUpdates != 1 ";
String ignore = " ( " + ignoreCurrent + " AND " + ignoreAll + " ) ";
String where = ignore + " AND fdroid_app." + DataColumns.SUGGESTED_VERSION_CODE + " > installed.versionCode";
final String ignoreCurrent = " fdroid_app.ignoreThisUpdate != fdroid_app.suggestedVercode ";
final String ignoreAll = " fdroid_app.ignoreAllUpdates != 1 ";
final String ignore = " ( " + ignoreCurrent + " AND " + ignoreAll + " ) ";
final String where = ignore + " AND fdroid_app." + DataColumns.SUGGESTED_VERSION_CODE + " > installed.versionCode";
return new AppQuerySelection(where).requireNaturalInstalledTable();
}
@ -548,8 +548,8 @@ public class AppProvider extends FDroidProvider {
};
// Remove duplicates, surround in % for case insensitive searching
Set<String> keywordSet = new HashSet<>(Arrays.asList(query.split("\\s")));
String[] keywords = new String[keywordSet.size()];
final Set<String> keywordSet = new HashSet<>(Arrays.asList(query.split("\\s")));
final String[] keywords = new String[keywordSet.size()];
int iKeyword = 0;
for (final String keyword : keywordSet) {
keywords[iKeyword] = "%" + keyword + "%";
@ -557,8 +557,8 @@ public class AppProvider extends FDroidProvider {
}
// Build selection string and fill out keyword arguments
StringBuilder selection = new StringBuilder();
String[] selectionKeywords = new String[columns.length * keywords.length];
final StringBuilder selection = new StringBuilder();
final String[] selectionKeywords = new String[columns.length * keywords.length];
iKeyword = 0;
boolean firstColumn = true;
for (final String column : columns) {