导航菜单

页面标题

页面副标题

Hopscotch v9.7.2 - MyMomentActivity.java 源代码

正在查看: Hopscotch v9.7.2 应用的 MyMomentActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package in.hopscotch.android.activity;

import android.R;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.text.SpannableStringBuilder;
import android.view.MenuItem;
import android.widget.TextView;
import androidx.appcompat.app.k;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
import com.google.android.material.snackbar.BaseTransientBottomBar;
import com.google.android.material.snackbar.Snackbar;
import in.hopscotch.android.api.response.ActionResponse;
import in.hopscotch.android.api.response.MomentResponse;
import in.hopscotch.android.api.response.MomentUserResponse;
import in.hopscotch.android.components.view.UnScrollRecyclerView;
import in.hopscotch.android.listener.l;
import in.hopscotch.android.model.FromAccount;

public class MyMomentActivity extends androidx.appcompat.app.i implements in.hopscotch.android.interfaces.i, l.a {
    private in.hopscotch.android.databinding.s0 activityMyMomentsBinding;
    private TextView customActionBarTextView;
    private boolean fromAccountPage;
    private boolean hasMoreProducts;
    private in.hopscotch.android.interfaces.i momentFragmentListener;
    private in.hopscotch.android.adapter.a0 momentMasonryAdapter;
    private in.hopscotch.android.viewmodel.moments.q myMomentsViewModel;
    private int pageNo;
    private int pageSize;
    private in.hopscotch.android.listener.l recyclerLoadingScrollListener;

    public class a extends RecyclerView.s {
        public a(MyMomentActivity myMomentActivity) {
        }

        public final void a(int i, RecyclerView recyclerView) {
            StaggeredGridLayoutManager layoutManager = recyclerView.getLayoutManager();
            layoutManager.r.a();
            layoutManager.H0();
        }

        public final void b(RecyclerView recyclerView, int i, int i2) {
            if (i2 > 0 || i2 < 0) {
                StaggeredGridLayoutManager layoutManager = recyclerView.getLayoutManager();
                layoutManager.r.a();
                layoutManager.H0();
            }
        }
    }

    static {
        k.c cVar = androidx.appcompat.app.k.a;
        androidx.appcompat.widget.j1.b();
    }

    public static void R0(MyMomentActivity myMomentActivity) {
        myMomentActivity.activityMyMomentsBinding.g.setRefreshing(false);
        myMomentActivity.pageNo = 1;
        myMomentActivity.myMomentsViewModel.j(1, myMomentActivity.pageSize);
        myMomentActivity.momentMasonryAdapter.p();
    }

    public final void H(String str) {
        if (str.equalsIgnoreCase(getString(2132019048))) {
            Intent a2 = in.hopscotch.android.application.a0.a(this);
            a2.setFlags(268468224);
            a2.putExtra("HOME_TAB", 2);
            a2.putExtra("FROM_SCREEN", getString(2132019048));
            startActivity(a2);
            finish();
        }
    }

    public final void I(boolean z) {
    }

    public final void S0() {
        this.activityMyMomentsBinding.h.setVisibility(8);
    }

    public final void Y() {
        int i = this.pageNo + 1;
        this.pageNo = i;
        this.myMomentsViewModel.j(i, this.pageSize);
    }

    public final void l(MomentResponse momentResponse) {
        if (momentResponse == null) {
            this.activityMyMomentsBinding.g.setVisibility(8);
            this.activityMyMomentsBinding.g.setEnabled(false);
            this.activityMyMomentsBinding.f.setVisibility(8);
            this.activityMyMomentsBinding.e.setVisibility(0);
            return;
        }
        this.hasMoreProducts = momentResponse.momentsPhotos.size() >= this.pageSize;
        if (this.pageNo == 1) {
            this.momentMasonryAdapter.Z(momentResponse.momentsPhotos);
        } else {
            this.momentMasonryAdapter.R(momentResponse.momentsPhotos);
        }
        this.activityMyMomentsBinding.g.setVisibility(0);
        this.activityMyMomentsBinding.g.setEnabled(true);
        this.activityMyMomentsBinding.f.setVisibility(0);
        this.activityMyMomentsBinding.e.setVisibility(8);
        this.recyclerLoadingScrollListener.d();
    }

    public final void onActivityResult(int i, int i2, Intent intent) {
        super/*androidx.fragment.app.n*/.onActivityResult(i, i2, intent);
        if (i == 2043 && i2 == -1) {
            ActionResponse actionResponse = (ActionResponse) intent.getSerializableExtra("DELETE_RESPONSE");
            if (actionResponse == null) {
                if (((Boolean) intent.getSerializableExtra("HEART_ICON_STATUS_CHANGE")).booleanValue()) {
                    this.momentMasonryAdapter.W(((Integer) intent.getSerializableExtra("position")).intValue(), ((Boolean) intent.getSerializableExtra("HEART_STATUS")).booleanValue());
                    return;
                }
                return;
            }
            in.hopscotch.android.viewmodel.moments.q qVar = this.myMomentsViewModel;
            if (qVar != null) {
                qVar.j(1, this.pageSize);
                this.momentMasonryAdapter.p();
                String str = actionResponse.message;
                SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
                spannableStringBuilder.append((CharSequence) str);
                Snackbar a2 = in.hopscotch.android.components.d.a(this, this.activityMyMomentsBinding.i, spannableStringBuilder, 0);
                Typeface createFromAsset = Typeface.createFromAsset(getAssets(), getString(in.hopscotch.android.components.s.averta_regular));
                BaseTransientBottomBar.i iVar = ((BaseTransientBottomBar) a2).a;
                TextView textView = (TextView) iVar.findViewById(2131364723);
                textView.setMaxLines(2);
                textView.setTypeface(createFromAsset);
                iVar.setBackgroundColor(getResources().getColor(2131099685));
                CoordinatorLayout.f layoutParams = iVar.getLayoutParams();
                layoutParams.c = 48;
                iVar.setLayoutParams(layoutParams);
                com.google.android.material.snackbar.n.c().l(a2.r(), ((BaseTransientBottomBar) a2).b);
            }
        }
    }

