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