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

@@ -65,7 +65,9 @@ public class SuggestionDismissController extends ItemTouchHelper.SimpleCallback
@Override
public int getSwipeDirs(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
if (viewHolder.getItemViewType() == R.layout.suggestion_tile) {
final int layoutId = viewHolder.getItemViewType();
if (layoutId == R.layout.suggestion_tile
|| layoutId == R.layout.suggestion_tile_card) {
// Only return swipe direction for suggestion tiles. All other types are not swipeable.
return super.getSwipeDirs(recyclerView, viewHolder);
}