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

View File

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

View File

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

View File

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