Revert "Fix 'No Apps' UI issues of ManageApplications"
This reverts commit 4a97095e36
.
Reason for revert: <It has abnormal scroll behavior when there is no profile tab>
Bug: 191945032
Bug: 191944934
Change-Id: Id6c71fbec4f490034bc07f6d8c9efabcb877d110
This commit is contained in:
@@ -28,6 +28,7 @@ import static com.google.common.truth.Truth.assertThat;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyBoolean;
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.doNothing;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.mock;
|
||||
@@ -48,6 +49,7 @@ import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.SearchView;
|
||||
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
@@ -153,6 +155,22 @@ public class ManageApplicationsTest {
|
||||
assertThat(mMenu.findItem(R.id.sort_order_frequent_notification).isVisible()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onCreateView_shouldNotShowLoadingContainer() {
|
||||
ReflectionHelpers.setField(mFragment, "mResetAppsHelper", mock(ResetAppsHelper.class));
|
||||
doNothing().when(mFragment).createHeader();
|
||||
|
||||
final LayoutInflater layoutInflater = mock(LayoutInflater.class);
|
||||
final View view = mock(View.class);
|
||||
final View loadingContainer = mock(View.class);
|
||||
when(layoutInflater.inflate(anyInt(), eq(null))).thenReturn(view);
|
||||
when(view.findViewById(R.id.loading_container)).thenReturn(loadingContainer);
|
||||
|
||||
mFragment.onCreateView(layoutInflater, mock(ViewGroup.class), null);
|
||||
|
||||
verify(loadingContainer, never()).setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onCreateOptionsMenu_shouldSetSearchQueryListener() {
|
||||
final SearchView searchView = mock(SearchView.class);
|
||||
@@ -203,6 +221,7 @@ public class ManageApplicationsTest {
|
||||
@Test
|
||||
public void updateLoading_appLoaded_shouldNotDelayCallToHandleLoadingContainer() {
|
||||
ReflectionHelpers.setField(mFragment, "mLoadingContainer", mock(View.class));
|
||||
ReflectionHelpers.setField(mFragment, "mListContainer", mock(View.class));
|
||||
final ManageApplications.ApplicationsAdapter adapter =
|
||||
spy(new ManageApplications.ApplicationsAdapter(mState, mFragment,
|
||||
AppFilterRegistry.getInstance().get(FILTER_APPS_ALL), new Bundle()));
|
||||
@@ -224,6 +243,7 @@ public class ManageApplicationsTest {
|
||||
@Test
|
||||
public void updateLoading_appNotLoaded_shouldDelayCallToHandleLoadingContainer() {
|
||||
ReflectionHelpers.setField(mFragment, "mLoadingContainer", mock(View.class));
|
||||
ReflectionHelpers.setField(mFragment, "mListContainer", mock(View.class));
|
||||
final ManageApplications.ApplicationsAdapter adapter =
|
||||
spy(new ManageApplications.ApplicationsAdapter(mState, mFragment,
|
||||
AppFilterRegistry.getInstance().get(FILTER_APPS_ALL), new Bundle()));
|
||||
@@ -252,6 +272,7 @@ public class ManageApplicationsTest {
|
||||
when(listContainer.getVisibility()).thenReturn(View.INVISIBLE);
|
||||
when(listContainer.getContext()).thenReturn(context);
|
||||
ReflectionHelpers.setField(mFragment, "mLoadingContainer", loadingContainer);
|
||||
ReflectionHelpers.setField(mFragment, "mListContainer", listContainer);
|
||||
final ManageApplications.ApplicationsAdapter adapter =
|
||||
spy(new ManageApplications.ApplicationsAdapter(mState, mFragment,
|
||||
AppFilterRegistry.getInstance().get(FILTER_APPS_ALL), new Bundle()));
|
||||
@@ -275,7 +296,7 @@ public class ManageApplicationsTest {
|
||||
|
||||
adapter.onRebuildComplete(null);
|
||||
|
||||
verify(loadingViewController).showEmpty(false /* animate */);
|
||||
verify(loadingViewController).showContent(true /* animate */);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -283,16 +304,15 @@ public class ManageApplicationsTest {
|
||||
final String query = "Test";
|
||||
final RecyclerView recyclerView = mock(RecyclerView.class);
|
||||
final View emptyView = mock(View.class);
|
||||
final View loadingContainer = mock(View.class);
|
||||
ReflectionHelpers.setField(mFragment, "mRecyclerView", recyclerView);
|
||||
ReflectionHelpers.setField(mFragment, "mEmptyView", emptyView);
|
||||
ReflectionHelpers.setField(mFragment, "mLoadingContainer", loadingContainer);
|
||||
final SearchView searchView = mock(SearchView.class);
|
||||
ReflectionHelpers.setField(mFragment, "mSearchView", searchView);
|
||||
when(searchView.isVisibleToUser()).thenReturn(true);
|
||||
when(searchView.getQuery()).thenReturn(query);
|
||||
final View listContainer = mock(View.class);
|
||||
when(listContainer.getVisibility()).thenReturn(View.VISIBLE);
|
||||
ReflectionHelpers.setField(mFragment, "mListContainer", listContainer);
|
||||
ReflectionHelpers.setField(
|
||||
mFragment, "mFilterAdapter", mock(ManageApplications.FilterSpinnerAdapter.class));
|
||||
final ArrayList<ApplicationsState.AppEntry> appList = new ArrayList<>();
|
||||
@@ -471,6 +491,8 @@ public class ManageApplicationsTest {
|
||||
mFragment.mFilterAdapter.updateFilterView(true);
|
||||
|
||||
assertThat(mFragment.mSpinnerHeader.getVisibility()).isEqualTo(View.VISIBLE);
|
||||
assertThat(mFragment.mRecyclerView.getPaddingTop()).isEqualTo(
|
||||
mContext.getResources().getDimensionPixelSize(R.dimen.app_bar_height));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Reference in New Issue
Block a user