导航菜单

页面标题

页面副标题

Hopscotch v9.7.2 - DepartmentPageActivity.java 源代码

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

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


package in.hopscotch.android.activity;

import android.R;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.graphics.BitmapFactory;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.transition.Fade;
import android.transition.Transition;
import android.util.Property;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.Window;
import android.view.animation.AlphaAnimation;
import android.view.animation.AnimationSet;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.LayoutAnimationController;
import android.view.animation.TranslateAnimation;
import android.widget.ImageView;
import androidx.appcompat.app.k;
import androidx.cardview.widget.CardView;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.yalantis.ucrop.view.CropImageView;
import in.hopscotch.android.api.factory.DepartmentSearchApiFactory;
import in.hopscotch.android.attribution.AttributionData;
import in.hopscotch.android.attribution.OrderAttributionHelper;
import in.hopscotch.android.domain.model.department.DepartmentSearchCategory;
import in.hopscotch.android.domain.model.extras.DepartmentInfo;
import java.lang.ref.WeakReference;
import java.util.List;

public class DepartmentPageActivity extends androidx.appcompat.app.i {
    private static final String EXTRA_DEPARTMENT_INFO = "dept_info";
    private static final String TAG = "DepartmentPageActivity";
    private static final String sharedImgTransitionName = "shared_img";
    private in.hopscotch.android.animhelper.a animhelper;
    private in.hopscotch.android.databinding.v3 binding;
    private in.hopscotch.android.adapter.n deptCatAdapter;
    private String deptID;
    private DepartmentInfo deptInfo;
    private in.hopscotch.android.adapter.n deptSubCatAdapter;
    private in.hopscotch.android.viewmodel.g deptViewModel;
    private ObjectAnimator gentleTranslate;
    private AttributionData localAttributionData;
    private boolean isStartingAnim = true;
    private DepartmentSearchCategory deptCat = null;
    private androidx.core.app.k0 mCallback = new a();

    public class a extends androidx.core.app.k0 {
        public a() {
        }

        public final void b() {
            DepartmentPageActivity departmentPageActivity = DepartmentPageActivity.this;
            if (departmentPageActivity.binding != null) {
                departmentPageActivity.binding.f.setVisibility(8);
                departmentPageActivity.binding.p.setVisibility(8);
            }
        }
    }

    public class b implements Transition.TransitionListener {
        public b() {
        }

        @Override
        public final void onTransitionCancel(Transition transition) {
        }

        @Override
        public final void onTransitionEnd(Transition transition) {
            DepartmentPageActivity departmentPageActivity = DepartmentPageActivity.this;
            if (!departmentPageActivity.isStartingAnim || departmentPageActivity.binding == null) {
                return;
            }
            departmentPageActivity.binding.p.setBackgroundResource(2131232380);
            departmentPageActivity.binding.n.setBackgroundResource(2131232380);
            DepartmentPageActivity.W0(departmentPageActivity);
            departmentPageActivity.isStartingAnim = false;
        }

        @Override
        public final void onTransitionPause(Transition transition) {
        }

        @Override
        public final void onTransitionResume(Transition transition) {
        }

        @Override
        public final void onTransitionStart(Transition transition) {
            DepartmentPageActivity departmentPageActivity = DepartmentPageActivity.this;
            departmentPageActivity.binding.p.setBackgroundResource(0);
            departmentPageActivity.binding.n.setBackgroundResource(0);
        }
    }

    public class c implements ViewTreeObserver.OnPreDrawListener {
        public c() {
        }

        @Override
        public final boolean onPreDraw() {
            DepartmentPageActivity departmentPageActivity = DepartmentPageActivity.this;
            departmentPageActivity.binding.l.getViewTreeObserver().removeOnPreDrawListener(this);
            String str = in.hopscotch.android.util.a1.a;
            departmentPageActivity.supportStartPostponedEnterTransition();
            return false;
        }
    }

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

