导航菜单

页面标题

页面副标题

Hopscotch v9.7.2 - HomePageActivity.java 源代码

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

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


package in.hopscotch.android.activity;

import android.content.BroadcastReceiver;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import androidx.core.view.j0;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleEventObserver;
import androidx.lifecycle.LifecycleOwner;
import com.aurelhubert.ahbottomnavigation.AHBottomNavigation;
import in.hopscotch.android.api.response.MomentUserResponse;
import in.hopscotch.android.fragment.RecentlyFragment;
import in.hopscotch.android.fragment.base.SlidingTabsColorsFragment;
import in.hopscotch.android.fragment.homepage.CollectionsFragment;
import in.hopscotch.android.model.SortingTile;
import in.hopscotch.android.model.UserStatus;
import in.hopscotch.android.model.homepage.ExtraData;
import in.hopscotch.android.util.f0;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Iterator;
import java.util.List;
import kotlin.jvm.internal.Intrinsics;

public class HomePageActivity extends p0 implements f0.b, in.hopscotch.android.interfaces.s {
    public static final int F = 0;
    public Fragment D;
    public String E = "";
    private in.hopscotch.android.databinding.h0 binding;
    private BroadcastReceiver mDepartmentUpdateBroadcastReceiver;
    private BroadcastReceiver mForceUpdateBroadcastReceiver;
    private in.hopscotch.android.application.p mForceUpdateManager;
    private MomentUserResponse momentResponse;

    public class a implements LifecycleEventObserver {
        public final Fragment a;
        public final int b;
        public final int c;
        public final Intent d;

        public a(HomePageActivity homePageActivity, Fragment fragment, int i, int i2, Intent intent) {
            this.a = fragment;
            this.b = i;
            this.c = i2;
            this.d = intent;
        }

        public final void onStateChanged(@NonNull LifecycleOwner lifecycleOwner, @NonNull Lifecycle.Event event) {
            if (event == Lifecycle.Event.ON_RESUME) {
                int i = this.c;
                Intent intent = this.d;
                Fragment fragment = this.a;
                fragment.onActivityResult(this.b, i, intent);
                fragment.getLifecycle().removeObserver(this);
            }
        }
    }

    @Override
    public final void onActivityResult(int i, int i2, Intent intent) {
        FragmentManager childFragmentManager;
        RecentlyFragment recentlyFragment;
        super.onActivityResult(i, i2, intent);
        if (i2 == 1001) {
            in.hopscotch.android.components.toast.a.d(getApplicationContext(), 2, getString(2132017269));
        }
        if (i2 == 1002) {
            in.hopscotch.android.components.toast.a.d(getApplicationContext(), 2, getString(2132017276));
        }
        if (i == 2032 && UserStatus.getInstance().getLoginStatus()) {
            v1();
            this.q.f();
            List Y = getSupportFragmentManager().Y();
            if (Y != null) {
                Iterator it = Y.iterator();
                while (it.hasNext()) {
                    if ((((Fragment) it.next()) instanceof SlidingTabsColorsFragment) && (recentlyFragment = (RecentlyFragment) this.D.getChildFragmentManager().Y().get(1)) != null) {
                        recentlyFragment.Q0();
                    }
                }
            }
        }
        if (i == 2039 && this.q.getCurrentItem() == 2) {
            ((in.hopscotch.android.fragment.b0) this.z.get(2)).A0();
        }
        if (i == 2042 && UserStatus.getInstance().getLoginStatus() && this.q.getCurrentItem() == 2) {
            ((in.hopscotch.android.fragment.b0) this.z.get(2)).B0();
        }
        Fragment fragment = null;
        if (i == 10010) {
            ArrayList arrayList = this.z;
            Fragment fragment2 = arrayList != null ? (Fragment) arrayList.get(2) : null;
            if (fragment2 instanceof in.hopscotch.android.fragment.b0) {
                fragment2.getLifecycle().addObserver(new a(this, fragment2, i, i2, intent));
            }
        }
        if (i == 1998520 || i == 1001709) {
            ArrayList arrayList2 = this.z;
            Fragment fragment3 = arrayList2 != null ? (Fragment) arrayList2.get(4) : null;
            if ((fragment3 instanceof in.hopscotch.android.fragment.q1) || (fragment3 instanceof in.hopscotch.android.hscart.ui.fragment.b)) {
                int i3 = in.hopscotch.android.hscheckout.a.a;
                if (fragment3 != null && (childFragmentManager = fragment3.getChildFragmentManager()) != null) {
                    fragment = childFragmentManager.R("checkout");
                }
                if (fragment instanceof in.hopscotch.android.hscheckout.ui.b) {
                    ((in.hopscotch.android.hscheckout.ui.b) fragment).onActivityResult(i, i2, intent);
                }
            }
        }
    }

