Simplify some code, mainly removing elses

This commit is contained in:
Daniel Martí 2015-12-07 21:19:48 +01:00
parent 9a0ba186e6
commit 62f6fd3d44
3 changed files with 9 additions and 10 deletions

View File

@ -268,12 +268,11 @@ public class RepoPersister {
} }
} }
if (toDelete.size() > 0) { if (toDelete.size() == 0) {
Uri uri = TempApkProvider.getApksUri(repo, toDelete);
return ContentProviderOperation.newDelete(uri).build();
} else {
return null; return null;
} }
Uri uri = TempApkProvider.getApksUri(repo, toDelete);
return ContentProviderOperation.newDelete(uri).build();
} }
/** /**

View File

@ -53,9 +53,11 @@ public class DownloaderFactory {
if (isBluetoothAddress(url)) { if (isBluetoothAddress(url)) {
String macAddress = url.getHost().replace("-", ":"); String macAddress = url.getHost().replace("-", ":");
return new BluetoothDownloader(context, macAddress, url, destFile); return new BluetoothDownloader(context, macAddress, url, destFile);
} else if (isOnionAddress(url)) { }
if (isOnionAddress(url)) {
return new TorHttpDownloader(context, url, destFile); return new TorHttpDownloader(context, url, destFile);
} else if (isLocalFile(url)) { }
if (isLocalFile(url)) {
return new LocalFileDownloader(context, url, destFile); return new LocalFileDownloader(context, url, destFile);
} }
return new HttpDownloader(context, url, destFile, username, password); return new HttpDownloader(context, url, destFile, username, password);

View File

@ -328,14 +328,12 @@ public class BluetoothServer extends Thread {
// Announce that the file server accepts partial content requests // Announce that the file server accepts partial content requests
private Response createResponse(NanoHTTPD.Response.Status status, String mimeType, String content) { private Response createResponse(NanoHTTPD.Response.Status status, String mimeType, String content) {
Response res = new Response(status.getRequestStatus(), mimeType, content); return new Response(status.getRequestStatus(), mimeType, content);
return res;
} }
// Announce that the file server accepts partial content requests // Announce that the file server accepts partial content requests
private Response createResponse(NanoHTTPD.Response.Status status, String mimeType, InputStream content) { private Response createResponse(NanoHTTPD.Response.Status status, String mimeType, InputStream content) {
Response res = new Response(status.getRequestStatus(), mimeType, content); return new Response(status.getRequestStatus(), mimeType, content);
return res;
} }
public static String getMimeTypeForFile(String uri) { public static String getMimeTypeForFile(String uri) {