导航菜单

页面标题

页面副标题

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

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

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


package com.bilibili.tv.ui.setting;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v7.widget.RecyclerView;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import bl.abd;
import bl.adl;
import bl.adw;
import bl.adz;
import bl.afk;
import bl.afm3;
import bl.afm4;
import bl.afn;
import bl.afo;
import bl.afp;
import bl.afq;
import bl.agb;
import bl.agd;
import bl.agf;
import bl.bbg;
import bl.bbi;
import bl.cj;
import bl.ok;
import com.bilibili.tv.ui.base.BaseUpViewActivity;
import com.bilibili.tv.ui.ranking.RankingLeftLinearLayoutManger;
import com.bilibili.tv.widget.DrawFrameLayout;
import com.bilibili.tv.widget.side.SideLeftSelectLinearLayout;
import java.lang.ref.WeakReference;
import kotlin.TypeCastException;
import u.aly.au;

public final class SettingActivity extends BaseUpViewActivity {
    public static final a Companion = new a(null);
    private static final String e = "fromType";
    private static final int f = 1;
    private static final int g = 2;
    private RecyclerView a;
    private b b;
    private Integer c = 0;
    private afp d;

    @Override
    public void a(agd agdVar) {
    }

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

    @Override
    public void a(Bundle bundle) {
        this.a = (RecyclerView) d(2131230955);
        ((TextView) d(2131230821)).setText(adl.e(2131493138));
        Intent intent = getIntent();
        this.c = intent != null ? Integer.valueOf(intent.getIntExtra(e, 0)) : null;
    }

    @Override
    public void onPostCreate(Bundle bundle) {
        super.onPostCreate(bundle);
        FragmentManager supportFragmentManager = getSupportFragmentManager();
        bbi.a((Object) supportFragmentManager, "supportFragmentManager");
        this.d = new afp(supportFragmentManager, 2131230865);
        Integer num = this.c;
        if (num != null && num.intValue() == 1) {
            ok.a("tv_setting_pageview", "from", "首页");
        } else if (num != null && num.intValue() == 2) {
            ok.a("tv_setting_pageview", "from", "个人中心");
        }
        afp afpVar = this.d;
        if (afpVar == null) {
            bbi.a();
        }
        int a2 = afpVar.a();
        cj cjVar = new cj();
        int i = a2 - 1;
        if (i >= 0) {
            int i2 = 0;
            while (true) {
                afp afpVar2 = this.d;
                if (afpVar2 == null) {
                    bbi.a();
                }
                cjVar.b(i2, afpVar2.b(i2).toString());
                if (i2 == i) {
                    break;
                } else {
                    i2++;
                }
            }
        }
        this.b = new b(this, cjVar);
        RankingLeftLinearLayoutManger rankingLeftLinearLayoutManger = new RankingLeftLinearLayoutManger(this, 1, false);
        RecyclerView recyclerView = this.a;
        if (recyclerView == null) {
            bbi.a();
        }
        recyclerView.setLayoutManager(rankingLeftLinearLayoutManger);
        RecyclerView recyclerView2 = this.a;
        if (recyclerView2 == null) {
            bbi.a();
        }
        recyclerView2.setFocusable(false);
        RecyclerView recyclerView3 = this.a;
        if (recyclerView3 == null) {
            bbi.a();
        }
        recyclerView3.setHasFixedSize(true);
        RecyclerView recyclerView4 = this.a;
        if (recyclerView4 == null) {
            bbi.a();
        }
        recyclerView4.setAdapter(this.b);
    }

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

    @Override
    public void onActivityResult(int i, int i2, Intent intent) {
        if (i2 == -1) {
            Fragment d = this.d.d(this.b.f());
            getContentResolver().takePersistableUriPermission(intent.getData(), 1);
            if (d instanceof afm3) {
                ((afm3) d).updateFilterPath(intent.getData().toString());
            }
        }
        super.onActivityResult(i, i2, intent);
    }

