导航菜单

页面标题

页面副标题

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

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

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


package com.bilibili.tv.ui.favorite;

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.text.TextUtils;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import bl.adl;
import bl.adw;
import bl.adz;
import bl.aec;
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;

public final class FavoriteActivity extends BaseSideActivity implements wf {
    public static final a Companion = new a(null);
    private aec b;
    private b c;

    @Override
    public String a() {
        return "ott-platform.collection.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 2131361821;
    }

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

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

        public final void a(Context context) {
            Intent intent = new Intent(context, (Class<?>) FavoriteActivity.class);
            if (context != null) {
                context.startActivity(intent);
            }
        }
    }

    @Override
    public void a(Bundle bundle) {
        if (getIntent() != null) {
            b((RecyclerView) d(2131230955));
            ((TextView) d(2131230821)).setText(adl.e(2131493074));
            ok.a("tv_myfavourite_pageview", new String[0]);
            FragmentManager supportFragmentManager = getSupportFragmentManager();
            bbi.a((Object) supportFragmentManager, "supportFragmentManager");
            this.b = new aec(supportFragmentManager, 2131230865);
        }
    }

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

    @Override
    public void onDestroy() {
        if (this.b != null) {
            aec aecVar = this.b;
            if (aecVar == null) {
                bbi.a();
            }
            aecVar.b();
            this.b = (aec) null;
        }
        this.c = (b) null;
        super.onDestroy();
    }

    @Override
    public boolean dispatchKeyEvent(KeyEvent keyEvent) {
        if (this.c == null || this.b == 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.c;
                    if (bVar == null) {
                        bbi.a();
                    }
                    bVar.b(false);
                }
            } else if (valueOf2 != null && valueOf2.intValue() == 22) {
                Fragment h = h();
                if (h == null) {
                    return true;
                }
                if ((h instanceof adw) && !((adw) h).c()) {
                    return true;
                }
                if (currentFocus instanceof SideLeftSelectLinearLayout) {
                    ((SideLeftSelectLinearLayout) currentFocus).c();
                    b bVar2 = this.c;
                    if (bVar2 == null) {
                        bbi.a();
                    }
                    bVar2.b(true);
                }
            }
        }
        return super.dispatchKeyEvent(keyEvent);
    }

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

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

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

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

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

        @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, "viewHolder");
            if (vVar instanceof agf) {
                if (this.e != null) {
                    TextView textView = ((agf) vVar).n;
                    bbi.a((Object) textView, "viewHolder.tvTitle");
                    textView.setText(this.e.a(i));
                }
                View view = vVar.a;
                bbi.a((Object) view, "viewHolder.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) {
                FavoriteActivity favoriteActivity = (FavoriteActivity) b.this.a.get();
                if (!z) {
                    if (b.this.d) {
                        return;
                    }
                    View view2 = this.b.a;
                    bbi.a((Object) view2, "viewHolder.itemView");
                    view2.setSelected(false);
                    return;
                }
                if (favoriteActivity == null || favoriteActivity.isFinishing() || favoriteActivity.b == null || favoriteActivity.getSupportFragmentManager() == null) {
                    return;
                }
                int f = this.b.f();
                if (System.currentTimeMillis() - b.this.c < 500) {
                    view.removeCallbacks(b.this);
                }
                b.this.b = f;
                view.postDelayed(b.this, 500L);
                b.this.c = System.currentTimeMillis();
                View view3 = this.b.a;
                bbi.a((Object) view3, "viewHolder.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();
                favoriteActivity.b(4);
            }
        }

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

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

        @Override
        public void run() {
            aec aecVar;
            FavoriteActivity favoriteActivity = this.a.get();
            if (favoriteActivity == null || favoriteActivity.isFinishing() || favoriteActivity.b == null || favoriteActivity.getSupportFragmentManager() == null || (aecVar = favoriteActivity.b) == null) {
                return;
            }
            aecVar.c(this.b);
        }
    }
}