Remove empty space in Usage access
When there is no need to show filter component, we don't need to set an extra padding top. Test: robotest, visual Change-Id: Ieaa65ed9785a06f0737aefaf102d0c857002bbdd Fixes: 123037802
This commit is contained in:
@@ -91,6 +91,8 @@ public class ManageApplicationsTest {
|
||||
private UserManager mUserManager;
|
||||
@Mock
|
||||
private PackageManager mPackageManager;
|
||||
|
||||
private Context mContext;
|
||||
private MenuItem mAppReset;
|
||||
private MenuItem mSortRecent;
|
||||
private MenuItem mSortFrequent;
|
||||
@@ -99,6 +101,7 @@ public class ManageApplicationsTest {
|
||||
@Before
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mContext = RuntimeEnvironment.application;
|
||||
mAppReset = new RoboMenuItem(R.id.reset_app_preferences);
|
||||
mSortRecent = new RoboMenuItem(R.id.sort_order_recent_notification);
|
||||
mSortFrequent = new RoboMenuItem(R.id.sort_order_frequent_notification);
|
||||
@@ -107,6 +110,7 @@ public class ManageApplicationsTest {
|
||||
when(mState.getBackgroundLooper()).thenReturn(Looper.myLooper());
|
||||
|
||||
mFragment = spy(new ManageApplications());
|
||||
when(mFragment.getContext()).thenReturn(mContext);
|
||||
when(mFragment.getActivity()).thenReturn(mActivity);
|
||||
when(mActivity.getResources()).thenReturn(mResources);
|
||||
when(mActivity.getSystemService(UserManager.class)).thenReturn(mUserManager);
|
||||
@@ -460,6 +464,31 @@ public class ManageApplicationsTest {
|
||||
assertThat(mFragment.mSortOrder).isEqualTo(mSortFrequent.getItemId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateFilterView_hasFilterSet_shouldShowFilterAndHavePaddingTop() {
|
||||
mFragment.mContentContainer = new View(mContext);
|
||||
mFragment.mSpinnerHeader = new View(mContext);
|
||||
mFragment.mFilterAdapter = new ManageApplications.FilterSpinnerAdapter(mFragment);
|
||||
|
||||
mFragment.mFilterAdapter.updateFilterView(true);
|
||||
|
||||
assertThat(mFragment.mSpinnerHeader.getVisibility()).isEqualTo(View.VISIBLE);
|
||||
assertThat(mFragment.mContentContainer.getPaddingTop()).isEqualTo(
|
||||
mContext.getResources().getDimensionPixelSize(R.dimen.app_bar_height));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateFilterView_noFilterSet_shouldHideFilterAndNoPaddingTop() {
|
||||
mFragment.mContentContainer = new View(mContext);
|
||||
mFragment.mSpinnerHeader = new View(mContext);
|
||||
mFragment.mFilterAdapter = new ManageApplications.FilterSpinnerAdapter(mFragment);
|
||||
|
||||
mFragment.mFilterAdapter.updateFilterView(false);
|
||||
|
||||
assertThat(mFragment.mSpinnerHeader.getVisibility()).isEqualTo(View.GONE);
|
||||
assertThat(mFragment.mContentContainer.getPaddingTop()).isEqualTo(0);
|
||||
}
|
||||
|
||||
private void setUpOptionMenus() {
|
||||
when(mMenu.findItem(anyInt())).thenAnswer(invocation -> {
|
||||
final Object[] args = invocation.getArguments();
|
||||
|
Reference in New Issue
Block a user