正在查看: 新暖心缘 v8.1.1 应用的 AudioChatActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 新暖心缘 v8.1.1 应用的 AudioChatActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.luanxingyuan.app.activity;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.PendingIntent;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.os.Handler;
import android.os.Looper;
import android.os.SystemClock;
import android.text.TextUtils;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.OvershootInterpolator;
import android.view.animation.TranslateAnimation;
import android.widget.Chronometer;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import com.faceunity.wrapper.faceunity;
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.AudioUserBean;
import com.luanxingyuan.app.bean.ChatMessageBean;
import com.luanxingyuan.app.bean.CustomMessageBean;
import com.luanxingyuan.app.dialog.i0;
import com.luanxingyuan.app.dialog.z;
import com.luanxingyuan.app.rtc.RtcEngineEventHandler;
import com.luanxingyuan.app.rtc.RtcManager;
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.LogUtil;
import com.luanxingyuan.app.util.ParamUtil;
import com.luanxingyuan.app.util.SoundRing;
import com.luanxingyuan.app.util.ToastUtil;
import com.opensource.svgaplayer.SVGAImageView;
import com.tencent.imsdk.BaseConstants;
import com.tencent.imsdk.TIMConversation;
import com.tencent.imsdk.TIMConversationType;
import com.tencent.imsdk.TIMCustomElem;
import com.tencent.imsdk.TIMElem;
import com.tencent.imsdk.TIMElemType;
import com.tencent.imsdk.TIMManager;
import com.tencent.imsdk.TIMMessage;
import com.tencent.imsdk.TIMMessageListener;
import com.tencent.imsdk.TIMValueCallBack;
import d7.i;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.List;
public class AudioChatActivity extends BaseActivity implements TIMMessageListener {
protected static final int StateCall = 0;
protected static final int StateChatting = 1;
protected static final int StateReceive = 2;
public static boolean isChatting;
private AVChatBean chatBean;
private CountDownTimer countDownTimer;
@BindView
ImageView headIv;
@BindView
TextView mAnswerTv;
@BindView
TextView mCallingDesTv;
protected TIMConversation mConversation;
@BindView
TextView mFocusTv;
@BindView
SVGAImageView mGifSv;
@BindView
TextView mGiftDesTv;
@BindView
ImageView mGiftHeadIv;
@BindView
ImageView mGiftIv;
@BindView
LinearLayout mGiftLl;
@BindView
TextView mGiftNumberTv;
@BindView
TextView mLeftHangUpTv;
@BindView
LinearLayout mMiddleActionLl;
@BindView
TextView mMiddleHangUpTv;
@BindView
TextView mSignTv;
@BindView
TextView muteTv;
@BindView
TextView nameTv;
private RtcManager rtcManager;
protected SoundRing soundRing;
@BindView
TextView speakerTv;
private int state;
@BindView
Chronometer timeCh;
private int mSingleTimeSendGiftCount = 0;
private Handler mHandler = new Handler(Looper.getMainLooper());
boolean isLuYin = false;
RtcEngineEventHandler rtcEngineEventHandler = new n();
private Runnable mGiftRunnable = new g();
int[] Subscriptions = {Mid.onLineToVoiceRes, Mid.anchorLinkUserToVoiceRes, Mid.brokenVoiceLineRes, 30010, Mid.brokenVIPLineRes, Mid.brokenUserLineRes};
q6.a<SocketResponse> subscription = new h();
class a extends r6.a<BaseResponse<AudioUserBean>> {
a() {
}
public void onResponse(BaseResponse<AudioUserBean> baseResponse, int i8) {
if (AudioChatActivity.this.isFinishing() || baseResponse == null || baseResponse.m_istatus != 1) {
return;
}
AudioUserBean audioUserBean = baseResponse.m_object;
AudioChatActivity.this.nameTv.setText(audioUserBean.nickName);
if (TextUtils.isEmpty(audioUserBean.handImg)) {
AudioChatActivity.this.headIv.setImageResource(2131231010);
} else {
AudioChatActivity audioChatActivity = AudioChatActivity.this;
o6.i.a(audioChatActivity, audioUserBean.handImg, audioChatActivity.headIv);
AudioChatActivity audioChatActivity2 = AudioChatActivity.this;
o6.i.a(audioChatActivity2, audioUserBean.handImg, audioChatActivity2.mGiftHeadIv);
}
AudioChatActivity.this.mSignTv.setText(audioUserBean.t_autograph);
if (audioUserBean.isFollow == 0) {
AudioChatActivity.this.mFocusTv.setSelected(false);
AudioChatActivity audioChatActivity3 = AudioChatActivity.this;
audioChatActivity3.mFocusTv.setText(audioChatActivity3.getString(2131820867));
} else {
AudioChatActivity.this.mFocusTv.setSelected(true);
AudioChatActivity audioChatActivity4 = AudioChatActivity.this;
audioChatActivity4.mFocusTv.setText(audioChatActivity4.getString(2131820917));
}
AudioChatActivity.this.updateUser(audioUserBean);
}
}
class b extends r6.a<BaseResponse> {
b() {
}
@Override
public void onError(x8.e eVar, Exception exc, int i8) {
super.onError(eVar, exc, i8);
ToastUtil.showToast(AudioChatActivity.this.getApplicationContext(), 2131821363);
}
public void onResponse(BaseResponse baseResponse, int i8) {
}
}
class c implements TIMValueCallBack<TIMMessage> {
c() {
}
@Override
public void onSuccess(TIMMessage tIMMessage) {
LogUtil.i("TIM SendMsg bitmap");
AudioChatActivity.this.addNewMessage(tIMMessage, false);
}
@Override
public void onError(int i8, String str) {
String str2 = "TIM send message failed. code: " + i8 + " errmsg: " + str;
LogUtil.i(str2);
ToastUtil.showToast(AudioChatActivity.this.getApplicationContext(), str2);
o6.g.C(i8);
}
}
class d implements i.d {
d() {
}
@Override
public void a(d7.l lVar) {
AudioChatActivity.this.mGifSv.setImageDrawable(new d7.f(lVar));
AudioChatActivity.this.mGifSv.s();
}
@Override
public void onError() {
}
}
class e implements Animation.AnimationListener {
e() {
}
@Override
public void onAnimationEnd(Animation animation) {
AudioChatActivity.this.mHandler.postDelayed(AudioChatActivity.this.mGiftRunnable, 3000L);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationStart(Animation animation) {
}
}
class f implements Animation.AnimationListener {
f() {
}
@Override
public void onAnimationEnd(Animation animation) {
if (AudioChatActivity.this.mSingleTimeSendGiftCount != 1) {
AudioChatActivity.this.mGiftLl.setVisibility(8);
}
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationStart(Animation animation) {
}
}
class g implements Runnable {
g() {
}
@Override
public void run() {
AudioChatActivity.this.mSingleTimeSendGiftCount = 0;
AudioChatActivity.this.startGiftOutAnim();
}
}
class h implements q6.a<SocketResponse> {
h() {
}
@Override
public void execute(SocketResponse socketResponse) {
int i8 = socketResponse.mid;
if (i8 == 30010) {
AudioChatActivity.this.moneyNotEnough();
return;
}
if (i8 != 30015 && i8 != 30016) {
switch (i8) {
case Mid.brokenVIPLineRes:
case Mid.brokenUserLineRes:
AudioChatActivity.this.brokenVIPLineRes(socketResponse.roomId, socketResponse.breakUserId, i8);
break;
}
return;
}
AudioChatActivity.this.onAudio(i8);
}
}
class i implements q6.a<String> {
final AVChatBean f6170a;
final Context f6171b;
i(AVChatBean aVChatBean, Context context) {
this.f6170a = aVChatBean;
this.f6171b = context;
}
@Override
public void execute(String str) {
if (TextUtils.isEmpty(str)) {
ToastUtil.showToast("连接失败");
return;
}
this.f6170a.sign = str;
Intent intent = new Intent(this.f6171b, (Class<?>) AudioChatActivity.class);
intent.putExtra("state", 2);
intent.putExtra("bean", this.f6170a);
try {
PendingIntent.getActivity(this.f6171b, 0, intent, faceunity.FUAITYPE_FACEPROCESSOR_FACEID).send();
} catch (PendingIntent.CanceledException e8) {
e8.printStackTrace();
}
}
}
class j implements Chronometer.OnChronometerTickListener {
j() {
}
@Override
public void onChronometerTick(Chronometer chronometer) {
String charSequence = chronometer.getText().toString();
if (charSequence.equals("00:00")) {
return;
}
if (charSequence.endsWith("00") || charSequence.endsWith("30")) {
AudioChatActivity.this.getChatState();
}
}
}
class k implements DialogInterface.OnClickListener {
k() {
}
@Override
public void onClick(DialogInterface dialogInterface, int i8) {
AudioChatActivity.this.finish();
}
}
class l extends r6.a<BaseResponse> {
l() {
}
@Override
public void onError(x8.e eVar, Exception exc, int i8) {
super.onError(eVar, exc, i8);
ToastUtil.showToast(AudioChatActivity.this.getApplicationContext(), 2131821363);
}
public void onResponse(BaseResponse baseResponse, int i8) {
if (baseResponse == null || baseResponse.m_istatus != 1) {
ToastUtil.showToast(AudioChatActivity.this.getApplicationContext(), 2131821363);
return;
}
String str = baseResponse.m_strMessage;
if (TextUtils.isEmpty(str) || !str.contains(AudioChatActivity.this.getResources().getString(2131821358))) {
return;
}
ToastUtil.showToast(AudioChatActivity.this.getApplicationContext(), str);
AudioChatActivity.this.mFocusTv.setSelected(true);
AudioChatActivity audioChatActivity = AudioChatActivity.this;
audioChatActivity.mFocusTv.setText(audioChatActivity.getString(2131820917));
}
}
class m extends r6.a<BaseResponse> {
m() {
}
@Override
public void onError(x8.e eVar, Exception exc, int i8) {
super.onError(eVar, exc, i8);
ToastUtil.showToast(AudioChatActivity.this.getApplicationContext(), 2131821363);
}
public void onResponse(BaseResponse baseResponse, int i8) {
if (baseResponse == null || baseResponse.m_istatus != 1) {
ToastUtil.showToast(AudioChatActivity.this.getApplicationContext(), 2131821363);
return;
}
String str = baseResponse.m_strMessage;
if (TextUtils.isEmpty(str) || !str.contains(AudioChatActivity.this.getResources().getString(2131821358))) {
return;
}
ToastUtil.showToast(AudioChatActivity.this.getApplicationContext(), str);
AudioChatActivity.this.mFocusTv.setSelected(false);
AudioChatActivity audioChatActivity = AudioChatActivity.this;
audioChatActivity.mFocusTv.setText(audioChatActivity.getString(2131820867));
}
}
class n implements RtcEngineEventHandler {
class a implements Runnable {
a() {
}
@Override
public void run() {
ToastUtil.showToast("对方已退出");
AudioChatActivity.this.finish();
AudioChatActivity.this.hangUp();
}
}
class b implements Runnable {
b() {
}
@Override
public void run() {
AudioChatActivity.this.stopCounter();
AudioChatActivity.this.userJoined();
AudioChatActivity.this.updateState(1);
}
}
n() {
}
@Override
public void onJoinChannelSuccess(String str, int i8, int i9) {
StringBuilder sb = new StringBuilder();
sb.append("onJoinChannelSuccess: ");
sb.append(i8);
}
@Override
public void onRemoteVideoStateChanged(int i8, int i9, int i10, int i11) {
}
@Override
public void onUserJoined(int i8, int i9) {
StringBuilder sb = new StringBuilder();
sb.append("onUserJoined: ");
sb.append(i8);
AudioChatActivity.this.runOnUiThread(new b());
}
@Override
public void onUserMuteVideo(int i8, boolean z7) {
}
@Override
public void onUserOffline(int i8, int i9) {
StringBuilder sb = new StringBuilder();
sb.append("onUserOffline: ");
sb.append(i8);
AudioChatActivity.this.runOnUiThread(new a());
}
}
class o extends r6.a<BaseResponse<Integer>> {
o() {
}
public void onResponse(BaseResponse<Integer> baseResponse, int i8) {
Integer num;
if (AudioChatActivity.this.isFinishing() || baseResponse == null || baseResponse.m_istatus != 1 || (num = baseResponse.m_object) == null || num.intValue() == 1) {
return;
}
ToastUtil.showToast("已挂断");
AudioChatActivity.this.finish();
}
}
class p extends CountDownTimer {
final boolean f6180a;
p(long j8, long j9, boolean z7) {
super(j8, j9);
this.f6180a = z7;
}
@Override
public void onFinish() {
AudioChatActivity.this.timeFinish(this.f6180a);
}
@Override
public void onTick(long j8) {
}
}
class q extends r6.a<BaseResponse> {
q() {
}
@Override
public void onError(x8.e eVar, Exception exc, int i8) {
super.onError(eVar, exc, i8);
ToastUtil.showToast(AudioChatActivity.this.getApplicationContext(), 2131821205);
AudioChatActivity.this.finish();
}
public void onResponse(BaseResponse baseResponse, int i8) {
if (AudioChatActivity.this.isFinishing()) {
return;
}
if (baseResponse == null) {
ToastUtil.showToast(AudioChatActivity.this.getApplicationContext(), 2131821205);
AudioChatActivity.this.finish();
return;
}
int i9 = baseResponse.m_istatus;
if (i9 == 1) {
AudioChatActivity.this.joinChannel();
return;
}
if (i9 == -7) {
new i0(AudioChatActivity.this, "音视频功能只有VIP用户可使用").show();
return;
}
if (i9 == -1) {
o6.b.a(AudioChatActivity.this);
return;
}
if (TextUtils.isEmpty(baseResponse.m_strMessage)) {
ToastUtil.showToast(AudioChatActivity.this.getApplicationContext(), 2131821205);
} else {
ToastUtil.showToast(AudioChatActivity.this.getApplicationContext(), baseResponse.m_strMessage);
}
AudioChatActivity.this.finish();
}
}
public void addNewMessage(TIMMessage tIMMessage, boolean z7) {
for (int i8 = 0; i8 < tIMMessage.getElementCount(); i8++) {
ChatMessageBean chatMessageBean = new ChatMessageBean();
chatMessageBean.isSelf = tIMMessage.isSelf();
chatMessageBean.time = tIMMessage.timestamp();
TIMElem element = tIMMessage.getElement(i8);
if (element.getType() == TIMElemType.Custom) {
String str = new String(((TIMCustomElem) element).getData());
if (z7) {
parseCustomMessage(str);
}
}
}
}
private void cancelFollow(int i8) {
HashMap hashMap = new HashMap();
hashMap.put("userId", getUserId());
hashMap.put("coverFollow", String.valueOf(i8));
x7.a.h().c(m6.a.m()).e("param", ParamUtil.getParam(hashMap)).f().c(new m());
}
private void destroy() {
if (this.rtcManager == null) {
return;
}
Handler handler = this.mHandler;
if (handler != null) {
handler.removeCallbacksAndMessages(null);
this.mHandler = null;
}
SVGAImageView sVGAImageView = this.mGifSv;
if (sVGAImageView != null) {
sVGAImageView.o();
this.mGifSv = null;
}
TIMManager.getInstance().removeMessageListener(this);
this.soundRing.stop();
stopTime();
stopCounter();
hangUp();
destroyRtc();
isChatting = false;
}
private void destroyRtc() {
RtcManager rtcManager = this.rtcManager;
if (rtcManager != null) {
rtcManager.removeRtcHandler(this.rtcEngineEventHandler);
this.rtcManager.rtcEngine().leaveChannel();
this.rtcManager = null;
}
}
public void getChatState() {
HashMap hashMap = new HashMap();
hashMap.put("userId", getUserId());
hashMap.put("videoUserId", Integer.valueOf(this.chatBean.getUserId()));
hashMap.put("videoCoverUserId", Integer.valueOf(this.chatBean.getActorId()));
hashMap.put("roomId", Integer.valueOf(this.chatBean.roomId));
x7.a.h().c(m6.a.k2()).e("param", ParamUtil.getParam(hashMap)).f().c(new o());
}
private void getUserInfo() {
if (this.chatBean == null) {
return;
}
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 a());
}
public void hangUp() {
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 b());
}
private void initData(Intent intent) {
this.state = intent.getIntExtra("state", 0);
this.chatBean = (AVChatBean) getIntent().getSerializableExtra("bean");
getUserInfo();
initEngine();
updateState(this.state);
this.timeCh.setOnChronometerTickListener(new j());
}
private void initEngine() {
RtcManager rtcManager = RtcManager.get();
this.rtcManager = rtcManager;
rtcManager.rtcEngine().enableAudio();
this.rtcManager.rtcEngine().muteLocalAudioStream(false);
this.rtcManager.rtcEngine().muteLocalVideoStream(true);
this.rtcManager.addRtcHandler(this.rtcEngineEventHandler);
}
private void initIm() {
this.mConversation = TIMManager.getInstance().getConversation(TIMConversationType.C2C, String.valueOf(this.chatBean.otherId + 10000));
TIMManager.getInstance().addMessageListener(this);
}
public void joinChannel() {
this.rtcManager.rtcEngine().setChannelProfile(1);
this.rtcManager.rtcEngine().setClientRole(1);
this.rtcManager.rtcEngine().joinChannel(this.chatBean.sign, this.chatBean.roomId + "", (String) null, AppManager.f().k().t_id);
}
private void parseCustomMessage(String str) {
try {
CustomMessageBean parseBean = CustomMessageBean.parseBean(str);
if (parseBean != null) {
if (parseBean.type.equals("1")) {
LogUtil.i("接收到的礼物: " + parseBean.gift_name);
startGif(parseBean.gift_gif_url);
startGiftInAnim(parseBean, false, false);
} else if (parseBean.type.equals("0")) {
parseBean.gift_name = getResources().getString(2131820891);
LogUtil.i("接收到的礼物: " + parseBean.gift_name);
startGiftInAnim(parseBean, false, true);
}
}
} catch (Exception e8) {
e8.printStackTrace();
}
}
private void saveFollow(int i8) {
HashMap hashMap = new HashMap();
hashMap.put("userId", getUserId());
hashMap.put("coverFollowUserId", String.valueOf(i8));
x7.a.h().c(m6.a.b1()).e("param", ParamUtil.getParam(hashMap)).f().c(new l());
}
private void sendMessage(TIMElem tIMElem) {
TIMMessage tIMMessage = new TIMMessage();
if (tIMMessage.addElement(tIMElem) != 0) {
ToastUtil.showToast(getApplicationContext(), 2131820826);
return;
}
TIMConversation tIMConversation = this.mConversation;
if (tIMConversation == null) {
ToastUtil.showToast(getApplicationContext(), 2131821375);
initIm();
} else if (tIMElem != null) {
tIMConversation.sendMessage(tIMMessage, new c());
} else {
ToastUtil.showToast(getApplicationContext(), 2131820826);
}
}
private void setSpeaker(boolean z7) {
if (this.rtcManager.rtcEngine() != null) {
this.rtcManager.rtcEngine().setEnableSpeakerphone(z7);
}
findViewById(2131297252).setSelected(z7);
}
public static void startCall(Context context, AVChatBean aVChatBean) {
Intent intent = new Intent(context, (Class<?>) AudioChatActivity.class);
intent.putExtra("state", 0);
intent.putExtra("bean", aVChatBean);
if (!(context instanceof Activity)) {
intent.addFlags(faceunity.FUAITYPE_HUMAN_PROCESSOR_DETECT);
}
context.startActivity(intent);
}
private void startComboAnim(TextView textView) {
ObjectAnimator ofFloat = ObjectAnimator.ofFloat(textView, "scaleX", 1.8f, 1.0f);
ObjectAnimator ofFloat2 = ObjectAnimator.ofFloat(textView, "scaleY", 1.8f, 1.0f);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.setDuration(300L);
animatorSet.setInterpolator(new OvershootInterpolator());
animatorSet.playTogether(ofFloat, ofFloat2);
animatorSet.start();
}
private void startGif(String str) {
if (TextUtils.isEmpty(str)) {
return;
}
try {
new d7.i(this).y(new URL(str), new d());
} catch (MalformedURLException e8) {
e8.printStackTrace();
}
}
private void startGiftInAnim(CustomMessageBean customMessageBean, boolean z7, boolean z8) {
String str;
String trim = this.mGiftDesTv.getText().toString().trim();
if ((!TextUtils.isEmpty(trim) && !trim.contains(customMessageBean.gift_name)) || z8) {
this.mSingleTimeSendGiftCount = 0;
}
int i8 = this.mSingleTimeSendGiftCount + 1;
this.mSingleTimeSendGiftCount = i8;
if (i8 != 1) {
if (z8) {
return;
}
this.mGiftNumberTv.setText(getResources().getString(2131821044) + this.mSingleTimeSendGiftCount);
this.mHandler.removeCallbacks(this.mGiftRunnable);
this.mHandler.postDelayed(this.mGiftRunnable, 3000L);
startComboAnim(this.mGiftNumberTv);
return;
}
if (z7) {
str = getResources().getString(2131821296) + customMessageBean.gift_name;
} else {
str = getResources().getString(2131821298) + customMessageBean.gift_name;
}
this.mGiftDesTv.setText(str);
if (z8) {
this.mGiftIv.setImageResource(2131231107);
this.mGiftNumberTv.setText(getResources().getString(2131821044) + customMessageBean.gold_number);
} else {
o6.i.i(this, customMessageBean.gift_still_url, this.mGiftIv);
this.mGiftNumberTv.setText(getResources().getString(2131821044) + this.mSingleTimeSendGiftCount);
}
this.mGiftLl.setVisibility(0);
this.mGiftLl.clearAnimation();
TranslateAnimation translateAnimation = (TranslateAnimation) AnimationUtils.loadAnimation(getApplicationContext(), 2130771987);
this.mGiftLl.setAnimation(translateAnimation);
translateAnimation.start();
this.mHandler.removeCallbacks(this.mGiftRunnable);
translateAnimation.setAnimationListener(new e());
}
public void startGiftOutAnim() {
this.mGiftLl.clearAnimation();
Animation loadAnimation = AnimationUtils.loadAnimation(getApplicationContext(), 2130771988);
this.mGiftLl.setAnimation(loadAnimation);
loadAnimation.start();
loadAnimation.setAnimationListener(new f());
}
public static void startReceive(Context context, AVChatBean aVChatBean) {
r6.b.o(aVChatBean.roomId, new i(aVChatBean, context));
}
private void startTimeCounter(boolean z7) {
stopCounter();
p pVar = new p(BaseConstants.DEFAULT_MSG_TIMEOUT, 1000L, z7);
this.countDownTimer = pVar;
pVar.start();
}
private void startTimer() {
HashMap hashMap = new HashMap();
hashMap.put("anthorId", Integer.valueOf(this.chatBean.getActorId()));
hashMap.put("userId", Integer.valueOf(this.chatBean.getUserId()));
hashMap.put("chatType", 2);
hashMap.put("roomId", Integer.valueOf(this.chatBean.roomId));
x7.a.h().c(m6.a.w1()).e("param", ParamUtil.getParam(hashMap)).f().c(new q());
}
public void stopCounter() {
CountDownTimer countDownTimer = this.countDownTimer;
if (countDownTimer != null) {
countDownTimer.cancel();
this.countDownTimer = null;
}
}
public void updateState(int i8) {
this.state = i8;
if (i8 == 0) {
joinChannel();
this.mCallingDesTv.setVisibility(0);
startTimeCounter(false);
this.soundRing.start();
return;
}
if (i8 != 1) {
if (i8 != 2) {
return;
}
this.mMiddleHangUpTv.setVisibility(8);
this.mLeftHangUpTv.setVisibility(0);
this.mAnswerTv.setVisibility(0);
startTimeCounter(true);
this.soundRing.start();
return;
}
setSpeaker(true);
this.soundRing.stop();
this.timeCh.setVisibility(0);
this.timeCh.setFormat("%s");
this.timeCh.setBase(SystemClock.elapsedRealtime());
this.timeCh.start();
this.mSignTv.setVisibility(0);
this.mMiddleActionLl.setVisibility(0);
this.mMiddleHangUpTv.setVisibility(0);
this.mCallingDesTv.setVisibility(8);
this.mLeftHangUpTv.setVisibility(8);
this.mAnswerTv.setVisibility(8);
}
protected void brokenVIPLineRes(int i8, int i9, int i10) {
}
@Override
public void finish() {
if (this.isLuYin) {
o6.k.i().l();
}
destroy();
super.finish();
}
@Override
protected View getContentView() {
return inflate(2131492906);
}
protected SoundRing getSoundRing() {
return new SoundRing();
}
protected void moneyNotEnough() {
new z(this).show();
}
protected void onAudio(int i8) {
if (i8 != 30018) {
return;
}
otherBroken();
}
@OnClick
public void onClick(View view) {
switch (view.getId()) {
case 2131296365:
startTimer();
break;
case 2131296470:
startActivity(new Intent(getApplicationContext(), (Class<?>) ChargeActivity.class));
break;
case 2131296692:
if (this.chatBean.otherId > 0) {
if (!this.mFocusTv.getText().toString().trim().equals(getString(2131820867))) {
cancelFollow(this.chatBean.otherId);
break;
} else {
saveFollow(this.chatBean.otherId);
break;
}
}
break;
case 2131296725:
new com.luanxingyuan.app.dialog.m(this.mContext, this.chatBean.otherId).show();
break;
case 2131296885:
case 2131296937:
new AlertDialog.Builder(this.mContext).setMessage("你确定退出聊天吗?").setNegativeButton("狠心挂断", new k()).setPositiveButton("再聊一会", (DialogInterface.OnClickListener) null).create().show();
break;
case 2131296965:
boolean z7 = !view.isSelected();
this.rtcManager.rtcEngine().muteLocalAudioStream(z7);
view.setSelected(z7);
break;
case 2131297154:
Intent intent = new Intent(getApplicationContext(), (Class<?>) ReportActivity.class);
intent.putExtra("actor_id", this.chatBean.otherId);
startActivity(intent);
break;
case 2131297252:
setSpeaker(!view.isSelected());
break;
}
}
@Override
protected void onContentAdded() {
isChatting = true;
SocketMessageManager.get().subscribe(this.subscription, this.Subscriptions);
needHeader(false);
this.soundRing = getSoundRing();
initData(getIntent());
initIm();
}
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
ButterKnife.a(this);
}
@Override
protected void onDestroy() {
destroy();
super.onDestroy();
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
initData(intent);
}
@Override
public boolean onNewMessages(List<TIMMessage> list) {
LogUtil.i("语音聊天页面新消息来了");
String valueOf = String.valueOf(this.chatBean.otherId + 10000);
for (TIMMessage tIMMessage : list) {
TIMConversation conversation = tIMMessage.getConversation();
if (conversation != null && conversation.getType() == TIMConversationType.C2C && !TextUtils.isEmpty(conversation.getPeer()) && TextUtils.equals(conversation.getPeer(), valueOf)) {
addNewMessage(tIMMessage, true);
}
}
return true;
}
protected void otherBroken() {
if (isFinishing()) {
return;
}
finish();
}
protected final void stopTime() {
Chronometer chronometer = this.timeCh;
if (chronometer != null) {
chronometer.stop();
}
}
@Override
protected boolean supportFullScreen() {
return true;
}
protected void timeFinish(boolean z7) {
if (!z7) {
ToastUtil.showToast(getApplication(), 2131821076);
}
finish();
}
protected void updateUser(AudioUserBean audioUserBean) {
}
protected void userJoined() {
RtcManager rtcManager;
if (!o6.k.i().j() || (rtcManager = this.rtcManager) == null) {
return;
}
this.isLuYin = true;
rtcManager.rtcEngine().startAudioRecording(o6.k.i().h(this.chatBean.otherId), 1);
}
}