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

Commit 08a75e0e authored by Jan Althaus's avatar Jan Althaus Committed by Android (Google) Code Review
Browse files

Merge "Change TextClassification to use RemoteActions" into pi-dev

parents 5e86c3c2 20d346ea
Loading
Loading
Loading
Loading
+12 −15
Original line number Diff line number Diff line
@@ -5877,6 +5877,8 @@ package android.app {
    method public java.lang.CharSequence getTitle();
    method public boolean isEnabled();
    method public void setEnabled(boolean);
    method public void setShouldShowIcon(boolean);
    method public boolean shouldShowIcon();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.app.RemoteAction> CREATOR;
  }
@@ -50354,17 +50356,14 @@ package android.view.textclassifier {
  public final class TextClassification implements android.os.Parcelable {
    method public int describeContents();
    method public java.util.List<android.app.RemoteAction> getActions();
    method public float getConfidenceScore(java.lang.String);
    method public java.lang.String getEntity(int);
    method public int getEntityCount();
    method public android.graphics.drawable.Drawable getIcon();
    method public android.content.Intent getIntent();
    method public java.lang.CharSequence getLabel();
    method public android.view.View.OnClickListener getOnClickListener();
    method public int getSecondaryActionsCount();
    method public android.graphics.drawable.Drawable getSecondaryIcon(int);
    method public android.content.Intent getSecondaryIntent(int);
    method public java.lang.CharSequence getSecondaryLabel(int);
    method public deprecated android.graphics.drawable.Drawable getIcon();
    method public deprecated android.content.Intent getIntent();
    method public deprecated java.lang.CharSequence getLabel();
    method public deprecated android.view.View.OnClickListener getOnClickListener();
    method public java.lang.String getSignature();
    method public java.lang.String getText();
    method public void writeToParcel(android.os.Parcel, int);
@@ -50373,15 +50372,13 @@ package android.view.textclassifier {
  public static final class TextClassification.Builder {
    ctor public TextClassification.Builder();
    method public android.view.textclassifier.TextClassification.Builder addSecondaryAction(android.content.Intent, java.lang.String, android.graphics.drawable.Drawable);
    method public android.view.textclassifier.TextClassification.Builder addAction(android.app.RemoteAction);
    method public android.view.textclassifier.TextClassification build();
    method public android.view.textclassifier.TextClassification.Builder clearSecondaryActions();
    method public android.view.textclassifier.TextClassification.Builder setEntityType(java.lang.String, float);
    method public android.view.textclassifier.TextClassification.Builder setIcon(android.graphics.drawable.Drawable);
    method public android.view.textclassifier.TextClassification.Builder setIntent(android.content.Intent);
    method public android.view.textclassifier.TextClassification.Builder setLabel(java.lang.String);
    method public android.view.textclassifier.TextClassification.Builder setOnClickListener(android.view.View.OnClickListener);
    method public android.view.textclassifier.TextClassification.Builder setPrimaryAction(android.content.Intent, java.lang.String, android.graphics.drawable.Drawable);
    method public deprecated android.view.textclassifier.TextClassification.Builder setIcon(android.graphics.drawable.Drawable);
    method public deprecated android.view.textclassifier.TextClassification.Builder setIntent(android.content.Intent);
    method public deprecated android.view.textclassifier.TextClassification.Builder setLabel(java.lang.String);
    method public deprecated android.view.textclassifier.TextClassification.Builder setOnClickListener(android.view.View.OnClickListener);
    method public android.view.textclassifier.TextClassification.Builder setSignature(java.lang.String);
    method public android.view.textclassifier.TextClassification.Builder setText(java.lang.String);
  }
+19 −5
Original line number Diff line number Diff line
@@ -18,14 +18,9 @@ package android.app;

import android.annotation.NonNull;
import android.graphics.drawable.Icon;
import android.os.Handler;
import android.os.Message;
import android.os.Messenger;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.RemoteException;
import android.text.TextUtils;
import android.util.Log;

import java.io.PrintWriter;

@@ -42,6 +37,7 @@ public final class RemoteAction implements Parcelable {
    private final CharSequence mContentDescription;
    private final PendingIntent mActionIntent;
    private boolean mEnabled;
    private boolean mShouldShowIcon;

    RemoteAction(Parcel in) {
        mIcon = Icon.CREATOR.createFromParcel(in);
@@ -49,6 +45,7 @@ public final class RemoteAction implements Parcelable {
        mContentDescription = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
        mActionIntent = PendingIntent.CREATOR.createFromParcel(in);
        mEnabled = in.readBoolean();
        mShouldShowIcon = in.readBoolean();
    }

    public RemoteAction(@NonNull Icon icon, @NonNull CharSequence title,
@@ -62,6 +59,7 @@ public final class RemoteAction implements Parcelable {
        mContentDescription = contentDescription;
        mActionIntent = intent;
        mEnabled = true;
        mShouldShowIcon = true;
    }

    /**
@@ -78,6 +76,20 @@ public final class RemoteAction implements Parcelable {
        return mEnabled;
    }

    /**
     * Sets whether the icon should be shown.
     */
    public void setShouldShowIcon(boolean shouldShowIcon) {
        mShouldShowIcon = shouldShowIcon;
    }

    /**
     * Return whether the icon should be shown.
     */
    public boolean shouldShowIcon() {
        return mShouldShowIcon;
    }

    /**
     * Return an icon representing the action.
     */
@@ -125,6 +137,7 @@ public final class RemoteAction implements Parcelable {
        TextUtils.writeToParcel(mContentDescription, out, flags);
        mActionIntent.writeToParcel(out, flags);
        out.writeBoolean(mEnabled);
        out.writeBoolean(mShouldShowIcon);
    }

    public void dump(String prefix, PrintWriter pw) {
@@ -134,6 +147,7 @@ public final class RemoteAction implements Parcelable {
        pw.print(" contentDescription=" + mContentDescription);
        pw.print(" icon=" + mIcon);
        pw.print(" action=" + mActionIntent.getIntent());
        pw.print(" shouldShowIcon=" + mShouldShowIcon);
        pw.println();
    }

+119 −236

File changed.

Preview size limit exceeded, changes collapsed.

+153 −137

File changed.

Preview size limit exceeded, changes collapsed.

+38 −38

File changed.

Preview size limit exceeded, changes collapsed.

Loading