柬埔寨通 v6.1.5版本的 MD5 值为:9b68581ac30883219d6a25858a099d6b
以下内容为反编译后的 VideoDetailActivity.java 源代码,内容仅作参考
package net.duohuo.magappx.video;
import android.app.ActionBar;
import android.content.Intent;
import android.content.res.Configuration;
import android.media.AudioManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.SparseArray;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.SurfaceView;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.BounceInterpolator;
import android.widget.AbsListView;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ListAdapter;
import android.widget.SeekBar;
import android.widget.TextView;
import anet.channel.entity.ConnType;
import butterknife.BindView;
import butterknife.OnClick;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.aliyun.player.IPlayer;
import com.aliyun.player.aliyunplayer.theme.Theme;
import com.aliyun.player.aliyunplayer.util.AliyunScreenMode;
import com.aliyun.player.aliyunplayer.util.ScreenUtils;
import com.aliyun.player.aliyunplayer.view.tipsview.TipsView;
import com.aliyun.player.aliyunplayer.widget.AliyunVodPlayerView;
import com.aliyun.player.nativeclass.PlayerConfig;
import com.aliyun.player.source.UrlSource;
import com.jianpuzhaitong.forum.R;
import com.snail.antifake.deviceid.AndroidDeviceIMEIUtil;
import com.tencent.open.SocialConstants;
import com.uc.crashsdk.export.LogType;
import com.yhao.floatwindow.FloatWindow;
import com.yhao.floatwindow.IFloatWindow;
import com.yhao.floatwindow.PermissionListener;
import com.yhao.floatwindow.ViewStateListener;
import java.util.Iterator;
import java.util.Map;
import java.util.Objects;
import net.duohuo.core.ITongdunOperation;
import net.duohuo.core.adapter.DataPage;
import net.duohuo.core.annotation.Extra;
import net.duohuo.core.dialog.DialogCallBack;
import net.duohuo.core.dialog.IDialog;
import net.duohuo.core.eventbus.Event;
import net.duohuo.core.eventbus.EventBus;
import net.duohuo.core.eventbus.OnEventListener;
import net.duohuo.core.fresco.FrescoImageView;
import net.duohuo.core.ioc.Ioc;
import net.duohuo.core.net.Net;
import net.duohuo.core.net.Result;
import net.duohuo.core.net.Task;
import net.duohuo.core.util.IUtil;
import net.duohuo.core.util.SafeJsonUtil;
import net.duohuo.magappx.API;
import net.duohuo.magappx.BrowseRecords;
import net.duohuo.magappx.DataViewType;
import net.duohuo.magappx.MagBizWebView;
import net.duohuo.magappx.UrlScheme;
import net.duohuo.magappx.chat.util.OnClickUtil;
import net.duohuo.magappx.circle.show.dataview.LookAllCommentDataView;
import net.duohuo.magappx.circle.show.dataview.ShowCommentChoiceDataView;
import net.duohuo.magappx.circle.show.dataview.ShowHotCommentDataView;
import net.duohuo.magappx.collection.ContentCollectionActivity;
import net.duohuo.magappx.common.activity.CommentActivity;
import net.duohuo.magappx.common.activity.CommonCommentActivity;
import net.duohuo.magappx.common.adapter.IncludeEmptyAdapter;
import net.duohuo.magappx.common.base.MagBaseActivity;
import net.duohuo.magappx.common.comp.comment.CommentApplaudView;
import net.duohuo.magappx.common.comp.comment.CommentInfo;
import net.duohuo.magappx.common.comp.share.Collect;
import net.duohuo.magappx.common.comp.share.Share;
import net.duohuo.magappx.common.comp.share.SharePopWindow;
import net.duohuo.magappx.common.dataview.model.Comment;
import net.duohuo.magappx.common.net.NetParams;
import net.duohuo.magappx.common.util.CacheUtils;
import net.duohuo.magappx.common.util.Constants;
import net.duohuo.magappx.common.util.LoginHintUtil;
import net.duohuo.magappx.common.util.UrlUtils;
import net.duohuo.magappx.common.util.timerewad.AccumulationTimeRewardHelper;
import net.duohuo.magappx.common.view.LocalListView;
import net.duohuo.magappx.common.view.MagWebView;
import net.duohuo.magappx.common.view.RichContent;
import net.duohuo.magappx.live.LiveDetailActivity;
import net.duohuo.magappx.main.login.UserApi;
import net.duohuo.magappx.main.login.model.UserPreference;
import net.duohuo.magappx.video.dataview.VideoDetailTopDataView;
import net.duohuo.magappx.video.dataview.VideoRecommendDataView;
import net.duohuo.magappx.video.model.VideoDetailItem;
import net.duohuo.magappx.video.util.VideoPlayNumCount;
import net.duohuo.magappx.video.videoplay.VideoPlayActivity;
import net.duohuo.magappx.video.videorecord.ShotVideoActivity;
import net.duohuo.magappx.video.videorecord.VideoRecordActivity;
import net.duohuo.webview.CustomViewCallbackWrapper;
import net.duohuo.webview.FileChooserParamsWrapper;
import net.duohuo.webview.ValueCallbackWrapper;
public class VideoDetailActivity extends MagBaseActivity implements DataPage.OnLoadSuccessCallBack, AudioManager.OnAudioFocusChangeListener, MagBizWebView.WebViewEventCallback {
private static final int MSG_VIDEO_RECORD_CHECK = 10000;
private static final int REQUEST_OVERLAY = 5004;
IncludeEmptyAdapter adapter;
AliyunScreenMode aliyunScreenMode;
AliyunVodPlayerView aliyunVodPlayerView;
@BindView(R.id.blank_for_statue2)
View blankForStatue2V;
@BindView(R.id.blank_for_statue)
View blankForStatueV;
EventBus bus;
Collect collect;
CommentApplaudView commentApplaudView;
ShowCommentChoiceDataView commentChoiceDataView;
@Extra
String comment_id;
@Extra(def = "")
String contentId;
private int customPaddingRight;
private View customView;
private CustomViewCallbackWrapper customViewCallback;
@BindView(R.id.error_tip)
View errorTipV;
VideoDetailItem.Info infoData;
boolean isClickVip;
boolean isTrySee;
@Extra(def = "")
String jumpToComment;
@BindView(R.id.layout)
ViewGroup layoutV;
@BindView(R.id.listview)
LocalListView listview;
LookAllCommentDataView lookAllCommentDataView;
private AudioManager mAudioManager;
private boolean mPlayOnFocusGain;
VideoDetailItem model;
@BindView(R.id.navi_line)
View naviLineV;
NetParams netParams;
ViewGroup.LayoutParams params;
@Extra(def = "")
String pic;
ViewGroup placeholderV;
private boolean portrait;
UserPreference preference;
@BindView(R.id.purchase)
TextView purchaseV;
@BindView(R.id.seek_bar)
SeekBar seekBar;
ShowHotCommentDataView showHotCommentDataView;
SurfaceView surfaceView;
float threshold;
@BindView(R.id.try_see)
TextView trySeeV;
VideoDetailTopDataView videoDetailTopDataView;
@Extra(def = "")
String videoPath;
@BindView(R.id.video_pay_box)
ViewGroup videoPayBoxV;
VideoRecommendDataView videoRecommendDataView;
@BindView(R.id.videoView)
AliyunVodPlayerView videoView;
@BindView(R.id.videolayout)
ViewGroup videolayoutV;
@BindView(R.id.vip_bg)
FrescoImageView vipBgV;
@BindView(R.id.vip_box)
View vipBoxV;
@BindView(R.id.vip_opening)
TextView vipOpeningV;
@BindView(R.id.vip_play)
TextView vipPlayV;
@BindView(R.id.vip_toast_text)
TextView vipToastTextV;
int w;
@BindView(R.id.webView)
MagWebView webView;
CommentInfo commentInfo = new CommentInfo();
Share share = new Share();
private int page = 1;
private int mAudioFocus = -1;
int width = IUtil.getDisplayWidth();
int status = 0;
private String playStyle = "1";
String source = "";
int position = 0;
AccumulationTimeRewardHelper helper = new AccumulationTimeRewardHelper(Constants.TYPE_WATCH_VIDEO);
boolean started = false;
int floatView = 0;
String link = "";
boolean isApplaud = false;
int commentCount = 0;
int applaudCount = 0;
String albumName = "";
boolean is_live_auth = false;
String sec_pca = "";
boolean isPlay = false;
int type = 2;
boolean hasPlay = false;
UrlSource urlSource = new UrlSource();
boolean isFirst = true;
private boolean isAutoWatermark = true;
private Handler mHandler = new Handler(Looper.getMainLooper()) {
@Override
public void handleMessage(Message message) {
super.handleMessage(message);
if (message.what == 10000) {
Net.url(API.Video.videoScreenRecordCheck).showProgress(false).showToast(false).param("id", VideoDetailActivity.this.contentId).post(new Task<Result>() {
@Override
public void onResult(Result result) {
if (!VideoDetailActivity.this.isFinishing() && result.success()) {
if (VideoDetailActivity.this.videoView != null && UserApi.checkLogin()) {
if (SafeJsonUtil.getBoolean(result.getData(), "is_inscreen_record")) {
String string = SafeJsonUtil.getString(result.getData(), "video_watermark_txt");
if (VideoDetailActivity.this.isAutoWatermark && !TextUtils.isEmpty(string)) {
UserPreference userPreference = (UserPreference) Ioc.get(UserPreference.class);
VideoDetailActivity.this.videoView.startVideoWatermark(string.replace("{user_name}", userPreference.name).replace("{uid}", userPreference.userId + "").replace("{phone_number}", userPreference.phone));
}
} else {
VideoDetailActivity.this.videoView.removeVideoWatermark();
}
}
if (SafeJsonUtil.getInteger(result.getData(), "prevent_screen") == 1) {
VideoDetailActivity.this.getWindow().addFlags(8192);
}
if (SafeJsonUtil.getBoolean(result.getData(), "is_limit_tuorist") && !UserApi.checkLogin()) {
if (VideoDetailActivity.this.videoView != null) {
VideoDetailActivity.this.videoView.pause();
}
LoginHintUtil.showLoginHint(VideoDetailActivity.this);
}
if (SafeJsonUtil.getBoolean(result.getData(), "is_need_refresh") && VideoDetailActivity.this.infoData != null && VideoDetailActivity.this.infoData.isCan_view()) {
if (VideoDetailActivity.this.videoView != null) {
VideoDetailActivity.this.videoView.pause();
VideoDetailActivity.this.videoView.lockScreen(false);
if (VideoDetailActivity.this.videoView.getmCurrentScreenMode() == AliyunScreenMode.Full) {
if ("2".equals(VideoDetailActivity.this.playStyle)) {
VideoDetailActivity.this.videoView.escFull();
} else {
VideoDetailActivity.this.videoView.changedToPortrait(true);
}
}
}
VideoDetailActivity.this.getNetData();
}
}
}
});
sendEmptyMessageDelayed(10000, 180000L);
}
}
};
private PermissionListener mPermissionListener = new PermissionListener() {
@Override
public void onFail() {
}
@Override
public void onSuccess() {
}
};
private ViewStateListener mViewStateListener = new ViewStateListener() {
@Override
public void onBackToDesktop() {
}
@Override
public void onHide() {
}
@Override
public void onMoveAnimEnd() {
}
@Override
public void onMoveAnimStart() {
}
@Override
public void onPositionUpdate(int i, int i2) {
}
@Override
public void onShow() {
}
@Override
public void onDismiss() {
if (VideoDetailActivity.this.videoView != null) {
VideoDetailActivity.this.videoView.onDestroy();
}
if (VideoDetailActivity.this.aliyunVodPlayerView != null) {
VideoDetailActivity.this.aliyunVodPlayerView.onDestroy();
}
VideoDetailActivity.this.giveUpAudioFocus();
}
};
private void configMediaPlayerState() {
}
@Override
public void onPageFinished() {
}
@Override
public void onPageStarted(String str) {
}
@Override
public void onProgressChanged(int i) {
}
@Override
public void onReceivedTitle(String str) {
}
@Override
public void onShowErrorPage() {
}
@Override
public void onShowFileChooser(ValueCallbackWrapper<Uri[]> valueCallbackWrapper, FileChooserParamsWrapper fileChooserParamsWrapper) {
}
@Override
public void onShowLoading() {
}
@Override
public void onShowProgress() {
}
@Override
public void openFileChooser(ValueCallbackWrapper<Uri> valueCallbackWrapper, String str, String str2) {
}
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.video_detail_activity);
findViewById(R.id.blank_for_statue).setBackgroundColor(-16777216);
this.webView.setWebViewEventCallback(this);
this.netParams = new NetParams(getBaseContext());
if (Build.VERSION.SDK_INT >= 23) {
getWindow().getDecorView().setSystemUiVisibility(LogType.UNEXP_ANR);
}
if (Build.VERSION.SDK_INT >= 19) {
try {
ViewGroup.LayoutParams layoutParams = this.blankForStatue2V.getLayoutParams();
layoutParams.height = IUtil.getStatusHeight();
if (layoutParams.height < IUtil.dip2px(getActivity(), 50.0f) && layoutParams.height > IUtil.dip2px(getActivity(), 18.0f)) {
this.blankForStatue2V.setLayoutParams(layoutParams);
}
} catch (Exception unused) {
}
}
setSwipeBackEnable(false);
this.webView.setVisibility(8);
this.aliyunScreenMode = AliyunScreenMode.Small;
findViewById(R.id.navi_action).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (VideoDetailActivity.this.share == null || VideoDetailActivity.this.model == null || VideoDetailActivity.this.errorTipV.getVisibility() == 0) {
VideoDetailActivity.this.showToast("数据加载中,请稍后再试...");
return;
}
SharePopWindow sharePopWindow = new SharePopWindow(VideoDetailActivity.this.getActivity());
sharePopWindow.setShare(VideoDetailActivity.this.share);
if (VideoDetailActivity.this.collect != null) {
sharePopWindow.setCollect(VideoDetailActivity.this.collect);
sharePopWindow.showCollect();
}
sharePopWindow.hideShareCard();
sharePopWindow.hideReport();
sharePopWindow.showWordOfCommand();
sharePopWindow.show(VideoDetailActivity.this.getActivity());
sharePopWindow.setCallBack(new SharePopWindow.CallBack() {
@Override
public void onRefresh() {
if (VideoDetailActivity.this.adapter != null) {
VideoDetailActivity.this.getNetData();
VideoDetailActivity.this.adapter.refresh();
}
}
});
}
});
try {
Map<String, IFloatWindow> map = FloatWindow.mFloatWindowMap;
for (String str : map.keySet()) {
ViewGroup viewGroup = (ViewGroup) FloatWindow.get(str).getView();
if (viewGroup != null) {
AliyunVodPlayerView aliyunVodPlayerView = (AliyunVodPlayerView) viewGroup.findViewById(R.id.videoView);
this.aliyunVodPlayerView = aliyunVodPlayerView;
if (aliyunVodPlayerView != null) {
if (this.contentId.equals(str)) {
this.position = this.aliyunVodPlayerView.getVideoPosition();
this.source = str;
map.get(str).dismiss();
map.remove(str);
} else {
this.aliyunVodPlayerView.onStop();
this.aliyunVodPlayerView.setOnVideoPlayerStateChangedListener(new AliyunVodPlayerView.OnVideoPlayerStateChangedListener() {
@Override
public void onVideoState(int i) {
if (i != 3 || VideoDetailActivity.this.videoView == null) {
return;
}
VideoDetailActivity.this.videoView.onStop();
}
});
}
}
}
}
} catch (Exception unused2) {
}
this.videoView.getmOrientationWatchDog().stopWatch();
this.w = (IUtil.getDisplayWidth() * 264) / 375;
this.threshold = (r1 * 16) / 9.0f;
this.surfaceView = this.videoView.getPlayerView();
ViewGroup.LayoutParams layoutParams2 = this.videoPayBoxV.getLayoutParams();
this.params = layoutParams2;
layoutParams2.width = IUtil.getDisplayWidth();
this.params.height = (IUtil.getDisplayWidth() * 9) / 16;
this.videoPayBoxV.setLayoutParams(this.params);
this.videoView.setViewGroup(this.videoPayBoxV);
this.videoView.setFrameLayout(this.videolayoutV);
View inflate = LayoutInflater.from(getActivity()).inflate(R.layout.placehoder_view, (ViewGroup) null);
this.listview.addHeaderView(inflate);
ViewGroup viewGroup2 = (ViewGroup) inflate.findViewById(R.id.placeholder);
this.placeholderV = viewGroup2;
ViewGroup.LayoutParams layoutParams3 = viewGroup2.getLayoutParams();
layoutParams3.height = this.params.height;
this.placeholderV.setLayoutParams(layoutParams3);
this.videoView.setPlaceholder(this.placeholderV);
ViewGroup.LayoutParams layoutParams4 = this.videolayoutV.getLayoutParams();
layoutParams4.height = this.params.height;
layoutParams4.width = IUtil.getDisplayWidth();
this.videolayoutV.setLayoutParams(layoutParams4);
SurfaceView surfaceView = this.surfaceView;
if (surfaceView != null) {
ViewGroup.LayoutParams layoutParams5 = surfaceView.getLayoutParams();
layoutParams5.height = this.params.height;
layoutParams5.width = IUtil.getDisplayWidth();
this.surfaceView.setLayoutParams(layoutParams5);
}
this.listview.setOnScrollListener(new AbsListView.OnScrollListener() {
private SparseArray recordSp = new SparseArray(0);
private int mCurrentfirstVisibleItem = 0;
@Override
public void onScrollStateChanged(AbsListView absListView, int i) {
}
@Override
public void onScroll(AbsListView absListView, int i, int i2, int i3) {
if ("1".equals(VideoDetailActivity.this.playStyle) || VideoDetailActivity.this.aliyunScreenMode == AliyunScreenMode.Full) {
return;
}
this.mCurrentfirstVisibleItem = i;
View childAt = absListView.getChildAt(0);
if (childAt != null) {
ItemRecod itemRecod = (ItemRecod) this.recordSp.get(i);
if (itemRecod == null) {
itemRecod = new ItemRecod();
}
itemRecod.height = childAt.getHeight();
itemRecod.f1212top = childAt.getTop();
this.recordSp.append(i, itemRecod);
}
if (getScrollY() < VideoDetailActivity.this.threshold - ((IUtil.getDisplayWidth() * 9) / 16) && getScrollY() > 0 && VideoDetailActivity.this.surfaceView != null) {
VideoDetailActivity.this.params.height = (int) (VideoDetailActivity.this.threshold * (1.0f - (getScrollY() / VideoDetailActivity.this.threshold)));
VideoDetailActivity.this.videoPayBoxV.setLayoutParams(VideoDetailActivity.this.params);
ViewGroup.LayoutParams layoutParams6 = VideoDetailActivity.this.videolayoutV.getLayoutParams();
layoutParams6.height = VideoDetailActivity.this.params.height;
VideoDetailActivity.this.videolayoutV.setLayoutParams(layoutParams6);
ViewGroup.LayoutParams layoutParams7 = VideoDetailActivity.this.surfaceView.getLayoutParams();
layoutParams7.height = VideoDetailActivity.this.params.height;
layoutParams7.width = (VideoDetailActivity.this.params.height * 9) / 16;
VideoDetailActivity.this.surfaceView.setLayoutParams(layoutParams7);
}
if (getScrollY() <= 0 && VideoDetailActivity.this.surfaceView != null && VideoDetailActivity.this.status != 1 && VideoDetailActivity.this.aliyunScreenMode == AliyunScreenMode.Small) {
VideoDetailActivity.this.params.height = (VideoDetailActivity.this.w * 16) / 9;
VideoDetailActivity.this.videoPayBoxV.setLayoutParams(VideoDetailActivity.this.params);
ViewGroup.LayoutParams layoutParams8 = VideoDetailActivity.this.videolayoutV.getLayoutParams();
layoutParams8.height = VideoDetailActivity.this.params.height;
VideoDetailActivity.this.videolayoutV.setLayoutParams(layoutParams8);
ViewGroup.LayoutParams layoutParams9 = VideoDetailActivity.this.surfaceView.getLayoutParams();
layoutParams9.height = VideoDetailActivity.this.params.height;
VideoDetailActivity.this.surfaceView.setLayoutParams(layoutParams9);
VideoDetailActivity.this.status = 1;
return;
}
VideoDetailActivity.this.status = 0;
}
private int getScrollY() {
int i;
int i2 = 0;
int i3 = 0;
while (true) {
i = this.mCurrentfirstVisibleItem;
if (i2 >= i) {
break;
}
ItemRecod itemRecod = (ItemRecod) this.recordSp.get(i2);
if (itemRecod != null) {
i3 += itemRecod.height;
}
i2++;
}
ItemRecod itemRecod2 = (ItemRecod) this.recordSp.get(i);
if (itemRecod2 == null) {
itemRecod2 = new ItemRecod();
}
return i3 - itemRecod2.f1212top;
}
});
this.videoDetailTopDataView = new VideoDetailTopDataView(this);
this.commentApplaudView = new CommentApplaudView(this, findViewById(R.id.comment_bar));
this.showHotCommentDataView = new ShowHotCommentDataView(this);
this.lookAllCommentDataView = new LookAllCommentDataView(this);
this.videoRecommendDataView = new VideoRecommendDataView(this);
this.commentChoiceDataView = new ShowCommentChoiceDataView(this);
setCallBackComment();
this.mHandler.sendEmptyMessageDelayed(10000, 1000L);
getNetData();
this.videoRecommendDataView.addOnClickListener(new VideoRecommendDataView.OnClickListener() {
@Override
public void setOnClickListener(String str2, String str3, String str4) {
if (OnClickUtil.isFastDoubleClick(1000L)) {
return;
}
VideoDetailActivity.this.findViewById(R.id.navi_action_second).setVisibility(8);
VideoDetailActivity.this.webView.setVisibility(8);
if (VideoDetailActivity.this.videoView != null) {
VideoDetailActivity.this.videoView.onStop();
}
VideoDetailActivity.this.contentId = str2;
VideoDetailActivity.this.isPlay = false;
Net url = Net.url(API.Video.videoDetail2);
url.param("video_content_id", VideoDetailActivity.this.contentId);
url.get(new Task<Result>() {
@Override
public void onResult(Result result) {
if (result.success()) {
VideoDetailActivity.this.setData(result);
}
}
});
}
});
initAdapter();
this.bus.registerListener(API.Event.comment_delete, getClass().getSimpleName(), new OnEventListener() {
@Override
public boolean doInUI(Event event) {
VideoDetailActivity.this.adapter.refresh();
return super.doInUI(event);
}
});
try {
this.mAudioManager = (AudioManager) getSystemService("audio");
} catch (Exception e) {
e.printStackTrace();
}
String substring = "https://app.jpztong.com/".substring(0, 23);
PlayerConfig playerConfig = this.videoView.getPlayerConfig();
playerConfig.mReferrer = substring;
this.videoView.setPlayerConfig(playerConfig);
tryToGetAudioFocus();
this.videoView.setOnFullClickListener(new AliyunVodPlayerView.OnFullClickListener() {
@Override
public void onFullClickListener(AliyunScreenMode aliyunScreenMode) {
VideoDetailActivity.this.aliyunScreenMode = aliyunScreenMode;
if ("2".equals(VideoDetailActivity.this.playStyle)) {
if (aliyunScreenMode == AliyunScreenMode.Full) {
VideoDetailActivity.this.blankForStatue2V.setVisibility(0);
VideoDetailActivity.this.blankForStatueV.setVisibility(8);
VideoDetailActivity.this.findViewById(R.id.comment_bar).setVisibility(8);
VideoDetailActivity.this.naviLineV.setVisibility(8);
VideoDetailActivity.this.destroyFloatWindow();
return;
}
if (aliyunScreenMode == AliyunScreenMode.Small) {
VideoDetailActivity.this.blankForStatue2V.setVisibility(8);
VideoDetailActivity.this.blankForStatueV.setVisibility(0);
VideoDetailActivity.this.findViewById(R.id.comment_bar).setVisibility(0);
VideoDetailActivity.this.naviLineV.setVisibility(0);
}
}
}
});
if (AndroidDeviceIMEIUtil.isRunOnEmulator(getActivity()) && getPackageName().equals(LiveDetailActivity.kuniu)) {
showToast("请勿在模拟器使用该功能");
finish();
}
}
@OnClick({R.id.navi_action_second})
public void actionSecondClick() {
requestOverlayPermission();
}
private void requestOverlayPermission() {
if (Build.VERSION.SDK_INT >= 23) {
if (!Settings.canDrawOverlays(getActivity())) {
((IDialog) Ioc.get(IDialog.class)).showDialog(getActivity(), "配置提示", "小窗播放视频需要在应用设置中开启悬浮窗权限,是否前往开启权限?", new DialogCallBack() {
@Override
public void onClick(int i) {
if (i == -1) {
VideoDetailActivity.this.startActivityForResult(new Intent("android.settings.action.MANAGE_OVERLAY_PERMISSION", Uri.parse("package:" + VideoDetailActivity.this.getPackageName())), 5004);
}
}
}).show();
return;
} else {
setFloatView();
return;
}
}
setFloatView();
}
public void destroyFloatWindow() {
try {
Iterator<String> it = FloatWindow.mFloatWindowMap.keySet().iterator();
while (it.hasNext()) {
FloatWindow.destroy(it.next());
}
} catch (Exception unused) {
}
}
private void setFloatView() {
int displayWidth;
int i;
destroyFloatWindow();
if ("2".equals(this.playStyle)) {
displayWidth = (IUtil.getDisplayWidth() * 149) / 375;
i = (displayWidth * 268) / 149;
} else {
displayWidth = (IUtil.getDisplayWidth() * 261) / 375;
i = (displayWidth * 147) / 261;
}
int displayWidth2 = (IUtil.getDisplayWidth() - displayWidth) - IUtil.dip2px(getActivity(), 10.0f);
int displayHeight = (IUtil.getDisplayHeight() - i) - IUtil.dip2px(getActivity(), 58.0f);
this.floatView = 1;
setPlayerHeight("2".equals(this.playStyle));
this.videolayoutV.removeView(this.videoView);
if (this.videoView.getmOrientationWatchDog() != null) {
this.videoView.getmOrientationWatchDog().stopWatch();
}
this.videoView.prohibitOther(this.contentId, getActivity(), this.playStyle);
new ImageView(getApplicationContext()).setImageResource(R.drawable.icon_256x256);
FloatWindow.with(getApplicationContext()).setView(this.videoView).setWidth(displayWidth).setHeight(i).setX(displayWidth2).setY(displayHeight).setMoveType(3, 10, 10).setMoveStyle(700L, new BounceInterpolator()).setFilter(false, new Class[0]).setViewStateListener(this.mViewStateListener).setPermissionListener(this.mPermissionListener).setDesktopShow(true).setTag(this.contentId).setFilter(false, ShotVideoActivity.class, VideoRecordActivity.class, VideoPlayActivity.class).build();
finish();
}
@Override
public void onActivityResult(int i, int i2, Intent intent) {
super.onActivityResult(i, i2, intent);
if (i == 5004 && i2 == -1) {
if (Settings.canDrawOverlays(getActivity())) {
setFloatView();
} else {
showToast("请先申请悬浮窗权限");
}
}
}
private void tryToGetAudioFocus() {
AudioManager audioManager = this.mAudioManager;
if (audioManager == null) {
onAudioFocusChange(1);
} else if (audioManager.requestAudioFocus(this, 3, 1) == 1) {
this.mAudioFocus = 1;
}
}
public void giveUpAudioFocus() {
AudioManager audioManager = this.mAudioManager;
if (audioManager != null && audioManager.abandonAudioFocus(this) == 1) {
this.mAudioFocus = -1;
}
}
@Override
public void onAudioFocusChange(int i) {
this.mAudioFocus = i;
configMediaPlayerState();
}
public void initAdapter() {
this.listview.isRefreshAble(false);
this.listview.addHeaderView(this.videoDetailTopDataView.getRootView());
this.listview.addHeaderView(this.videoRecommendDataView.getRootView());
this.listview.addHeaderView(this.showHotCommentDataView.getRootView());
this.listview.addHeaderView(this.commentChoiceDataView.getRootView());
this.listview.addFooterView(this.lookAllCommentDataView.getRootView());
IncludeEmptyAdapter includeEmptyAdapter = new IncludeEmptyAdapter(getActivity(), API.Video.showCommentv2, DataViewType.comment);
this.adapter = includeEmptyAdapter;
this.listview.setAdapter((ListAdapter) includeEmptyAdapter);
this.adapter.set("commenttag", this.commentInfo);
this.commentChoiceDataView.setData("video");
this.adapter.addOnLoadSuccessCallBack(this);
IncludeEmptyAdapter includeEmptyAdapter2 = this.adapter;
Objects.requireNonNull(includeEmptyAdapter2);
includeEmptyAdapter2.set("EMPTY_KEY_HINT", "暂无回复");
IncludeEmptyAdapter includeEmptyAdapter3 = this.adapter;
Objects.requireNonNull(includeEmptyAdapter3);
includeEmptyAdapter3.set("EMPTY_KEY_PIC", Integer.valueOf(R.drawable.exception_no_comment));
this.commentChoiceDataView.setCommentChoiceCallback(new ShowCommentChoiceDataView.CommentChoiceCallback() {
@Override
public void isPoster(boolean z) {
VideoDetailActivity.this.adapter.param("poster", Boolean.valueOf(z));
VideoDetailActivity.this.adapter.refresh();
}
@Override
public void isHot(boolean z) {
VideoDetailActivity.this.adapter.param("sort", "hot");
VideoDetailActivity.this.adapter.refresh();
}
@Override
public void order(boolean z) {
VideoDetailActivity.this.adapter.param("sort", z ? ContentCollectionActivity.ASC : "desc");
VideoDetailActivity.this.adapter.refresh();
}
});
if (TextUtils.isEmpty(this.jumpToComment)) {
return;
}
this.listview.postDelayed(new Runnable() {
@Override
public void run() {
VideoDetailActivity.this.listview.setSelection(5);
}
}, 300L);
}
public void getNetData() {
Net url = Net.url(API.Video.videoDetail2);
url.param("video_content_id", this.contentId);
url.get(new Task<Result>() {
@Override
public void onResult(Result result) {
if (result.success()) {
VideoDetailActivity.this.setData(result);
}
}
});
}
public void setData(Result result) {
JSONObject jSONObject = new JSONObject();
JSONArray list = result.getList();
JSONObject jSONObject2 = (JSONObject) result.get(Constants.PAGE_INFO);
this.is_live_auth = "1".equals(SafeJsonUtil.getString(jSONObject2, "is_live_auth"));
this.sec_pca = SafeJsonUtil.getString(jSONObject2, "sec_pca");
this.aliyunScreenMode = AliyunScreenMode.Small;
this.link = result.get("album_link") == null ? "" : result.get("album_link").toString();
this.albumName = result.get("album_name") != null ? result.get("album_name").toString() : "";
this.seekBar.setVisibility(8);
if (jSONObject2 != null) {
jSONObject2.put("link", (Object) this.link);
this.commentCount = Integer.parseInt(result.get("comment_count") == null ? "0" : result.get("comment_count").toString());
this.applaudCount = Integer.parseInt(result.get("applaud_count") != null ? result.get("applaud_count").toString() : "0");
jSONObject.put("list", (Object) list);
jSONObject.put(Constants.PAGE_INFO, (Object) jSONObject2);
jSONObject.put("album_name", (Object) this.albumName);
jSONObject.put("album_link", (Object) this.link);
String string = SafeJsonUtil.getString(jSONObject2, "play_style");
this.playStyle = string;
if (TextUtils.isEmpty(string)) {
this.playStyle = "1";
}
VideoDetailItem videoDetailItem = (VideoDetailItem) JSON.parseObject(jSONObject.toJSONString(), VideoDetailItem.class);
this.model = videoDetailItem;
this.contentId = videoDetailItem.getInfo().getVideoContentId();
this.videoDetailTopDataView.setData(this.model);
this.videoRecommendDataView.setData(this.model);
this.videoView.setVisibility(0);
this.errorTipV.setVisibility(8);
findViewById(R.id.comment_bar).setVisibility(0);
this.videoDetailTopDataView.getRootView().findViewById(R.id.layout).setVisibility(0);
this.showHotCommentDataView.getRootView().findViewById(R.id.comment_hot_box).setVisibility(0);
this.commentChoiceDataView.getRootView().findViewById(R.id.choicelayout).setVisibility(0);
this.adapter.isShowEmptyView = false;
init();
this.isApplaud = this.model.getInfo().getIsPraise() == 1;
setShareData();
setDataComment();
this.pic = this.model.getInfo().getCoverPicTburl();
findViewById(R.id.navi_action_second).setVisibility(8);
if (this.model.getInfo().getIsIframe() == 1) {
this.playStyle = "1";
setPlayerHeight(false);
this.webView.setVisibility(0);
this.videoView.setVisibility(8);
this.webView.loadFromNet(this.model.getInfo().getIframeUrl());
VideoPlayNumCount.videoPlayNumCount(this.model.getInfo().getVideoContentId());
this.vipBoxV.setVisibility(8);
this.videoView.getmOrientationWatchDog().stopWatch();
BrowseRecords.videoBrowseRecords(this.pic, this.model.getInfo().getTitle(), this.model.getInfo().getSource(), this.link, this.model.getInfo().getDuration());
return;
}
this.videoView.setVisibility(0);
this.webView.setVisibility(8);
this.infoData = this.model.getInfo();
setVipBox();
return;
}
jSONObject.put("list", (Object) list);
jSONObject.put(Constants.PAGE_INFO, (Object) jSONObject2);
jSONObject.put("album_name", (Object) this.albumName);
jSONObject.put("album_link", (Object) this.link);
VideoDetailItem videoDetailItem2 = (VideoDetailItem) JSON.parseObject(jSONObject.toJSONString(), VideoDetailItem.class);
this.model = videoDetailItem2;
this.videoDetailTopDataView.setData(videoDetailItem2);
this.videoRecommendDataView.setData(this.model);
setShareData();
this.videoView.setVisibility(8);
this.errorTipV.setVisibility(0);
this.adapter.clear();
this.adapter.notifyDataSetChanged();
videoOccurError();
findViewById(R.id.comment_bar).setVisibility(8);
this.videoDetailTopDataView.getRootView().findViewById(R.id.layout).setVisibility(8);
this.showHotCommentDataView.getRootView().findViewById(R.id.comment_hot_box).setVisibility(8);
this.commentChoiceDataView.getRootView().findViewById(R.id.choicelayout).setVisibility(8);
this.adapter.isShowEmptyView = true;
}
public void init() {
this.adapter.param("content_id", this.contentId);
if (!TextUtils.isEmpty(this.comment_id)) {
this.adapter.param("comment_id", this.comment_id);
}
this.listview.setAdapter((ListAdapter) this.adapter);
this.showHotCommentDataView.setAdapter(this.adapter);
this.adapter.refresh();
}
public void setVideo(final String str, String str2) {
findViewById(R.id.navi_action).setVisibility(0);
findViewById(R.id.navi_action_second).setVisibility(0);
this.videoView.clearFocus();
this.videoView.setShowReplay(true);
this.videoView.setKeepScreenOn(true);
this.videoView.setTheme(Theme.Red);
if ("1".equals(this.playStyle)) {
this.videoView.setScaleMode(IPlayer.ScaleMode.SCALE_ASPECT_FIT);
this.videoView.getmOrientationWatchDog().startWatch();
} else {
this.videoView.setScaleMode(IPlayer.ScaleMode.SCALE_TO_FILL);
this.videoView.getmOrientationWatchDog().stopWatch();
}
this.videoView.setAutoPlay(true);
this.videoView.setCoverUri(str);
if (this.is_live_auth && (str2.indexOf(".m3u8") != -1 || str2.indexOf("rtmp://") != -1 || str2.indexOf("RTMP://") != -1)) {
this.urlSource.setUri(UrlUtils.addUrl(str2, this.sec_pca));
} else {
this.urlSource.setUri(str2);
}
if (!this.hasPlay) {
VideoPlayNumCount.videoPlayNumCount(this.model.getInfo().getVideoContentId());
this.hasPlay = true;
}
postDelay(new Runnable() {
@Override
public void run() {
VideoDetailActivity.this.videoView.setLocalSource(VideoDetailActivity.this.urlSource);
}
}, 100L);
this.videoView.setOnTipClickListener(new TipsView.OnTipClickListener() {
@Override
public void onContinuePlay() {
}
@Override
public void onExit() {
}
@Override
public void onRefreshSts() {
}
@Override
public void onStopPlay() {
}
@Override
public void onWait() {
}
@Override
public void onRetryPlay(int i) {
Net url = Net.url(API.Video.videoDetail2);
url.param("video_content_id", VideoDetailActivity.this.contentId);
url.get(new Task<Result>() {
@Override
public void onResult(Result result) {
if (result.success()) {
JSONObject jSONObject = new JSONObject();
JSONArray list = result.getList();
JSONObject jSONObject2 = (JSONObject) result.get(Constants.PAGE_INFO);
VideoDetailActivity.this.is_live_auth = "1".equals(SafeJsonUtil.getString(jSONObject2, "is_live_auth"));
VideoDetailActivity.this.sec_pca = SafeJsonUtil.getString(jSONObject2, "sec_pca");
if (jSONObject2 != null) {
jSONObject2.put("link", (Object) VideoDetailActivity.this.link);
VideoDetailActivity.this.commentCount = Integer.parseInt(result.get("comment_count") == null ? "0" : result.get("comment_count").toString());
VideoDetailActivity.this.applaudCount = Integer.parseInt(result.get("applaud_count") != null ? result.get("applaud_count").toString() : "0");
jSONObject.put("list", (Object) list);
jSONObject.put(Constants.PAGE_INFO, (Object) jSONObject2);
jSONObject.put("album_name", (Object) VideoDetailActivity.this.albumName);
jSONObject.put("album_link", (Object) VideoDetailActivity.this.link);
VideoDetailActivity.this.model = (VideoDetailItem) JSON.parseObject(jSONObject.toJSONString(), VideoDetailItem.class);
VideoDetailActivity.this.infoData = VideoDetailActivity.this.model.getInfo();
} else {
jSONObject.put("list", (Object) list);
jSONObject.put(Constants.PAGE_INFO, (Object) jSONObject2);
jSONObject.put("album_name", (Object) VideoDetailActivity.this.albumName);
jSONObject.put("album_link", (Object) VideoDetailActivity.this.link);
VideoDetailActivity.this.model = (VideoDetailItem) JSON.parseObject(jSONObject.toJSONString(), VideoDetailItem.class);
}
VideoDetailActivity.this.videoPath = VideoDetailActivity.this.isTrySee ? VideoDetailActivity.this.infoData.getTry_see_video_url() : VideoDetailActivity.this.infoData.getVideoUrl();
VideoDetailActivity.this.setVideo(str, VideoDetailActivity.this.videoPath);
}
}
});
}
@Override
public void onReplay() {
if (VideoDetailActivity.this.videoView != null) {
VideoDetailActivity.this.videoView.rePlay();
}
}
});
this.videoView.setOnPreparedListener(new IPlayer.OnPreparedListener() {
@Override
public void onPrepared() {
VideoDetailActivity.this.videoView.setSeekBar(VideoDetailActivity.this.seekBar);
}
});
this.videoView.setOnFirstFrameStartListener(new IPlayer.OnRenderingStartListener() {
@Override
public void onRenderingStart() {
if (VideoDetailActivity.this.position == 0 || !VideoDetailActivity.this.contentId.equals(VideoDetailActivity.this.source)) {
return;
}
VideoDetailActivity.this.videoView.seekTo(VideoDetailActivity.this.position);
}
});
this.videoView.setOnCompletionListener(new IPlayer.OnCompletionListener() {
@Override
public void onCompletion() {
VideoDetailActivity.this.position = 0;
if (VideoDetailActivity.this.isTrySee) {
VideoDetailActivity.this.infoData.setHasTry(true);
VideoDetailActivity.this.isTrySee = false;
VideoDetailActivity.this.setVipBox();
}
}
});
this.videoView.setOnVideoPlayerStateChangedListener(new AliyunVodPlayerView.OnVideoPlayerStateChangedListener() {
@Override
public void onVideoState(int i) {
if (i == 3) {
VideoDetailActivity.this.helper.timeStart();
VideoDetailActivity.this.started = true;
} else if (i == 4 || i == 6) {
VideoDetailActivity.this.helper.timeEnd();
VideoDetailActivity.this.started = false;
}
if (i != 3 || VideoDetailActivity.this.aliyunVodPlayerView == null) {
return;
}
VideoDetailActivity.this.aliyunVodPlayerView.onStop();
}
});
}
private void setPlayerHeight(boolean z) {
this.params.height = z ? (this.w * 16) / 9 : (IUtil.getDisplayWidth() * 9) / 16;
this.videoPayBoxV.setLayoutParams(this.params);
ViewGroup viewGroup = this.placeholderV;
if (viewGroup != null) {
ViewGroup.LayoutParams layoutParams = viewGroup.getLayoutParams();
layoutParams.height = this.params.height;
this.placeholderV.setLayoutParams(layoutParams);
}
ViewGroup.LayoutParams layoutParams2 = this.videolayoutV.getLayoutParams();
layoutParams2.height = this.params.height;
layoutParams2.width = IUtil.getDisplayWidth();
this.videolayoutV.setLayoutParams(layoutParams2);
SurfaceView surfaceView = this.surfaceView;
if (surfaceView != null) {
ViewGroup.LayoutParams layoutParams3 = surfaceView.getLayoutParams();
layoutParams3.height = z ? this.params.height : -1;
layoutParams3.width = z ? this.w : -1;
this.surfaceView.setLayoutParams(layoutParams3);
}
}
public void setVipBox() {
if (this.infoData != null) {
this.videoView.setPlayStyle(this.playStyle);
setPlayerHeight("2".equals(this.playStyle));
if (this.infoData.isIs_free()) {
String videoUrl = this.model.getInfo().getVideoUrl();
this.videoPath = videoUrl;
setVideo(this.pic, videoUrl);
this.vipBoxV.setVisibility(8);
return;
}
this.videoView.getmOrientationWatchDog().stopWatch();
findViewById(R.id.navi_action).setVisibility(8);
this.vipBoxV.setVisibility(0);
this.vipBgV.loadView(this.pic, R.drawable.vip_video_bg);
if ("1".equals(this.infoData.getIs_open_try_see())) {
if (this.infoData.isHasTry()) {
if (this.infoData.isIs_open_join() && this.infoData.isIs_need_order()) {
this.vipToastTextV.setText("试看结束,本片需购买或开通VIP免费看");
} else if (this.infoData.isIs_open_join()) {
this.vipToastTextV.setText("试看结束,VIP会员可免费观看");
} else if (this.infoData.isIs_need_order()) {
this.vipToastTextV.setText("试看结束,本片需购买观看");
}
} else if (this.infoData.isIs_open_join() && this.infoData.isIs_need_order()) {
this.vipToastTextV.setText("购买此视频或开通VIP会员可免费观看,点击试看");
} else if (this.infoData.isIs_open_join()) {
this.vipToastTextV.setText("VIP会员可免费观看,点击试看");
} else if (this.infoData.isIs_need_order()) {
this.vipToastTextV.setText("本片需购买观看,点击试看");
}
} else if (this.infoData.isIs_open_join() && this.infoData.isIs_need_order()) {
this.vipToastTextV.setText("此视频需购买或开通VIP会员可免费观看");
} else if (this.infoData.isIs_open_join()) {
this.vipToastTextV.setText("VIP会员可免费观看");
} else if (this.infoData.isIs_need_order()) {
this.vipToastTextV.setText("此视频为付费内容,请购买后查看");
}
if (this.infoData.isCan_view()) {
this.vipPlayV.setVisibility(0);
this.trySeeV.setVisibility(8);
this.vipOpeningV.setVisibility(8);
this.purchaseV.setVisibility(8);
if (this.infoData.isHas_order()) {
this.vipToastTextV.setText("已购买此付费视频,点击开始观看");
return;
} else if (this.infoData.isIs_join()) {
this.vipToastTextV.setText("已是VIP会员,可免费观看此视频");
return;
} else {
this.vipToastTextV.setText("已购买此付费视频,点击开始观看.");
return;
}
}
this.vipPlayV.setVisibility(8);
if (this.infoData.isIs_need_order()) {
this.purchaseV.setVisibility(0);
this.purchaseV.setText(this.infoData.getOrder_str());
} else {
this.purchaseV.setVisibility(8);
}
if (this.infoData.isIs_open_join()) {
this.vipOpeningV.setVisibility(0);
this.vipOpeningV.setText(this.infoData.getJoin_str());
} else {
this.vipOpeningV.setVisibility(8);
}
if ("1".equals(this.infoData.getIs_open_try_see()) && !this.infoData.isHasTry()) {
this.trySeeV.setVisibility(0);
} else {
this.trySeeV.setVisibility(8);
}
}
}
public void setShareData() {
VideoDetailItem videoDetailItem = this.model;
if (videoDetailItem == null || videoDetailItem.getInfo() == null || this.model.getInfo().getShareInfo() == null) {
return;
}
this.share.platforms = "ALL";
this.share.type = 0;
this.share.pic = this.model.getInfo().getShareInfo().getSharePic();
this.share.title = this.model.getInfo().getShareInfo().getTitle();
this.share.description = this.model.getInfo().getShareInfo().getDes();
this.share.url = this.model.getInfo().getShareInfo().getShareUrl();
Share share = this.share;
share.shareType = share.shareChat;
this.share.typeText = "";
this.share.toChatUrl = UrlScheme.appcode + "://videoContent?contentId=" + this.contentId;
this.share.originalUrl = UrlScheme.appcode + "://videoContent?contentId=" + this.contentId;
Collect collect = new Collect();
this.collect = collect;
collect.setPic(this.model.getInfo().getShareInfo().getSharePic());
this.collect.setUserId("1");
this.collect.setTitle(this.model.getInfo().getShareInfo().getTitle());
this.collect.setKey("video_" + this.contentId);
this.collect.setCatName(this.albumName);
this.collect.setLink(UrlScheme.appcode + "://videoContent?contentId=" + this.contentId);
}
public class AnonymousClass17 extends UserApi.LoginCallBack {
AnonymousClass17() {
}
@Override
public void onLogin() {
((IDialog) Ioc.get(IDialog.class)).showDialog(VideoDetailActivity.this.getActivity(), "提示", "确定购买?", new DialogCallBack() {
@Override
public void onClick(int i) {
if (i == -1) {
Net url = Net.url(VideoDetailActivity.this.infoData.getOrder_link());
url.showProgress(false);
url.get(new Task<Result>() {
@Override
public void onResult(Result result) {
if (result.success()) {
VideoDetailActivity.this.getNetData();
} else {
VideoDetailActivity.this.isClickVip = true;
}
}
});
}
}
});
}
}
@OnClick({R.id.purchase})
public void purchaseClick() {
if (this.infoData != null) {
UserApi.afterLogin(getActivity(), new AnonymousClass17());
}
}
@OnClick({R.id.vip_opening})
public void vipOpeningClcik() {
if (this.infoData != null) {
this.isClickVip = true;
UrlScheme.toUrl(getActivity(), this.infoData.getOrder_join_link());
}
}
@OnClick({R.id.try_see})
public void trySeeClick() {
VideoDetailItem.Info info = this.infoData;
if (info != null) {
this.isTrySee = true;
this.videoPath = info.getTry_see_video_url();
this.vipBoxV.setVisibility(8);
setVideo(this.pic, this.videoPath);
}
}
@OnClick({R.id.vip_play})
public void vipPlayClick() {
VideoDetailItem.Info info = this.infoData;
if (info != null) {
this.videoPath = info.getVideoUrl();
this.vipBoxV.setVisibility(8);
setVideo(this.pic, this.videoPath);
}
}
public void videoOccurError() {
this.videoView.onStop();
this.errorTipV.setVisibility(0);
}
private void setCallBackComment() {
initShare();
this.commentApplaudView.setCommentCallBack(new CommentActivity.CommentCallBack() {
@Override
public void onCommentSuccess(String str, String str2) {
VideoDetailActivity.this.adapter.refresh();
VideoDetailActivity.this.commentInfo.setCommentCount(VideoDetailActivity.this.commentInfo.getCommentCount() + 1);
VideoDetailActivity.this.commentApplaudView.notifyChange();
}
});
this.commentApplaudView.setApplaudCallback(new CommentApplaudView.ApplaudCallBck() {
@Override
public void onApplaudCallBck(Boolean bool) {
bool.booleanValue();
}
});
}
public void initShare() {
this.commentApplaudView.setShareListen(new CommentApplaudView.shareListenClick() {
@Override
public void shareClick() {
if (VideoDetailActivity.this.share == null || VideoDetailActivity.this.model == null) {
VideoDetailActivity.this.showToast("数据加载中,请稍后再试...");
return;
}
SharePopWindow sharePopWindow = new SharePopWindow(VideoDetailActivity.this.getActivity());
sharePopWindow.setShare(VideoDetailActivity.this.share);
sharePopWindow.hideShareCard();
sharePopWindow.hideOtherFunction();
sharePopWindow.show(VideoDetailActivity.this.getActivity());
}
});
}
public class AnonymousClass21 extends UserApi.LoginCallBack {
AnonymousClass21() {
}
@Override
public void onLogin() {
Intent intent = new Intent(VideoDetailActivity.this.getActivity(), (Class<?>) CommonCommentActivity.class);
intent.putExtra("uploadType", "1");
intent.putExtra("picupload", ConnType.PK_OPEN);
if (VideoDetailActivity.this.model != null && VideoDetailActivity.this.model.getUser() != null) {
intent.putExtra("hint", "回复" + VideoDetailActivity.this.model.getUser().getName() + com.xiaomi.mipush.sdk.Constants.COLON_SEPARATOR);
}
CommonCommentActivity.commentCallBack = new AnonymousClass1();
VideoDetailActivity.this.getActivity().startActivity(intent);
VideoDetailActivity.this.overridePendingTransition(R.anim.alpha_in, R.anim.alpha_out);
}
public class AnonymousClass1 implements CommonCommentActivity.CommentCallBack {
AnonymousClass1() {
}
@Override
public void onCommentSuccess(String str, String str2, String str3, int i, RichContent.Pic pic) {
Net url = Net.url(API.Video.contentAddComment);
url.param("content", str);
url.param("content_id", VideoDetailActivity.this.contentId);
if (i == 1) {
url.param(SocialConstants.PARAM_IMAGE, str2);
}
if (i == 2 && pic != null) {
url.param("video", pic.videoAid);
url.param(SocialConstants.PARAM_IMAGE, pic.thumbAid);
}
if (!TextUtils.isEmpty(Ioc.getApplicationContext().getString(R.string.android_partner_key))) {
url.param("auth", ((ITongdunOperation) Ioc.get(ITongdunOperation.class)).onEvent(Ioc.getApplicationContext()));
}
if (!TextUtils.isEmpty(str3)) {
url.param("users", str3);
}
VideoDetailActivity.this.netParams.setNetParams(url);
url.post(new Task<Result>() {
@Override
public void onResult(Result result) {
if (result.success()) {
VideoDetailActivity.this.adapter.add((Comment) SafeJsonUtil.parseBean(result.json().getString(DataViewType.comment), Comment.class));
VideoDetailActivity.this.listview.postDelayed(new Runnable() {
@Override
public void run() {
VideoDetailActivity.this.listview.smoothScrollToPosition(VideoDetailActivity.this.listview.getBottom());
}
}, 100L);
CacheUtils.putString(VideoDetailActivity.this.getActivity(), CacheUtils.commentKey, "");
CacheUtils.putString(VideoDetailActivity.this.getActivity(), CacheUtils.commentAtUsers, new JSONArray().toJSONString());
VideoDetailActivity.this.commentInfo.setCommentCount(VideoDetailActivity.this.commentInfo.getCommentCount() + 1);
VideoDetailActivity.this.adapter.notifyDataSetChanged();
VideoDetailActivity.this.commentApplaudView.notifyChange();
}
}
});
}
}
}
@OnClick({R.id.comment})
public void commentClick() {
UserApi.afterLogin(this, new AnonymousClass21());
}
private void setDataComment() {
this.commentInfo.setCommentUrl(API.Video.contentAddComment);
this.commentInfo.addCommentExtra("content_id", this.contentId);
this.commentInfo.setApplaudAddUrl(API.Video.contentAddApplaud);
this.commentInfo.setApplaudCancelUrl(API.Video.contentCancelApplaud);
this.commentInfo.setApplaud(this.isApplaud);
this.commentInfo.setApplaudKey("content_id");
this.commentInfo.setApplaudValue(this.contentId);
this.commentInfo.setShareUrl("http://baidu.com");
this.commentInfo.setApplaudCount(this.applaudCount);
this.commentInfo.setCommentCount(this.commentCount);
this.commentInfo.setCommentApplaudAddUrl(API.Video.applaudComment);
this.commentInfo.setCommentApplaudCancelUrl(API.Video.cancelApplaudComment);
this.commentApplaudView.setData(this.commentInfo);
}
@OnClick({R.id.comment_view})
public void commentLocation() {
if (this.commentInfo.getCommentCount() == 0) {
commentClick();
} else if (this.listview.getHeaderViewsCount() + this.listview.getFooterViewsCount() == this.listview.getCount()) {
LocalListView localListView = this.listview;
localListView.setSelection(localListView.getBottom());
} else {
this.listview.setSelection(9);
}
}
@Override
public void onConfigurationChanged(Configuration configuration) {
super.onConfigurationChanged(configuration);
if ("2".equals(this.playStyle)) {
return;
}
this.portrait = configuration.orientation == 1;
findViewById(R.id.navi_action).setVisibility(this.portrait ? 0 : 8);
this.blankForStatueV.setVisibility(this.portrait ? 0 : 8);
tryFullScreen(!this.portrait);
videoModeChange(!this.portrait);
}
private void tryFullScreen(boolean z) {
ActionBar actionBar = getActionBar();
if (actionBar != null) {
if (z) {
actionBar.hide();
} else {
actionBar.show();
}
}
setFullScreen(z);
}
private void setFullScreen(boolean z) {
if (z) {
getWindow().setFlags(1024, 1024);
this.videoView.setSystemUiVisibility(5894);
findViewById(R.id.comment_bar).setVisibility(8);
this.naviLineV.setVisibility(8);
destroyFloatWindow();
return;
}
getWindow().clearFlags(1024);
this.videoView.setSystemUiVisibility(0);
findViewById(R.id.comment_bar).setVisibility(0);
this.naviLineV.setVisibility(0);
}
@Override
public void onPause() {
if (this.webView.getVisibility() == 0) {
this.webView.onPause();
}
super.onPause();
}
@Override
public void onStop() {
super.onStop();
AliyunVodPlayerView aliyunVodPlayerView = this.videoView;
if (aliyunVodPlayerView != null && this.floatView == 0) {
aliyunVodPlayerView.onStop();
}
EventBus eventBus = this.bus;
if (eventBus != null) {
eventBus.unregisterListener(API.Event.clickAll, getClass().getSimpleName());
}
}
@Override
public boolean onKeyDown(int i, KeyEvent keyEvent) {
if (this.videoView != null) {
if ("2".equals(this.playStyle)) {
return super.onKeyDown(i, keyEvent);
}
if (!this.videoView.onKeyDown(i, keyEvent)) {
return false;
}
}
return super.onKeyDown(i, keyEvent);
}
@Override
public void onResume() {
if (this.webView.getVisibility() == 0) {
this.webView.onResume();
}
super.onResume();
this.bus.registerListener(API.Event.clickAll, getClass().getSimpleName(), new OnEventListener() {
@Override
public boolean doInUI(Event event) {
VideoDetailActivity.this.adapter.refresh();
return super.doInUI(event);
}
});
AliyunVodPlayerView aliyunVodPlayerView = this.videoView;
if (aliyunVodPlayerView != null) {
aliyunVodPlayerView.onResume();
if ("2".equals(this.playStyle)) {
if (this.aliyunScreenMode == AliyunScreenMode.Full) {
this.videoView.setFullScreen(true);
} else if (this.aliyunScreenMode == AliyunScreenMode.Small) {
this.videoView.setFullScreen(false);
}
} else {
int i = getResources().getConfiguration().orientation;
if (i == 1) {
tryFullScreen(false);
videoModeChange(false);
} else if (i == 2) {
tryFullScreen(true);
videoModeChange(true);
}
}
}
if (this.isClickVip) {
this.isClickVip = false;
getNetData();
}
}
@OnClick({R.id.icon_navi_back})
public void naviBackFinish() {
AliyunVodPlayerView aliyunVodPlayerView = this.videoView;
if (aliyunVodPlayerView != null) {
if (aliyunVodPlayerView.ismIsFullScreenLocked()) {
return;
}
if (this.videoView.getmCurrentScreenMode() == AliyunScreenMode.Full) {
if ("2".equals(this.playStyle)) {
this.videoView.escFull();
return;
} else {
this.videoView.changedToPortrait(true);
return;
}
}
onfinish();
return;
}
onfinish();
}
public void onfinish() {
if (this.customView != null) {
onHideCustomView();
} else {
finish();
}
}
@Override
public void onBackPressed() {
naviBackFinish();
}
@Override
public void onLoadSuccess(Task task, int i) {
if (task == null || task.getResult() == null) {
return;
}
if (i == 1) {
this.page = i;
}
if (((String) this.adapter.get("isDelete")) != null) {
CommentInfo commentInfo = this.commentInfo;
commentInfo.setCommentCount(commentInfo.getCommentCount() < 1 ? 0 : this.commentInfo.getCommentCount() - 1);
this.commentApplaudView.notifyChange();
this.adapter.set("isDelete", null);
}
if (i == 1 && task.getResult().success()) {
this.adapter.set("is_open_comment_lzl", "1");
this.showHotCommentDataView.setData(SafeJsonUtil.parseList(task.getResult().json().getString("hot_list"), Comment.class));
this.adapter.param("comment_id", null);
JSONArray list = task.getResult().getList();
if (list != null && list.size() > 0) {
if (!TextUtils.isEmpty(this.comment_id)) {
this.comment_id = null;
this.lookAllCommentDataView.setData(true);
if (this.isFirst) {
this.listview.post(new Runnable() {
@Override
public void run() {
VideoDetailActivity.this.listview.smoothScrollToPosition(VideoDetailActivity.this.listview.getBottom());
VideoDetailActivity.this.isFirst = false;
}
});
return;
}
return;
}
this.lookAllCommentDataView.setData(false);
return;
}
this.lookAllCommentDataView.setData(false);
}
}
@Override
public void onDestroy() {
this.mHandler.removeMessages(10000);
super.onDestroy();
EventBus eventBus = this.bus;
if (eventBus != null) {
eventBus.unregisterListener(API.Event.comment_delete, getClass().getSimpleName());
}
this.webView.removeAllViews();
MagWebView magWebView = this.webView;
if (magWebView != null) {
magWebView.destroy();
}
if (this.started) {
this.helper.timeEnd();
}
if (this.floatView == 0) {
this.videoView.onDestroy();
giveUpAudioFocus();
}
}
@Override
public void onHideCustomView() {
setRequestedOrientation(1);
View view = this.customView;
if (view == null) {
return;
}
view.setPadding(view.getPaddingLeft(), this.customView.getPaddingTop(), this.customPaddingRight, this.customView.getPaddingBottom());
((FrameLayout) getWindow().getDecorView()).removeView(this.customView);
this.customView = null;
this.customViewCallback.onCustomViewHidden();
}
@Override
public void onShowCustomView(View view, CustomViewCallbackWrapper customViewCallbackWrapper) {
if (this.customView != null) {
customViewCallbackWrapper.onCustomViewHidden();
return;
}
setRequestedOrientation(0);
((FrameLayout) getWindow().getDecorView()).addView(view, new FrameLayout.LayoutParams(-1, -1));
this.customPaddingRight = view.getPaddingRight();
view.setPadding(view.getPaddingLeft(), view.getPaddingTop(), Math.max(ScreenUtils.getNavigationBarHeight(getActivity()), view.getPaddingRight()), view.getPaddingBottom());
this.customView = view;
view.setBackgroundResource(android.R.color.black);
this.customViewCallback = customViewCallbackWrapper;
}
public class ItemRecod {
int height = 0;
int f1212top = 0;
public ItemRecod() {
}
}
}