酷狗概念版 v2.5.5版本的 MD5 值为:782d327088fca4e58310f35a56f41319
以下内容为反编译后的 DiscoveryMainFragment.java 源代码,内容仅作参考
package com.kugou.android.netmusic.discovery.ui;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.kugou.android.app.NavigationUtils;
import com.kugou.android.app.fanxing.spv.KanMVFragment;
import com.kugou.android.app.flexowebview.KGFelxoWebFragment;
import com.kugou.android.common.delegate.DelegateFragment;
import com.kugou.android.common.delegate.SwipeDelegate;
import com.kugou.android.common.delegate.q;
import com.kugou.android.common.delegate.s;
import com.kugou.android.lite.R;
import com.kugou.android.mymusic.playlist.n;
import com.kugou.android.netmusic.bills.singer.main.ui.DiscoverySingerFragment;
import com.kugou.android.netmusic.discovery.d.d;
import com.kugou.android.netmusic.discovery.flow.ui.DiscoveryFlowFragment;
import com.kugou.android.netmusic.discovery.ui.DiscoverySubFragmentBase;
import com.kugou.android.netmusic.discovery.video.UgcVideoListFragment;
import com.kugou.android.netmusic.search.SingerClassificationFragment;
import com.kugou.common.apm.sdk.f;
import com.kugou.common.base.e.c;
import com.kugou.common.base.g;
import com.kugou.common.userCenter.protocol.j;
import com.kugou.common.utils.as;
import com.kugou.common.utils.cj;
import com.kugou.framework.service.util.BackgroundServiceUtil;
import com.kugou.framework.statistics.easytrace.task.GrayExposeTask$GrayExposeR;
import com.kugou.ktv.android.common.j.i;
@com.kugou.common.base.uiframe.a(b = GrayExposeTask$GrayExposeR.CYueKuFrag)
@c(a = 927009262)
public class DiscoveryMainFragment extends DelegateFragment implements q.a, DiscoverySubFragmentBase.a {
private boolean f36040c;
private boolean f;
private boolean h;
private long i;
private int f36038a = -1;
private int f36039b = -1;
private int[] f36041d = {R.string.a0v, R.string.a0y, R.string.a0w, R.string.a11, R.string.a0z, R.string.a10};
private final String[] f36042e = {"kg_discovery_nav_flow", "kg_discovery_nav_rec", "kg_discovery_nav_mv", "kg_discovery_nav_top", "kg_discovery_nav_singer", "kg_discovery_nav_tag"};
private DelegateFragment[] l = new DelegateFragment[6];
private boolean j = false;
private boolean[] g = {true, true, true, true, true, true};
@Override
public DelegateFragment a() {
return this;
}
@Override
public void b_(int i) {
}
@Override
public void c(int i) {
}
@Override
public int getThisPage() {
return 40;
}
@Override
public boolean onLayerChange() {
return false;
}
@Override
public int getSubPage() {
return this.f36039b;
}
public static void a(DelegateFragment delegateFragment, int i) {
Bundle bundle = new Bundle();
bundle.putInt("key_discovery_main_start_tab", i);
delegateFragment.startFragment(DiscoveryMainFragment.class, bundle);
}
public static void a(DelegateFragment delegateFragment) {
delegateFragment.startFragment(DiscoveryMainFragment.class, null);
}
@Override
public void onCreate(Bundle bundle) {
this.f36038a = getArguments().getInt("key_discovery_main_start_tab", 1);
int i = this.f36038a;
if (i < 0 || i > 5) {
this.f36038a = 1;
}
if (this.f36038a == 1 && !this.j) {
f.b().a("41006");
this.j = true;
}
super.onCreate(bundle);
}
@Override
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
return layoutInflater.inflate(R.layout.yg, viewGroup, false);
}
@Override
public void onViewCreated(View view, Bundle bundle) {
super.onViewCreated(view, bundle);
if (as.f54365e) {
a_("重要:酷狗乐库,请告知开发跳转路径");
}
}
@Override
public void onActivityCreated(Bundle bundle) {
super.onActivityCreated(bundle);
this.f36040c = getArguments().getBoolean("isFromMyFav", false);
enableTitleDelegate();
enableDownFeeSongFinishDelegate();
enableSwipeDelegate(this);
getTitleDelegate().a(new s.l() {
@Override
public void a(View view) {
if (DiscoveryMainFragment.this.f36039b == 2) {
NavigationUtils.startSearchFragment(DiscoveryMainFragment.this, "/乐库/搜索", 2);
} else {
NavigationUtils.startSearchFragment(DiscoveryMainFragment.this, "/乐库/搜索");
}
}
});
initDelegates();
b();
getTitleDelegate().r(R.drawable.e2);
a(bundle, this.f36038a);
d(this.f36038a);
if (this.f36038a != 0) {
getSwipeDelegate().b(this.f36038a, false);
}
getTitleDelegate().a((CharSequence) aN_().getString(R.string.a1b));
getTitleDelegate().a(new s.o() {
@Override
public void b_(View view) {
if (DiscoveryMainFragment.this.l[DiscoveryMainFragment.this.f36039b] == null || !(DiscoveryMainFragment.this.l[DiscoveryMainFragment.this.f36039b] instanceof DiscoverySubFragmentBase)) {
return;
}
if (((DiscoverySubFragmentBase) DiscoveryMainFragment.this.l[DiscoveryMainFragment.this.f36039b]).c() != null) {
((DiscoverySubFragmentBase) DiscoveryMainFragment.this.l[DiscoveryMainFragment.this.f36039b]).c().setSelection(0);
} else {
((DiscoverySubFragmentBase) DiscoveryMainFragment.this.l[DiscoveryMainFragment.this.f36039b]).i();
}
}
});
com.kugou.common.business.unicom.b.a.a(aN_()).a();
new d() {
@Override
public void a(j.c cVar) {
DiscoveryMainFragment.this.f = true;
if (DiscoveryMainFragment.this.f36039b == 2) {
if (DiscoveryMainFragment.this.d()) {
DiscoveryMainFragment.this.getTitleDelegate().b((CharSequence) "我的视频");
} else {
DiscoveryMainFragment.this.getTitleDelegate().b((CharSequence) "入驻");
}
DiscoveryMainFragment.this.getTitleDelegate().n(true);
}
}
}.c();
}
@Override
public void onFragmentResume() {
super.onFragmentResume();
DelegateFragment delegateFragment = this.l[this.f36039b];
if (delegateFragment != null) {
delegateFragment.onFragmentResume();
if (delegateFragment instanceof DiscoverySubFragmentBase) {
((DiscoverySubFragmentBase) delegateFragment).l();
}
}
this.h = false;
this.i = System.currentTimeMillis();
}
@Override
public void onFragmentPause() {
int i = 0;
while (true) {
DelegateFragment[] delegateFragmentArr = this.l;
if (i >= delegateFragmentArr.length) {
break;
}
if (delegateFragmentArr[i] != null && delegateFragmentArr[i].isAlive()) {
this.l[i].onFragmentPause();
}
i++;
}
super.onFragmentPause();
if (this.h || this.i <= 0) {
return;
}
this.h = true;
com.kugou.framework.statistics.easytrace.task.d dVar = new com.kugou.framework.statistics.easytrace.task.d(com.kugou.framework.statistics.easytrace.a.acS);
double currentTimeMillis = (System.currentTimeMillis() - this.i) / 100;
Double.isNaN(currentTimeMillis);
BackgroundServiceUtil.trace(dVar.setIvarr2(String.valueOf(currentTimeMillis / 10.0d)));
this.i = 0L;
}
@Override
public void onResume() {
super.onResume();
if (getCurrentFragment() instanceof DiscoveryMainFragment) {
this.h = false;
this.i = System.currentTimeMillis();
}
}
@Override
public void onPause() {
super.onPause();
if (getCurrentFragment() instanceof DiscoveryMainFragment) {
long j = this.i;
if (j <= 0 || this.h || j <= 0) {
return;
}
this.h = true;
com.kugou.framework.statistics.easytrace.task.d dVar = new com.kugou.framework.statistics.easytrace.task.d(com.kugou.framework.statistics.easytrace.a.acS);
double currentTimeMillis = (System.currentTimeMillis() - this.i) / 100;
Double.isNaN(currentTimeMillis);
BackgroundServiceUtil.trace(dVar.setIvarr2(String.valueOf(currentTimeMillis / 10.0d)));
this.i = 0L;
}
}
@Override
public void onFragmentStop() {
super.onFragmentStop();
}
@Override
public void onFragmentRestart() {
super.onFragmentRestart();
}
private void a(Bundle bundle, int i) {
getSwipeDelegate().f(this.f36041d.length);
SwipeDelegate.a aVar = new SwipeDelegate.a();
aVar.a(f(bundle), getString(this.f36041d[0]), this.f36042e[0]);
aVar.a(b(bundle), getString(this.f36041d[1]), this.f36042e[1]);
aVar.a(a(bundle), getString(this.f36041d[2]), this.f36042e[2]);
aVar.a(c(bundle), getString(this.f36041d[3]), this.f36042e[3]);
aVar.a(d(bundle), getString(this.f36041d[4]), this.f36042e[4]);
aVar.a(e(bundle), getString(this.f36041d[5]), this.f36042e[5]);
getSwipeDelegate().c(true);
getSwipeDelegate().a(aVar, i);
}
private DelegateFragment f(Bundle bundle) {
if (bundle != null) {
this.l[0] = (DiscoverySubFragmentBase) getChildFragmentManager().findFragmentByTag(this.f36042e[0]);
}
DelegateFragment[] delegateFragmentArr = this.l;
if (delegateFragmentArr[0] == null) {
delegateFragmentArr[0] = new DiscoveryFlowFragment();
this.l[0].setArguments(getArguments());
}
return this.l[0];
}
private DelegateFragment b(Bundle bundle) {
if (bundle != null) {
this.l[1] = (DiscoverySubFragmentBase) getChildFragmentManager().findFragmentByTag(this.f36042e[1]);
}
DelegateFragment[] delegateFragmentArr = this.l;
if (delegateFragmentArr[1] == null) {
delegateFragmentArr[1] = new DiscoveryRecFragment();
this.l[1].setArguments(getArguments());
}
return this.l[1];
}
private DelegateFragment a(Bundle bundle) {
if (bundle != null) {
this.l[2] = (KanMVFragment) getChildFragmentManager().findFragmentByTag(this.f36042e[2]);
}
DelegateFragment[] delegateFragmentArr = this.l;
if (delegateFragmentArr[2] == null) {
delegateFragmentArr[2] = new KanMVFragment();
Bundle bundle2 = new Bundle();
bundle2.putAll(getArguments());
bundle2.putBoolean("is_frome_yueku", true);
bundle2.putBoolean("is_from_yueku_tab", true);
bundle2.putString(DelegateFragment.KEY_CUSTOM_IDENTIFIER, "视频");
this.l[2].setArguments(bundle2);
}
return this.l[2];
}
private DelegateFragment c(Bundle bundle) {
if (bundle != null) {
this.l[3] = (DiscoverySubFragmentBase) getChildFragmentManager().findFragmentByTag(this.f36042e[3]);
}
DelegateFragment[] delegateFragmentArr = this.l;
if (delegateFragmentArr[3] == null) {
delegateFragmentArr[3] = new DiscoveryRankFragment();
this.l[3].setArguments(getArguments());
}
return this.l[3];
}
private DelegateFragment d(Bundle bundle) {
boolean z;
if (bundle != null) {
this.l[4] = (DiscoverySubFragmentBase) getChildFragmentManager().findFragmentByTag(this.f36042e[4]);
}
DelegateFragment[] delegateFragmentArr = this.l;
if (delegateFragmentArr[4] == null) {
delegateFragmentArr[4] = new DiscoverySingerFragment();
this.l[4].setArguments(getArguments());
this.l[4].getArguments().putString(DelegateFragment.KEY_CUSTOM_IDENTIFIER, "歌手");
}
DelegateFragment[] delegateFragmentArr2 = this.l;
if ((delegateFragmentArr2[4] instanceof DiscoverySingerFragment) && (z = this.f36040c)) {
((DiscoverySingerFragment) delegateFragmentArr2[4]).b(z);
}
return this.l[4];
}
private DelegateFragment e(Bundle bundle) {
if (bundle != null) {
this.l[5] = (DiscoverySubFragmentBase) getChildFragmentManager().findFragmentByTag(this.f36042e[5]);
}
DelegateFragment[] delegateFragmentArr = this.l;
if (delegateFragmentArr[5] == null) {
delegateFragmentArr[5] = new DiscoveryTagFragment();
this.l[5].setArguments(getArguments());
}
return this.l[5];
}
public void b(int i) {
if (i != this.f36039b) {
getSwipeDelegate().b(i, true);
}
}
private void d(int i) {
if (i < 0 || i >= this.l.length) {
if (as.f54365e) {
as.d("BLUE", "DiscoveryMainFragment switching to a unknown tab");
return;
}
return;
}
if (i == this.f36039b) {
return;
}
f(i);
e(i);
this.f36039b = i;
for (DelegateFragment delegateFragment : this.l) {
if (delegateFragment != null && (delegateFragment instanceof DiscoverySubFragmentBase)) {
((DiscoverySubFragmentBase) delegateFragment).i_(i);
}
}
DelegateFragment[] delegateFragmentArr = this.l;
DiscoveryFlowFragment discoveryFlowFragment = (DiscoveryFlowFragment) delegateFragmentArr[0];
DiscoveryRecFragment discoveryRecFragment = (DiscoveryRecFragment) delegateFragmentArr[1];
KanMVFragment kanMVFragment = (KanMVFragment) delegateFragmentArr[2];
if (i == 0) {
if (discoveryFlowFragment != null) {
discoveryFlowFragment.n();
}
if (discoveryRecFragment != null) {
discoveryRecFragment.n();
}
} else if (i == 1) {
if (discoveryRecFragment != null) {
discoveryRecFragment.m();
}
if (discoveryFlowFragment != null) {
discoveryFlowFragment.o();
}
} else {
if (discoveryRecFragment != null) {
discoveryRecFragment.n();
}
if (discoveryFlowFragment != null) {
discoveryFlowFragment.o();
}
}
if (kanMVFragment != null) {
kanMVFragment.a(i);
}
}
private void f(int i) {
if (i == 0) {
getTitleDelegate().b("入驻");
getTitleDelegate().n(true);
return;
}
if (i == 4) {
getTitleDelegate().b("全部歌手");
getTitleDelegate().n(true);
return;
}
if (i == 5) {
getTitleDelegate().b("投稿");
getTitleDelegate().n(true);
} else {
if (i == 2) {
if (this.f && com.kugou.common.environment.a.u()) {
if (d()) {
getTitleDelegate().b("我的视频");
} else {
getTitleDelegate().b("入驻");
}
} else {
getTitleDelegate().b("入驻");
}
getTitleDelegate().n(true);
return;
}
getTitleDelegate().n(false);
}
}
public boolean d() {
j.c cVar = d.f34379e.get(Long.valueOf(com.kugou.common.environment.a.Y()));
if (cVar == null) {
return false;
}
if (cVar.h == 3 || cVar.h == 1) {
return com.kugou.common.environment.a.u();
}
return false;
}
private void b() {
getTitleDelegate().b("入驻");
getTitleDelegate().n(true);
TextView l = getTitleDelegate().l();
l.setTextSize(11.0f);
l.setBackgroundResource(R.drawable.rf);
ViewGroup.LayoutParams layoutParams = l.getLayoutParams();
int b2 = cj.b(aN_(), 8.0f);
layoutParams.width = -2;
layoutParams.height = cj.b(aN_(), 22.0f);
l.setLayoutParams(layoutParams);
l.setMinWidth(cj.b(aN_(), 45.0f));
l.setPadding(b2, 0, b2, 0);
getTitleDelegate().a(new s.d() {
@Override
public void a(View view) {
if (DiscoveryMainFragment.this.f36039b != 0) {
if (DiscoveryMainFragment.this.f36039b != 4) {
if (DiscoveryMainFragment.this.f36039b == 5) {
DiscoveryMainFragment.this.c();
return;
}
if (DiscoveryMainFragment.this.f36039b == 2) {
if (DiscoveryMainFragment.this.d()) {
Bundle bundle = new Bundle();
bundle.putLong("userid", com.kugou.common.environment.a.Y());
DiscoveryMainFragment.this.startFragment(UgcVideoListFragment.class, bundle);
return;
} else {
Bundle bundle2 = new Bundle();
bundle2.putString("web_url", "https://mtpls.kugou.com/topic/5cad9513dea80b413512f72d.html");
g.a((Class<? extends Fragment>) KGFelxoWebFragment.class, bundle2);
com.kugou.common.statistics.e.a.a(com.kugou.android.netmusic.discovery.flow.h.a.gV);
return;
}
}
return;
}
Bundle bundle3 = new Bundle();
DiscoveryMainFragment.this.getArguments().putString(DelegateFragment.KEY_CUSTOM_IDENTIFIER, "歌手");
DiscoveryMainFragment.this.startFragment(SingerClassificationFragment.class, bundle3);
com.kugou.common.statistics.e.a.a(com.kugou.framework.statistics.easytrace.a.YJ);
return;
}
Bundle bundle4 = new Bundle();
bundle4.putString("web_url", "http://m.kugou.com/webapp/kg/apply.html");
g.a((Class<? extends Fragment>) KGFelxoWebFragment.class, bundle4);
com.kugou.common.statistics.e.a.a(com.kugou.android.netmusic.discovery.flow.h.a.gV);
}
});
}
public void c() {
if (com.kugou.android.netmusic.musicstore.c.a(aN_())) {
Bundle bundle = new Bundle();
bundle.putString("web_url", "https://mlist.kugou.com/intro.html");
bundle.putBoolean("felxo_fragment_has_playing_bar", true);
bundle.putBoolean("felxo_fragment_has_menu", false);
bundle.putBoolean("felxo_fragment_has_title_menu", false);
bundle.putString("web_title", getString(R.string.a1a));
startFragment(KGFelxoWebFragment.class, bundle);
BackgroundServiceUtil.trace(new n(com.kugou.framework.statistics.easytrace.a.Xq));
}
}
@Override
public void onSkinColorChanged() {
super.onSkinColorChanged();
}
private void e(int i) {
com.kugou.common.statistics.song.a aVar = com.kugou.framework.statistics.easytrace.a.ba;
String str = null;
switch (i) {
case 0:
aVar = com.kugou.android.netmusic.discovery.flow.h.a.hj;
str = "酷狗号";
break;
case 1:
aVar = com.kugou.framework.statistics.easytrace.a.ba;
str = "推荐";
break;
case 2:
aVar = com.kugou.framework.statistics.easytrace.c.da;
str = "视频";
break;
case 3:
aVar = com.kugou.framework.statistics.easytrace.a.bb;
str = "排行";
break;
case 4:
aVar = com.kugou.framework.statistics.easytrace.a.bc;
str = "歌手";
break;
case 5:
aVar = com.kugou.framework.statistics.easytrace.a.YM;
str = "分类";
break;
case 6:
aVar = com.kugou.framework.statistics.easytrace.a.bw;
break;
}
com.kugou.framework.statistics.easytrace.task.d dVar = new com.kugou.framework.statistics.easytrace.task.d(aN_(), aVar);
if (!TextUtils.isEmpty(str)) {
dVar.setFo("/乐库/" + str);
}
BackgroundServiceUtil.trace(dVar);
if (this.g[i] && i != 0 && i != 1 && i != 2 && i != 3 && i != 4 && i == 5) {
BackgroundServiceUtil.trace(new com.kugou.framework.statistics.easytrace.task.d(aN_(), com.kugou.framework.statistics.easytrace.a.bx));
}
this.g[i] = false;
}
@Override
public void onDestroy() {
super.onDestroy();
}
@Override
public void d_(int i) {
if (i == 1 && !this.j) {
f.b().a("41006");
this.j = true;
}
int i2 = this.f36039b;
if (i != i2) {
DelegateFragment[] delegateFragmentArr = this.l;
if (delegateFragmentArr[i2] instanceof DiscoverySubFragmentBase) {
((DiscoverySubFragmentBase) delegateFragmentArr[i2]).k();
}
}
d(i);
}
@Override
public void a(int i, float f, int i2) {
if (i == 0) {
DelegateFragment[] delegateFragmentArr = this.l;
if (delegateFragmentArr[0] == null || !(delegateFragmentArr[this.f36039b] instanceof DiscoverySubFragmentBase)) {
return;
}
((DiscoverySubFragmentBase) delegateFragmentArr[0]).a(i, f, i2);
}
}
@Override
public void onNewBundle(Bundle bundle) {
super.onNewBundle(bundle);
if (bundle != null) {
int i = bundle.getInt("key_discovery_main_start_tab", -1);
long j = bundle.getLong("jump_singer_id", -1L);
if (i != 4 || j <= 0) {
return;
}
if (getSwipeDelegate() != null) {
i.a(new Runnable() {
@Override
public void run() {
DiscoveryMainFragment.this.getSwipeDelegate().b(4, false);
}
}, 500L);
}
DelegateFragment[] delegateFragmentArr = this.l;
if (delegateFragmentArr[4] != null) {
delegateFragmentArr[4].onNewBundle(bundle);
}
}
}
@Override
public boolean onKeyDown(int i, KeyEvent keyEvent) {
DelegateFragment[] delegateFragmentArr = this.l;
int i2 = this.f36039b;
if (delegateFragmentArr[i2] != null) {
return delegateFragmentArr[i2].onKeyDown(i, keyEvent);
}
return super.onKeyDown(i, keyEvent);
}
@Override
public void onSkinAllChanged() {
super.onSkinAllChanged();
for (DelegateFragment delegateFragment : this.l) {
if (delegateFragment != null && delegateFragment.isAlive() && (delegateFragment instanceof DiscoverySubFragmentBase)) {
((DiscoverySubFragmentBase) delegateFragment).j();
} else if (delegateFragment != null && delegateFragment.isAlive() && (delegateFragment instanceof KanMVFragment)) {
((KanMVFragment) delegateFragment).p();
}
}
}
}