diff options
author | Jason Monk <jmonk@google.com> | 2015-02-02 11:27:58 -0500 |
---|---|---|
committer | Jason Monk <jmonk@google.com> | 2015-02-05 10:43:26 -0500 |
commit | 7ce96b9e610de2782ec5f2af806e7bc0f90c8578 (patch) | |
tree | b1ca59e71832ed8848b66aa5da74c36137b16e36 /packages/SettingsLib/src/com/android/settingslib/bluetooth/Utils.java | |
parent | 3ec5f97ac5705d5fe2c7ceb7b61a4df5f18b980f (diff) | |
download | frameworks_base-7ce96b9e610de2782ec5f2af806e7bc0f90c8578.zip frameworks_base-7ce96b9e610de2782ec5f2af806e7bc0f90c8578.tar.gz frameworks_base-7ce96b9e610de2782ec5f2af806e7bc0f90c8578.tar.bz2 |
Move non-ui bt settings code to SettingsLib
Mostly this is moving classes from Settings to SettingsLib but there
were a few changes to support this separation.
- A bunch of things became public rather than package
- Moved some settings only code out of these classes
- Added error callback to handle errors
To see the changes from original classes view the diff against
patch-set 1.
Bug: 19180466
Change-Id: I69fd888362c6dbb325f6113b32c4b15cc6a23a41
Diffstat (limited to 'packages/SettingsLib/src/com/android/settingslib/bluetooth/Utils.java')
-rw-r--r-- | packages/SettingsLib/src/com/android/settingslib/bluetooth/Utils.java | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/Utils.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/Utils.java new file mode 100644 index 0000000..c919426 --- /dev/null +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/Utils.java @@ -0,0 +1,43 @@ +package com.android.settingslib.bluetooth; + +import android.bluetooth.BluetoothProfile; +import android.content.Context; + +import com.android.settingslib.R; + +public class Utils { + public static final boolean V = false; // verbose logging + public static final boolean D = true; // regular logging + + private static ErrorListener sErrorListener; + + public static int getConnectionStateSummary(int connectionState) { + switch (connectionState) { + case BluetoothProfile.STATE_CONNECTED: + return R.string.bluetooth_connected; + case BluetoothProfile.STATE_CONNECTING: + return R.string.bluetooth_connecting; + case BluetoothProfile.STATE_DISCONNECTED: + return R.string.bluetooth_disconnected; + case BluetoothProfile.STATE_DISCONNECTING: + return R.string.bluetooth_disconnecting; + default: + return 0; + } + } + + static void showError(Context context, String name, int messageResId) { + if (sErrorListener != null) { + sErrorListener.onShowError(context, name, messageResId); + } + } + + public static void setErrorListener(ErrorListener listener) { + sErrorListener = listener; + } + + public interface ErrorListener { + void onShowError(Context context, String name, int messageResId); + } + +} |