Merge "BT device picker: don't rescan after rotating the device"
This commit is contained in:
@@ -45,13 +45,13 @@ public class ProgressCategory extends ProgressCategoryBase {
|
||||
textView.setVisibility(noDeviceFound ? View.INVISIBLE : View.VISIBLE);
|
||||
progressBar.setVisibility(mProgress ? View.VISIBLE : View.INVISIBLE);
|
||||
|
||||
if (mProgress) {
|
||||
if (mProgress || !noDeviceFound) {
|
||||
if (mNoDeviceFoundAdded) {
|
||||
removePreference(mNoDeviceFoundPreference);
|
||||
mNoDeviceFoundAdded = false;
|
||||
}
|
||||
} else {
|
||||
if (noDeviceFound && !mNoDeviceFoundAdded) {
|
||||
if (!mNoDeviceFoundAdded) {
|
||||
if (mNoDeviceFoundPreference == null) {
|
||||
mNoDeviceFoundPreference = new Preference(getContext());
|
||||
mNoDeviceFoundPreference.setLayoutResource(R.layout.preference_empty_list);
|
||||
@@ -70,4 +70,3 @@ public class ProgressCategory extends ProgressCategoryBase {
|
||||
notifyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -33,6 +33,7 @@ public final class DevicePickerFragment extends DeviceListPreferenceFragment {
|
||||
private boolean mNeedAuth;
|
||||
private String mLaunchPackage;
|
||||
private String mLaunchClass;
|
||||
private boolean mStartScanOnResume;
|
||||
|
||||
@Override
|
||||
void addPreferencesForActivity() {
|
||||
@@ -50,13 +51,17 @@ public final class DevicePickerFragment extends DeviceListPreferenceFragment {
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
getActivity().setTitle(getString(R.string.device_picker));
|
||||
mStartScanOnResume = (savedInstanceState == null); // don't start scan after rotation
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
addCachedDevices();
|
||||
mLocalAdapter.startScanning(true);
|
||||
if (mStartScanOnResume) {
|
||||
mLocalAdapter.startScanning(true);
|
||||
mStartScanOnResume = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user