    @Override
    public final void onBackPressed() {
        Fragment fragment = this.D;
        if (fragment == null || !fragment.isVisible()) {
            super.onBackPressed();
        } else {
            s1();
        }
    }

    @Override
    public final void onCreate(Bundle bundle) {
        this.i = true;
        overridePendingTransition(0, 0);
        super.onCreate(bundle);
        UserStatus.setInstall(true);
        in.hopscotch.android.db.a.k().putLong("homeActivityStartTime", Calendar.getInstance().getTimeInMillis());
        in.hopscotch.android.db.a.k().apply();
        in.hopscotch.android.db.a.R(Boolean.FALSE);
        this.t.setVisibility(8);
        in.hopscotch.android.application.p pVar = new in.hopscotch.android.application.p(this);
        this.mForceUpdateManager = pVar;
        this.mForceUpdateBroadcastReceiver = new in.hopscotch.android.application.o(pVar);
        com.google.firebase.crashlytics.c.a().d("ACTIVITY_NAME", getClass().getName());
        ((FrameLayout.LayoutParams) this.r.getLayoutParams()).setMargins(0, 0, 0, 0);
        LayoutInflater layoutInflater = getLayoutInflater();
        FrameLayout frameLayout = this.s;
        int i = in.hopscotch.android.databinding.h0.d;
        this.binding = (in.hopscotch.android.databinding.h0) androidx.databinding.p.M(layoutInflater, 2131558463, frameLayout, true, androidx.databinding.g.e());
        this.q.setVisibility(0);
        this.binding.E().post(new androidx.activity.p(this, 18));
    }

    @Override
    public final void onDestroy() {
        in.hopscotch.android.util.f0.b().e();
        in.hopscotch.android.util.p0.a().getClass();
        in.hopscotch.android.util.p0.c((SortingTile) null);
        super.onDestroy();
    }

    public final void onNewIntent(@NonNull Intent intent) {
        super/*androidx.activity.j*/.onNewIntent(intent);
        int intExtra = intent.getIntExtra("HOME_TAB", -1);
        if (intExtra != -1) {
            this.p = intExtra;
            o1(intExtra, false);
            if (intExtra == 0 && intent.getStringExtra("FROM_SCREEN") != null && intent.getStringExtra("from_location") != null) {
                in.hopscotch.android.analytics.c.m().r(intent.getStringExtra("FROM_SCREEN"), intent.getStringExtra("from_location"));
            }
        }
        if (intent.getBooleanExtra("GO_TO_RECENTLY_VIEWED", false)) {
            try {
                this.u.setVisibility(0);
                FrameLayout frameLayout = this.u;
                int i = androidx.core.view.j0.a;
                j0.d.w(frameLayout, 100.0f);
                this.u.bringToFront();
                g1();
                FragmentManager supportFragmentManager = getSupportFragmentManager();
                supportFragmentManager.getClass();
                androidx.fragment.app.a aVar = new androidx.fragment.app.a(supportFragmentManager);
                aVar.m(2130771974, 2130771976, 2130771974, 2130771976);
                Fragment fragment = this.D;
                if (fragment == null) {
                    t1();
                } else if (!fragment.isAdded()) {
                    r1();
                }
                aVar.k(2131364266, this.D, "TAB_FRAGMENT", 1);
                aVar.p(false);
                FragmentManager supportFragmentManager2 = getSupportFragmentManager();
                supportFragmentManager2.L(true);
                Iterator it = supportFragmentManager2.i().iterator();
                while (it.hasNext()) {
                    ((androidx.fragment.app.p0) it.next()).p();
                }
                this.q.setVisibility(8);
            } catch (IllegalStateException e) {
                in.hopscotch.android.util.g.b(e);
            }
        }
        if (intent.getBooleanExtra("EXTERNAL_ACTION", false) || intent.getBooleanExtra("INTERNAL_ACTION", false)) {
            setIntent(intent);
            recreate();
        }
        if (!TextUtils.isEmpty(intent.getStringExtra("department"))) {
            setIntent(intent);
        }
        if (intent.getAction() == null || intent.getAction() == null || intent.getExtras() == null || !intent.getAction().equals("SHOP_BY")) {
            return;
        }
        String stringExtra = intent.getStringExtra("SHEET_ID");
        String stringExtra2 = intent.getStringExtra("SELECTED_TAB_NAME");
        Serializable serializable = (ExtraData) in.hopscotch.android.util.a1.z(intent.getExtras(), "EXTRA_DATA", ExtraData.class);
        if (stringExtra != null) {
            FragmentManager supportFragmentManager3 = getSupportFragmentManager();
            String simpleName = in.hopscotch.android.fragment.homepage.q.class.getSimpleName();
            in.hopscotch.android.fragment.homepage.q.s1.getClass();
            Intrinsics.checkNotNullParameter(supportFragmentManager3, "fragmentManager");
            Intrinsics.checkNotNullParameter(stringExtra, "sheetId");
            in.hopscotch.android.fragment.homepage.q qVar = new in.hopscotch.android.fragment.homepage.q();
            Bundle bundle = new Bundle();
            bundle.putString("SHEET_ID", stringExtra);
            bundle.putString("SELECTED_TAB_NAME", stringExtra2);
            bundle.putSerializable("EXTRA_DATA", serializable);
            qVar.setArguments(bundle);
            qVar.show(supportFragmentManager3, simpleName);
        }
    }

