Support Remote actions

Bug: 168846477
Test: Manual
Change-Id: I7b9dc96bc7a8ccb25ccb4b7135880768256f1ef3
This commit is contained in:
Samuel Fufa
2020-09-23 00:45:27 -07:00
parent 006d2a3d6d
commit 02be2a43f5
11 changed files with 307 additions and 169 deletions

View File

@@ -65,6 +65,7 @@ import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.ItemInfoWithIcon;
import com.android.launcher3.model.data.PackageItemInfo;
import com.android.launcher3.model.data.PromiseAppInfo;
import com.android.launcher3.model.data.RemoteActionItemInfo;
import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.util.SafeCloseable;
import com.android.launcher3.views.ActivityContext;
@@ -300,6 +301,14 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
verifyHighRes();
}
/**
* Apply label and tag using a {@link RemoteActionItemInfo}
*/
public void applyFromRemoteActionInfo(RemoteActionItemInfo remoteActionItemInfo) {
applyIconAndLabel(remoteActionItemInfo);
setTag(remoteActionItemInfo);
}
private void applyIconAndLabel(ItemInfoWithIcon info) {
FastBitmapDrawable iconDrawable = newIcon(getContext(), info);
mDotParams.color = IconPalette.getMutedColor(info.bitmap.color, 0.54f);
@@ -681,6 +690,8 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
mActivity.invalidateParent(info);
} else if (info instanceof PackageItemInfo) {
applyFromItemInfoWithIcon((PackageItemInfo) info);
} else if (info instanceof RemoteActionItemInfo) {
applyFromRemoteActionInfo((RemoteActionItemInfo) info);
}
mDisableRelayout = false;