导航菜单

页面标题

页面副标题

哔哩哔哩 v1.6.6 - RankingActivity.java 源代码

正在查看: 哔哩哔哩 v1.6.6 应用的 RankingActivity.java JAVA 源代码文件

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


package com.bilibili.tv.ui.ranking;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import bl.adl;
import bl.adw;
import bl.adz;
import bl.afg;
import bl.agd;
import bl.agf;
import bl.bbg;
import bl.bbi;
import bl.cj;
import bl.ok;
import bl.wf;
import bl.wg;
import com.bilibili.tv.ui.base.BaseSideActivity;
import com.bilibili.tv.widget.side.SideLeftSelectLinearLayout;
import java.lang.ref.WeakReference;
import kotlin.TypeCastException;
import u.aly.au;

public final class RankingActivity extends BaseSideActivity implements wf {
    public static final a Companion = new a(null);
    private b b;
    private ImageView c;
    private afg d;

    @Override
    public String a() {
        return "ott-platform.rank.0.0.pv";
    }

    @Override
    public void a(agd agdVar) {
    }

    @Override
    public boolean a_() {
        return wg.a(this);
    }

    @Override
    public Bundle b() {
        return null;
    }

    @Override
    public int g() {
        return 2131361826;
    }

    public static final class a {
        private a() {
        }

        public a(bbg bbgVar) {
            this();
        }

        public final void a(Context context) {
            bbi.b(context, au.aD);
            context.startActivity(new Intent(context, (Class<?>) RankingActivity.class));
        }
    }

    @Override
    public void a(Bundle bundle) {
        a((RecyclerView) d(2131230955));
        TextView textView = (TextView) d(2131230821);
        this.c = (ImageView) d(2131230752);
        textView.setText(adl.e(2131493109));
        this.d = new afg(this, 2131230865);
        ok.a("tv_ranking_all_view", new String[0]);
    }

    @Override
    public void onPostCreate(Bundle bundle) {
        super.onPostCreate(bundle);
        j().setLayoutManager(new RankingLeftLinearLayoutManger(this, 1, false));
        afg afgVar = this.d;
        if (afgVar == null) {
            bbi.a();
        }
        int a2 = afgVar.a();
        cj cjVar = new cj();
        int i = a2 - 1;
        if (i >= 0) {
            int i2 = 0;
            while (true) {
                afg afgVar2 = this.d;
                if (afgVar2 == null) {
                    bbi.a();
                }
                cjVar.b(i2, afgVar2.b(i2).toString());
                if (i2 == i) {
                    break;
                } else {
                    i2++;
                }
            }
        }
        this.b = new b(this, cjVar);
        j().setAdapter(this.b);
        j().setFocusable(false);
        j().setHasFixedSize(true);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        this.b = (b) null;
        this.d = (afg) null;
    }

    @Override
    public boolean dispatchKeyEvent(KeyEvent keyEvent) {
        if (this.b == null || this.d == null) {
            return super.dispatchKeyEvent(keyEvent);
        }
        Integer valueOf = keyEvent != null ? Integer.valueOf(keyEvent.getAction()) : null;
        Integer valueOf2 = keyEvent != null ? Integer.valueOf(keyEvent.getKeyCode()) : null;
        if (valueOf != null && valueOf.intValue() == 0) {
            View currentFocus = getCurrentFocus();
            if (currentFocus == null) {
                return super.dispatchKeyEvent(keyEvent);
            }
            if (valueOf2 != null && valueOf2.intValue() == 21) {
                Object parent = currentFocus.getParent();
                if (!(parent instanceof View)) {
                    parent = null;
                }
                View view = (View) parent;
                Object tag = view != null ? view.getTag() : null;
                if (TextUtils.equals((CharSequence) (tag instanceof CharSequence ? tag : null), adw.a)) {
                    b bVar = this.b;
                    if (bVar == null) {
                        bbi.a();
                    }
                    bVar.b(false);
                }
            } else if (valueOf2 != null && valueOf2.intValue() == 22) {
                afg afgVar = this.d;
                if (afgVar == null) {
                    bbi.a();
                }
                b bVar2 = this.b;
                if (bVar2 == null) {
                    bbi.a();
                }
                Fragment d = afgVar.d(bVar2.f());
                if (d == null) {
                    return true;
                }
                if ((d instanceof adw) && !((adw) d).c()) {
                    return true;
                }
                if (currentFocus instanceof SideLeftSelectLinearLayout) {
                    ((SideLeftSelectLinearLayout) currentFocus).c();
                    b bVar3 = this.b;
                    if (bVar3 == null) {
                        bbi.a();
                    }
                    bVar3.b(true);
                }
            }
        }
        return super.dispatchKeyEvent(keyEvent);
    }

