summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrzej J.R. Hunt <andrzej@ahunt.org>2012-09-17 10:15:44 +0200
committerAndrzej J.R. Hunt <andrzej@ahunt.org>2012-09-17 10:16:55 +0200
commit9f8cd15be96c74428296534061f1103ae392164c (patch)
tree7bf7436546a19e0d5bbbd0ea21c760d08517cead
parent9b0b15ee092d70fcaf0bfe4c2da35371d9c6b142 (diff)
Add icons + device name display to pairing activity.
Change-Id: If27119e3e62bac8046fcc33cb12767b116bcc991
-rw-r--r--android/sdremote/AndroidManifest.xml6
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/PairingActivity.java8
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/communication/Client.java9
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java4
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/communication/NetworkClient.java1
5 files changed, 26 insertions, 2 deletions
diff --git a/android/sdremote/AndroidManifest.xml b/android/sdremote/AndroidManifest.xml
index 7ccc1f0ce16d..613e7d9f232a 100644
--- a/android/sdremote/AndroidManifest.xml
+++ b/android/sdremote/AndroidManifest.xml
@@ -26,12 +26,14 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
+ <activity
+ android:name=".PairingActivity"
+ android:icon="@drawable/actionbar_icon_computer" >
+ </activity>
<service android:name=".communication.CommunicationService" >
</service>
- <activity android:name=".PairingActivity" >
- </activity>
<activity android:name=".StartPresentationActivity" >
</activity>
<activity
diff --git a/android/sdremote/src/org/libreoffice/impressremote/PairingActivity.java b/android/sdremote/src/org/libreoffice/impressremote/PairingActivity.java
index cb65c5c26ddf..495aad49f207 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/PairingActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/PairingActivity.java
@@ -44,6 +44,8 @@ public class PairingActivity extends SherlockActivity {
LocalBroadcastManager.getInstance(this).registerReceiver(mListener,
aFilter);
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+
}
@Override
@@ -69,6 +71,8 @@ public class PairingActivity extends SherlockActivity {
if (mCommunicationService.getState() == State.CONNECTING) {
mPinText.setText(mCommunicationService.getPairingPin());
+ getSupportActionBar().setTitle(
+ mCommunicationService.getPairingDeviceName());
}
}
@@ -91,6 +95,10 @@ public class PairingActivity extends SherlockActivity {
String aPin = aIntent.getStringExtra("PIN");
mPinText.setText(aPin);
+ if (mCommunicationService != null)
+ getSupportActionBar().setTitle(
+ mCommunicationService
+ .getPairingDeviceName());
// refreshLists();
} else if (aIntent.getAction().equals(
CommunicationService.MSG_PAIRING_SUCCESSFUL)) {
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/Client.java b/android/sdremote/src/org/libreoffice/impressremote/communication/Client.java
index 549d9cc2463c..148da4acdf1a 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/Client.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/Client.java
@@ -33,6 +33,7 @@ public abstract class Client {
protected BufferedReader mReader;
protected OutputStream mOutputStream;
protected String mPin = "";
+ protected String mName = "";
private static Client latestInstance = null;
@@ -108,6 +109,14 @@ public abstract class Client {
}
}
+ public static String getName() {
+ if (latestInstance != null) {
+ return latestInstance.mName;
+ } else {
+ return "";
+ }
+ }
+
/**
* Send a valid command to the Server.
*/
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java b/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java
index 8a42f701087a..982dc7aaed94 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java
@@ -59,6 +59,10 @@ public class CommunicationService extends Service implements Runnable {
return Client.getPin();
}
+ public String getPairingDeviceName() {
+ return Client.getName();
+ }
+
private State mStateDesired = State.DISCONNECTED;
private Server mServerDesired = null;
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/NetworkClient.java b/android/sdremote/src/org/libreoffice/impressremote/communication/NetworkClient.java
index 91b169d1a5dd..c939613a25ef 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/NetworkClient.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/NetworkClient.java
@@ -35,6 +35,7 @@ public class NetworkClient extends Client {
CommunicationService aCommunicationService) {
super(aServer, aCommunicationService);
try {
+ mName = aServer.getName();
mSocket = new Socket(aServer.getAddress(), PORT);
mInputStream = mSocket.getInputStream();
mReader = new BufferedReader(new InputStreamReader(mInputStream,