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