APKPure.apk分析 / SecondCommentHeadViewAdapter.java
package com.apkpure.aegon.cms.adapter;
import android.app.Activity;
import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.apkpure.aegon.R;
import com.apkpure.aegon.application.AegonApplication;
import com.apkpure.aegon.application.RealApplicationLike;
import com.apkpure.aegon.download.HollowDownloadButton;
import com.apkpure.aegon.statistics.datong.element.DTStatInfo;
import com.apkpure.aegon.widgets.app_icon.AppIconView;
import com.apkpure.aegon.widgets.textview.ExpressionTextView;
import com.apkpure.proto.nano.AppDetailInfoProtos;
import com.apkpure.proto.nano.AssetInfoProtos;
import com.apkpure.proto.nano.CmsResponseProtos;
import com.apkpure.proto.nano.ComemntImageProtos;
import com.apkpure.proto.nano.CommentInfoProtos;
import com.apkpure.proto.nano.ImageInfoProtos;
import com.apkpure.proto.nano.ShareUrlInfoProtos;
import com.apkpure.proto.nano.TubeInfoProtos;
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.makeramen.roundedimageview.RoundedImageView;
import com.pierfrancescosoffritti.androidyoutubeplayer.core.player.views.YouTubePlayerView;
import e.f.a.e.c;
import e.g.a.b0.a;
import e.g.a.i.a0.b1;
import e.g.a.i.a0.c1;
import e.g.a.i.a0.d1;
import e.g.a.i.a0.e1;
import e.g.a.i.a0.f1;
import e.g.a.i.a0.g1;
import e.g.a.i.a0.h1;
import e.g.a.i.a0.t1;
import e.g.a.i.a0.u1;
import e.g.a.i0.a0;
import e.g.a.i0.a1;
import e.g.a.i0.h0;
import e.g.a.i0.n0;
import e.g.a.l.o;
import e.g.a.n0.d;
import e.g.a.s.f;
import e.g.a.t.b.h;
import e.h.a.q.g;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
public class SecondCommentHeadViewAdapter extends BaseMultiItemQuickAdapter<a, BaseViewHolder> {
/* renamed from: a reason: collision with root package name */
public CommentInfoProtos.CommentInfo f1435a;
public d b;
public Activity c;
public HashSet<Integer> d = new HashSet<>();
/* renamed from: e reason: collision with root package name */
public e.g.a.i.d0.a f1436e;
/* renamed from: f reason: collision with root package name */
public CmsResponseProtos.CmsItemList f1437f;
/* renamed from: g reason: collision with root package name */
public String f1438g;
public SecondCommentHeadViewAdapter(List<a> list, Activity activity) {
super(list);
this.c = activity;
addItemType(-1, R.layout.arg_RES_2131493292);
addItemType(1, R.layout.arg_RES_2131493290);
addItemType(2, R.layout.arg_RES_2131493293);
addItemType(3, R.layout.arg_RES_2131493291);
addItemType(4, R.layout.arg_RES_2131493287);
addItemType(5, R.layout.arg_RES_2131493288);
addItemType(6, R.layout.arg_RES_2131493289);
}
@Override // com.chad.library.adapter.base.BaseQuickAdapter
public void convert(BaseViewHolder baseViewHolder, Object obj) {
FrameLayout.LayoutParams layoutParams;
ImageInfoProtos.ImageInfo imageInfo;
String str;
ImageInfoProtos.ImageInfo imageInfo2;
a aVar = (a) obj;
switch (aVar.c) {
case -1:
((TextView) baseViewHolder.getView(R.id.arg_RES_2131298796)).setOnClickListener(new f1(this));
return;
case 0:
default:
return;
case 1:
int i2 = 8;
ComemntImageProtos.CommentImage commentImage = aVar.b.image;
if (commentImage != null) {
View view = baseViewHolder.itemView;
view.setVisibility(0);
FrameLayout frameLayout = (FrameLayout) baseViewHolder.getView(R.id.arg_RES_2131297431);
ImageView imageView = (ImageView) baseViewHolder.getView(R.id.arg_RES_2131297429);
TextView textView = (TextView) baseViewHolder.getView(R.id.arg_RES_2131297296);
boolean q2 = e.g.a.i0.f1.q(commentImage.original.url);
if (q2) {
i2 = 0;
}
textView.setVisibility(i2);
if (q2) {
LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(-2, -2);
ImageInfoProtos.ImageInfo imageInfo3 = commentImage.original;
if (!(imageInfo3.height == 0 || imageInfo3.width == 0)) {
long b2 = (long) a1.b(this.c);
ImageInfoProtos.ImageInfo imageInfo4 = commentImage.original;
int i3 = (int) ((b2 * imageInfo4.height) / imageInfo4.width);
if (((long) (a1.b(this.c) - 32)) > commentImage.original.width * 2) {
ImageInfoProtos.ImageInfo imageInfo5 = commentImage.original;
layoutParams = new FrameLayout.LayoutParams((int) (imageInfo5.width * 2), ((int) imageInfo5.height) * 2);
} else {
layoutParams = new FrameLayout.LayoutParams(a1.b(this.c) - 32, i3);
}
imageView.setAdjustViewBounds(false);
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
layoutParams2.gravity = 17;
frameLayout.setLayoutParams(layoutParams2);
imageView.setLayoutParams(layoutParams);
}
} else {
LinearLayout.LayoutParams layoutParams3 = new LinearLayout.LayoutParams(-1, -2);
FrameLayout.LayoutParams layoutParams4 = new FrameLayout.LayoutParams(-1, -2);
imageView.setAdjustViewBounds(true);
frameLayout.setLayoutParams(layoutParams3);
imageView.setLayoutParams(layoutParams4);
}
boolean o2 = e.g.a.i0.f1.o(commentImage.original.url);
c.Y(this.mContext, (o2 ? commentImage.original : commentImage.thumbnail).url, imageView, c.L(e.g.a.s.l.a.K(this.mContext)));
imageView.setOnClickListener(new g1(this, o2, aVar, view, baseViewHolder, commentImage, imageView));
return;
}
return;
case 2:
TubeInfoProtos.TubeInfo tubeInfo = aVar.b.tube;
if (tubeInfo != null) {
View view2 = baseViewHolder.itemView;
FrameLayout frameLayout2 = (FrameLayout) baseViewHolder.getView(R.id.arg_RES_2131298324);
FrameLayout frameLayout3 = (FrameLayout) baseViewHolder.getView(R.id.arg_RES_2131296660);
ImageView imageView2 = (ImageView) baseViewHolder.getView(R.id.arg_RES_2131296661);
int i4 = AegonApplication.f1165e;
c.Y(RealApplicationLike.getContext(), "https://static-sg.winudf.com/wupload/xy/aprojectadmin/r4qBCniy.webp", (ImageView) baseViewHolder.getView(R.id.arg_RES_2131298914), new g());
YouTubePlayerView l2 = l();
imageView2.getLayoutParams().height = c.G(this.mContext);
l2.getLayoutParams().height = c.G(this.mContext);
l2.setVisibility(8);
frameLayout2.addView(l(), frameLayout2.getChildCount());
((TextView) baseViewHolder.getView(R.id.arg_RES_2131298912)).setText(a0.g(Integer.parseInt(tubeInfo.lengthSeconds)));
ComemntImageProtos.CommentImage commentImage2 = tubeInfo.imageInfo;
if (!(commentImage2 == null || (imageInfo = commentImage2.original) == null || (str = imageInfo.url) == null)) {
Context context = this.mContext;
e.d.a.a.a.u0(context, 2, context, str, imageView2);
}
view2.setOnClickListener(new b1(this, aVar, frameLayout2));
return;
}
return;
case 3:
String str2 = aVar.b.msg;
if (TextUtils.isEmpty(str2)) {
return;
}
if (!TextUtils.isEmpty(str2)) {
baseViewHolder.itemView.setVisibility(0);
((ExpressionTextView) baseViewHolder.getView(R.id.arg_RES_2131297442)).setHtmlText(str2);
return;
}
baseViewHolder.itemView.setVisibility(8);
return;
case 4:
AppDetailInfoProtos.AppDetailInfo appDetailInfo = aVar.b.apk;
if (appDetailInfo != null) {
View view3 = baseViewHolder.itemView;
view3.setVisibility(0);
ImageView imageView3 = (ImageView) baseViewHolder.getView(R.id.arg_RES_2131297223);
TextView textView2 = (TextView) baseViewHolder.getView(R.id.arg_RES_2131296599);
HollowDownloadButton hollowDownloadButton = (HollowDownloadButton) baseViewHolder.getView(R.id.arg_RES_2131297453);
((AppIconView) baseViewHolder.getView(R.id.arg_RES_2131297401)).i(appDetailInfo, true);
((TextView) baseViewHolder.getView(R.id.arg_RES_2131297541)).setText(appDetailInfo.label);
((TextView) baseViewHolder.getView(R.id.arg_RES_2131298901)).setText(String.format(this.mContext.getString(R.string.arg_RES_2131821925), appDetailInfo.versionName));
((TextView) baseViewHolder.getView(R.id.arg_RES_2131297098)).setText(String.format(this.mContext.getString(R.string.arg_RES_2131821923), Long.valueOf(appDetailInfo.downloadCount)));
if (!appDetailInfo.isOfficial || appDetailInfo.officialOpenConfig == null) {
imageView3.setVisibility(8);
} else {
imageView3.setVisibility(0);
}
imageView3.setOnClickListener(new c1(this, appDetailInfo));
AssetInfoProtos.AssetInfo assetInfo = appDetailInfo.asset;
if (assetInfo == null) {
textView2.setText("");
hollowDownloadButton.setEnabled(false);
} else {
textView2.setText(h0.g(assetInfo.size, "%.1f"));
hollowDownloadButton.setEnabled(true);
e.g.a.h0.b.o.a aVar2 = null;
hollowDownloadButton.n(this.mContext, o.f.SECOND_COMMENT, appDetailInfo, null);
Context context2 = this.mContext;
if (context2 instanceof h) {
aVar2 = ((h) context2).a();
}
DTStatInfo dTStatInfo = new DTStatInfo(aVar2);
dTStatInfo.position = String.valueOf(baseViewHolder.getAdapterPosition());
hollowDownloadButton.setDtStatInfo(dTStatInfo);
}
view3.setOnClickListener(new e.g.a.i.a0.a1(this, appDetailInfo));
return;
}
return;
case 5:
AppDetailInfoProtos.AppDetailInfo appDetailInfo2 = aVar.b.app;
if (appDetailInfo2 != null) {
baseViewHolder.itemView.setVisibility(0);
LinearLayout linearLayout = (LinearLayout) baseViewHolder.getView(R.id.arg_RES_2131298174);
TextView textView3 = (TextView) baseViewHolder.getView(R.id.arg_RES_2131298171);
((AppIconView) baseViewHolder.getView(R.id.arg_RES_2131297401)).i(appDetailInfo2, true);
((TextView) baseViewHolder.getView(R.id.arg_RES_2131297540)).setText(appDetailInfo2.label);
((Button) baseViewHolder.getView(R.id.arg_RES_2131297038)).setOnClickListener(new d1(baseViewHolder));
baseViewHolder.itemView.setOnClickListener(new e1(this, appDetailInfo2));
if (appDetailInfo2.isShowCommentScore) {
linearLayout.setVisibility(0);
textView3.setText(String.format(e.g.a.z.d.c(), "%.1f", Double.valueOf(appDetailInfo2.commentScore)));
return;
}
linearLayout.setVisibility(4);
return;
}
return;
case 6:
ShareUrlInfoProtos.ShareUrlInfo shareUrlInfo = aVar.b.shareUrl;
if (shareUrlInfo != null) {
View view4 = baseViewHolder.itemView;
RoundedImageView roundedImageView = (RoundedImageView) baseViewHolder.getView(R.id.arg_RES_2131298439);
TextView textView4 = (TextView) baseViewHolder.getView(R.id.arg_RES_2131298444);
TextView textView5 = (TextView) baseViewHolder.getView(R.id.arg_RES_2131298437);
TextView textView6 = (TextView) baseViewHolder.getView(R.id.arg_RES_2131298442);
roundedImageView.getLayoutParams().height = (int) (((float) a1.a(this.mContext)) * 0.22f);
ComemntImageProtos.CommentImage commentImage3 = shareUrlInfo.image;
String str3 = (commentImage3 == null || (imageInfo2 = commentImage3.thumbnail) == null) ? null : imageInfo2.url;
String str4 = shareUrlInfo.url;
if (!TextUtils.isEmpty(str3)) {
roundedImageView.setVisibility(0);
Context context3 = this.mContext;
c.Y(context3, str3, roundedImageView, c.L(e.g.a.s.l.a.T0(context3, 2)));
} else {
roundedImageView.setVisibility(8);
}
if (!TextUtils.isEmpty(shareUrlInfo.title)) {
textView4.setText(shareUrlInfo.title);
textView4.setVisibility(0);
} else {
textView4.setVisibility(8);
}
if (TextUtils.isEmpty(shareUrlInfo.description) || !TextUtils.isEmpty(shareUrlInfo.title)) {
textView5.setVisibility(8);
} else {
textView5.setText(shareUrlInfo.description);
textView5.setVisibility(0);
}
if (!TextUtils.isEmpty(shareUrlInfo.siteName)) {
textView6.setText(shareUrlInfo.siteName);
textView6.setVisibility(0);
} else {
textView6.setVisibility(8);
}
view4.setOnClickListener(new h1(this, str4, shareUrlInfo));
return;
}
return;
}
}
public final void k(a aVar, View view) {
int i2;
YouTubePlayerView youTubePlayerView;
List<a> data = getData();
ArrayList arrayList = new ArrayList();
for (a aVar2 : data) {
int i3 = aVar2.c;
if (i3 == 1 || i3 == 2) {
arrayList.add(aVar2);
}
}
int i4 = 0;
while (true) {
if (i4 >= arrayList.size()) {
i2 = -1;
break;
}
a aVar3 = (a) arrayList.get(i4);
if (TextUtils.equals(aVar3.d, aVar.d) && aVar.c == aVar3.c && aVar.b == aVar3.b) {
i2 = i4;
break;
}
i4++;
}
if (i2 == -1) {
return;
}
if (((a) arrayList.get(i2)).c == 2) {
TubeInfoProtos.TubeInfo tubeInfo = ((a) arrayList.get(i2)).b.tube;
d dVar = this.b;
if (!(dVar == null || (youTubePlayerView = dVar.f6928a) == null)) {
youTubePlayerView.setVisibility(0);
d dVar2 = this.b;
dVar2.f6929e = view;
dVar2.f(true);
this.b.g(false);
youTubePlayerView.h(new t1(this, tubeInfo));
youTubePlayerView.c(new u1(this, youTubePlayerView));
if (this.f1435a != null) {
f.i(this.c, e.d.a.a.a.Q(new StringBuilder(), this.f1435a.id, ""), tubeInfo.playUrl, this.c.getString(R.string.arg_RES_2131820821), this.c.getString(R.string.arg_RES_2131821774));
return;
}
return;
}
return;
}
n0.e0(this.mContext, this.f1437f, this.f1436e, arrayList, null, i2);
}
public final YouTubePlayerView l() {
YouTubePlayerView youTubePlayerView = new YouTubePlayerView(this.c);
youTubePlayerView.setLayoutParams(new FrameLayout.LayoutParams(-1, -2));
youTubePlayerView.setVisibility(4);
youTubePlayerView.setBackgroundColor(R.color.arg_RES_2131099826);
youTubePlayerView.setVisibility(8);
return youTubePlayerView;
}
}