upgrade
This commit is contained in:
@@ -249,6 +249,8 @@ public class SipEngine implements BluetelInterface {
|
||||
*/
|
||||
public void GoToInCall(Context context, String callnumber, String callstate, int calltype, int callid) {
|
||||
Intent intent = null;
|
||||
|
||||
logmy.e("GoToInCall==============" + isMeetingCall(callnumber) +"==="+ System.currentTimeMillis());
|
||||
if (isMeetingCall(callnumber)) {
|
||||
intent = new Intent(context, InCallMeetingActivity.class);
|
||||
} else {
|
||||
|
||||
@@ -32,6 +32,7 @@ import com.tianrun.sipcall.ui.TrAdapter;
|
||||
import com.tianrun.sipcall.ui.TrBaseActivity;
|
||||
import com.tianrun.sipcall.ui.UIUtl;
|
||||
import com.tianrun.sipcall.utils.HttpUtl;
|
||||
import com.tianrun.sipcall.utils.logmy;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -257,6 +258,8 @@ public class CreateMeetingActivity extends TrBaseActivity {
|
||||
UIUtl.toastI("请添加要加入会议的分机号");
|
||||
return;
|
||||
}
|
||||
|
||||
logmy.e("createMeeting==============" + System.currentTimeMillis());
|
||||
QMUITipDialog dialog = UIUtl.toastLoading("");
|
||||
Net.createMeeting(meetingTopic.getText().toString(), meetingDesc.getText().toString(), userStr, new HttpUtl.CallBack() {
|
||||
@Override
|
||||
@@ -271,7 +274,7 @@ public class CreateMeetingActivity extends TrBaseActivity {
|
||||
// }
|
||||
// SipEngine.getInstance().CallNumber(code, isVideo);
|
||||
// }
|
||||
UIUtl.toastS("临时会议创建成功");
|
||||
// UIUtl.toastS("临时会议创建成功");
|
||||
dialog.dismiss();
|
||||
finish();
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.PowerManager;
|
||||
import android.os.PowerManager.WakeLock;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
@@ -84,6 +85,8 @@ public class InCallMeetingActivity extends TrBaseActivity implements OnClickList
|
||||
private boolean VIDEOSTATE = false;
|
||||
public static Intent incallIntent;
|
||||
|
||||
private boolean isinited = false;
|
||||
|
||||
TrAdapter adapterUser;
|
||||
|
||||
List<DBUser> allUsers = new ArrayList<>();
|
||||
@@ -141,31 +144,39 @@ public class InCallMeetingActivity extends TrBaseActivity implements OnClickList
|
||||
KeyguardManager.KeyguardLock kl = km.newKeyguardLock("unLock");
|
||||
kl.disableKeyguard();
|
||||
initview();
|
||||
|
||||
if (DBUser.mySelf != null && DBUser.mySelf.isManager) {
|
||||
imageButtonAddUser.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
imageButtonAddUser.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
incallIntent = getIntent();
|
||||
setDate(this.getIntent());
|
||||
|
||||
allUsers.clear();
|
||||
setUsers();
|
||||
getMembers();
|
||||
getMemberTimer();
|
||||
initTabAndPager();
|
||||
mTabSegment.setVisibility(View.INVISIBLE);
|
||||
// getMembers();
|
||||
getMemberTimer();
|
||||
}
|
||||
|
||||
static void getMemberTimer() {
|
||||
if(handler_CallActivity != null) {
|
||||
CONS.SENDMESSAGETO(handler_CallActivity, -1, null);
|
||||
handler_CallActivity.postDelayed(getMemberRunner, 2000);
|
||||
}
|
||||
}
|
||||
static Runnable getMemberRunner = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
CONS.SENDMESSAGETO(handler_CallActivity, -1, null);
|
||||
getMemberTimer();
|
||||
}
|
||||
};
|
||||
|
||||
private void initview() {
|
||||
if(isinited) return;
|
||||
isinited = true;
|
||||
View view = findViewById(R.id.IncallMeetingRoot);
|
||||
gridUser = view.findViewById(R.id.GridUser);
|
||||
show = (TextView) findViewById(R.id.show);
|
||||
@@ -178,6 +189,7 @@ public class InCallMeetingActivity extends TrBaseActivity implements OnClickList
|
||||
remoteRender = (SMSurfaceViewRenderer) findViewById(R.id.remote_video_view);
|
||||
localRenderLayout = (SMPercentFrameLayout) findViewById(R.id.local_video_layout);
|
||||
remoteRenderLayout = (SMPercentFrameLayout) findViewById(R.id.remote_video_layout);
|
||||
logmy.e("new EngineServer============================" + System.currentTimeMillis());
|
||||
engineServer = new EngineServer(localRender, remoteRender, localRenderLayout, remoteRenderLayout, true);
|
||||
|
||||
incall_mute = findViewById(R.id.incall_mute);
|
||||
@@ -190,11 +202,6 @@ public class InCallMeetingActivity extends TrBaseActivity implements OnClickList
|
||||
mTabSegment = findViewById(R.id.ScreenType);
|
||||
mContentViewPager = findViewById(R.id.contentViewPager);
|
||||
imageButtonAddUser = findViewById(R.id.imageButtonAddUser);
|
||||
if (DBUser.mySelf.isManager) {
|
||||
imageButtonAddUser.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
imageButtonAddUser.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
private void initTabAndPager() {
|
||||
@@ -315,7 +322,7 @@ public class InCallMeetingActivity extends TrBaseActivity implements OnClickList
|
||||
|
||||
@Override
|
||||
public void clickCallback(Object data, AdapterView<?> parent, View view, int position, long id) {
|
||||
if (!DBUser.mySelf.isManager) {
|
||||
if (DBUser.mySelf == null || !DBUser.mySelf.isManager) {
|
||||
return;
|
||||
}
|
||||
DBUser d = (DBUser) data;
|
||||
@@ -329,7 +336,7 @@ public class InCallMeetingActivity extends TrBaseActivity implements OnClickList
|
||||
.dimAmount(0.5f)
|
||||
.skinManager(QMUISkinManager.defaultInstance(InCallMeetingActivity.this))
|
||||
.edgeProtection(QMUIDisplayHelper.dp2px(InCallMeetingActivity.this, 20));
|
||||
if (DBUser.mySelf.isManager) {
|
||||
if (DBUser.mySelf != null && DBUser.mySelf.isManager) {
|
||||
if(d.isBusy()) {
|
||||
if (d.isMute) {
|
||||
qa.addAction(new QMUIQuickAction.Action().icon(R.drawable.unmute).text("取消禁言").onClick(
|
||||
@@ -506,7 +513,7 @@ public class InCallMeetingActivity extends TrBaseActivity implements OnClickList
|
||||
incall_muteVideo.setVisibility(View.GONE);
|
||||
} else {
|
||||
incall_answer.setVisibility(View.GONE);
|
||||
if (DBUser.mySelf.isManager) {
|
||||
if (DBUser.mySelf != null && DBUser.mySelf.isManager) {
|
||||
incall_mute.setVisibility(View.VISIBLE);
|
||||
if (VIDEOSTATE) {
|
||||
incall_muteVideo.setVisibility(View.VISIBLE);
|
||||
@@ -562,6 +569,7 @@ public class InCallMeetingActivity extends TrBaseActivity implements OnClickList
|
||||
*/
|
||||
public synchronized void stopVideoStream(boolean isExit) {
|
||||
if (VIDEOSTATE && engineServer != null) {
|
||||
logmy.e("stopVideoStream============================" + System.currentTimeMillis());
|
||||
engineServer.stopVideoStream(isExit);
|
||||
VIDEOSTATE = false;
|
||||
}
|
||||
@@ -631,7 +639,7 @@ public class InCallMeetingActivity extends TrBaseActivity implements OnClickList
|
||||
break;
|
||||
}
|
||||
c = 0;
|
||||
logmy.e("startVideoStream=============="+ callnumber + "--" + server + "--" + rport + "--" + lport);
|
||||
logmy.e("startVideoStream=============="+ callnumber + "--" + server + "--" + rport + "--" + lport +"====" + System.currentTimeMillis());
|
||||
if (engineServer != null) {
|
||||
ShowVideoView(true);
|
||||
/*
|
||||
@@ -654,7 +662,7 @@ public class InCallMeetingActivity extends TrBaseActivity implements OnClickList
|
||||
engineServer.startVideoStream(this, server, rport, lport, payload, BitRate, FrameRate, w, h, c, true);
|
||||
VIDEOSTATE = true;
|
||||
|
||||
if (DBUser.mySelf.isManager) {
|
||||
if (DBUser.mySelf != null && DBUser.mySelf.isManager) {
|
||||
incall_mute.setVisibility(View.VISIBLE);
|
||||
incall_muteVideo.setVisibility(View.VISIBLE);
|
||||
}
|
||||
@@ -673,7 +681,7 @@ public class InCallMeetingActivity extends TrBaseActivity implements OnClickList
|
||||
break;
|
||||
case R.id.incall_answer:
|
||||
incall_answer.setVisibility(View.GONE);
|
||||
if (DBUser.mySelf.isManager) {
|
||||
if (DBUser.mySelf != null && DBUser.mySelf.isManager) {
|
||||
incall_mute.setVisibility(View.VISIBLE);
|
||||
}
|
||||
SipEngine.getInstance().answer(callid);
|
||||
|
||||
@@ -35,6 +35,7 @@ public class DBUser {
|
||||
this.name = d.getString("name");
|
||||
this.phone = d.getString("extn");
|
||||
this.status = d.getString("sip_state");
|
||||
status = status == null ? "" : status;
|
||||
String weight = d.getString("weight");
|
||||
if (weight != null) {
|
||||
this.isManager = weight.equals("1") ? true : false;
|
||||
|
||||
@@ -108,6 +108,10 @@ public class LoginActivity extends TrBaseActivity {
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if(dialogLoading != null) {
|
||||
dialogLoading.dismiss();
|
||||
dialogLoading = null;
|
||||
}
|
||||
if (InCallActivity.handler_CallActivity != null) {
|
||||
startActivity(InCallActivity.incallIntent);
|
||||
return;
|
||||
@@ -206,6 +210,10 @@ public class LoginActivity extends TrBaseActivity {
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if(dialogLoading != null) {
|
||||
dialogLoading.dismiss();
|
||||
dialogLoading = null;
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@@ -219,17 +227,19 @@ public class LoginActivity extends TrBaseActivity {
|
||||
case CONS.LOGINFAILED:
|
||||
if(dialogLoading != null) {
|
||||
dialogLoading.dismiss();
|
||||
dialogLoading = null;
|
||||
}
|
||||
break;
|
||||
case CONS.LOGIN:
|
||||
if(dialogLoading != null) {
|
||||
dialogLoading.dismiss();
|
||||
dialogLoading = null;
|
||||
}
|
||||
if (isEnable()) {
|
||||
saveUserInfor(this.name, this.pw, this.ip, this.port);
|
||||
}
|
||||
startActivity(new Intent(this, MainActivity.class));
|
||||
DBUser.mySelf = new DBUser("", this.name, "true");
|
||||
startActivity(new Intent(this, MainActivity.class));
|
||||
finish();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -171,6 +171,7 @@ public class MainActivity extends TrBaseActivity {
|
||||
|
||||
// 处理当前分机号可能有需要加入的会议
|
||||
private void checkBeforeMeetingState() {
|
||||
if(DBUser.mySelf == null) return;
|
||||
Net.getUserInfor(DBUser.mySelf.phone, new HttpUtl.CallBack() {
|
||||
@Override
|
||||
public void onRequestComplete(int cmd, String result, Object orgs) {
|
||||
@@ -242,7 +243,7 @@ public class MainActivity extends TrBaseActivity {
|
||||
} else {
|
||||
StartMeetingVoice.setVisibility(View.VISIBLE);
|
||||
StartMeetingVideo.setVisibility(View.VISIBLE);
|
||||
if (DBUser.mySelf.isManager) {
|
||||
if (DBUser.mySelf != null && DBUser.mySelf.isManager) {
|
||||
ButtonDelGroup.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
ButtonDelGroup.setVisibility(View.INVISIBLE);
|
||||
@@ -261,7 +262,7 @@ public class MainActivity extends TrBaseActivity {
|
||||
allUsers.addAll(group.users);
|
||||
}
|
||||
//根据权限来处理
|
||||
if (DBUser.mySelf.isManager) {
|
||||
if (DBUser.mySelf != null && DBUser.mySelf.isManager) {
|
||||
DBUser u = new DBUser("", "添加分机", "false");
|
||||
u.isAddFlag = true;
|
||||
allUsers.add(u);
|
||||
@@ -303,10 +304,10 @@ public class MainActivity extends TrBaseActivity {
|
||||
imageViewAddGroupIcon.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
if (DBUser.mySelf.isBusy()) {
|
||||
if (DBUser.mySelf != null && DBUser.mySelf.isBusy()) {
|
||||
imageViewSelfStatus.setColorFilter(Color.RED);
|
||||
textViewSelfStatus.setText("通话中");
|
||||
} else if (DBUser.mySelf.isOnline()) {
|
||||
} else if (DBUser.mySelf != null && DBUser.mySelf.isOnline()) {
|
||||
imageViewSelfStatus.setColorFilter(Color.GREEN);
|
||||
textViewSelfStatus.setText("在线");
|
||||
} else {
|
||||
@@ -425,7 +426,7 @@ public class MainActivity extends TrBaseActivity {
|
||||
}
|
||||
}
|
||||
));
|
||||
if (DBUser.mySelf.isManager && currSelectData != null && (!currSelectData.isAll())) {
|
||||
if (DBUser.mySelf != null && DBUser.mySelf.isManager && currSelectData != null && (!currSelectData.isAll())) {
|
||||
qa.addAction(new QMUIQuickAction.Action().icon(android.R.drawable.ic_delete).text("移除").onClick(
|
||||
new QMUIQuickAction.OnClickListener() {
|
||||
@Override
|
||||
@@ -582,7 +583,7 @@ public class MainActivity extends TrBaseActivity {
|
||||
allUsers.clear();
|
||||
allUsers.addAll(group.users);
|
||||
//根据权限来处理
|
||||
if (DBUser.mySelf.isManager) {
|
||||
if (DBUser.mySelf != null && DBUser.mySelf.isManager) {
|
||||
DBUser u = new DBUser("", "添加分机", "false");
|
||||
u.isAddFlag = true;
|
||||
allUsers.add(u);
|
||||
|
||||
@@ -42,18 +42,22 @@ public class Net {
|
||||
Object[] _params = (Object[]) params;
|
||||
HttpUtl.CallBack callback = (HttpUtl.CallBack) (_params[0]);
|
||||
Object orgs = _params[1];
|
||||
if (ActivityMgr.topActivity != null && callback != null) {
|
||||
ActivityMgr.topActivity.handler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (callback != null) {
|
||||
callback.onRequestComplete(cmd, result, orgs);
|
||||
try {
|
||||
if (ActivityMgr.topActivity != null && callback != null) {
|
||||
ActivityMgr.topActivity.handler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (callback != null) {
|
||||
callback.onRequestComplete(cmd, result, orgs);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
ActivityMgr.sendMsg(cmd, new NetPkg(result, orgs));
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, e.getMessage());
|
||||
}
|
||||
|
||||
ActivityMgr.sendMsg(cmd, new NetPkg(result, orgs));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -24,6 +24,7 @@ public class ActivityMgr {
|
||||
}
|
||||
|
||||
public static void onHideActivity(TrBaseActivity a) {
|
||||
UIUtl.onHideActivity(a);
|
||||
actives.remove(a.getClass());
|
||||
if (a == topActivity) {
|
||||
topActivity = null;
|
||||
@@ -32,7 +33,9 @@ public class ActivityMgr {
|
||||
|
||||
public static void sendMsg(int menu, Object obj) {
|
||||
for (TrBaseActivity a : actives.values()) {
|
||||
CONS.SENDMESSAGETO(a.handler, menu, obj);
|
||||
if(a != null && a.handler != null) {
|
||||
CONS.SENDMESSAGETO(a.handler, menu, obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import android.widget.Toast;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.qmuiteam.qmui.skin.QMUISkinManager;
|
||||
import com.qmuiteam.qmui.widget.dialog.QMUIBaseDialog;
|
||||
import com.qmuiteam.qmui.widget.dialog.QMUIBottomSheet;
|
||||
import com.qmuiteam.qmui.widget.dialog.QMUITipDialog;
|
||||
import com.tianrun.sipcall.App;
|
||||
@@ -18,9 +19,46 @@ import com.tianrun.sipcall.SipEngine;
|
||||
import com.tianrun.sipcall.login.LoginActivity;
|
||||
import com.tianrun.sipcall.utils.HttpUtl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class UIUtl {
|
||||
public static Map<Class, ArrayList<QMUIBaseDialog>> activesWithDialogs = new ConcurrentHashMap<>();
|
||||
|
||||
private static void onShowDialog(TrBaseActivity activity, QMUIBaseDialog dialog){
|
||||
try {
|
||||
ArrayList<QMUIBaseDialog> list = activesWithDialogs.get(activity.getClass());
|
||||
if (list == null) {
|
||||
list = new ArrayList<QMUIBaseDialog>();
|
||||
}
|
||||
list.add(dialog);
|
||||
activesWithDialogs.put(activity.getClass(), list);
|
||||
} catch (Exception e){
|
||||
System.out.println(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void onHideActivity(TrBaseActivity activity){
|
||||
try {
|
||||
if(activity == null) return;
|
||||
ArrayList<QMUIBaseDialog> list = activesWithDialogs.get(activity.getClass());
|
||||
if(list != null) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
QMUIBaseDialog dialog =list.get(i);
|
||||
if(dialog != null) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
}
|
||||
list.clear();
|
||||
}
|
||||
activesWithDialogs.remove(activity.getClass());
|
||||
} catch (Exception e){
|
||||
System.out.println(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void toast(String tip) {
|
||||
if (ActivityMgr.topActivity == null) return;
|
||||
try {
|
||||
@@ -32,7 +70,7 @@ public class UIUtl {
|
||||
.setTipWord(tip)
|
||||
.create();
|
||||
tipDialog.show();
|
||||
hideToast(tipDialog);
|
||||
hideToast(ActivityMgr.topActivity, tipDialog);
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
@@ -51,7 +89,7 @@ public class UIUtl {
|
||||
.setTipWord(tip)
|
||||
.create();
|
||||
tipDialog.show();
|
||||
hideToast(tipDialog);
|
||||
hideToast(ActivityMgr.topActivity, tipDialog);
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
@@ -70,7 +108,7 @@ public class UIUtl {
|
||||
.setTipWord(tip)
|
||||
.create();
|
||||
tipDialog.show();
|
||||
hideToast(tipDialog);
|
||||
hideToast(ActivityMgr.topActivity, tipDialog);
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
@@ -89,7 +127,7 @@ public class UIUtl {
|
||||
.setTipWord(tip)
|
||||
.create();
|
||||
tipDialog.show();
|
||||
hideToast(tipDialog);
|
||||
hideToast(ActivityMgr.topActivity, tipDialog);
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
@@ -108,12 +146,16 @@ public class UIUtl {
|
||||
return tipDialog;
|
||||
}
|
||||
|
||||
private static void hideToast(QMUITipDialog tipDialog) {
|
||||
if (ActivityMgr.topActivity == null) return;
|
||||
ActivityMgr.topActivity.handler.postDelayed(new Runnable() {
|
||||
private static void hideToast(TrBaseActivity activity, QMUITipDialog tipDialog) {
|
||||
if (activity == null) return;
|
||||
activity.handler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
ArrayList<QMUIBaseDialog> list = activesWithDialogs.get(activity.getClass());
|
||||
if(list != null && list.contains(tipDialog)) {
|
||||
list.remove(tipDialog);
|
||||
}
|
||||
tipDialog.dismiss();
|
||||
} catch (Exception e) {
|
||||
System.out.println(e);
|
||||
|
||||
@@ -68,8 +68,6 @@ public class HttpUtl {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
;
|
||||
}.start();
|
||||
}
|
||||
|
||||
@@ -96,8 +94,6 @@ public class HttpUtl {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
;
|
||||
}.start();
|
||||
|
||||
}
|
||||
@@ -161,6 +157,7 @@ public class HttpUtl {
|
||||
return "";
|
||||
} else {
|
||||
UIUtl.toastI("内部错误");
|
||||
Log.e("http", urlStr);
|
||||
throw new RuntimeException(" responseCode :" + retCode);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user