Use FooterPreference in xml explicitly
- Removed the FooterPreferenceMixin from the BluetoothDetailsMacAddressController. - Added the common api addFooterPreference. Fixes: 139104386 Test: manual test Test: make RunSettingsRoboTests ROBOTEST_FILTER=com.android.settings.bluetooth Change-Id: Iab40fa4c5be674290b1dc6d372c84609ccc2ea49
This commit is contained in:
@@ -25,13 +25,13 @@ import com.android.settings.R;
|
||||
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
|
||||
import com.android.settingslib.core.lifecycle.Lifecycle;
|
||||
import com.android.settingslib.widget.FooterPreference;
|
||||
import com.android.settingslib.widget.FooterPreferenceMixinCompat;
|
||||
|
||||
/**
|
||||
* This class adds the device MAC address to a footer.
|
||||
*/
|
||||
public class BluetoothDetailsMacAddressController extends BluetoothDetailsController {
|
||||
FooterPreferenceMixinCompat mFooterPreferenceMixin;
|
||||
public static final String KEY_DEVICE_DETAILS_FOOTER = "device_details_footer";
|
||||
|
||||
FooterPreference mFooterPreference;
|
||||
|
||||
public BluetoothDetailsMacAddressController(Context context,
|
||||
@@ -39,12 +39,11 @@ public class BluetoothDetailsMacAddressController extends BluetoothDetailsContro
|
||||
CachedBluetoothDevice device,
|
||||
Lifecycle lifecycle) {
|
||||
super(context, fragment, device, lifecycle);
|
||||
mFooterPreferenceMixin = new FooterPreferenceMixinCompat(fragment, lifecycle);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init(PreferenceScreen screen) {
|
||||
mFooterPreference = mFooterPreferenceMixin.createFooterPreference();
|
||||
mFooterPreference = screen.findPreference(KEY_DEVICE_DETAILS_FOOTER);
|
||||
mFooterPreference.setTitle(mContext.getString(
|
||||
R.string.bluetooth_device_mac_address, mCachedDevice.getAddress()));
|
||||
}
|
||||
@@ -57,9 +56,6 @@ public class BluetoothDetailsMacAddressController extends BluetoothDetailsContro
|
||||
|
||||
@Override
|
||||
public String getPreferenceKey() {
|
||||
if (mFooterPreference == null) {
|
||||
return null;
|
||||
}
|
||||
return mFooterPreference.getKey();
|
||||
return KEY_DEVICE_DETAILS_FOOTER;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user