导航菜单

页面标题

页面副标题

Mint v5.7.3 - PhotoGalleryDetailActivity.java 源代码

正在查看: Mint v5.7.3 应用的 PhotoGalleryDetailActivity.java JAVA 源代码文件

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


package com.htmedia.mint.ui.activity;

import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.MenuItem;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.comscore.Analytics;
import com.htmedia.mint.AppController;
import com.htmedia.mint.pojo.Content;
import com.htmedia.mint.pojo.ForyouPojo;
import com.htmedia.mint.pojo.PinnedArticlePojo;
import com.htmedia.mint.pojo.config.Config;
import com.htmedia.mint.pojo.config.Section;
import com.htmedia.mint.utils.q;
import com.htmedia.sso.helpers.ToastHelper;
import com.snowplowanalytics.snowplow.tracker.Tracker;
import com.thoughtbot.expandablerecyclerview.BuildConfig;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import x4.oj0;

public class PhotoGalleryDetailActivity extends com.htmedia.mint.ui.activity.a implements k6.n1, k6.s {
    private AppController a;
    private k6.m1 b;
    private int f;
    private String j;
    private HashMap<String, String> o;
    private q7.e5 s;
    private oj0 t;
    private int c = 0;
    private int d = 0;
    private int e = 0;
    private String g = BuildConfig.FLAVOR;
    private String h = BuildConfig.FLAVOR;
    private boolean i = false;
    private final List<Content> p = new ArrayList();
    private final List<Content> q = new ArrayList();
    private final List<PinnedArticlePojo> r = new ArrayList();

    class a extends RecyclerView.OnScrollListener {
        a() {
        }

        public void onScrollStateChanged(RecyclerView recyclerView, int i) {
            super.onScrollStateChanged(recyclerView, i);
            if (i == 0) {
                PhotoGalleryDetailActivity.this.R();
            }
        }

        public void onScrolled(RecyclerView recyclerView, int i, int i2) {
            if (PhotoGalleryDetailActivity.this.i || PhotoGalleryDetailActivity.this.t.d.getLayoutManager().findLastVisibleItemPosition() != PhotoGalleryDetailActivity.this.q.size() - 1) {
                return;
            }
            if (PhotoGalleryDetailActivity.this.p.size() > PhotoGalleryDetailActivity.this.t.d.getAdapter().getItemCount()) {
                PhotoGalleryDetailActivity photoGalleryDetailActivity = PhotoGalleryDetailActivity.this;
                photoGalleryDetailActivity.W(String.valueOf(((Content) photoGalleryDetailActivity.p.get(PhotoGalleryDetailActivity.this.t.d.getAdapter().getItemCount() - 1)).getId()));
            }
            if (PhotoGalleryDetailActivity.this.e <= PhotoGalleryDetailActivity.this.d - 1 || PhotoGalleryDetailActivity.this.t.d.getAdapter().getItemCount() < PhotoGalleryDetailActivity.this.p.size()) {
                return;
            }
            PhotoGalleryDetailActivity.P(PhotoGalleryDetailActivity.this);
            PhotoGalleryDetailActivity.this.Y();
        }
    }

    static int P(PhotoGalleryDetailActivity photoGalleryDetailActivity) {
        int i = photoGalleryDetailActivity.d;
        photoGalleryDetailActivity.d = i + 1;
        return i;
    }

    private boolean Q(View view, int i, int i2) {
        int[] iArr = new int[2];
        view.getLocationOnScreen(iArr);
        int i3 = iArr[1];
        if (i3 <= i2) {
            return ((i2 - i3) * 100) / i < 30;
        }
        int i4 = this.f - i3;
        return i4 > i || (i4 * 100) / i >= 70;
    }

    private List<Content> S(List<Content> list) {
        if (TextUtils.isEmpty(this.g) || !com.htmedia.mint.utils.f0.X1(this.g)) {
            return list;
        }
        long parseLong = Long.parseLong(this.g);
        ArrayList arrayList = new ArrayList();
        for (Content content : list) {
            if (content.getType().equals(j5.b.d.a()) && parseLong != content.getId()) {
                arrayList.add(content);
            }
        }
        return arrayList;
    }

