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

Commit d591904d authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix size of parcelled TextClassification icons."

parents f62b1d36 ef7cb2c0
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.drawable.BitmapDrawable;
@@ -378,7 +379,7 @@ public final class TextClassification implements Parcelable {
        final List<Drawable> drawables = new ArrayList<>(bitmaps.size());
        for (Bitmap bitmap : bitmaps) {
            if (bitmap != null) {
                drawables.add(new BitmapDrawable(null, bitmap));
                drawables.add(new BitmapDrawable(Resources.getSystem(), bitmap));
            } else {
                drawables.add(null);
            }
@@ -681,7 +682,8 @@ public final class TextClassification implements Parcelable {
    private TextClassification(Parcel in) {
        mText = in.readString();
        mPrimaryIcon = in.readInt() == 0
                ? null : new BitmapDrawable(null, Bitmap.CREATOR.createFromParcel(in));
                ? null
                : new BitmapDrawable(Resources.getSystem(), Bitmap.CREATOR.createFromParcel(in));
        mPrimaryLabel = in.readString();
        mPrimaryIntent = in.readInt() == 0 ? null : Intent.CREATOR.createFromParcel(in);
        mPrimaryOnClickListener = null;  // not parcelable
+2 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package android.view.textclassifier;
import static org.junit.Assert.assertEquals;

import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
@@ -47,7 +48,7 @@ public class TextClassificationTest {
            colors[i] = colorValue;
        }
        final Bitmap bitmap = Bitmap.createBitmap(colors, width, height, Bitmap.Config.ARGB_8888);
        final BitmapDrawable drawable = new BitmapDrawable(null, bitmap);
        final BitmapDrawable drawable = new BitmapDrawable(Resources.getSystem(), bitmap);
        drawable.setTargetDensity(bitmap.getDensity());
        return drawable;
    }