Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5a05f5f5 authored by tim peng's avatar tim peng Committed by Android (Google) Code Review
Browse files

Merge "Update preferenceSlice layout rule for new volume panel design"

parents ddb7746f da96aeb3
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -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)
+14 −9
Original line number Diff line number Diff line
@@ -286,7 +286,7 @@ public class SliceBuilderUtils {
        final PendingIntent actionIntent = getSliderAction(context, sliceData);
        final PendingIntent contentIntent = getContentPendingIntent(context, sliceData);
        final IconCompat icon = getSafeIcon(context, sliceData);
        @ColorInt final int color = Utils.getColorAccentDefaultColor(context);
        @ColorInt int color = Utils.getColorAccentDefaultColor(context);
        final CharSequence subtitleText = getSubtitleText(context, controller, sliceData);
        final SliceAction primaryAction = SliceAction.createDeeplink(contentIntent, icon,
                ListBuilder.ICON_IMAGE, sliceData.getTitle());
@@ -299,17 +299,22 @@ public class SliceBuilderUtils {
        if (cur > sliderController.getMax()) {
            cur = sliderController.getMax();
        }

        return new ListBuilder(context, sliceData.getUri(), ListBuilder.INFINITY)
                .setAccentColor(color)
                .addInputRange(new InputRangeBuilder()
        final InputRangeBuilder inputRangeBuilder = new InputRangeBuilder()
                .setTitle(sliceData.getTitle())
                .setSubtitle(subtitleText)
                .setPrimaryAction(primaryAction)
                .setMax(sliderController.getMax())
                .setMin(sliderController.getMin())
                .setValue(cur)
                        .setInputAction(actionIntent))
                .setInputAction(actionIntent);
        if (sliceData.getIconResource() != 0) {
            inputRangeBuilder.setTitleItem(icon, ListBuilder.ICON_IMAGE);
            color = CustomSliceable.COLOR_NOT_TINTED;
        }

        return new ListBuilder(context, sliceData.getUri(), ListBuilder.INFINITY)
                .setAccentColor(color)
                .addInputRange(inputRangeBuilder)
                .setKeywords(keywords)
                .build();
    }