    public static void S0(DepartmentPageActivity departmentPageActivity) {
        in.hopscotch.android.animhelper.a aVar = departmentPageActivity.animhelper;
        in.hopscotch.android.databinding.v3 v3Var = departmentPageActivity.binding;
        aVar.a(v3Var.d, v3Var.f, v3Var.o, v3Var.p, v3Var.j, v3Var.q);
        departmentPageActivity.binding.n.setOnClickListener(null);
        DepartmentSearchCategory departmentSearchCategory = departmentPageActivity.deptCat;
        if (departmentSearchCategory != null) {
            departmentPageActivity.binding.j.setOnClickListener(new v(0, departmentPageActivity, departmentSearchCategory));
        }
    }

    public static void W0(DepartmentPageActivity departmentPageActivity) {
        departmentPageActivity.binding.j.setVisibility(8);
        CardView cardView = departmentPageActivity.binding.j;
        Property property = View.TRANSLATION_X;
        ObjectAnimator ofFloat = ObjectAnimator.ofFloat(cardView, (Property<CardView, Float>) property, (departmentPageActivity.getResources().getDimension(2131165464) * (-1.0f)) / 2.0f, CropImageView.DEFAULT_ASPECT_RATIO);
        ofFloat.addListener(new w(departmentPageActivity));
        long j = 100;
        ofFloat.setStartDelay(j);
        ofFloat.start();
        departmentPageActivity.binding.i.setVisibility(0);
        ObjectAnimator ofFloat2 = ObjectAnimator.ofFloat(departmentPageActivity.binding.o, (Property<CardView, Float>) property, in.hopscotch.android.util.a1.g(72.0f, departmentPageActivity) * (-1.0f));
        ofFloat2.setStartDelay(j);
        ofFloat2.start();
        ofFloat2.addListener(new x(departmentPageActivity, ofFloat2));
        ObjectAnimator ofFloat3 = ObjectAnimator.ofFloat(departmentPageActivity.binding.q, (Property<View, Float>) property, in.hopscotch.android.util.a1.g(72.0f, departmentPageActivity) * (-1.0f));
        ofFloat3.addListener(new y(departmentPageActivity, ofFloat3));
        ofFloat3.setStartDelay(j);
        ofFloat3.start();
    }

    public final void X0(ViewGroup viewGroup) {
        AnimationSet animationSet = new AnimationSet(false);
        TranslateAnimation translateAnimation = new TranslateAnimation(1, CropImageView.DEFAULT_ASPECT_RATIO, 1, CropImageView.DEFAULT_ASPECT_RATIO, 1, 0.2f, 1, CropImageView.DEFAULT_ASPECT_RATIO);
        DecelerateInterpolator decelerateInterpolator = new DecelerateInterpolator();
        AlphaAnimation alphaAnimation = new AlphaAnimation(CropImageView.DEFAULT_ASPECT_RATIO, 1.0f);
        alphaAnimation.setInterpolator(decelerateInterpolator);
        translateAnimation.setAnimationListener(new a0(this));
        translateAnimation.setInterpolator(decelerateInterpolator);
        animationSet.setInterpolator(decelerateInterpolator);
        animationSet.addAnimation(alphaAnimation);
        animationSet.addAnimation(translateAnimation);
        animationSet.setDuration(125L);
        viewGroup.setLayoutAnimation(new LayoutAnimationController(animationSet, 0.5f));
    }

    public final void Y0() {
        ImageView imageView;
        in.hopscotch.android.databinding.v3 v3Var = this.binding;
        if (v3Var != null && this.animhelper != null && (imageView = v3Var.n) != null) {
            imageView.setOnClickListener(new androidx.media3.ui.m(this, 3));
        }
        this.binding.j.setOnClickListener(null);
    }

    public final void Z0(List<DepartmentSearchCategory> list) {
        int k = this.deptCatAdapter.k();
        this.deptCatAdapter.M(list, null);
        c1();
        this.binding.m.setVisibility(8);
        if (k == 0) {
            X0(this.binding.d);
        }
    }

