正在查看: 新暖心缘 v8.1.1 应用的 CallingActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 新暖心缘 v8.1.1 应用的 CallingActivity.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.AudioUserBean;
import com.luanxingyuan.app.bean.MultipleChatInfo;
import com.luanxingyuan.app.dialog.d0;
import com.luanxingyuan.app.socket.SocketMessageManager;
import com.luanxingyuan.app.socket.domain.Mid;
import com.luanxingyuan.app.socket.domain.SocketResponse;
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 java.util.HashMap;
import o6.n;
public class CallingActivity extends BaseActivity {
private MultipleChatInfo chatInfo;
@BindView
TextView inviteTv;
private CountDownTimer mAutoHangUpTimer;
@BindView
ImageView mCameraIv;
@BindView
LinearLayout mCameraLl;
@BindView
TextView mCameraTv;
@BindView
ImageView mHead2Iv;
@BindView
ImageView mHeadIv;
@BindView
TextView mName2Tv;
@BindView
TextView mNameTv;
private SoundRing soundRing;
int[] Subscriptions = {Mid.video_brokenLineRes};
q6.a<SocketResponse> subscription = new f();
class a extends CountDownTimer {
a(long j8, long j9) {
super(j8, j9);
}
@Override
public void onFinish() {
CallingActivity.this.hangUp();
}
@Override
public void onTick(long j8) {
}
}
class b extends r6.a<BaseResponse<AudioUserBean>> {
b() {
}
public void onResponse(BaseResponse<AudioUserBean> baseResponse, int i8) {
AudioUserBean audioUserBean;
if (CallingActivity.this.isFinishing() || baseResponse == null || baseResponse.m_istatus != 1 || (audioUserBean = baseResponse.m_object) == null) {
return;
}
CallingActivity callingActivity = CallingActivity.this;
TextView textView = callingActivity.inviteTv;
Object[] objArr = new Object[2];
objArr[0] = audioUserBean.nickName;
objArr[1] = !callingActivity.chatInfo.isAudioChat() ? "视频" : "语音";
textView.setText(String.format("%1$s邀请你加入他的一对二%2$s聊天房间", objArr));
CallingActivity.this.mNameTv.setText(audioUserBean.nickName);
CallingActivity.this.mName2Tv.setText(audioUserBean.nickName);
com.bumptech.glide.b.x(((BaseActivity) CallingActivity.this).mContext).p(audioUserBean.handImg).i(2131231010).p0(new d3.k()).G0(CallingActivity.this.mHeadIv);
com.bumptech.glide.b.x(((BaseActivity) CallingActivity.this).mContext).p(audioUserBean.handImg).i(2131231010).p0(new d3.k()).G0(CallingActivity.this.mHead2Iv);
}
}
class c implements PermissionUtil.OnPermissionListener {
class a implements q6.a<String> {
a() {
}
@Override
public void execute(String str) {
if (CallingActivity.this.isFinishing()) {
return;
}
CallingActivity.this.dismissLoadingDialog();
if (TextUtils.isEmpty(str)) {
ToastUtil.showToast("接听失败,请重试");
} else {
CallingActivity.this.chatInfo.sign = str;
CallingActivity.this.startCountTime();
}
}
}
c() {
}
@Override
public void onPermissionDenied() {
new d0(CallingActivity.this).show();
}
@Override
public void onPermissionGranted() {
CallingActivity.this.showLoadingDialog();
r6.b.o(CallingActivity.this.chatInfo.mansionRoomId, new a());
}
}
class d extends r6.a<BaseResponse> {
d() {
}
@Override
public void onError(x8.e eVar, Exception exc, int i8) {
super.onError(eVar, exc, i8);
CallingActivity.this.dismissLoadingDialog();
}
public void onResponse(com.luanxingyuan.app.base.BaseResponse r4, int r5) {
throw new UnsupportedOperationException("Method not decompiled: com.luanxingyuan.app.activity.CallingActivity.d.onResponse(com.luanxingyuan.app.base.BaseResponse, int):void");
}
}
class e extends r6.a<BaseResponse> {
e() {
}
public void onResponse(BaseResponse baseResponse, int i8) {
}
}
class f implements q6.a<SocketResponse> {
f() {
}
@Override
public void execute(SocketResponse socketResponse) {
if (socketResponse.mid != 30024) {
return;
}
CallingActivity.this.onHangUp(socketResponse.roomId, socketResponse.breakUserId);
}
}
public void cancelAutoTimer() {
CountDownTimer countDownTimer = this.mAutoHangUpTimer;
if (countDownTimer != null) {
countDownTimer.cancel();
this.mAutoHangUpTimer = null;
}
}
private void getPassUserInfo() {
HashMap hashMap = new HashMap();
hashMap.put("userId", Integer.valueOf(AppManager.f().k().t_id));
hashMap.put("coverUserId", Integer.valueOf(this.chatInfo.connectUserId));
x7.a.h().c(m6.a.g2()).e("param", ParamUtil.getParam(hashMap)).f().c(new b());
}
public void hangUp() {
cancelAutoTimer();
finish();
HashMap hashMap = new HashMap();
hashMap.put("userId", getUserId());
hashMap.put("breakUserId", getUserId());
hashMap.put("roomId", Integer.valueOf(this.chatInfo.roomId));
hashMap.put("mansionRoomId", Integer.valueOf(this.chatInfo.mansionRoomId));
hashMap.put("breakType", Integer.valueOf(this.chatInfo.chatType));
x7.a.h().c(m6.a.B1()).e("param", ParamUtil.getParam(hashMap)).f().c(new e());
}
private void initAutoCountTimer() {
if (this.mAutoHangUpTimer == null) {
a aVar = new a(35000L, 1000L);
this.mAutoHangUpTimer = aVar;
aVar.start();
}
}
private void playMusic() {
this.soundRing.start();
}
public void startCountTime() {
showLoadingDialog();
HashMap hashMap = new HashMap();
hashMap.put("userId", getUserId());
hashMap.put("roomId", Integer.valueOf(this.chatInfo.roomId));
hashMap.put("chatType", Integer.valueOf(this.chatInfo.chatType));
hashMap.put("mansionRoomId", Integer.valueOf(this.chatInfo.mansionRoomId));
x7.a.h().c(m6.a.y2()).e("param", ParamUtil.getParam(hashMap)).f().c(new d());
}
@Override
protected View getContentView() {
return inflate(2131492909);
}
@Override
protected boolean isImmersionBarEnabled() {
return true;
}
@OnClick
public void onClick(View view) {
int id = view.getId();
if (id == 2131296273) {
PermissionUtil.requestPermissions(this.mContext, new c(), "android.permission.CAMERA", "android.permission.RECORD_AUDIO");
return;
}
if (id != 2131296448) {
if (id != 2131296776) {
return;
}
hangUp();
} else if (this.mCameraIv.isSelected()) {
this.mCameraIv.setSelected(false);
this.mCameraTv.setText(getResources().getString(2131821102));
n.B(getApplicationContext(), true);
} else {
this.mCameraIv.setSelected(true);
this.mCameraTv.setText(getResources().getString(2131821118));
n.B(getApplicationContext(), false);
}
}
@Override
protected void onContentAdded() {
if (AppManager.f().d().d()) {
finish();
return;
}
SocketMessageManager.get().subscribe(this.subscription, this.Subscriptions);
this.soundRing = new SoundRing();
this.chatInfo = (MultipleChatInfo) getIntent().getSerializableExtra("chatInfo");
needHeader(false);
initAutoCountTimer();
playMusic();
getPassUserInfo();
if (this.chatInfo.isAudioChat()) {
findViewById(2131297434).setVisibility(8);
} else {
findViewById(2131296377).setVisibility(8);
}
}
@Override
protected void onDestroy() {
SocketMessageManager.get().unsubscribe(this.subscription);
super.onDestroy();
SoundRing soundRing = this.soundRing;
if (soundRing != null) {
soundRing.stop();
}
cancelAutoTimer();
}
protected void onHangUp(int i8, int i9) {
if (i8 != this.chatInfo.roomId) {
return;
}
try {
if (isFinishing()) {
return;
}
ToastUtil.showToast(getApplicationContext(), 2131820918);
finish();
} catch (Exception e8) {
e8.printStackTrace();
}
}
}