Loading core/java/android/view/textclassifier/TextClassification.java +4 −2 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); } Loading Loading @@ -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 Loading core/tests/coretests/src/android/view/textclassifier/TextClassificationTest.java +2 −1 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; } Loading Loading
core/java/android/view/textclassifier/TextClassification.java +4 −2 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); } Loading Loading @@ -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 Loading
core/tests/coretests/src/android/view/textclassifier/TextClassificationTest.java +2 −1 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; } Loading