正在查看: Cashalo v2.25.0.0 应用的 NotificationFeedActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Cashalo v2.25.0.0 应用的 NotificationFeedActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package finance.empower.android.app.home.notifications;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import finance.empower.android.app.BaseActivity;
import finance.empower.android.app.BaseLaunchActivity;
import finance.empower.android.app.NavButton;
import finance.empower.android.app.home.notifications.NotificationsFeedPresenter;
import finance.empower.android.core.ui.view.ViewExtKt;
import finance.empower.android.domain.model.Notification;
import finance.empower.android.kotlin.extensions.content.Internals;
import finance.empower.ph.R;
import finance.empower.ph.databinding.ActivityNotificationsFeedBinding;
import javax.inject.Inject;
import kotlin.Lazy;
import kotlin.LazyKt;
import kotlin.LazyThreadSafetyMode;
import kotlin.Metadata;
import kotlin.Pair;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.FunctionReferenceImpl;
import kotlin.jvm.internal.Intrinsics;
@Metadata(d1 = {"\u0000\\\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\b\u0007\u0018\u0000 ,2\u00020\u00012\u00020\u0002:\u0001,B\u0005¢\u0006\u0002\u0010\u0003J\u0010\u0010\u001c\u001a\u00020\u001d2\u0006\u0010\u001e\u001a\u00020\u001fH\u0016J\u0012\u0010 \u001a\u00020\u001d2\b\u0010!\u001a\u0004\u0018\u00010\"H\u0014J\b\u0010#\u001a\u00020\u001dH\u0014J\b\u0010$\u001a\u00020\u001dH\u0014J\u0010\u0010%\u001a\u00020\u001d2\u0006\u0010&\u001a\u00020'H\u0016J\u001a\u0010(\u001a\u00020\u001d2\u0006\u0010)\u001a\u00020*2\b\b\u0002\u0010+\u001a\u00020\u000bH\u0002R\u001b\u0010\u0004\u001a\u00020\u00058BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\b\u0010\t\u001a\u0004\b\u0006\u0010\u0007R\u000e\u0010\n\u001a\u00020\u000bX\u0082\u000e¢\u0006\u0002\n\u0000R\u001b\u0010\f\u001a\u00020\r8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u0010\u0010\t\u001a\u0004\b\u000e\u0010\u000fR\u0014\u0010\u0011\u001a\u00020\u0012X\u0094D¢\u0006\b\n\u0000\u001a\u0004\b\u0013\u0010\u0014R$\u0010\u0017\u001a\u00020\u00162\u0006\u0010\u0015\u001a\u00020\u0016@GX\u0086.¢\u0006\u000e\n\u0000\u001a\u0004\b\u0018\u0010\u0019\"\u0004\b\u001a\u0010\u001b¨\u0006-"}, d2 = {"Lfinance/empower/android/app/home/notifications/NotificationFeedActivity;", "Lfinance/empower/android/app/BaseActivity;", "Lfinance/empower/android/app/home/notifications/NotificationsFeedPresenter$ViewContract;", "()V", "binding", "Lfinance/empower/ph/databinding/ActivityNotificationsFeedBinding;", "getBinding", "()Lfinance/empower/ph/databinding/ActivityNotificationsFeedBinding;", "binding$delegate", "Lkotlin/Lazy;", "dataLoaded", "", "notificationFeedAdapter", "Lfinance/empower/android/app/home/notifications/NotificationFeedAdapter;", "getNotificationFeedAdapter", "()Lfinance/empower/android/app/home/notifications/NotificationFeedAdapter;", "notificationFeedAdapter$delegate", "pageName", "", "getPageName", "()Ljava/lang/String;", "<set-?>", "Lfinance/empower/android/app/home/notifications/NotificationsFeedPresenter;", "presenter", "getPresenter", "()Lfinance/empower/android/app/home/notifications/NotificationsFeedPresenter;", "setPresenter", "(Lfinance/empower/android/app/home/notifications/NotificationsFeedPresenter;)V", "navigateToLinkLocation", "", "url", "Landroid/net/Uri;", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "onStart", "onStop", "render", "viewState", "Lfinance/empower/android/app/home/notifications/NotificationsFeedPresenter$ViewContract$ViewState;", "showContentState", "content", "Lfinance/empower/android/app/home/notifications/NotificationsFeedPresenter$ViewContract$ViewState$Content;", "isLoading", "Companion", "empower-app_release"}, k = 1, mv = {1, 9, 0}, xi = 48)
public final class NotificationFeedActivity extends BaseActivity implements NotificationsFeedPresenter.ViewContract {
private boolean dataLoaded;
public NotificationsFeedPresenter presenter;
public static final Companion INSTANCE = new Companion(null);
public static final int $stable = 8;
private final Lazy binding = LazyKt.lazy(new Function0<ActivityNotificationsFeedBinding>() {
{
super(0);
}
public final ActivityNotificationsFeedBinding m780invoke() {
return ActivityNotificationsFeedBinding.inflate(NotificationFeedActivity.this.getLayoutInflater());
}
});
private final Lazy notificationFeedAdapter = LazyKt.lazy(LazyThreadSafetyMode.NONE, new Function0<NotificationFeedAdapter>() {
{
super(0);
}
@Metadata(k = 3, mv = {1, 9, 0}, xi = 48)
class AnonymousClass1 extends FunctionReferenceImpl implements Function1<Notification, Unit> {
AnonymousClass1(Object obj) {
super(1, obj, NotificationsFeedPresenter.class, "onNotificationClicked", "onNotificationClicked(Lfinance/empower/android/domain/model/Notification;)V", 0);
}
public Object invoke(Object obj) {
invoke((Notification) obj);
return Unit.INSTANCE;
}
public final void invoke(Notification notification) {
Intrinsics.checkNotNullParameter(notification, "p0");
((NotificationsFeedPresenter) this.receiver).onNotificationClicked(notification);
}
}
public final NotificationFeedAdapter m781invoke() {
return new NotificationFeedAdapter(new AnonymousClass1(NotificationFeedActivity.this.getPresenter()));
}
});
private final String pageName = "NotificationsScreen";
@Metadata(d1 = {"\u0000\u0018\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u000e\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u0006¨\u0006\u0007"}, d2 = {"Lfinance/empower/android/app/home/notifications/NotificationFeedActivity$Companion;", "", "()V", "newIntent", "Landroid/content/Intent;", "context", "Landroid/content/Context;", "empower-app_release"}, k = 1, mv = {1, 9, 0}, xi = 48)
public static final class Companion {
public Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final Intent newIntent(Context context) {
Intrinsics.checkNotNullParameter(context, "context");
return Internals.createIntent(context, NotificationFeedActivity.class, new Pair[0]);
}
}
public final NotificationsFeedPresenter getPresenter() {
NotificationsFeedPresenter notificationsFeedPresenter = this.presenter;
if (notificationsFeedPresenter != null) {
return notificationsFeedPresenter;
}
Intrinsics.throwUninitializedPropertyAccessException("presenter");
return null;
}
@Inject
public final void setPresenter(NotificationsFeedPresenter notificationsFeedPresenter) {
Intrinsics.checkNotNullParameter(notificationsFeedPresenter, "<set-?>");
this.presenter = notificationsFeedPresenter;
}
private final ActivityNotificationsFeedBinding getBinding() {
return (ActivityNotificationsFeedBinding) this.binding.getValue();
}
public final NotificationFeedAdapter getNotificationFeedAdapter() {
return (NotificationFeedAdapter) this.notificationFeedAdapter.getValue();
}
@Override
protected String getPageName() {
return this.pageName;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActivityNotificationsFeedBinding binding = getBinding();
setContentView((View) binding.getRoot());
NotificationFeedActivity notificationFeedActivity = this;
BaseActivity.setupToolbar$default(notificationFeedActivity, null, null, NavButton.UP, null, false, getString(R.string.notifications_feed_title), 27, null);
RecyclerView recyclerView = binding.recyclerNotifications;
final RecyclerView.LayoutManager linearLayoutManager = new LinearLayoutManager(recyclerView.getContext());
recyclerView.setLayoutManager(linearLayoutManager);
recyclerView.setAdapter(getNotificationFeedAdapter());
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
public void onScrolled(RecyclerView recyclerView2, int dx, int dy) {
boolean z;
NotificationFeedAdapter notificationFeedAdapter;
Intrinsics.checkNotNullParameter(recyclerView2, "recyclerView");
z = NotificationFeedActivity.this.dataLoaded;
if (!z || dy <= 0) {
return;
}
int findLastVisibleItemPosition = linearLayoutManager.findLastVisibleItemPosition() + 20;
notificationFeedAdapter = NotificationFeedActivity.this.getNotificationFeedAdapter();
if (findLastVisibleItemPosition >= notificationFeedAdapter.getItemCount()) {
NotificationFeedActivity.this.getPresenter().loadMore();
}
}
});
}
@Override
protected void onStart() {
super.onStart();
getPresenter().onStart();
}
protected void onStop() {
getPresenter().onStop();
super.onStop();
}
@Override
public void render(NotificationsFeedPresenter.ViewContract.ViewState viewState) {
Intrinsics.checkNotNullParameter(viewState, "viewState");
this.dataLoaded = false;
ActivityNotificationsFeedBinding binding = getBinding();
ProgressBar root = binding.includeAppbar.progressBanner.getRoot();
Intrinsics.checkNotNullExpressionValue(root, "getRoot(...)");
ViewExtKt.hide(root);
View view = binding.shimmerNotifications;
Intrinsics.checkNotNullExpressionValue(view, "shimmerNotifications");
ViewExtKt.collapse(view);
LinearLayout linearLayout = binding.containerEmptyState;
Intrinsics.checkNotNullExpressionValue(linearLayout, "containerEmptyState");
ViewExtKt.collapse(linearLayout);
LinearLayout linearLayout2 = binding.containerErrorState;
Intrinsics.checkNotNullExpressionValue(linearLayout2, "containerErrorState");
ViewExtKt.collapse(linearLayout2);
View view2 = binding.recyclerNotifications;
Intrinsics.checkNotNullExpressionValue(view2, "recyclerNotifications");
ViewExtKt.collapse(view2);
if (viewState instanceof NotificationsFeedPresenter.ViewContract.ViewState.Loading) {
NotificationsFeedPresenter.ViewContract.ViewState.Content content = ((NotificationsFeedPresenter.ViewContract.ViewState.Loading) viewState).getContent();
if (content == null) {
View view3 = binding.shimmerNotifications;
Intrinsics.checkNotNullExpressionValue(view3, "shimmerNotifications");
ViewExtKt.show(view3);
return;
} else {
ProgressBar root2 = binding.includeAppbar.progressBanner.getRoot();
Intrinsics.checkNotNullExpressionValue(root2, "getRoot(...)");
ViewExtKt.show(root2);
showContentState(content, true);
return;
}
}
if (viewState instanceof NotificationsFeedPresenter.ViewContract.ViewState.Empty) {
LinearLayout linearLayout3 = binding.containerEmptyState;
Intrinsics.checkNotNullExpressionValue(linearLayout3, "containerEmptyState");
ViewExtKt.show(linearLayout3);
} else if (viewState instanceof NotificationsFeedPresenter.ViewContract.ViewState.Error) {
LinearLayout linearLayout4 = binding.containerErrorState;
Intrinsics.checkNotNullExpressionValue(linearLayout4, "containerErrorState");
ViewExtKt.show(linearLayout4);
} else if (viewState instanceof NotificationsFeedPresenter.ViewContract.ViewState.Content) {
showContentState$default(this, (NotificationsFeedPresenter.ViewContract.ViewState.Content) viewState, false, 2, null);
}
}
@Override
public void navigateToLinkLocation(Uri url) {
Intrinsics.checkNotNullParameter(url, "url");
startActivity(BaseLaunchActivity.INSTANCE.newIntentFromInternalSource((Context) this, url));
}
static void showContentState$default(NotificationFeedActivity notificationFeedActivity, NotificationsFeedPresenter.ViewContract.ViewState.Content content, boolean z, int i, Object obj) {
if ((i & 2) != 0) {
z = false;
}
notificationFeedActivity.showContentState(content, z);
}
private final void showContentState(NotificationsFeedPresenter.ViewContract.ViewState.Content content, boolean isLoading) {
View view = getBinding().recyclerNotifications;
Intrinsics.checkNotNullExpressionValue(view, "recyclerNotifications");
ViewExtKt.show(view);
getNotificationFeedAdapter().bind(content.getNotifications());
this.dataLoaded = !isLoading;
}
}