同城相亲 v1.1.1版本的 MD5 值为:007e8e047d75ee89cca348774925c94f
以下内容为反编译后的 TCVodPlayerFragment.java 源代码,内容仅作参考
package com.ysxsoft.goddess.videos.play;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import androidx.viewpager.widget.PagerAdapter;
import androidx.viewpager.widget.ViewPager;
import com.alipay.sdk.widget.j;
import com.bumptech.glide.Glide;
import com.flyco.tablayout.CommonTabLayout;
import com.github.like.LikeButton;
import com.github.like.OnLikeListener;
import com.lxj.xpopup.XPopup;
import com.tencent.rtmp.ITXVodPlayListener;
import com.tencent.rtmp.TXLog;
import com.tencent.rtmp.TXVodPlayConfig;
import com.tencent.rtmp.TXVodPlayer;
import com.tencent.rtmp.ui.TXCloudVideoView;
import com.umeng.socialize.common.SocializeConstants;
import com.ysxsoft.goddess.R;
import com.ysxsoft.goddess.api.ApiManager;
import com.ysxsoft.goddess.api.MyHttpCallback;
import com.ysxsoft.goddess.api.MyOkHttpUtils;
import com.ysxsoft.goddess.dialog.CwshzPopupView;
import com.ysxsoft.goddess.dialog.LiWuPopupView;
import com.ysxsoft.goddess.dialog.PingLunPopupView;
import com.ysxsoft.goddess.dialog.SharePopupView;
import com.ysxsoft.goddess.dialog.ShbPopupView;
import com.ysxsoft.goddess.fragment.BaseFragment;
import com.ysxsoft.goddess.ui.ChatMsgActivity;
import com.ysxsoft.goddess.ui.HqgsZcrActivity;
import com.ysxsoft.goddess.ui.UserHomeActivity;
import com.ysxsoft.goddess.ui.XqbmActivity;
import com.ysxsoft.goddess.utils.BitmapUtils;
import com.ysxsoft.goddess.utils.GetJsonDataUtil;
import com.ysxsoft.goddess.utils.LogUtils;
import com.ysxsoft.goddess.utils.TelephonyUtil;
import com.ysxsoft.goddess.utils.ToastUtils;
import com.ysxsoft.goddess.videos.play.TCVodPlayerFragment;
import de.hdodenhof.circleimageview.CircleImageView;
import fr.castorflex.android.verticalviewpager.VerticalViewPager;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class TCVodPlayerFragment extends BaseFragment implements ITXVodPlayListener, TelephonyUtil.OnTelephoneListener {
private static final String TAG = "TCVodPlayerActivity";
private CommonTabLayout commonTabLayout;
private ImageView mIvCover;
private MyPagerAdapter mPagerAdapter;
private View mRootView;
private TXCloudVideoView mTXCloudVideoView;
private TXVodPlayer mTXVodPlayer;
private VerticalViewPager mVerticalViewPager;
private View statusBar;
private SwipeRefreshLayout swipeRefreshLayout;
private TextView tvRqb;
private TextView tvTchdp;
public List<JSONObject> mTCLiveInfoList = new ArrayList();
private int mInitTCLiveInfoPosition = 0;
private int mCurrentPosition = 0;
private String province = "";
private String city = "";
@Override
public void onNetStatus(TXVodPlayer tXVodPlayer, Bundle bundle) {
}
public static TCVodPlayerFragment newInstance() {
TCVodPlayerFragment tCVodPlayerFragment = new TCVodPlayerFragment();
tCVodPlayerFragment.setArguments(new Bundle());
return tCVodPlayerFragment;
}
@Override
@Nullable
public View onCreateView(LayoutInflater layoutInflater, @Nullable ViewGroup viewGroup, @Nullable Bundle bundle) {
this.mRootView = layoutInflater.inflate(R.layout.tx_fragment_player, viewGroup);
return this.mRootView;
}
@Override
public void onActivityCreated(@Nullable Bundle bundle) {
super.onActivityCreated(bundle);
initViews();
initPlayerSDK();
TelephonyUtil.getInstance().setOnTelephoneListener(this);
TelephonyUtil.getInstance().initPhoneListener();
try {
Thread.sleep(500L);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
private void initViews() {
this.swipeRefreshLayout = (SwipeRefreshLayout) this.mRootView.findViewById(R.id.sr_swiperefresh);
this.swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
HashMap<String, String> hashMap = new HashMap<>();
hashMap.put(j.l, "1");
TCVodPlayerFragment.this.initData(hashMap);
}
});
this.mTXCloudVideoView = (TXCloudVideoView) this.mRootView.findViewById(R.id.player_cloud_view);
this.mVerticalViewPager = (VerticalViewPager) this.mRootView.findViewById(R.id.vertical_view_pager);
this.mVerticalViewPager.setOffscreenPageLimit(2);
this.mVerticalViewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrollStateChanged(int i) {
}
@Override
public void onPageScrolled(int i, float f, int i2) {
TXLog.d(TCVodPlayerFragment.TAG, "mVerticalViewPager, onPageScrolled position = " + i);
}
@Override
public void onPageSelected(int i) {
TXLog.d(TCVodPlayerFragment.TAG, "mVerticalViewPager, onPageSelected position = " + i);
TCVodPlayerFragment.this.mCurrentPosition = i;
TXLog.d(TCVodPlayerFragment.TAG, "滑动后,让之前的播放器暂停,mTXVodPlayer = " + TCVodPlayerFragment.this.mTXVodPlayer);
if (TCVodPlayerFragment.this.mTXVodPlayer != null) {
TCVodPlayerFragment.this.mTXVodPlayer.seek(0);
TCVodPlayerFragment.this.mTXVodPlayer.pause();
}
if (i == 0) {
TCVodPlayerFragment.this.swipeRefreshLayout.setEnabled(true);
} else {
TCVodPlayerFragment.this.swipeRefreshLayout.setEnabled(false);
}
if (i == TCVodPlayerFragment.this.mTCLiveInfoList.size() - 1) {
TCVodPlayerFragment.this.initData(new HashMap<>());
}
}
});
this.mVerticalViewPager.setPageTransformer(false, new ViewPager.PageTransformer() {
@Override
public void transformPage(View view, float f) {
TXLog.d(TCVodPlayerFragment.TAG, "mVerticalViewPager, transformPage pisition = " + f + " mCurrentPosition" + TCVodPlayerFragment.this.mCurrentPosition);
if (f != 0.0f) {
return;
}
ViewGroup viewGroup = (ViewGroup) view;
TCVodPlayerFragment.this.mIvCover = (ImageView) viewGroup.findViewById(R.id.player_iv_cover);
TCVodPlayerFragment.this.mTXCloudVideoView = (TXCloudVideoView) viewGroup.findViewById(R.id.player_cloud_view);
PlayerInfo findPlayerInfo = TCVodPlayerFragment.this.mPagerAdapter.findPlayerInfo(TCVodPlayerFragment.this.mCurrentPosition);
if (findPlayerInfo != null) {
findPlayerInfo.vodPlayer.resume();
TCVodPlayerFragment.this.mTXVodPlayer = findPlayerInfo.vodPlayer;
}
}
});
this.mPagerAdapter = new MyPagerAdapter();
this.mVerticalViewPager.setAdapter(this.mPagerAdapter);
}
public class MyPagerAdapter extends PagerAdapter {
ArrayList<PlayerInfo> playerInfoList = new ArrayList<>();
@Override
public boolean isViewFromObject(View view, Object obj) {
return view == obj;
}
MyPagerAdapter() {
}
protected PlayerInfo instantiatePlayerInfo(int i) {
LogUtils.d("instantiatePlayerInfo " + i);
PlayerInfo playerInfo = new PlayerInfo();
TXVodPlayer tXVodPlayer = new TXVodPlayer(TCVodPlayerFragment.this.getActivity());
tXVodPlayer.setRenderRotation(0);
tXVodPlayer.setRenderMode(1);
tXVodPlayer.setVodListener(TCVodPlayerFragment.this);
TXVodPlayConfig tXVodPlayConfig = new TXVodPlayConfig();
File externalFilesDir = TCVodPlayerFragment.this.getActivity().getExternalFilesDir(null);
if (externalFilesDir != null) {
tXVodPlayConfig.setCacheFolderPath(externalFilesDir.getAbsolutePath() + "/txcache");
}
tXVodPlayConfig.setMaxCacheItems(5);
tXVodPlayer.setConfig(tXVodPlayConfig);
tXVodPlayer.setAutoPlay(false);
try {
playerInfo.playURL = TCVodPlayerFragment.this.mTCLiveInfoList.get(i).getString("video");
} catch (JSONException e) {
e.printStackTrace();
}
playerInfo.vodPlayer = tXVodPlayer;
playerInfo.pos = i;
this.playerInfoList.add(playerInfo);
return playerInfo;
}
protected void destroyPlayerInfo(int i) {
while (true) {
PlayerInfo findPlayerInfo = findPlayerInfo(i);
if (findPlayerInfo == null) {
return;
}
findPlayerInfo.vodPlayer.stopPlay(true);
this.playerInfoList.remove(findPlayerInfo);
LogUtils.d("destroyPlayerInfo " + i);
}
}
public PlayerInfo findPlayerInfo(int i) {
for (int i2 = 0; i2 < this.playerInfoList.size(); i2++) {
PlayerInfo playerInfo = this.playerInfoList.get(i2);
if (playerInfo.pos == i) {
return playerInfo;
}
}
return null;
}
public PlayerInfo findPlayerInfo(TXVodPlayer tXVodPlayer) {
for (int i = 0; i < this.playerInfoList.size(); i++) {
PlayerInfo playerInfo = this.playerInfoList.get(i);
if (playerInfo.vodPlayer == tXVodPlayer) {
return playerInfo;
}
}
return null;
}
public void onDestroy() {
Iterator<PlayerInfo> it = this.playerInfoList.iterator();
while (it.hasNext()) {
it.next().vodPlayer.stopPlay(true);
}
this.playerInfoList.clear();
}
@Override
public int getCount() {
return TCVodPlayerFragment.this.mTCLiveInfoList.size();
}
@Override
public Object instantiateItem(ViewGroup viewGroup, int i) {
final String str;
final String str2;
final String str3 = "";
LogUtils.d("MyPagerAdapter instantiateItem, position = " + i);
final JSONObject jSONObject = TCVodPlayerFragment.this.mTCLiveInfoList.get(i);
View inflate = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.tx_view_player_content, (ViewGroup) null);
inflate.setId(i);
inflate.findViewById(R.id.tv_hqzcr).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
TCVodPlayerFragment.MyPagerAdapter.this.lambda$instantiateItem$0$TCVodPlayerFragment$MyPagerAdapter(view);
}
});
inflate.findViewById(R.id.iv_xqbm).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
TCVodPlayerFragment.MyPagerAdapter.this.lambda$instantiateItem$1$TCVodPlayerFragment$MyPagerAdapter(view);
}
});
inflate.findViewById(R.id.iv_share).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
TCVodPlayerFragment.MyPagerAdapter.this.lambda$instantiateItem$2$TCVodPlayerFragment$MyPagerAdapter(view);
}
});
try {
str = jSONObject.getString("content_type");
} catch (JSONException e) {
e.printStackTrace();
str = "";
}
try {
str2 = jSONObject.getString("lives_id");
} catch (JSONException e2) {
e2.printStackTrace();
str2 = "";
}
try {
str3 = jSONObject.getString("video_id");
} catch (JSONException e3) {
e3.printStackTrace();
}
inflate.findViewById(R.id.iv_pinglun).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
TCVodPlayerFragment.MyPagerAdapter.this.lambda$instantiateItem$3$TCVodPlayerFragment$MyPagerAdapter(str, str2, str3, view);
}
});
inflate.findViewById(R.id.iv_liwu).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
TCVodPlayerFragment.MyPagerAdapter.this.lambda$instantiateItem$4$TCVodPlayerFragment$MyPagerAdapter(str, str2, str3, view);
}
});
((LikeButton) inflate.findViewById(R.id.likeBtn)).setOnLikeListener(new OnLikeListener() {
@Override
public void liked(LikeButton likeButton) {
try {
TCVodPlayerFragment.this.videoStar(jSONObject.getString("video_id"), likeButton);
} catch (JSONException e4) {
e4.printStackTrace();
}
}
@Override
public void unLiked(LikeButton likeButton) {
try {
TCVodPlayerFragment.this.videoStar(jSONObject.getString("video_id"), likeButton);
} catch (JSONException e4) {
e4.printStackTrace();
}
}
});
final LikeButton likeButton = (LikeButton) inflate.findViewById(R.id.favBtn);
likeButton.setOnLikeListener(new OnLikeListener() {
@Override
public void liked(LikeButton likeButton2) {
try {
TCVodPlayerFragment.this.videoFav(jSONObject.getString(SocializeConstants.TENCENT_UID), likeButton);
} catch (JSONException e4) {
e4.printStackTrace();
}
}
@Override
public void unLiked(LikeButton likeButton2) {
try {
TCVodPlayerFragment.this.videoFav(jSONObject.getString(SocializeConstants.TENCENT_UID), likeButton);
} catch (JSONException e4) {
e4.printStackTrace();
}
}
});
ImageView imageView = (ImageView) inflate.findViewById(R.id.player_iv_cover);
if (TCVodPlayerFragment.this.mIvCover == null) {
imageView.setVisibility(8);
TCVodPlayerFragment.this.mIvCover = imageView;
}
try {
BitmapUtils.blurBgPic(TCVodPlayerFragment.this.getActivity(), imageView, jSONObject.getString("cover_image"), R.mipmap.icon_img);
} catch (JSONException e4) {
e4.printStackTrace();
}
CircleImageView circleImageView = (CircleImageView) inflate.findViewById(R.id.player_civ_avatar);
try {
Glide.with(TCVodPlayerFragment.this).load(jSONObject.getString("avatar")).into(circleImageView);
} catch (JSONException e5) {
e5.printStackTrace();
}
circleImageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Bundle bundle = new Bundle();
try {
bundle.putString(SocializeConstants.TENCENT_UID, jSONObject.getString(SocializeConstants.TENCENT_UID));
} catch (JSONException e6) {
e6.printStackTrace();
}
TCVodPlayerFragment.this.startActivity(UserHomeActivity.class, bundle);
}
});
TextView textView = (TextView) inflate.findViewById(R.id.tv_name);
try {
textView.setText("@" + jSONObject.getString("username"));
} catch (JSONException e6) {
e6.printStackTrace();
}
textView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Bundle bundle = new Bundle();
try {
bundle.putString(SocializeConstants.TENCENT_UID, jSONObject.getString(SocializeConstants.TENCENT_UID));
} catch (JSONException e7) {
e7.printStackTrace();
}
TCVodPlayerFragment.this.startActivity(ChatMsgActivity.class, bundle);
}
});
try {
((TextView) inflate.findViewById(R.id.tv_title)).setText(jSONObject.getString("title"));
} catch (JSONException e7) {
e7.printStackTrace();
}
ImageView imageView2 = (ImageView) inflate.findViewById(R.id.iv_video_play_btn);
TXCloudVideoView tXCloudVideoView = (TXCloudVideoView) inflate.findViewById(R.id.player_cloud_view);
PlayerInfo instantiatePlayerInfo = instantiatePlayerInfo(i);
try {
instantiatePlayerInfo.video_id = jSONObject.getString("video_id");
} catch (JSONException e8) {
e8.printStackTrace();
}
instantiatePlayerInfo.playerView = tXCloudVideoView;
instantiatePlayerInfo.vodPlayer.setPlayerView(tXCloudVideoView);
instantiatePlayerInfo.vodPlayer.startPlay(instantiatePlayerInfo.playURL);
try {
TCVodPlayerFragment.this.getVideoInfo(jSONObject.getString(SocializeConstants.TENCENT_UID), jSONObject.getString("video_id"), inflate);
} catch (JSONException e9) {
e9.printStackTrace();
}
viewGroup.addView(inflate);
return inflate;
}
public void lambda$instantiateItem$0$TCVodPlayerFragment$MyPagerAdapter(View view) {
TCVodPlayerFragment.this.startActivity(HqgsZcrActivity.class);
}
public void lambda$instantiateItem$1$TCVodPlayerFragment$MyPagerAdapter(View view) {
TCVodPlayerFragment.this.startActivity(XqbmActivity.class);
}
public void lambda$instantiateItem$2$TCVodPlayerFragment$MyPagerAdapter(View view) {
new XPopup.Builder(TCVodPlayerFragment.this.getActivity()).asCustom(new SharePopupView(TCVodPlayerFragment.this.getActivity()).setTitle("欢迎加入同城相亲相亲平台").setDescr("相亲找对象就上同城相亲APP,女神男神任你挑选,七大相亲专场让您快速脱单").setImgUrl("http://app.chinameinv.com.cn/assets/img/logo.jpg").setUrl("https://app.chinameinv.com.cn/app.html")).show();
}
public void lambda$instantiateItem$3$TCVodPlayerFragment$MyPagerAdapter(String str, String str2, String str3, View view) {
new XPopup.Builder(TCVodPlayerFragment.this.getActivity()).autoFocusEditText(false).asCustom(new PingLunPopupView(TCVodPlayerFragment.this.getActivity(), str, str2, str3)).show();
}
public void lambda$instantiateItem$4$TCVodPlayerFragment$MyPagerAdapter(String str, String str2, String str3, View view) {
new XPopup.Builder(TCVodPlayerFragment.this.getActivity()).autoFocusEditText(false).asCustom(new LiWuPopupView(TCVodPlayerFragment.this.getActivity(), str, str2, str3)).show();
}
@Override
public void destroyItem(ViewGroup viewGroup, int i, Object obj) {
LogUtils.d("MyPagerAdapter destroyItem, position = " + i);
destroyPlayerInfo(i);
viewGroup.removeView((View) obj);
}
}
private void initPlayerSDK() {
this.mVerticalViewPager.setCurrentItem(this.mInitTCLiveInfoPosition);
}
private void restartPlay() {
TXVodPlayer tXVodPlayer = this.mTXVodPlayer;
if (tXVodPlayer != null) {
tXVodPlayer.resume();
}
}
@Override
public void onResume() {
super.onResume();
}
public void onInitResume() {
TXCloudVideoView tXCloudVideoView = this.mTXCloudVideoView;
if (tXCloudVideoView != null) {
tXCloudVideoView.onResume();
}
TXVodPlayer tXVodPlayer = this.mTXVodPlayer;
if (tXVodPlayer != null) {
tXVodPlayer.resume();
}
}
@Override
public void onPause() {
super.onPause();
onInitPause();
}
public void onInitPause() {
TXCloudVideoView tXCloudVideoView = this.mTXCloudVideoView;
if (tXCloudVideoView != null) {
tXCloudVideoView.onPause();
}
TXVodPlayer tXVodPlayer = this.mTXVodPlayer;
if (tXVodPlayer != null) {
tXVodPlayer.pause();
}
}
@Override
public void onDestroy() {
super.onDestroy();
TXCloudVideoView tXCloudVideoView = this.mTXCloudVideoView;
if (tXCloudVideoView != null) {
tXCloudVideoView.onDestroy();
this.mTXCloudVideoView = null;
}
this.mPagerAdapter.onDestroy();
stopPlay(true);
this.mTXVodPlayer = null;
TelephonyUtil.getInstance().uninitPhoneListener();
}
protected void stopPlay(boolean z) {
TXVodPlayer tXVodPlayer = this.mTXVodPlayer;
if (tXVodPlayer != null) {
tXVodPlayer.stopPlay(z);
}
}
@Override
public void onPlayEvent(TXVodPlayer tXVodPlayer, int i, Bundle bundle) {
if (i == 2009) {
bundle.getInt("EVT_PARAM1");
bundle.getInt("EVT_PARAM2");
} else if (i == 2006) {
restartPlay();
} else if (i == 2003) {
PlayerInfo findPlayerInfo = this.mPagerAdapter.findPlayerInfo(tXVodPlayer);
if (findPlayerInfo != null) {
findPlayerInfo.isBegin = true;
}
if (this.mTXVodPlayer == tXVodPlayer) {
LogUtils.i("onPlayEvent, event I FRAME, player = " + tXVodPlayer);
this.mIvCover.setVisibility(8);
httpPlayLog(findPlayerInfo.video_id);
}
} else if (i == 2013) {
if (this.mTXVodPlayer == tXVodPlayer) {
LogUtils.i("onPlayEvent, event prepared, player = " + tXVodPlayer);
this.mTXVodPlayer.resume();
}
} else if (i == 2004) {
PlayerInfo findPlayerInfo2 = this.mPagerAdapter.findPlayerInfo(tXVodPlayer);
if (findPlayerInfo2 == null || !findPlayerInfo2.isBegin) {
return;
}
this.mIvCover.setVisibility(8);
LogUtils.d("onPlayEvent, event begin, cover remove");
} else if (i < 0) {
if (this.mTXVodPlayer == tXVodPlayer) {
LogUtils.i("onPlayEvent, event prepared, player = " + tXVodPlayer);
}
ToastUtils.showToast("event:" + i, 0);
}
}
private void httpPlayLog(String str) {
HashMap hashMap = new HashMap();
hashMap.put("video_id", str);
MyOkHttpUtils.post(ApiManager.VIDEO_LOG, hashMap).execute(new MyHttpCallback() {
@Override
public void onSuccess(JSONObject jSONObject) {
}
@Override
public void onError(String str2) {
LogUtils.e(str2);
}
});
}
@Override
public void onRinging() {
TXVodPlayer tXVodPlayer = this.mTXVodPlayer;
if (tXVodPlayer != null) {
tXVodPlayer.setMute(true);
}
}
@Override
public void onOffhook() {
TXVodPlayer tXVodPlayer = this.mTXVodPlayer;
if (tXVodPlayer != null) {
tXVodPlayer.setMute(true);
}
}
@Override
public void onIdle() {
TXVodPlayer tXVodPlayer = this.mTXVodPlayer;
if (tXVodPlayer != null) {
tXVodPlayer.setMute(false);
}
}
public void initData(HashMap<String, String> hashMap) {
hashMap.put("video_province", this.province);
hashMap.put("video_city", this.city);
LogUtils.e(hashMap.toString());
MyOkHttpUtils.post(ApiManager.VIDEO_LIST, hashMap).execute(new MyHttpCallback() {
@Override
public void onError(String str) {
TCVodPlayerFragment.this.swipeRefreshLayout.setRefreshing(false);
TCVodPlayerFragment.this.showToast(str);
}
@Override
public void onSuccess(JSONObject jSONObject) {
try {
if (jSONObject.getJSONObject("data").getInt("status") == 1) {
if (TCVodPlayerFragment.this.swipeRefreshLayout.isRefreshing()) {
TCVodPlayerFragment.this.mTCLiveInfoList.clear();
}
JSONArray jSONArray = jSONObject.getJSONObject("data").getJSONArray("videos");
for (int i = 0; i < jSONArray.length(); i++) {
TCVodPlayerFragment.this.mTCLiveInfoList.add(jSONArray.getJSONObject(i));
}
TCVodPlayerFragment.this.mPagerAdapter.notifyDataSetChanged();
if (TCVodPlayerFragment.this.swipeRefreshLayout.isRefreshing()) {
TCVodPlayerFragment.this.mPagerAdapter = new MyPagerAdapter();
TCVodPlayerFragment.this.mVerticalViewPager.setAdapter(TCVodPlayerFragment.this.mPagerAdapter);
}
} else {
TCVodPlayerFragment.this.showToast("暂无更多视频");
}
TCVodPlayerFragment.this.swipeRefreshLayout.setRefreshing(false);
} catch (JSONException e) {
e.printStackTrace();
}
}
});
}
public void videoStar(String str, final LikeButton likeButton) {
HashMap hashMap = new HashMap();
hashMap.put("video_id", str);
MyOkHttpUtils.post(ApiManager.VIDEO_STAR, hashMap).execute(new MyHttpCallback() {
@Override
public void onError(String str2) {
ToastUtils.showToast(str2, 0);
}
@Override
public void onSuccess(JSONObject jSONObject) {
try {
ToastUtils.showToast(jSONObject.getString("msg"), 0);
if (jSONObject.getJSONObject("data").getInt("liked") == 1) {
likeButton.setLiked(true);
} else {
likeButton.setLiked(false);
}
} catch (JSONException e) {
e.printStackTrace();
}
}
});
}
public void videoFav(String str, final LikeButton likeButton) {
HashMap hashMap = new HashMap();
hashMap.put(SocializeConstants.TENCENT_UID, str);
MyOkHttpUtils.post(ApiManager.VIDEO_FAV, hashMap).execute(new MyHttpCallback() {
@Override
public void onError(String str2) {
ToastUtils.showToast(str2, 0);
}
@Override
public void onSuccess(JSONObject jSONObject) {
try {
ToastUtils.showToast(jSONObject.getString("msg"), 0);
if (jSONObject.getJSONObject("data").getInt("is_favorite") == 1) {
likeButton.setLiked(true);
} else {
likeButton.setLiked(false);
}
} catch (JSONException e) {
e.printStackTrace();
}
}
});
}
public void getVideoInfo(String str, String str2, View view) {
CircleImageView circleImageView = (CircleImageView) view.findViewById(R.id.civ_shb1);
CircleImageView circleImageView2 = (CircleImageView) view.findViewById(R.id.civ_shb2);
CircleImageView circleImageView3 = (CircleImageView) view.findViewById(R.id.civ_shb3);
CircleImageView circleImageView4 = (CircleImageView) view.findViewById(R.id.civ_shb4);
CircleImageView circleImageView5 = (CircleImageView) view.findViewById(R.id.civ_shb5);
TextView textView = (TextView) view.findViewById(R.id.tv_bofangliang);
TextView textView2 = (TextView) view.findViewById(R.id.tv_scl);
TextView textView3 = (TextView) view.findViewById(R.id.tv_shb);
LikeButton likeButton = (LikeButton) view.findViewById(R.id.likeBtn);
LikeButton likeButton2 = (LikeButton) view.findViewById(R.id.favBtn);
ImageView imageView = (ImageView) view.findViewById(R.id.iv_gz);
HashMap hashMap = new HashMap();
hashMap.put("video_id", str2);
MyOkHttpUtils.post(ApiManager.VIDEO_INFO, hashMap).execute(new AnonymousClass8(imageView, likeButton, likeButton2, textView, textView2, textView3, str, circleImageView, circleImageView2, circleImageView3, circleImageView4, circleImageView5));
}
public class AnonymousClass8 extends MyHttpCallback {
final CircleImageView val$civShb1;
final CircleImageView val$civShb2;
final CircleImageView val$civShb3;
final CircleImageView val$civShb4;
final CircleImageView val$civShb5;
final LikeButton val$favButton;
final ImageView val$ivGz;
final LikeButton val$likeButton;
final TextView val$tvBfl;
final TextView val$tvScl;
final TextView val$tvShb;
final String val$user_id;
AnonymousClass8(ImageView imageView, LikeButton likeButton, LikeButton likeButton2, TextView textView, TextView textView2, TextView textView3, String str, CircleImageView circleImageView, CircleImageView circleImageView2, CircleImageView circleImageView3, CircleImageView circleImageView4, CircleImageView circleImageView5) {
this.val$ivGz = imageView;
this.val$likeButton = likeButton;
this.val$favButton = likeButton2;
this.val$tvBfl = textView;
this.val$tvScl = textView2;
this.val$tvShb = textView3;
this.val$user_id = str;
this.val$civShb1 = circleImageView;
this.val$civShb2 = circleImageView2;
this.val$civShb3 = circleImageView3;
this.val$civShb4 = circleImageView4;
this.val$civShb5 = circleImageView5;
}
@Override
public void onError(String str) {
LogUtils.e(str);
}
@Override
public void onSuccess(JSONObject jSONObject) {
try {
ArrayList arrayList = new ArrayList();
JSONObject jSONObject2 = jSONObject.getJSONObject("data");
final JSONArray jSONArray = jSONObject2.getJSONArray("guardian");
int i = jSONObject2.getInt("followed");
int i2 = jSONObject2.getInt("liked");
int i3 = jSONObject2.getInt("collected");
if (i == 1) {
this.val$ivGz.setVisibility(8);
} else {
this.val$ivGz.setVisibility(0);
}
this.val$likeButton.setLiked(Boolean.valueOf(i2 == 1));
this.val$favButton.setLiked(Boolean.valueOf(i3 == 1));
this.val$tvBfl.setText(jSONObject2.getString("views"));
this.val$tvScl.setText(jSONObject2.getString("user_vip"));
if (!TextUtils.isEmpty(jSONObject2.getString("user_vip"))) {
this.val$tvScl.setVisibility(0);
} else {
this.val$tvScl.setVisibility(8);
}
TextView textView = this.val$tvShb;
final String str = this.val$user_id;
textView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
TCVodPlayerFragment.AnonymousClass8.this.lambda$onSuccess$0$TCVodPlayerFragment$8(jSONArray, str, view);
}
});
for (int i4 = 0; i4 < jSONArray.length(); i4++) {
arrayList.addAll(GetJsonDataUtil.getList(jSONArray.getJSONObject(i4).getJSONArray("user_list")));
}
for (int i5 = 0; i5 < arrayList.size(); i5++) {
if (i5 == 0) {
this.val$civShb1.setVisibility(0);
Glide.with(TCVodPlayerFragment.this.getActivity()).load(((JSONObject) arrayList.get(i5)).getString("avatar")).into(this.val$civShb1);
} else if (i5 == 1) {
this.val$civShb2.setVisibility(0);
Glide.with(TCVodPlayerFragment.this.getActivity()).load(((JSONObject) arrayList.get(i5)).getString("avatar")).into(this.val$civShb2);
} else if (i5 == 2) {
this.val$civShb3.setVisibility(0);
Glide.with(TCVodPlayerFragment.this.getActivity()).load(((JSONObject) arrayList.get(i5)).getString("avatar")).into(this.val$civShb3);
} else if (i5 == 3) {
this.val$civShb4.setVisibility(0);
Glide.with(TCVodPlayerFragment.this.getActivity()).load(((JSONObject) arrayList.get(i5)).getString("avatar")).into(this.val$civShb4);
} else if (i5 == 4) {
this.val$civShb5.setVisibility(0);
Glide.with(TCVodPlayerFragment.this.getActivity()).load(((JSONObject) arrayList.get(i5)).getString("avatar")).into(this.val$civShb5);
}
}
} catch (JSONException e) {
e.printStackTrace();
}
}
public void lambda$onSuccess$0$TCVodPlayerFragment$8(JSONArray jSONArray, final String str, View view) {
new XPopup.Builder(TCVodPlayerFragment.this.getActivity()).autoFocusEditText(false).asCustom(new ShbPopupView(TCVodPlayerFragment.this.getActivity(), jSONArray).setBtnClickListener(new ShbPopupView.BtnClickListener() {
@Override
public void result() {
new XPopup.Builder(TCVodPlayerFragment.this.getActivity()).autoFocusEditText(false).asCustom(new CwshzPopupView(TCVodPlayerFragment.this.getActivity(), str).setBtnClickListener(new CwshzPopupView.BtnClickListener() {
@Override
public void result() {
}
})).show();
}
})).show();
}
}
}