Browse Source

Very light code cleanup.

pull/465/head
Eric Kok 6 years ago
parent
commit
988c786892
  1. 34
      app/src/main/java/org/transdroid/daemon/Daemon.java
  2. 5
      app/src/main/java/org/transdroid/daemon/DaemonException.java
  3. 2
      app/src/main/java/org/transdroid/daemon/DaemonMethod.java

34
app/src/main/java/org/transdroid/daemon/Daemon.java

@ -302,12 +302,14 @@ public enum Daemon { @@ -302,12 +302,14 @@ public enum Daemon {
}
public static boolean supportsAvailability(Daemon type) {
return type == uTorrent || type == BitTorrent || type == DLinkRouterBT || type == Transmission || type == Vuze || type == BuffaloNas || type == Dummy;
return type == uTorrent || type == BitTorrent || type == DLinkRouterBT || type == Transmission || type == Vuze || type == BuffaloNas
|| type == Dummy;
}
public static boolean supportsFileListing(Daemon type) {
return type == Synology || type == Transmission || type == uTorrent || type == BitTorrent || type == KTorrent || type == Deluge || type == DelugeRpc
|| type == rTorrent || type == Vuze || type == DLinkRouterBT || type == Bitflu || type == qBittorrent || type == BuffaloNas || type == BitComet || type == Aria2 || type == tTorrent || type == Dummy;
return type == Synology || type == Transmission || type == uTorrent || type == BitTorrent || type == KTorrent || type == Deluge
|| type == DelugeRpc || type == rTorrent || type == Vuze || type == DLinkRouterBT || type == Bitflu || type == qBittorrent
|| type == BuffaloNas || type == BitComet || type == Aria2 || type == tTorrent || type == Dummy;
}
public static boolean supportsFineDetails(Daemon type) {
@ -339,7 +341,8 @@ public enum Daemon { @@ -339,7 +341,8 @@ public enum Daemon {
public static boolean supportsSetTransferRates(Daemon type) {
return type == Deluge || type == DelugeRpc
|| type == Transmission || type == uTorrent || type == BitTorrent || type == rTorrent || type == Vuze || type == BuffaloNas || type == BitComet || type == Aria2 || type == qBittorrent || type == Dummy;
|| type == Transmission || type == uTorrent || type == BitTorrent || type == rTorrent || type == Vuze || type == BuffaloNas
|| type == BitComet || type == Aria2 || type == qBittorrent || type == Dummy;
}
public static boolean supportsAddByFile(Daemon type) {
@ -349,26 +352,31 @@ public enum Daemon { @@ -349,26 +352,31 @@ public enum Daemon {
public static boolean supportsAddByMagnetUrl(Daemon type) {
return type == uTorrent || type == BitTorrent || type == Transmission || type == Synology || type == Deluge || type == DelugeRpc
|| type == Bitflu || type == KTorrent || type == rTorrent || type == qBittorrent || type == BitComet || type == Aria2 || type == tTorrent || type == Dummy;
|| type == Bitflu || type == KTorrent || type == rTorrent || type == qBittorrent || type == BitComet || type == Aria2
|| type == tTorrent || type == Dummy;
}
public static boolean supportsRemoveWithData(Daemon type) {
return type == uTorrent || type == Vuze || type == Transmission || type == Deluge || type == DelugeRpc
|| type == BitTorrent || type == Tfb4rt || type == DLinkRouterBT || type == Bitflu || type == qBittorrent || type == BuffaloNas || type == BitComet || type == rTorrent || type == Aria2 || type == tTorrent || type == Dummy;
|| type == BitTorrent || type == Tfb4rt || type == DLinkRouterBT || type == Bitflu || type == qBittorrent || type == BuffaloNas
|| type == BitComet || type == rTorrent || type == Aria2 || type == tTorrent || type == Dummy;
}
public static boolean supportsFilePrioritySetting(Daemon type) {
return type == BitTorrent || type == uTorrent || type == Transmission || type == KTorrent || type == rTorrent || type == Vuze || type == Deluge || type == DelugeRpc
return type == BitTorrent || type == uTorrent || type == Transmission || type == KTorrent || type == rTorrent || type == Vuze
|| type == Deluge || type == DelugeRpc
|| type == qBittorrent || type == tTorrent || type == Dummy;
}
public static boolean supportsDateAdded(Daemon type) {
return type == Vuze || type == Transmission || type == rTorrent || type == Bitflu || type == BitComet || type == uTorrent || type == BitTorrent || type == Deluge || type == DelugeRpc
return type == Vuze || type == Transmission || type == rTorrent || type == Bitflu || type == BitComet || type == uTorrent
|| type == BitTorrent || type == Deluge || type == DelugeRpc
|| type == qBittorrent || type == Dummy;
}
public static boolean supportsLabels(Daemon type) {
return type == uTorrent || type == BitTorrent || type == Deluge || type == DelugeRpc || type == BitComet || type == rTorrent || type == qBittorrent || type == Dummy;
return type == uTorrent || type == BitTorrent || type == Deluge || type == DelugeRpc || type == BitComet || type == rTorrent
|| type == qBittorrent || type == Dummy;
}
public static boolean supportsSetLabel(Daemon type) {
@ -389,18 +397,16 @@ public enum Daemon { @@ -389,18 +397,16 @@ public enum Daemon {
}
public static boolean supportsForceRecheck(Daemon type) {
return type == uTorrent || type == BitTorrent || type == Deluge || type == DelugeRpc || type == rTorrent || type == Transmission || type == Dummy || type == qBittorrent;
return type == uTorrent || type == BitTorrent || type == Deluge || type == DelugeRpc || type == rTorrent || type == Transmission
|| type == Dummy || type == qBittorrent;
}
public static boolean supportsExtraPassword(Daemon type) {
return type == Deluge || type == Aria2;
}
public static boolean supportsUsernameForHttp(Daemon type) {
return type == Deluge || type == Aria2;
}
public static boolean supportsRemoteRssManagement(Daemon type) {
return type == uTorrent || type == DelugeRpc;
}
}

5
app/src/main/java/org/transdroid/daemon/DaemonException.java

@ -18,6 +18,8 @@ @@ -18,6 +18,8 @@
package org.transdroid.daemon;
import android.support.annotation.NonNull;
/**
* An exception thrown when an error occurs inside a server daemon adapter.
* The error message is from a resource string ID, since this can be
@ -40,7 +42,7 @@ public class DaemonException extends Exception { @@ -40,7 +42,7 @@ public class DaemonException extends Exception {
ParsingFailed,
AuthenticationFailure,
NotConnected,
FileAccessError;
FileAccessError
}
public DaemonException(ExceptionType internalException, String message) {
@ -52,6 +54,7 @@ public class DaemonException extends Exception { @@ -52,6 +54,7 @@ public class DaemonException extends Exception {
return internalException;
}
@NonNull
@Override
public String toString() {
return internalException.toString() + " exception: " + getMessage();

2
app/src/main/java/org/transdroid/daemon/DaemonMethod.java

@ -47,7 +47,7 @@ public enum DaemonMethod { @@ -47,7 +47,7 @@ public enum DaemonMethod {
ForceRecheck (22);
private int code;
private static final Map<Integer,DaemonMethod> lookup = new HashMap<Integer,DaemonMethod>();
private static final Map<Integer,DaemonMethod> lookup = new HashMap<>();
static {
for(DaemonMethod s : EnumSet.allOf(DaemonMethod.class))

Loading…
Cancel
Save