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();
|
||||
updateRepos();
|
||||
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
|
||||
|
@ -335,8 +335,8 @@ public final class Utils {
|
||||
|| keyHexString.matches(".*[^a-fA-F0-9].*")) {
|
||||
Log.e(TAG, "Signing key certificate was blank or contained a non-hex-digit!");
|
||||
return null;
|
||||
} else
|
||||
return calcFingerprint(Hasher.unhex(keyHexString));
|
||||
}
|
||||
return calcFingerprint(Hasher.unhex(keyHexString));
|
||||
}
|
||||
|
||||
public static String calcFingerprint(Certificate cert) {
|
||||
@ -385,7 +385,8 @@ public final class Utils {
|
||||
final String[] parts = languageTag.split("-");
|
||||
if (parts.length == 1) {
|
||||
return new Locale(parts[0]);
|
||||
} else if (parts.length == 2) {
|
||||
}
|
||||
if (parts.length == 2) {
|
||||
String country = parts[1];
|
||||
// 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
|
||||
@ -395,10 +396,9 @@ public final class Utils {
|
||||
country = country.substring(1);
|
||||
}
|
||||
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> {
|
||||
@ -411,23 +411,20 @@ public final class Utils {
|
||||
public static CommaSeparatedList make(List<String> list) {
|
||||
if (list == null || list.size() == 0)
|
||||
return null;
|
||||
else {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (i > 0) {
|
||||
sb.append(',');
|
||||
}
|
||||
sb.append(list.get(i));
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (i > 0) {
|
||||
sb.append(',');
|
||||
}
|
||||
return new CommaSeparatedList(sb.toString());
|
||||
sb.append(list.get(i));
|
||||
}
|
||||
return new CommaSeparatedList(sb.toString());
|
||||
}
|
||||
|
||||
public static CommaSeparatedList make(String list) {
|
||||
if (list == null || list.length() == 0)
|
||||
return null;
|
||||
else
|
||||
return new CommaSeparatedList(list);
|
||||
return new CommaSeparatedList(list);
|
||||
}
|
||||
|
||||
public static String str(CommaSeparatedList instance) {
|
||||
|
@ -12,9 +12,8 @@ public abstract class ClipboardCompat extends Compatibility {
|
||||
public static ClipboardCompat create(Context context) {
|
||||
if (hasApi(11)) {
|
||||
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) {
|
||||
if (hasApi(14)) {
|
||||
return new IceCreamSwitch(context);
|
||||
} else {
|
||||
return new OldSwitch(context);
|
||||
}
|
||||
return new OldSwitch(context);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -120,9 +120,8 @@ public class NewRepoConfig {
|
||||
public Uri getRepoUri() {
|
||||
if (uriString == null) {
|
||||
return null;
|
||||
} else {
|
||||
return Uri.parse(uriString);
|
||||
}
|
||||
return Uri.parse(uriString);
|
||||
}
|
||||
|
||||
public String getHost() { return host; }
|
||||
|
@ -185,9 +185,8 @@ public class LocalRepoManager {
|
||||
if (dir.exists()) {
|
||||
if (dir.isDirectory()) {
|
||||
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()) {
|
||||
|
@ -135,10 +135,9 @@ public class ApkDownloader implements AsyncDownloadWrapper.Listener {
|
||||
if (hashMatches()) {
|
||||
Log.d(TAG, "Using cached apk at " + localFile);
|
||||
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;
|
||||
}
|
||||
|
@ -11,18 +11,16 @@ public class DownloaderFactory {
|
||||
throws IOException {
|
||||
if (isOnionAddress(url)) {
|
||||
return new TorHttpDownloader(url, context);
|
||||
} else {
|
||||
return new HttpDownloader(url, context);
|
||||
}
|
||||
return new HttpDownloader(url, context);
|
||||
}
|
||||
|
||||
public static Downloader create(String url, File destFile)
|
||||
throws IOException {
|
||||
if (isOnionAddress(url)) {
|
||||
return new TorHttpDownloader(url, destFile);
|
||||
} else {
|
||||
return new HttpDownloader(url, destFile);
|
||||
}
|
||||
return new HttpDownloader(url, destFile);
|
||||
}
|
||||
|
||||
private static boolean isOnionAddress(String url) {
|
||||
|
@ -98,9 +98,8 @@ public class LocalHTTPD extends NanoHTTPD {
|
||||
}
|
||||
|
||||
return handlePost(session);
|
||||
} else {
|
||||
return handleGet(session);
|
||||
}
|
||||
return handleGet(session);
|
||||
}
|
||||
|
||||
private Response handlePost(IHTTPSession session) {
|
||||
@ -110,10 +109,9 @@ public class LocalHTTPD extends NanoHTTPD {
|
||||
if (!session.getParms().containsKey("repo")) {
|
||||
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.");
|
||||
} 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("");
|
||||
}
|
||||
|
@ -162,8 +162,7 @@ public class MDnsHelper implements ServiceListener {
|
||||
InetAddress[] addresses = serviceInfo.getInetAddresses();
|
||||
if (addresses != null && addresses.length > 0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -41,9 +41,8 @@ abstract public class RepoUpdater {
|
||||
public static RepoUpdater createUpdaterFor(Context ctx, Repo repo) {
|
||||
if (repo.fingerprint == null && repo.pubkey == null) {
|
||||
return new UnsignedRepoUpdater(ctx, repo);
|
||||
} else {
|
||||
return new SignedRepoUpdater(ctx, repo);
|
||||
}
|
||||
return new SignedRepoUpdater(ctx, repo);
|
||||
}
|
||||
|
||||
protected final Context context;
|
||||
|
@ -129,10 +129,9 @@ abstract public class AppListFragment extends ThemeableListFragment implements
|
||||
prefs.edit().putBoolean(TRIED_EMPTY_UPDATE, true).commit();
|
||||
UpdateService.updateNow(getActivity());
|
||||
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
|
||||
|
@ -137,9 +137,8 @@ public class SwapActivity extends ActionBarActivity implements SwapProcessManage
|
||||
if (Preferences.get().showNfcDuringSwap() && nfcMessageReady) {
|
||||
showFragment(new NfcSwapFragment(), STATE_NFC);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void showBluetooth() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user