diff options
author | Lifu Tang <lifu@google.com> | 2015-03-26 17:56:19 -0700 |
---|---|---|
committer | Lifu Tang <lifu@google.com> | 2015-04-06 11:00:04 -0700 |
commit | be794c30ca49c17521e66482ce30c94ffb2ec8ee (patch) | |
tree | 74a7611dc93d0d933080ae2a03e7519cda6b2c52 /src/com/android/settings/bluetooth | |
parent | 8019aa6b7bc9be660faac081772f25f9d6bcbff0 (diff) | |
download | packages_apps_Settings-be794c30ca49c17521e66482ce30c94ffb2ec8ee.zip packages_apps_Settings-be794c30ca49c17521e66482ce30c94ffb2ec8ee.tar.gz packages_apps_Settings-be794c30ca49c17521e66482ce30c94ffb2ec8ee.tar.bz2 |
Added links to scanning settings
Bug: 19918721
Change-Id: Ifb1508807d34b675e9ea1522f86a9310ed6b663f
Diffstat (limited to 'src/com/android/settings/bluetooth')
-rwxr-xr-x | src/com/android/settings/bluetooth/BluetoothSettings.java | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/src/com/android/settings/bluetooth/BluetoothSettings.java b/src/com/android/settings/bluetooth/BluetoothSettings.java index b1eed51..1d0dc7e 100755 --- a/src/com/android/settings/bluetooth/BluetoothSettings.java +++ b/src/com/android/settings/bluetooth/BluetoothSettings.java @@ -33,7 +33,10 @@ import android.preference.Preference; import android.preference.PreferenceCategory; import android.preference.PreferenceGroup; import android.preference.PreferenceScreen; +import android.text.Spannable; +import android.text.style.TextAppearanceSpan; import android.util.Log; +import android.view.Gravity; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; @@ -45,8 +48,10 @@ import android.widget.EditText; import android.widget.TextView; import com.android.internal.logging.MetricsLogger; +import com.android.settings.LinkifyUtils; import com.android.settings.R; import com.android.settings.SettingsActivity; +import com.android.settings.location.ScanningSettings; import com.android.settings.search.BaseSearchIndexProvider; import com.android.settings.search.Indexable; import com.android.settings.search.SearchIndexableRaw; @@ -136,6 +141,7 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem mEmptyView = (TextView) getView().findViewById(android.R.id.empty); getListView().setEmptyView(mEmptyView); + mEmptyView.setGravity(Gravity.START | Gravity.CENTER_VERTICAL); final SettingsActivity activity = (SettingsActivity) getActivity(); mSwitchBar = activity.getSwitchBar(); @@ -352,7 +358,7 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem break; case BluetoothAdapter.STATE_OFF: - messageId = R.string.bluetooth_empty_list_bluetooth_off; + setOffMessage(); if (isUiRestricted()) { messageId = R.string.bluetooth_empty_list_user_restricted; } @@ -366,12 +372,39 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem setDeviceListGroup(preferenceScreen); removeAllDevices(); - mEmptyView.setText(messageId); + if (messageId != 0) { + mEmptyView.setText(messageId); + } if (!isUiRestricted()) { getActivity().invalidateOptionsMenu(); } } + private void setOffMessage() { + if (mEmptyView == null) { + return; + } + final CharSequence briefText = getText(R.string.bluetooth_empty_list_bluetooth_off); + final StringBuilder contentBuilder = new StringBuilder(); + contentBuilder.append(briefText); + contentBuilder.append("\n\n"); + contentBuilder.append(getText(R.string.ble_scan_notify_text)); + getPreferenceScreen().removeAll(); + LinkifyUtils.linkify(mEmptyView, contentBuilder, new LinkifyUtils.OnClickListener() { + @Override + public void onClick() { + final SettingsActivity activity = + (SettingsActivity) BluetoothSettings.this.getActivity(); + activity.startPreferencePanel(ScanningSettings.class.getName(), null, + R.string.location_scanning_screen_title, null, null, 0); + } + }); + Spannable boldSpan = (Spannable) mEmptyView.getText(); + boldSpan.setSpan( + new TextAppearanceSpan(getActivity(), android.R.style.TextAppearance_Medium), 0, + briefText.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + } + @Override public void onBluetoothStateChanged(int bluetoothState) { super.onBluetoothStateChanged(bluetoothState); |