    @Override
    public final void onPause() {
        in.hopscotch.android.util.f0.b().e();
        super.onPause();
    }

    @Override
    public final void onRequestPermissionsResult(int i, @NonNull String[] strArr, @NonNull int[] iArr) {
        if (i == 1000) {
            in.hopscotch.android.db.a.Z(iArr[0] == -1);
        } else {
            super.onRequestPermissionsResult(i, strArr, iArr);
        }
    }

    public final void onRestoreInstanceState(@NonNull Bundle bundle) {
        Fragment fragment;
        MomentUserResponse momentUserResponse;
        super/*android.app.Activity*/.onRestoreInstanceState(bundle);
        int i = bundle.getInt("lastFragmentPosition", 0);
        if (i < this.z.size()) {
            fragment = (Fragment) this.z.get(i);
            if ((fragment instanceof in.hopscotch.android.fragment.b0) && (momentUserResponse = (MomentUserResponse) bundle.getSerializable("momentUserResponse")) != null) {
                Bundle bundle2 = new Bundle();
                bundle2.putSerializable("momentUserResponse", momentUserResponse);
                fragment.setArguments(bundle2);
            }
        } else {
            fragment = null;
        }
        if (fragment == null || fragment.isAdded()) {
            return;
        }
        FragmentManager fragmentManager = this.y;
        androidx.fragment.app.a f = android.support.v4.media.a.f(fragmentManager, fragmentManager);
        f.k(2131365205, fragment, fragment.getTag(), 1);
        f.h();
    }

    @Override
    public final void onResume() {
        in.hopscotch.android.util.f0.b().c(this);
        in.hopscotch.android.util.f0.b().d();
        this.mForceUpdateManager.n();
        if ((Calendar.getInstance().getTimeInMillis() - in.hopscotch.android.db.a.x().getLong("homeActivityStartTime", 0L)) / 1440000 > 1) {
            if (getSupportFragmentManager().Y() != null) {
                for (int i = 0; i < getSupportFragmentManager().Y().size(); i++) {
                    if (getSupportFragmentManager().Y().get(i) instanceof CollectionsFragment) {
                        ((CollectionsFragment) getSupportFragmentManager().Y().get(i)).r1();
                    }
                }
            }
            in.hopscotch.android.db.a.k().putLong("homeActivityStartTime", Calendar.getInstance().getTimeInMillis());
            in.hopscotch.android.db.a.k().apply();
        }
        boolean booleanExtra = getIntent() != null ? getIntent().getBooleanExtra("EXTERNAL_ACTION", false) : false;
        if (in.hopscotch.android.common.helper.q.c() != null && !booleanExtra) {
            in.hopscotch.android.common.helper.q.g(null);
        }
        if (this.q.getCurrentItem() == 3) {
            ((Fragment) this.z.get(3)).onResume();
        }
        Fragment fragment = this.D;
        if (fragment != null && fragment.isAdded()) {
            v1();
        }
        super.onResume();
    }

    public final void onSaveInstanceState(@NonNull Bundle bundle) {
        Fragment fragment;
        MomentUserResponse momentUserResponse;
        int currentItem = this.q.getCurrentItem();
        if (currentItem < this.z.size() && (fragment = (Fragment) this.z.get(currentItem)) != null) {
            bundle.putInt("lastFragmentPosition", currentItem);
            this.y.J0(fragment);
            if ((fragment instanceof in.hopscotch.android.fragment.b0) && (momentUserResponse = this.momentResponse) != null) {
                bundle.putSerializable("momentUserResponse", momentUserResponse);
            }
        }
        super/*androidx.activity.j*/.onSaveInstanceState(bundle);
    }

