summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorAndrzej Hunt <andrzej.hunt@collabora.com>2014-01-16 15:38:38 +0000
committerAndrzej Hunt <andrzej.hunt@collabora.com>2014-01-16 15:42:38 +0000
commit17e7bc358faab29ddb524d478f6b5ca2fed1a5f8 (patch)
tree3503d46f6f85e2cac0d2ff2ecbdedad8ccde27e3 /android
parent6d87a2c28f074953a84fd9e5a4aed333ae30136a (diff)
Revert "fdo#60486 Fix auto-enabling bluetooth and improve bluetooth handling."
This will be superceded by the following sdremote improvments, which would otherwise have path conflicts due to this patch. This reverts commit 3cc31f89787e435c893b38a0adc0a23f566ab60f. Change-Id: I49f004d068fdf852f5690e365a17168b001b9136
Diffstat (limited to 'android')
-rw-r--r--android/sdremote/res/values/strings.xml1
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/activity/ComputersActivity.java14
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothServersFinder.java12
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/fragment/ComputersFragment.java22
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/util/BluetoothOperator.java10
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/util/Intents.java5
6 files changed, 14 insertions, 50 deletions
diff --git a/android/sdremote/res/values/strings.xml b/android/sdremote/res/values/strings.xml
index 7dc068a5c968..4ec816af049b 100644
--- a/android/sdremote/res/values/strings.xml
+++ b/android/sdremote/res/values/strings.xml
@@ -90,6 +90,5 @@
<string name="requirements_network_connection">The Android device and a computer connected to the same network.</string>
<string name="requirements_network_ports">If you have a firewall make sure ports 1598 and 1599 are opened.</string>
<string name="requirements_bluetooth_connection">A computer with enabled Bluetooth.</string>
- <string name="message_bluetooth_disabled">Please enable bluetooth to connect to a bluetooth enabled computer.</string>
</resources>
diff --git a/android/sdremote/src/org/libreoffice/impressremote/activity/ComputersActivity.java b/android/sdremote/src/org/libreoffice/impressremote/activity/ComputersActivity.java
index ad7c9db775bb..f75d197f8c8c 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/activity/ComputersActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/activity/ComputersActivity.java
@@ -31,8 +31,6 @@ import org.libreoffice.impressremote.util.SavedStates;
public class ComputersActivity extends ActionBarActivity implements ActionBar.TabListener, ViewPager.OnPageChangeListener {
private boolean mBluetoothWasEnabled;
- private final static int REQUEST_ENABLE_BT = 1;
-
@Override
protected void onCreate(Bundle aSavedInstanceState) {
super.onCreate(aSavedInstanceState);
@@ -44,16 +42,6 @@ public class ComputersActivity extends ActionBarActivity implements ActionBar.Ta
setUpContent();
}
- @Override
- protected void onActivityResult(int arg0, int arg1, Intent arg2) {
- super.onActivityResult(arg0, arg1, arg2);
-
- if (arg0 == REQUEST_ENABLE_BT) {
- // Ideally we should do all detection based on listening to the bluetooth state
- // as the user can still enable BT separately (see BluetoothServersFinder.java:onReceive)
- }
- }
-
private void saveBluetoothState(Bundle aSavedInstanceState) {
// In more ideal world this work should be done at the service.
// Unfortunately service cannot save or restore its state.
@@ -76,7 +64,7 @@ public class ComputersActivity extends ActionBarActivity implements ActionBar.Ta
}
private void enableBluetooth() {
- BluetoothOperator.enable(this, REQUEST_ENABLE_BT);
+ BluetoothOperator.enable();
}
private void setUpTitle() {
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothServersFinder.java b/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothServersFinder.java
index e696a1ba14ef..29e9b9c1a051 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothServersFinder.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothServersFinder.java
@@ -72,19 +72,9 @@ class BluetoothServersFinder extends BroadcastReceiver implements ServersFinder,
public void onReceive(Context aContext, Intent aIntent) {
if (BluetoothAdapter.ACTION_STATE_CHANGED.equals(aIntent.getAction())) {
switch (aIntent.getIntExtra(BluetoothAdapter.EXTRA_STATE, 0)) {
- case BluetoothAdapter.STATE_ON: {
+ case BluetoothAdapter.STATE_ON:
BluetoothOperator.getAdapter().startDiscovery();
- Intent aNewIntent = Intents.buildBluetoothStateChangedIntent();
- LocalBroadcastManager.getInstance(mContext).sendBroadcast(aNewIntent);
return;
- }
-
- case BluetoothAdapter.STATE_OFF: {
- mServers.clear();
- Intent aNewIntent = Intents.buildBluetoothStateChangedIntent();
- LocalBroadcastManager.getInstance(mContext).sendBroadcast(aNewIntent);
- return;
- }
default:
return;
diff --git a/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputersFragment.java b/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputersFragment.java
index 4e013c8ee855..bd80f6cfc65f 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputersFragment.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputersFragment.java
@@ -13,7 +13,6 @@ import java.util.List;
import java.util.concurrent.TimeUnit;
import android.app.Activity;
-import android.bluetooth.BluetoothAdapter;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
@@ -54,8 +53,6 @@ public class ComputersFragment extends ListFragment implements ServiceConnection
WIFI, BLUETOOTH
}
- boolean mBluetoothDisabled = false;
-
private CommunicationService mCommunicationService;
private BroadcastReceiver mIntentsReceiver;
@@ -149,10 +146,7 @@ public class ComputersFragment extends ListFragment implements ServiceConnection
return getString(R.string.message_search_wifi);
case BLUETOOTH:
- if (mBluetoothDisabled != true)
- return getString(R.string.message_search_bluetooth);
- else
- return getString(R.string.message_bluetooth_disabled);
+ return getString(R.string.message_search_bluetooth);
default:
return "";
@@ -214,8 +208,6 @@ public class ComputersFragment extends ListFragment implements ServiceConnection
}
}
- mBluetoothDisabled = !BluetoothAdapter.getDefaultAdapter().isEnabled();
-
return aComputers;
}
@@ -257,10 +249,18 @@ public class ComputersFragment extends ListFragment implements ServiceConnection
return;
}
+ if (!isShowingProgressMessageRequired()) {
+ return;
+ }
+
showProgressMessage();
showLearnMoreMessage();
}
+ private boolean isShowingProgressMessageRequired() {
+ return getProgressMessageView().getVisibility() == View.INVISIBLE;
+ }
+
private void tearDownComputersAdapter() {
setListAdapter(null);
}
@@ -328,8 +328,6 @@ public class ComputersFragment extends ListFragment implements ServiceConnection
public void onReceive(Context aContext, Intent aIntent) {
if (Intents.Actions.SERVERS_LIST_CHANGED.equals(aIntent.getAction())) {
mComputersFragment.loadComputers();
- } else if (Intents.Actions.BLUETOOTH_STATE_CHANGED.equals(aIntent.getAction())) {
- mComputersFragment.loadComputers();
}
}
}
@@ -337,7 +335,7 @@ public class ComputersFragment extends ListFragment implements ServiceConnection
private IntentFilter buildIntentsReceiverFilter() {
IntentFilter aIntentFilter = new IntentFilter();
aIntentFilter.addAction(Intents.Actions.SERVERS_LIST_CHANGED);
- aIntentFilter.addAction(Intents.Actions.BLUETOOTH_STATE_CHANGED);
+
return aIntentFilter;
}
diff --git a/android/sdremote/src/org/libreoffice/impressremote/util/BluetoothOperator.java b/android/sdremote/src/org/libreoffice/impressremote/util/BluetoothOperator.java
index c451518160ac..95228388d501 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/util/BluetoothOperator.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/util/BluetoothOperator.java
@@ -8,9 +8,7 @@
*/
package org.libreoffice.impressremote.util;
-import android.app.Activity;
import android.bluetooth.BluetoothAdapter;
-import android.content.Intent;
public final class BluetoothOperator {
private BluetoothOperator() {
@@ -28,16 +26,12 @@ public final class BluetoothOperator {
return BluetoothAdapter.getDefaultAdapter();
}
- public static void enable(Activity aActivity, int nRequestCode) {
+ public static void enable() {
if (!isAvailable()) {
return;
}
- if (getAdapter() != null) {
- Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
- aActivity.startActivityForResult(enableBtIntent, nRequestCode);
- }
-
+ getAdapter().enable();
}
public static void disable() {
diff --git a/android/sdremote/src/org/libreoffice/impressremote/util/Intents.java b/android/sdremote/src/org/libreoffice/impressremote/util/Intents.java
index e27f2f1ee75b..beab7ae03460 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/util/Intents.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/util/Intents.java
@@ -29,7 +29,6 @@ public final class Intents {
}
public static final String SERVERS_LIST_CHANGED = "SERVERS_LIST_CHANGED";
- public static final String BLUETOOTH_STATE_CHANGED = "BLUETOOTH_STATE_CHANGED";
public static final String PAIRING_SUCCESSFUL = "PAIRING_SUCCESSFUL";
public static final String PAIRING_VALIDATION = "PAIRING_VALIDATION";
@@ -75,10 +74,6 @@ public final class Intents {
return new Intent(Actions.SERVERS_LIST_CHANGED);
}
- public static Intent buildBluetoothStateChangedIntent() {
- return new Intent(Actions.BLUETOOTH_STATE_CHANGED);
- }
-
public static Intent buildPairingSuccessfulIntent() {
return new Intent(Actions.PAIRING_SUCCESSFUL);
}