Use FooterPreference in xml explicitly
Removed the FooterPreferenceMixin from the BillingCycleSettings page. Fixes: 139099367 Test: manual test Test: make RunSettingsRoboTests ROBOTEST_FILTER=com.android.settings.datausage Change-Id: I408e433b3366a617b6c5a6fdb18f4830de4b8287
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
<PreferenceScreen
|
<PreferenceScreen
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||||
android:key="billing_cycle_settings"
|
android:key="billing_cycle_settings"
|
||||||
android:title="@string/billing_cycle">
|
android:title="@string/billing_cycle">
|
||||||
|
|
||||||
@@ -39,4 +40,10 @@
|
|||||||
android:key="data_limit"
|
android:key="data_limit"
|
||||||
android:title="@string/data_limit" />
|
android:title="@string/data_limit" />
|
||||||
|
|
||||||
|
<com.android.settingslib.widget.FooterPreference
|
||||||
|
android:key="billing_cycle_footer"
|
||||||
|
android:title="@string/data_warning_footnote"
|
||||||
|
android:selectable="false"
|
||||||
|
settings:searchable="false"/>
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
@@ -118,8 +118,6 @@ public class BillingCycleSettings extends DataUsageBaseFragment implements
|
|||||||
mEnableDataLimit = (SwitchPreference) findPreference(KEY_SET_DATA_LIMIT);
|
mEnableDataLimit = (SwitchPreference) findPreference(KEY_SET_DATA_LIMIT);
|
||||||
mEnableDataLimit.setOnPreferenceChangeListener(this);
|
mEnableDataLimit.setOnPreferenceChangeListener(this);
|
||||||
mDataLimit = findPreference(KEY_DATA_LIMIT);
|
mDataLimit = findPreference(KEY_DATA_LIMIT);
|
||||||
|
|
||||||
mFooterPreferenceMixin.createFooterPreference().setTitle(R.string.data_warning_footnote);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -47,8 +47,6 @@ import androidx.preference.SwitchPreference;
|
|||||||
|
|
||||||
import com.android.settings.testutils.shadow.ShadowFragment;
|
import com.android.settings.testutils.shadow.ShadowFragment;
|
||||||
import com.android.settingslib.NetworkPolicyEditor;
|
import com.android.settingslib.NetworkPolicyEditor;
|
||||||
import com.android.settingslib.widget.FooterPreference;
|
|
||||||
import com.android.settingslib.widget.FooterPreferenceMixinCompat;
|
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@@ -58,7 +56,6 @@ import org.mockito.MockitoAnnotations;
|
|||||||
import org.robolectric.RobolectricTestRunner;
|
import org.robolectric.RobolectricTestRunner;
|
||||||
import org.robolectric.RuntimeEnvironment;
|
import org.robolectric.RuntimeEnvironment;
|
||||||
import org.robolectric.annotation.Config;
|
import org.robolectric.annotation.Config;
|
||||||
import org.robolectric.util.ReflectionHelpers;
|
|
||||||
|
|
||||||
@RunWith(RobolectricTestRunner.class)
|
@RunWith(RobolectricTestRunner.class)
|
||||||
public class BillingCycleSettingsTest {
|
public class BillingCycleSettingsTest {
|
||||||
@@ -162,9 +159,6 @@ public class BillingCycleSettingsTest {
|
|||||||
when(mConnectivityManager.isNetworkSupported(anyInt())).thenReturn(true);
|
when(mConnectivityManager.isNetworkSupported(anyInt())).thenReturn(true);
|
||||||
final SwitchPreference preference = mock(SwitchPreference.class);
|
final SwitchPreference preference = mock(SwitchPreference.class);
|
||||||
when(billingCycleSettings.findPreference(anyString())).thenReturn(preference);
|
when(billingCycleSettings.findPreference(anyString())).thenReturn(preference);
|
||||||
final FooterPreferenceMixinCompat footer = mock(FooterPreferenceMixinCompat.class);
|
|
||||||
ReflectionHelpers.setField(billingCycleSettings, "mFooterPreferenceMixin", footer);
|
|
||||||
when(footer.createFooterPreference()).thenReturn(mock(FooterPreference.class));
|
|
||||||
|
|
||||||
billingCycleSettings.onCreate(Bundle.EMPTY);
|
billingCycleSettings.onCreate(Bundle.EMPTY);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user