Use FooterPreference in xml explicitly

We don't rely on FooterPreferenceMixinCompat
to create footer preference in dashboard fragment.

Instead, declare a FooterPreference explicitly in
xml of screen.

It makes more sense for our referenceController design.

Test: visual, robotest
Bug: 124129485
Change-Id: I0b0c0f9e38d85aa89b815ce2b84ddff30a1d206b
This commit is contained in:
tmfang
2019-05-31 18:24:29 +08:00
parent f1c0f23510
commit 24c3324268
10 changed files with 84 additions and 109 deletions

View File

@@ -21,6 +21,7 @@ import static com.android.settings.core.BasePreferenceController.CONDITIONALLY_U
import static com.android.settings.development.gamedriver.GameDriverEnableForAllAppsPreferenceController.GAME_DRIVER_ALL_APPS;
import static com.android.settings.development.gamedriver.GameDriverEnableForAllAppsPreferenceController.GAME_DRIVER_DEFAULT;
import static com.android.settings.development.gamedriver.GameDriverEnableForAllAppsPreferenceController.GAME_DRIVER_OFF;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.spy;
@@ -62,7 +63,7 @@ public class GameDriverFooterPreferenceControllerTest {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
mResolver = mContext.getContentResolver();
mController = spy(new GameDriverFooterPreferenceController(mContext));
mController = spy(new GameDriverFooterPreferenceController(mContext, "key"));
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
}
@@ -104,20 +105,4 @@ public class GameDriverFooterPreferenceControllerTest {
verify(mGameDriverContentObserver).unregister(mResolver);
}
@Test
public void updateState_available_visible() {
when(mController.getAvailabilityStatus()).thenReturn(AVAILABLE_UNSEARCHABLE);
mController.updateState(mPreference);
verify(mPreference).setVisible(true);
}
@Test
public void updateState_unavailable_invisible() {
when(mController.getAvailabilityStatus()).thenReturn(CONDITIONALLY_UNAVAILABLE);
mController.updateState(mPreference);
verify(mPreference).setVisible(false);
}
}