    @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 || valueOf2 == null || valueOf2.intValue() == 19 || valueOf2.intValue() == 20) {
                return super.dispatchKeyEvent(keyEvent);
            }
            if (valueOf2.intValue() == 21) {
                Fragment d = this.d.d(this.b.f());
                if ((d instanceof afn) && ((afn) d).b()) {
                    return false;
                }
                if ((d instanceof afo) && ((afo) d).b()) {
                    return false;
                }
                if (currentFocus instanceof DrawFrameLayout) {
                    int childCount = this.a.getChildCount() - 1;
                    if (childCount >= 0) {
                        int i = 0;
                        while (true) {
                            View childAt = this.a.getChildAt(i);
                            bbi.a((Object) childAt, "childView");
                            if (childAt.isSelected()) {
                                childAt.requestFocus();
                            }
                            if (i == childCount) {
                                break;
                            }
                            i++;
                        }
                    }
                    this.b.b(false);
                }
            } else if (valueOf2.intValue() == 22) {
                Fragment d2 = this.d.d(this.b.f());
                if (d2 == null) {
                    return true;
                }
                if (d2 instanceof adw) {
                    if (!((adw) d2).c()) {
                        return true;
                    }
                    this.b.b(true);
                    if (currentFocus instanceof SideLeftSelectLinearLayout) {
                        ((SideLeftSelectLinearLayout) currentFocus).c();
                    }
                    if (d2 instanceof afq) {
                        ((afq) d2).a();
                    }
                    if (d2 instanceof afk) {
                        ((afk) d2).a();
                    }
                    if (d2 instanceof afn) {
                        return ((afn) d2).a();
                    }
                    if (d2 instanceof afo) {
                        return ((afo) d2).a();
                    }
                    if (d2 instanceof afm3) {
                        return ((afm3) d2).a();
                    }
                    if (d2 instanceof afm4) {
                        return ((afm4) d2).a();
                    }
                    return true;
                }
            }
        }
        return super.dispatchKeyEvent(keyEvent);
    }

    public final class b extends adz<RecyclerView.v> {
        private int a;
        private final WeakReference<SettingActivity> b;
        private cj<String> c;
        private boolean d;
        private int e;

        static int access$008(b bVar) {
            int i = bVar.e;
            bVar.e = i + 1;
            return i;
        }

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

        public b(SettingActivity settingActivity, cj<String> cjVar) {
            bbi.b(settingActivity, "activity");
            bbi.b(cjVar, "countInfo");
            this.b = new WeakReference<>(settingActivity);
            this.c = cjVar;
        }

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

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

        @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, final int i) {
            bbi.b(vVar, "holder");
            if (vVar instanceof agf) {
                if (this.c != null) {
                    TextView textView = ((agf) vVar).n;
                    bbi.a((Object) textView, "holder.tvTitle");
                    cj<String> cjVar = this.c;
                    textView.setText(cjVar != null ? cjVar.a(i) : null);
                }
                View view = vVar.a;
                bbi.a((Object) view, "holder.itemView");
                view.setOnFocusChangeListener(new a(vVar));
                vVar.a.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public final void onClick(View view2) {
                        if (i == 4) {
                            bbi.a((Object) view2, "v");
                            Context context = view2.getContext();
                            bbi.a((Object) context, "v.context");
                            final Activity a2 = adl.a(context);
                            b.access$008(b.this);
                            if (a2 != null && b.this.e > 7) {
                                agb.a aVar = new agb.a(a2);
                                aVar.a(1).a("Deep♂Dark♂Fantasy").a(true).b(a2.getString(2131492985), new agb.b() {
                                    @Override
                                    public final void a(agb agbVar, View view3) {
                                        abd.a((Context) a2, true);
                                        agbVar.dismiss();
                                    }
                                }).a(a2.getString(2131492982), new agb.b() {
                                    @Override
                                    public final void a(agb agbVar, View view3) {
                                        abd.a((Context) a2, false);
                                        agbVar.dismiss();
                                    }
                                });
                                aVar.a().show();
                            }
                        }
                    }
                });
            }
        }

        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) {
                SettingActivity settingActivity = (SettingActivity) b.this.b.get();
                if (!z) {
                    if (!b.this.d) {
                        View view2 = this.b.a;
                        bbi.a((Object) view2, "holder.itemView");
                        view2.setSelected(false);
                        return;
                    }
                    return;
                }
                if (settingActivity != null && !settingActivity.isFinishing() && settingActivity.d != null && settingActivity.getSupportFragmentManager() != null) {
                    int f = this.b.f();
                    afp afpVar = settingActivity.d;
                    if (afpVar == null) {
                        bbi.a();
                    }
                    afpVar.c(f);
                    b.this.e(f);
                    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();
                    settingActivity.b(4);
                }
            }
        }

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

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

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

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

        public final String a() {
            return SettingActivity.e;
        }

        public final int b() {
            return 1;
        }

        public final void a(Context context, int i) {
            bbi.b(context, au.aD);
            Intent intent = new Intent(context, (Class<?>) SettingActivity.class);
            intent.putExtra(a(), i);
            context.startActivity(intent);
        }
    }
}