mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-02 08:56:55 +00:00
Implementing support for item diffing instead of creating out the
complete UI on every update Bug: 229860311 Test: Verified locally Change-Id: I5712b5d76878a0ed72cc1392ede59b3778b7a1dc
This commit is contained in:
@@ -25,11 +25,14 @@ import static org.junit.Assert.assertTrue;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView.ViewHolder;
|
||||
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.allapps.ActivityAllAppsContainerView;
|
||||
import com.android.launcher3.allapps.AllAppsPagedView;
|
||||
import com.android.launcher3.allapps.WorkAdapterProvider;
|
||||
import com.android.launcher3.allapps.WorkEduCard;
|
||||
import com.android.launcher3.allapps.WorkPausedCard;
|
||||
import com.android.launcher3.allapps.WorkProfileManager;
|
||||
import com.android.launcher3.tapl.LauncherInstrumentation;
|
||||
|
||||
@@ -38,6 +41,7 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class WorkProfileTest extends AbstractLauncherUiTest {
|
||||
|
||||
@@ -130,6 +134,8 @@ public class WorkProfileTest extends AbstractLauncherUiTest {
|
||||
return manager.getCurrentState() == WorkProfileManager.STATE_DISABLED;
|
||||
}, LauncherInstrumentation.WAIT_TIME_MS);
|
||||
|
||||
waitForWorkCard("Work paused card not shown", view -> view instanceof WorkPausedCard);
|
||||
|
||||
// start work profile toggle ON test
|
||||
executeOnLauncher(l -> {
|
||||
ActivityAllAppsContainerView<?> allApps = l.getAppsView();
|
||||
@@ -154,9 +160,19 @@ public class WorkProfileTest extends AbstractLauncherUiTest {
|
||||
l.getAppsView().getWorkManager().reset();
|
||||
});
|
||||
|
||||
waitForLauncherCondition("Work profile education not shown",
|
||||
l -> l.getAppsView().getActiveRecyclerView()
|
||||
.findViewHolderForAdapterPosition(0).itemView instanceof WorkEduCard,
|
||||
LauncherInstrumentation.WAIT_TIME_MS);
|
||||
waitForWorkCard("Work profile education not shown", view -> view instanceof WorkEduCard);
|
||||
}
|
||||
|
||||
private void waitForWorkCard(String message, Predicate<View> workCardCheck) {
|
||||
waitForLauncherCondition(message, l -> {
|
||||
l.getAppsView().getAppsStore().disableDeferUpdates(DEFER_UPDATES_TEST);
|
||||
ViewHolder holder = l.getAppsView().getActiveRecyclerView()
|
||||
.findViewHolderForAdapterPosition(0);
|
||||
try {
|
||||
return holder != null && workCardCheck.test(holder.itemView);
|
||||
} finally {
|
||||
l.getAppsView().getAppsStore().enableDeferUpdates(DEFER_UPDATES_TEST);
|
||||
}
|
||||
}, LauncherInstrumentation.WAIT_TIME_MS);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user