Refactoring before adding a new view type in the WidgetsListAdapter

Changes made:
1. Model: added an abstract class for storing common information for
   entries shown in the full page widgets picker.
2. Introduced a ViewHolderBinder interface to split the logic of binding
   data to ViewHolder into separate classes.
3. Move the view holder binding of WidgetsListRow from WidgetListAdapter
   to its new class.
4. Move some widgets picker classes into a new picker package.

Test: Auto: Run WidgetsListAdapterTest, WidgetsListRowEntryTest and
      WidgetsListRowViewHolderBinderTest.
      Manual: open the all apps widgets tray and navigate the list.

Bug: 179797520
Change-Id: Iab29557842bb79156cad84d00a4c5d0db0c5aa06
This commit is contained in:
Steven Ng
2021-02-08 17:18:25 +00:00
parent 823c5f8bf6
commit 2f5648a911
27 changed files with 1043 additions and 372 deletions

View File

@@ -28,7 +28,7 @@ import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.util.ComponentKey;
import com.android.launcher3.util.ItemInfoMatcher;
import com.android.launcher3.widget.WidgetListRowEntry;
import com.android.launcher3.widget.model.WidgetsListBaseEntry;
import java.util.ArrayList;
import java.util.HashMap;
@@ -123,7 +123,7 @@ public abstract class BaseModelUpdateTask implements ModelUpdateTask {
}
public void bindUpdatedWidgets(BgDataModel dataModel) {
final ArrayList<WidgetListRowEntry> widgets =
final ArrayList<WidgetsListBaseEntry> widgets =
dataModel.widgetsModel.getWidgetsList(mApp.getContext());
scheduleCallbackTask(c -> c.bindAllWidgets(widgets));
}