Update preferenceSlice layout rule for new volume panel design

-show icon at left side of Slice if the mapping preference contains icon
-align MediaOutputIndicatorSlice layout with other volume slice

Bug: 148821795
Test: make -j42 RunSettingsRoboTests
Change-Id: I5b0cf7f32f355503942cb62ccf36f77ceeb1b30d
This commit is contained in:
timhypeng
2020-02-04 10:19:33 +08:00
committed by tim peng
parent b7f5bf4682
commit da96aeb33d
2 changed files with 22 additions and 10 deletions

View File

@@ -23,6 +23,7 @@ import android.app.PendingIntent;
import android.bluetooth.BluetoothDevice;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.util.Log;
@@ -77,18 +78,24 @@ public class MediaOutputIndicatorSlice implements CustomSliceable {
final SliceAction primarySliceAction = SliceAction.createDeeplink(
primaryActionIntent, icon, ListBuilder.ICON_IMAGE, title);
@ColorInt final int color = Utils.getColorAccentDefaultColor(mContext);
// To set an empty icon to indent the row
final ListBuilder listBuilder = new ListBuilder(mContext,
MEDIA_OUTPUT_INDICATOR_SLICE_URI,
ListBuilder.INFINITY)
.setAccentColor(color)
.addRow(new ListBuilder.RowBuilder()
.setTitle(title)
.setTitleItem(createEmptyIcon(), ListBuilder.ICON_IMAGE)
.setSubtitle(findActiveDeviceName())
.setPrimaryAction(primarySliceAction));
return listBuilder.build();
}
private IconCompat createEmptyIcon() {
final Bitmap bitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888);
return IconCompat.createWithBitmap(bitmap);
}
private Intent getMediaOutputSliceIntent() {
final Intent intent = new Intent()
.setAction(MediaOutputSliceConstants.ACTION_MEDIA_OUTPUT)