discord-jadx/app/src/main/java/androidx/core/app/RemoteActionCompat.java

108 lines
3.8 KiB
Java

package androidx.core.app;
import android.app.PendingIntent;
import android.app.RemoteAction;
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;
public final class RemoteActionCompat implements VersionedParcelable {
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public PendingIntent mActionIntent;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public CharSequence mContentDescription;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public boolean mEnabled;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public IconCompat mIcon;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public boolean mShouldShowIcon;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public CharSequence mTitle;
@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;
}
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;
}
@NonNull
@RequiresApi(26)
public static RemoteActionCompat createFromRemoteAction(@NonNull RemoteAction remoteAction) {
Preconditions.checkNotNull(remoteAction);
RemoteActionCompat remoteActionCompat = new RemoteActionCompat(IconCompat.createFromIcon(remoteAction.getIcon()), remoteAction.getTitle(), remoteAction.getContentDescription(), remoteAction.getActionIntent());
remoteActionCompat.setEnabled(remoteAction.isEnabled());
if (Build.VERSION.SDK_INT >= 28) {
remoteActionCompat.setShouldShowIcon(remoteAction.shouldShowIcon());
}
return remoteActionCompat;
}
@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 z2) {
this.mEnabled = z2;
}
public void setShouldShowIcon(boolean z2) {
this.mShouldShowIcon = z2;
}
public boolean shouldShowIcon() {
return this.mShouldShowIcon;
}
@NonNull
@RequiresApi(26)
public RemoteAction toRemoteAction() {
RemoteAction remoteAction = new RemoteAction(this.mIcon.toIcon(), this.mTitle, this.mContentDescription, this.mActionIntent);
remoteAction.setEnabled(isEnabled());
if (Build.VERSION.SDK_INT >= 28) {
remoteAction.setShouldShowIcon(shouldShowIcon());
}
return remoteAction;
}
}