upgrade
This commit is contained in:
@@ -117,6 +117,7 @@ public class SipEngine implements BluetelInterface {
|
||||
this.ip = ip;
|
||||
this.port = port;
|
||||
myBluetelEngine.Register(name, pw, ip, port);
|
||||
isRelogin = false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -132,6 +133,7 @@ public class SipEngine implements BluetelInterface {
|
||||
|
||||
@Override
|
||||
public void AccountState(String uri, boolean state) {
|
||||
if(isRelogin) return;
|
||||
logmy.e(uri + "-->" + state);
|
||||
if (state) {
|
||||
if (!onLine) {
|
||||
@@ -150,12 +152,11 @@ public class SipEngine implements BluetelInterface {
|
||||
}, null);
|
||||
}
|
||||
} else {
|
||||
if(!onLine && !isRelogin) {
|
||||
if(!onLine) {
|
||||
UIUtl.toastI("Sip登陆失败");
|
||||
ActivityMgr.sendMsg(CONS.LOGINFAILED, null);
|
||||
}
|
||||
}
|
||||
isRelogin = false;
|
||||
}
|
||||
|
||||
public boolean isMeetingCall(String phoneNo) {
|
||||
|
||||
@@ -56,6 +56,7 @@ public class CreateGroupActivity extends TrBaseActivity {
|
||||
DBUser u = new DBUser("", "添加分机号", "");
|
||||
u.isAddFlag = true;
|
||||
users.add(u);
|
||||
users.add(DBUser.mySelf);
|
||||
|
||||
setList(null);
|
||||
}
|
||||
@@ -219,6 +220,11 @@ public class CreateGroupActivity extends TrBaseActivity {
|
||||
}
|
||||
|
||||
public void createGroup(View view) {
|
||||
String name = meetingTopic.getText().toString();
|
||||
if(name == null || name.isEmpty()) {
|
||||
UIUtl.toastI("分组名不能为空");
|
||||
return;
|
||||
}
|
||||
String userStr = getSelectedUsers();
|
||||
if (userStr == null || userStr == "") {
|
||||
UIUtl.toastI("请添加要加入会议的分机号");
|
||||
|
||||
@@ -174,7 +174,7 @@ public class CreateMeetingActivity extends TrBaseActivity {
|
||||
List<String> list = new ArrayList<>();
|
||||
List<String> listPhone = new ArrayList<>();
|
||||
for (DBUser u : DBUser.allUser) {
|
||||
if (mapUsers.get(u.phone) == null) {
|
||||
if (mapUsers.get(u.phone) == null && (!u.isBusy())) { // 只有空间的才加入
|
||||
listPhone.add(u.phone);
|
||||
list.add(u.phone + " | " + u.name);
|
||||
}
|
||||
@@ -256,16 +256,17 @@ public class CreateMeetingActivity extends TrBaseActivity {
|
||||
Net.createMeeting(meetingTopic.getText().toString(), meetingDesc.getText().toString(), userStr, new HttpUtl.CallBack() {
|
||||
@Override
|
||||
public void onRequestComplete(int cmd, String result, Object orgs) {
|
||||
JSONObject jo = JSONObject.parseObject(result);
|
||||
if (jo != null) {
|
||||
String code = "";
|
||||
if(isVideo) {
|
||||
code = jo.getString("video_code");
|
||||
} else {
|
||||
code = jo.getString("audio_code");
|
||||
}
|
||||
SipEngine.getInstance().CallNumber(code, isVideo);
|
||||
}
|
||||
// JSONObject jo = JSONObject.parseObject(result);
|
||||
// if (jo != null) {
|
||||
// String code = "";
|
||||
// if(isVideo) {
|
||||
// code = jo.getString("video_code");
|
||||
// } else {
|
||||
// code = jo.getString("audio_code");
|
||||
// }
|
||||
// SipEngine.getInstance().CallNumber(code, isVideo);
|
||||
// }
|
||||
UIUtl.toastS("临时会议创建成功");
|
||||
dialog.dismiss();
|
||||
finish();
|
||||
}
|
||||
|
||||
@@ -147,9 +147,21 @@ public class InCallMeetingActivity extends TrBaseActivity implements OnClickList
|
||||
allUsers.clear();
|
||||
setUsers();
|
||||
getMembers();
|
||||
getMemberTimer();
|
||||
initTabAndPager();
|
||||
}
|
||||
|
||||
static void getMemberTimer() {
|
||||
CONS.SENDMESSAGETO(handler_CallActivity, -1, null);
|
||||
handler_CallActivity.postDelayed(getMemberRunner, 2000);
|
||||
}
|
||||
static Runnable getMemberRunner = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
getMemberTimer();
|
||||
}
|
||||
};
|
||||
|
||||
private void initview() {
|
||||
View view = findViewById(R.id.IncallMeetingRoot);
|
||||
gridUser = view.findViewById(R.id.GridUser);
|
||||
@@ -393,7 +405,7 @@ public class InCallMeetingActivity extends TrBaseActivity implements OnClickList
|
||||
));
|
||||
}
|
||||
|
||||
qa.addAction(new QMUIQuickAction.Action().icon(R.drawable.fullscreen).text("切到主界面").onClick(
|
||||
qa.addAction(new QMUIQuickAction.Action().icon(R.drawable.fullscreen).text("主界面").onClick(
|
||||
new QMUIQuickAction.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(QMUIQuickAction quickAction, QMUIQuickAction.Action action, int position) {
|
||||
@@ -490,11 +502,13 @@ public class InCallMeetingActivity extends TrBaseActivity implements OnClickList
|
||||
stopVideoStream(true);
|
||||
super.onDestroy();
|
||||
SipEngine.getInstance().hangup(callid);
|
||||
handler_CallActivity.removeCallbacks(getMemberRunner);
|
||||
handler_CallActivity = null;
|
||||
if (wakeLock != null) {
|
||||
wakeLock.release();
|
||||
wakeLock = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -553,6 +567,9 @@ public class InCallMeetingActivity extends TrBaseActivity implements OnClickList
|
||||
case Net
|
||||
.CMD_getGroupMenbers:
|
||||
break;
|
||||
case -1:
|
||||
getMembers();
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -658,7 +675,7 @@ public class InCallMeetingActivity extends TrBaseActivity implements OnClickList
|
||||
}
|
||||
}
|
||||
));
|
||||
qa.addAction(new QMUIQuickAction.Action().icon(R.drawable.unmute).text("全部取消禁言").onClick(
|
||||
qa.addAction(new QMUIQuickAction.Action().icon(R.drawable.unmute).text("取消禁言").onClick(
|
||||
new QMUIQuickAction.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(QMUIQuickAction quickAction, QMUIQuickAction.Action action, int position) {
|
||||
@@ -687,7 +704,7 @@ public class InCallMeetingActivity extends TrBaseActivity implements OnClickList
|
||||
.dimAmount(0.5f)
|
||||
.skinManager(QMUISkinManager.defaultInstance(InCallMeetingActivity.this))
|
||||
.edgeProtection(QMUIDisplayHelper.dp2px(InCallMeetingActivity.this, 20));
|
||||
qa.addAction(new QMUIQuickAction.Action().icon(R.drawable.unvideo).text("全部关闭视频").onClick(
|
||||
qa.addAction(new QMUIQuickAction.Action().icon(R.drawable.unvideo).text("全部关闭").onClick(
|
||||
new QMUIQuickAction.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(QMUIQuickAction quickAction, QMUIQuickAction.Action action, int position) {
|
||||
@@ -705,7 +722,7 @@ public class InCallMeetingActivity extends TrBaseActivity implements OnClickList
|
||||
}
|
||||
}
|
||||
));
|
||||
qa.addAction(new QMUIQuickAction.Action().icon(R.drawable.video).text("全部恢复视频").onClick(
|
||||
qa.addAction(new QMUIQuickAction.Action().icon(R.drawable.video).text("全部恢复").onClick(
|
||||
new QMUIQuickAction.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(QMUIQuickAction quickAction, QMUIQuickAction.Action action, int position) {
|
||||
|
||||
@@ -18,7 +18,7 @@ public class DBUser {
|
||||
public String name = "";
|
||||
public String phone = "";
|
||||
public String status = "";
|
||||
public boolean isManager = false;
|
||||
public boolean isManager = true;
|
||||
public boolean isAddFlag = false;
|
||||
|
||||
public boolean isMute = false;
|
||||
@@ -37,7 +37,7 @@ public class DBUser {
|
||||
this.status = d.getString("sip_state");
|
||||
String weight = d.getString("weight");
|
||||
if (weight != null) {
|
||||
this.isManager = weight.equals("1");
|
||||
this.isManager = weight.equals("1") ? true : false;
|
||||
} else {
|
||||
this.isManager = false;
|
||||
}
|
||||
@@ -66,7 +66,7 @@ public class DBUser {
|
||||
u = new DBUser((JSONObject) o);
|
||||
allUser.add(u);
|
||||
mapUsers.put(u.phone, u);
|
||||
if (mySelf != null && u.phone == mySelf.phone) {
|
||||
if (mySelf != null && u.phone.equals(mySelf.phone)) {
|
||||
mySelf = u;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ import java.util.List;
|
||||
|
||||
public class LoginActivity extends TrBaseActivity {
|
||||
private TextView show;
|
||||
private EditText username, userpw, userip, userport;
|
||||
private EditText username, userpw, userip, userport, httpHost, httpPort;
|
||||
|
||||
/**
|
||||
* 账号密码服务器地址端口直接在这输入
|
||||
@@ -54,6 +54,8 @@ public class LoginActivity extends TrBaseActivity {
|
||||
private String pw = "";
|
||||
private int port = 0;
|
||||
private String ip = "";
|
||||
private String http_ip = "";
|
||||
private int http_port = 0;
|
||||
QMUITipDialog dialogLoading;
|
||||
|
||||
@Override
|
||||
@@ -65,6 +67,8 @@ public class LoginActivity extends TrBaseActivity {
|
||||
userpw = findViewById(R.id.userpw);
|
||||
userip = findViewById(R.id.userip);
|
||||
userport = findViewById(R.id.userport);
|
||||
httpHost = findViewById(R.id.http_host);
|
||||
httpPort = findViewById(R.id.http_port);
|
||||
if (Build.VERSION.SDK_INT >= 23) {//6.0才用动态权限
|
||||
initPermission();
|
||||
}
|
||||
@@ -75,7 +79,11 @@ public class LoginActivity extends TrBaseActivity {
|
||||
username.setText(obj.getString("name"));
|
||||
userpw.setText(obj.getString("password"));
|
||||
userip.setText(obj.getString("ip"));
|
||||
userport.setText(obj.getInteger("port").toString());
|
||||
Integer port = obj.getInteger("port");
|
||||
userport.setText(port == null? "" : port.toString());
|
||||
httpHost.setText(obj.getString("http_ip"));
|
||||
port = obj.getInteger("http_port");
|
||||
httpPort.setText(port == null? "" : port.toString());
|
||||
|
||||
handler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
@@ -122,9 +130,13 @@ public class LoginActivity extends TrBaseActivity {
|
||||
public void doLogin() {
|
||||
if (SipEngine.getInstance().isonLine())
|
||||
return;
|
||||
if (!isEnable())
|
||||
if (!isEnable()) {
|
||||
UIUtl.toastI("请填写完整的设置信息");
|
||||
return;
|
||||
}
|
||||
dialogLoading = UIUtl.toastLoading("");
|
||||
Net.ip = http_ip;
|
||||
Net.port = http_port;
|
||||
SipEngine.getInstance().init();//先初始化
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
@@ -143,6 +155,8 @@ public class LoginActivity extends TrBaseActivity {
|
||||
boolean b = false;
|
||||
boolean c = false;
|
||||
boolean d = false;
|
||||
boolean e = false;
|
||||
boolean f = false;
|
||||
if (username.getText().toString() != null && !username.getText().toString().equals("")) {
|
||||
name = username.getText().toString();
|
||||
a = true;
|
||||
@@ -160,7 +174,16 @@ public class LoginActivity extends TrBaseActivity {
|
||||
d = true;
|
||||
}
|
||||
|
||||
return a && b && c && d;
|
||||
if (httpHost.getText().toString() != null && !httpHost.getText().toString().equals("")) {
|
||||
http_ip = httpHost.getText().toString();
|
||||
e = true;
|
||||
}
|
||||
if (httpPort.getText().toString() != null && !httpPort.getText().toString().equals("")) {
|
||||
http_port = Integer.parseInt(httpPort.getText().toString());
|
||||
f = true;
|
||||
}
|
||||
|
||||
return a && b && c && d && e && f;
|
||||
|
||||
}
|
||||
|
||||
@@ -175,6 +198,8 @@ public class LoginActivity extends TrBaseActivity {
|
||||
jo.put("password", password);
|
||||
jo.put("ip", ip);
|
||||
jo.put("port", port);
|
||||
jo.put("http_ip", http_ip);
|
||||
jo.put("http_port", http_port);
|
||||
SharedPreferences sp = getSharedPreferences("UserInfor", MODE_PRIVATE);
|
||||
sp.edit().putString("content", jo.toJSONString()).commit();
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.graphics.Color;
|
||||
import android.media.AudioManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -56,6 +57,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MainActivity extends TrBaseActivity {
|
||||
public static Handler mainHandler;
|
||||
TextView textVolum;
|
||||
TextView textSelfNum;
|
||||
QMUITabSegment mTabSegment;
|
||||
@@ -71,6 +73,8 @@ public class MainActivity extends TrBaseActivity {
|
||||
ImageView buttonAddVol;
|
||||
ImageView buttonDelVol;
|
||||
DBHead currSelectData;
|
||||
ImageView imageViewSelfStatus;
|
||||
TextView textViewSelfStatus;
|
||||
|
||||
GridView gridUser;
|
||||
List<Object> allUsers = new ArrayList<>();
|
||||
@@ -119,6 +123,8 @@ public class MainActivity extends TrBaseActivity {
|
||||
setContentView(R.layout.activity_main);
|
||||
textVolum = findViewById(R.id.Volumne);
|
||||
textSelfNum = findViewById(R.id.textViewSelfNum);
|
||||
imageViewSelfStatus = findViewById(R.id.imageViewSelfStatus);
|
||||
textViewSelfStatus = findViewById(R.id.textViewSelfStatus);
|
||||
mTabSegment = findViewById(R.id.HeadList);
|
||||
gridUser = findViewById(R.id.GridUser);
|
||||
mContentViewPager = findViewById(R.id.contentViewPager);
|
||||
@@ -144,6 +150,7 @@ public class MainActivity extends TrBaseActivity {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
mainHandler = this.handler;
|
||||
|
||||
ButtonDelGroup.setVisibility(View.INVISIBLE);
|
||||
StartMeetingVoice.setVisibility(View.INVISIBLE);
|
||||
@@ -155,7 +162,7 @@ public class MainActivity extends TrBaseActivity {
|
||||
headers.add(currSelectData);
|
||||
initTabAndPager();
|
||||
Net.getGroups(null, null);
|
||||
Net.getUsers(null, null);
|
||||
getUsersData();
|
||||
checkBeforeMeetingState();
|
||||
}
|
||||
|
||||
@@ -243,6 +250,7 @@ public class MainActivity extends TrBaseActivity {
|
||||
if (currSelectData.isAll()) {
|
||||
allUsers.addAll(DBUser.allUser);
|
||||
setUsers();
|
||||
Net.getUsers(null, null);
|
||||
} else {
|
||||
DBGroup group = DBGroup.getGroup(currSelectData.id);
|
||||
if (group != null) {
|
||||
@@ -290,6 +298,17 @@ public class MainActivity extends TrBaseActivity {
|
||||
buttonAddGroup.setVisibility(View.INVISIBLE);
|
||||
imageViewAddGroupIcon.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
if (DBUser.mySelf.isBusy()) {
|
||||
imageViewSelfStatus.setColorFilter(Color.RED);
|
||||
textViewSelfStatus.setText("通话中");
|
||||
} else if (DBUser.mySelf.isOnline()) {
|
||||
imageViewSelfStatus.setColorFilter(Color.GREEN);
|
||||
textViewSelfStatus.setText("在线");
|
||||
} else {
|
||||
imageViewSelfStatus.setColorFilter(Color.GRAY);
|
||||
textViewSelfStatus.setText("离线");
|
||||
}
|
||||
}
|
||||
|
||||
void chgVolum(View v, boolean isAdd) {
|
||||
@@ -314,7 +333,7 @@ public class MainActivity extends TrBaseActivity {
|
||||
static Runnable runGetUsers = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Net.getUsers(null, null);
|
||||
getUsersData();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -322,8 +341,9 @@ public class MainActivity extends TrBaseActivity {
|
||||
return gridUser;
|
||||
}
|
||||
|
||||
public void getUsersData() {
|
||||
handler.postDelayed(runGetUsers, 3000);
|
||||
public static void getUsersData() {
|
||||
Net.getUsers(null, null);
|
||||
mainHandler.postDelayed(runGetUsers, 3000);
|
||||
}
|
||||
|
||||
public void setUsers() {
|
||||
@@ -404,7 +424,7 @@ public class MainActivity extends TrBaseActivity {
|
||||
public void onClick(QMUIQuickAction quickAction, QMUIQuickAction.Action action, int position) {
|
||||
quickAction.dismiss();
|
||||
QMUITipDialog dialog = UIUtl.toastLoading("");
|
||||
Net.kickMember4Group(currSelectData.audio_code, d.phone, new HttpUtl.CallBack() {
|
||||
Net.deleteMember4Group(currSelectData.id, d.phone, new HttpUtl.CallBack() {
|
||||
@Override
|
||||
public void onRequestComplete(int cmd, String result, Object orgs) {
|
||||
UIUtl.toastS("移除分机成功");
|
||||
@@ -526,6 +546,7 @@ public class MainActivity extends TrBaseActivity {
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
mainHandler.removeCallbacks(runGetUsers);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -535,12 +556,12 @@ public class MainActivity extends TrBaseActivity {
|
||||
finish();
|
||||
break;
|
||||
case Net.CMD_getUsers:
|
||||
getUsersData();
|
||||
if (currSelectData.isAll()) {
|
||||
allUsers.clear();
|
||||
allUsers.addAll(DBUser.allUser);
|
||||
setUsers();
|
||||
}
|
||||
refreshView();
|
||||
break;
|
||||
case Net.CMD_getGroupMenbers:
|
||||
NetPkg pkg = (NetPkg) (m.obj);
|
||||
@@ -555,8 +576,8 @@ public class MainActivity extends TrBaseActivity {
|
||||
u.isAddFlag = true;
|
||||
allUsers.add(u);
|
||||
}
|
||||
setUsers();
|
||||
}
|
||||
setUsers();
|
||||
break;
|
||||
case Net.CMD_getGroups:
|
||||
refreshHeaders();
|
||||
@@ -568,7 +589,6 @@ public class MainActivity extends TrBaseActivity {
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
handler.removeCallbacks(runGetUsers);
|
||||
}
|
||||
|
||||
public void addVolume(View view) {
|
||||
|
||||
@@ -32,6 +32,7 @@ public class Net {
|
||||
public static final int CMD_unvmuteMember4Group = 7013;
|
||||
public static final int CMD_vidlayoutMember4Group = 7014;
|
||||
public static final int CMD_vidfloorMember4Group = 7015;
|
||||
public static final int CMD_deleteMember4Group = 7016;
|
||||
|
||||
static HttpUtl.CallBack _callback = new HttpUtl.CallBack() {
|
||||
@Override
|
||||
@@ -97,7 +98,7 @@ public class Net {
|
||||
|
||||
public static void createMeeting(String topic, String description, String members, HttpUtl.CallBack callBack, Object orgs) {
|
||||
String url = "http://" + ip + ":" + port + "/api/conferences/conference/insert";
|
||||
String _params = "topic=" + topic + "&description=" + description + "&members=" + members + "&typ=prompt" + "&start_member=" + DBUser.mySelf.phone;
|
||||
String _params = "topic=" + topic + "&description=" + description + "&members=" + members + "&type=prompt" + "&start_member=" + DBUser.mySelf.phone;
|
||||
Object[] params = {callBack, orgs};
|
||||
HttpUtl.doPostAsyn(url, _params, _callback, CMD_createMeeting, params);
|
||||
}
|
||||
@@ -135,6 +136,13 @@ public class Net {
|
||||
HttpUtl.doPostAsyn(url, _params, _callback, CMD_addUser2Group, params);
|
||||
}
|
||||
|
||||
public static void deleteMember4Group(String task_uuid, String members, HttpUtl.CallBack callBack, Object orgs) {
|
||||
String url = "http://" + ip + ":" + port + "/api/conferences/conference/delete";
|
||||
String _params = "task_uuid=" + task_uuid + "&members=" + members;
|
||||
Object[] params = {callBack, orgs};
|
||||
HttpUtl.doPostAsyn(url, _params, _callback, CMD_deleteMember4Group, params);
|
||||
}
|
||||
|
||||
public static void kickMember4Group(String task_uuid, String members, HttpUtl.CallBack callBack, Object orgs) {
|
||||
String url = "http://" + ip + ":" + port + "/api/conferences/conference/update";
|
||||
String _params = "opr_nbr=" + task_uuid + "&opr_member=" + members + "&opr_action=kick";
|
||||
|
||||
@@ -18,6 +18,7 @@ public class TrBaseActivity extends AppCompatActivity implements Handler.Callbac
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
@@ -25,10 +26,18 @@ public class TrBaseActivity extends AppCompatActivity implements Handler.Callbac
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
ActivityMgr.onHideActivity(this);
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
ActivityMgr.onHideActivity(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ public class UIUtl {
|
||||
System.out.println(e);
|
||||
}
|
||||
}
|
||||
}, 1200);
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
public static TrAdapter setList(Context context, GridView grid, int convertViewId, Object list, TrAdapter.Callback callback) {
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
package com.tianrun.sipcall.utils;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageItemInfo;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import com.tianrun.sipcall.App;
|
||||
import com.tianrun.sipcall.SipEngine;
|
||||
import com.tianrun.sipcall.login.LoginActivity;
|
||||
import com.tianrun.sipcall.ui.ActivityMgr;
|
||||
import com.tianrun.sipcall.ui.UIUtl;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
@@ -137,13 +146,14 @@ public class HttpUtl {
|
||||
baos.write(buf, 0, len);
|
||||
}
|
||||
baos.flush();
|
||||
if (baos.toString()==null||baos.toString().equals("")) {
|
||||
if (baos.toString() == null || baos.toString().equals("")) {
|
||||
Log.i("http", "result为空");
|
||||
} else {
|
||||
Log.i("http", baos.toString());
|
||||
}
|
||||
return baos.toString();
|
||||
} else {
|
||||
checkTokenFailed(retCode);
|
||||
throw new RuntimeException(" responseCode :" + retCode);
|
||||
}
|
||||
|
||||
@@ -166,6 +176,25 @@ public class HttpUtl {
|
||||
// return null;
|
||||
}
|
||||
|
||||
static void checkTokenFailed(int code) {
|
||||
if(code == 401) {
|
||||
UIUtl.toastI("Token 失效");
|
||||
|
||||
if(ActivityMgr.topActivity != null) {
|
||||
SipEngine.getInstance().onLine = false;
|
||||
SipEngine.getInstance().isRelogin = true;
|
||||
// SipEngine.getInstance().Unregister();
|
||||
// SipEngine.getInstance().stop();
|
||||
Intent intent = new Intent(App.getContext(), LoginActivity.class);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putBoolean("donotAutoLogin", true);
|
||||
intent.putExtras(bundle);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
ActivityMgr.topActivity.startActivity(intent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 向指定 URL 发送POST方法的请求
|
||||
*
|
||||
@@ -217,6 +246,9 @@ public class HttpUtl {
|
||||
if (result .equals("{}")){
|
||||
result = conn.getResponseCode()+"";
|
||||
}
|
||||
|
||||
int retCode = conn.getResponseCode();
|
||||
checkTokenFailed(retCode);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Log.i("http", e.toString());
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="@color/whitesmoke"
|
||||
@@ -11,8 +12,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="null"
|
||||
android:textColor="#FFFFFF"
|
||||
android:text="设置"
|
||||
android:textColor="#363636"
|
||||
android:textSize="20sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
@@ -23,62 +24,229 @@
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp">
|
||||
android:orientation="vertical">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/username"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="50sp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/corners_black"
|
||||
android:hint="账号"
|
||||
android:padding="5dp"
|
||||
android:text="5503"
|
||||
android:textColor="@color/blackcolor"
|
||||
android:textColorHint="@color/gray"
|
||||
android:textSize="15sp" />
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:singleLine="true"
|
||||
android:text="SIP设置"
|
||||
android:textColor="#CCCCCC"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/userpw"
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="50sp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/corners_black"
|
||||
android:hint="密码"
|
||||
android:padding="5dp"
|
||||
android:text="!@#123Qw"
|
||||
android:textColor="@color/blackcolor"
|
||||
android:textColorHint="@color/gray"
|
||||
android:textSize="15sp" />
|
||||
android:layout_height="50dp"
|
||||
android:background="#FFFFFF"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="visible">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/userip"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="50sp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/corners_black"
|
||||
android:hint="服务器地址"
|
||||
android:padding="5dp"
|
||||
android:text="47.111.20.34"
|
||||
android:textColor="@color/blackcolor"
|
||||
android:textColorHint="@color/gray"
|
||||
android:textSize="15sp" />
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_weight="0.5"
|
||||
android:gravity="center_vertical"
|
||||
android:singleLine="true"
|
||||
android:text="分机号"
|
||||
android:textColor="#000000"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/userport"
|
||||
<EditText
|
||||
android:id="@+id/username"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1.5"
|
||||
android:hint="请输入"
|
||||
android:singleLine="true"
|
||||
android:textColor="#000000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="5dp"
|
||||
android:background="#FFFFFF"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="visible">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_weight="0.5"
|
||||
android:gravity="center_vertical"
|
||||
android:singleLine="true"
|
||||
android:text="密码"
|
||||
android:textColor="#000000"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/userpw"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1.5"
|
||||
android:hint="请输入"
|
||||
android:singleLine="true"
|
||||
android:textColor="#000000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="5dp"
|
||||
android:background="#FFFFFF"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="visible">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_weight="0.5"
|
||||
android:gravity="center_vertical"
|
||||
android:singleLine="true"
|
||||
android:text="SIP服务器"
|
||||
android:textColor="#000000"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/userip"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1.5"
|
||||
android:hint="请输入"
|
||||
android:singleLine="true"
|
||||
android:textColor="#000000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="5dp"
|
||||
android:background="#FFFFFF"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="visible">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_weight="0.5"
|
||||
android:gravity="center_vertical"
|
||||
android:singleLine="true"
|
||||
android:text="SIP端口"
|
||||
android:textColor="#000000"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/userport"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1.5"
|
||||
android:hint="请输入"
|
||||
android:singleLine="true"
|
||||
android:textColor="#000000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView4"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:singleLine="true"
|
||||
android:text="服务器设置"
|
||||
android:textColor="#CCCCCC"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="5dp"
|
||||
android:background="#FFFFFF"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="visible">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_weight="0.5"
|
||||
android:gravity="center_vertical"
|
||||
android:singleLine="true"
|
||||
android:text="服务器"
|
||||
android:textColor="#000000"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/http_host"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1.5"
|
||||
android:hint="请输入"
|
||||
android:singleLine="true"
|
||||
android:textColor="#000000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="50sp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/corners_black"
|
||||
android:hint="端口"
|
||||
android:padding="5dp"
|
||||
android:text="5060"
|
||||
android:textColor="@color/blackcolor"
|
||||
android:textColorHint="@color/gray"
|
||||
android:textSize="15sp" />
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:background="#FFFFFF"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="visible">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_weight="0.5"
|
||||
android:gravity="center_vertical"
|
||||
android:singleLine="true"
|
||||
android:text="端口"
|
||||
android:textColor="#000000"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/http_port"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1.5"
|
||||
android:hint="请输入"
|
||||
android:singleLine="true"
|
||||
android:textColor="#000000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView5"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="30dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<Button
|
||||
android:layout_width="fill_parent"
|
||||
@@ -86,7 +254,7 @@
|
||||
android:layout_margin="10dp"
|
||||
android:background="@drawable/callpad_bg"
|
||||
android:onClick="login"
|
||||
android:text="登录"
|
||||
android:text="确定"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="20sp" />
|
||||
|
||||
@@ -102,7 +270,8 @@
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="20sp"
|
||||
android:visibility="invisible" />
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
@@ -94,9 +94,33 @@
|
||||
android:layout_marginBottom="50dp"
|
||||
android:background="@drawable/bt_bgd"
|
||||
android:onClick="logout"
|
||||
android:text="退出"
|
||||
android:text="设置"
|
||||
android:textColor="#FFFFFF" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageViewSelfStatus"
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="10dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginStart="18dp"
|
||||
android:layout_marginBottom="7dp"
|
||||
android:layout_weight="1"
|
||||
app:srcCompat="@drawable/circle"
|
||||
app:tint="#5EE463" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewSelfStatus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:text="在线"
|
||||
android:textAlignment="textStart"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewSelfNum"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -105,7 +129,7 @@
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:text="号码:xxxx"
|
||||
android:textAlignment="center"
|
||||
android:textSize="12sp" />
|
||||
|
||||
@@ -78,6 +78,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/qmui_divider"
|
||||
android:onClick="exit"
|
||||
android:text="取消"
|
||||
android:textColor="@color/redcolor"
|
||||
@@ -88,8 +89,10 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/callpad_bg"
|
||||
android:onClick="createGroup"
|
||||
android:text="创建分组" />
|
||||
android:text="创建分组"
|
||||
android:textColor="#FFFFFF" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/IncallMeetingRoot"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="@drawable/callbackground">
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView3"
|
||||
@@ -94,8 +93,8 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/qmui_divider"
|
||||
android:src="@drawable/voice2"
|
||||
android:background="@drawable/bt_bgd"
|
||||
android:src="@drawable/mute"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ImageButton
|
||||
@@ -103,7 +102,7 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/qmui_divider"
|
||||
android:background="@drawable/bt_bgd"
|
||||
android:src="@drawable/unvideo"
|
||||
tools:visibility="visible" />
|
||||
|
||||
|
||||
Reference in New Issue
Block a user