    private String T(String str) {
        return (str == null || !str.contains("-")) ? str : str.substring(0, str.indexOf(45));
    }

    private void U() {
        String string = getIntent().getExtras().getString("story_id");
        this.g = string;
        this.g = T(string);
        this.b = new k6.m1(this, this);
        HashMap<String, String> hashMap = new HashMap<>();
        this.o = hashMap;
        hashMap.put("Authorization", com.htmedia.mint.utils.q.a);
        W(this.g);
        if (!getIntent().getExtras().containsKey("gallery_data")) {
            Y();
        } else {
            this.d = getIntent().getExtras().getInt("pagerPosition", 0);
            this.p.addAll(S(getIntent().getExtras().getParcelableArrayList("gallery_data")));
        }
    }

    private String V() {
        for (Section section : this.a.g().getOthers()) {
            if (section.getId().equalsIgnoreCase(com.htmedia.mint.utils.q.d[7])) {
                String url = section.getUrl();
                if (url.contains("http")) {
                    return url + "&page=" + this.d;
                }
                return this.j + url + "&page=" + this.d;
            }
        }
        return BuildConfig.FLAVOR + "&page=" + this.d;
    }

    private String X(Config config, String str) {
        if ("mintLounge".equalsIgnoreCase((getIntent() == null || getIntent().getExtras() == null) ? BuildConfig.FLAVOR : getIntent().getExtras().getString("story_type", BuildConfig.FLAVOR))) {
            return config.getMintLounge().getDetailUrl() + str;
        }
        for (Section section : config.getOthers()) {
            if (section.getId().equalsIgnoreCase(com.htmedia.mint.utils.q.d[6])) {
                String url = section.getUrl();
                if (url.contains("http")) {
                    return url + str + "&elements=true";
                }
                return this.j + url + str + "&elements=true";
            }
        }
        return BuildConfig.FLAVOR + this.g + "&elements=true";
    }

    private View Z(int i) {
        return this.t.d.getChildAt(i);
    }

    private boolean b0(int i, int i2) {
        View Z = Z(i);
        int i3 = this.f - i2;
        int height = Z.getHeight();
        if (height <= i3 || (i3 * 100) / height > 70) {
            return Q(Z, height, i2);
        }
        return false;
    }

    public void c0(View view) {
        d0();
    }

    private void d0() {
        if (getIntent().getExtras() != null && getIntent().getExtras().containsKey("isNotification") && getIntent().getExtras().getInt("isNotification") > q.m.INAPP.ordinal()) {
            startActivity(new Intent((Context) this, (Class<?>) HomeActivity.class));
        }
        finish();
    }

    public void R() {
        int[] iArr = new int[2];
        this.t.d.getLocationOnScreen(iArr);
        int childCount = this.t.d.getLayoutManager().getChildCount();
        for (int i = 0; i < childCount; i++) {
            boolean b0 = b0(i, iArr[1]);
            int findFirstVisibleItemPosition = this.t.d.getLayoutManager().findFirstVisibleItemPosition() + i;
            if (b0 && findFirstVisibleItemPosition != this.c) {
                this.c = findFirstVisibleItemPosition;
                if (findFirstVisibleItemPosition < this.p.size()) {
                    Content content = this.p.get(findFirstVisibleItemPosition);
                    Section section = new Section();
                    section.setDisplayName("Gallery");
                    Tracker instance = Tracker.instance();
                    String str = com.htmedia.mint.utils.q.c[0];
                    com.htmedia.mint.utils.k1.w(instance, content, section, str, str, content.isExpanded(), findFirstVisibleItemPosition, this.r, this.h);
                }
            }
        }
    }

    public void W(String str) {
        this.i = true;
        this.b.a(0, "PhotoGalleryActivity", X(this.a.g(), str), null, this.o, false, false);
    }