    public final void onBackPressed() {
        if (FromAccount.getInstance().getCameFromAccount()) {
            FromAccount.getInstance().setCameFromAccount(false);
            finish();
        } else {
            super/*androidx.activity.j*/.onBackPressed();
            startActivity(in.hopscotch.android.application.a0.a(this));
            finish();
        }
    }

    public final void onCreate(Bundle bundle) {
        super/*androidx.fragment.app.n*/.onCreate(bundle);
        in.hopscotch.android.util.e0.b().h();
        this.pageNo = 1;
        this.pageSize = 20;
        com.google.firebase.crashlytics.c.a().d("ACTIVITY_NAME", getClass().getName());
        this.activityMyMomentsBinding = (in.hopscotch.android.databinding.s0) androidx.databinding.g.h(this, 2131558472);
        this.momentFragmentListener = this;
        in.hopscotch.android.viewmodel.moments.q qVar = new in.hopscotch.android.viewmodel.moments.q(this, this.momentFragmentListener);
        this.myMomentsViewModel = qVar;
        this.activityMyMomentsBinding.g0(qVar);
        setSupportActionBar(this.activityMyMomentsBinding.j);
        this.customActionBarTextView = new TextView(this);
        String string = getString(2132018459);
        this.customActionBarTextView.setLayoutParams(new CoordinatorLayout.f(-1, -2));
        this.customActionBarTextView.setText(string);
        this.customActionBarTextView.setTextColor(getResources().getColor(in.hopscotch.android.components.m.blackish_gray));
        this.customActionBarTextView.setTextSize(20.0f);
        Typeface createFromAsset = Typeface.createFromAsset(getAssets(), getString(in.hopscotch.android.components.s.averta_semibold));
        this.customActionBarTextView.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
        this.customActionBarTextView.setTypeface(createFromAsset);
        getSupportActionBar().u();
        getSupportActionBar().q(this.customActionBarTextView);
        this.activityMyMomentsBinding.j.setBackgroundColor(androidx.core.content.a.b(this, 2131100828));
        getSupportActionBar().t(true);
        getSupportActionBar().w();
        this.fromAccountPage = getIntent().getBooleanExtra(getString(2132018051), false);
        StaggeredGridLayoutManager staggeredGridLayoutManager = new StaggeredGridLayoutManager(2, 1);
        staggeredGridLayoutManager.z1();
        this.activityMyMomentsBinding.f.setLayoutManager(staggeredGridLayoutManager);
        in.hopscotch.android.adapter.a0 a0Var = new in.hopscotch.android.adapter.a0(this, this.momentFragmentListener);
        this.momentMasonryAdapter = a0Var;
        this.activityMyMomentsBinding.f.setAdapter(a0Var);
        this.activityMyMomentsBinding.f.setHasFixedSize(false);
        UnScrollRecyclerView unScrollRecyclerView = this.activityMyMomentsBinding.f;
        String str = in.hopscotch.android.util.a1.a;
        androidx.recyclerview.widget.l0 itemAnimator = unScrollRecyclerView.getItemAnimator();
        if (itemAnimator instanceof androidx.recyclerview.widget.l0) {
            itemAnimator.a = false;
        }
        this.activityMyMomentsBinding.f.j(new in.hopscotch.android.adapter.a3(4));
        this.activityMyMomentsBinding.f.setNestedScrollingEnabled(false);
        in.hopscotch.android.listener.l lVar = new in.hopscotch.android.listener.l(this);
        this.recyclerLoadingScrollListener = lVar;
        this.activityMyMomentsBinding.f.m(lVar);
        in.hopscotch.android.databinding.s0 s0Var = this.activityMyMomentsBinding;
        if (s0Var != null) {
            s0Var.g.setColorSchemeResources(new int[]{2131099810, R.color.holo_green_light, R.color.holo_orange_light, R.color.holo_red_light});
            this.activityMyMomentsBinding.g.setProgressViewOffset(false, 0, in.hopscotch.android.util.a1.E(this));
            this.activityMyMomentsBinding.g.setOnRefreshListener(new androidx.media3.exoplayer.h0(this, 10));
            this.activityMyMomentsBinding.g.setEnabled(true);
        }
        this.myMomentsViewModel.j(this.pageNo, this.pageSize);
        this.activityMyMomentsBinding.f.m(new a(this));
    }

    public final boolean onOptionsItemSelected(MenuItem menuItem) {
        if (menuItem.getItemId() != 16908332) {
            return super/*android.app.Activity*/.onOptionsItemSelected(menuItem);
        }
        if (this.fromAccountPage) {
            finish();
            return true;
        }
        Intent a2 = in.hopscotch.android.application.a0.a(this);
        a2.setFlags(268468224);
        a2.putExtra("HOME_TAB", 0);
        startActivity(a2);
        finish();
        return true;
    }

    public final boolean q0() {
        return this.hasMoreProducts;
    }

    public final void u0(MomentUserResponse momentUserResponse) {
    }

    public final void z(Intent intent) {
        startActivityForResult(intent, 2043);
    }
}