Remove "See more" from wifi/bluetooth slices

- Also set the height of SliceView back to wrap_content as the space our
content needs can be satisfied with MODE_LARGE.

Change-Id: Ibaa514ac9c022c2723d99e5104f8d5ec63f14661
Fixes: 118763869
Test: robotests, visual
This commit is contained in:
Emily Chuang
2018-11-01 11:38:25 +08:00
committed by Fan Zhang
parent e4b4923dd0
commit 4b08270d8c
6 changed files with 10 additions and 30 deletions

View File

@@ -24,9 +24,9 @@
<androidx.slice.widget.SliceView
android:id="@+id/slice_view"
android:layout_width="match_parent"
android:layout_height="@dimen/homepage_slice_card_max_height"
android:layout_marginBottom="@dimen/homepage_card_bottom_margin"
android:layout_marginTop="@dimen/homepage_card_top_margin"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/homepage_card_vertical_margin"
android:layout_marginTop="@dimen/homepage_card_vertical_margin"
android:paddingStart="@dimen/homepage_card_padding_start"
android:paddingEnd="@dimen/homepage_card_padding_end"/>

View File

@@ -327,17 +327,10 @@
<!-- Homepage cards size and padding -->
<dimen name="homepage_card_corner_radius">8dp</dimen>
<dimen name="homepage_card_elevation">2dp</dimen>
<dimen name="homepage_card_top_margin">6dp</dimen>
<dimen name="homepage_card_bottom_margin">6dp</dimen>
<dimen name="homepage_card_vertical_margin">6dp</dimen>
<dimen name="homepage_card_side_margin">16dp</dimen>
<dimen name="homepage_card_padding_start">16dp</dimen>
<dimen name="homepage_card_padding_end">16dp</dimen>
<dimen name="homepage_card_padding_top">6dp</dimen>
<dimen name="homepage_card_padding_bottom">6dp</dimen>
<!-- Slice cards maximum height (4 rows + show more)
MODE_LARGE height(3 rows + show more) 240dp + two lines text(1 row) 60dp = 300dp -->
<dimen name="homepage_slice_card_max_height">300dp</dimen>
<!-- Signal icon in NetworkSelectSetting -->
<dimen name="signal_strength_icon_size">24dp</dimen>

View File

@@ -455,8 +455,8 @@
</style>
<style name="ContextualCardStyle">
<item name="android:layout_marginTop">@dimen/homepage_card_top_margin</item>
<item name="android:layout_marginBottom">@dimen/homepage_card_bottom_margin</item>
<item name="android:layout_marginTop">@dimen/homepage_card_vertical_margin</item>
<item name="android:layout_marginBottom">@dimen/homepage_card_vertical_margin</item>
<item name="android:layout_marginStart">@dimen/homepage_card_side_margin</item>
<item name="android:layout_marginEnd">@dimen/homepage_card_side_margin</item>
<item name="cardCornerRadius">@dimen/homepage_card_corner_radius</item>

View File

@@ -95,8 +95,6 @@ public class ConnectedDeviceSlice implements CustomSliceable {
private static final Comparator<CachedBluetoothDevice> COMPARATOR
= Comparator.naturalOrder();
private static final int DEFAULT_EXPANDED_ROW_COUNT = 4;
private static final String TAG = "ConnectedDeviceSlice";
private final Context mContext;
@@ -162,13 +160,6 @@ public class ConnectedDeviceSlice implements CustomSliceable {
for (ListBuilder.RowBuilder rowBuilder : rows) {
listBuilder.addRow(rowBuilder);
}
// Only show "see more" button when the number of data row is more than or equal to 4.
// TODO(b/118465996): SHOW MORE button won't work properly when having two data rows
if (rows.size() >= DEFAULT_EXPANDED_ROW_COUNT) {
listBuilder.setSeeMoreAction(primaryActionIntent);
}
return listBuilder.build();
}

View File

@@ -71,7 +71,7 @@ public class WifiSlice implements CustomSliceable {
.build();
@VisibleForTesting
static final int DEFAULT_EXPANDED_ROW_COUNT = 4;
static final int DEFAULT_EXPANDED_ROW_COUNT = 3;
private final Context mContext;
@@ -137,10 +137,7 @@ public class WifiSlice implements CustomSliceable {
.setSubtitle(placeholder));
}
}
// Add more button
return listBuilder
.setSeeMoreAction(primaryAction)
.build();
return listBuilder.build();
}
private RowBuilder getAccessPointRow(AccessPoint accessPoint) {

View File

@@ -88,9 +88,8 @@ public class WifiSliceTest {
int rows = SliceQuery.findAll(wifiSlice, FORMAT_SLICE, HINT_LIST_ITEM,
null /* nonHints */).size();
// All AP rows + title row + see more row
// (see more row will drop the last AP row, thus -1)
assertThat(rows).isEqualTo(DEFAULT_EXPANDED_ROW_COUNT - 1 + 2);
// All AP rows + title row
assertThat(rows).isEqualTo(DEFAULT_EXPANDED_ROW_COUNT + 1);
}
@Test