    public final void a1(List<DepartmentSearchCategory> list, DepartmentSearchCategory departmentSearchCategory) {
        this.deptSubCatAdapter.M(list, departmentSearchCategory);
        X0(this.binding.f);
    }

    public final void b1(String str) {
        androidx.core.graphics.drawable.b bVar = new androidx.core.graphics.drawable.b(getResources(), BitmapFactory.decodeResource(getResources(), 2131231864));
        bVar.c();
        in.hopscotch.android.util.a1.L(0, bVar, getApplicationContext(), str, this.binding.p, getResources().getDimension(2131165461), getResources().getDimension(2131165460), true, ImageView.ScaleType.CENTER_CROP, false);
    }

    public final void c1() {
        if (this.deptCat == null) {
            DepartmentSearchCategory departmentSearchCategory = new DepartmentSearchCategory();
            this.deptCat = departmentSearchCategory;
            departmentSearchCategory.setImageUrl(this.deptInfo.search_image_url);
            this.deptCat.setSubCategoryList((List) null);
            this.deptCat.setActionUri(this.deptInfo.action_uri);
            this.deptCat.setCategoryId(-1);
            this.deptCat.setSearchLink((String) null);
            this.deptCat.setParent(true);
        }
        this.binding.j.setOnClickListener(new v(0, this, this.deptCat));
    }

    public final void d1() {
        this.binding.j.setPivotX(CropImageView.DEFAULT_ASPECT_RATIO);
        this.binding.j.setPivotY(r0.getHeight() / 2);
        in.hopscotch.android.animhelper.a aVar = this.animhelper;
        in.hopscotch.android.databinding.v3 v3Var = this.binding;
        aVar.b(this, v3Var.d, v3Var.f, v3Var.o, v3Var.p, v3Var.j, v3Var.q);
    }

    public final void onBackPressed() {
        if (this.binding.d.getVisibility() != 8) {
            supportFinishAfterTransition();
            return;
        }
        in.hopscotch.android.animhelper.a aVar = this.animhelper;
        in.hopscotch.android.databinding.v3 v3Var = this.binding;
        aVar.a(v3Var.d, v3Var.f, v3Var.o, v3Var.p, v3Var.j, v3Var.q);
        DepartmentSearchCategory departmentSearchCategory = this.deptCat;
        if (departmentSearchCategory != null) {
            this.binding.j.setOnClickListener(new v(0, this, departmentSearchCategory));
        }
    }