    public void Y() {
        this.i = true;
        this.b.a(0, "PhotoGalleryActivity", V(), null, this.o, false, false);
    }

    void a0() {
        this.t.d.setLayoutManager(new LinearLayoutManager(this));
        q7.e5 e5Var = new q7.e5(this, this.q, this);
        this.s = e5Var;
        this.t.d.setAdapter(e5Var);
        this.t.d.addOnScrollListener(new a());
        if (getIntent().getExtras() == null || !getIntent().getExtras().containsKey("story_tittle")) {
            com.htmedia.mint.utils.n.q0(this, "Photo Gallery");
            return;
        }
        com.htmedia.mint.utils.n.q0(this, "Photo Gallery :- Headline : " + getIntent().getExtras().getString("story_tittle"));
    }

    @Override
    public void getConfig(Config config) {
        this.a.L(config);
        this.j = this.a.g().getServerUrl();
        U();
        a0();
    }

    @Override
    public void getStoryData(ForyouPojo foryouPojo, String str) {
        if (foryouPojo == null || foryouPojo.getContentList().size() <= 0) {
            return;
        }
        this.i = false;
        if (foryouPojo.getPersonalizeCheck() != null) {
            this.h = foryouPojo.getPersonalizeCheck();
        }
        if (foryouPojo.getContentList().get(0).getListElement() != null) {
            this.q.addAll(foryouPojo.getContentList());
            q7.e5 e5Var = this.s;
            e5Var.notifyItemChanged(e5Var.getItemCount());
            if (foryouPojo.getPinnedArticles() != null) {
                this.r.addAll(foryouPojo.getPinnedArticles());
                return;
            }
            return;
        }
        this.e = foryouPojo.getTotalPages();
        this.p.addAll(S(foryouPojo.getContentList()));
        if (this.t.d.getAdapter().getItemCount() == 1) {
            W(String.valueOf(this.p.get(0).getId()));
        }
        if (foryouPojo.getPinnedArticles() != null) {
            this.r.addAll(foryouPojo.getPinnedArticles());
        }
        if (this.d == 0) {
            R();
        }
    }

    public void onBackPressed() {
        d0();
    }

    public void onConfigurationChanged(@NonNull Configuration configuration) {
        super.onConfigurationChanged(configuration);
        AppController.e(getIntent(), this);
    }

    protected void onCreate(@Nullable Bundle bundle) {
        super/*androidx.fragment.app.FragmentActivity*/.onCreate(bundle);
        oj0 contentView = DataBindingUtil.setContentView(this, 2131625125);
        this.t = contentView;
        com.htmedia.mint.utils.f0.b = false;
        setSupportActionBar(contentView.e);
        getSupportActionBar().setDisplayShowTitleEnabled(false);
        this.t.a.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                PhotoGalleryDetailActivity.this.c0(view);
            }
        });
        this.a = getApplication();
        this.f = Resources.getSystem().getDisplayMetrics().heightPixels;
        if (this.a.g() != null) {
            this.j = this.a.g().getServerUrl();
            U();
            a0();
        } else {
            new k6.r(this, this).e(0, "PhotoGalleryActivity", "https://images.livemint.com/apps/v3/deviceconfig.json", true, false);
        }
        m7.g.p(AppController.V);
    }

    @Override
    public void onError(String str) {
        ToastHelper.showToast(this, getString(2131952025));
    }

    @Override
    public void onError(String str, String str2) {
        com.htmedia.mint.utils.o0.a(str2, str);
        ToastHelper.showToast(this, getString(2131952025));
    }

    public boolean onOptionsItemSelected(MenuItem menuItem) {
        if (menuItem.getItemId() != 16908332) {
            return super/*android.app.Activity*/.onOptionsItemSelected(menuItem);
        }
        finish();
        return true;
    }

    protected void onPause() {
        super/*androidx.fragment.app.FragmentActivity*/.onPause();
        Analytics.notifyExitForeground();
    }

    protected void onResume() {
        super/*androidx.fragment.app.FragmentActivity*/.onResume();
        Analytics.notifyEnterForeground();
    }
}