    @Override
    public Fragment h() {
        if (this.d == null || this.b == null) {
            return null;
        }
        afg afgVar = this.d;
        if (afgVar == null) {
            bbi.a();
        }
        b bVar = this.b;
        if (bVar == null) {
            bbi.a();
        }
        return afgVar.d(bVar.f());
    }

    public static final class b extends adz<RecyclerView.v> implements Runnable {
        private final WeakReference<RankingActivity> a;
        private long b;
        private boolean c;
        private int d;
        private final cj<String> e;

        @Override
        public int e() {
            return 0;
        }

        public b(RankingActivity rankingActivity, cj<String> cjVar) {
            bbi.b(rankingActivity, "activity");
            this.e = cjVar;
            this.a = new WeakReference<>(rankingActivity);
        }

        public final void e(int i) {
            this.d = i;
        }

        public final int f() {
            return this.d;
        }

        @Override
        public RecyclerView.v a(ViewGroup viewGroup, int i) {
            bbi.b(viewGroup, "parent");
            agf a2 = agf.a(viewGroup);
            bbi.a((Object) a2, "SideTitleVH.create(parent)");
            return a2;
        }

        @Override
        public void a(RecyclerView.v vVar, int i) {
            bbi.b(vVar, "holder");
            if (vVar instanceof agf) {
                if (this.e != null) {
                    TextView textView = ((agf) vVar).n;
                    bbi.a((Object) textView, "holder.tvTitle");
                    textView.setText(this.e.a(i));
                }
                View view = vVar.a;
                bbi.a((Object) view, "holder.itemView");
                view.setOnFocusChangeListener(new a(vVar));
            }
        }

        static final class a implements View.OnFocusChangeListener {
            final RecyclerView.v b;

            a(RecyclerView.v vVar) {
                this.b = vVar;
            }

            @Override
            public final void onFocusChange(View view, boolean z) {
                RankingActivity rankingActivity = (RankingActivity) b.this.a.get();
                if (!z) {
                    if (b.this.c) {
                        return;
                    }
                    View view2 = this.b.a;
                    bbi.a((Object) view2, "holder.itemView");
                    view2.setSelected(false);
                    return;
                }
                if (rankingActivity == null || rankingActivity.isFinishing() || rankingActivity.d == null || rankingActivity.getSupportFragmentManager() == null) {
                    return;
                }
                int f = this.b.f();
                if (System.currentTimeMillis() - b.this.b < 500) {
                    view.removeCallbacks(b.this);
                }
                b.this.e(f);
                view.postDelayed(b.this, 500L);
                b.this.b = System.currentTimeMillis();
                View view3 = this.b.a;
                bbi.a((Object) view3, "holder.itemView");
                view3.setSelected(true);
                View view4 = this.b.a;
                if (view4 == null) {
                    throw new TypeCastException("null cannot be cast to non-null type com.bilibili.tv.widget.side.SideLeftSelectLinearLayout");
                }
                ((SideLeftSelectLinearLayout) view4).a();
                rankingActivity.b(4);
                if (rankingActivity.c == null) {
                    return;
                }
                cj cjVar = b.this.e;
                if (cjVar == null) {
                    bbi.a();
                }
                if (f == cjVar.b() - 1) {
                    ImageView imageView = rankingActivity.c;
                    if (imageView == null) {
                        bbi.a();
                    }
                    imageView.setVisibility(4);
                    return;
                }
                ImageView imageView2 = rankingActivity.c;
                if (imageView2 == null) {
                    bbi.a();
                }
                imageView2.setVisibility(0);
            }
        }

        @Override
        public int a() {
            cj<String> cjVar = this.e;
            if (cjVar != null) {
                return cjVar.b();
            }
            return 0;
        }

        public final void b(boolean z) {
            this.c = z;
        }

        @Override
        public void run() {
            afg afgVar;
            RankingActivity rankingActivity = this.a.get();
            if (rankingActivity == null || rankingActivity.isFinishing() || rankingActivity.d == null || rankingActivity.getSupportFragmentManager() == null || (afgVar = rankingActivity.d) == null) {
                return;
            }
            afgVar.c(this.d);
        }
    }
}