酷狗概念版 v2.5.5版本的 MD5 值为:782d327088fca4e58310f35a56f41319
以下内容为反编译后的 ChannelCreateFragment.java 源代码,内容仅作参考
package com.kugou.android.app.home.channel;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.GravityCompat;
import android.text.Editable;
import android.text.InputFilter;
import android.text.TextUtils;
import android.util.Pair;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import com.huawei.hms.push.constant.RemoteMessageConst;
import com.kugou.android.app.NavigationUtils;
import com.kugou.android.app.crossplatform.bean.Type;
import com.kugou.android.app.home.channel.clasify.create.ChannelClassifyFragment;
import com.kugou.android.app.home.channel.detailpage.ChannelDetailFragment;
import com.kugou.android.app.home.channel.protocol.SetPopupProtocol;
import com.kugou.android.app.home.channel.protocol.ac;
import com.kugou.android.app.home.channel.view.DynamicGridLayout;
import com.kugou.android.app.msgchat.image.send.c;
import com.kugou.android.common.delegate.DelegateFragment;
import com.kugou.android.common.delegate.s;
import com.kugou.android.lite.R;
import com.kugou.android.station.create.CreateStationFragment;
import com.kugou.android.station.main.event.CreateStationEvent;
import com.kugou.common.userinfo.entity.f;
import com.kugou.common.utils.as;
import com.kugou.common.utils.bc;
import com.kugou.common.utils.br;
import com.kugou.common.utils.bv;
import com.kugou.common.widget.KGTransButton;
import com.kugou.fanxing.core.a.utils.o;
import com.kugou.framework.database.channel.entity.ChannelEntity;
import com.kugou.framework.database.channel.entity.ChannelTagEntity;
import com.qq.e.comm.constants.ErrorCode;
import com.tencent.open.SocialConstants;
import de.greenrobot.event.EventBus;
import java.io.File;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONException;
import org.json.JSONObject;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;
@com.kugou.common.base.e.c(a = 663707719)
public class ChannelCreateFragment extends DelegateFragment {
private com.kugou.android.app.msgchat.image.send.c F;
private com.kugou.android.app.msgchat.image.send.c G;
private ChannelEntity f9723a;
private KGTransButton f9724b;
private EditText f9725c;
private EditText f9726d;
private TextView f9727e;
private DynamicGridLayout f;
private View g;
private View h;
private ImageView i;
private com.kugou.android.app.msgchat.image.b.c j;
private View k;
private View l;
private View m;
private View n;
private View o;
private TextView p;
private ImageView q;
private ImageView r;
private View s;
private ImageView t;
private com.kugou.android.app.msgchat.image.b.c u;
private String z;
private a v = a.CREATE;
private int w = 1;
private List<ChannelTagEntity> x = new ArrayList();
private int y = 0;
private int A = 1;
private int B = 2;
private boolean C = false;
private View.OnClickListener D = new View.OnClickListener() {
@Override
public void onClick(View view) {
ChannelCreateFragment.this.y = 1;
ChannelCreateFragment.this.i().a(1, 0, true);
}
};
private View.OnClickListener E = new View.OnClickListener() {
@Override
public void onClick(View view) {
ChannelCreateFragment.this.y = 2;
ChannelCreateFragment.this.j().a(1, 0, true);
}
};
@Override
public boolean canSlide() {
return false;
}
@Override
public boolean hasMenu() {
return false;
}
@Override
public boolean hasNavigationBar() {
return false;
}
@Override
public boolean hasPlayingBar() {
return false;
}
public enum a {
CREATE("创建频道", "创建频道成功", "创建频道失败", "确认退出频道创建吗?"),
EDIT("编辑频道", "编辑频道成功", "编辑频道失败", "确认退出频道编辑吗?");
private String f9763c;
private String f9764d;
private String f9765e;
private String f;
a(String str, String str2, String str3, String str4) {
this.f9763c = str;
this.f9764d = str2;
this.f9765e = str3;
this.f = str4;
}
}
@Override
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
return layoutInflater.inflate(R.layout.qz, viewGroup, false);
}
@Override
public void onViewCreated(View view, Bundle bundle) {
super.onViewCreated(view, bundle);
EventBus.getDefault().register(getClass().getClassLoader(), getClass().getName(), this);
this.f9723a = getArguments() != null ? (ChannelEntity) getArguments().getParcelable("channel_data") : null;
this.w = getArguments() != null ? getArguments().getInt("channel_source", this.w) : 1;
this.z = getArguments() != null ? getArguments().getString("trace_20143") : "";
this.v = this.f9723a == null ? a.CREATE : a.EDIT;
d();
a(view);
com.kugou.common.statistics.e.a.a(new com.kugou.common.statistics.easytrace.task.b(20131, "click").a("type", Integer.toString(this.w)).a(SocialConstants.PARAM_SOURCE, "0"));
boolean z = false;
if (getArguments() != null && getArguments().getBoolean("extra_show_channel_type_dialog_auto", false)) {
z = true;
}
if (z) {
g();
}
c();
}
private void c() {
SetPopupProtocol.f11493a.a(SetPopupProtocol.f11493a.a(), "1").b(Schedulers.io()).a(AndroidSchedulers.mainThread()).a(com.kugou.android.a.b.f3616a, com.kugou.android.a.b.f3617b);
}
private void d() {
enableTitleDelegate();
initDelegates();
getTitleDelegate().a((CharSequence) this.v.f9763c);
getTitleDelegate().a(new s.b() {
@Override
public void onBackClick(View view) {
ChannelCreateFragment.this.e();
}
});
}
@Override
public boolean onKeyDown(int i, KeyEvent keyEvent) {
if (i == 4) {
e();
return true;
}
return super.onKeyDown(i, keyEvent);
}
public void e() {
com.kugou.common.dialog8.popdialogs.b bVar = new com.kugou.common.dialog8.popdialogs.b(aN_());
bVar.setTitleVisible(false);
bVar.setMessage(this.v.f);
bVar.setButtonMode(2);
bVar.setNegativeHint("取消");
bVar.setPositiveHint("确认");
bVar.setOnDialogClickListener(new com.kugou.common.dialog8.e() {
@Override
public void onNegativeClick() {
}
@Override
public void onOptionClick(com.kugou.common.dialog8.i iVar) {
}
@Override
public void onPositiveClick() {
ChannelCreateFragment.this.finish();
}
});
bVar.show();
}
public void a(boolean z) {
this.f9724b.setmPressAlpha(0.1f);
if (z) {
this.f9724b.setDisableMode(false);
} else {
this.f9724b.setDisableMode(true);
}
}
private void a(View view) {
this.f9724b = (KGTransButton) view.findViewById(R.id.d18);
a(false);
this.f9724b.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view2) {
ChannelCreateFragment.this.k();
}
});
this.f9727e = (TextView) view.findViewById(R.id.c_w);
this.f9725c = (EditText) view.findViewById(R.id.dm4);
a((TextView) view.findViewById(R.id.dm2), (TextView) view.findViewById(R.id.dm3), this.f9725c, this.A);
this.f9726d = (EditText) view.findViewById(R.id.dm7);
a((TextView) view.findViewById(R.id.dm5), (TextView) view.findViewById(R.id.dm6), this.f9726d, this.B);
this.f = (DynamicGridLayout) view.findViewById(R.id.dme);
this.f.setLineSpace(br.a((Context) aN_(), 20.0f));
View findViewById = view.findViewById(R.id.dmf);
this.g = view.findViewById(R.id.dmg);
this.h = view.findViewById(R.id.dmh);
this.i = (ImageView) view.findViewById(R.id.dmi);
this.g.setOnClickListener(this.D);
this.h.setOnClickListener(this.D);
View findViewById2 = view.findViewById(R.id.dmj);
this.k = view.findViewById(R.id.dmk);
this.s = view.findViewById(R.id.dml);
this.t = (ImageView) view.findViewById(R.id.dmm);
this.k.setOnClickListener(this.E);
this.s.setOnClickListener(this.E);
this.l = view.findViewById(R.id.dm8);
this.m = view.findViewById(R.id.dm_);
this.n = view.findViewById(R.id.dma);
this.o = view.findViewById(R.id.dmc);
this.q = (ImageView) view.findViewById(R.id.dmb);
this.r = (ImageView) view.findViewById(R.id.dmd);
this.p = (TextView) view.findViewById(R.id.dm9);
findViewById.setVisibility(0);
if (this.v == a.CREATE) {
this.f9727e.setVisibility(0);
}
ChannelEntity channelEntity = this.f9723a;
if (channelEntity != null) {
this.f9725c.setText(channelEntity.f57741d);
this.f9726d.setText(this.f9723a.f);
this.j = new com.kugou.android.app.msgchat.image.b.c();
this.j.f = this.f9723a.j();
com.bumptech.glide.g.a(this).a(this.j.f).a((com.bumptech.glide.d<String>) new com.bumptech.glide.request.b.g<com.bumptech.glide.load.resource.a.b>() {
@Override
public void a(Object obj, com.bumptech.glide.request.a.c cVar) {
a((com.bumptech.glide.load.resource.a.b) obj, (com.bumptech.glide.request.a.c<? super com.bumptech.glide.load.resource.a.b>) cVar);
}
public void a(com.bumptech.glide.load.resource.a.b bVar, com.bumptech.glide.request.a.c<? super com.bumptech.glide.load.resource.a.b> cVar) {
ChannelCreateFragment.this.g.setVisibility(8);
ChannelCreateFragment.this.h.setVisibility(0);
ChannelCreateFragment.this.i.setImageDrawable(bVar);
ChannelCreateFragment channelCreateFragment = ChannelCreateFragment.this;
channelCreateFragment.a(channelCreateFragment.b());
}
});
if (this.v == a.EDIT) {
this.f9724b.setText("完成");
findViewById2.setVisibility(0);
this.u = new com.kugou.android.app.msgchat.image.b.c();
this.u.f = this.f9723a.n();
com.bumptech.glide.g.a(this).a(this.u.f).a((com.bumptech.glide.d<String>) new com.bumptech.glide.request.b.g<com.bumptech.glide.load.resource.a.b>() {
@Override
public void a(Object obj, com.bumptech.glide.request.a.c cVar) {
a((com.bumptech.glide.load.resource.a.b) obj, (com.bumptech.glide.request.a.c<? super com.bumptech.glide.load.resource.a.b>) cVar);
}
public void a(com.bumptech.glide.load.resource.a.b bVar, com.bumptech.glide.request.a.c<? super com.bumptech.glide.load.resource.a.b> cVar) {
ChannelCreateFragment.this.k.setVisibility(8);
ChannelCreateFragment.this.s.setVisibility(0);
ChannelCreateFragment.this.t.setImageDrawable(bVar);
ChannelCreateFragment channelCreateFragment = ChannelCreateFragment.this;
channelCreateFragment.a(channelCreateFragment.b());
}
});
a(this.f9723a.S == 1, this.f9723a.S == 2);
}
}
ChannelEntity channelEntity2 = this.f9723a;
a(channelEntity2 == null ? new ArrayList<>() : channelEntity2.h);
view.findViewById(R.id.dmn).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view2) {
if (com.kugou.fanxing.ums.util.a.a(ErrorCode.OtherError.CONTENT_FORCE_EXPOSURE)) {
return;
}
com.kugou.common.privacy.h.b(view2.getContext(), "酷狗概念版频道创建规则", "https://activity.kugou.com/text2html/v-0a7d7ba0/index.html");
com.kugou.common.statistics.e.a.a(new com.kugou.common.statistics.easytrace.task.b(20297, "click"));
}
});
this.o.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view2) {
ChannelCreateFragment.this.a(false, true);
}
});
this.n.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view2) {
ChannelCreateFragment.this.a(true, false);
}
});
f();
if (this.v == a.CREATE) {
a(true, false);
}
this.l.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view2) {
ChannelCreateFragment.this.g();
}
});
}
private void f() {
this.p.setText(com.kugou.common.config.c.a().b(com.kugou.android.app.a.a.EX, "频道类型下的解释文案"));
}
public void g() {
String b2 = com.kugou.common.config.c.a().b(com.kugou.android.app.a.a.EW, "频道类型~");
try {
if (TextUtils.isEmpty(b2)) {
JSONObject jSONObject = new JSONObject();
jSONObject.put("title", "什么是频道类型");
jSONObject.put(SocialConstants.PARAM_APP_DESC, "频道类型~");
jSONObject.put("button", "我知道了");
b2 = jSONObject.toString();
}
JSONObject jSONObject2 = new JSONObject(b2);
String optString = jSONObject2.optString("title");
String optString2 = jSONObject2.optString(SocialConstants.PARAM_APP_DESC);
String optString3 = jSONObject2.optString("button");
com.kugou.common.dialog8.popdialogs.b bVar = new com.kugou.common.dialog8.popdialogs.b(aN_());
bVar.setTitleVisible(true);
bVar.setTitle(optString);
bVar.b(14);
bVar.setMessage(optString2);
bVar.a(GravityCompat.START);
bVar.setButtonMode(1);
bVar.setPositiveHint(optString3);
bVar.show();
} catch (JSONException e2) {
e2.printStackTrace();
}
}
private void a(String str) {
com.kugou.common.dialog8.popdialogs.b bVar = new com.kugou.common.dialog8.popdialogs.b(aN_());
bVar.setTitleVisible(true);
bVar.setTitle("频道修改失败");
bVar.setMessage(str);
bVar.setButtonMode(1);
bVar.setPositiveHint("好的");
bVar.show();
}
public void a(boolean z, boolean z2) {
this.r.setVisibility(z2 ? 0 : 8);
this.q.setVisibility(z ? 0 : 8);
}
private void a(TextView textView, final TextView textView2, EditText editText, int i) {
final int a2 = a(editText);
editText.addTextChangedListener(new o.a() {
@Override
public void afterTextChanged(Editable editable) {
textView2.setText(String.format("%d/%d", Integer.valueOf(editable.length()), Integer.valueOf(a2)));
ChannelCreateFragment channelCreateFragment = ChannelCreateFragment.this;
channelCreateFragment.a(channelCreateFragment.b());
}
});
}
public int a(EditText editText) {
int i;
try {
i = 0;
for (InputFilter inputFilter : editText.getFilters()) {
try {
Class<?> cls = inputFilter.getClass();
if (cls.getName().equals("android.text.InputFilter$LengthFilter")) {
int i2 = i;
for (Field field : cls.getDeclaredFields()) {
try {
if (field.getName().equals("mMax")) {
field.setAccessible(true);
i2 = ((Integer) field.get(inputFilter)).intValue();
}
} catch (Exception e2) {
e = e2;
i = i2;
e.printStackTrace();
return i;
}
}
i = i2;
}
} catch (Exception e3) {
e = e3;
}
}
} catch (Exception e4) {
e = e4;
i = 0;
}
return i;
}
public void a(List<ChannelTagEntity> list) {
this.f.removeAllViews();
int a2 = br.a((Context) aN_(), 13.0f);
int a3 = br.a((Context) aN_(), 7.0f);
int a4 = br.a((Context) aN_(), 15.0f);
int a5 = br.a((Context) aN_(), 12.0f);
ArrayList<ChannelTagEntity> arrayList = new ArrayList(list);
this.x = new ArrayList(arrayList);
if (arrayList.size() < 2) {
arrayList.add(ChannelTagEntity.f57747e);
}
for (ChannelTagEntity channelTagEntity : arrayList) {
if ("fake_new".equals(channelTagEntity.g)) {
FrameLayout frameLayout = new FrameLayout(aN_());
DynamicGridLayout.LayoutParams layoutParams = new DynamicGridLayout.LayoutParams(br.c(60.0f), br.c(30.0f));
layoutParams.rightMargin = a4;
ImageView imageView = new ImageView(aN_());
FrameLayout.LayoutParams layoutParams2 = new FrameLayout.LayoutParams(br.c(13.0f), br.c(13.0f));
layoutParams2.gravity = 17;
imageView.setLayoutParams(layoutParams2);
imageView.setImageResource(R.drawable.bq3);
frameLayout.setBackground(com.kugou.common.skinpro.d.b.a().b("skin_search_bg", R.drawable.skin_search_bg));
frameLayout.addView(imageView);
frameLayout.setPadding(a2, a3, a2, a3);
frameLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ChannelCreateFragment.this.startFragment(ChannelClassifyFragment.class, ChannelClassifyFragment.f10569a.a((ArrayList) ChannelCreateFragment.this.x));
}
});
this.f.addView(frameLayout, layoutParams);
} else {
TextView textView = new TextView(aN_());
DynamicGridLayout.LayoutParams layoutParams3 = new DynamicGridLayout.LayoutParams(-2, -2);
layoutParams3.rightMargin = a4;
textView.setTextColor(-1);
textView.setText(channelTagEntity.h);
textView.setTextSize(0, a5);
textView.setTag(channelTagEntity);
textView.setPadding(a2, a3, a2, a3);
a(textView, h());
Drawable mutate = ContextCompat.getDrawable(aN_(), R.drawable.bq4).mutate();
mutate.setBounds(0, 0, mutate.getIntrinsicWidth(), mutate.getIntrinsicHeight());
textView.setCompoundDrawablePadding(br.c(6.0f));
textView.setCompoundDrawables(null, null, mutate, null);
textView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ChannelCreateFragment.this.x.remove((ChannelTagEntity) view.getTag());
ChannelCreateFragment channelCreateFragment = ChannelCreateFragment.this;
channelCreateFragment.a((List<ChannelTagEntity>) channelCreateFragment.x);
}
});
this.f.addView(textView, layoutParams3);
}
}
a(b());
}
private void a(View view, Drawable drawable) {
int paddingLeft = view.getPaddingLeft();
int paddingTop = view.getPaddingTop();
int paddingRight = view.getPaddingRight();
int paddingBottom = view.getPaddingBottom();
view.setBackgroundDrawable(drawable);
view.setPadding(paddingLeft, paddingTop, paddingRight, paddingBottom);
}
private Drawable h() {
GradientDrawable gradientDrawable = new GradientDrawable();
gradientDrawable.setCornerRadius(getResources().getDimensionPixelSize(R.dimen.hv));
gradientDrawable.setColor(com.kugou.common.skinpro.d.b.a().a(com.kugou.common.skinpro.shadowframe.c.COMMON_WIDGET));
return gradientDrawable;
}
public String a() {
StringBuilder sb = new StringBuilder();
for (ChannelTagEntity channelTagEntity : this.x) {
if (sb.length() != 0) {
sb.append(",");
}
sb.append(channelTagEntity.g);
}
return sb.toString();
}
public boolean b() {
return (TextUtils.isEmpty(this.f9725c.getText().toString().trim()) || TextUtils.isEmpty(this.f9726d.getText().toString().trim()) || this.x.isEmpty() || this.j == null || (this.q.getVisibility() != 0 && this.r.getVisibility() != 0)) ? false : true;
}
public com.kugou.android.app.msgchat.image.send.c i() {
if (this.F == null) {
this.F = new com.kugou.android.app.msgchat.image.send.c((DelegateFragment) this, com.kugou.android.netmusic.discovery.flow.zone.d.a.d(), false, true);
this.F.b(720, 1032);
this.F.a(new c.a() {
@Override
public void a(List<com.kugou.android.app.msgchat.image.b.c> list) {
ChannelCreateFragment.this.a(list.get(0));
}
@Override
public void a(com.kugou.android.app.msgchat.image.b.c cVar) {
ChannelCreateFragment.this.a(cVar);
}
});
}
return this.F;
}
public com.kugou.android.app.msgchat.image.send.c j() {
if (this.G == null) {
this.G = new com.kugou.android.app.msgchat.image.send.c((DelegateFragment) this, com.kugou.android.netmusic.discovery.flow.zone.d.a.d(), false, true);
this.G.b(720, 1032);
this.G.a(new c.a() {
@Override
public void a(List<com.kugou.android.app.msgchat.image.b.c> list) {
ChannelCreateFragment.this.b(list.get(0));
}
@Override
public void a(com.kugou.android.app.msgchat.image.b.c cVar) {
ChannelCreateFragment.this.b(cVar);
}
});
}
return this.G;
}
public void a(com.kugou.android.app.msgchat.image.b.c cVar) {
this.j = cVar;
this.g.setVisibility(8);
this.h.setVisibility(0);
com.bumptech.glide.g.a(this).a(new File(this.j.b())).j().a(this.i);
a(b());
}
public void b(com.kugou.android.app.msgchat.image.b.c cVar) {
this.u = cVar;
this.k.setVisibility(8);
this.s.setVisibility(0);
com.bumptech.glide.g.a(this).a(new File(this.u.b())).j().a(this.t);
a(b());
}
@Override
public void onNewBundle(Bundle bundle) {
super.onNewBundle(bundle);
if (bundle == null || !TextUtils.equals(bundle.getString(RemoteMessageConst.FROM), "cover_compose")) {
return;
}
com.kugou.android.app.msgchat.image.b.c cVar = new com.kugou.android.app.msgchat.image.b.c();
cVar.a(bundle.getString("data"));
this.j = cVar;
this.g.setVisibility(8);
this.h.setVisibility(0);
com.bumptech.glide.g.a(this).a(new File(this.j.b())).j().a(this.i);
a(b());
}
@Override
public void onActivityResult(int i, int i2, Intent intent) {
super.onActivityResult(i, i2, intent);
com.kugou.android.app.msgchat.image.send.c cVar = this.F;
if (cVar != null && this.y == 1) {
cVar.a(i, i2, intent);
}
com.kugou.android.app.msgchat.image.send.c cVar2 = this.G;
if (cVar2 == null || this.y != 2) {
return;
}
cVar2.a(i, i2, intent);
}
public void onEvent(com.kugou.android.app.home.channel.clasify.create.a aVar) {
a(aVar.a());
}
public void onEventMainThread(CreateStationEvent createStationEvent) {
Bundle bundle = new Bundle();
bundle.putParcelable("EXTRA_CHANNEL_DATA", createStationEvent.getF40775a());
bundle.putString("EXTRA_FO", "创建频道");
bundle.putInt("CHANNEL_DETAIL_SOURCE", 29);
com.kugou.common.q.b.a().b(createStationEvent.getF40775a().f57740c, (Boolean) true);
replaceFragment(ChannelDetailFragment.class, bundle);
}
@Override
public void onDestroy() {
super.onDestroy();
EventBus.getDefault().unregister(this);
if (this.C) {
return;
}
StringBuilder sb = new StringBuilder();
if (this.f9725c.getText().length() <= 0) {
sb.append("频道名/");
}
if (this.f9726d.getText().length() <= 0) {
sb.append("推荐语");
}
if (this.x.isEmpty()) {
sb.append("分类/");
}
if (this.j == null) {
sb.append("封面/");
}
if (TextUtils.isEmpty(sb)) {
sb.append("无");
}
com.kugou.common.statistics.e.a.a(new com.kugou.common.statistics.easytrace.task.b(4103, "click").a("type", this.v.f9763c).a("empty", sb.toString()));
}
public void k() {
if (bc.u(aN_()) && b()) {
this.C = true;
String obj = this.f9725c.getText().toString();
String obj2 = this.f9726d.getText().toString();
String a2 = a();
int i = this.q.getVisibility() != 0 ? 2 : 1;
com.kugou.common.statistics.e.a.a(new com.kugou.common.statistics.easytrace.task.b(20131, "click").a("type", Integer.toString(i)).a(SocialConstants.PARAM_SOURCE, "1"));
if (this.v.equals(a.CREATE)) {
a(obj, obj2, a2, i);
} else {
D_();
b(obj, obj2, a2, i);
}
}
}
private void a(final String str, final String str2, final String str3, final int i) {
NavigationUtils.a(getActivity(), f.a.f54243b, new Runnable() {
@Override
public void run() {
Bundle bundle = new Bundle();
bundle.putBoolean("from_create_channel", true);
bundle.putSerializable("need_create_channel_info_image", ChannelCreateFragment.this.j);
bundle.putString("need_create_channel_info_intro", str2);
bundle.putString("need_create_channel_info_name", str);
bundle.putString("need_create_channel_info_tags", str3);
bundle.putInt("channel_source", ChannelCreateFragment.this.w);
bundle.putInt("need_create_channel_info_type", i);
ChannelCreateFragment.this.startFragment(CreateStationFragment.class, bundle);
}
});
}
private void b(final String str, final String str2, final String str3, final int i) {
rx.e.b(com.kugou.android.app.home.channel.utils.e.a(this.j, "youthimg"), com.kugou.android.app.home.channel.utils.e.a(this.u, "youthimg"), new rx.b.f<String, String, String[]>() {
@Override
public String[] a(String str4, String str5) {
return new String[]{str4, str5};
}
}).c((rx.b.e) new rx.b.e<String[], rx.e<String>>() {
@Override
public rx.e<String> call(String[] strArr) {
return ac.a(ChannelCreateFragment.this.f9723a.f57740c, str, strArr[1], str3, str2, strArr[0], i);
}
}).b(Schedulers.newThread()).a(AndroidSchedulers.mainThread()).a((rx.b.b) new rx.b.b<String>() {
@Override
public void call(String str4) {
try {
as.f("lzq-log", str4);
JSONObject jSONObject = new JSONObject(str4);
int i2 = jSONObject.getInt("status");
int optInt = jSONObject.optInt("error_code");
String optString = jSONObject.optString("error_msg");
if (TextUtils.isEmpty(optString)) {
optString = "创建失败";
}
if (i2 != 1) {
ChannelCreateFragment.this.a(optInt, optString);
} else {
ChannelEntity c2 = com.kugou.android.app.home.channel.utils.b.c(jSONObject.optJSONObject("data"));
if (c2 == null) {
return;
}
Pair<Integer, String> f = c2.f();
com.kugou.common.statistics.e.a.a(new com.kugou.common.statistics.easytrace.task.b(20143, "statistics").a("pdid", c2.f57740c).a("id1", String.valueOf(f.first)).a("id2", (String) f.second).a("tab", ChannelCreateFragment.this.z).a(Type.state, i == 1 ? "1" : "2"));
ChannelCreateFragment.this.a(c2);
}
} catch (Exception e2) {
ChannelCreateFragment.this.a(0, e2.getMessage());
}
}
}, new rx.b.b<Throwable>() {
@Override
public void call(Throwable th) {
ChannelCreateFragment.this.a(0, th.getMessage());
}
});
}
public void a(ChannelEntity channelEntity) {
ao_();
bv.a((Context) aN_(), this.v.f9764d);
int i = AnonymousClass15.f9739a[this.v.ordinal()];
if (i == 1) {
EventBus.getDefault().post(new com.kugou.android.app.home.channel.event.j(channelEntity, 2));
Bundle bundle = new Bundle();
bundle.putParcelable("EXTRA_CHANNEL_DATA", channelEntity);
if (!TextUtils.isEmpty(channelEntity.G)) {
bundle.putBoolean("isEditMode", true);
}
bundle.putBoolean("from_create_channel", true);
bundle.putInt("channel_source", this.w);
replaceFragment(CreateStationFragment.class, bundle);
} else if (i == 2) {
EventBus.getDefault().post(new com.kugou.android.app.home.channel.event.j(channelEntity, 4));
finish();
}
com.kugou.common.statistics.e.a.a(new com.kugou.common.statistics.easytrace.task.b(4102, "click").a("type", this.v.f9763c).a(Type.state, "1"));
}
public static class AnonymousClass15 {
static final int[] f9739a = new int[a.values().length];
static {
try {
f9739a[a.CREATE.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
f9739a[a.EDIT.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
}
}
public void a(int i, String str) {
ao_();
if (i == 80021 || i == 80020) {
a(str);
if (this.v == a.EDIT) {
a(this.f9723a.S == 1, this.f9723a.S == 2);
return;
}
return;
}
as.f("lzq-young", "errorcode:" + i + " errormsg:" + str);
bv.a((Context) aN_(), str);
com.kugou.common.statistics.e.a.a(new com.kugou.common.statistics.easytrace.task.b(4102, "click").a("type", this.v.f9763c).a(Type.state, "0").a("ehc", String.valueOf(i)));
}
@Override
public void onSkinAllChanged() {
super.onSkinAllChanged();
if (getTitleDelegate().E() != null) {
getTitleDelegate().E().setBackgroundColor(com.kugou.common.skinpro.d.b.a().a(com.kugou.common.skinpro.shadowframe.c.TITLE));
}
l();
}
private void l() {
DynamicGridLayout dynamicGridLayout = this.f;
if (dynamicGridLayout == null) {
return;
}
int childCount = dynamicGridLayout.getChildCount();
for (int i = 0; i < childCount; i++) {
View childAt = this.f.getChildAt(i);
if (childAt instanceof TextView) {
a(childAt, h());
}
if (childAt instanceof FrameLayout) {
GradientDrawable gradientDrawable = new GradientDrawable();
gradientDrawable.setCornerRadius(getResources().getDimensionPixelSize(R.dimen.hv));
gradientDrawable.setColor(com.kugou.common.skinpro.g.b.a(com.kugou.common.skinpro.d.b.a().a(com.kugou.common.skinpro.shadowframe.c.PRIMARY_TEXT), 0.04f));
childAt.setBackground(gradientDrawable);
}
}
}
}