PhotoRoom v4.8.2版本的 MD5 值为:c40a01bb3380c0f75c0cb6ac6760f295
以下内容为反编译后的 CourierInbox.java 源代码,内容仅作参考
package com.courier.android.inbox;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.ColorStateList;
import android.net.Uri;
import android.util.AttributeSet;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.appcompat.app.d;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import b10.e1;
import b10.e2;
import com.courier.android.Courier;
import com.courier.android.R;
import com.courier.android.inbox.CourierInboxTheme;
import com.courier.android.models.CourierAgent;
import com.courier.android.models.CourierBrand;
import com.courier.android.models.CourierBrandInApp;
import com.courier.android.models.CourierBrandSettings;
import com.courier.android.models.CourierInboxListener;
import com.courier.android.models.CourierInboxListenerKt;
import com.courier.android.models.InboxAction;
import com.courier.android.models.InboxMessage;
import com.courier.android.modules.CoreInboxKt;
import com.courier.android.repositories.InboxRepository;
import com.courier.android.utils.ExtensionsKt;
import com.shakebugs.shake.form.ShakeTitle;
import gy.i;
import hy.l;
import hy.p;
import hy.q;
import java.util.List;
import kotlin.Metadata;
import kotlin.collections.c0;
import kotlin.collections.u;
import kotlin.jvm.internal.k;
import kotlin.jvm.internal.t;
import px.f1;
import px.x;
import px.z;
import v30.r;
import v30.s;
@Metadata(d1 = {"\u0000Ð\u0001\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0010\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\u0018\u00002\u00020\u0001:\u0001pB'\b\u0007\u0012\u0006\u0010j\u001a\u00020i\u0012\n\b\u0002\u0010l\u001a\u0004\u0018\u00010k\u0012\b\b\u0002\u0010m\u001a\u00020\u001c¢\u0006\u0004\bn\u0010oJ\b\u0010\u0003\u001a\u00020\u0002H\u0002J\b\u0010\u0004\u001a\u00020\u0002H\u0002J\b\u0010\u0005\u001a\u00020\u0002H\u0002J\b\u0010\u0006\u001a\u00020\u0002H\u0002J\b\u0010\u0007\u001a\u00020\u0002H\u0002J\f\u0010\t\u001a\u00020\u0002*\u00020\bH\u0002J\f\u0010\n\u001a\u00020\u0002*\u00020\bH\u0002J\b\u0010\f\u001a\u00020\u000bH\u0002J\u0016\u0010\u0010\u001a\u00020\u00022\f\u0010\u000f\u001a\b\u0012\u0004\u0012\u00020\u000e0\rH\u0003J\u001c\u0010\u0014\u001a\u00020\u00022\b\b\u0002\u0010\u0012\u001a\u00020\u00112\b\b\u0002\u0010\u0013\u001a\u00020\u0011H\u0002J\b\u0010\u0015\u001a\u00020\u0002H\u0002J\b\u0010\u0016\u001a\u00020\u0002H\u0014J\b\u0010\u0017\u001a\u00020\u0002H\u0014J@\u0010\u001f\u001a\u00020\u000228\u0010\u001e\u001a4\u0012\u0013\u0012\u00110\u000e¢\u0006\f\b\u0019\u0012\b\b\u001a\u0012\u0004\b\b(\u001b\u0012\u0013\u0012\u00110\u001c¢\u0006\f\b\u0019\u0012\b\b\u001a\u0012\u0004\b\b(\u001d\u0012\u0004\u0012\u00020\u0002\u0018\u00010\u0018JU\u0010#\u001a\u00020\u00022M\u0010\u001e\u001aI\u0012\u0013\u0012\u00110!¢\u0006\f\b\u0019\u0012\b\b\u001a\u0012\u0004\b\b(\"\u0012\u0013\u0012\u00110\u000e¢\u0006\f\b\u0019\u0012\b\b\u001a\u0012\u0004\b\b(\u001b\u0012\u0013\u0012\u00110\u001c¢\u0006\f\b\u0019\u0012\b\b\u001a\u0012\u0004\b\b(\u001d\u0012\u0004\u0012\u00020\u0002\u0018\u00010 J+\u0010&\u001a\u00020\u00022#\u0010\u001e\u001a\u001f\u0012\u0013\u0012\u00110\u001c¢\u0006\f\b\u0019\u0012\b\b\u001a\u0012\u0004\b\b(%\u0012\u0004\u0012\u00020\u0002\u0018\u00010$R$\u0010)\u001a\u00020'2\u0006\u0010(\u001a\u00020'8\u0002@BX\u0082\u000e¢\u0006\f\n\u0004\b)\u0010*\"\u0004\b+\u0010,R*\u0010.\u001a\u00020-2\u0006\u0010(\u001a\u00020-8\u0006@FX\u0086\u000e¢\u0006\u0012\n\u0004\b.\u0010/\u001a\u0004\b0\u00101\"\u0004\b2\u00103R*\u00104\u001a\u00020-2\u0006\u0010(\u001a\u00020-8\u0006@FX\u0086\u000e¢\u0006\u0012\n\u0004\b4\u0010/\u001a\u0004\b5\u00101\"\u0004\b6\u00103R$\u00107\u001a\u00020-2\u0006\u0010(\u001a\u00020-8\u0002@CX\u0082\u000e¢\u0006\f\n\u0004\b7\u0010/\"\u0004\b8\u00103R$\u0010:\u001a\u00020\b2\u0006\u00109\u001a\u00020\b8\u0006@BX\u0086.¢\u0006\f\n\u0004\b:\u0010;\u001a\u0004\b<\u0010=R\u0016\u0010?\u001a\u00020>8\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\b?\u0010@R\u0016\u0010B\u001a\u00020A8\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\bB\u0010CR\u0016\u0010E\u001a\u00020D8\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\bE\u0010FR\u0016\u0010H\u001a\u00020G8\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\bH\u0010IR\u0016\u0010K\u001a\u00020J8\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\bK\u0010LR\u0016\u0010N\u001a\u00020M8\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\bN\u0010OR*\u0010P\u001a\u0016\u0012\u0004\u0012\u00020\u000e\u0012\u0004\u0012\u00020\u001c\u0012\u0004\u0012\u00020\u0002\u0018\u00010\u00188\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bP\u0010QR0\u0010R\u001a\u001c\u0012\u0004\u0012\u00020!\u0012\u0004\u0012\u00020\u000e\u0012\u0004\u0012\u00020\u001c\u0012\u0004\u0012\u00020\u0002\u0018\u00010 8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bR\u0010SR$\u0010T\u001a\u0010\u0012\u0004\u0012\u00020\u001c\u0012\u0004\u0012\u00020\u0002\u0018\u00010$8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bT\u0010UR\u001b\u0010[\u001a\u00020V8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\bW\u0010X\u001a\u0004\bY\u0010ZR\u0014\u0010]\u001a\u00020\\8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b]\u0010^R\u0014\u0010`\u001a\u00020_8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b`\u0010aR\u0014\u0010c\u001a\u00020b8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\bc\u0010dR\u0016\u0010h\u001a\u0004\u0018\u00010e8BX\u0082\u0004¢\u0006\u0006\u001a\u0004\bf\u0010g¨\u0006q"}, d2 = {"Lcom/courier/android/inbox/CourierInbox;", "Landroid/widget/FrameLayout;", "Lpx/f1;", "reloadViews", "refreshTheme", "openDialog", "launchCourierWebsite", "setup", "Landroidx/recyclerview/widget/RecyclerView;", "restoreScrollPosition", "forceReactNativeLayoutFix", "Lb10/e2;", "openVisibleMessages", "", "Lcom/courier/android/models/InboxMessage;", "newMessages", "refreshMessages", "", "showMessages", "showLoading", "refreshAdapters", "refreshBrand", "onAttachedToWindow", "onDetachedFromWindow", "Lkotlin/Function2;", "Lpx/i0;", "name", "message", "", "index", "listener", "setOnClickMessageListener", "Lkotlin/Function3;", "Lcom/courier/android/models/InboxAction;", "action", "setOnClickActionListener", "Lkotlin/Function1;", "offsetInDp", "setOnScrollInboxListener", "Lcom/courier/android/inbox/CourierInbox$State;", "value", "state", "Lcom/courier/android/inbox/CourierInbox$State;", "setState", "(Lcom/courier/android/inbox/CourierInbox$State;)V", "Lcom/courier/android/inbox/CourierInboxTheme;", "lightTheme", "Lcom/courier/android/inbox/CourierInboxTheme;", "getLightTheme", "()Lcom/courier/android/inbox/CourierInboxTheme;", "setLightTheme", "(Lcom/courier/android/inbox/CourierInboxTheme;)V", "darkTheme", "getDarkTheme", "setDarkTheme", "theme", "setTheme", "<set-?>", "recyclerView", "Landroidx/recyclerview/widget/RecyclerView;", "getRecyclerView", "()Landroidx/recyclerview/widget/RecyclerView;", "Landroidx/swiperefreshlayout/widget/SwipeRefreshLayout;", "refreshLayout", "Landroidx/swiperefreshlayout/widget/SwipeRefreshLayout;", "Landroid/widget/TextView;", "detailTextView", "Landroid/widget/TextView;", "Landroid/widget/RelativeLayout;", "courierBar", "Landroid/widget/RelativeLayout;", "Landroid/widget/ImageView;", "courierBarButton", "Landroid/widget/ImageView;", "Landroid/widget/ProgressBar;", "loadingIndicator", "Landroid/widget/ProgressBar;", "Lcom/courier/android/models/CourierInboxListener;", "inboxListener", "Lcom/courier/android/models/CourierInboxListener;", "onClickInboxMessageAtIndex", "Lhy/p;", "onClickInboxActionForMessageAtIndex", "Lhy/q;", "onScrollInbox", "Lhy/l;", "Lcom/courier/android/repositories/InboxRepository;", "inboxRepo$delegate", "Lpx/x;", "getInboxRepo", "()Lcom/courier/android/repositories/InboxRepository;", "inboxRepo", "Lcom/courier/android/inbox/MessagesAdapter;", "messagesAdapter", "Lcom/courier/android/inbox/MessagesAdapter;", "Lcom/courier/android/inbox/LoadingAdapter;", "loadingAdapter", "Lcom/courier/android/inbox/LoadingAdapter;", "Landroidx/recyclerview/widget/g;", "adapter", "Landroidx/recyclerview/widget/g;", "Landroidx/recyclerview/widget/LinearLayoutManager;", "getLayoutManager", "()Landroidx/recyclerview/widget/LinearLayoutManager;", "layoutManager", "Landroid/content/Context;", "context", "Landroid/util/AttributeSet;", "attrs", "defStyleAttr", "<init>", "(Landroid/content/Context;Landroid/util/AttributeSet;I)V", "State", "android_release"}, k = 1, mv = {1, 7, 1})
public final class CourierInbox extends FrameLayout {
@r
private final androidx.recyclerview.widget.g adapter;
private RelativeLayout courierBar;
private ImageView courierBarButton;
@r
private CourierInboxTheme darkTheme;
private TextView detailTextView;
private CourierInboxListener inboxListener;
@r
private final x inboxRepo$delegate;
@r
private CourierInboxTheme lightTheme;
@r
private final LoadingAdapter loadingAdapter;
private ProgressBar loadingIndicator;
@r
private final MessagesAdapter messagesAdapter;
@s
private q<? super InboxAction, ? super InboxMessage, ? super Integer, f1> onClickInboxActionForMessageAtIndex;
@s
private p<? super InboxMessage, ? super Integer, f1> onClickInboxMessageAtIndex;
@s
private l<? super Integer, f1> onScrollInbox;
private RecyclerView recyclerView;
private SwipeRefreshLayout refreshLayout;
@r
private State state;
@r
private CourierInboxTheme theme;
@Metadata(d1 = {"\u0000\u0012\n\u0002\u0018\u0002\n\u0002\u0010\u0010\n\u0000\n\u0002\u0010\u000e\n\u0002\b\n\b\u0082\u0001\u0018\u00002\b\u0012\u0004\u0012\u00020\u00000\u0001B\u0013\b\u0002\u0012\n\b\u0002\u0010\u0002\u001a\u0004\u0018\u00010\u0003¢\u0006\u0002\u0010\u0004R\u001c\u0010\u0002\u001a\u0004\u0018\u00010\u0003X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0005\u0010\u0006\"\u0004\b\u0007\u0010\bj\u0002\b\tj\u0002\b\nj\u0002\b\u000bj\u0002\b\f¨\u0006\r"}, d2 = {"Lcom/courier/android/inbox/CourierInbox$State;", "", ShakeTitle.TYPE, "", "(Ljava/lang/String;ILjava/lang/String;)V", "getTitle", "()Ljava/lang/String;", "setTitle", "(Ljava/lang/String;)V", "LOADING", "ERROR", "CONTENT", "EMPTY", "android_release"}, k = 1, mv = {1, 7, 1}, xi = 48)
public enum State {
LOADING(null, 1, null),
ERROR(null, 1, null),
CONTENT(null, 1, null),
EMPTY(null, 1, null);
@s
private String title;
State(String str) {
this.title = str;
}
State(String str, int i11, k kVar) {
this((i11 & 1) != 0 ? null : str);
}
@s
public final String getTitle() {
return this.title;
}
public final void setTitle(@s String str) {
this.title = str;
}
}
@Metadata(k = 3, mv = {1, 7, 1}, xi = 48)
public class WhenMappings {
public static final int[] $EnumSwitchMapping$0;
static {
int[] iArr = new int[State.values().length];
iArr[State.LOADING.ordinal()] = 1;
iArr[State.ERROR.ordinal()] = 2;
iArr[State.CONTENT.ordinal()] = 3;
iArr[State.EMPTY.ordinal()] = 4;
$EnumSwitchMapping$0 = iArr;
}
}
@i
public CourierInbox(@r Context context) {
this(context, null, 0, 6, null);
t.i(context, "context");
}
@i
public CourierInbox(@r Context context, @s AttributeSet attributeSet) {
this(context, attributeSet, 0, 4, null);
t.i(context, "context");
}
@i
public CourierInbox(@r Context context, @s AttributeSet attributeSet, int i11) {
super(context, attributeSet, i11);
x a11;
List m11;
t.i(context, "context");
this.state = State.LOADING;
CourierInboxTheme.Companion companion = CourierInboxTheme.Companion;
this.lightTheme = companion.getDEFAULT_LIGHT();
this.darkTheme = companion.getDEFAULT_DARK();
this.theme = companion.getDEFAULT_LIGHT();
a11 = z.a(CourierInbox$inboxRepo$2.INSTANCE);
this.inboxRepo$delegate = a11;
CourierInboxTheme courierInboxTheme = this.theme;
m11 = u.m();
MessagesAdapter messagesAdapter = new MessagesAdapter(courierInboxTheme, m11, new CourierInbox$messagesAdapter$1(this), new CourierInbox$messagesAdapter$2(this));
this.messagesAdapter = messagesAdapter;
this.loadingAdapter = new LoadingAdapter(this.theme);
this.adapter = new androidx.recyclerview.widget.g(messagesAdapter);
View.inflate(context, R.layout.courier_inbox, this);
setup();
refreshTheme();
}
public CourierInbox(Context context, AttributeSet attributeSet, int i11, int i12, k kVar) {
this(context, (i12 & 2) != 0 ? null : attributeSet, (i12 & 4) != 0 ? 0 : i11);
}
public final void forceReactNativeLayoutFix(RecyclerView recyclerView) {
if (Courier.Companion.getUSER_AGENT() != CourierAgent.REACT_NATIVE_ANDROID) {
return;
}
try {
RecyclerView.h adapter = recyclerView.getAdapter();
if (adapter != null) {
adapter.notifyDataSetChanged();
}
recyclerView.scrollBy(0, 0);
} catch (Exception e11) {
Courier.Companion.error(e11.toString());
}
}
public final InboxRepository getInboxRepo() {
return (InboxRepository) this.inboxRepo$delegate.getValue();
}
public final LinearLayoutManager getLayoutManager() {
RecyclerView.p layoutManager = getRecyclerView().getLayoutManager();
if (layoutManager instanceof LinearLayoutManager) {
return (LinearLayoutManager) layoutManager;
}
return null;
}
private final void launchCourierWebsite() {
getContext().startActivity(new Intent("android.intent.action.VIEW", Uri.parse("https://www.courier.com/")));
}
private final void openDialog() {
d.a aVar = new d.a(getContext());
aVar.setTitle("Learn more about Courier?");
aVar.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i11) {
CourierInbox.m80openDialog$lambda5$lambda3(dialogInterface, i11);
}
});
aVar.setPositiveButton("Learn More", new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i11) {
CourierInbox.m81openDialog$lambda5$lambda4(CourierInbox.this, dialogInterface, i11);
}
});
aVar.show();
}
public static final void m80openDialog$lambda5$lambda3(DialogInterface dialogInterface, int i11) {
}
public static final void m81openDialog$lambda5$lambda4(CourierInbox this$0, DialogInterface dialogInterface, int i11) {
t.i(this$0, "this$0");
this$0.launchCourierWebsite();
}
private final e2 openVisibleMessages() {
e2 d11;
d11 = b10.k.d(Courier.Companion.getCoroutineScope$android_release(), e1.b(), null, new CourierInbox$openVisibleMessages$1(this, null), 2, null);
return d11;
}
public final void refreshAdapters(boolean z11, boolean z12) {
if (z11) {
this.adapter.i(0, this.messagesAdapter);
} else {
this.adapter.l(this.messagesAdapter);
}
androidx.recyclerview.widget.g gVar = this.adapter;
if (z12) {
gVar.j(this.loadingAdapter);
} else {
gVar.l(this.loadingAdapter);
}
}
public static void refreshAdapters$default(CourierInbox courierInbox, boolean z11, boolean z12, int i11, Object obj) {
if ((i11 & 1) != 0) {
z11 = false;
}
if ((i11 & 2) != 0) {
z12 = false;
}
courierInbox.refreshAdapters(z11, z12);
}
public final void refreshBrand() {
CourierBrandInApp inapp;
Boolean disableCourierFooter;
CourierBrand inboxBrand = CoreInboxKt.getInboxBrand(Courier.Companion.getShared());
if (inboxBrand != null) {
this.theme.attachBrand$android_release(inboxBrand);
CourierBrandSettings settings = inboxBrand.getSettings();
boolean booleanValue = (settings == null || (inapp = settings.getInapp()) == null || (disableCourierFooter = inapp.getDisableCourierFooter()) == null) ? false : disableCourierFooter.booleanValue();
RelativeLayout relativeLayout = this.courierBar;
if (relativeLayout == null) {
t.A("courierBar");
relativeLayout = null;
}
relativeLayout.setVisibility(booleanValue ^ true ? 0 : 8);
reloadViews();
}
}
@c.a
public final void refreshMessages(List<InboxMessage> list) {
Object t02;
Object t03;
List<InboxMessage> messages$android_release = this.messagesAdapter.getMessages$android_release();
this.messagesAdapter.setMessages$android_release(list);
int i11 = 0;
boolean z11 = list.size() - messages$android_release.size() == 1;
t02 = c0.t0(list);
InboxMessage inboxMessage = (InboxMessage) t02;
String messageId = inboxMessage != null ? inboxMessage.getMessageId() : null;
t03 = c0.t0(messages$android_release);
InboxMessage inboxMessage2 = (InboxMessage) t03;
if (!t.d(messageId, inboxMessage2 != null ? inboxMessage2.getMessageId() : null) && z11) {
this.messagesAdapter.notifyItemInserted(0);
restoreScrollPosition(getRecyclerView());
} else if (list.size() > messages$android_release.size()) {
this.messagesAdapter.notifyItemRangeInserted(messages$android_release.size(), list.size() - messages$android_release.size());
} else if (list.size() != messages$android_release.size()) {
this.messagesAdapter.notifyDataSetChanged();
openVisibleMessages();
} else {
for (Object obj : list) {
int i12 = i11 + 1;
if (i11 < 0) {
u.w();
}
InboxMessage inboxMessage3 = (InboxMessage) obj;
RecyclerView.h0 f02 = getRecyclerView().f0(i11);
MessageItemViewHolder messageItemViewHolder = f02 instanceof MessageItemViewHolder ? (MessageItemViewHolder) f02 : null;
if (messageItemViewHolder != null) {
messageItemViewHolder.setMessage(this.theme, inboxMessage3);
}
i11 = i12;
}
}
}
private final void refreshTheme() {
Context context = getContext();
t.h(context, "context");
setTheme(ExtensionsKt.isDarkMode(context) ? this.darkTheme : this.lightTheme);
}
private final void reloadViews() {
Integer loadingColor$android_release = this.theme.getLoadingColor$android_release();
ProgressBar progressBar = null;
if (loadingColor$android_release != null) {
int intValue = loadingColor$android_release.intValue();
SwipeRefreshLayout swipeRefreshLayout = this.refreshLayout;
if (swipeRefreshLayout == null) {
t.A("refreshLayout");
swipeRefreshLayout = null;
}
swipeRefreshLayout.setColorSchemeColors(intValue);
}
if (getRecyclerView().getItemDecorationCount() > 0) {
getRecyclerView().k1(0);
}
androidx.recyclerview.widget.k dividerItemDecoration$android_release = this.theme.getDividerItemDecoration$android_release();
if (dividerItemDecoration$android_release != null) {
getRecyclerView().h(dividerItemDecoration$android_release);
}
TextView textView = this.detailTextView;
if (textView == null) {
t.A("detailTextView");
textView = null;
}
ExtensionsKt.setCourierFont(textView, this.theme.getDetailTitleFont$android_release());
Integer loadingColor$android_release2 = this.theme.getLoadingColor$android_release();
if (loadingColor$android_release2 != null) {
int intValue2 = loadingColor$android_release2.intValue();
ProgressBar progressBar2 = this.loadingIndicator;
if (progressBar2 == null) {
t.A("loadingIndicator");
} else {
progressBar = progressBar2;
}
progressBar.setIndeterminateTintList(ColorStateList.valueOf(intValue2));
}
}
private final void restoreScrollPosition(RecyclerView recyclerView) {
RecyclerView.p layoutManager = recyclerView.getLayoutManager();
if (layoutManager != null) {
layoutManager.onRestoreInstanceState(layoutManager.onSaveInstanceState());
}
}
public final void setState(State state) {
this.state = state;
int i11 = WhenMappings.$EnumSwitchMapping$0[state.ordinal()];
ProgressBar progressBar = null;
if (i11 == 1) {
SwipeRefreshLayout swipeRefreshLayout = this.refreshLayout;
if (swipeRefreshLayout == null) {
t.A("refreshLayout");
swipeRefreshLayout = null;
}
swipeRefreshLayout.setVisibility(8);
TextView textView = this.detailTextView;
if (textView == null) {
t.A("detailTextView");
textView = null;
}
textView.setVisibility(8);
ProgressBar progressBar2 = this.loadingIndicator;
if (progressBar2 == null) {
t.A("loadingIndicator");
} else {
progressBar = progressBar2;
}
progressBar.setVisibility(0);
} else if (i11 == 2) {
SwipeRefreshLayout swipeRefreshLayout2 = this.refreshLayout;
if (swipeRefreshLayout2 == null) {
t.A("refreshLayout");
swipeRefreshLayout2 = null;
}
swipeRefreshLayout2.setVisibility(8);
TextView textView2 = this.detailTextView;
if (textView2 == null) {
t.A("detailTextView");
textView2 = null;
}
textView2.setVisibility(0);
TextView textView3 = this.detailTextView;
if (textView3 == null) {
t.A("detailTextView");
textView3 = null;
}
textView3.setText(this.state.getTitle());
ProgressBar progressBar3 = this.loadingIndicator;
if (progressBar3 == null) {
t.A("loadingIndicator");
} else {
progressBar = progressBar3;
}
progressBar.setVisibility(8);
} else if (i11 == 3) {
SwipeRefreshLayout swipeRefreshLayout3 = this.refreshLayout;
if (swipeRefreshLayout3 == null) {
t.A("refreshLayout");
swipeRefreshLayout3 = null;
}
swipeRefreshLayout3.setVisibility(0);
TextView textView4 = this.detailTextView;
if (textView4 == null) {
t.A("detailTextView");
textView4 = null;
}
textView4.setVisibility(8);
TextView textView5 = this.detailTextView;
if (textView5 == null) {
t.A("detailTextView");
textView5 = null;
}
textView5.setText((CharSequence) null);
ProgressBar progressBar4 = this.loadingIndicator;
if (progressBar4 == null) {
t.A("loadingIndicator");
} else {
progressBar = progressBar4;
}
progressBar.setVisibility(8);
} else if (i11 != 4) {
} else {
SwipeRefreshLayout swipeRefreshLayout4 = this.refreshLayout;
if (swipeRefreshLayout4 == null) {
t.A("refreshLayout");
swipeRefreshLayout4 = null;
}
swipeRefreshLayout4.setVisibility(8);
TextView textView6 = this.detailTextView;
if (textView6 == null) {
t.A("detailTextView");
textView6 = null;
}
textView6.setVisibility(0);
TextView textView7 = this.detailTextView;
if (textView7 == null) {
t.A("detailTextView");
textView7 = null;
}
textView7.setText(this.state.getTitle());
ProgressBar progressBar5 = this.loadingIndicator;
if (progressBar5 == null) {
t.A("loadingIndicator");
} else {
progressBar = progressBar5;
}
progressBar.setVisibility(8);
}
}
@c.a
private final void setTheme(CourierInboxTheme courierInboxTheme) {
this.theme = courierInboxTheme;
reloadViews();
this.messagesAdapter.setTheme$android_release(this.theme);
this.messagesAdapter.notifyDataSetChanged();
this.loadingAdapter.setTheme$android_release(this.theme);
this.loadingAdapter.notifyDataSetChanged();
}
private final void setup() {
View findViewById = findViewById(R.id.loadingIndicator);
t.h(findViewById, "findViewById(R.id.loadingIndicator)");
this.loadingIndicator = (ProgressBar) findViewById;
View findViewById2 = findViewById(R.id.courierBarButton);
t.h(findViewById2, "findViewById(R.id.courierBarButton)");
ImageView imageView = (ImageView) findViewById2;
this.courierBarButton = imageView;
SwipeRefreshLayout swipeRefreshLayout = null;
if (imageView == null) {
t.A("courierBarButton");
imageView = null;
}
imageView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
CourierInbox.m82setup$lambda6(CourierInbox.this, view);
}
});
View findViewById3 = findViewById(R.id.detailTextView);
t.h(findViewById3, "findViewById(R.id.detailTextView)");
this.detailTextView = (TextView) findViewById3;
View findViewById4 = findViewById(R.id.courierBar);
t.h(findViewById4, "findViewById(R.id.courierBar)");
this.courierBar = (RelativeLayout) findViewById4;
View findViewById5 = findViewById(R.id.recyclerView);
t.h(findViewById5, "findViewById(R.id.recyclerView)");
this.recyclerView = (RecyclerView) findViewById5;
getRecyclerView().setAdapter(this.adapter);
getRecyclerView().setOnScrollChangeListener(new View.OnScrollChangeListener() {
@Override
public final void onScrollChange(View view, int i11, int i12, int i13, int i14) {
CourierInbox.m83setup$lambda8(CourierInbox.this, view, i11, i12, i13, i14);
}
});
View findViewById6 = findViewById(R.id.refreshLayout);
t.h(findViewById6, "findViewById(R.id.refreshLayout)");
SwipeRefreshLayout swipeRefreshLayout2 = (SwipeRefreshLayout) findViewById6;
this.refreshLayout = swipeRefreshLayout2;
if (swipeRefreshLayout2 == null) {
t.A("refreshLayout");
} else {
swipeRefreshLayout = swipeRefreshLayout2;
}
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.j() {
@Override
public final void onRefresh() {
CourierInbox.m84setup$lambda9(CourierInbox.this);
}
});
this.inboxListener = CoreInboxKt.addInboxListener(Courier.Companion.getShared(), new CourierInbox$setup$4(this), new CourierInbox$setup$5(this), new CourierInbox$setup$6(this));
}
public static final void m82setup$lambda6(CourierInbox this$0, View view) {
t.i(this$0, "this$0");
this$0.openDialog();
}
public static final void m83setup$lambda8(CourierInbox this$0, View view, int i11, int i12, int i13, int i14) {
t.i(this$0, "this$0");
l<? super Integer, f1> lVar = this$0.onScrollInbox;
if (lVar != null) {
lVar.invoke(Integer.valueOf(ExtensionsKt.getPxToDp(this$0.getRecyclerView().computeVerticalScrollOffset())));
}
this$0.openVisibleMessages();
}
public static final void m84setup$lambda9(CourierInbox this$0) {
t.i(this$0, "this$0");
CoreInboxKt.refreshInbox(Courier.Companion.getShared(), new CourierInbox$setup$3$1(this$0));
}
@r
public final CourierInboxTheme getDarkTheme() {
return this.darkTheme;
}
@r
public final CourierInboxTheme getLightTheme() {
return this.lightTheme;
}
@r
public final RecyclerView getRecyclerView() {
RecyclerView recyclerView = this.recyclerView;
if (recyclerView != null) {
return recyclerView;
}
t.A("recyclerView");
return null;
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
forceReactNativeLayoutFix(getRecyclerView());
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
CourierInboxListener courierInboxListener = this.inboxListener;
if (courierInboxListener == null) {
t.A("inboxListener");
courierInboxListener = null;
}
CourierInboxListenerKt.remove(courierInboxListener);
}
public final void setDarkTheme(@r CourierInboxTheme value) {
t.i(value, "value");
if (t.d(this.darkTheme, value)) {
return;
}
this.darkTheme = value;
refreshTheme();
}
public final void setLightTheme(@r CourierInboxTheme value) {
t.i(value, "value");
if (t.d(this.lightTheme, value)) {
return;
}
this.lightTheme = value;
refreshTheme();
}
public final void setOnClickActionListener(@s q<? super InboxAction, ? super InboxMessage, ? super Integer, f1> qVar) {
this.onClickInboxActionForMessageAtIndex = qVar;
}
public final void setOnClickMessageListener(@s p<? super InboxMessage, ? super Integer, f1> pVar) {
this.onClickInboxMessageAtIndex = pVar;
}
public final void setOnScrollInboxListener(@s l<? super Integer, f1> lVar) {
this.onScrollInbox = lVar;
}
}