summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorAndrzej J.R. Hunt <andrzej@ahunt.org>2012-08-03 14:15:37 +0200
committerMichael Meeks <michael.meeks@suse.com>2012-08-06 10:23:10 +0100
commitbbbfaf7b9e3bead70966db338c250e4cbb4fc1d9 (patch)
treebe258595fa694ba6fab333c3db35547176f19e54 /android
parentb5d6989e8b7a739881f54ce9db0d560fb69e7eb9 (diff)
Fixed styling of server finder.
Change-Id: I74186efe472f89463b597790d46be5523ce85b6f
Diffstat (limited to 'android')
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/SelectorActivity.java79
1 files changed, 43 insertions, 36 deletions
diff --git a/android/sdremote/src/org/libreoffice/impressremote/SelectorActivity.java b/android/sdremote/src/org/libreoffice/impressremote/SelectorActivity.java
index 4bed7105fca2..132b6e4eea28 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/SelectorActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/SelectorActivity.java
@@ -34,7 +34,9 @@ public class SelectorActivity extends Activity {
private CommunicationService mCommunicationService;
+ private View mBluetoothContainer;
private LinearLayout mBluetoothList;
+ private View mNetworkContainer;
private LinearLayout mNetworkList;
private TextView mNoServerLabel;
@@ -49,7 +51,9 @@ public class SelectorActivity extends Activity {
LocalBroadcastManager.getInstance(this).registerReceiver(mListener,
aFilter);
+ mBluetoothContainer = findViewById(R.id.selector_container_bluetooth);
mBluetoothList = (LinearLayout) findViewById(R.id.selector_list_bluetooth);
+ mNetworkContainer = findViewById(R.id.selector_container_network);
mNetworkList = (LinearLayout) findViewById(R.id.selector_list_network);
mNoServerLabel = (TextView) findViewById(R.id.selector_label_none);
@@ -109,53 +113,56 @@ public class SelectorActivity extends Activity {
private HashMap<Server, View> mNetworkServers = new HashMap<Server, View>();
private void refreshLists() {
- if (mCommunicationService == null)
- return;
+ if (mCommunicationService != null) {
- Server[] aServers = mCommunicationService.getServers();
+ Server[] aServers = mCommunicationService.getServers();
- // Bluetooth -- Remove old
- for (Entry<Server, View> aEntry : mBluetoothServers.entrySet()) {
- if (!Arrays.asList(aServers).contains(aEntry.getKey())) {
- mBluetoothServers.remove(aEntry.getKey());
- mBluetoothList.removeView(aEntry.getValue());
+ // Bluetooth -- Remove old
+ for (Entry<Server, View> aEntry : mBluetoothServers.entrySet()) {
+ if (!Arrays.asList(aServers).contains(aEntry.getKey())) {
+ mBluetoothServers.remove(aEntry.getKey());
+ mBluetoothList.removeView(aEntry.getValue());
+ }
}
- }
- // Network -- Remove old
- for (Entry<Server, View> aEntry : mNetworkServers.entrySet()) {
- if (!Arrays.asList(aServers).contains(aEntry.getKey())) {
- mNetworkServers.remove(aEntry.getKey());
- mNetworkList.removeView(aEntry.getValue());
- }
- }
- // Add all new
- for (Server aServer : aServers) {
- boolean aIsBluetooth = (aServer.getProtocol() == Protocol.BLUETOOTH);
- HashMap<Server, View> aMap = aIsBluetooth ? mBluetoothServers
- : mNetworkServers;
- LinearLayout aLayout = aIsBluetooth ? mBluetoothList : mNetworkList;
-
- if (!aMap.containsValue(aServer)) {
- View aView = getLayoutInflater().inflate(
- R.layout.activity_selector_sublayout_server,
- aLayout);
- TextView aText = (TextView) aView
- .findViewById(R.id.selector_sub_label);
- aText.setText(aServer.getName());
- aMap.put(aServer, aView);
+ // Network -- Remove old
+ for (Entry<Server, View> aEntry : mNetworkServers.entrySet()) {
+ if (!Arrays.asList(aServers).contains(aEntry.getKey())) {
+ mNetworkServers.remove(aEntry.getKey());
+ mNetworkList.removeView(aEntry.getValue());
+ }
}
+ // Add all new
+ for (Server aServer : aServers) {
+ boolean aIsBluetooth = (aServer.getProtocol() == Protocol.BLUETOOTH);
+ HashMap<Server, View> aMap = aIsBluetooth ? mBluetoothServers
+ : mNetworkServers;
+ LinearLayout aLayout = aIsBluetooth ? mBluetoothList
+ : mNetworkList;
+
+ if (!aMap.containsValue(aServer)) {
+ View aView = getLayoutInflater()
+ .inflate(R.layout.activity_selector_sublayout_server,
+ aLayout);
+ TextView aText = (TextView) aView
+ .findViewById(R.id.selector_sub_label);
+ aText.setText(aServer.getName());
+ aMap.put(aServer, aView);
+ }
+ }
}
// Hide as necessary
- mBluetoothList.setVisibility((mBluetoothServers.size() != 0) ? View.VISIBLE
- : View.INVISIBLE);
- mNetworkList.setVisibility((mNetworkServers.size() != 0) ? View.VISIBLE
- : View.INVISIBLE);
+ mBluetoothContainer
+ .setVisibility((mBluetoothServers.size() != 0) ? View.VISIBLE
+ : View.GONE);
+ mNetworkContainer
+ .setVisibility((mNetworkServers.size() != 0) ? View.VISIBLE
+ : View.GONE);
mNoServerLabel.setVisibility((mBluetoothServers.size() == 0)
&& (mNetworkServers.size() == 0) ? View.VISIBLE
- : View.INVISIBLE);
+ : View.GONE);
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file