Allow remote views to be used in Tiles

If a suggeested action Tile has a remote view defined, inflate a card
layout to contain the remote view, instead of showing the default
title-summary layout.

Additionally, if the remote view has a view with ID
@android:id/primary, that will be used as the click target rather
than the entire card.

Test: cd tests/robotests && mma
Bug: 35668836
Change-Id: I0fd1b9c637b6d7a3d7d2f6268669917408a882eb
This commit is contained in:
Maurice Lam
2017-03-23 21:23:09 -07:00
parent a2218a938f
commit fc972a75a9
8 changed files with 192 additions and 29 deletions

View File

@@ -218,7 +218,13 @@ public class DashboardData {
*/
private void countSuggestion(Tile tile, boolean add) {
if (add) {
mItems.add(new Item(tile, R.layout.suggestion_tile, Objects.hash(tile.title), false));
mItems.add(new Item(
tile,
tile.remoteViews != null
? R.layout.suggestion_tile_card
: R.layout.suggestion_tile,
Objects.hash(tile.title),
false));
}
mId++;
}