    public final void onStart() {
        super.onStart();
        androidx.localbroadcastmanager.content.a.b(this).c(this.mForceUpdateBroadcastReceiver, new IntentFilter("displayUpdateDialog"));
    }

    public final void onStop() {
        androidx.localbroadcastmanager.content.a.b(this).e(this.mForceUpdateBroadcastReceiver);
        androidx.localbroadcastmanager.content.a.b(this).e(this.mDepartmentUpdateBroadcastReceiver);
        super.onStop();
    }

    public final void r1() {
        Fragment R = getSupportFragmentManager().R("TAB_FRAGMENT");
        this.D = R;
        if (R != null) {
            FragmentManager supportFragmentManager = getSupportFragmentManager();
            androidx.fragment.app.a f = android.support.v4.media.a.f(supportFragmentManager, supportFragmentManager);
            f.t(this.D);
            f.p(false);
            if (this.D.isDetached()) {
                ArrayList arrayList = new ArrayList();
                arrayList.add(new RecentlyFragment.RecentlyViewTab(getString(in.hopscotch.android.components.s.deepLinkBoutiquesListing), getResources().getColor(2131100828), false));
                arrayList.add(new RecentlyFragment.RecentlyViewTab(getString(in.hopscotch.android.components.s.deepLinkProductsListing), getResources().getColor(2131100828), true));
                this.D = SlidingTabsColorsFragment.G0(arrayList, this);
            }
        }
    }

    public final void s1() {
        this.u.setVisibility(8);
        if (this.D != null) {
            FragmentManager supportFragmentManager = getSupportFragmentManager();
            androidx.fragment.app.a f = android.support.v4.media.a.f(supportFragmentManager, supportFragmentManager);
            f.i(this.D);
            f.p(false);
        }
        FragmentManager fragmentManager = this.y;
        androidx.fragment.app.a f2 = android.support.v4.media.a.f(fragmentManager, fragmentManager);
        for (int i = 0; i < this.z.size(); i++) {
            if (i == 0) {
                f2.v((Fragment) this.z.get(i));
            } else {
                f2.s((Fragment) this.z.get(i));
            }
        }
        f2.p(false);
        AHBottomNavigation aHBottomNavigation = this.q;
        if (aHBottomNavigation != null) {
            aHBottomNavigation.setVisibility(0);
            this.q.i();
        }
    }

    public final void t1() {
        Fragment R = getSupportFragmentManager().R("TAB_FRAGMENT");
        this.D = R;
        if (R == null) {
            ArrayList arrayList = new ArrayList();
            arrayList.add(new RecentlyFragment.RecentlyViewTab(getString(in.hopscotch.android.components.s.deepLinkBoutiquesListing), getResources().getColor(2131100828), false));
            arrayList.add(new RecentlyFragment.RecentlyViewTab(getString(in.hopscotch.android.components.s.deepLinkProductsListing), getResources().getColor(2131100828), true));
            this.D = SlidingTabsColorsFragment.G0(arrayList, this);
        }
    }

    public final void u1(MomentUserResponse momentUserResponse) {
        this.momentResponse = momentUserResponse;
    }

    public final void v1() {
        try {
            FragmentManager fragmentManager = this.y;
            fragmentManager.getClass();
            androidx.fragment.app.a aVar = new androidx.fragment.app.a(fragmentManager);
            for (int i = 0; i < this.z.size(); i++) {
                if (((Fragment) this.z.get(i)).isVisible()) {
                    aVar.s((Fragment) this.z.get(i));
                }
            }
            aVar.p(false);
        } catch (Exception e) {
            in.hopscotch.android.util.g.b(e);
        }
    }

    public static abstract class PagerItem implements Parcelable {
        private final int mIndicatorColor;
        private final CharSequence mTitle;

        public PagerItem(CharSequence charSequence, int i) {
            this.mTitle = charSequence;
            this.mIndicatorColor = i;
        }

        public final CharSequence b() {
            return this.mTitle;
        }

        @Override
        public final int describeContents() {
            return 0;
        }

        @Override
        public final void writeToParcel(Parcel parcel, int i) {
            parcel.writeString(this.mTitle.toString());
            parcel.writeInt(this.mIndicatorColor);
        }

        public PagerItem(Parcel parcel) {
            this(parcel.readString(), parcel.readInt());
        }
    }
}