More final keywords
This commit is contained in:
parent
05aa6a39fa
commit
9e82463e46
@ -864,7 +864,7 @@ public class AppDetails extends ActionBarActivity implements ProgressListener, A
|
||||
// Install the version of this app denoted by 'app.curApk'.
|
||||
@Override
|
||||
public void install(final Apk apk) {
|
||||
String[] projection = { RepoProvider.DataColumns.ADDRESS };
|
||||
final String[] projection = { RepoProvider.DataColumns.ADDRESS };
|
||||
Repo repo = RepoProvider.Helper.findById(this, apk.repo, projection);
|
||||
if (repo == null || repo.address == null) {
|
||||
return;
|
||||
|
@ -580,7 +580,7 @@ public class UpdateService extends IntentService implements ProgressListener {
|
||||
private List<String> getKnownAppIdsFromProvider(List<App> apps) {
|
||||
|
||||
final Uri uri = AppProvider.getContentUri(apps);
|
||||
String[] fields = { AppProvider.DataColumns.APP_ID };
|
||||
final String[] fields = { AppProvider.DataColumns.APP_ID };
|
||||
Cursor cursor = getContentResolver().query(uri, fields, null, null, null);
|
||||
|
||||
int knownIdCount = cursor != null ? cursor.getCount() : 0;
|
||||
@ -608,7 +608,7 @@ public class UpdateService extends IntentService implements ProgressListener {
|
||||
* @see org.fdroid.fdroid.UpdateService#getKnownAppIds(java.util.List)
|
||||
*/
|
||||
private List<Apk> getKnownApksFromProvider(List<Apk> apks) {
|
||||
String[] fields = {
|
||||
final String[] fields = {
|
||||
ApkProvider.DataColumns.APK_ID,
|
||||
ApkProvider.DataColumns.VERSION,
|
||||
ApkProvider.DataColumns.VERSION_CODE
|
||||
@ -744,7 +744,7 @@ public class UpdateService extends IntentService implements ProgressListener {
|
||||
long startTime = System.currentTimeMillis();
|
||||
List<Apk> toRemove = new ArrayList<>();
|
||||
|
||||
String[] fields = {
|
||||
final String[] fields = {
|
||||
ApkProvider.DataColumns.APK_ID,
|
||||
ApkProvider.DataColumns.VERSION_CODE,
|
||||
ApkProvider.DataColumns.VERSION,
|
||||
|
@ -99,7 +99,7 @@ public class FileCompat {
|
||||
|
||||
// The "file" must be a sanitized file, and hence only contain A-Za-z0-9.-_ already,
|
||||
// but it makes no assurances about the parent directory.
|
||||
String[] args = {
|
||||
final String[] args = {
|
||||
"/system/bin/chmod",
|
||||
mode,
|
||||
file.getAbsolutePath()
|
||||
|
@ -300,14 +300,14 @@ public class ApkProvider extends FDroidProvider {
|
||||
}
|
||||
|
||||
private QuerySelection queryApp(String appId) {
|
||||
String selection = DataColumns.APK_ID + " = ? ";
|
||||
String[] args = { appId };
|
||||
final String selection = DataColumns.APK_ID + " = ? ";
|
||||
final String[] args = { appId };
|
||||
return new QuerySelection(selection, args);
|
||||
}
|
||||
|
||||
private QuerySelection querySingle(Uri uri) {
|
||||
String selection = " vercode = ? and id = ? ";
|
||||
String[] args = {
|
||||
final String selection = " vercode = ? and id = ? ";
|
||||
final String[] args = {
|
||||
// First (0th) path segment is the word "apk",
|
||||
// and we are not interested in it.
|
||||
uri.getPathSegments().get(1),
|
||||
@ -317,14 +317,14 @@ public class ApkProvider extends FDroidProvider {
|
||||
}
|
||||
|
||||
private QuerySelection queryRepo(long repoId) {
|
||||
String selection = DataColumns.REPO_ID + " = ? ";
|
||||
String[] args = { Long.toString(repoId) };
|
||||
final String selection = DataColumns.REPO_ID + " = ? ";
|
||||
final String[] args = { Long.toString(repoId) };
|
||||
return new QuerySelection(selection, args);
|
||||
}
|
||||
|
||||
private QuerySelection queryApks(String apkKeys) {
|
||||
String[] apkDetails = apkKeys.split(",");
|
||||
String[] args = new String[apkDetails.length * 2];
|
||||
final String[] apkDetails = apkKeys.split(",");
|
||||
final String[] args = new String[apkDetails.length * 2];
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (apkDetails.length > MAX_APKS_TO_QUERY) {
|
||||
throw new IllegalArgumentException(
|
||||
|
@ -527,8 +527,8 @@ public class AppProvider extends FDroidProvider {
|
||||
}
|
||||
|
||||
private AppQuerySelection queryRepo(long repoId) {
|
||||
String selection = " fdroid_apk.repo = ? ";
|
||||
String[] args = { String.valueOf(repoId) };
|
||||
final String selection = " fdroid_apk.repo = ? ";
|
||||
final String[] args = { String.valueOf(repoId) };
|
||||
return new AppQuerySelection(selection, args);
|
||||
}
|
||||
|
||||
@ -582,13 +582,13 @@ public class AppProvider extends FDroidProvider {
|
||||
}
|
||||
|
||||
private AppQuerySelection querySingle(String id) {
|
||||
String selection = "fdroid_app.id = ?";
|
||||
String[] args = { id };
|
||||
final String selection = "fdroid_app.id = ?";
|
||||
final String[] args = { id };
|
||||
return new AppQuerySelection(selection, args);
|
||||
}
|
||||
|
||||
private AppQuerySelection queryIgnored() {
|
||||
String selection = "fdroid_app.ignoreAllUpdates = 1 OR " +
|
||||
final String selection = "fdroid_app.ignoreAllUpdates = 1 OR " +
|
||||
"fdroid_app.ignoreThisUpdate >= fdroid_app.suggestedVercode";
|
||||
return new AppQuerySelection(selection);
|
||||
}
|
||||
@ -597,31 +597,31 @@ public class AppProvider extends FDroidProvider {
|
||||
// fdroid_repo will have null fields if the LEFT JOIN didn't resolve, e.g. due to there
|
||||
// being no apks for the app in the result set. In that case, we can't tell if it is from
|
||||
// a swap repo or not.
|
||||
String selection = " fdroid_repo.isSwap = 0 OR fdroid_repo.isSwap is null ";
|
||||
final String selection = " fdroid_repo.isSwap = 0 OR fdroid_repo.isSwap is null ";
|
||||
return new AppQuerySelection(selection);
|
||||
}
|
||||
|
||||
private AppQuerySelection queryNewlyAdded() {
|
||||
String selection = "fdroid_app.added > ?";
|
||||
String[] args = { Utils.DATE_FORMAT.format(Preferences.get().calcMaxHistory()) };
|
||||
final String selection = "fdroid_app.added > ?";
|
||||
final String[] args = { Utils.DATE_FORMAT.format(Preferences.get().calcMaxHistory()) };
|
||||
return new AppQuerySelection(selection, args);
|
||||
}
|
||||
|
||||
private AppQuerySelection queryRecentlyUpdated() {
|
||||
String selection = "fdroid_app.added != fdroid_app.lastUpdated AND fdroid_app.lastUpdated > ?";
|
||||
String[] args = { Utils.DATE_FORMAT.format(Preferences.get().calcMaxHistory()) };
|
||||
final String selection = "fdroid_app.added != fdroid_app.lastUpdated AND fdroid_app.lastUpdated > ?";
|
||||
final String[] args = { Utils.DATE_FORMAT.format(Preferences.get().calcMaxHistory()) };
|
||||
return new AppQuerySelection(selection, args);
|
||||
}
|
||||
|
||||
private AppQuerySelection queryCategory(String category) {
|
||||
// TODO: In the future, add a new table for categories,
|
||||
// so we can join onto it.
|
||||
String selection =
|
||||
final String selection =
|
||||
" fdroid_app.categories = ? OR " + // Only category e.g. "internet"
|
||||
" fdroid_app.categories LIKE ? OR " + // First category e.g. "internet,%"
|
||||
" fdroid_app.categories LIKE ? OR " + // Last category e.g. "%,internet"
|
||||
" fdroid_app.categories LIKE ? "; // One of many categories e.g. "%,internet,%"
|
||||
String[] args = {
|
||||
final String[] args = {
|
||||
category,
|
||||
category + ",%",
|
||||
"%," + category,
|
||||
@ -924,7 +924,7 @@ public class AppProvider extends FDroidProvider {
|
||||
Log.d(TAG, "Using icon dir '"+iconsDir+"'");
|
||||
String repoVersion = Integer.toString(Repo.VERSION_DENSITY_SPECIFIC_ICONS);
|
||||
String query = getIconUpdateQuery();
|
||||
String[] params = { repoVersion, iconsDir };
|
||||
final String[] params = { repoVersion, iconsDir };
|
||||
write().execSQL(query, params);
|
||||
}
|
||||
|
||||
|
@ -111,7 +111,7 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||
private void populateRepoNames(SQLiteDatabase db, int oldVersion) {
|
||||
if (oldVersion < 37) {
|
||||
Log.i(TAG, "Populating repo names from the url");
|
||||
String[] columns = { "address", "_id" };
|
||||
final String[] columns = { "address", "_id" };
|
||||
Cursor cursor = db.query(TABLE_REPO, columns,
|
||||
"name IS NULL OR name = ''", null, null, null, null);
|
||||
if (cursor != null) {
|
||||
@ -123,7 +123,7 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||
ContentValues values = new ContentValues(1);
|
||||
String name = Repo.addressToName(address);
|
||||
values.put("name", name);
|
||||
String[] args = { Long.toString(id) };
|
||||
final String[] args = { Long.toString(id) };
|
||||
Log.i(TAG, "Setting repo name to '" + name + "' for repo " + address);
|
||||
db.update(TABLE_REPO, values, "_id = ?", args);
|
||||
cursor.moveToNext();
|
||||
|
@ -68,7 +68,7 @@ public class RepoProvider extends FDroidProvider {
|
||||
String[] projection) {
|
||||
ContentResolver resolver = context.getContentResolver();
|
||||
Uri uri = RepoProvider.getContentUri();
|
||||
String[] args = { fieldValue };
|
||||
final String[] args = { fieldValue };
|
||||
Cursor cursor = resolver.query(
|
||||
uri, projection, fieldName + " = ?", args, null);
|
||||
return cursorToList(cursor);
|
||||
@ -190,7 +190,7 @@ public class RepoProvider extends FDroidProvider {
|
||||
|
||||
public static int countAppsForRepo(Context context, long repoId) {
|
||||
ContentResolver resolver = context.getContentResolver();
|
||||
String[] projection = { ApkProvider.DataColumns._COUNT_DISTINCT_ID };
|
||||
final String[] projection = { ApkProvider.DataColumns._COUNT_DISTINCT_ID };
|
||||
Uri apkUri = ApkProvider.getRepoUri(repoId);
|
||||
Cursor cursor = resolver.query(apkUri, projection, null, null, null);
|
||||
int count = 0;
|
||||
|
@ -614,7 +614,7 @@ public class ManageReposActivity extends ActionBarActivity {
|
||||
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
|
||||
Uri uri = RepoProvider.allExceptSwapUri();
|
||||
Log.i(TAG, "Creating repo loader '" + uri + "'.");
|
||||
String[] projection = {
|
||||
final String[] projection = {
|
||||
RepoProvider.DataColumns._ID,
|
||||
RepoProvider.DataColumns.NAME,
|
||||
RepoProvider.DataColumns.PUBLIC_KEY,
|
||||
|
Loading…
x
Reference in New Issue
Block a user