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

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

Merge "Adding enabled state for remote actions."

parents b2312cdb 6b88baf1
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -5717,6 +5717,8 @@ package android.app {
    method public java.lang.CharSequence getContentDescription();
    method public android.graphics.drawable.Icon getIcon();
    method public java.lang.CharSequence getTitle();
    method public boolean isEnabled();
    method public void setEnabled(boolean);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.app.RemoteAction> CREATOR;
  }
+2 −0
Original line number Diff line number Diff line
@@ -5920,6 +5920,8 @@ package android.app {
    method public java.lang.CharSequence getContentDescription();
    method public android.graphics.drawable.Icon getIcon();
    method public java.lang.CharSequence getTitle();
    method public boolean isEnabled();
    method public void setEnabled(boolean);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.app.RemoteAction> CREATOR;
  }
+2 −0
Original line number Diff line number Diff line
@@ -5728,6 +5728,8 @@ package android.app {
    method public java.lang.CharSequence getContentDescription();
    method public android.graphics.drawable.Icon getIcon();
    method public java.lang.CharSequence getTitle();
    method public boolean isEnabled();
    method public void setEnabled(boolean);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.app.RemoteAction> CREATOR;
  }
+22 −1
Original line number Diff line number Diff line
@@ -41,12 +41,14 @@ public final class RemoteAction implements Parcelable {
    private final CharSequence mTitle;
    private final CharSequence mContentDescription;
    private final PendingIntent mActionIntent;
    private boolean mEnabled;

    RemoteAction(Parcel in) {
        mIcon = Icon.CREATOR.createFromParcel(in);
        mTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
        mContentDescription = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
        mActionIntent = PendingIntent.CREATOR.createFromParcel(in);
        mEnabled = in.readBoolean();
    }

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

    /**
     * Sets whether this action is enabled.
     */
    public void setEnabled(boolean enabled) {
        mEnabled = enabled;
    }

    /**
     * Return whether this action is enabled.
     */
    public boolean isEnabled() {
        return mEnabled;
    }

    /**
@@ -91,7 +108,9 @@ public final class RemoteAction implements Parcelable {

    @Override
    public RemoteAction clone() {
        return new RemoteAction(mIcon, mTitle, mContentDescription, mActionIntent);
        RemoteAction action = new RemoteAction(mIcon, mTitle, mContentDescription, mActionIntent);
        action.setEnabled(mEnabled);
        return action;
    }

    @Override
@@ -105,11 +124,13 @@ public final class RemoteAction implements Parcelable {
        TextUtils.writeToParcel(mTitle, out, flags);
        TextUtils.writeToParcel(mContentDescription, out, flags);
        mActionIntent.writeToParcel(out, flags);
        out.writeBoolean(mEnabled);
    }

    public void dump(String prefix, PrintWriter pw) {
        pw.print(prefix);
        pw.print("title=" + mTitle);
        pw.print(" enabled=" + mEnabled);
        pw.print(" contentDescription=" + mContentDescription);
        pw.print(" icon=" + mIcon);
        pw.print(" action=" + mActionIntent.getIntent());
+2 −1
Original line number Diff line number Diff line
@@ -18,4 +18,5 @@
    android:layout_width="@dimen/pip_action_size"
    android:layout_height="@dimen/pip_action_size"
    android:padding="@dimen/pip_action_padding"
    android:background="?android:selectableItemBackgroundBorderless" />
 No newline at end of file
    android:background="?android:selectableItemBackgroundBorderless"
    android:forceHasOverlappingRendering="false" />
 No newline at end of file
Loading