Translatable names for plugins, for use in the UI.

This commit is contained in:
akwizgran
2012-11-06 13:54:19 +00:00
parent 91f4967124
commit 2eb943ee2a
8 changed files with 42 additions and 10 deletions

View File

@@ -11,6 +11,9 @@ public interface Plugin {
/** Returns the plugin's transport identifier. */ /** Returns the plugin's transport identifier. */
TransportId getId(); TransportId getId();
/** Returns a label for looking up the plugin's translated name. */
String getName();
/** Starts the plugin. */ /** Starts the plugin. */
void start() throws IOException; void start() throws IOException;

View File

@@ -73,6 +73,10 @@ class BluetoothPlugin implements DuplexPlugin {
return ID; return ID;
} }
public String getName() {
return "BLUETOOTH_PLUGIN_NAME";
}
public void start() throws IOException { public void start() throws IOException {
// Initialise the Bluetooth stack // Initialise the Bluetooth stack
try { try {

View File

@@ -85,6 +85,11 @@ class DroidtoothPlugin implements DuplexPlugin {
return ID; return ID;
} }
public String getName() {
// Share a name with the J2SE Bluetooth plugin
return "BLUETOOTH_PLUGIN_NAME";
}
public void start() throws IOException { public void start() throws IOException {
// BluetoothAdapter.getDefaultAdapter() must be called on a thread // BluetoothAdapter.getDefaultAdapter() must be called on a thread
// with a message queue, so submit it to the AndroidExecutor // with a message queue, so submit it to the AndroidExecutor

View File

@@ -66,6 +66,10 @@ class GmailPlugin implements SimplexPlugin {
return ID; return ID;
} }
public String getName() {
return "GMAIL_PLUGIN_NAME";
}
public void start() throws IOException { public void start() throws IOException {
pluginExecutor.execute(new Runnable() { pluginExecutor.execute(new Runnable() {
public void run() { public void run() {

View File

@@ -44,6 +44,10 @@ implements RemovableDriveMonitor.Callback {
return ID; return ID;
} }
public String getName() {
return "REMOVABLE_DRIVE_PLUGIN_NAME";
}
public void start() throws IOException { public void start() throws IOException {
running = true; running = true;
monitor.start(this); monitor.start(this);

View File

@@ -51,6 +51,10 @@ class LanTcpPlugin extends TcpPlugin {
return ID; return ID;
} }
public String getName() {
return "LAN_TCP_PLUGIN_NAME";
}
@Override @Override
protected List<SocketAddress> getLocalSocketAddresses() { protected List<SocketAddress> getLocalSocketAddresses() {
List<SocketAddress> addrs = new ArrayList<SocketAddress>(); List<SocketAddress> addrs = new ArrayList<SocketAddress>();

View File

@@ -48,6 +48,10 @@ class WanTcpPlugin extends TcpPlugin {
return ID; return ID;
} }
public String getName() {
return "WAN_TCP_PLUGIN_NAME";
}
@Override @Override
protected List<SocketAddress> getLocalSocketAddresses() { protected List<SocketAddress> getLocalSocketAddresses() {
List<SocketAddress> addrs = new ArrayList<SocketAddress>(); List<SocketAddress> addrs = new ArrayList<SocketAddress>();

View File

@@ -63,6 +63,10 @@ class TorPlugin implements DuplexPlugin {
return ID; return ID;
} }
public String getName() {
return "TOR_PLUGIN_NAME";
}
public void start() throws IOException { public void start() throws IOException {
synchronized(this) { synchronized(this) {
running = true; running = true;