    public final void onCreate(Bundle bundle) {
        Fade fade;
        try {
            Window window = getWindow();
            if (window != null) {
                window.addFlags(Integer.MIN_VALUE);
                window.clearFlags(67108864);
                window.setStatusBarColor(getResources().getColor(2131099811));
            }
        } catch (Exception e) {
            in.hopscotch.android.util.g.b(e);
        }
        super/*androidx.fragment.app.n*/.onCreate(bundle);
        in.hopscotch.android.util.e0.b().h();
        this.localAttributionData = OrderAttributionHelper.getInstance().getCurrentAttributionData();
        this.binding = (in.hopscotch.android.databinding.v3) androidx.databinding.g.h(this, 2131558598);
        this.deptInfo = (DepartmentInfo) getIntent().getExtras().get(EXTRA_DEPARTMENT_INFO);
        in.hopscotch.android.viewmodel.g gVar = new in.hopscotch.android.viewmodel.g(new WeakReference(this), this.deptInfo);
        this.deptViewModel = gVar;
        this.binding.g0(gVar);
        this.deptCatAdapter = new in.hopscotch.android.adapter.n(this, this.deptViewModel, true);
        this.binding.d.setLayoutManager(new LinearLayoutManager(this, 1, false));
        this.binding.d.setAdapter(this.deptCatAdapter);
        this.binding.m.setVisibility(0);
        this.deptID = Uri.parse(this.deptInfo.action_uri).getQueryParameter("id");
        Fade fade2 = null;
        String string = in.hopscotch.android.db.a.x().getString("department_" + this.deptID, null);
        if (string != null) {
            List<DepartmentSearchCategory> list = (List) in.hopscotch.android.common.util.d.b().a().d(string, new z(this).getType());
            this.deptCatAdapter.M(list, null);
            c1();
            if (list != null) {
                this.binding.m.setVisibility(8);
            }
            X0(this.binding.d);
        }
        this.deptSubCatAdapter = new in.hopscotch.android.adapter.n(this, this.deptViewModel, false);
        this.binding.f.setLayoutManager(new LinearLayoutManager(this, 1, false));
        this.binding.f.setAdapter(this.deptSubCatAdapter);
        this.animhelper = new in.hopscotch.android.animhelper.a();
        DepartmentInfo departmentInfo = this.deptInfo;
        if (departmentInfo != null) {
            in.hopscotch.android.viewmodel.g gVar2 = this.deptViewModel;
            gVar2.getClass();
            String queryParameter = Uri.parse(departmentInfo.action_uri).getQueryParameter("id");
            DepartmentSearchApiFactory.getInstance().getDepartmentSearchResult(queryParameter, new in.hopscotch.android.viewmodel.f(gVar2, queryParameter, departmentInfo));
        }
        supportPostponeEnterTransition();
        setEnterSharedElementCallback(this.mCallback);
        String str = in.hopscotch.android.util.a1.a;
        getWindow().getSharedElementEnterTransition().addListener(new b());
        this.binding.n.setImageResource(2131231857);
        Context applicationContext = getApplicationContext();
        String str2 = this.deptInfo.search_image_url;
        ImageView imageView = this.binding.n;
        float dimension = getResources().getDimension(2131165454);
        float dimension2 = getResources().getDimension(2131165453);
        ImageView.ScaleType scaleType = ImageView.ScaleType.CENTER_CROP;
        in.hopscotch.android.util.a1.L(2131231864, (Drawable) null, applicationContext, str2, imageView, dimension, dimension2, false, scaleType, true);
        in.hopscotch.android.util.a1.L(0, new ColorDrawable(getResources().getColor(in.hopscotch.android.components.m.banner_background)), getApplicationContext(), this.deptInfo.store_image_url, this.binding.i, CropImageView.DEFAULT_ASPECT_RATIO, CropImageView.DEFAULT_ASPECT_RATIO, false, scaleType, false);
        this.binding.n.setTransitionName(sharedImgTransitionName);
        this.binding.l.getViewTreeObserver().addOnPreDrawListener(new c());
        int i = Build.VERSION.SDK_INT;
        if (i >= 23) {
            if (i >= 23) {
                fade = new Fade();
                fade.excludeTarget(R.id.navigationBarBackground, true);
                fade.excludeTarget(R.id.statusBarBackground, true);
            } else {
                fade = null;
            }
            if (fade != null) {
                Window window2 = getWindow();
                if (i >= 23) {
                    fade2 = new Fade();
                    fade2.excludeTarget(R.id.navigationBarBackground, true);
                    fade2.excludeTarget(R.id.statusBarBackground, true);
                }
                window2.setEnterTransition(fade2);
            }
        }
    }

    public final void onDestroy() {
        super.onDestroy();
        this.gentleTranslate = null;
        in.hopscotch.android.viewmodel.g gVar = this.deptViewModel;
        if (gVar != null) {
            gVar.e();
        }
        this.deptViewModel = null;
        this.binding = null;
    }

    public final void onResume() {
        super/*androidx.fragment.app.n*/.onResume();
        OrderAttributionHelper.getInstance().setCurrentOrderAttributionData(this.localAttributionData);
        in.hopscotch.android.util.a1.a = "";
    }
}