柬埔寨通 v6.1.5版本的 MD5 值为:9b68581ac30883219d6a25858a099d6b
以下内容为反编译后的 LiveDetailActivity.java 源代码,内容仅作参考
package net.duohuo.magappx.live;
import android.app.ActionBar;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Color;
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.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.BounceInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.widget.ImageView;
import android.widget.SeekBar;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentPagerAdapter;
import androidx.viewpager.widget.ViewPager;
import butterknife.BindView;
import butterknife.OnClick;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alipay.sdk.m.p0.b;
import com.aliyun.player.IPlayer;
import com.aliyun.player.aliyunplayer.theme.Theme;
import com.aliyun.player.aliyunplayer.util.AliyunScreenMode;
import com.aliyun.player.aliyunplayer.view.control.ControlView;
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.uc.crashsdk.export.LogType;
import com.umeng.analytics.pro.as;
import com.yhao.floatwindow.FloatWindow;
import com.yhao.floatwindow.IFloatWindow;
import com.yhao.floatwindow.PermissionListener;
import com.yhao.floatwindow.ViewStateListener;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import master.flame.danmaku.controller.DrawHandler;
import master.flame.danmaku.danmaku.model.BaseDanmaku;
import master.flame.danmaku.danmaku.model.DanmakuTimer;
import master.flame.danmaku.danmaku.model.android.BaseCacheStuffer;
import master.flame.danmaku.danmaku.model.android.DanmakuContext;
import master.flame.danmaku.danmaku.model.android.Danmakus;
import master.flame.danmaku.danmaku.model.android.SpannedCacheStuffer;
import master.flame.danmaku.danmaku.parser.BaseDanmakuParser;
import master.flame.danmaku.ui.widget.DanmakuView;
import net.duohuo.core.annotation.Extra;
import net.duohuo.core.dialog.DialogCallBack;
import net.duohuo.core.dialog.IDialog;
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.UrlScheme;
import net.duohuo.magappx.chat.util.OnClickUtil;
import net.duohuo.magappx.common.base.MagBaseActivity;
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.util.Constants;
import net.duohuo.magappx.common.util.LoginHintUtil;
import net.duohuo.magappx.common.util.UrlUtils;
import net.duohuo.magappx.live.LiveTimer;
import net.duohuo.magappx.live.SendLiveMsgActivity;
import net.duohuo.magappx.live.fragment.LiveDesFragment;
import net.duohuo.magappx.live.fragment.LiveInteractFragment;
import net.duohuo.magappx.live.fragment.LivePicTextFragment;
import net.duohuo.magappx.main.login.UserApi;
import net.duohuo.magappx.main.login.model.UserPreference;
import net.duohuo.magappx.video.model.VideoDetailItem;
import net.duohuo.magappx.video.videoplay.VideoPlayActivity;
import net.duohuo.magappx.video.videorecord.ShotVideoActivity;
import net.duohuo.magappx.video.videorecord.VideoRecordActivity;
import net.lucode.hackware.magicindicator.MagicIndicator;
import net.lucode.hackware.magicindicator.ViewPagerHelper;
import net.lucode.hackware.magicindicator.buildins.UIUtil;
import net.lucode.hackware.magicindicator.buildins.commonnavigator.CommonNavigator;
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.CommonNavigatorAdapter;
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IPagerIndicator;
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IPagerTitleView;
import net.lucode.hackware.magicindicator.buildins.commonnavigator.indicators.LinePagerIndicator;
import net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.ScaleTransitionPagerTitleView;
public class LiveDetailActivity extends MagBaseActivity implements AudioManager.OnAudioFocusChangeListener {
private static final int MSG_VIDEO_RECORD_CHECK = 10000;
private static final int REQUEST_OVERLAY = 5004;
public static final String kuniu = "com.kuniu.app";
AliyunScreenMode aliyunScreenMode;
AliyunVodPlayerView aliyunVodPlayerView;
@BindView(R.id.applauds_icon)
ImageView applaudsIconV;
@BindView(R.id.blank_for_statue2)
View blankForStatue2V;
@BindView(R.id.blank_for_statue)
View blankForStatueV;
@BindView(R.id.buycount)
TextView buycountV;
Collect collect;
@BindView(R.id.comment)
TextView commentV;
@Extra(def = "")
String contentId;
@BindView(R.id.definition_h)
View definitionHV;
@BindView(R.id.definition_v)
View definitionVV;
@BindView(R.id.definition_h_h)
TextView definition_h_h;
@BindView(R.id.definition_h_l)
TextView definition_h_l;
@BindView(R.id.definition_v_h)
TextView definition_v_h;
@BindView(R.id.definition_v_l)
TextView definition_v_l;
@BindView(R.id.error_tip)
View errorTipV;
@BindView(R.id.estoppel)
View estoppelV;
@BindView(R.id.head)
FrescoImageView headV;
VideoDetailItem.Info infoData;
boolean isClickVip;
boolean isTrySee;
LiveInteractFragment liveInteractFragment;
private AudioManager mAudioManager;
private DanmakuContext mContext;
@BindView(R.id.sv_danmaku)
DanmakuView mDanmakuView;
@BindView(R.id.magicIndicator)
MagicIndicator magicIndicator;
VideoDetailItem model;
@BindView(R.id.viewpager)
ViewPager pageView;
ViewGroup.LayoutParams params;
@Extra(def = "")
String pic;
@BindView(R.id.purchase)
TextView purchaseV;
@BindView(R.id.seecount)
TextView seeCountV;
@BindView(R.id.seek_bar)
SeekBar seekBar;
String source;
@BindView(R.id.try_see)
TextView trySeeV;
@Extra(def = "")
String videoPath;
@BindView(R.id.video_pay_box)
ViewGroup videoPayBoxV;
@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;
@BindView(R.id.zan_number)
TextView zanNumberV;
int position = 0;
boolean is_live_auth = false;
String sec_pca = "";
boolean hasPlay = false;
private int mAudioFocus = -1;
boolean isApplaud = false;
int applaudCount = 0;
int commentCount = 0;
String link = "";
String albumName = "";
Share share = new Share();
boolean started = false;
String channelId = "";
private BaseCacheStuffer.Proxy mCacheStufferAdapter = new BaseCacheStuffer.Proxy() {
@Override
public void prepareDrawing(BaseDanmaku baseDanmaku, boolean z) {
}
@Override
public void releaseResource(BaseDanmaku baseDanmaku) {
}
};
boolean isHighDefinition = true;
UrlSource urlSource = new UrlSource();
private boolean portrait = true;
int floatView = 0;
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 (LiveDetailActivity.this.videoView != null) {
LiveDetailActivity.this.videoView.onDestroy();
}
if (LiveDetailActivity.this.aliyunVodPlayerView != null) {
LiveDetailActivity.this.aliyunVodPlayerView.onDestroy();
}
LiveDetailActivity.this.giveUpAudioFocus();
}
};
public int estoppel_type = 0;
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", LiveDetailActivity.this.contentId).post(new Task<Result>() {
@Override
public void onResult(Result result) {
if (!LiveDetailActivity.this.isFinishing() && result.success()) {
if (LiveDetailActivity.this.videoView != null && UserApi.checkLogin()) {
if (SafeJsonUtil.getBoolean(result.getData(), "is_inscreen_record")) {
String string = SafeJsonUtil.getString(result.getData(), "video_watermark_txt");
if (LiveDetailActivity.this.isAutoWatermark && !TextUtils.isEmpty(string)) {
UserPreference userPreference = (UserPreference) Ioc.get(UserPreference.class);
LiveDetailActivity.this.videoView.startVideoWatermark(string.replace("{user_name}", userPreference.name).replace("{uid}", userPreference.userId + "").replace("{phone_number}", userPreference.phone));
}
} else {
LiveDetailActivity.this.videoView.removeVideoWatermark();
}
}
if (SafeJsonUtil.getInteger(result.getData(), "prevent_screen") == 1) {
LiveDetailActivity.this.getWindow().addFlags(8192);
}
if (SafeJsonUtil.getBoolean(result.getData(), "is_limit_tuorist") && !UserApi.checkLogin()) {
if (LiveDetailActivity.this.videoView != null) {
LiveDetailActivity.this.videoView.pause();
}
LoginHintUtil.showLoginHint(LiveDetailActivity.this);
}
if (SafeJsonUtil.getBoolean(result.getData(), "is_need_refresh") && LiveDetailActivity.this.infoData != null && LiveDetailActivity.this.infoData.isCan_view()) {
if (LiveDetailActivity.this.videoView != null) {
LiveDetailActivity.this.videoView.pause();
LiveDetailActivity.this.videoView.lockScreen(false);
if (LiveDetailActivity.this.videoView.getmCurrentScreenMode() == AliyunScreenMode.Full) {
LiveDetailActivity.this.videoView.changedToPortrait(true);
}
}
LiveDetailActivity.this.getNetData(false);
}
}
}
});
sendEmptyMessageDelayed(10000, 60000L);
}
}
};
private void configMediaPlayerState() {
}
private void setPlayerHeight(boolean z) {
}
public void sendMsg() {
}
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.activity_live_detial);
findViewById(R.id.blank_for_statue).setBackgroundColor(-16777216);
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) {
}
}
findViewById(R.id.navi_action).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (LiveDetailActivity.this.share == null || LiveDetailActivity.this.model == null || LiveDetailActivity.this.errorTipV.getVisibility() == 0) {
LiveDetailActivity.this.showToast("数据加载中,请稍后再试...");
return;
}
SharePopWindow sharePopWindow = new SharePopWindow(LiveDetailActivity.this.getActivity());
sharePopWindow.setShare(LiveDetailActivity.this.share);
if (LiveDetailActivity.this.collect != null) {
sharePopWindow.setCollect(LiveDetailActivity.this.collect);
sharePopWindow.showCollect();
}
sharePopWindow.hideShareCard();
sharePopWindow.hideReport();
sharePopWindow.showWordOfCommand();
sharePopWindow.show(LiveDetailActivity.this.getActivity());
sharePopWindow.hideRefresh();
sharePopWindow.setCallBack(new SharePopWindow.CallBack() {
@Override
public void onRefresh() {
LiveDetailActivity.this.getNetData(false);
}
});
}
});
postDelay(new Runnable() {
@Override
public void run() {
LiveDetailActivity.this.setSwipeBackEnable(false);
}
}, 3000L);
this.aliyunScreenMode = AliyunScreenMode.Small;
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 || LiveDetailActivity.this.videoView == null) {
return;
}
LiveDetailActivity.this.videoView.onStop();
}
});
}
}
}
}
} catch (Exception unused2) {
}
this.videoView.getmOrientationWatchDog().stopWatch();
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);
ViewGroup.LayoutParams layoutParams3 = this.mDanmakuView.getLayoutParams();
layoutParams3.height = this.params.height / 3;
this.mDanmakuView.setLayoutParams(layoutParams3);
ViewGroup viewGroup2 = (ViewGroup) LayoutInflater.from(getActivity()).inflate(R.layout.placehoder_view, (ViewGroup) null).findViewById(R.id.placeholder);
ViewGroup.LayoutParams layoutParams4 = viewGroup2.getLayoutParams();
layoutParams4.height = this.params.height;
viewGroup2.setLayoutParams(layoutParams4);
this.videoView.setPlaceholder(viewGroup2);
ViewGroup.LayoutParams layoutParams5 = this.videolayoutV.getLayoutParams();
layoutParams5.height = this.params.height;
layoutParams5.width = IUtil.getDisplayWidth();
this.videolayoutV.setLayoutParams(layoutParams5);
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) {
LiveDetailActivity.this.aliyunScreenMode = aliyunScreenMode;
}
});
new LiveTimer(getLifecycle(), 20, new LiveTimer.TaskCallback() {
@Override
public void onTask() {
LiveDetailActivity.this.getRoomInfo();
if (LiveDetailActivity.this.liveInteractFragment != null) {
LiveDetailActivity.this.liveInteractFragment.websocketCheck();
}
}
});
this.mHandler.sendEmptyMessageDelayed(10000, 1000L);
HashMap hashMap = new HashMap();
hashMap.put(1, 2);
hashMap.put(6, 2);
HashMap hashMap2 = new HashMap();
hashMap2.put(1, true);
hashMap2.put(5, true);
this.mDanmakuView = (DanmakuView) findViewById(R.id.sv_danmaku);
DanmakuContext create = DanmakuContext.create();
this.mContext = create;
create.setDanmakuStyle(2, 3.0f).setDuplicateMergingEnabled(false).setScrollSpeedFactor(1.2f).setScaleTextSize(1.2f).setCacheStuffer(new SpannedCacheStuffer(), this.mCacheStufferAdapter).setMaximumLines(hashMap).preventOverlapping(hashMap2).setDanmakuMargin(40);
this.mDanmakuView.setCallback(new DrawHandler.Callback() {
@Override
public void danmakuShown(BaseDanmaku baseDanmaku) {
}
@Override
public void drawingFinished() {
}
@Override
public void updateTimer(DanmakuTimer danmakuTimer) {
}
@Override
public void prepared() {
LiveDetailActivity.this.mDanmakuView.start();
}
});
this.mDanmakuView.prepare(new BaseDanmakuParser() {
@Override
public Danmakus parse() {
return new Danmakus();
}
}, this.mContext);
this.mDanmakuView.showFPS(false);
this.mDanmakuView.enableDanmakuDrawingCache(true);
getNetData(true);
if (AndroidDeviceIMEIUtil.isRunOnEmulator(getActivity()) && getPackageName().equals(kuniu)) {
showToast("请勿在模拟器使用该功能");
finish();
}
}
public void setDefinitionBtn() {
if (this.isHighDefinition) {
this.definition_h_h.setTextColor(Color.parseColor("#FFA857"));
this.definition_v_h.setTextColor(Color.parseColor("#FFA857"));
this.definition_h_l.setTextColor(Color.parseColor("#ffffff"));
this.definition_v_l.setTextColor(Color.parseColor("#ffffff"));
this.definition_h_h.setBackgroundResource(R.drawable.bg_live_definition_s);
this.definition_v_h.setBackgroundResource(R.drawable.bg_live_definition_s);
this.definition_h_l.setBackgroundResource(R.drawable.bg_live_definition_n);
this.definition_v_l.setBackgroundResource(R.drawable.bg_live_definition_n);
return;
}
this.definition_h_l.setTextColor(Color.parseColor("#FFA857"));
this.definition_v_l.setTextColor(Color.parseColor("#FFA857"));
this.definition_h_h.setTextColor(Color.parseColor("#ffffff"));
this.definition_v_h.setTextColor(Color.parseColor("#ffffff"));
this.definition_h_l.setBackgroundResource(R.drawable.bg_live_definition_s);
this.definition_v_l.setBackgroundResource(R.drawable.bg_live_definition_s);
this.definition_h_h.setBackgroundResource(R.drawable.bg_live_definition_n);
this.definition_v_h.setBackgroundResource(R.drawable.bg_live_definition_n);
}
public void hideDefinitionLayout() {
this.definitionHV.setVisibility(8);
this.definitionVV.setVisibility(8);
}
public void setVideo(final String str, String str2) {
findViewById(R.id.navi_action).setVisibility(this.portrait ? 0 : 8);
findViewById(R.id.navi_action_second).setVisibility(0);
this.videoView.clearFocus();
this.videoView.setShowReplay(true);
this.videoView.setKeepScreenOn(true);
this.videoView.setTheme(Theme.Red);
this.videoView.setScaleMode(IPlayer.ScaleMode.SCALE_ASPECT_FIT);
this.videoView.getmOrientationWatchDog().startWatch();
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);
}
postDelay(new Runnable() {
@Override
public void run() {
LiveDetailActivity.this.videoView.setLocalSource(LiveDetailActivity.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", LiveDetailActivity.this.contentId);
url.get(new Task<Result>() {
@Override
public void onResult(Result result) {
if (result.success()) {
JSONObject jSONObject = SafeJsonUtil.getJSONObject(result.json(), Constants.PAGE_INFO);
JSONObject jSONObject2 = new JSONObject();
JSONArray list = result.getList();
LiveDetailActivity.this.link = result.get("album_link") == null ? "" : result.get("album_link").toString();
LiveDetailActivity.this.albumName = result.get("album_name") != null ? result.get("album_name").toString() : "";
jSONObject.put("link", (Object) LiveDetailActivity.this.link);
jSONObject2.put("list", (Object) list);
jSONObject2.put(Constants.PAGE_INFO, (Object) jSONObject);
jSONObject2.put("album_name", (Object) LiveDetailActivity.this.albumName);
jSONObject2.put("album_link", (Object) LiveDetailActivity.this.link);
LiveDetailActivity.this.model = (VideoDetailItem) JSON.parseObject(jSONObject2.toJSONString(), VideoDetailItem.class);
LiveDetailActivity.this.infoData = LiveDetailActivity.this.model.getInfo();
LiveDetailActivity.this.is_live_auth = "1".equals(SafeJsonUtil.getString(jSONObject, "is_live_auth"));
LiveDetailActivity.this.sec_pca = SafeJsonUtil.getString(jSONObject, "sec_pca");
if (LiveDetailActivity.this.isTrySee) {
LiveDetailActivity.this.videoPath = LiveDetailActivity.this.model.getInfo().getTry_see_video_url();
} else {
LiveDetailActivity.this.videoPath = LiveDetailActivity.this.isHighDefinition ? LiveDetailActivity.this.model.getInfo().getVideoUrl() : LiveDetailActivity.this.model.getInfo().low_definition_url;
}
LiveDetailActivity.this.setVideo(str, LiveDetailActivity.this.videoPath);
}
}
});
}
@Override
public void onReplay() {
if (LiveDetailActivity.this.videoView != null) {
LiveDetailActivity.this.videoView.rePlay();
}
}
});
this.videoView.setOnPreparedListener(new IPlayer.OnPreparedListener() {
@Override
public void onPrepared() {
LiveDetailActivity.this.videoView.setSeekBar(LiveDetailActivity.this.seekBar);
}
});
this.videoView.setOnFirstFrameStartListener(new IPlayer.OnRenderingStartListener() {
@Override
public void onRenderingStart() {
if (LiveDetailActivity.this.position != 0) {
LiveDetailActivity.this.videoView.seekTo(LiveDetailActivity.this.position);
}
}
});
this.videoView.setOnCompletionListener(new IPlayer.OnCompletionListener() {
@Override
public void onCompletion() {
LiveDetailActivity.this.position = 0;
if (LiveDetailActivity.this.isTrySee) {
LiveDetailActivity.this.infoData.setHasTry(true);
LiveDetailActivity.this.isTrySee = false;
LiveDetailActivity.this.setVipBox();
}
}
});
this.videoView.setOnVideoPlayerStateChangedListener(new AliyunVodPlayerView.OnVideoPlayerStateChangedListener() {
@Override
public void onVideoState(int i) {
if (i == 3) {
LiveDetailActivity.this.started = true;
} else if (i == 4 || i == 6) {
LiveDetailActivity.this.started = false;
}
if (i != 3 || LiveDetailActivity.this.aliyunVodPlayerView == null) {
return;
}
LiveDetailActivity.this.aliyunVodPlayerView.onStop();
}
});
}
private void tryToGetAudioFocus() {
AudioManager audioManager = this.mAudioManager;
if (audioManager == null) {
onAudioFocusChange(1);
} else if (audioManager.requestAudioFocus(this, 3, 1) == 1) {
this.mAudioFocus = 1;
}
}
@Override
public void onConfigurationChanged(Configuration configuration) {
super.onConfigurationChanged(configuration);
hideDefinitionLayout();
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);
}
@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) {
this.videoView.changedToPortrait(true);
return;
} else {
onfinish();
return;
}
}
onfinish();
}
public void onfinish() {
finish();
}
@Override
public void onBackPressed() {
naviBackFinish();
}
public void setVipBox() {
if (this.infoData != null) {
this.videoView.setPlayStyle("1");
setPlayerHeight(false);
if (this.infoData.isIs_free()) {
this.videoPath = this.isHighDefinition ? this.infoData.getVideoUrl() : this.infoData.low_definition_url;
setDefinitionSwitch(false);
setVideo(this.pic, this.videoPath);
this.vipBoxV.setVisibility(8);
if (this.videoView.getControlView().isDanmuOpen()) {
this.mDanmakuView.show();
return;
}
return;
}
this.videoView.getmOrientationWatchDog().stopWatch();
findViewById(R.id.navi_action).setVisibility(8);
this.vipBoxV.setVisibility(0);
this.mDanmakuView.hide();
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 videoOccurError() {
this.videoView.onStop();
this.errorTipV.setVisibility(0);
}
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 + "://liveContent?contentId=" + this.contentId;
this.share.originalUrl = UrlScheme.appcode + "://liveContent?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 + "://liveContent?contentId=" + this.contentId);
}
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);
destroyFloatWindow();
return;
}
getWindow().clearFlags(1024);
this.videoView.setSystemUiVisibility(0);
findViewById(R.id.comment_bar).setVisibility(0);
}
private void destroyFloatWindow() {
try {
Iterator<String> it = FloatWindow.mFloatWindowMap.keySet().iterator();
while (it.hasNext()) {
FloatWindow.destroy(it.next());
}
} catch (Exception unused) {
}
}
@Override
public void onAudioFocusChange(int i) {
this.mAudioFocus = i;
configMediaPlayerState();
}
public class AnonymousClass15 extends UserApi.LoginCallBack {
AnonymousClass15() {
}
@Override
public void onLogin() {
((IDialog) Ioc.get(IDialog.class)).showDialog(LiveDetailActivity.this.getActivity(), "提示", "确定购买?", new DialogCallBack() {
@Override
public void onClick(int i) {
if (i == -1) {
Net url = Net.url(LiveDetailActivity.this.infoData.getOrder_link());
url.showProgress(false);
url.get(new Task<Result>() {
@Override
public void onResult(Result result) {
if (result.success()) {
LiveDetailActivity.this.getNetData(false);
} else {
LiveDetailActivity.this.isClickVip = true;
}
}
});
}
}
});
}
}
@OnClick({R.id.purchase})
public void purchaseClick() {
if (this.infoData != null) {
UserApi.afterLogin(getActivity(), new AnonymousClass15());
}
}
@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) {
LiveDetailActivity.this.startActivityForResult(new Intent("android.settings.action.MANAGE_OVERLAY_PERMISSION", Uri.parse("package:" + LiveDetailActivity.this.getPackageName())), 5004);
}
}
}).show();
return;
} else {
setFloatView();
return;
}
}
setFloatView();
}
private void setFloatView() {
destroyFloatWindow();
int displayWidth = (IUtil.getDisplayWidth() * 261) / 375;
int 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(false);
this.videolayoutV.removeView(this.videoView);
if (this.videoView.getmOrientationWatchDog() != null) {
this.videoView.getmOrientationWatchDog().stopWatch();
}
this.videoView.prohibitOther(this.contentId, getActivity(), "1");
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("请先申请悬浮窗权限");
}
}
}
@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);
if (this.videoView.getControlView().isDanmuOpen()) {
this.mDanmakuView.show();
}
setDefinitionSwitch(true);
setVideo(this.pic, this.videoPath);
}
}
@OnClick({R.id.vip_play})
public void vipPlayClick() {
VideoDetailItem.Info info = this.infoData;
if (info != null) {
this.videoPath = this.isHighDefinition ? info.getVideoUrl() : info.low_definition_url;
this.vipBoxV.setVisibility(8);
if (this.videoView.getControlView().isDanmuOpen()) {
this.mDanmakuView.show();
}
setDefinitionSwitch(false);
setVideo(this.pic, this.videoPath);
}
}
@OnClick({R.id.applauds_icon})
public void setApplaudIconVClick(View view) {
if (OnClickUtil.isFastDoubleClick()) {
return;
}
UserApi.afterLogin(getActivity(), new UserApi.LoginCallBack() {
@Override
public void onLogin() {
Net url = Net.url(LiveDetailActivity.this.isApplaud ? API.Video.contentCancelApplaud : API.Video.contentAddApplaud);
url.param("content_id", LiveDetailActivity.this.contentId);
url.post(new Task<Result>() {
@Override
public void onResult(Result result) {
if (result.success()) {
LiveDetailActivity.this.applaudCount = LiveDetailActivity.this.isApplaud ? LiveDetailActivity.this.applaudCount - 1 : LiveDetailActivity.this.applaudCount + 1;
LiveDetailActivity.this.isApplaud = !LiveDetailActivity.this.isApplaud;
LiveDetailActivity.this.applaudsIconV.setImageResource(!LiveDetailActivity.this.isApplaud ? R.drawable.toolbar_icon_praise_n : R.drawable.toolbar_icon_praise_f);
LiveDetailActivity.this.zanNumberV.setText(LiveDetailActivity.this.applaudCount + "");
LiveDetailActivity.this.zanNumberV.setVisibility(LiveDetailActivity.this.applaudCount > 0 ? 0 : 8);
}
}
});
}
});
}
@OnClick({R.id.share_icon})
public void onShareClick(View view) {
if (this.share == null || this.model == null) {
showToast("数据加载中,请稍后再试...");
return;
}
SharePopWindow sharePopWindow = new SharePopWindow(getActivity());
sharePopWindow.setShare(this.share);
sharePopWindow.hideShareCard();
sharePopWindow.hideOtherFunction();
sharePopWindow.show(getActivity());
}
@Override
public void onResume() {
super.onResume();
if (UserApi.checkLogin()) {
this.headV.loadView(((UserPreference) Ioc.get(UserPreference.class)).head, R.color.image_def, (Boolean) true);
} else {
this.headV.loadView("", R.drawable.head_default);
}
AliyunVodPlayerView aliyunVodPlayerView = this.videoView;
if (aliyunVodPlayerView != null) {
aliyunVodPlayerView.onResume();
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(false);
}
}
public void getNetData(boolean z) {
Net url = Net.url(API.Video.videoDetail2);
url.param("video_content_id", this.contentId);
url.get(new AnonymousClass18(z));
}
public class AnonymousClass18 extends Task<Result> {
final boolean val$buildCoumn;
AnonymousClass18(boolean z) {
this.val$buildCoumn = z;
}
@Override
public void onResult(Result result) {
if (result.success()) {
JSONObject jSONObject = SafeJsonUtil.getJSONObject(result.json(), Constants.PAGE_INFO);
LiveDetailActivity.this.seeCountV.setText(SafeJsonUtil.getString(result.json(), "info.play_num_"));
if (SafeJsonUtil.getInteger(result.json(), "info.buy_count") > 0) {
LiveDetailActivity.this.buycountV.setText("报名人数:" + SafeJsonUtil.getString(result.json(), "info.buy_count"));
LiveDetailActivity.this.buycountV.setVisibility(0);
} else {
LiveDetailActivity.this.buycountV.setVisibility(8);
}
LiveDetailActivity.this.isApplaud = "1".equals(SafeJsonUtil.getString(result.json(), "info.is_praise"));
LiveDetailActivity.this.channelId = SafeJsonUtil.getString(jSONObject, "live_code");
LiveDetailActivity.this.applaudsIconV.setImageResource(!LiveDetailActivity.this.isApplaud ? R.drawable.toolbar_icon_praise_n : R.drawable.toolbar_icon_praise_f);
LiveDetailActivity.this.applaudCount = SafeJsonUtil.getInteger(jSONObject, "praise_num");
LiveDetailActivity.this.zanNumberV.setText(LiveDetailActivity.this.applaudCount + "");
LiveDetailActivity.this.zanNumberV.setVisibility(LiveDetailActivity.this.applaudCount > 0 ? 0 : 8);
JSONObject jSONObject2 = new JSONObject();
JSONArray list = result.getList();
LiveDetailActivity.this.is_live_auth = "1".equals(SafeJsonUtil.getString(jSONObject, "is_live_auth"));
LiveDetailActivity.this.sec_pca = SafeJsonUtil.getString(jSONObject, "sec_pca");
LiveDetailActivity.this.aliyunScreenMode = AliyunScreenMode.Small;
LiveDetailActivity.this.link = result.get("album_link") == null ? "" : result.get("album_link").toString();
LiveDetailActivity.this.albumName = result.get("album_name") != null ? result.get("album_name").toString() : "";
if (jSONObject != null) {
jSONObject.put("link", (Object) LiveDetailActivity.this.link);
LiveDetailActivity.this.commentCount = Integer.parseInt(result.get("comment_count") == null ? "0" : result.get("comment_count").toString());
LiveDetailActivity.this.applaudCount = Integer.parseInt(result.get("applaud_count") != null ? result.get("applaud_count").toString() : "0");
jSONObject2.put("list", (Object) list);
jSONObject2.put(Constants.PAGE_INFO, (Object) jSONObject);
jSONObject2.put("album_name", (Object) LiveDetailActivity.this.albumName);
jSONObject2.put("album_link", (Object) LiveDetailActivity.this.link);
LiveDetailActivity.this.model = (VideoDetailItem) JSON.parseObject(jSONObject2.toJSONString(), VideoDetailItem.class);
LiveDetailActivity liveDetailActivity = LiveDetailActivity.this;
liveDetailActivity.contentId = liveDetailActivity.model.getInfo().getVideoContentId();
LiveDetailActivity.this.videoView.setVisibility(0);
LiveDetailActivity.this.errorTipV.setVisibility(8);
LiveDetailActivity.this.findViewById(R.id.comment_bar).setVisibility(0);
LiveDetailActivity liveDetailActivity2 = LiveDetailActivity.this;
liveDetailActivity2.isApplaud = liveDetailActivity2.model.getInfo().getIsPraise() == 1;
LiveDetailActivity.this.setShareData();
LiveDetailActivity liveDetailActivity3 = LiveDetailActivity.this;
liveDetailActivity3.pic = liveDetailActivity3.model.getInfo().getCoverPicTburl();
LiveDetailActivity.this.findViewById(R.id.navi_action_second).setVisibility(8);
LiveDetailActivity.this.videoView.setVisibility(0);
LiveDetailActivity liveDetailActivity4 = LiveDetailActivity.this;
liveDetailActivity4.infoData = liveDetailActivity4.model.getInfo();
if ("1".equals(LiveDetailActivity.this.infoData.open_more_quality) && "2".equals(LiveDetailActivity.this.infoData.default_quality) && !TextUtils.isEmpty(LiveDetailActivity.this.infoData.low_definition_url)) {
LiveDetailActivity.this.isHighDefinition = false;
}
LiveDetailActivity.this.videoView.getControlView().setDefinitionMode(LiveDetailActivity.this.isHighDefinition);
LiveDetailActivity.this.videoView.getControlView().hideSpeed();
LiveDetailActivity.this.setVipBox();
if ("1".equals(LiveDetailActivity.this.infoData.open_bullet_chat)) {
LiveDetailActivity.this.videoView.getControlView().setDanmuCallback(new ControlView.DanmuStateCallback() {
@Override
public void onChange(boolean z) {
if (z) {
LiveDetailActivity.this.mDanmakuView.show();
} else {
LiveDetailActivity.this.mDanmakuView.hide();
}
}
});
}
LiveDetailActivity.this.videoView.getControlView().setDefinitionClickCallback(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (LiveDetailActivity.this.portrait) {
LiveDetailActivity.this.definitionHV.setVisibility(0);
} else {
LiveDetailActivity.this.definitionVV.setVisibility(0);
}
LiveDetailActivity.this.videoView.postDelayed(new Runnable() {
@Override
public void run() {
LiveDetailActivity.this.hideDefinitionLayout();
}
}, 3000L);
LiveDetailActivity.this.setDefinitionBtn();
}
});
} else {
jSONObject2.put("list", (Object) list);
jSONObject2.put(Constants.PAGE_INFO, (Object) jSONObject);
jSONObject2.put("album_name", (Object) LiveDetailActivity.this.albumName);
jSONObject2.put("album_link", (Object) LiveDetailActivity.this.link);
LiveDetailActivity.this.model = (VideoDetailItem) JSON.parseObject(jSONObject2.toJSONString(), VideoDetailItem.class);
LiveDetailActivity.this.setShareData();
LiveDetailActivity.this.videoView.setVisibility(8);
LiveDetailActivity.this.errorTipV.setVisibility(0);
LiveDetailActivity.this.videoOccurError();
LiveDetailActivity.this.findViewById(R.id.comment_bar).setVisibility(8);
}
if (this.val$buildCoumn) {
LiveDetailActivity.this.buildColum(result);
}
}
}
}
public void buildColum(final Result result) {
final JSONArray jSONArray = SafeJsonUtil.getJSONArray(result.json(), "columns");
int i = 0;
for (int i2 = 0; i2 < jSONArray.size(); i2++) {
if (1 == SafeJsonUtil.getInteger(SafeJsonUtil.getJSONObjectFromArray(jSONArray, i2), "is_default")) {
i = i2;
}
}
CommonNavigator commonNavigator = new CommonNavigator(getActivity());
commonNavigator.setAdapter(new CommonNavigatorAdapter() {
@Override
public int getCount() {
return jSONArray.size();
}
@Override
public IPagerTitleView getTitleView(Context context, final int i3) {
ScaleTransitionPagerTitleView scaleTransitionPagerTitleView = new ScaleTransitionPagerTitleView(context);
int dip2px = UIUtil.dip2px(context, 20.0d);
scaleTransitionPagerTitleView.setPadding(dip2px, 0, dip2px, 0);
scaleTransitionPagerTitleView.setText(SafeJsonUtil.getString(SafeJsonUtil.getJSONObjectFromArray(jSONArray, i3), "name"));
scaleTransitionPagerTitleView.setTextSize(2, 15.0f);
scaleTransitionPagerTitleView.setMinScale(0.9f);
scaleTransitionPagerTitleView.setNormalColor(LiveDetailActivity.this.getResources().getColor(R.color.grey_dark));
scaleTransitionPagerTitleView.setSelectedColor(LiveDetailActivity.this.getResources().getColor(R.color.link));
scaleTransitionPagerTitleView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
LiveDetailActivity.this.pageView.setCurrentItem(i3);
}
});
return scaleTransitionPagerTitleView;
}
@Override
public IPagerIndicator getIndicator(Context context) {
LinePagerIndicator linePagerIndicator = new LinePagerIndicator(context);
linePagerIndicator.setMode(2);
linePagerIndicator.setLineHeight(UIUtil.dip2px(context, 2.0d));
linePagerIndicator.setLineWidth(UIUtil.dip2px(context, 20.0d));
linePagerIndicator.setRoundRadius(UIUtil.dip2px(context, 1.0d));
linePagerIndicator.setStartInterpolator(new AccelerateInterpolator());
linePagerIndicator.setEndInterpolator(new DecelerateInterpolator(2.0f));
linePagerIndicator.setColors(Integer.valueOf(ContextCompat.getColor(LiveDetailActivity.this.getActivity(), R.color.link)));
return linePagerIndicator;
}
});
this.magicIndicator.setNavigator(commonNavigator);
commonNavigator.getTitleContainer().setShowDividers(2);
ViewPagerHelper.bind(this.magicIndicator, this.pageView);
this.pageView.setAdapter(new FragmentPagerAdapter(getSupportFragmentManager()) {
@Override
public Fragment getItem(int i3) {
JSONObject jSONObject = SafeJsonUtil.getJSONObject(result.json(), Constants.PAGE_INFO);
int integer = SafeJsonUtil.getInteger(SafeJsonUtil.getJSONObjectFromArray(jSONArray, i3), "type");
if (integer == 1) {
LiveDetailActivity liveDetailActivity = LiveDetailActivity.this;
LiveInteractFragment liveInteractFragment = new LiveInteractFragment(LiveDetailActivity.this.channelId, SafeJsonUtil.getString(jSONObject, "notice"));
liveDetailActivity.liveInteractFragment = liveInteractFragment;
return liveInteractFragment;
}
if (integer == 2) {
return new LiveDesFragment(SafeJsonUtil.getString(jSONObject, "title"), SafeJsonUtil.getString(jSONObject, "desc"));
}
if (integer == 3) {
return new LivePicTextFragment(LiveDetailActivity.this.contentId);
}
return new Fragment();
}
@Override
public int getCount() {
return jSONArray.size();
}
});
this.pageView.setOffscreenPageLimit(5);
this.pageView.setCurrentItem(i);
}
public void giveUpAudioFocus() {
AudioManager audioManager = this.mAudioManager;
if (audioManager != null && audioManager.abandonAudioFocus(this) == 1) {
this.mAudioFocus = -1;
}
}
@Override
public void onDestroy() {
super.onDestroy();
if (this.floatView == 0) {
this.videoView.onDestroy();
giveUpAudioFocus();
}
DanmakuView danmakuView = this.mDanmakuView;
if (danmakuView != null) {
danmakuView.release();
this.mDanmakuView = null;
}
this.mHandler.removeMessages(10000);
}
public void getRoomInfo() {
if (TextUtils.isEmpty(this.channelId)) {
return;
}
Net url = Net.url(API.Video.getRoomInfo);
url.showProgress(false);
url.param("room_id", this.channelId);
url.get(new Task<Result>() {
@Override
public void onResult(Result result) {
if (result.success()) {
if (SafeJsonUtil.getInteger(result.getData(), "can_send") == 2) {
LiveDetailActivity.this.estoppelV.setVisibility(0);
LiveDetailActivity.this.commentV.setText("全员禁言中");
LiveDetailActivity.this.estoppel_type = 1;
} else if (SafeJsonUtil.getInteger(result.getData(), "user_can_say") == 2) {
LiveDetailActivity.this.estoppelV.setVisibility(0);
LiveDetailActivity.this.commentV.setText("你已被禁止发言");
LiveDetailActivity.this.estoppel_type = 2;
} else {
LiveDetailActivity.this.estoppelV.setVisibility(8);
LiveDetailActivity.this.commentV.setText(LiveDetailActivity.this.getResources().getText(R.string.live_bottom_comment));
LiveDetailActivity.this.estoppel_type = 0;
}
}
}
});
}
@OnClick({R.id.comment})
public void onComment(View view) {
if (UserApi.afterLogin(getActivity(), null)) {
toComment("");
}
}
public void toComment(String str) {
VideoDetailItem.Info info;
if (UserApi.afterLogin(getActivity(), null) && (info = this.infoData) != null) {
if (!info.isCan_view()) {
if (this.infoData.isIs_need_order()) {
purchaseClick();
return;
} else {
if (this.infoData.isIs_open_join()) {
vipOpeningClcik();
return;
}
return;
}
}
int i = this.estoppel_type;
if (i == 1) {
showToast("全员禁言中");
return;
}
if (i == 2) {
showToast("你已被禁止发言");
return;
}
Intent intent = new Intent(getActivity(), (Class<?>) SendLiveMsgActivity.class);
SendLiveMsgActivity.commentCallBack = new SendLiveMsgActivity.CommentCallBack() {
@Override
public void onCommentSuccess(String str2) {
Net url = Net.url(API.Video.sendToChannel);
url.param("channel_id", LiveDetailActivity.this.channelId);
JSONObject jSONObject = new JSONObject();
UserPreference userPreference = (UserPreference) Ioc.get(UserPreference.class);
jSONObject.put("type", (Object) "text");
jSONObject.put(b.d, (Object) str2);
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("head", (Object) userPreference.head);
jSONObject2.put("id", (Object) Integer.valueOf(userPreference.userId));
jSONObject2.put("is_vip", (Object) Integer.valueOf(userPreference.is_vip));
jSONObject2.put("vip_name_color", (Object) userPreference.vip_name_color);
jSONObject2.put("name", (Object) userPreference.name);
jSONObject2.put("member_group_ico", (Object) SafeJsonUtil.parseJSONArray(userPreference.member_group_ico));
jSONObject.put(as.m, (Object) jSONObject2);
url.param("content", jSONObject);
url.showProgress(false);
url.postJSON(new Task<Result>() {
@Override
public void onResult(Result result) {
if (LiveDetailActivity.this.liveInteractFragment != null) {
LiveDetailActivity.this.liveInteractFragment.sendMessage();
}
}
});
}
};
intent.putExtra("msg", str);
startActivity(intent);
overridePendingTransition(R.anim.alpha_in, R.anim.alpha_out);
}
}
public void addDanmaKuMsg(CharSequence charSequence, int i) {
if ("1".equals(this.infoData.open_bullet_chat)) {
BaseDanmaku createDanmaku = this.mContext.mDanmakuFactory.createDanmaku(1);
createDanmaku.text = charSequence;
createDanmaku.padding = 5;
createDanmaku.priority = (byte) 1;
createDanmaku.isLive = true;
createDanmaku.setTime(this.mDanmakuView.getCurrentTime() + 1200 + (i * 500));
createDanmaku.textSize = (getResources().getDisplayMetrics().density - 0.6f) * 14.0f;
createDanmaku.textColor = -1;
createDanmaku.textShadowColor = 0;
createDanmaku.underlineColor = 0;
this.mDanmakuView.addDanmaku(createDanmaku);
}
}
@OnClick({R.id.definition_v_h, R.id.definition_v_l, R.id.definition_h_h, R.id.definition_h_l})
public void onDefinitionBtnCllick(View view) {
int id = view.getId();
if (id == R.id.definition_v_h || id == R.id.definition_h_h) {
if (this.isHighDefinition) {
return;
} else {
this.isHighDefinition = true;
}
} else if (!this.isHighDefinition) {
return;
} else {
this.isHighDefinition = false;
}
this.videoView.getControlView().setDefinitionMode(this.isHighDefinition);
hideDefinitionLayout();
VideoDetailItem.Info info = this.infoData;
if (info != null) {
this.videoPath = this.isHighDefinition ? info.getVideoUrl() : info.low_definition_url;
this.position = this.videoView.getVideoPosition();
setVideo(this.pic, this.videoPath);
}
}
public void setDefinitionSwitch(boolean z) {
if (z) {
this.videoView.getControlView().setDefinitionVisible(false);
} else {
this.videoView.getControlView().setDefinitionVisible("1".equals(this.infoData.open_more_quality));
}
}
}