- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
171 lines
5.6 KiB
Java
171 lines
5.6 KiB
Java
package androidx.core.app;
|
|
|
|
import android.annotation.SuppressLint;
|
|
import android.app.PendingIntent;
|
|
import android.app.RemoteAction;
|
|
import android.graphics.drawable.Icon;
|
|
import android.os.Build;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.RequiresApi;
|
|
import androidx.annotation.RestrictTo;
|
|
import androidx.core.graphics.drawable.IconCompat;
|
|
import androidx.core.util.Preconditions;
|
|
import androidx.versionedparcelable.VersionedParcelable;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class RemoteActionCompat implements VersionedParcelable {
|
|
|
|
@NonNull
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
|
|
public PendingIntent mActionIntent;
|
|
|
|
@NonNull
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
|
|
public CharSequence mContentDescription;
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
|
|
public boolean mEnabled;
|
|
|
|
@NonNull
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
|
|
public IconCompat mIcon;
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
|
|
public boolean mShouldShowIcon;
|
|
|
|
@NonNull
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
|
|
public CharSequence mTitle;
|
|
|
|
@NonNull
|
|
public PendingIntent getActionIntent() {
|
|
return this.mActionIntent;
|
|
}
|
|
|
|
@NonNull
|
|
public CharSequence getContentDescription() {
|
|
return this.mContentDescription;
|
|
}
|
|
|
|
@NonNull
|
|
public IconCompat getIcon() {
|
|
return this.mIcon;
|
|
}
|
|
|
|
@NonNull
|
|
public CharSequence getTitle() {
|
|
return this.mTitle;
|
|
}
|
|
|
|
public boolean isEnabled() {
|
|
return this.mEnabled;
|
|
}
|
|
|
|
public void setEnabled(boolean z) {
|
|
this.mEnabled = z;
|
|
}
|
|
|
|
public void setShouldShowIcon(boolean z) {
|
|
this.mShouldShowIcon = z;
|
|
}
|
|
|
|
@SuppressLint({"KotlinPropertyAccess"})
|
|
public boolean shouldShowIcon() {
|
|
return this.mShouldShowIcon;
|
|
}
|
|
|
|
public RemoteActionCompat(@NonNull IconCompat iconCompat, @NonNull CharSequence charSequence, @NonNull CharSequence charSequence2, @NonNull PendingIntent pendingIntent) {
|
|
this.mIcon = (IconCompat) Preconditions.checkNotNull(iconCompat);
|
|
this.mTitle = (CharSequence) Preconditions.checkNotNull(charSequence);
|
|
this.mContentDescription = (CharSequence) Preconditions.checkNotNull(charSequence2);
|
|
this.mActionIntent = (PendingIntent) Preconditions.checkNotNull(pendingIntent);
|
|
this.mEnabled = true;
|
|
this.mShouldShowIcon = true;
|
|
}
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
|
|
public RemoteActionCompat() {
|
|
}
|
|
|
|
public RemoteActionCompat(@NonNull RemoteActionCompat remoteActionCompat) {
|
|
Preconditions.checkNotNull(remoteActionCompat);
|
|
this.mIcon = remoteActionCompat.mIcon;
|
|
this.mTitle = remoteActionCompat.mTitle;
|
|
this.mContentDescription = remoteActionCompat.mContentDescription;
|
|
this.mActionIntent = remoteActionCompat.mActionIntent;
|
|
this.mEnabled = remoteActionCompat.mEnabled;
|
|
this.mShouldShowIcon = remoteActionCompat.mShouldShowIcon;
|
|
}
|
|
|
|
@NonNull
|
|
@RequiresApi(26)
|
|
public static RemoteActionCompat createFromRemoteAction(@NonNull RemoteAction remoteAction) {
|
|
Preconditions.checkNotNull(remoteAction);
|
|
RemoteActionCompat remoteActionCompat = new RemoteActionCompat(IconCompat.createFromIcon(Api26Impl.getIcon(remoteAction)), Api26Impl.getTitle(remoteAction), Api26Impl.getContentDescription(remoteAction), Api26Impl.getActionIntent(remoteAction));
|
|
remoteActionCompat.setEnabled(Api26Impl.isEnabled(remoteAction));
|
|
if (Build.VERSION.SDK_INT >= 28) {
|
|
remoteActionCompat.setShouldShowIcon(Api28Impl.shouldShowIcon(remoteAction));
|
|
}
|
|
return remoteActionCompat;
|
|
}
|
|
|
|
@NonNull
|
|
@RequiresApi(26)
|
|
public RemoteAction toRemoteAction() {
|
|
RemoteAction createRemoteAction = Api26Impl.createRemoteAction(this.mIcon.toIcon(), this.mTitle, this.mContentDescription, this.mActionIntent);
|
|
Api26Impl.setEnabled(createRemoteAction, isEnabled());
|
|
if (Build.VERSION.SDK_INT >= 28) {
|
|
Api28Impl.setShouldShowIcon(createRemoteAction, shouldShowIcon());
|
|
}
|
|
return createRemoteAction;
|
|
}
|
|
|
|
@RequiresApi(28)
|
|
public static class Api28Impl {
|
|
private Api28Impl() {
|
|
}
|
|
|
|
public static boolean shouldShowIcon(RemoteAction remoteAction) {
|
|
return remoteAction.shouldShowIcon();
|
|
}
|
|
|
|
public static void setShouldShowIcon(RemoteAction remoteAction, boolean z) {
|
|
remoteAction.setShouldShowIcon(z);
|
|
}
|
|
}
|
|
|
|
@RequiresApi(26)
|
|
public static class Api26Impl {
|
|
private Api26Impl() {
|
|
}
|
|
|
|
public static CharSequence getContentDescription(RemoteAction remoteAction) {
|
|
return remoteAction.getContentDescription();
|
|
}
|
|
|
|
public static PendingIntent getActionIntent(RemoteAction remoteAction) {
|
|
return remoteAction.getActionIntent();
|
|
}
|
|
|
|
public static CharSequence getTitle(RemoteAction remoteAction) {
|
|
return remoteAction.getTitle();
|
|
}
|
|
|
|
public static Icon getIcon(RemoteAction remoteAction) {
|
|
return remoteAction.getIcon();
|
|
}
|
|
|
|
public static boolean isEnabled(RemoteAction remoteAction) {
|
|
return remoteAction.isEnabled();
|
|
}
|
|
|
|
public static RemoteAction createRemoteAction(Icon icon, CharSequence charSequence, CharSequence charSequence2, PendingIntent pendingIntent) {
|
|
return new RemoteAction(icon, charSequence, charSequence2, pendingIntent);
|
|
}
|
|
|
|
public static void setEnabled(RemoteAction remoteAction, boolean z) {
|
|
remoteAction.setEnabled(z);
|
|
}
|
|
}
|
|
}
|