Merge "Fix text overlap issue when flinging in ManageApplication" into pi-dev

This commit is contained in:
TreeHugger Robot
2018-03-26 21:50:14 +00:00
committed by Android (Google) Code Review
2 changed files with 88 additions and 4 deletions

View File

@@ -16,6 +16,8 @@
package com.android.settings.applications.manageapplications;
import static android.support.v7.widget.RecyclerView.SCROLL_STATE_DRAGGING;
import static android.support.v7.widget.RecyclerView.SCROLL_STATE_IDLE;
import static com.android.settings.applications.manageapplications.AppFilterRegistry.FILTER_APPS_ALL;
import static com.android.settings.applications.manageapplications.ManageApplications.LIST_TYPE_MAIN;
import static com.android.settings.applications.manageapplications.ManageApplications.LIST_TYPE_NOTIFICATION;
@@ -229,6 +231,40 @@ public class ManageApplicationsTest {
verify(loadingViewController).showContent(true /* animate */);
}
@Test
public void notifyItemChange_recyclerViewIdle_shouldNotify() {
final RecyclerView recyclerView = mock(RecyclerView.class);
final ManageApplications.ApplicationsAdapter adapter =
spy(new ManageApplications.ApplicationsAdapter(mState,
mock(ManageApplications.class),
AppFilterRegistry.getInstance().get(FILTER_APPS_ALL), new Bundle()));
adapter.onAttachedToRecyclerView(recyclerView);
adapter.mOnScrollListener.onScrollStateChanged(recyclerView, SCROLL_STATE_IDLE);
adapter.mOnScrollListener.postNotifyItemChange(0 /* index */);
verify(adapter).notifyItemChanged(0);
}
@Test
public void notifyItemChange_recyclerViewScrolling_shouldNotifyWhenIdle() {
final RecyclerView recyclerView = mock(RecyclerView.class);
final ManageApplications.ApplicationsAdapter adapter =
spy(new ManageApplications.ApplicationsAdapter(mState,
mock(ManageApplications.class),
AppFilterRegistry.getInstance().get(FILTER_APPS_ALL), new Bundle()));
adapter.onAttachedToRecyclerView(recyclerView);
adapter.mOnScrollListener.onScrollStateChanged(recyclerView, SCROLL_STATE_DRAGGING);
adapter.mOnScrollListener.postNotifyItemChange(0 /* index */);
verify(adapter, never()).notifyItemChanged(0);
verify(adapter, never()).notifyDataSetChanged();
adapter.mOnScrollListener.onScrollStateChanged(recyclerView, SCROLL_STATE_IDLE);
verify(adapter).notifyDataSetChanged();
}
private void setUpOptionMenus() {
when(mMenu.findItem(anyInt())).thenAnswer(invocation -> {
final Object[] args = invocation.getArguments();