Drop unnecessary elses after returns
This commit is contained in:
parent
e1a6e2386f
commit
5e7146d19a
@ -400,10 +400,9 @@ public class FDroid extends ActionBarActivity {
|
|||||||
getPreferences(MODE_PRIVATE).edit().putBoolean(TRIED_EMPTY_UPDATE, true).commit();
|
getPreferences(MODE_PRIVATE).edit().putBoolean(TRIED_EMPTY_UPDATE, true).commit();
|
||||||
updateRepos();
|
updateRepos();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
|
||||||
Log.d(TAG, "Empty app list, but it looks like we've had an update previously. Will not force repo update.");
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
Log.d(TAG, "Empty app list, but it looks like we've had an update previously. Will not force repo update.");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Force a repo update now. A progress dialog is shown and the UpdateService
|
// Force a repo update now. A progress dialog is shown and the UpdateService
|
||||||
|
@ -335,8 +335,8 @@ public final class Utils {
|
|||||||
|| keyHexString.matches(".*[^a-fA-F0-9].*")) {
|
|| keyHexString.matches(".*[^a-fA-F0-9].*")) {
|
||||||
Log.e(TAG, "Signing key certificate was blank or contained a non-hex-digit!");
|
Log.e(TAG, "Signing key certificate was blank or contained a non-hex-digit!");
|
||||||
return null;
|
return null;
|
||||||
} else
|
}
|
||||||
return calcFingerprint(Hasher.unhex(keyHexString));
|
return calcFingerprint(Hasher.unhex(keyHexString));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String calcFingerprint(Certificate cert) {
|
public static String calcFingerprint(Certificate cert) {
|
||||||
@ -385,7 +385,8 @@ public final class Utils {
|
|||||||
final String[] parts = languageTag.split("-");
|
final String[] parts = languageTag.split("-");
|
||||||
if (parts.length == 1) {
|
if (parts.length == 1) {
|
||||||
return new Locale(parts[0]);
|
return new Locale(parts[0]);
|
||||||
} else if (parts.length == 2) {
|
}
|
||||||
|
if (parts.length == 2) {
|
||||||
String country = parts[1];
|
String country = parts[1];
|
||||||
// Some languages have an "r" before the country as per the values folders, such
|
// Some languages have an "r" before the country as per the values folders, such
|
||||||
// as "zh-rCN". As far as the Locale class is concerned, the "r" is
|
// as "zh-rCN". As far as the Locale class is concerned, the "r" is
|
||||||
@ -395,10 +396,9 @@ public final class Utils {
|
|||||||
country = country.substring(1);
|
country = country.substring(1);
|
||||||
}
|
}
|
||||||
return new Locale(parts[0], country);
|
return new Locale(parts[0], country);
|
||||||
} else {
|
|
||||||
Log.e(TAG, "Locale could not be parsed from language tag: " + languageTag);
|
|
||||||
return new Locale(languageTag);
|
|
||||||
}
|
}
|
||||||
|
Log.e(TAG, "Locale could not be parsed from language tag: " + languageTag);
|
||||||
|
return new Locale(languageTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class CommaSeparatedList implements Iterable<String> {
|
public static class CommaSeparatedList implements Iterable<String> {
|
||||||
@ -411,23 +411,20 @@ public final class Utils {
|
|||||||
public static CommaSeparatedList make(List<String> list) {
|
public static CommaSeparatedList make(List<String> list) {
|
||||||
if (list == null || list.size() == 0)
|
if (list == null || list.size() == 0)
|
||||||
return null;
|
return null;
|
||||||
else {
|
StringBuilder sb = new StringBuilder();
|
||||||
StringBuilder sb = new StringBuilder();
|
for (int i = 0; i < list.size(); i++) {
|
||||||
for (int i = 0; i < list.size(); i++) {
|
if (i > 0) {
|
||||||
if (i > 0) {
|
sb.append(',');
|
||||||
sb.append(',');
|
|
||||||
}
|
|
||||||
sb.append(list.get(i));
|
|
||||||
}
|
}
|
||||||
return new CommaSeparatedList(sb.toString());
|
sb.append(list.get(i));
|
||||||
}
|
}
|
||||||
|
return new CommaSeparatedList(sb.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CommaSeparatedList make(String list) {
|
public static CommaSeparatedList make(String list) {
|
||||||
if (list == null || list.length() == 0)
|
if (list == null || list.length() == 0)
|
||||||
return null;
|
return null;
|
||||||
else
|
return new CommaSeparatedList(list);
|
||||||
return new CommaSeparatedList(list);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String str(CommaSeparatedList instance) {
|
public static String str(CommaSeparatedList instance) {
|
||||||
|
@ -12,9 +12,8 @@ public abstract class ClipboardCompat extends Compatibility {
|
|||||||
public static ClipboardCompat create(Context context) {
|
public static ClipboardCompat create(Context context) {
|
||||||
if (hasApi(11)) {
|
if (hasApi(11)) {
|
||||||
return new HoneycombClipboard(context);
|
return new HoneycombClipboard(context);
|
||||||
} else {
|
|
||||||
return new OldClipboard();
|
|
||||||
}
|
}
|
||||||
|
return new OldClipboard();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,9 +19,8 @@ public abstract class SwitchCompat extends Compatibility {
|
|||||||
public static SwitchCompat create(Context context) {
|
public static SwitchCompat create(Context context) {
|
||||||
if (hasApi(14)) {
|
if (hasApi(14)) {
|
||||||
return new IceCreamSwitch(context);
|
return new IceCreamSwitch(context);
|
||||||
} else {
|
|
||||||
return new OldSwitch(context);
|
|
||||||
}
|
}
|
||||||
|
return new OldSwitch(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -120,9 +120,8 @@ public class NewRepoConfig {
|
|||||||
public Uri getRepoUri() {
|
public Uri getRepoUri() {
|
||||||
if (uriString == null) {
|
if (uriString == null) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
|
||||||
return Uri.parse(uriString);
|
|
||||||
}
|
}
|
||||||
|
return Uri.parse(uriString);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getHost() { return host; }
|
public String getHost() { return host; }
|
||||||
|
@ -185,9 +185,8 @@ public class LocalRepoManager {
|
|||||||
if (dir.exists()) {
|
if (dir.exists()) {
|
||||||
if (dir.isDirectory()) {
|
if (dir.isDirectory()) {
|
||||||
return;
|
return;
|
||||||
} else {
|
|
||||||
throw new IOException("Can't make directory " + dir + " - it is already a file.");
|
|
||||||
}
|
}
|
||||||
|
throw new IOException("Can't make directory " + dir + " - it is already a file.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dir.mkdir()) {
|
if (!dir.mkdir()) {
|
||||||
|
@ -135,10 +135,9 @@ public class ApkDownloader implements AsyncDownloadWrapper.Listener {
|
|||||||
if (hashMatches()) {
|
if (hashMatches()) {
|
||||||
Log.d(TAG, "Using cached apk at " + localFile);
|
Log.d(TAG, "Using cached apk at " + localFile);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
|
||||||
Log.d(TAG, "Not using cached apk at " + localFile);
|
|
||||||
deleteLocalFile();
|
|
||||||
}
|
}
|
||||||
|
Log.d(TAG, "Not using cached apk at " + localFile);
|
||||||
|
deleteLocalFile();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -11,18 +11,16 @@ public class DownloaderFactory {
|
|||||||
throws IOException {
|
throws IOException {
|
||||||
if (isOnionAddress(url)) {
|
if (isOnionAddress(url)) {
|
||||||
return new TorHttpDownloader(url, context);
|
return new TorHttpDownloader(url, context);
|
||||||
} else {
|
|
||||||
return new HttpDownloader(url, context);
|
|
||||||
}
|
}
|
||||||
|
return new HttpDownloader(url, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Downloader create(String url, File destFile)
|
public static Downloader create(String url, File destFile)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
if (isOnionAddress(url)) {
|
if (isOnionAddress(url)) {
|
||||||
return new TorHttpDownloader(url, destFile);
|
return new TorHttpDownloader(url, destFile);
|
||||||
} else {
|
|
||||||
return new HttpDownloader(url, destFile);
|
|
||||||
}
|
}
|
||||||
|
return new HttpDownloader(url, destFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isOnionAddress(String url) {
|
private static boolean isOnionAddress(String url) {
|
||||||
|
@ -98,9 +98,8 @@ public class LocalHTTPD extends NanoHTTPD {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return handlePost(session);
|
return handlePost(session);
|
||||||
} else {
|
|
||||||
return handleGet(session);
|
|
||||||
}
|
}
|
||||||
|
return handleGet(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Response handlePost(IHTTPSession session) {
|
private Response handlePost(IHTTPSession session) {
|
||||||
@ -110,10 +109,9 @@ public class LocalHTTPD extends NanoHTTPD {
|
|||||||
if (!session.getParms().containsKey("repo")) {
|
if (!session.getParms().containsKey("repo")) {
|
||||||
Log.e(TAG, "Malformed /request-swap request to local repo HTTP server. Should have posted a 'repo' parameter." );
|
Log.e(TAG, "Malformed /request-swap request to local repo HTTP server. Should have posted a 'repo' parameter." );
|
||||||
return new Response(Response.Status.BAD_REQUEST, MIME_PLAINTEXT, "Requires 'repo' parameter to be posted.");
|
return new Response(Response.Status.BAD_REQUEST, MIME_PLAINTEXT, "Requires 'repo' parameter to be posted.");
|
||||||
} else {
|
|
||||||
requestSwap(session.getParms().get("repo"));
|
|
||||||
return new Response(Response.Status.OK, MIME_PLAINTEXT, "Swap request received.");
|
|
||||||
}
|
}
|
||||||
|
requestSwap(session.getParms().get("repo"));
|
||||||
|
return new Response(Response.Status.OK, MIME_PLAINTEXT, "Swap request received.");
|
||||||
}
|
}
|
||||||
return new Response("");
|
return new Response("");
|
||||||
}
|
}
|
||||||
|
@ -162,8 +162,7 @@ public class MDnsHelper implements ServiceListener {
|
|||||||
InetAddress[] addresses = serviceInfo.getInetAddresses();
|
InetAddress[] addresses = serviceInfo.getInetAddresses();
|
||||||
if (addresses != null && addresses.length > 0)
|
if (addresses != null && addresses.length > 0)
|
||||||
return true;
|
return true;
|
||||||
else
|
return false;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -41,9 +41,8 @@ abstract public class RepoUpdater {
|
|||||||
public static RepoUpdater createUpdaterFor(Context ctx, Repo repo) {
|
public static RepoUpdater createUpdaterFor(Context ctx, Repo repo) {
|
||||||
if (repo.fingerprint == null && repo.pubkey == null) {
|
if (repo.fingerprint == null && repo.pubkey == null) {
|
||||||
return new UnsignedRepoUpdater(ctx, repo);
|
return new UnsignedRepoUpdater(ctx, repo);
|
||||||
} else {
|
|
||||||
return new SignedRepoUpdater(ctx, repo);
|
|
||||||
}
|
}
|
||||||
|
return new SignedRepoUpdater(ctx, repo);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final Context context;
|
protected final Context context;
|
||||||
|
@ -129,10 +129,9 @@ abstract public class AppListFragment extends ThemeableListFragment implements
|
|||||||
prefs.edit().putBoolean(TRIED_EMPTY_UPDATE, true).commit();
|
prefs.edit().putBoolean(TRIED_EMPTY_UPDATE, true).commit();
|
||||||
UpdateService.updateNow(getActivity());
|
UpdateService.updateNow(getActivity());
|
||||||
return true;
|
return true;
|
||||||
} else {
|
|
||||||
Log.d(TAG, "Empty app list, but it looks like we've had an update previously. Will not force repo update.");
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
Log.d(TAG, "Empty app list, but it looks like we've had an update previously. Will not force repo update.");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -137,9 +137,8 @@ public class SwapActivity extends ActionBarActivity implements SwapProcessManage
|
|||||||
if (Preferences.get().showNfcDuringSwap() && nfcMessageReady) {
|
if (Preferences.get().showNfcDuringSwap() && nfcMessageReady) {
|
||||||
showFragment(new NfcSwapFragment(), STATE_NFC);
|
showFragment(new NfcSwapFragment(), STATE_NFC);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showBluetooth() {
|
private void showBluetooth() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user