正在查看: 新暖心缘 v8.1.1 应用的 WaitActorActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 新暖心缘 v8.1.1 应用的 WaitActorActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.luanxingyuan.app.activity;
import android.os.CountDownTimer;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import butterknife.BindView;
import butterknife.OnClick;
import com.luanxingyuan.app.base.AppManager;
import com.luanxingyuan.app.base.BaseActivity;
import com.luanxingyuan.app.base.BaseResponse;
import com.luanxingyuan.app.bean.AVChatBean;
import com.luanxingyuan.app.bean.ActorInfoBean;
import com.luanxingyuan.app.bean.AudioUserBean;
import com.luanxingyuan.app.bean.ChargeBean;
import com.luanxingyuan.app.bean.CoverUrlBean;
import com.luanxingyuan.app.bean.InfoRoomBean;
import com.luanxingyuan.app.bean.LabelBean;
import com.luanxingyuan.app.dialog.d0;
import com.luanxingyuan.app.dialog.i0;
import com.luanxingyuan.app.socket.SocketMessageManager;
import com.luanxingyuan.app.socket.domain.SocketResponse;
import com.luanxingyuan.app.util.DevicesUtil;
import com.luanxingyuan.app.util.LogUtil;
import com.luanxingyuan.app.util.ParamUtil;
import com.luanxingyuan.app.util.SoundRing;
import com.luanxingyuan.app.util.ToastUtil;
import com.luanxingyuan.app.util.permission.PermissionUtil;
import com.pili.pldroid.player.widget.PLVideoView;
import java.util.HashMap;
public class WaitActorActivity extends BaseActivity {
private AVChatBean chatBean;
private CountDownTimer mAutoHangUpTimer;
@BindView
ImageView mCameraIv;
@BindView
LinearLayout mCameraLl;
@BindView
TextView mCameraTv;
@BindView
ImageView mContentIv;
@BindView
ImageView mHeadIv;
@BindView
TextView mNameTv;
@BindView
PLVideoView mVideoView;
@BindView
TextView money;
private SoundRing soundRing;
private boolean mNeedPause = true;
int[] Subscriptions = {30005};
q6.a<SocketResponse> subscription = new g();
class a extends r6.a<BaseResponse<ActorInfoBean<CoverUrlBean, LabelBean, ChargeBean, InfoRoomBean>>> {
a() {
}
public void onResponse(BaseResponse<ActorInfoBean<CoverUrlBean, LabelBean, ChargeBean, InfoRoomBean>> baseResponse, int i8) {
TextView textView;
if (baseResponse == null || baseResponse.m_istatus != 1 || WaitActorActivity.this.isFinishing()) {
return;
}
if (baseResponse.m_object.t_role != 1 || (textView = WaitActorActivity.this.money) == null) {
TextView textView2 = WaitActorActivity.this.money;
if (textView2 != null) {
textView2.setVisibility(8);
return;
}
return;
}
textView.setVisibility(0);
WaitActorActivity.this.money.setText("视频通话" + baseResponse.m_object.anchorSetup.get(0).t_video_gold + "金币/分钟");
}
}
class b extends CountDownTimer {
b(long j8, long j9) {
super(j8, j9);
}
@Override
public void onFinish() {
WaitActorActivity.this.hangUp();
}
@Override
public void onTick(long j8) {
}
}
class c extends r6.a<BaseResponse<AudioUserBean>> {
c() {
}
public void onResponse(BaseResponse<AudioUserBean> baseResponse, int i8) {
AudioUserBean audioUserBean;
if (WaitActorActivity.this.isFinishing() || baseResponse == null || baseResponse.m_istatus != 1 || (audioUserBean = baseResponse.m_object) == null) {
return;
}
WaitActorActivity.this.mNameTv.setText(audioUserBean.nickName);
String str = audioUserBean.handImg;
if (TextUtils.isEmpty(str)) {
WaitActorActivity.this.mHeadIv.setImageResource(2131231010);
} else {
int dp2px = DevicesUtil.dp2px(WaitActorActivity.this, 50.0f);
int dp2px2 = DevicesUtil.dp2px(WaitActorActivity.this, 50.0f);
WaitActorActivity waitActorActivity = WaitActorActivity.this;
o6.i.e(waitActorActivity, str, waitActorActivity.mHeadIv, 5, dp2px, dp2px2);
}
String str2 = audioUserBean.t_addres_url;
if (TextUtils.isEmpty(str2)) {
if (TextUtils.isEmpty(audioUserBean.t_cover_img)) {
return;
}
int screenW = DevicesUtil.getScreenW(((BaseActivity) WaitActorActivity.this).mContext);
int screenH = DevicesUtil.getScreenH(((BaseActivity) WaitActorActivity.this).mContext);
if (screenW > 800) {
screenW = (int) (screenW * 0.7d);
screenH = (int) (screenH * 0.7d);
}
o6.i.j(((BaseActivity) WaitActorActivity.this).mContext, audioUserBean.t_cover_img, WaitActorActivity.this.mContentIv, screenW, screenH);
return;
}
String str3 = audioUserBean.t_video_img;
if (!TextUtils.isEmpty(str3)) {
int screenW2 = DevicesUtil.getScreenW(((BaseActivity) WaitActorActivity.this).mContext);
int screenH2 = DevicesUtil.getScreenH(((BaseActivity) WaitActorActivity.this).mContext);
if (screenW2 > 800) {
screenW2 = (int) (screenW2 * 0.7d);
screenH2 = (int) (screenH2 * 0.7d);
}
o6.i.j(((BaseActivity) WaitActorActivity.this).mContext, str3, WaitActorActivity.this.mContentIv, screenW2, screenH2);
}
WaitActorActivity.this.playVideoWithUrl(str2);
}
}
class d implements PermissionUtil.OnPermissionListener {
class a implements q6.a<String> {
a() {
}
@Override
public void execute(String str) {
if (WaitActorActivity.this.isFinishing()) {
return;
}
WaitActorActivity.this.dismissLoadingDialog();
if (TextUtils.isEmpty(str)) {
ToastUtil.showToast("接听失败,请重试");
return;
}
WaitActorActivity.this.chatBean.sign = str;
WaitActorActivity.this.money.setVisibility(8);
WaitActorActivity.this.toVideoChat();
}
}
d() {
}
@Override
public void onPermissionDenied() {
if (WaitActorActivity.this.isFinishing()) {
return;
}
new d0(WaitActorActivity.this).show();
}
@Override
public void onPermissionGranted() {
r6.b.o(WaitActorActivity.this.chatBean.roomId, new a());
}
}
class e extends r6.a<BaseResponse<String>> {
e() {
}
public void onAfter(int i8) {
if (WaitActorActivity.this.isFinishing()) {
return;
}
WaitActorActivity.this.dismissLoadingDialog();
}
public void onResponse(BaseResponse baseResponse, int i8) {
if (WaitActorActivity.this.isFinishing()) {
return;
}
boolean z7 = false;
if (baseResponse != null && baseResponse.m_istatus == 1) {
LogUtil.i("开始计费成功");
VideoChatActivity.start(((BaseActivity) WaitActorActivity.this).mContext, WaitActorActivity.this.chatBean);
WaitActorActivity.this.cancelAutoTimer();
WaitActorActivity.this.finish();
return;
}
if (baseResponse != null) {
int i9 = baseResponse.m_istatus;
if (i9 == -7) {
new i0(WaitActorActivity.this).show();
z7 = true;
} else if (i9 == -1) {
o6.b.a(WaitActorActivity.this);
} else if (!TextUtils.isEmpty(baseResponse.m_strMessage)) {
ToastUtil.showToast(baseResponse.m_strMessage);
}
} else {
ToastUtil.showToast(2131821205);
}
if (z7) {
return;
}
WaitActorActivity.this.cancelAutoTimer();
WaitActorActivity.this.hangUp();
}
}
class f extends r6.a<BaseResponse> {
f() {
}
public void onResponse(BaseResponse baseResponse, int i8) {
}
}
class g implements q6.a<SocketResponse> {
g() {
}
@Override
public void execute(SocketResponse socketResponse) {
if (socketResponse.mid != 30005) {
return;
}
WaitActorActivity.this.onHangUp(socketResponse.roomId, socketResponse.breakUserId);
}
}
public void cancelAutoTimer() {
CountDownTimer countDownTimer = this.mAutoHangUpTimer;
if (countDownTimer != null) {
countDownTimer.cancel();
this.mAutoHangUpTimer = null;
}
}
private void getData() {
HashMap hashMap = new HashMap();
hashMap.put("userId", Integer.valueOf(AppManager.f().k().t_id));
hashMap.put("coverUserId", Integer.valueOf(this.chatBean.otherId));
x7.a.h().a("language", m6.b.f15484u).c(m6.a.r()).e("param", ParamUtil.getParam(hashMap)).f().c(new a());
}
private void getPassUserInfo() {
HashMap hashMap = new HashMap();
hashMap.put("userId", Integer.valueOf(AppManager.f().k().t_id));
hashMap.put("coverUserId", Integer.valueOf(this.chatBean.otherId));
x7.a.h().c(m6.a.g2()).e("param", ParamUtil.getParam(hashMap)).f().c(new c());
}
public void hangUp() {
cancelAutoTimer();
finish();
HashMap hashMap = new HashMap();
hashMap.put("userId", getUserId());
hashMap.put("roomId", Integer.valueOf(this.chatBean.roomId));
x7.a.h().c(m6.a.h()).e("param", ParamUtil.getParam(hashMap)).f().c(new f());
}
private void initAutoCountTimer() {
int i8 = AppManager.f().k().t_role;
if (this.mAutoHangUpTimer == null) {
b bVar = new b(35000L, 1000L);
this.mAutoHangUpTimer = bVar;
bVar.start();
}
}
private void playMusic() {
this.soundRing.start();
}
public void playVideoWithUrl(String str) {
if (this.mVideoView != null) {
this.mContentIv.setVisibility(8);
this.mVideoView.setDisplayAspectRatio(2);
this.mVideoView.setVideoPath(str);
this.mVideoView.setVolume(0.0f, 0.0f);
this.mVideoView.setLooping(true);
this.mVideoView.start();
}
}
public void toVideoChat() {
if (this.chatBean.isActor()) {
VideoChatActivity.start(this.mContext, this.chatBean);
cancelAutoTimer();
finish();
return;
}
showLoadingDialog();
HashMap hashMap = new HashMap();
hashMap.put("userId", getUserId());
hashMap.put("anthorId", Integer.valueOf(this.chatBean.otherId));
hashMap.put("roomId", Integer.valueOf(this.chatBean.roomId));
hashMap.put("chatType", 1);
x7.a.h().c(m6.a.w1()).e("param", ParamUtil.getParam(hashMap)).f().c(new e());
}
@Override
protected View getContentView() {
return inflate(2131492982);
}
@Override
protected boolean isImmersionBarEnabled() {
return true;
}
@OnClick
public void onClick(View view) {
int id = view.getId();
if (id == 2131296273) {
PermissionUtil.requestPermissions(this, new d(), "android.permission.CAMERA", "android.permission.RECORD_AUDIO");
return;
}
if (id != 2131296448) {
if (id != 2131296776) {
return;
}
hangUp();
} else {
this.mCameraIv.setSelected(!r3.isSelected());
this.mCameraTv.setText(this.mCameraIv.isSelected() ? 2131821102 : 2131821118);
this.chatBean.closeVideo = this.mCameraIv.isSelected();
}
}
@Override
protected void onContentAdded() {
if (AppManager.f().d().d()) {
finish();
return;
}
this.chatBean = (AVChatBean) getIntent().getSerializableExtra("bean");
SocketMessageManager.get().subscribe(this.subscription, this.Subscriptions);
this.soundRing = new SoundRing();
needHeader(false);
initAutoCountTimer();
playMusic();
getPassUserInfo();
getData();
}
@Override
protected void onDestroy() {
SocketMessageManager.get().unsubscribe(this.subscription);
super.onDestroy();
SoundRing soundRing = this.soundRing;
if (soundRing != null) {
soundRing.stop();
}
PLVideoView pLVideoView = this.mVideoView;
if (pLVideoView != null) {
pLVideoView.stopPlayback();
this.mVideoView = null;
}
cancelAutoTimer();
}
protected void onHangUp(int i8, int i9) {
if (i8 != this.chatBean.roomId) {
return;
}
try {
if (isFinishing()) {
return;
}
ToastUtil.showToast(getApplicationContext(), 2131820918);
finish();
} catch (Exception e8) {
e8.printStackTrace();
}
}
@Override
protected void onPause() {
super.onPause();
PLVideoView pLVideoView = this.mVideoView;
if (pLVideoView == null || !this.mNeedPause) {
return;
}
pLVideoView.stopPlayback();
}
@Override
protected void onResume() {
super.onResume();
this.mNeedPause = true;
}
}