Merge branch 'studio-fixes' into 'master'

Studio fixes



See merge request !351
This commit is contained in:
Daniel Martí 2016-07-07 19:34:01 +00:00
commit 0adca3ff2c
16 changed files with 42 additions and 48 deletions

View File

@ -217,7 +217,7 @@ public final class Preferences implements SharedPreferences.OnSharedPreferenceCh
return preferences.getBoolean(PREF_USE_TOR, false);
}
public boolean isProxyEnabled() {
private boolean isProxyEnabled() {
return preferences.getBoolean(PREF_ENABLE_PROXY, DEFAULT_ENABLE_PROXY);
}

View File

@ -159,15 +159,15 @@ public class UpdateService extends IntentService {
LocalBroadcastManager.getInstance(this).unregisterReceiver(updateStatusReceiver);
}
protected static void sendStatus(Context context, int statusCode) {
private static void sendStatus(Context context, int statusCode) {
sendStatus(context, statusCode, null, -1);
}
protected static void sendStatus(Context context, int statusCode, String message) {
private static void sendStatus(Context context, int statusCode, String message) {
sendStatus(context, statusCode, message, -1);
}
protected static void sendStatus(Context context, int statusCode, String message, int progress) {
private static void sendStatus(Context context, int statusCode, String message, int progress) {
Intent intent = new Intent(LOCAL_ACTION_STATUS);
intent.putExtra(EXTRA_STATUS_CODE, statusCode);
if (!TextUtils.isEmpty(message)) {
@ -177,7 +177,7 @@ public class UpdateService extends IntentService {
LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
}
protected void sendRepoErrorStatus(int statusCode, ArrayList<CharSequence> repoErrors) {
private void sendRepoErrorStatus(int statusCode, ArrayList<CharSequence> repoErrors) {
Intent intent = new Intent(LOCAL_ACTION_STATUS);
intent.putExtra(EXTRA_STATUS_CODE, statusCode);
intent.putExtra(EXTRA_REPO_ERRORS, repoErrors.toArray(new CharSequence[repoErrors.size()]));

View File

@ -177,7 +177,7 @@ public class Apk extends ValueObject implements Comparable<Apk> {
*
* see https://gitlab.com/fdroid/fdroidserver/blob/master/fdroidserver/update.py#L535#
*/
public static String fdroidToAndroidPermission(String permission) {
private static String fdroidToAndroidPermission(String permission) {
if (!permission.contains(".")) {
return "android.permission." + permission;
}

View File

@ -32,7 +32,7 @@ import org.fdroid.fdroid.Utils;
* SEARCH TABLE fdroid_apk AS suggestedApk USING INDEX sqlite_autoindex_fdroid_apk_1 (appId=? AND vercode=?)
* USE TEMP B-TREE FOR ORDER BY
*/
public class LoggingQuery {
final class LoggingQuery {
private static final long SLOW_QUERY_DURATION = 100;
private static final String TAG = "Slow Query";
@ -41,7 +41,7 @@ public class LoggingQuery {
private final String query;
private final String[] queryArgs;
public LoggingQuery(SQLiteDatabase db, String query, String[] queryArgs) {
private LoggingQuery(SQLiteDatabase db, String query, String[] queryArgs) {
this.db = db;
this.query = query;
this.queryArgs = queryArgs;
@ -51,7 +51,7 @@ public class LoggingQuery {
* When running a debug build, this will log details (including query plans) for any query which
* takes longer than {@link LoggingQuery#SLOW_QUERY_DURATION}.
*/
public Cursor rawQuery() {
private Cursor rawQuery() {
if (BuildConfig.DEBUG) {
long startTime = System.currentTimeMillis();
Cursor cursor = db.rawQuery(query, queryArgs);
@ -61,9 +61,8 @@ public class LoggingQuery {
logSlowQuery(queryDuration);
}
return cursor;
} else {
return db.rawQuery(query, queryArgs);
}
return db.rawQuery(query, queryArgs);
}
/**

View File

@ -1,15 +1,15 @@
package org.fdroid.fdroid.data;
public class OrderClause {
class OrderClause {
public final String expression;
private final String expression;
private String[] args;
public OrderClause(String expression) {
OrderClause(String expression) {
this.expression = expression;
}
public OrderClause(String field, String[] args, boolean isAscending) {
OrderClause(String field, String[] args, boolean isAscending) {
this.expression = field + " " + (isAscending ? "ASC" : "DESC");
this.args = args;
}
@ -22,4 +22,4 @@ public class OrderClause {
public String[] getArgs() {
return args;
}
}
}

View File

@ -4,6 +4,7 @@ import android.support.annotation.Nullable;
import android.text.TextUtils;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
abstract class QueryBuilder {
@ -91,16 +92,12 @@ abstract class QueryBuilder {
List<String> args = new ArrayList<>();
if (selectionArgs != null) {
for (String arg : selectionArgs) {
args.add(arg);
}
Collections.addAll(args, selectionArgs);
}
for (OrderClause orderBy : orderBys) {
if (orderBy.getArgs() != null) {
for (String arg : orderBy.getArgs()) {
args.add(arg);
}
Collections.addAll(args, orderBy.getArgs());
}
}
@ -147,9 +144,8 @@ abstract class QueryBuilder {
private String orderBySql() {
if (orderBys.size() == 0) {
return "";
} else {
return " ORDER BY " + TextUtils.join(", ", orderBys);
}
return " ORDER BY " + TextUtils.join(", ", orderBys);
}
private String groupBySql() {

View File

@ -41,11 +41,11 @@ public class QuerySelection {
return selection;
}
public boolean hasSelection() {
private boolean hasSelection() {
return !TextUtils.isEmpty(selection);
}
public boolean hasArgs() {
private boolean hasArgs() {
return args != null && args.length > 0;
}

View File

@ -44,7 +44,7 @@ import java.io.IOException;
*/
public class ApkFileProvider extends FileProvider {
public static final String AUTHORITY = "org.fdroid.fdroid.installer.ApkFileProvider";
private static final String AUTHORITY = "org.fdroid.fdroid.installer.ApkFileProvider";
/**
* Copies the APK into private data directory of F-Droid and returns a "file" or "content" Uri

View File

@ -37,7 +37,7 @@ import java.util.HashSet;
* displayed to the user. This is especially important in case an unattended installer
* has been used which displays permissions before download.
*/
public class ApkVerifier {
class ApkVerifier {
private static final String TAG = "ApkVerifier";
@ -107,11 +107,11 @@ public class ApkVerifier {
public static class ApkVerificationException extends Exception {
public ApkVerificationException(String message) {
ApkVerificationException(String message) {
super(message);
}
public ApkVerificationException(Throwable cause) {
ApkVerificationException(Throwable cause) {
super(cause);
}
}

View File

@ -91,16 +91,15 @@ public abstract class Installer {
}
int count = newPermissionCount(apk);
if (count > 0) {
Uri uri = ApkProvider.getContentUri(apk);
Intent intent = new Intent(context, InstallConfirmActivity.class);
intent.setData(uri);
return intent;
} else {
if (count == 0) {
// no permission screen needed!
return null;
}
Uri uri = ApkProvider.getContentUri(apk);
Intent intent = new Intent(context, InstallConfirmActivity.class);
intent.setData(uri);
return intent;
}
private int newPermissionCount(Apk apk) {

View File

@ -58,8 +58,8 @@ public final class LocalRepoKeyStore {
private static final String TAG = "LocalRepoKeyStore";
public static final String INDEX_CERT_ALIAS = "fdroid";
public static final String HTTP_CERT_ALIAS = "https";
private static final String INDEX_CERT_ALIAS = "fdroid";
private static final String HTTP_CERT_ALIAS = "https";
private static final String DEFAULT_SIG_ALG = "SHA1withRSA";
private static final String DEFAULT_KEY_ALGO = "RSA";

View File

@ -68,7 +68,7 @@ import rx.schedulers.Schedulers;
public class SwapService extends Service {
private static final String TAG = "SwapService";
public static final String SHARED_PREFERENCES = "swap-state";
private static final String SHARED_PREFERENCES = "swap-state";
private static final String KEY_APPS_TO_SWAP = "appsToSwap";
private static final String KEY_BLUETOOTH_ENABLED = "bluetoothEnabled";
private static final String KEY_WIFI_ENABLED = "wifiEnabled";

View File

@ -32,8 +32,8 @@ public abstract class Downloader {
public final File outputFile;
protected final URL sourceUrl;
protected String cacheTag;
final URL sourceUrl;
String cacheTag;
/**
* For sending download progress, should only be called in {@link #progressTask}
@ -74,7 +74,7 @@ public abstract class Downloader {
this.cacheTag = cacheTag;
}
protected boolean wantToCheckCache() {
boolean wantToCheckCache() {
return cacheTag != null;
}
@ -86,7 +86,7 @@ public abstract class Downloader {
public abstract boolean isCached();
protected void downloadFromStream(int bufferSize, boolean resumable) throws IOException, InterruptedException {
void downloadFromStream(int bufferSize, boolean resumable) throws IOException, InterruptedException {
Utils.debugLog(TAG, "Downloading from stream");
InputStream input = null;
OutputStream outputStream = new FileOutputStream(outputFile, resumable);

View File

@ -195,7 +195,7 @@ public class DownloaderService extends Service {
* @param intent The {@link Intent} passed via {@link
* android.content.Context#startService(Intent)}.
*/
protected void handleIntent(Intent intent) {
private void handleIntent(Intent intent) {
final Uri uri = intent.getData();
final SanitizedFile localFile = ApkCache.getApkDownloadPath(this, uri);
sendBroadcast(uri, Downloader.ACTION_STARTED, localFile);
@ -300,7 +300,7 @@ public class DownloaderService extends Service {
/**
* Check if a URL is actively being downloaded.
*/
public static boolean isActive(String urlString) {
private static boolean isActive(String urlString) {
return downloader != null && TextUtils.equals(urlString, downloader.sourceUrl.toString());
}

View File

@ -56,7 +56,7 @@ import org.fdroid.fdroid.data.Schema;
*/
public class InstallConfirmActivity extends FragmentActivity implements OnCancelListener, OnClickListener {
public static final int RESULT_CANNOT_PARSE = RESULT_FIRST_USER + 1;
private static final int RESULT_CANNOT_PARSE = RESULT_FIRST_USER + 1;
private Intent intent;

View File

@ -155,7 +155,7 @@ public class RepoDetailsActivity extends ActionBarActivity {
setIntent(i);
}
void processIntent(Intent i) {
private void processIntent(Intent i) {
if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(i.getAction())) {
Parcelable[] rawMsgs =
i.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES);