all
15
.gitignore
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
*.iml
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/caches
|
||||
/.idea/libraries
|
||||
/.idea/modules.xml
|
||||
/.idea/workspace.xml
|
||||
/.idea/navEditor.xml
|
||||
/.idea/assetWizardSettings.xml
|
||||
.DS_Store
|
||||
/build
|
||||
/captures
|
||||
.externalNativeBuild
|
||||
.cxx
|
||||
.idea
|
||||
1
app/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
47
app/build.gradle
Normal file
@@ -0,0 +1,47 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
buildToolsVersion "29.0.3"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.tianrun.siphone"
|
||||
minSdkVersion 19
|
||||
// targetSdkVersion 29
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
multiDexEnabled true
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
ndk{
|
||||
abiFilters "armeabi"
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
|
||||
|
||||
implementation 'com.qmuiteam:qmui:2.0.0-alpha10'
|
||||
|
||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
||||
implementation 'com.google.android.material:material:1.2.0'
|
||||
implementation 'androidx.gridlayout:gridlayout:1.0.0'
|
||||
implementation files('libs/fastjson-1.1.36.jar')
|
||||
testImplementation 'junit:junit:4.13'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
}
|
||||
BIN
app/libs/alllibs-release.aar
Normal file
BIN
app/libs/fastjson-1.1.36.jar
Normal file
21
app/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@@ -0,0 +1,26 @@
|
||||
package cn.bluetel.bluetelsiptestdemo;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getTargetContext();
|
||||
|
||||
assertEquals("cn.bluetel.bluetelsiptestdemo", appContext.getPackageName());
|
||||
}
|
||||
}
|
||||
106
app/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,106 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.tianrun.sipcall"
|
||||
tools:ignore="LockedOrientationActivity">
|
||||
|
||||
<uses-permission android:name="android.permission.NFC" /> <!-- 这个是限制安装权限,只给有nfc功能的手机安装(可选) -->
|
||||
<uses-feature
|
||||
android:name="android.hardware.nfc"
|
||||
android:required="true" /> <!-- 允许设置时区 -->
|
||||
<uses-permission android:name="android.permission.SET_TIME_ZONE" /> <!-- 显示系统窗口权限 -->
|
||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> <!-- 在 屏幕最顶部显示addview -->
|
||||
<uses-permission android:name="android.permission.SYSTEM_OVERLAY_WINDOW" />
|
||||
<uses-permission android:name="android.permission.RESTART_PACKAGES" />
|
||||
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
|
||||
<uses-permission android:name="android.permission.MODIFY_APPWIDGET_BIND_PERMISSIONS" />
|
||||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.READ_LOGS" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
<uses-permission android:name="android.permission.READ_CONTACTS" />
|
||||
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
|
||||
<uses-permission android:name="android.permission.CALL_PHONE" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
|
||||
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
|
||||
<uses-permission android:name="android.permission.READ_CALL_LOG" />
|
||||
<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.BAIDU_LOCATION_SERVICE" />
|
||||
|
||||
|
||||
<application
|
||||
android:name=".App"
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:usesCleartextTraffic="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity
|
||||
android:name=".login.LoginActivity"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTask"
|
||||
android:windowSoftInputMode="adjustResize|stateHidden"
|
||||
android:screenOrientation="landscape">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".login.MainActivity"
|
||||
android:launchMode="singleTask"
|
||||
android:windowSoftInputMode="adjustResize|stateHidden"
|
||||
android:screenOrientation="landscape" />
|
||||
<activity
|
||||
android:name=".call.CallActivity"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="landscape" />
|
||||
<activity
|
||||
android:name=".call.InCallActivity"
|
||||
android:launchMode="singleInstance"
|
||||
android:screenOrientation="landscape" />
|
||||
<activity
|
||||
android:name=".call.InCallMeetingActivity"
|
||||
android:launchMode="singleInstance"
|
||||
android:screenOrientation="landscape" />
|
||||
<activity
|
||||
android:name=".call.CreateMeetingActivity"
|
||||
android:launchMode="singleInstance"
|
||||
android:windowSoftInputMode="adjustResize|stateHidden"
|
||||
android:screenOrientation="landscape" />
|
||||
<activity
|
||||
android:name=".call.CreateGroupActivity"
|
||||
android:launchMode="singleInstance"
|
||||
android:windowSoftInputMode="adjustResize|stateHidden"
|
||||
android:screenOrientation="landscape" />
|
||||
<receiver android:name=".BootBroadcastReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED"/>
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
38
app/src/main/java/com/tianrun/sipcall/App.java
Normal file
@@ -0,0 +1,38 @@
|
||||
package com.tianrun.sipcall;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.multidex.MultiDexApplication;
|
||||
|
||||
|
||||
public class App extends MultiDexApplication {
|
||||
|
||||
public static String TAG = "ApplicationAPP";
|
||||
private static App sInstance;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
sInstance = this;
|
||||
}
|
||||
|
||||
public static App getInstance() {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public static Context getContext() {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public static String getRString(int resid) {
|
||||
return sInstance.getString(resid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTerminate() {
|
||||
super.onTerminate();
|
||||
Log.e(TAG, "Application终止");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.tianrun.sipcall;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.tianrun.sipcall.login.LoginActivity;
|
||||
|
||||
public class BootBroadcastReceiver extends BroadcastReceiver {
|
||||
static final String ACTION = "android.intent.action.BOOT_COMPLETED";
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if(intent.getAction().equals(ACTION)){
|
||||
Intent myIntent = new Intent(context, LoginActivity.class);
|
||||
myIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(myIntent);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
318
app/src/main/java/com/tianrun/sipcall/SipEngine.java
Normal file
@@ -0,0 +1,318 @@
|
||||
package com.tianrun.sipcall;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.tianrun.sipcall.call.CallMediaUtils;
|
||||
import com.tianrun.sipcall.call.InCallActivity;
|
||||
import com.tianrun.sipcall.call.InCallMeetingActivity;
|
||||
import com.tianrun.sipcall.call.utils.InCallUtils;
|
||||
import com.tianrun.sipcall.net.Net;
|
||||
import com.tianrun.sipcall.ui.ActivityMgr;
|
||||
import com.tianrun.sipcall.ui.UIUtl;
|
||||
import com.tianrun.sipcall.utils.CONS;
|
||||
import com.tianrun.sipcall.utils.HttpUtl;
|
||||
import com.tianrun.sipcall.utils.logmy;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import blue.all.BluetelEngine;
|
||||
import blue.bluetelobserver.BluetelInterface;
|
||||
|
||||
|
||||
public class SipEngine implements BluetelInterface {
|
||||
|
||||
public static final String TAG = "TestEngine";
|
||||
|
||||
private static SipEngine Instance;
|
||||
public boolean onLine = false;
|
||||
public boolean isRelogin = false;
|
||||
private String name = "0";
|
||||
private String pw = "0";
|
||||
public String ip = "0";
|
||||
private int port = 0;
|
||||
public static List<InCallUtils> callPagesConfig = new ArrayList<InCallUtils>();//所有通话页面的集合
|
||||
|
||||
private BluetelEngine myBluetelEngine;
|
||||
|
||||
public static SipEngine getInstance() {
|
||||
if (Instance == null)
|
||||
Instance = new SipEngine();
|
||||
return Instance;
|
||||
}
|
||||
|
||||
//删除页面配置
|
||||
private void removeConfig(int callid) {
|
||||
//移除页面配置
|
||||
InCallUtils cursorPagesConfig = null;
|
||||
for (InCallUtils icu : callPagesConfig) {
|
||||
if (icu.getCallId() == callid) {
|
||||
cursorPagesConfig = icu;
|
||||
}
|
||||
}
|
||||
if (cursorPagesConfig != null) {
|
||||
callPagesConfig.remove(cursorPagesConfig);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据号码查通话的id
|
||||
*
|
||||
* @param callnumber
|
||||
* @return
|
||||
*/
|
||||
public int getCallId(String callnumber) {
|
||||
int res = 0;
|
||||
for (InCallUtils icu : callPagesConfig) {
|
||||
if (icu.getCallNumber().equals(callnumber)) {
|
||||
res = icu.getCallId();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 退出
|
||||
*/
|
||||
public void stop() {
|
||||
myBluetelEngine.deinit();
|
||||
}
|
||||
|
||||
public String getip() {
|
||||
return ip;
|
||||
}
|
||||
public String getName() {return name;};
|
||||
|
||||
public boolean isonLine() {
|
||||
return onLine;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
if (myBluetelEngine == null) {
|
||||
myBluetelEngine = new BluetelEngine(App.getContext(), this);
|
||||
} else {
|
||||
myBluetelEngine.Stop();
|
||||
myBluetelEngine = new BluetelEngine(App.getContext(), this);
|
||||
}
|
||||
logmy.e("服务启动");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 注册
|
||||
*
|
||||
* @param name
|
||||
* @param pw
|
||||
* @param ip
|
||||
* @param port
|
||||
*/
|
||||
public void Register(String name, String pw, String ip, int port) {
|
||||
this.name = name;
|
||||
this.pw = pw;
|
||||
this.ip = ip;
|
||||
this.port = port;
|
||||
myBluetelEngine.Register(name, pw, ip, port);
|
||||
}
|
||||
|
||||
/**
|
||||
* 注销
|
||||
*/
|
||||
public void Unregister() {
|
||||
onLine = false;
|
||||
myBluetelEngine.Stop();
|
||||
}
|
||||
|
||||
|
||||
/**************************** 接口 *************************************************/
|
||||
|
||||
@Override
|
||||
public void AccountState(String uri, boolean state) {
|
||||
logmy.e(uri + "-->" + state);
|
||||
if (state) {
|
||||
if (!onLine) {
|
||||
onLine = true;
|
||||
Net.login(this.name, this.pw, new HttpUtl.CallBack() {
|
||||
@Override
|
||||
public void onRequestComplete(int cmd, String result, Object orgs) {
|
||||
ActivityMgr.sendMsg(CONS.LOGIN, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestError(int cmd, String result, Object orgs) {
|
||||
UIUtl.toastI("取得token失败");
|
||||
ActivityMgr.sendMsg(CONS.LOGINFAILED, null);
|
||||
}
|
||||
}, null);
|
||||
}
|
||||
} else {
|
||||
if(!onLine && !isRelogin) {
|
||||
UIUtl.toastI("Sip登陆失败");
|
||||
ActivityMgr.sendMsg(CONS.LOGINFAILED, null);
|
||||
}
|
||||
}
|
||||
isRelogin = false;
|
||||
}
|
||||
|
||||
public boolean isMeetingCall(String phoneNo) {
|
||||
if (phoneNo.length() >= 5) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void FirstIncoming(String incomingNumber, boolean isVideo, int rPort, int lPort, boolean isHolder, int callid) {
|
||||
logmy.e("FirstIncoming:" + incomingNumber + "<>" + isVideo + "<>" + rPort + "<>" + lPort + "<>" + isHolder + "<>" + callid);
|
||||
int calltype = isVideo == false ? 0 : 1;
|
||||
String state = isVideo == true ? "视频来电" : "音频来电";
|
||||
callPagesConfig.add(new InCallUtils(incomingNumber, isHolder, isVideo, rPort, lPort, incomingNumber, state, false, 0, callid));
|
||||
GoToInCall(App.getContext(), incomingNumber, "来电", calltype, callid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void OtherIncoming(String incomingNumber, boolean isVideo, int rPort, int lPort, boolean isHolder, int callid) {
|
||||
logmy.e("OtherIncoming:" + incomingNumber + "<>" + isVideo + "<>" + rPort + "<>" + lPort + "<>" + isHolder + "<>" + callid);
|
||||
String state = isVideo == true ? "视频来电" : "音频来电";
|
||||
callPagesConfig.add(new InCallUtils(incomingNumber, isHolder, isVideo, rPort, lPort, incomingNumber, state, false, 0, callid));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void StateCallDown(int callid, String number) {
|
||||
logmy.e(callid + "<>" + number);
|
||||
removeConfig(callid);
|
||||
ActivityMgr.sendMsg(CONS.CALLDOWN, callid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void CallState(int callid, int callstate, String number) {
|
||||
String stateValues = "未知状态";
|
||||
switch (callstate) {
|
||||
case 1:
|
||||
stateValues = "呼叫中";//也可以在这里启动主动呼叫界面(此demo主动启动页面做在了button上)
|
||||
break;
|
||||
case 2:
|
||||
stateValues = "未知";
|
||||
break;
|
||||
case 3:
|
||||
stateValues = "振铃中";
|
||||
break;
|
||||
case 4:
|
||||
stateValues = "连接中";
|
||||
break;
|
||||
case 5:
|
||||
stateValues = "通话中";
|
||||
//一般在这里进行增益调节
|
||||
break;
|
||||
case 6:
|
||||
stateValues = "挂断";
|
||||
break;
|
||||
}
|
||||
logmy.e(callid + "<>" + stateValues + "<>" + number);
|
||||
|
||||
ActivityMgr.sendMsg(CONS.CALLSTATE, stateValues);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void NotifyCallMediaState(int callid, int r, int l, int payload) {
|
||||
logmy.e("NotifyCallMediaState" + callid + "<>" + r + "<>" + l + "<>" + payload);
|
||||
ActivityMgr.sendMsg(CONS.MEDIASTATE, new CallMediaUtils(callid, payload, r, l));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ErrorMessage(String s) {
|
||||
logmy.e(s);
|
||||
}
|
||||
|
||||
|
||||
/************************ 方法 ***************************************************/
|
||||
|
||||
/**
|
||||
* 去通话页面 要在NotifyCallMediaState接口之前页面开好
|
||||
*
|
||||
* @param context
|
||||
* @param callnumber
|
||||
* @param callstate
|
||||
* @param calltype
|
||||
* @param callid
|
||||
*/
|
||||
public void GoToInCall(Context context, String callnumber, String callstate, int calltype, int callid) {
|
||||
Intent intent = null;
|
||||
if (isMeetingCall(callnumber)) {
|
||||
intent = new Intent(context, InCallMeetingActivity.class);
|
||||
} else {
|
||||
intent = new Intent(context, InCallActivity.class);
|
||||
}
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putInt("callid", callid);
|
||||
bundle.putString("callnumber", callnumber);
|
||||
bundle.putString("callstate", callstate);
|
||||
bundle.putInt("calltype", calltype);
|
||||
intent.putExtras(bundle);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
/**
|
||||
* 打电话
|
||||
*
|
||||
* @param number 呼叫的号码
|
||||
* @param isVideo 是否是视频呼叫
|
||||
* @return
|
||||
*/
|
||||
public int CallNumber(String number, boolean isVideo) {
|
||||
int callid = myBluetelEngine.CallNumber(number, ip, port, isVideo);
|
||||
int calltype = isVideo ? 0 : 1;
|
||||
GoToInCall(App.getContext(), number, "呼叫中", calltype, callid);
|
||||
callPagesConfig.add(new InCallUtils(number, false, isVideo, 0, 0, number, "呼叫中", false, 0, callid));
|
||||
return callid;
|
||||
}
|
||||
|
||||
/**
|
||||
* 挂断电话
|
||||
*
|
||||
* @param callid
|
||||
*/
|
||||
public void hangup(int callid) {
|
||||
myBluetelEngine.hangup(callid);
|
||||
removeConfig(callid);//移除页面配置
|
||||
}
|
||||
|
||||
/**
|
||||
* 接听电话
|
||||
*
|
||||
* @param callid
|
||||
*/
|
||||
public void answer(int callid) {
|
||||
myBluetelEngine.answer(callid);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通话增益调节
|
||||
*
|
||||
* @param callId
|
||||
* @param tx
|
||||
* @param rx
|
||||
*/
|
||||
public void setAdjustAudio(int callId, int tx, int rx) {
|
||||
myBluetelEngine.setAdjustAudio2(callId, tx, rx);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通话保持
|
||||
*
|
||||
* @param isHolder
|
||||
* @param callid
|
||||
* @return
|
||||
*/
|
||||
public boolean Holder(boolean isHolder, int callid) {
|
||||
return myBluetelEngine.Holder(isHolder, callid);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
91
app/src/main/java/com/tianrun/sipcall/call/CallActivity.java
Normal file
@@ -0,0 +1,91 @@
|
||||
package com.tianrun.sipcall.call;
|
||||
|
||||
import com.tianrun.sipcall.R;
|
||||
import com.tianrun.sipcall.SipEngine;
|
||||
import com.tianrun.sipcall.ui.TrBaseActivity;
|
||||
import com.tianrun.sipcall.utils.CONS;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Handler.Callback;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.EditText;
|
||||
import android.widget.GridView;
|
||||
import android.widget.ListAdapter;
|
||||
import android.widget.SimpleAdapter;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
public class CallActivity extends TrBaseActivity implements AdapterView.OnItemClickListener {
|
||||
public static Handler handler_CallActivity;
|
||||
// private Handler handler = new Handler(this);
|
||||
|
||||
private String[] nums = {"1","2","3","4","5","6","7","8","9","*","0","#"};
|
||||
private EditText et_callnumber;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_callactivity);
|
||||
handler_CallActivity = handler;
|
||||
et_callnumber = (EditText) findViewById(R.id.et_callnumber);
|
||||
initNumKeyboard();
|
||||
}
|
||||
|
||||
public void initNumKeyboard(){
|
||||
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this.getBaseContext(), android.R.layout.simple_expandable_list_item_1, nums);
|
||||
|
||||
GridView gv = findViewById(R.id.NumKeyBoard);
|
||||
gv.setAdapter(adapter);
|
||||
gv.setOnItemClickListener(this);
|
||||
}
|
||||
|
||||
public void audiocall(View view) {
|
||||
String callnumber = et_callnumber.getText().toString();
|
||||
if (callnumber.isEmpty()) {
|
||||
Toast.makeText(CallActivity.this, "号码不能为空", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
SipEngine.getInstance().CallNumber(callnumber, false);
|
||||
}
|
||||
|
||||
public void videocall(View view) {
|
||||
String callnumber = et_callnumber.getText().toString();
|
||||
if (callnumber.isEmpty()) {
|
||||
Toast.makeText(CallActivity.this, "号码不能为空", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
SipEngine.getInstance().CallNumber(callnumber, true);
|
||||
}
|
||||
|
||||
public void createmeeting(View view)
|
||||
{
|
||||
startActivity(new Intent(this, CreateMeetingActivity.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
handler_CallActivity = null;
|
||||
}
|
||||
@Override
|
||||
public boolean handleMessage(Message m) {
|
||||
switch (m.what) {
|
||||
case CONS.FINISH:
|
||||
finish();
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
et_callnumber.setText(et_callnumber.getText()+nums[position]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.tianrun.sipcall.call;
|
||||
|
||||
public class CallMediaUtils {
|
||||
|
||||
/**
|
||||
* 通话的id
|
||||
*/
|
||||
private int callid;
|
||||
/**
|
||||
* payload
|
||||
*/
|
||||
private int payload;
|
||||
/**
|
||||
* 本地端口
|
||||
*/
|
||||
private int l;
|
||||
/**
|
||||
* 远程端口
|
||||
*/
|
||||
private int r;
|
||||
|
||||
|
||||
public CallMediaUtils(int callid, int payload, int r, int l) {
|
||||
super();
|
||||
this.callid = callid;
|
||||
this.payload = payload;
|
||||
this.l = l;
|
||||
this.r = r;
|
||||
}
|
||||
public int getCallid() {
|
||||
return callid;
|
||||
}
|
||||
public void setCallid(int callid) {
|
||||
this.callid = callid;
|
||||
}
|
||||
public int getPayload() {
|
||||
return payload;
|
||||
}
|
||||
public void setPayload(int payload) {
|
||||
this.payload = payload;
|
||||
}
|
||||
public int getL() {
|
||||
return l;
|
||||
}
|
||||
public void setL(int l) {
|
||||
this.l = l;
|
||||
}
|
||||
public int getR() {
|
||||
return r;
|
||||
}
|
||||
public void setR(int r) {
|
||||
this.r = r;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,239 @@
|
||||
package com.tianrun.sipcall.call;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.os.Message;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.GridView;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.qmuiteam.qmui.skin.QMUISkinManager;
|
||||
import com.qmuiteam.qmui.widget.dialog.QMUIDialog;
|
||||
import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction;
|
||||
import com.qmuiteam.qmui.widget.dialog.QMUITipDialog;
|
||||
import com.tianrun.sipcall.R;
|
||||
import com.tianrun.sipcall.SipEngine;
|
||||
import com.tianrun.sipcall.db.DBUser;
|
||||
import com.tianrun.sipcall.net.Net;
|
||||
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 java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class CreateGroupActivity extends TrBaseActivity {
|
||||
TextView meetingTopic;
|
||||
GridView gridUsers;
|
||||
TrAdapter adapterUser;
|
||||
|
||||
List<DBUser> users = new ArrayList<>();
|
||||
HashMap<String, DBUser> mapUsers = new HashMap<>();
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.creatgroup_view);
|
||||
|
||||
View rootView = findViewById(R.id.RelativeLayoutNewGroupRoot);
|
||||
meetingTopic = rootView.findViewById(R.id.group_name);
|
||||
gridUsers = rootView.findViewById(R.id.GridUser_select);
|
||||
|
||||
users.clear();
|
||||
mapUsers.clear();
|
||||
DBUser u = new DBUser("", "添加分机号", "");
|
||||
u.isAddFlag = true;
|
||||
users.add(u);
|
||||
|
||||
setList(null);
|
||||
}
|
||||
|
||||
public class UserSelectViews {
|
||||
public TextView textViewName;
|
||||
public TextView textViewNum;
|
||||
public ImageView imageViewStatus;
|
||||
public Button buttonDel;
|
||||
public CheckBox checkBox;
|
||||
public ImageView getImageViewPhoneIcon;
|
||||
public ImageView imageViewAddflag;
|
||||
}
|
||||
|
||||
public void setList(List<DBUser> list) {
|
||||
if (list != null) {
|
||||
for (DBUser u : list) {
|
||||
mapUsers.put(u.phone, u);
|
||||
users.add(users.size() - 1, u);
|
||||
}
|
||||
}
|
||||
|
||||
if (adapterUser == null) {
|
||||
adapterUser = UIUtl.setList(this, gridUsers, R.layout.list_item_user_select, users, new TrAdapter.Callback() {
|
||||
@Override
|
||||
public void initCallback(Object data, int position, View prefabView, ViewGroup parent) {
|
||||
UserSelectViews views;
|
||||
if (prefabView.getTag() == null) {
|
||||
views = new UserSelectViews();
|
||||
views.textViewName = prefabView.findViewById(R.id.textViewName);
|
||||
views.textViewNum = prefabView.findViewById(R.id.textViewNum);
|
||||
views.imageViewStatus = prefabView.findViewById(R.id.imageViewStatus);
|
||||
views.buttonDel = prefabView.findViewById(R.id.buttonDel);
|
||||
views.checkBox = prefabView.findViewById(R.id.checkBox);
|
||||
views.getImageViewPhoneIcon = prefabView.findViewById(R.id.imageView3PhoneIcon);
|
||||
views.imageViewAddflag = prefabView.findViewById(R.id.imageViewAddFlag);
|
||||
prefabView.setTag(views);
|
||||
} else {
|
||||
views = (UserSelectViews) (prefabView.getTag());
|
||||
}
|
||||
|
||||
DBUser user = (DBUser) data;
|
||||
|
||||
if (user.isAddFlag) {
|
||||
views.imageViewAddflag.setVisibility(View.VISIBLE);
|
||||
views.buttonDel.setVisibility(View.INVISIBLE);
|
||||
views.checkBox.setVisibility(View.INVISIBLE);
|
||||
views.getImageViewPhoneIcon.setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
views.imageViewAddflag.setVisibility(View.INVISIBLE);
|
||||
views.buttonDel.setVisibility(View.VISIBLE);
|
||||
views.checkBox.setVisibility(View.INVISIBLE);
|
||||
views.getImageViewPhoneIcon.setVisibility(View.VISIBLE);
|
||||
}
|
||||
views.textViewName.setText(user.name);
|
||||
views.textViewNum.setText(user.phone);
|
||||
if (user.isOffline()) {
|
||||
views.imageViewStatus.setColorFilter(Color.GRAY);
|
||||
} else if (user.isOnline()) {
|
||||
views.imageViewStatus.setColorFilter(Color.GREEN);
|
||||
} else if (user.isBusy()) {
|
||||
views.imageViewStatus.setColorFilter(Color.RED);
|
||||
} else {
|
||||
views.imageViewStatus.setColorFilter(Color.GRAY);
|
||||
}
|
||||
views.checkBox.setChecked(true);
|
||||
views.checkBox.setClickable(false);
|
||||
// views.checkBox.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
// UserSelect d = (UserSelect) data;
|
||||
// d.isSelected = !d.isSelected;
|
||||
// adapterUser.notifyDataSetChanged();
|
||||
// refreshSelectedUsers();
|
||||
// }
|
||||
// });
|
||||
views.buttonDel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
users.remove(data);
|
||||
mapUsers.remove(user.phone);
|
||||
adapterUser.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clickCallback(Object data, AdapterView<?> parent, View view, int position, long id) {
|
||||
DBUser d = (DBUser) data;
|
||||
if (d.isAddFlag) {
|
||||
showUsersMultiChoiceDialog();
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
adapterUser.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void showUsersMultiChoiceDialog() {
|
||||
List<String> list = new ArrayList<>();
|
||||
List<String> listPhone = new ArrayList<>();
|
||||
for (DBUser u : DBUser.allUser) {
|
||||
if (mapUsers.get(u.phone) == null) {
|
||||
listPhone.add(u.phone);
|
||||
list.add(u.phone + "|" + u.name);
|
||||
}
|
||||
}
|
||||
if(list.size() == 0) {
|
||||
UIUtl.toastI("所有分机已经添加");
|
||||
return;
|
||||
}
|
||||
|
||||
final String[] items = new String[list.size()];
|
||||
list.toArray(items);
|
||||
final QMUIDialog.MultiCheckableDialogBuilder builder = new QMUIDialog.MultiCheckableDialogBuilder(this)
|
||||
.setTitle("选择要加入的分机号")
|
||||
// .setCheckedItems(new int[]{1, 3})
|
||||
.setSkinManager(QMUISkinManager.defaultInstance(this))
|
||||
.addItems(items, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
}
|
||||
});
|
||||
builder.addAction("取消", new QMUIDialogAction.ActionListener() {
|
||||
@Override
|
||||
public void onClick(QMUIDialog dialog, int index) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
builder.addAction("确定", new QMUIDialogAction.ActionListener() {
|
||||
@Override
|
||||
public void onClick(QMUIDialog dialog, int index) {
|
||||
int[] selectIndexs = builder.getCheckedItemIndexes();
|
||||
if (selectIndexs.length > 0) {
|
||||
List<DBUser> list = new ArrayList<>();
|
||||
for (int i = 0; i < selectIndexs.length; i++) {
|
||||
String phNum = listPhone.get(selectIndexs[i]);
|
||||
list.add(DBUser.getUser(phNum));
|
||||
}
|
||||
setList(list);
|
||||
}
|
||||
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
int mCurrentDialogStyle = com.qmuiteam.qmui.R.style.QMUI_Dialog;
|
||||
builder.create(mCurrentDialogStyle).show();
|
||||
}
|
||||
|
||||
public String getSelectedUsers() {
|
||||
String str = "";
|
||||
for (DBUser us : users) {
|
||||
if (!us.isAddFlag) {
|
||||
str = str + us.phone + ",";
|
||||
}
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
public void createGroup(View view) {
|
||||
String userStr = getSelectedUsers();
|
||||
if (userStr == null || userStr == "") {
|
||||
UIUtl.toastI("请添加要加入会议的分机号");
|
||||
return;
|
||||
}
|
||||
//TODO:
|
||||
}
|
||||
|
||||
public void exit(View view) {
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleMessage(@NonNull Message msg) {
|
||||
return super.handleMessage(msg);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,295 @@
|
||||
package com.tianrun.sipcall.call;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.os.Message;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.GridView;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.qmuiteam.qmui.skin.QMUISkinManager;
|
||||
import com.qmuiteam.qmui.widget.dialog.QMUIDialog;
|
||||
import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction;
|
||||
import com.qmuiteam.qmui.widget.dialog.QMUITipDialog;
|
||||
import com.tianrun.sipcall.R;
|
||||
import com.tianrun.sipcall.SipEngine;
|
||||
import com.tianrun.sipcall.db.DBUser;
|
||||
import com.tianrun.sipcall.net.Net;
|
||||
import com.tianrun.sipcall.net.NetPkg;
|
||||
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 java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class CreateMeetingActivity extends TrBaseActivity {
|
||||
TextView meetingTopic;
|
||||
TextView meetingDesc;
|
||||
TextView meetingUsers;
|
||||
GridView gridUsers;
|
||||
TrAdapter adapterUser;
|
||||
|
||||
List<DBUser> users = new ArrayList<>();
|
||||
HashMap<String, DBUser> mapUsers = new HashMap<>();
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.creatmeeting_view);
|
||||
|
||||
meetingTopic = findViewById(R.id.meeting_name);
|
||||
meetingDesc = findViewById(R.id.meeting_desc);
|
||||
meetingUsers = findViewById(R.id.textViewMembers);
|
||||
gridUsers = findViewById(R.id.GridUser_select);
|
||||
|
||||
users.clear();
|
||||
mapUsers.clear();
|
||||
DBUser u = new DBUser("", "添加分机号", "");
|
||||
u.isAddFlag = true;
|
||||
users.add(u);
|
||||
|
||||
setList(null);
|
||||
refreshSelectedUsers();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
refreshSelectedUsers();
|
||||
}
|
||||
|
||||
public class UserSelectViews {
|
||||
public TextView textViewName;
|
||||
public TextView textViewNum;
|
||||
public ImageView imageViewStatus;
|
||||
public Button buttonDel;
|
||||
public CheckBox checkBox;
|
||||
public ImageView getImageViewPhoneIcon;
|
||||
public ImageView imageViewAddflag;
|
||||
}
|
||||
|
||||
public void setList(List<DBUser> list) {
|
||||
if (list != null) {
|
||||
for (DBUser u : list) {
|
||||
mapUsers.put(u.phone, u);
|
||||
users.add(users.size() - 1, u);
|
||||
}
|
||||
}
|
||||
|
||||
if (adapterUser == null) {
|
||||
adapterUser = UIUtl.setList(this, gridUsers, R.layout.list_item_user_select, users, new TrAdapter.Callback() {
|
||||
@Override
|
||||
public void initCallback(Object data, int position, View prefabView, ViewGroup parent) {
|
||||
UserSelectViews views;
|
||||
if (prefabView.getTag() == null) {
|
||||
views = new UserSelectViews();
|
||||
views.textViewName = prefabView.findViewById(R.id.textViewName);
|
||||
views.textViewNum = prefabView.findViewById(R.id.textViewNum);
|
||||
views.imageViewStatus = prefabView.findViewById(R.id.imageViewStatus);
|
||||
views.buttonDel = prefabView.findViewById(R.id.buttonDel);
|
||||
views.checkBox = prefabView.findViewById(R.id.checkBox);
|
||||
views.getImageViewPhoneIcon = prefabView.findViewById(R.id.imageView3PhoneIcon);
|
||||
views.imageViewAddflag = prefabView.findViewById(R.id.imageViewAddFlag);
|
||||
prefabView.setTag(views);
|
||||
} else {
|
||||
views = (UserSelectViews) (prefabView.getTag());
|
||||
}
|
||||
|
||||
DBUser user = (DBUser) data;
|
||||
|
||||
if (user.isAddFlag) {
|
||||
views.imageViewAddflag.setVisibility(View.VISIBLE);
|
||||
views.buttonDel.setVisibility(View.INVISIBLE);
|
||||
views.checkBox.setVisibility(View.INVISIBLE);
|
||||
views.getImageViewPhoneIcon.setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
views.imageViewAddflag.setVisibility(View.INVISIBLE);
|
||||
views.buttonDel.setVisibility(View.VISIBLE);
|
||||
views.checkBox.setVisibility(View.INVISIBLE);
|
||||
views.getImageViewPhoneIcon.setVisibility(View.VISIBLE);
|
||||
}
|
||||
views.textViewName.setText(user.name);
|
||||
views.textViewNum.setText(user.phone);
|
||||
if (user.isOffline()) {
|
||||
views.imageViewStatus.setColorFilter(Color.GRAY);
|
||||
} else if (user.isOnline()) {
|
||||
views.imageViewStatus.setColorFilter(Color.GREEN);
|
||||
} else if (user.isBusy()) {
|
||||
views.imageViewStatus.setColorFilter(Color.RED);
|
||||
} else {
|
||||
views.imageViewStatus.setColorFilter(Color.GRAY);
|
||||
}
|
||||
views.checkBox.setChecked(true);
|
||||
views.checkBox.setClickable(false);
|
||||
// views.checkBox.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
// UserSelect d = (UserSelect) data;
|
||||
// d.isSelected = !d.isSelected;
|
||||
// adapterUser.notifyDataSetChanged();
|
||||
// refreshSelectedUsers();
|
||||
// }
|
||||
// });
|
||||
views.buttonDel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
users.remove(data);
|
||||
mapUsers.remove(user.phone);
|
||||
adapterUser.notifyDataSetChanged();
|
||||
refreshSelectedUsers();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clickCallback(Object data, AdapterView<?> parent, View view, int position, long id) {
|
||||
DBUser d = (DBUser) data;
|
||||
if (d.isAddFlag) {
|
||||
showUsersMultiChoiceDialog();
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
adapterUser.notifyDataSetChanged();
|
||||
refreshSelectedUsers();
|
||||
}
|
||||
}
|
||||
|
||||
private void showUsersMultiChoiceDialog() {
|
||||
List<String> list = new ArrayList<>();
|
||||
List<String> listPhone = new ArrayList<>();
|
||||
for (DBUser u : DBUser.allUser) {
|
||||
if (mapUsers.get(u.phone) == null) {
|
||||
listPhone.add(u.phone);
|
||||
list.add(u.phone + " | " + u.name);
|
||||
}
|
||||
}
|
||||
if(list.size() == 0) {
|
||||
UIUtl.toastI("所有分机已经添加");
|
||||
return;
|
||||
}
|
||||
|
||||
final String[] items = new String[list.size()];
|
||||
list.toArray(items);
|
||||
final QMUIDialog.MultiCheckableDialogBuilder builder = new QMUIDialog.MultiCheckableDialogBuilder(this)
|
||||
.setTitle("选择要加入的分机号")
|
||||
// .setCheckedItems(new int[]{1, 3})
|
||||
.setSkinManager(QMUISkinManager.defaultInstance(this))
|
||||
.addItems(items, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
}
|
||||
});
|
||||
builder.addAction("取消", new QMUIDialogAction.ActionListener() {
|
||||
@Override
|
||||
public void onClick(QMUIDialog dialog, int index) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
builder.addAction("确定", new QMUIDialogAction.ActionListener() {
|
||||
@Override
|
||||
public void onClick(QMUIDialog dialog, int index) {
|
||||
int[] selectIndexs = builder.getCheckedItemIndexes();
|
||||
if (selectIndexs.length > 0) {
|
||||
List<DBUser> list = new ArrayList<>();
|
||||
for (int i = 0; i < selectIndexs.length; i++) {
|
||||
String phNum = listPhone.get(selectIndexs[i]);
|
||||
list.add(DBUser.getUser(phNum));
|
||||
}
|
||||
setList(list);
|
||||
}
|
||||
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
int mCurrentDialogStyle = com.qmuiteam.qmui.R.style.QMUI_Dialog;
|
||||
builder.create(mCurrentDialogStyle).show();
|
||||
}
|
||||
|
||||
public void refreshSelectedUsers() {
|
||||
meetingUsers.setText("已选择:" + getSelectedUsers());
|
||||
}
|
||||
|
||||
public String getSelectedUsers() {
|
||||
String str = "";
|
||||
for (DBUser us : users) {
|
||||
if (!us.isAddFlag) {
|
||||
str = str + us.phone + ",";
|
||||
}
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
public void createMeetingVoice(View view) {
|
||||
createMeeting(false);
|
||||
|
||||
}
|
||||
|
||||
public void createMeetingVideo(View view) {
|
||||
createMeeting(true);
|
||||
}
|
||||
|
||||
void createMeeting(boolean isVideo) {
|
||||
String userStr = getSelectedUsers();
|
||||
if (userStr == null || userStr == "") {
|
||||
UIUtl.toastI("请添加要加入会议的分机号");
|
||||
return;
|
||||
}
|
||||
QMUITipDialog dialog = UIUtl.toastLoading("");
|
||||
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);
|
||||
}
|
||||
dialog.dismiss();
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestError(int cmd, String result, Object orgs) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
}, isVideo);
|
||||
}
|
||||
|
||||
public void exit(View view) {
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleMessage(@NonNull Message msg) {
|
||||
switch (msg.what) {
|
||||
case Net.CMD_createMeeting:
|
||||
NetPkg pkg =(NetPkg)(msg.obj);
|
||||
|
||||
break;
|
||||
}
|
||||
return super.handleMessage(msg);
|
||||
}
|
||||
|
||||
}
|
||||
277
app/src/main/java/com/tianrun/sipcall/call/InCallActivity.java
Normal file
@@ -0,0 +1,277 @@
|
||||
package com.tianrun.sipcall.call;
|
||||
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.KeyguardManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.PowerManager;
|
||||
import android.os.PowerManager.WakeLock;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.tianrun.sipcall.R;
|
||||
import com.tianrun.sipcall.SipEngine;
|
||||
import com.tianrun.sipcall.ui.TrBaseActivity;
|
||||
import com.tianrun.sipcall.utils.CONS;
|
||||
import com.tianrun.sipcall.utils.logmy;
|
||||
|
||||
import blue.view.EngineServer;
|
||||
import blue.view.SMPercentFrameLayout;
|
||||
import blue.view.SMSurfaceViewRenderer;
|
||||
|
||||
|
||||
public class InCallActivity extends TrBaseActivity implements OnClickListener {
|
||||
public static Handler handler_CallActivity;
|
||||
public static String TAG = "CallActivity";
|
||||
private Handler handler = new Handler(this);
|
||||
private PowerManager powerManager = null;
|
||||
private WakeLock wakeLock = null;
|
||||
private SMSurfaceViewRenderer localRender;
|
||||
private SMSurfaceViewRenderer remoteRender;
|
||||
private SMPercentFrameLayout localRenderLayout;
|
||||
private SMPercentFrameLayout remoteRenderLayout;
|
||||
private ImageButton incall_answer, incall_hangup;
|
||||
private TextView show;
|
||||
// private Button meetingbutton;
|
||||
|
||||
private EngineServer engineServer;
|
||||
|
||||
private int callid = -1;//当前通话的id
|
||||
private String callnumber = "未知";
|
||||
private String callstate = "未知";
|
||||
private int calltype = 0; //0音频1视频
|
||||
private boolean VIDEOSTATE = false;
|
||||
public static Intent incallIntent;
|
||||
|
||||
@SuppressLint("InvalidWakeLockTag")
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
// fullScreen();
|
||||
setContentView(R.layout.incallactivity);
|
||||
handler_CallActivity = handler;
|
||||
powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
|
||||
//获取PowerManager.WakeLock对象,后面的参数|表示同时传入两个值,最后的是调试用的Tag
|
||||
wakeLock = powerManager.newWakeLock(PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.SCREEN_BRIGHT_WAKE_LOCK, "bright");
|
||||
//点亮屏幕
|
||||
wakeLock.acquire();
|
||||
|
||||
KeyguardManager km = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
|
||||
KeyguardManager.KeyguardLock kl = km.newKeyguardLock("unLock");
|
||||
kl.disableKeyguard();
|
||||
initview();
|
||||
incallIntent = getIntent();
|
||||
setDate(this.getIntent());
|
||||
}
|
||||
|
||||
private void initview() {
|
||||
show = (TextView) findViewById(R.id.show);
|
||||
incall_answer = (ImageButton) findViewById(R.id.incall_answer);
|
||||
incall_hangup = (ImageButton) findViewById(R.id.incall_hangup);
|
||||
incall_hangup.setOnClickListener(this);
|
||||
incall_answer.setOnClickListener(this);
|
||||
//下面为视频部分
|
||||
localRender = (SMSurfaceViewRenderer) findViewById(R.id.local_video_view);
|
||||
remoteRender = (SMSurfaceViewRenderer) findViewById(R.id.remote_video_view);
|
||||
localRenderLayout = (SMPercentFrameLayout) findViewById(R.id.local_video_layout);
|
||||
remoteRenderLayout = (SMPercentFrameLayout) findViewById(R.id.remote_video_layout);
|
||||
engineServer = new EngineServer(localRender, remoteRender, localRenderLayout, remoteRenderLayout, true);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
fullScreen();
|
||||
incallIntent = getIntent();
|
||||
setDate(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if (callstate.equals("来电")) {
|
||||
incall_answer.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
incall_answer.setVisibility(View.GONE);
|
||||
}
|
||||
show.setText(callnumber + callstate);
|
||||
if (incall_answer.getVisibility() == View.VISIBLE) {
|
||||
incall_answer.setVisibility(View.GONE);
|
||||
SipEngine.getInstance().answer(callid);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
// onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
stopVideoStream(true);
|
||||
super.onDestroy();
|
||||
SipEngine.getInstance().hangup(callid);
|
||||
handler_CallActivity = null;
|
||||
if (wakeLock != null) {
|
||||
wakeLock.release();
|
||||
wakeLock = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 变更通话数据
|
||||
*/
|
||||
public void setDate(Intent intent) {
|
||||
Bundle bundle = intent.getExtras();
|
||||
callid = bundle.getInt("callid");
|
||||
callnumber = bundle.getString("callnumber");
|
||||
callstate = bundle.getString("callstate");
|
||||
calltype = bundle.getInt("calltype");
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止视频
|
||||
*
|
||||
* @param isExit 是否完全退出视频
|
||||
*/
|
||||
public synchronized void stopVideoStream(boolean isExit) {
|
||||
if (VIDEOSTATE && engineServer != null) {
|
||||
engineServer.stopVideoStream(isExit);
|
||||
VIDEOSTATE = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleMessage(Message m) {
|
||||
switch (m.what) {
|
||||
case CONS.CALLSTATE:
|
||||
callstate = (String) m.obj;
|
||||
show.setText(callnumber + callstate);
|
||||
if (callstate.equals("挂断")) {
|
||||
stopVideoStream(true);
|
||||
finish();
|
||||
}
|
||||
break;
|
||||
case CONS.MEDIASTATE:
|
||||
CallMediaUtils utils = (CallMediaUtils) m.obj;
|
||||
int r = utils.getR();
|
||||
int l = utils.getL();
|
||||
int payload = utils.getPayload();
|
||||
if (r != 0 || l != 0) {
|
||||
//开始视频
|
||||
ShowVideoView(true);
|
||||
startVideoStream(SipEngine.getInstance().getip(), r, l, payload);
|
||||
} else {
|
||||
//开始音频
|
||||
stopVideoStream(false);
|
||||
ShowVideoView(false);
|
||||
}
|
||||
break;
|
||||
case CONS.CALLDOWN:
|
||||
stopVideoStream(true);
|
||||
finish();
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private synchronized void startVideoStream(String server, int rport, int lport, final int payload) {
|
||||
int BitRate = 768;
|
||||
int FrameRate = 10;
|
||||
int w = 480;
|
||||
int h = 270;
|
||||
String camerafb = "Front";
|
||||
int c = 1;
|
||||
switch (camerafb) {
|
||||
case "Front":
|
||||
c = 1;
|
||||
break;
|
||||
case "Post":
|
||||
c = 0;
|
||||
break;
|
||||
case "Usb":
|
||||
c = 2;
|
||||
break;
|
||||
}
|
||||
c = 0;
|
||||
logmy.e(callnumber + "--" + server + "--" + rport + "--" + lport);
|
||||
if (engineServer != null) {
|
||||
ShowVideoView(true);
|
||||
/*
|
||||
* 开始视频
|
||||
* @param context
|
||||
* @param server 服务器地址
|
||||
* @param rport 远程端口
|
||||
* @param lport 本地端口
|
||||
* @param payload payload
|
||||
* @param BitRate 带宽
|
||||
* @param FrameRate 帧率
|
||||
* @param w 宽
|
||||
* @param h 高
|
||||
* @param camtype 摄像头前后外置
|
||||
* @param videoHwAcceleration 是否启用硬编
|
||||
* @param recordTx 是否录制远程画面
|
||||
* @param recordRx 是否录制本地画面
|
||||
* @param saveVideoDir 录制画面存放的文件
|
||||
*/
|
||||
engineServer.startVideoStream(this, server, rport, lport, payload, BitRate, FrameRate, w, h, c, true);
|
||||
VIDEOSTATE = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.incall_hangup:
|
||||
SipEngine.getInstance().hangup(callid);
|
||||
if (SipEngine.callPagesConfig.size() == 0) {
|
||||
finish();
|
||||
}
|
||||
break;
|
||||
case R.id.incall_answer:
|
||||
incall_answer.setVisibility(View.GONE);
|
||||
SipEngine.getInstance().answer(callid);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void ShowVideoView(boolean show) {
|
||||
if (show) {
|
||||
localRenderLayout.setVisibility(View.VISIBLE);
|
||||
remoteRenderLayout.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
localRenderLayout.setVisibility(View.GONE);
|
||||
remoteRenderLayout.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
void fullScreen() {
|
||||
int flag = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
|
||||
getWindow().getDecorView().setSystemUiVisibility(flag);
|
||||
}
|
||||
|
||||
public void switchCamera() {
|
||||
if (engineServer != null) {
|
||||
engineServer.switchCamera(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,276 @@
|
||||
package com.tianrun.sipcall.call;
|
||||
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.KeyguardManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.PowerManager;
|
||||
import android.os.PowerManager.WakeLock;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.tianrun.sipcall.R;
|
||||
import com.tianrun.sipcall.SipEngine;
|
||||
import com.tianrun.sipcall.ui.TrBaseActivity;
|
||||
import com.tianrun.sipcall.utils.CONS;
|
||||
import com.tianrun.sipcall.utils.logmy;
|
||||
|
||||
import blue.view.EngineServer;
|
||||
import blue.view.SMPercentFrameLayout;
|
||||
import blue.view.SMSurfaceViewRenderer;
|
||||
|
||||
|
||||
public class InCallMeetingActivity extends TrBaseActivity implements OnClickListener {
|
||||
public static Handler handler_CallActivity;
|
||||
public static String TAG = "CallMeetingActivity";
|
||||
private Handler handler = new Handler(this);
|
||||
private PowerManager powerManager = null;
|
||||
private WakeLock wakeLock = null;
|
||||
private SMSurfaceViewRenderer localRender;
|
||||
private SMSurfaceViewRenderer remoteRender;
|
||||
private SMPercentFrameLayout localRenderLayout;
|
||||
private SMPercentFrameLayout remoteRenderLayout;
|
||||
private ImageButton incall_answer, incall_hangup;
|
||||
private TextView show;
|
||||
|
||||
private EngineServer engineServer;
|
||||
|
||||
private int callid = -1;//当前通话的id
|
||||
private String callnumber = "未知";
|
||||
private String callstate = "未知";
|
||||
private int calltype = 0; //0音频1视频
|
||||
private boolean VIDEOSTATE = false;
|
||||
public static Intent incallIntent;
|
||||
|
||||
@SuppressLint("InvalidWakeLockTag")
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
// fullScreen();
|
||||
setContentView(R.layout.incallmeetingactivity);
|
||||
handler_CallActivity = handler;
|
||||
powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
|
||||
//获取PowerManager.WakeLock对象,后面的参数|表示同时传入两个值,最后的是调试用的Tag
|
||||
wakeLock = powerManager.newWakeLock(PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.SCREEN_BRIGHT_WAKE_LOCK, "bright");
|
||||
//点亮屏幕
|
||||
wakeLock.acquire();
|
||||
|
||||
KeyguardManager km = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
|
||||
KeyguardManager.KeyguardLock kl = km.newKeyguardLock("unLock");
|
||||
kl.disableKeyguard();
|
||||
initview();
|
||||
incallIntent = getIntent();
|
||||
setDate(this.getIntent());
|
||||
}
|
||||
|
||||
private void initview() {
|
||||
show = (TextView) findViewById(R.id.show);
|
||||
incall_answer = (ImageButton) findViewById(R.id.incall_answer);
|
||||
incall_hangup = (ImageButton) findViewById(R.id.incall_hangup);
|
||||
incall_hangup.setOnClickListener(this);
|
||||
incall_answer.setOnClickListener(this);
|
||||
//下面为视频部分
|
||||
localRender = (SMSurfaceViewRenderer) findViewById(R.id.local_video_view);
|
||||
remoteRender = (SMSurfaceViewRenderer) findViewById(R.id.remote_video_view);
|
||||
localRenderLayout = (SMPercentFrameLayout) findViewById(R.id.local_video_layout);
|
||||
remoteRenderLayout = (SMPercentFrameLayout) findViewById(R.id.remote_video_layout);
|
||||
engineServer = new EngineServer(localRender, remoteRender, localRenderLayout, remoteRenderLayout, true);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
fullScreen();
|
||||
incallIntent = getIntent();
|
||||
setDate(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if (callstate.equals("来电")) {
|
||||
incall_answer.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
incall_answer.setVisibility(View.GONE);
|
||||
}
|
||||
show.setText(callnumber + callstate);
|
||||
//控件显示号码,来电,去电,通话中...
|
||||
if (incall_answer.getVisibility() == View.VISIBLE) {
|
||||
incall_answer.setVisibility(View.GONE);
|
||||
SipEngine.getInstance().answer(callid);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
// onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
stopVideoStream(true);
|
||||
super.onDestroy();
|
||||
SipEngine.getInstance().hangup(callid);
|
||||
handler_CallActivity = null;
|
||||
if (wakeLock != null) {
|
||||
wakeLock.release();
|
||||
wakeLock = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 变更通话数据
|
||||
*/
|
||||
public void setDate(Intent intent) {
|
||||
Bundle bundle = intent.getExtras();
|
||||
callid = bundle.getInt("callid");
|
||||
callnumber = bundle.getString("callnumber");
|
||||
callstate = bundle.getString("callstate");
|
||||
calltype = bundle.getInt("calltype");
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止视频
|
||||
*
|
||||
* @param isExit 是否完全退出视频
|
||||
*/
|
||||
public synchronized void stopVideoStream(boolean isExit) {
|
||||
if (VIDEOSTATE && engineServer != null) {
|
||||
engineServer.stopVideoStream(isExit);
|
||||
VIDEOSTATE = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleMessage(Message m) {
|
||||
switch (m.what) {
|
||||
case CONS.CALLSTATE:
|
||||
callstate = (String) m.obj;
|
||||
show.setText(callnumber + callstate);
|
||||
if (callstate.equals("挂断")) {
|
||||
stopVideoStream(true);
|
||||
finish();
|
||||
}
|
||||
break;
|
||||
case CONS.MEDIASTATE:
|
||||
CallMediaUtils utils = (CallMediaUtils) m.obj;
|
||||
int r = utils.getR();
|
||||
int l = utils.getL();
|
||||
int payload = utils.getPayload();
|
||||
if (r != 0 || l != 0) {
|
||||
//开始视频
|
||||
ShowVideoView(true);
|
||||
startVideoStream(SipEngine.getInstance().getip(), r, l, payload);
|
||||
} else {
|
||||
//开始音频
|
||||
stopVideoStream(false);
|
||||
ShowVideoView(false);
|
||||
}
|
||||
break;
|
||||
case CONS.CALLDOWN:
|
||||
stopVideoStream(true);
|
||||
finish();
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private synchronized void startVideoStream(String server, int rport, int lport, final int payload) {
|
||||
int BitRate = 768;
|
||||
int FrameRate = 10;
|
||||
int w = 480;
|
||||
int h = 270;
|
||||
String camerafb = "Front";
|
||||
int c = 1;
|
||||
switch (camerafb) {
|
||||
case "Front":
|
||||
c = 1;
|
||||
break;
|
||||
case "Post":
|
||||
c = 0;
|
||||
break;
|
||||
case "Usb":
|
||||
c = 2;
|
||||
break;
|
||||
}
|
||||
c = 0;
|
||||
logmy.e(callnumber + "--" + server + "--" + rport + "--" + lport);
|
||||
if (engineServer != null) {
|
||||
ShowVideoView(true);
|
||||
/*
|
||||
* 开始视频
|
||||
* @param context
|
||||
* @param server 服务器地址
|
||||
* @param rport 远程端口
|
||||
* @param lport 本地端口
|
||||
* @param payload payload
|
||||
* @param BitRate 带宽
|
||||
* @param FrameRate 帧率
|
||||
* @param w 宽
|
||||
* @param h 高
|
||||
* @param camtype 摄像头前后外置
|
||||
* @param videoHwAcceleration 是否启用硬编
|
||||
* @param recordTx 是否录制远程画面
|
||||
* @param recordRx 是否录制本地画面
|
||||
* @param saveVideoDir 录制画面存放的文件
|
||||
*/
|
||||
engineServer.startVideoStream(this, server, rport, lport, payload, BitRate, FrameRate, w, h, c, true);
|
||||
VIDEOSTATE = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.incall_hangup:
|
||||
SipEngine.getInstance().hangup(callid);
|
||||
if (SipEngine.callPagesConfig.size() == 0) {
|
||||
finish();
|
||||
}
|
||||
break;
|
||||
case R.id.incall_answer:
|
||||
incall_answer.setVisibility(View.GONE);
|
||||
SipEngine.getInstance().answer(callid);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void ShowVideoView(boolean show) {
|
||||
if (show) {
|
||||
localRenderLayout.setVisibility(View.VISIBLE);
|
||||
remoteRenderLayout.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
localRenderLayout.setVisibility(View.GONE);
|
||||
remoteRenderLayout.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
void fullScreen() {
|
||||
int flag = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
|
||||
getWindow().getDecorView().setSystemUiVisibility(flag);
|
||||
}
|
||||
|
||||
public void switchCamera() {
|
||||
if (engineServer != null) {
|
||||
engineServer.switchCamera(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
221
app/src/main/java/com/tianrun/sipcall/call/MyEngineServer.java
Normal file
@@ -0,0 +1,221 @@
|
||||
package com.tianrun.sipcall.call;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.bluetel.media.MediaConstraintsAndScalingType;
|
||||
import com.bluetel.media.SMCodec;
|
||||
import com.bluetel.media.SMConnection;
|
||||
import com.bluetel.media.SMMediaEngine;
|
||||
import com.bluetel.media.SMMediaStream;
|
||||
import com.bluetel.media.SMVideoCapturer;
|
||||
import com.bluetel.media.SMVideoRenderer;
|
||||
import com.bluetel.media.SMVideoSource;
|
||||
import com.bluetel.media.SMVideoTrack;
|
||||
|
||||
import org.webrtc.Camera1Enumerator;
|
||||
import org.webrtc.CameraVideoCapturer;
|
||||
import org.webrtc.EglBase;
|
||||
import org.webrtc.RendererCommon;
|
||||
import org.webrtc.VideoCapturer;
|
||||
|
||||
import blue.view.EngineServer;
|
||||
import blue.view.SMPercentFrameLayout;
|
||||
import blue.view.SMSurfaceViewRenderer;
|
||||
|
||||
public class MyEngineServer {
|
||||
public static final String TAG = "EngineServer";
|
||||
private EglBase rootEglBase;
|
||||
private SMConnection connection;
|
||||
private SMMediaEngine engine;
|
||||
private SMVideoCapturer videoCapturer;
|
||||
private SMVideoSource videoSource;
|
||||
private SMMediaStream mediaStream;
|
||||
private SMSurfaceViewRenderer localRender;
|
||||
private SMSurfaceViewRenderer remoteRender;
|
||||
private SMPercentFrameLayout localRenderLayout;
|
||||
private SMPercentFrameLayout remoteRenderLayout;
|
||||
public static final String VIDEO_TRACK_ID = "ARDAMSv0";
|
||||
public static final String VIDEO_TRACK_ID2 = "ARDAMSv1";
|
||||
public static final String AUDIO_TRACK_ID = "ARDAMSa0";
|
||||
public static final String MAX_VIDEO_WIDTH_CONSTRAINT = "maxWidth";
|
||||
public static final String MIN_VIDEO_WIDTH_CONSTRAINT = "minWidth";
|
||||
public static final String MAX_VIDEO_HEIGHT_CONSTRAINT = "maxHeight";
|
||||
public static final String MIN_VIDEO_HEIGHT_CONSTRAINT = "minHeight";
|
||||
public static final String MAX_VIDEO_FPS_CONSTRAINT = "maxFrameRate";
|
||||
public static final String MIN_VIDEO_FPS_CONSTRAINT = "minFrameRate";
|
||||
public static final int MAX_VIDEO_WIDTH = 1920;
|
||||
public static final int MAX_VIDEO_HEIGHT = 1080;
|
||||
public static final int MAX_VIDEO_FPS = 30;
|
||||
private static final int LOCAL_X_CONNECTED = 72;
|
||||
private static final int LOCAL_Y_CONNECTED = 72;
|
||||
private static final int LOCAL_WIDTH_CONNECTED = 25;
|
||||
private static final int LOCAL_HEIGHT_CONNECTED = 25;
|
||||
private static final int REMOTE_X = 0;
|
||||
private static final int REMOTE_Y = 0;
|
||||
private static final int REMOTE_WIDTH = 100;
|
||||
private static final int REMOTE_HEIGHT = 100;
|
||||
private static final String LAYOUT_AVERAGE = "LAYOUT_AVERAGE";
|
||||
private static final String LAYOUT_REMOTEFULL = "LAYOUT_REMOTEFULL";
|
||||
private static final String LAYOUT_LOCALFULL = "LAYOUT_LOCALFULL";
|
||||
private static final String LAYOUT_PRIMARY = "LAYOUT_PRIMARY";
|
||||
private String mLayoutState = "LAYOUT_PRIMARY";
|
||||
|
||||
public MyEngineServer(SMSurfaceViewRenderer var1, SMSurfaceViewRenderer var2, SMPercentFrameLayout var3, SMPercentFrameLayout var4, boolean var5) {
|
||||
this.localRender = var1;
|
||||
this.remoteRender = var2;
|
||||
this.localRenderLayout = var3;
|
||||
this.remoteRenderLayout = var4;
|
||||
this.rootEglBase = EglBase.create();
|
||||
if (var5) {
|
||||
var1.init(this.rootEglBase.getEglBaseContext(), (RendererCommon.RendererEvents)null);
|
||||
}
|
||||
|
||||
var2.init(this.rootEglBase.getEglBaseContext(), (RendererCommon.RendererEvents)null);
|
||||
var1.setZOrderMediaOverlay(true);
|
||||
this.updateVideoView();
|
||||
}
|
||||
|
||||
private void updateVideoView() {
|
||||
this.remoteRenderLayout.setPosition(0, 0, 100, 100);
|
||||
this.remoteRender.setScalingType(MediaConstraintsAndScalingType.SCALE_ASPECT_FIT());
|
||||
this.remoteRender.setMirror(false);
|
||||
this.localRenderLayout.setPosition(72, 72, 25, 25);
|
||||
this.localRender.setScalingType(MediaConstraintsAndScalingType.SCALE_ASPECT_FIT());
|
||||
if (this.mLayoutState.equals("LAYOUT_PRIMARY")) {
|
||||
this.localRenderLayout.setPosition(72, 72, 25, 25);
|
||||
this.localRender.setScalingType(MediaConstraintsAndScalingType.SCALE_ASPECT_FIT());
|
||||
} else if (this.mLayoutState.equals("LAYOUT_AVERAGE")) {
|
||||
this.localRenderLayout.setPosition(50, 0, 50, 100);
|
||||
this.localRender.setScalingType(MediaConstraintsAndScalingType.SCALE_ASPECT_FIT());
|
||||
this.remoteRenderLayout.setPosition(0, 0, 50, 100);
|
||||
this.remoteRender.setScalingType(MediaConstraintsAndScalingType.SCALE_ASPECT_FIT());
|
||||
} else if (this.mLayoutState.equals("LAYOUT_REMOTEFULL")) {
|
||||
this.localRenderLayout.setPosition(100, 100, 0, 0);
|
||||
this.localRender.setScalingType(MediaConstraintsAndScalingType.SCALE_ASPECT_FIT());
|
||||
this.remoteRenderLayout.setPosition(0, 0, 100, 100);
|
||||
this.remoteRender.setScalingType(MediaConstraintsAndScalingType.SCALE_ASPECT_FIT());
|
||||
} else if (this.mLayoutState.equals("LAYOUT_LOCALFULL")) {
|
||||
this.localRenderLayout.setPosition(0, 0, 100, 100);
|
||||
this.localRender.setScalingType(MediaConstraintsAndScalingType.SCALE_ASPECT_FIT());
|
||||
this.remoteRenderLayout.setPosition(100, 100, 0, 0);
|
||||
this.remoteRender.setScalingType(MediaConstraintsAndScalingType.SCALE_ASPECT_FIT());
|
||||
}
|
||||
|
||||
this.localRender.setMirror(false);
|
||||
this.remoteRender.requestLayout();
|
||||
this.localRender.requestLayout();
|
||||
}
|
||||
|
||||
public synchronized void startVideoStream(Context var1, String var2, int var3, int var4, final int var5, int var6, int var7, int var8, int var9, int var10, boolean var11) {
|
||||
SMMediaEngine.initializeGlobals(var1, true, true, var11);
|
||||
this.engine = SMMediaEngine.create();
|
||||
this.connection = this.engine.createConnection(new SMConnection.ConnectionObserver() {
|
||||
public void onAddStream(SMMediaStream var1) {
|
||||
if (var1.videoTracks.size() == 1) {
|
||||
SMVideoTrack var2 = (SMVideoTrack)var1.videoTracks.get(0);
|
||||
var2.setEnabled(true);
|
||||
var2.addRenderer(new SMVideoRenderer(MyEngineServer.this.remoteRender));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onRemoveStream(SMMediaStream var1) {
|
||||
}
|
||||
|
||||
public SMCodec onReceiveVideoTrack(int var1, int var2) {
|
||||
return new SMCodec(var5, 1);
|
||||
}
|
||||
});
|
||||
this.connection.bindLocalAddr((String)null, var4, var4 + 1);
|
||||
this.connection.addRemoteAddr(var2, var3, var3 + 1);
|
||||
String var12 = Camera1Enumerator.getDeviceName(var10);
|
||||
Log.d("EngineServer", "Opening camera: " + var12);
|
||||
this.videoCapturer = SMVideoCapturer.create(var12, (CameraVideoCapturer.CameraEventsHandler)null, false);
|
||||
if (this.videoCapturer == null) {
|
||||
Log.d("EngineServer", "Failed to open camera");
|
||||
} else {
|
||||
this.videoSource = this.createVideoSource(this.videoCapturer, 1280, 720);
|
||||
this.videoSource.adaptOutputFormat(var8, var9, var7);
|
||||
SMVideoTrack var13 = this.engine.createVideoTrack("ARDAMSv0", this.videoSource);
|
||||
var13.setEnabled(true);
|
||||
SMVideoRenderer var14 = new SMVideoRenderer(this.localRender);
|
||||
var13.addRenderer(var14);
|
||||
this.mediaStream = this.engine.createLocalMediaStream("ARDAMS");
|
||||
this.mediaStream.addTrack(var13);
|
||||
int var15 = var6 * 1000;
|
||||
var15 = (int)((float)var15 * 0.9F);
|
||||
int var16 = var15 / 2;
|
||||
int var17 = (int)((double)var15 * 0.75D);
|
||||
this.mediaStream.setVideoCodec(new SMCodec(var5, 1, 20, var16, var15, var17, false));
|
||||
this.connection.addSendStream(this.mediaStream);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void stopVideoStream(boolean var1) {
|
||||
if (this.connection != null) {
|
||||
this.connection.dispose();
|
||||
this.connection = null;
|
||||
}
|
||||
|
||||
if (this.videoCapturer != null) {
|
||||
this.videoCapturer.stopCapture();
|
||||
this.videoCapturer.dispose();
|
||||
this.videoCapturer = null;
|
||||
}
|
||||
|
||||
if (this.videoSource != null) {
|
||||
this.videoSource.dispose();
|
||||
}
|
||||
|
||||
if (this.rootEglBase != null && var1) {
|
||||
this.rootEglBase.release();
|
||||
this.rootEglBase = null;
|
||||
}
|
||||
|
||||
if (this.remoteRender != null && var1) {
|
||||
this.remoteRender.release();
|
||||
this.remoteRender = null;
|
||||
}
|
||||
|
||||
if (this.localRender != null && var1) {
|
||||
this.localRender.release();
|
||||
this.localRender = null;
|
||||
}
|
||||
|
||||
if (this.engine != null && var1) {
|
||||
this.engine.dispose();
|
||||
this.engine = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private SMVideoSource createVideoSource(VideoCapturer var1, int var2, int var3) {
|
||||
return (new MediaConstraintsAndScalingType(this.engine, var1, var2, var3)).createVideoSource();
|
||||
}
|
||||
|
||||
public synchronized void adjustVideoView(int var1) {
|
||||
if (var1 == 1) {
|
||||
this.mLayoutState = "LAYOUT_AVERAGE";
|
||||
} else if (var1 == 2) {
|
||||
this.mLayoutState = "LAYOUT_REMOTEFULL";
|
||||
} else if (var1 == 3) {
|
||||
this.mLayoutState = "LAYOUT_LOCALFULL";
|
||||
} else {
|
||||
this.mLayoutState = "LAYOUT_PRIMARY";
|
||||
}
|
||||
|
||||
this.updateVideoView();
|
||||
}
|
||||
|
||||
public synchronized void setLayoutState(String var1) {
|
||||
this.mLayoutState = var1;
|
||||
}
|
||||
|
||||
public synchronized void switchCamera(CameraVideoCapturer.CameraSwitchHandler var1) {
|
||||
if (this.videoCapturer != null) {
|
||||
this.videoCapturer.switchCamera(var1);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package com.tianrun.sipcall.call.utils;
|
||||
|
||||
public class InCallUtils {
|
||||
|
||||
private String callNumber;
|
||||
private boolean isHolder;
|
||||
private boolean isVideo;
|
||||
private int rPort;
|
||||
private int lPort;
|
||||
private String timeThreadId;
|
||||
private String callState;
|
||||
private boolean isCurrentCall;
|
||||
private int payload;
|
||||
private int callId;
|
||||
|
||||
|
||||
public InCallUtils(String callNumber, boolean isHolder, boolean isVideo,
|
||||
int rPort, int lPort, String timeThreadId, String callState,
|
||||
boolean isCurrentCall, int payload,int callId) {
|
||||
super();
|
||||
this.callNumber = callNumber;
|
||||
this.isHolder = isHolder;
|
||||
this.isVideo = isVideo;
|
||||
this.rPort = rPort;
|
||||
this.lPort = lPort;
|
||||
this.timeThreadId = timeThreadId;
|
||||
this.callState = callState;
|
||||
this.isCurrentCall = isCurrentCall;
|
||||
this.payload = payload;
|
||||
this.callId = callId;
|
||||
}
|
||||
|
||||
|
||||
public int getCallId() {
|
||||
return callId;
|
||||
}
|
||||
|
||||
|
||||
public void setCallId(int callId) {
|
||||
this.callId = callId;
|
||||
}
|
||||
|
||||
|
||||
public int getPayload() {
|
||||
return payload;
|
||||
}
|
||||
public void setPayload(int payload) {
|
||||
this.payload = payload;
|
||||
}
|
||||
public boolean isCurrentCall() {
|
||||
return isCurrentCall;
|
||||
}
|
||||
public void setCurrentCall(boolean isCurrentCall) {
|
||||
this.isCurrentCall = isCurrentCall;
|
||||
}
|
||||
public String getCallState() {
|
||||
return callState;
|
||||
}
|
||||
public void setCallState(String callState) {
|
||||
this.callState = callState;
|
||||
}
|
||||
public String getCallNumber() {
|
||||
return callNumber;
|
||||
}
|
||||
public void setCallNumber(String callNumber) {
|
||||
this.callNumber = callNumber;
|
||||
}
|
||||
public boolean isHolder() {
|
||||
return isHolder;
|
||||
}
|
||||
public void setHolder(boolean isHolder) {
|
||||
this.isHolder = isHolder;
|
||||
}
|
||||
public boolean isVideo() {
|
||||
return isVideo;
|
||||
}
|
||||
public void setVideo(boolean isVideo) {
|
||||
this.isVideo = isVideo;
|
||||
}
|
||||
public int getrPort() {
|
||||
return rPort;
|
||||
}
|
||||
public void setrPort(int rPort) {
|
||||
this.rPort = rPort;
|
||||
}
|
||||
public int getlPort() {
|
||||
return lPort;
|
||||
}
|
||||
public void setlPort(int lPort) {
|
||||
this.lPort = lPort;
|
||||
}
|
||||
public String getTimeThreadId() {
|
||||
return timeThreadId;
|
||||
}
|
||||
public void setTimeThreadId(String timeThreadId) {
|
||||
this.timeThreadId = timeThreadId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
68
app/src/main/java/com/tianrun/sipcall/db/DBHead.java
Normal file
@@ -0,0 +1,68 @@
|
||||
package com.tianrun.sipcall.db;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DBHead {
|
||||
public String name;
|
||||
public String desc;
|
||||
public String audio_code;
|
||||
public String video_code;
|
||||
public String status;
|
||||
public String id;
|
||||
public boolean isSelected = false;
|
||||
|
||||
public static List<DBHead> allGroups = new ArrayList<>();
|
||||
|
||||
public DBHead(String id, String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
|
||||
}
|
||||
|
||||
public DBHead(JSONObject o) {
|
||||
name = o.getString("topic");
|
||||
desc = o.getString("description");
|
||||
audio_code = o.getString("audio_code");
|
||||
video_code = o.getString("video_code");
|
||||
status = o.getString("audio_status");
|
||||
id = o.getString("task_uuid");
|
||||
}
|
||||
|
||||
public static DBHead newHead4Total() {
|
||||
DBHead u = new DBHead("-999", "全部");
|
||||
return u;
|
||||
}
|
||||
|
||||
public boolean isAll() {
|
||||
return id.equals("-999");
|
||||
}
|
||||
|
||||
public static void onGetGroups(JSONArray list) {
|
||||
allGroups.clear();
|
||||
for (Object o : list) {
|
||||
allGroups.add(new DBHead((JSONObject) o));
|
||||
}
|
||||
}
|
||||
|
||||
public static DBHead getByUUID(String uuid) {
|
||||
for (DBHead d : allGroups) {
|
||||
if (d.id.equals(uuid)){
|
||||
return d;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static DBHead getByCode(String code) {
|
||||
for (DBHead d : allGroups) {
|
||||
if (d.audio_code.equals(code) || d.video_code.equals(code)) {
|
||||
return d;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
23
app/src/main/java/com/tianrun/sipcall/db/DBRoot.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package com.tianrun.sipcall.db;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.tianrun.sipcall.net.Net;
|
||||
|
||||
public class DBRoot {
|
||||
|
||||
public static void onGetData(int cmd, String content) {
|
||||
switch (cmd) {
|
||||
case Net.CMD_getUsers:
|
||||
JSONArray allUsers = JSONObject.parseObject(content).getJSONArray("agents");
|
||||
DBUser.onGetUsers(allUsers);
|
||||
break;
|
||||
case Net.CMD_getGroups:
|
||||
JSONArray list = JSONArray.parseArray(content);
|
||||
DBHead.onGetGroups(list);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
62
app/src/main/java/com/tianrun/sipcall/db/DBUser.java
Normal file
@@ -0,0 +1,62 @@
|
||||
package com.tianrun.sipcall.db;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class DBUser {
|
||||
public static List<DBUser> allUser = new ArrayList<>();
|
||||
public static HashMap<String, DBUser> mapUsers = new HashMap<>();
|
||||
public static DBUser mySelf;
|
||||
public String name = "";
|
||||
public String phone = "";
|
||||
public String status = "";
|
||||
public boolean isManager = false;
|
||||
public boolean isAddFlag = false;
|
||||
|
||||
public DBUser(String name, String phone, String status) {
|
||||
this.name = name;
|
||||
this.phone = phone;
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public DBUser(JSONObject d) {
|
||||
this.name = d.getString("name");
|
||||
this.phone = d.getString("extn");
|
||||
this.status = d.getString("sip_state");
|
||||
this.isManager = d.getString("weight").equals("1");
|
||||
}
|
||||
|
||||
public boolean isBusy() {
|
||||
return status.equals("busy");
|
||||
}
|
||||
|
||||
public boolean isOnline() {
|
||||
return status.equals("true");
|
||||
}
|
||||
|
||||
public boolean isOffline() {
|
||||
return status.equals("false");
|
||||
}
|
||||
|
||||
public static void onGetUsers(JSONArray array) {
|
||||
allUser.clear();
|
||||
DBUser u;
|
||||
for (Object o : array) {
|
||||
u = new DBUser((JSONObject) o);
|
||||
allUser.add(u);
|
||||
mapUsers.put(u.phone, u);
|
||||
if (mySelf != null && u.phone == mySelf.phone) {
|
||||
mySelf = u;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static DBUser getUser(String phoneNo) {
|
||||
return mapUsers.get(phoneNo);
|
||||
}
|
||||
|
||||
}
|
||||
359
app/src/main/java/com/tianrun/sipcall/login/LoginActivity.java
Normal file
@@ -0,0 +1,359 @@
|
||||
package com.tianrun.sipcall.login;
|
||||
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewOutlineProvider;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.qmuiteam.qmui.widget.dialog.QMUIDialog;
|
||||
import com.qmuiteam.qmui.widget.dialog.QMUITipDialog;
|
||||
import com.tianrun.sipcall.App;
|
||||
import com.tianrun.sipcall.R;
|
||||
import com.tianrun.sipcall.SipEngine;
|
||||
import com.tianrun.sipcall.call.InCallActivity;
|
||||
import com.tianrun.sipcall.call.InCallMeetingActivity;
|
||||
import com.tianrun.sipcall.db.DBUser;
|
||||
import com.tianrun.sipcall.net.Net;
|
||||
import com.tianrun.sipcall.ui.ActivityMgr;
|
||||
import com.tianrun.sipcall.ui.TrBaseActivity;
|
||||
import com.tianrun.sipcall.ui.UIUtl;
|
||||
import com.tianrun.sipcall.utils.CONS;
|
||||
import com.tianrun.sipcall.utils.HttpUtl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class LoginActivity extends TrBaseActivity {
|
||||
private TextView show;
|
||||
private EditText username, userpw, userip, userport;
|
||||
|
||||
/**
|
||||
* 账号密码服务器地址端口直接在这输入
|
||||
*/
|
||||
private String name = "";
|
||||
private String pw = "";
|
||||
private int port = 0;
|
||||
private String ip = "";
|
||||
QMUITipDialog dialogLoading;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_login);
|
||||
show = findViewById(R.id.show);
|
||||
username = findViewById(R.id.username);
|
||||
userpw = findViewById(R.id.userpw);
|
||||
userip = findViewById(R.id.userip);
|
||||
userport = findViewById(R.id.userport);
|
||||
if (Build.VERSION.SDK_INT >= 23) {//6.0才用动态权限
|
||||
initPermission();
|
||||
}
|
||||
|
||||
String str = getUserInfor();
|
||||
if (str != null && !str.isEmpty()) {
|
||||
JSONObject obj = JSONObject.parseObject(str);
|
||||
username.setText(obj.getString("name"));
|
||||
userpw.setText(obj.getString("password"));
|
||||
userip.setText(obj.getString("ip"));
|
||||
userport.setText(obj.getInteger("port").toString());
|
||||
|
||||
handler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
boolean donotAutoLogin = false;
|
||||
Intent intent = getIntent();
|
||||
if (intent != null) {
|
||||
Bundle bundle = intent.getExtras();
|
||||
if(bundle != null) {
|
||||
donotAutoLogin = bundle.getBoolean("donotAutoLogin");
|
||||
}
|
||||
}
|
||||
if (!donotAutoLogin) {
|
||||
doLogin();
|
||||
}
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if (InCallActivity.handler_CallActivity != null) {
|
||||
startActivity(InCallActivity.incallIntent);
|
||||
return;
|
||||
}
|
||||
if (InCallMeetingActivity.handler_CallActivity != null) {
|
||||
startActivity(InCallMeetingActivity.incallIntent);
|
||||
return;
|
||||
}
|
||||
if (SipEngine.getInstance().onLine) {
|
||||
startActivity(new Intent(LoginActivity.this, MainActivity.class));
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void login(View view) {
|
||||
doLogin();
|
||||
}
|
||||
|
||||
public void doLogin() {
|
||||
if (SipEngine.getInstance().isonLine())
|
||||
return;
|
||||
if (!isEnable())
|
||||
return;
|
||||
dialogLoading = UIUtl.toastLoading("");
|
||||
SipEngine.getInstance().init();//先初始化
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
SipEngine.getInstance().Register(
|
||||
name,
|
||||
pw,
|
||||
ip,
|
||||
port);//再注册
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
private boolean isEnable() {
|
||||
boolean a = false;
|
||||
boolean b = false;
|
||||
boolean c = false;
|
||||
boolean d = false;
|
||||
if (username.getText().toString() != null && !username.getText().toString().equals("")) {
|
||||
name = username.getText().toString();
|
||||
a = true;
|
||||
}
|
||||
if (userpw.getText().toString() != null && !userpw.getText().toString().equals("")) {
|
||||
pw = userpw.getText().toString();
|
||||
b = true;
|
||||
}
|
||||
if (userip.getText().toString() != null && !userip.getText().toString().equals("")) {
|
||||
ip = userip.getText().toString();
|
||||
c = true;
|
||||
}
|
||||
if (userport.getText().toString() != null && !userport.getText().toString().equals("")) {
|
||||
port = Integer.parseInt(userport.getText().toString());
|
||||
d = true;
|
||||
}
|
||||
|
||||
return a && b && c && d;
|
||||
|
||||
}
|
||||
|
||||
public String getUserInfor() {
|
||||
SharedPreferences sp = getSharedPreferences("UserInfor", MODE_PRIVATE);
|
||||
return sp.getString("content", null);
|
||||
}
|
||||
|
||||
public void saveUserInfor(String name, String password, String ip, int port) {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("name", name);
|
||||
jo.put("password", password);
|
||||
jo.put("ip", ip);
|
||||
jo.put("port", port);
|
||||
SharedPreferences sp = getSharedPreferences("UserInfor", MODE_PRIVATE);
|
||||
sp.edit().putString("content", jo.toJSONString()).commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleMessage(Message m) {
|
||||
switch (m.what) {
|
||||
case CONS.LOGINSHOW:
|
||||
String str = (String) m.obj;
|
||||
show.setText(str);
|
||||
break;
|
||||
case CONS.LOGINFAILED:
|
||||
if(dialogLoading != null) {
|
||||
dialogLoading.dismiss();
|
||||
}
|
||||
case CONS.LOGIN:
|
||||
if(dialogLoading != null) {
|
||||
dialogLoading.dismiss();
|
||||
}
|
||||
if (isEnable()) {
|
||||
saveUserInfor(this.name, this.pw, this.ip, this.port);
|
||||
}
|
||||
startActivity(new Intent(this, MainActivity.class));
|
||||
DBUser.mySelf = new DBUser("", this.name, "true");
|
||||
finish();
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/****************************************权限设置***************************************/
|
||||
|
||||
// 所需的全部权限
|
||||
public static String[] permissions = new String[]{
|
||||
Manifest.permission.NFC,
|
||||
Manifest.permission.RECORD_AUDIO,
|
||||
Manifest.permission.INTERNET,
|
||||
// Manifest.permission.READ_LOGS,
|
||||
Manifest.permission.ACCESS_NETWORK_STATE,
|
||||
Manifest.permission.ACCESS_WIFI_STATE,
|
||||
Manifest.permission.READ_PHONE_STATE,
|
||||
// Manifest.permission.WRITE_SETTINGS,
|
||||
Manifest.permission.CAMERA,
|
||||
Manifest.permission.MODIFY_AUDIO_SETTINGS,
|
||||
// Manifest.permission.BIND_APPWIDGET,
|
||||
// Manifest.permission.MOUNT_UNMOUNT_FILESYSTEMS,
|
||||
// Manifest.permission.SYSTEM_OVERLAY_WINDOW,
|
||||
Manifest.permission.RESTART_PACKAGES,
|
||||
// Manifest.permission.SYSTEM_ALERT_WINDOW,
|
||||
// Manifest.permission.SET_TIME_ZONE,
|
||||
Manifest.permission.READ_CALL_LOG,
|
||||
Manifest.permission.BROADCAST_STICKY,
|
||||
Manifest.permission.GET_ACCOUNTS,
|
||||
Manifest.permission.BLUETOOTH,
|
||||
Manifest.permission.CHANGE_WIFI_MULTICAST_STATE,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||
Manifest.permission.CHANGE_WIFI_STATE,
|
||||
Manifest.permission.ACCESS_FINE_LOCATION,
|
||||
Manifest.permission.VIBRATE,
|
||||
Manifest.permission.DISABLE_KEYGUARD,
|
||||
Manifest.permission.WAKE_LOCK,
|
||||
Manifest.permission.CALL_PHONE,
|
||||
Manifest.permission.WRITE_CONTACTS,
|
||||
Manifest.permission.READ_CONTACTS,
|
||||
Manifest.permission.RECEIVE_BOOT_COMPLETED,
|
||||
Manifest.permission.PROCESS_OUTGOING_CALLS,
|
||||
Manifest.permission.ACCESS_COARSE_LOCATION,
|
||||
Manifest.permission.KILL_BACKGROUND_PROCESSES,
|
||||
Manifest.permission.READ_EXTERNAL_STORAGE
|
||||
};
|
||||
List<String> mPermissionList = new ArrayList<>();
|
||||
private final int mRequestCode = 100;//权限请求码
|
||||
|
||||
private void initPermission() {
|
||||
mPermissionList.clear();//清空已经允许的没有通过的权限
|
||||
//逐个判断是否还有未通过的权限
|
||||
for (int i = 0; i < permissions.length; i++) {
|
||||
if (ContextCompat.checkSelfPermission(this, permissions[i]) !=
|
||||
PackageManager.PERMISSION_GRANTED) {
|
||||
mPermissionList.add(permissions[i]);//添加还未授予的权限到mPermissionList中
|
||||
}
|
||||
}
|
||||
//申请权限
|
||||
if (mPermissionList.size() > 0) {//有权限没有通过,需要申请
|
||||
ActivityCompat.requestPermissions(this, permissions, mRequestCode);
|
||||
} else {
|
||||
//权限已经都通过了,可以将程序继续打开了
|
||||
CONS.requestPermission_ACTION_MANAGE_OVERLAY_PERMISSION(this);
|
||||
CONS.requestPermission_ACTION_MANAGE_WRITE_SETTINGS(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
|
||||
@NonNull int[] grantResults) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
switch (requestCode) {
|
||||
case 101:
|
||||
|
||||
break;
|
||||
case 102:
|
||||
|
||||
break;
|
||||
default:
|
||||
|
||||
boolean hasPermissionDismiss = false;//有权限没有通过
|
||||
if (mRequestCode == requestCode) {
|
||||
for (int i = 0; i < grantResults.length; i++) {
|
||||
if (grantResults[i] == -1) {
|
||||
hasPermissionDismiss = true;
|
||||
Log.e("main", permissions[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (hasPermissionDismiss) {//如果有没有被允许的权限
|
||||
showPermissionDialog();
|
||||
} else {
|
||||
//权限已经都通过了,可以将程序继续打开了
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
AlertDialog mPermissionDialog;
|
||||
|
||||
private void showPermissionDialog() {
|
||||
if (mPermissionDialog == null) {
|
||||
mPermissionDialog = new AlertDialog.Builder(this)
|
||||
.setMessage("已禁用权限,请手动授予")
|
||||
.setPositiveButton("设置", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
cancelPermissionDialog();
|
||||
|
||||
Uri packageURI = Uri.parse("package:" + App.getContext());
|
||||
Intent intent = new Intent(Settings.
|
||||
ACTION_APPLICATION_DETAILS_SETTINGS, packageURI);
|
||||
startActivity(intent);
|
||||
}
|
||||
})
|
||||
.setNegativeButton("取消", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
//关闭页面或者做其他操作
|
||||
cancelPermissionDialog();
|
||||
}
|
||||
})
|
||||
.create();
|
||||
}
|
||||
mPermissionDialog.show();
|
||||
|
||||
}
|
||||
|
||||
private void cancelPermissionDialog() {
|
||||
mPermissionDialog.cancel();
|
||||
}
|
||||
|
||||
public void exit2(View view) {
|
||||
Net.login(this.name, this.pw, new HttpUtl.CallBack() {
|
||||
@Override
|
||||
public void onRequestComplete(int cmd, String result, Object orgs) {
|
||||
ActivityMgr.sendMsg(CONS.LOGIN, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestError(int cmd, String result, Object orgs) {
|
||||
UIUtl.toastI("取得token失败");
|
||||
}
|
||||
}, null);
|
||||
|
||||
}
|
||||
}
|
||||
563
app/src/main/java/com/tianrun/sipcall/login/MainActivity.java
Normal file
@@ -0,0 +1,563 @@
|
||||
package com.tianrun.sipcall.login;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.media.AudioManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Message;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.Button;
|
||||
import android.widget.GridView;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.viewpager.widget.PagerAdapter;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.qmuiteam.qmui.skin.QMUISkinManager;
|
||||
import com.qmuiteam.qmui.util.QMUIDisplayHelper;
|
||||
import com.qmuiteam.qmui.widget.dialog.QMUIBottomSheet;
|
||||
import com.qmuiteam.qmui.widget.dialog.QMUIDialog;
|
||||
import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction;
|
||||
import com.qmuiteam.qmui.widget.dialog.QMUITipDialog;
|
||||
import com.qmuiteam.qmui.widget.popup.QMUIPopups;
|
||||
import com.qmuiteam.qmui.widget.popup.QMUIQuickAction;
|
||||
import com.qmuiteam.qmui.widget.tab.QMUITabBuilder;
|
||||
import com.qmuiteam.qmui.widget.tab.QMUITabIndicator;
|
||||
import com.qmuiteam.qmui.widget.tab.QMUITabSegment;
|
||||
import com.tianrun.sipcall.App;
|
||||
import com.tianrun.sipcall.R;
|
||||
import com.tianrun.sipcall.SipEngine;
|
||||
import com.tianrun.sipcall.call.CallActivity;
|
||||
import com.tianrun.sipcall.call.CreateGroupActivity;
|
||||
import com.tianrun.sipcall.call.CreateMeetingActivity;
|
||||
import com.tianrun.sipcall.db.DBHead;
|
||||
import com.tianrun.sipcall.db.DBUser;
|
||||
import com.tianrun.sipcall.net.Net;
|
||||
import com.tianrun.sipcall.net.NetPkg;
|
||||
import com.tianrun.sipcall.ui.ActivityMgr;
|
||||
import com.tianrun.sipcall.ui.TrAdapter;
|
||||
import com.tianrun.sipcall.ui.TrBaseActivity;
|
||||
import com.tianrun.sipcall.ui.UIUtl;
|
||||
import com.tianrun.sipcall.utils.CONS;
|
||||
import com.tianrun.sipcall.utils.HttpUtl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MainActivity extends TrBaseActivity {
|
||||
TextView textVolum;
|
||||
TextView textSelfNum;
|
||||
QMUITabSegment mTabSegment;
|
||||
ViewPager mContentViewPager;
|
||||
Button buttonAddGroup;
|
||||
ImageView imageViewAddGroupIcon;
|
||||
View StartMeetingVideo;
|
||||
View StartMeetingVoice;
|
||||
View ButtonDelGroup;
|
||||
// TrAdapter adapter;
|
||||
TrAdapter adapterUser;
|
||||
AudioManager audioManager;
|
||||
ImageView buttonAddVol;
|
||||
ImageView buttonDelVol;
|
||||
DBHead currSelectData;
|
||||
|
||||
GridView gridUser;
|
||||
List<Object> allUsers = new ArrayList<>();
|
||||
List<DBHead> headers = new ArrayList<>();
|
||||
private int mCurrentDialogStyle = com.qmuiteam.qmui.R.style.QMUI_Dialog;
|
||||
|
||||
|
||||
private PagerAdapter mPagerAdapter = new PagerAdapter() {
|
||||
@Override
|
||||
public boolean isViewFromObject(View view, Object object) {
|
||||
return view == object;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return headers.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object instantiateItem(final ViewGroup container, int position) {
|
||||
// ContentPage page = ContentPage.getPage(position);
|
||||
View view = getPageView(position);
|
||||
// view.setTag(page);
|
||||
// ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(
|
||||
// ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
// container.addView(view, params);
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroyItem(ViewGroup container, int position, Object object) {
|
||||
container.removeView((View) object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemPosition(@NonNull Object object) {
|
||||
View view = (View) object;
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.M)
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
textVolum = findViewById(R.id.Volumne);
|
||||
textSelfNum = findViewById(R.id.textViewSelfNum);
|
||||
mTabSegment = findViewById(R.id.HeadList);
|
||||
gridUser = findViewById(R.id.GridUser);
|
||||
mContentViewPager = findViewById(R.id.contentViewPager);
|
||||
buttonAddGroup = findViewById(R.id.buttonAddGroup);
|
||||
imageViewAddGroupIcon = findViewById(R.id.imageViewAddGroupIcon);
|
||||
audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
|
||||
StartMeetingVoice = findViewById(R.id.StartMeetingVoice);
|
||||
StartMeetingVideo = findViewById(R.id.StartMeetingVideo);
|
||||
ButtonDelGroup = findViewById(R.id.ButtonDelGroup);
|
||||
buttonAddVol = findViewById(R.id.imageViewAddVoice);
|
||||
buttonAddVol.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
chgVolum(v, true);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
buttonDelVol = findViewById(R.id.imageViewDelVoice);
|
||||
buttonDelVol.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
chgVolum(v, false);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
ButtonDelGroup.setVisibility(View.INVISIBLE);
|
||||
StartMeetingVoice.setVisibility(View.INVISIBLE);
|
||||
StartMeetingVideo.setVisibility(View.INVISIBLE);
|
||||
refreshView();
|
||||
|
||||
currSelectData = DBHead.newHead4Total();
|
||||
currSelectData.isSelected = true;
|
||||
headers.add(currSelectData);
|
||||
initTabAndPager();
|
||||
Net.getGroups(null, null);
|
||||
Net.getUsers(null, null);
|
||||
checkBeforeMeetingState();
|
||||
}
|
||||
|
||||
// 处理当前分机号可能有需要加入的会议
|
||||
private void checkBeforeMeetingState() {
|
||||
Net.getUserInfor(DBUser.mySelf.phone, new HttpUtl.CallBack() {
|
||||
@Override
|
||||
public void onRequestComplete(int cmd, String result, Object orgs) {
|
||||
JSONArray array = JSONObject.parseObject(result).getJSONArray("agents");
|
||||
JSONObject jo = array.getJSONObject(0);
|
||||
JSONArray comment = jo.getJSONArray("comment");
|
||||
if (comment != null && comment.size() > 0) {
|
||||
List<String> list = new ArrayList<>();
|
||||
for (Object o : comment) {
|
||||
JSONObject com = (JSONObject) o;
|
||||
String name = com.getString("topic") + "【" + ((com.getString("type").equals("video_profile")) ? "视频会议" : "语音会议") + "】";
|
||||
list.add(name);
|
||||
}
|
||||
|
||||
UIUtl.showBottomSheetList("您有会议需要加入", list, new QMUIBottomSheet.BottomListSheetBuilder.OnSheetItemClickListener() {
|
||||
@Override
|
||||
public void onClick(QMUIBottomSheet dialog, View itemView, int position, String tag) {
|
||||
JSONObject o = comment.getJSONObject(position);
|
||||
SipEngine.getInstance().CallNumber(o.getString("nbr"), (o.getString("type").equals("video_profile")) ? true : false);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestError(int cmd, String result, Object orgs) {
|
||||
}
|
||||
}, null);
|
||||
}
|
||||
|
||||
void refreshHeaders() {
|
||||
DBHead h = headers.get(0);
|
||||
headers.clear();
|
||||
headers.add(h);
|
||||
headers.addAll(DBHead.allGroups);
|
||||
|
||||
mPagerAdapter.notifyDataSetChanged();
|
||||
mTabSegment.reset();
|
||||
QMUITabBuilder tabBuilder = mTabSegment.tabBuilder();
|
||||
for (int i = 0; i < headers.size(); i++) {
|
||||
mTabSegment.addTab(tabBuilder.setText(headers.get(i).name).build(this));
|
||||
}
|
||||
mTabSegment.notifyDataChanged();
|
||||
}
|
||||
|
||||
private void initTabAndPager() {
|
||||
mContentViewPager.setAdapter(mPagerAdapter);
|
||||
// mContentViewPager.setCurrentItem(mDestPage.getPosition(), false);
|
||||
QMUITabBuilder tabBuilder = mTabSegment.tabBuilder();
|
||||
for (int i = 0; i < headers.size(); i++) {
|
||||
mTabSegment.addTab(tabBuilder.setText(headers.get(i).name).build(this));
|
||||
}
|
||||
int space = QMUIDisplayHelper.dp2px(this, 16);
|
||||
mTabSegment.setIndicator(new QMUITabIndicator(
|
||||
QMUIDisplayHelper.dp2px(this, 2), false, true));
|
||||
mTabSegment.setMode(QMUITabSegment.MODE_SCROLLABLE);
|
||||
mTabSegment.setItemSpaceInScrollMode(space);
|
||||
mTabSegment.setupWithViewPager(mContentViewPager, false);
|
||||
mTabSegment.setPadding(space, 0, space, 0);
|
||||
mTabSegment.addOnTabSelectedListener(new QMUITabSegment.OnTabSelectedListener() {
|
||||
@Override
|
||||
public void onTabSelected(int index) {
|
||||
currSelectData = headers.get(index);
|
||||
if (currSelectData.isAll()) {
|
||||
ButtonDelGroup.setVisibility(View.INVISIBLE);
|
||||
StartMeetingVoice.setVisibility(View.INVISIBLE);
|
||||
StartMeetingVideo.setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
StartMeetingVoice.setVisibility(View.VISIBLE);
|
||||
StartMeetingVideo.setVisibility(View.VISIBLE);
|
||||
if (DBUser.mySelf.isManager) {
|
||||
ButtonDelGroup.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
ButtonDelGroup.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
//显示分机
|
||||
allUsers.clear();
|
||||
if(currSelectData.isAll()) {
|
||||
allUsers.addAll(DBUser.allUser);
|
||||
setUsers();
|
||||
} else {
|
||||
setUsers();
|
||||
//取得数据
|
||||
Net.getGroupMenbers(currSelectData.id, null, currSelectData.id);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabUnselected(int index) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabReselected(int index) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDoubleTap(int index) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void refreshView() {
|
||||
//通话音量
|
||||
int max = audioManager.getStreamMaxVolume(AudioManager.STREAM_VOICE_CALL);
|
||||
int current = audioManager.getStreamVolume(AudioManager.STREAM_VOICE_CALL);
|
||||
textVolum.setText("音量:" + current);
|
||||
if (DBUser.mySelf != null && DBUser.mySelf.phone != null) {
|
||||
textSelfNum.setText("分机号:" + DBUser.mySelf.phone);
|
||||
}
|
||||
if (DBUser.mySelf != null && DBUser.mySelf.isManager) {
|
||||
buttonAddGroup.setVisibility(View.VISIBLE);
|
||||
imageViewAddGroupIcon.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
buttonAddGroup.setVisibility(View.INVISIBLE);
|
||||
imageViewAddGroupIcon.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
void chgVolum(View v, boolean isAdd) {
|
||||
handler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!v.isPressed()) {
|
||||
return;
|
||||
}
|
||||
if (isAdd) {
|
||||
addVolume(v);
|
||||
} else {
|
||||
delVolume(v);
|
||||
}
|
||||
if (v.isPressed()) {
|
||||
chgVolum(v, isAdd);
|
||||
}
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
|
||||
static Runnable runGetUsers = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Net.getUsers(null, null);
|
||||
}
|
||||
};
|
||||
|
||||
public View getPageView(int pos) {
|
||||
return gridUser;
|
||||
}
|
||||
|
||||
public void getUsersData() {
|
||||
handler.postDelayed(runGetUsers, 3000);
|
||||
}
|
||||
|
||||
public class UserViews {
|
||||
public TextView textViewName;
|
||||
public TextView textViewNum;
|
||||
public ImageView imageViewStatus;
|
||||
public ImageView imageViewPhoneIcon;
|
||||
public ImageView imageViewAddflag;
|
||||
}
|
||||
|
||||
public void setUsers() {
|
||||
if (DBUser.allUser == null) return;
|
||||
if (adapterUser == null) {
|
||||
adapterUser = UIUtl.setList(this, gridUser, R.layout.list_item_user, allUsers, new TrAdapter.Callback() {
|
||||
@Override
|
||||
public void initCallback(Object data, int position, View prefabView, ViewGroup parent) {
|
||||
UserViews views = null;
|
||||
if (prefabView.getTag() == null) {
|
||||
views = new UserViews();
|
||||
views.textViewName = prefabView.findViewById(R.id.textViewName);
|
||||
views.textViewNum = prefabView.findViewById(R.id.textViewNum);
|
||||
views.imageViewStatus = prefabView.findViewById(R.id.imageViewStatus);
|
||||
views.imageViewAddflag = prefabView.findViewById(R.id.imageViewAddflag);
|
||||
views.imageViewPhoneIcon = prefabView.findViewById(R.id.imageView3PhoneIcon);
|
||||
prefabView.setTag(views);
|
||||
} else {
|
||||
views = (UserViews) (prefabView.getTag());
|
||||
}
|
||||
DBUser d = (DBUser) data;
|
||||
views.textViewName.setText(d.name);
|
||||
views.textViewNum.setText(d.phone);
|
||||
if (d.isOffline()) {
|
||||
views.imageViewStatus.setColorFilter(Color.GRAY);
|
||||
} else if (d.isOnline()) {
|
||||
views.imageViewStatus.setColorFilter(Color.GREEN);
|
||||
} else if (d.isBusy()) {
|
||||
views.imageViewStatus.setColorFilter(Color.RED);
|
||||
} else {
|
||||
views.imageViewStatus.setColorFilter(Color.GRAY);
|
||||
}
|
||||
if (d.isAddFlag) {
|
||||
views.imageViewPhoneIcon.setVisibility(View.INVISIBLE);
|
||||
views.imageViewAddflag.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
views.imageViewPhoneIcon.setVisibility(View.VISIBLE);
|
||||
views.imageViewAddflag.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clickCallback(Object data, AdapterView<?> parent, View view, int position, long id) {
|
||||
DBUser d = (DBUser) data;
|
||||
if (d.isAddFlag) {
|
||||
//TODO:
|
||||
return;
|
||||
}
|
||||
QMUIQuickAction qa = QMUIPopups.quickAction(MainActivity.this,
|
||||
QMUIDisplayHelper.dp2px(MainActivity.this, 56),
|
||||
QMUIDisplayHelper.dp2px(MainActivity.this, 56))
|
||||
.shadow(true)
|
||||
.dimAmount(0.5f)
|
||||
.skinManager(QMUISkinManager.defaultInstance(MainActivity.this))
|
||||
.edgeProtection(QMUIDisplayHelper.dp2px(MainActivity.this, 20))
|
||||
.addAction(new QMUIQuickAction.Action().icon(R.drawable.voice2).text("语音").onClick(
|
||||
new QMUIQuickAction.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(QMUIQuickAction quickAction, QMUIQuickAction.Action action, int position) {
|
||||
quickAction.dismiss();
|
||||
SipEngine.getInstance().CallNumber(d.phone, false);
|
||||
}
|
||||
}
|
||||
))
|
||||
.addAction(new QMUIQuickAction.Action().icon(R.drawable.video).text("视频").onClick(
|
||||
new QMUIQuickAction.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(QMUIQuickAction quickAction, QMUIQuickAction.Action action, int position) {
|
||||
quickAction.dismiss();
|
||||
SipEngine.getInstance().CallNumber(d.phone, true);
|
||||
}
|
||||
}
|
||||
));
|
||||
if (DBUser.mySelf.isManager) {
|
||||
qa.addAction(new QMUIQuickAction.Action().icon(android.R.drawable.ic_delete).text("移除").onClick(
|
||||
new QMUIQuickAction.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(QMUIQuickAction quickAction, QMUIQuickAction.Action action, int position) {
|
||||
quickAction.dismiss();
|
||||
//TODO:移除分机
|
||||
}
|
||||
}
|
||||
));
|
||||
}
|
||||
qa.show(view);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
adapterUser.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
// public void refreshHeadList() {
|
||||
// adapter.notifyDataSetChanged();
|
||||
// }
|
||||
|
||||
public void call(View view) {
|
||||
startActivity(new Intent(MainActivity.this, CallActivity.class));
|
||||
}
|
||||
|
||||
public void meeting(View view) {
|
||||
}
|
||||
|
||||
public void message(View view) {
|
||||
}
|
||||
|
||||
public void report(View view) {
|
||||
}
|
||||
|
||||
// public void exit(View view) {
|
||||
// if (ActivityMgr.getActivity(LoginActivity.class) == null) {
|
||||
// Intent intent = new Intent(this, LoginActivity.class);
|
||||
// intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
// startActivity(intent);
|
||||
// }
|
||||
// finish();
|
||||
// SipEngine.getInstance().Unregister();
|
||||
// }
|
||||
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleMessage(Message m) {
|
||||
switch (m.what) {
|
||||
case CONS.FINISH:
|
||||
finish();
|
||||
break;
|
||||
case Net.CMD_getUsers:
|
||||
getUsersData();
|
||||
if (currSelectData.isAll()) {
|
||||
allUsers.clear();
|
||||
allUsers.addAll(DBUser.allUser);
|
||||
setUsers();
|
||||
}
|
||||
break;
|
||||
case Net.CMD_getGroupMenbers:
|
||||
NetPkg pkg = (NetPkg)(m.obj);
|
||||
String oldUUID = pkg.orgs.toString();
|
||||
if (!currSelectData.isAll() && oldUUID.equals(currSelectData.id)) {
|
||||
//TODO:解析数据
|
||||
//根据权限来处理
|
||||
if (DBUser.mySelf.isManager) {
|
||||
DBUser u = new DBUser("", "添加分机", "false");
|
||||
u.isAddFlag = true;
|
||||
allUsers.add(u);
|
||||
}
|
||||
setUsers();
|
||||
}
|
||||
break;
|
||||
case Net.CMD_getGroups:
|
||||
refreshHeaders();
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
handler.removeCallbacks(runGetUsers);
|
||||
}
|
||||
|
||||
public void addVolume(View view) {
|
||||
// UIUtl.toast("音量加");
|
||||
// int max = audioManager.getStreamMaxVolume( AudioManager.STREAM_VOICE_CALL );
|
||||
audioManager.adjustStreamVolume(AudioManager.STREAM_VOICE_CALL, AudioManager.ADJUST_RAISE, 0);
|
||||
int current = audioManager.getStreamVolume(AudioManager.STREAM_VOICE_CALL);
|
||||
textVolum.setText("音量:" + current);
|
||||
}
|
||||
|
||||
public void delVolume(View view) {
|
||||
// UIUtl.toastW("音量减");
|
||||
audioManager.adjustStreamVolume(AudioManager.STREAM_VOICE_CALL, AudioManager.ADJUST_LOWER, 0);
|
||||
int current = audioManager.getStreamVolume(AudioManager.STREAM_VOICE_CALL);
|
||||
textVolum.setText("音量:" + current);
|
||||
}
|
||||
|
||||
public void addGroup(View view) {
|
||||
startActivity(new Intent(this, CreateGroupActivity.class));
|
||||
}
|
||||
|
||||
public void addTmpMeeting(View view) {
|
||||
startActivity(new Intent(this, CreateMeetingActivity.class));
|
||||
}
|
||||
|
||||
public void logout(View v) {
|
||||
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);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
public void doMeetingVoice4Group(View v) {
|
||||
if (currSelectData.isAll()) {
|
||||
return;
|
||||
}
|
||||
SipEngine.getInstance().CallNumber(currSelectData.audio_code, false);
|
||||
}
|
||||
|
||||
public void doMeetingVideo4Group(View v) {
|
||||
if (currSelectData.isAll()) {
|
||||
return;
|
||||
}
|
||||
SipEngine.getInstance().CallNumber(currSelectData.video_code, true);
|
||||
}
|
||||
|
||||
public void deleteGroup(View v) {
|
||||
if (currSelectData.isAll()) {
|
||||
return;
|
||||
}
|
||||
new QMUIDialog.MessageDialogBuilder(this)
|
||||
.setTitle("提示")
|
||||
.setMessage("确定要删除分组吗?")
|
||||
.setSkinManager(QMUISkinManager.defaultInstance(this))
|
||||
.addAction("取消", new QMUIDialogAction.ActionListener() {
|
||||
@Override
|
||||
public void onClick(QMUIDialog dialog, int index) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
})
|
||||
.addAction(0, "删除", QMUIDialogAction.ACTION_PROP_NEGATIVE, new QMUIDialogAction.ActionListener() {
|
||||
@Override
|
||||
public void onClick(QMUIDialog dialog, int index) {
|
||||
//TODO:
|
||||
dialog.dismiss();
|
||||
}
|
||||
})
|
||||
.create(mCurrentDialogStyle).show();
|
||||
}
|
||||
}
|
||||
95
app/src/main/java/com/tianrun/sipcall/net/Net.java
Normal file
@@ -0,0 +1,95 @@
|
||||
package com.tianrun.sipcall.net;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.tianrun.sipcall.App;
|
||||
import com.tianrun.sipcall.db.DBRoot;
|
||||
import com.tianrun.sipcall.ui.ActivityMgr;
|
||||
import com.tianrun.sipcall.ui.UIUtl;
|
||||
import com.tianrun.sipcall.utils.HttpUtl;
|
||||
|
||||
public class Net {
|
||||
public static String ip = "47.111.20.34";
|
||||
public static int port = 29003;
|
||||
|
||||
private static final String TAG = "NetDisPatch";
|
||||
|
||||
public static final int CMD_login = 7000;
|
||||
public static final int CMD_getUsers = 7001;
|
||||
public static final int CMD_createMeeting = 7002;
|
||||
public static final int CMD_getUserInfor = 7003;
|
||||
public static final int CMD_getGroups = 7004;
|
||||
public static final int CMD_getGroupMenbers = 7005;
|
||||
|
||||
static HttpUtl.CallBack _callback = new HttpUtl.CallBack() {
|
||||
@Override
|
||||
public void onRequestComplete(int cmd, String result, Object params) {
|
||||
Log.i(TAG, "onRequestComplete: " + result);
|
||||
DBRoot.onGetData(cmd, result);
|
||||
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);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ActivityMgr.sendMsg(cmd, new NetPkg(result, orgs));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestError(int cmd, String result, Object orgs) {
|
||||
Log.e(TAG, "onRequestError: " + result);
|
||||
if (orgs != null) {
|
||||
((HttpUtl.CallBack) orgs).onRequestError(cmd, result, orgs);
|
||||
}
|
||||
UIUtl.toastI(result);
|
||||
}
|
||||
};
|
||||
|
||||
public static void login(String username, String password, HttpUtl.CallBack callBack, Object orgs) {
|
||||
username = "root";
|
||||
password = "12345678aa";
|
||||
String url = "http://" + ip + ":" + port + "/api/login?" + "username=" + username + "&" + "password=" + password;
|
||||
Object[] params = {callBack, orgs};
|
||||
HttpUtl.doGetAsyn(url, _callback, CMD_login, params);
|
||||
}
|
||||
|
||||
public static void getUserInfor(String extn, HttpUtl.CallBack callBack, Object orgs) {
|
||||
String url = "http://" + ip + ":" + port + "/api/ola/agents?extn=" + extn;
|
||||
Object[] params = {callBack, orgs};
|
||||
HttpUtl.doGetAsyn(url, _callback, CMD_getUserInfor, params);
|
||||
}
|
||||
|
||||
public static void getUsers(HttpUtl.CallBack callBack, Object orgs) {
|
||||
String url = "http://" + ip + ":" + port + "/api/ola/agents";
|
||||
Object[] params = {callBack, orgs};
|
||||
HttpUtl.doGetAsyn(url, _callback, CMD_getUsers, params);
|
||||
}
|
||||
|
||||
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;
|
||||
Object[] params = {callBack, orgs};
|
||||
HttpUtl.doPostAsyn(url, _params, _callback, CMD_createMeeting, params);
|
||||
}
|
||||
|
||||
public static void getGroups(HttpUtl.CallBack callBack, Object orgs) {
|
||||
String url = "http://" + ip + ":" + port + "/api/conferences/conference/list";
|
||||
Object[] params = {callBack, orgs};
|
||||
HttpUtl.doGetAsyn(url, _callback, CMD_getGroups, params);
|
||||
}
|
||||
|
||||
public static void getGroupMenbers(String task_uuid, HttpUtl.CallBack callBack, Object orgs) {
|
||||
String url = "http://" + ip + ":" + port + "/api/conferences/conference/"+task_uuid;
|
||||
Object[] params = {callBack, orgs};
|
||||
HttpUtl.doGetAsyn(url, _callback, CMD_getGroupMenbers, params);
|
||||
}
|
||||
}
|
||||
11
app/src/main/java/com/tianrun/sipcall/net/NetPkg.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package com.tianrun.sipcall.net;
|
||||
|
||||
public class NetPkg {
|
||||
public String content;
|
||||
public Object orgs;
|
||||
|
||||
public NetPkg(String content, Object orgs) {
|
||||
this.content = content;
|
||||
this.orgs = orgs;
|
||||
}
|
||||
}
|
||||
36
app/src/main/java/com/tianrun/sipcall/ui/ActivityMgr.java
Normal file
@@ -0,0 +1,36 @@
|
||||
package com.tianrun.sipcall.ui;
|
||||
|
||||
import com.tianrun.sipcall.utils.CONS;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.ConcurrentSkipListSet;
|
||||
|
||||
public class ActivityMgr {
|
||||
public static Map<Class, TrBaseActivity> actives = new ConcurrentHashMap<>();
|
||||
public static TrBaseActivity topActivity;
|
||||
public static TrBaseActivity getActivity(Class _class){
|
||||
return actives.get(_class);
|
||||
}
|
||||
|
||||
public static void onShowActivity(TrBaseActivity a) {
|
||||
topActivity = a;
|
||||
if(!actives.containsKey(a.getClass())) {
|
||||
actives.put(a.getClass(), a);
|
||||
}
|
||||
}
|
||||
public static void onHideActivity(TrBaseActivity a) {
|
||||
actives.remove(a.getClass());
|
||||
if(a == topActivity) {
|
||||
topActivity = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void sendMsg(int menu, Object obj) {
|
||||
for(TrBaseActivity a : actives.values()) {
|
||||
CONS.SENDMESSAGETO( a.handler, menu, obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
67
app/src/main/java/com/tianrun/sipcall/ui/TrAdapter.java
Normal file
@@ -0,0 +1,67 @@
|
||||
package com.tianrun.sipcall.ui;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.BaseAdapter;
|
||||
|
||||
import com.tianrun.sipcall.R;
|
||||
import com.tianrun.sipcall.login.MainActivity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class TrAdapter extends BaseAdapter {
|
||||
|
||||
public interface Callback {
|
||||
void initCallback(Object data, int position, View prefabView, ViewGroup parent);
|
||||
|
||||
void clickCallback(Object data, AdapterView<?> parent, View view, int position, long id);
|
||||
}
|
||||
|
||||
public List<Object> list = null;
|
||||
private Context context;
|
||||
private LayoutInflater inflater;
|
||||
private int convertViewId;
|
||||
private Callback callback;
|
||||
|
||||
public TrAdapter(Context context, int convertViewId, List<Object> list, Callback callback) {
|
||||
inflater = LayoutInflater.from(context);
|
||||
this.convertViewId = convertViewId;
|
||||
this.list = list;
|
||||
this.context = context;
|
||||
this.callback = callback;
|
||||
}
|
||||
|
||||
public List<Object> getList()
|
||||
{
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return list.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return list.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
if(convertView == null)
|
||||
convertView = inflater.inflate(convertViewId, null);
|
||||
callback.initCallback(getItem(position), position, convertView, parent);
|
||||
return convertView;
|
||||
}
|
||||
|
||||
}
|
||||
34
app/src/main/java/com/tianrun/sipcall/ui/TrBaseActivity.java
Normal file
@@ -0,0 +1,34 @@
|
||||
package com.tianrun.sipcall.ui;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
public class TrBaseActivity extends AppCompatActivity implements Handler.Callback {
|
||||
|
||||
public Handler handler = new Handler(this);
|
||||
|
||||
@Override
|
||||
public boolean handleMessage(@NonNull Message msg) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
ActivityMgr.onShowActivity(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
ActivityMgr.onHideActivity(this);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
168
app/src/main/java/com/tianrun/sipcall/ui/UIUtl.java
Normal file
@@ -0,0 +1,168 @@
|
||||
package com.tianrun.sipcall.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.GridView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.qmuiteam.qmui.skin.QMUISkinManager;
|
||||
import com.qmuiteam.qmui.widget.dialog.QMUIBottomSheet;
|
||||
import com.qmuiteam.qmui.widget.dialog.QMUITipDialog;
|
||||
import com.tianrun.sipcall.App;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class UIUtl {
|
||||
public static void toast(String tip) {
|
||||
if (ActivityMgr.topActivity == null) return;
|
||||
try {
|
||||
ActivityMgr.topActivity.handler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
QMUITipDialog tipDialog = new QMUITipDialog.Builder(ActivityMgr.topActivity)
|
||||
.setIconType(QMUITipDialog.Builder.ICON_TYPE_NOTHING)
|
||||
.setTipWord(tip)
|
||||
.create();
|
||||
tipDialog.show();
|
||||
hideToast(tipDialog);
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
System.out.println(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void toastI(String tip) {
|
||||
if (ActivityMgr.topActivity == null) return;
|
||||
try {
|
||||
ActivityMgr.topActivity.handler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
QMUITipDialog tipDialog = new QMUITipDialog.Builder(ActivityMgr.topActivity)
|
||||
.setIconType(QMUITipDialog.Builder.ICON_TYPE_INFO)
|
||||
.setTipWord(tip)
|
||||
.create();
|
||||
tipDialog.show();
|
||||
hideToast(tipDialog);
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
System.out.println(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void toastS(String tip) {
|
||||
if (ActivityMgr.topActivity == null) return;
|
||||
try {
|
||||
ActivityMgr.topActivity.handler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
QMUITipDialog tipDialog = new QMUITipDialog.Builder(ActivityMgr.topActivity)
|
||||
.setIconType(QMUITipDialog.Builder.ICON_TYPE_SUCCESS)
|
||||
.setTipWord(tip)
|
||||
.create();
|
||||
tipDialog.show();
|
||||
hideToast(tipDialog);
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
System.out.println(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void toastW(String tip) {
|
||||
if (ActivityMgr.topActivity == null) return;
|
||||
try {
|
||||
ActivityMgr.topActivity.handler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
QMUITipDialog tipDialog = new QMUITipDialog.Builder(ActivityMgr.topActivity)
|
||||
.setIconType(QMUITipDialog.Builder.ICON_TYPE_FAIL)
|
||||
.setTipWord(tip)
|
||||
.create();
|
||||
tipDialog.show();
|
||||
hideToast(tipDialog);
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
System.out.println(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static QMUITipDialog toastLoading(String tip) {
|
||||
if (ActivityMgr.topActivity == null) return null;
|
||||
QMUITipDialog tipDialog = new QMUITipDialog.Builder(ActivityMgr.topActivity)
|
||||
.setIconType(QMUITipDialog.Builder.ICON_TYPE_LOADING)
|
||||
.setTipWord(tip)
|
||||
.create();
|
||||
tipDialog.show();
|
||||
// hideToast(tipDialog);
|
||||
return tipDialog;
|
||||
}
|
||||
|
||||
private static void hideToast(QMUITipDialog tipDialog) {
|
||||
if (ActivityMgr.topActivity == null) return;
|
||||
ActivityMgr.topActivity.handler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
tipDialog.dismiss();
|
||||
} catch (Exception e) {
|
||||
System.out.println(e);
|
||||
}
|
||||
}
|
||||
}, 1200);
|
||||
}
|
||||
|
||||
public static TrAdapter setList(Context context, GridView grid, int convertViewId, Object list, TrAdapter.Callback callback) {
|
||||
TrAdapter adapter = new TrAdapter(context, convertViewId, (List<Object>) list, callback);
|
||||
grid.setAdapter(adapter);
|
||||
grid.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
callback.clickCallback(adapter.getItem(position), parent, view, position, id);
|
||||
}
|
||||
});
|
||||
return adapter;
|
||||
}
|
||||
|
||||
|
||||
public static void showBottomSheetList(
|
||||
CharSequence title,
|
||||
List<String> items, QMUIBottomSheet.BottomListSheetBuilder.OnSheetItemClickListener onClick) {
|
||||
showBottomSheetList(true, true, title, items, false, true, onClick);
|
||||
}
|
||||
|
||||
public static void showBottomSheetList(boolean gravityCenter,
|
||||
boolean addCancelBtn,
|
||||
CharSequence title,
|
||||
List<String> items,
|
||||
boolean allowDragDismiss,
|
||||
boolean withMark, QMUIBottomSheet.BottomListSheetBuilder.OnSheetItemClickListener onClick) {
|
||||
QMUIBottomSheet.BottomListSheetBuilder builder = new QMUIBottomSheet.BottomListSheetBuilder(App.getContext());
|
||||
builder.setGravityCenter(gravityCenter)
|
||||
.setSkinManager(QMUISkinManager.defaultInstance(App.getContext()))
|
||||
.setTitle(title)
|
||||
.setAddCancelBtn(addCancelBtn)
|
||||
.setAllowDrag(allowDragDismiss)
|
||||
.setNeedRightMark(withMark)
|
||||
.setOnSheetItemClickListener(new QMUIBottomSheet.BottomListSheetBuilder.OnSheetItemClickListener() {
|
||||
@Override
|
||||
public void onClick(QMUIBottomSheet dialog, View itemView, int position, String tag) {
|
||||
dialog.dismiss();
|
||||
// Toast.makeText(getActivity(), "Item " + (position + 1), Toast.LENGTH_SHORT).show();
|
||||
onClick.onClick(dialog, itemView, position, tag);
|
||||
}
|
||||
});
|
||||
if (withMark) {
|
||||
builder.setCheckedIndex(40);
|
||||
}
|
||||
for (int i = 1; i <= items.size(); i++) {
|
||||
builder.addItem(items.get(i));
|
||||
}
|
||||
builder.build().show();
|
||||
}
|
||||
}
|
||||
166
app/src/main/java/com/tianrun/sipcall/utils/CONS.java
Normal file
@@ -0,0 +1,166 @@
|
||||
package com.tianrun.sipcall.utils;
|
||||
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.provider.Settings;
|
||||
|
||||
import com.tianrun.sipcall.App;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
public class CONS {
|
||||
|
||||
|
||||
public static final int LOGIN = 200;
|
||||
public static final int LOGINSHOW = 201;
|
||||
public static final int CALLSTATE = 202;
|
||||
public static final int MEDIASTATE = 203;
|
||||
public static final int CALLDOWN = 204;
|
||||
public static final int FINISH = 205;
|
||||
public static final int SETSPEN = 206;
|
||||
public static final int SETTEXT = 207;
|
||||
public static final int INCOMINGMESSAGE = 208;//来短信了
|
||||
public static final int showpic = 209;
|
||||
public static final int LOGINFAILED = 230;
|
||||
|
||||
public static void SENDMESSAGETO(Handler handler, int menu, Object object) {
|
||||
if (handler != null) {
|
||||
Message.obtain(handler, menu, object).sendToTarget();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Java文件操作 获取文件扩展名
|
||||
* IMG_20170905_100435.jpg.mp3-->mp3
|
||||
* Created on: 2017-9-28
|
||||
* Author: lyf
|
||||
*/
|
||||
public static String getExtensionName(String filename) {
|
||||
if ((filename != null) && (filename.length() > 0)) {
|
||||
int dot = filename.lastIndexOf('.');
|
||||
if ((dot >-1) && (dot < (filename.length() - 1))) {
|
||||
return filename.substring(dot + 1);
|
||||
}
|
||||
}
|
||||
return filename;
|
||||
}
|
||||
|
||||
/**
|
||||
* Java文件操作 获取不带扩展名的文件名
|
||||
* IMG_20170905_100435.jpg.mp3-->IMG_20170905_100435.jpg
|
||||
* Created on: 2017-9-28
|
||||
* Author: lyf
|
||||
*/
|
||||
public static String getFileNameNoEx(String filename) {
|
||||
if ((filename != null) && (filename.length() > 0)) {
|
||||
int dot = filename.lastIndexOf('.');
|
||||
if ((dot >-1) && (dot < (filename.length()))) {
|
||||
return filename.substring(0, dot);
|
||||
}
|
||||
}
|
||||
return filename;
|
||||
}
|
||||
|
||||
|
||||
public static final int REQUEST_CODE_ASK_WRITE_SETTINGS = 101;//允许程序读取或写入系统设置
|
||||
public static void requestPermission_ACTION_MANAGE_WRITE_SETTINGS(Activity c){
|
||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M){
|
||||
if( !Settings.System.canWrite(c)){
|
||||
Intent intent = new Intent(Settings.ACTION_MANAGE_WRITE_SETTINGS,
|
||||
Uri.parse("package:" + App.getContext().getPackageName()));
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
c.startActivityForResult(intent, REQUEST_CODE_ASK_WRITE_SETTINGS);
|
||||
}else{
|
||||
//有了权限,你要做什么呢?具体的动作
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static final int REQUEST_OVERLAY = 102;//悬浮窗口权限申请
|
||||
public static void requestPermission_ACTION_MANAGE_OVERLAY_PERMISSION(Activity c) {
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
if (!Settings.canDrawOverlays(c)) {
|
||||
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
|
||||
Uri.parse("package:" + App.getContext().getPackageName()));
|
||||
c.startActivityForResult(intent, REQUEST_OVERLAY);
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static long forChannel(File f1,File f2) throws Exception{
|
||||
long time=new Date().getTime();
|
||||
int length=2097152;
|
||||
FileInputStream in=new FileInputStream(f1);
|
||||
FileOutputStream out=new FileOutputStream(f2);
|
||||
FileChannel inC=in.getChannel();
|
||||
FileChannel outC=out.getChannel();
|
||||
ByteBuffer b=null;
|
||||
while(true){
|
||||
if(inC.position()==inC.size()){
|
||||
inC.close();
|
||||
outC.close();
|
||||
return new Date().getTime()-time;
|
||||
}
|
||||
if((inC.size()-inC.position())<length){
|
||||
length=(int)(inC.size()-inC.position());
|
||||
}else
|
||||
length=2097152;
|
||||
b=ByteBuffer.allocateDirect(length);
|
||||
inC.read(b);
|
||||
b.flip();
|
||||
outC.write(b);
|
||||
outC.force(false);
|
||||
}
|
||||
}
|
||||
|
||||
public static String getFileSuffix(File f) {
|
||||
String name = f.getName();
|
||||
if (name != null && !"".equals(name)) {
|
||||
if (name.contains(".")) {
|
||||
return name.substring(name.lastIndexOf("."));
|
||||
}
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//防止华为机型未加入白名单时按返回键回到桌面再锁屏后几秒钟进程被杀
|
||||
// public static void onBackPressed(Activity activity) {
|
||||
// IntentWrapper.onBackPressed(activity);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
379
app/src/main/java/com/tianrun/sipcall/utils/HttpUtl.java
Normal file
@@ -0,0 +1,379 @@
|
||||
package com.tianrun.sipcall.utils;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Http请求的工具类
|
||||
*
|
||||
* @author suming
|
||||
*
|
||||
*/
|
||||
public class HttpUtl {
|
||||
|
||||
//超时时间
|
||||
private static final int TIMEOUT_IN_MILLIONS = 10000;
|
||||
|
||||
public interface CallBack {
|
||||
void onRequestComplete(int cmd, String result, Object orgs);
|
||||
void onRequestError(int cmd, String result, Object orgs);
|
||||
}
|
||||
|
||||
|
||||
public static String token;
|
||||
|
||||
/**
|
||||
* 异步的Get请求
|
||||
*
|
||||
* @param urlStr
|
||||
* @param callBack
|
||||
*/
|
||||
public static void doGetAsyn(final String urlStr, final CallBack callBack, int cmd, Object orgs) {
|
||||
new Thread() {
|
||||
public void run() {
|
||||
try {
|
||||
String result = doGet(urlStr);
|
||||
if (callBack != null) {
|
||||
callBack.onRequestComplete(cmd, result, orgs);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
if (callBack != null) {
|
||||
callBack.onRequestError(cmd, e.toString(), orgs);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
}.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* 异步的Post请求
|
||||
*
|
||||
* @param urlStr
|
||||
* @param params
|
||||
* @param callBack
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void doPostAsyn(final String urlStr, final String params, final CallBack callBack, int cmd, Object orgs) {
|
||||
new Thread() {
|
||||
public void run() {
|
||||
try {
|
||||
String result = doPost(urlStr, params);
|
||||
if (callBack != null) {
|
||||
callBack.onRequestComplete(cmd, result, orgs);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
if (callBack != null) {
|
||||
callBack.onRequestError(cmd, e.toString(), orgs);
|
||||
}
|
||||
}
|
||||
};
|
||||
}.start();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get请求,获得返回数据
|
||||
*
|
||||
* @param urlStr
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String doGet(String urlStr) throws Exception {
|
||||
URL url = null;
|
||||
HttpURLConnection conn = null;
|
||||
InputStream is = null;
|
||||
ByteArrayOutputStream baos = null;
|
||||
try {
|
||||
Log.i("http", "原始" + urlStr);
|
||||
// String encodURL = URLEncoder.encode(urlStr, "UTF-8");
|
||||
String encodURL = Uri.encode(urlStr);
|
||||
encodURL = encodURL.replaceAll("%3A", ":");
|
||||
encodURL = encodURL.replaceAll("%2F", "/");
|
||||
encodURL = encodURL.replaceAll("%3F", "?");
|
||||
encodURL = encodURL.replaceAll("%26", "&");
|
||||
encodURL = encodURL.replaceAll("%3D", "=");
|
||||
url = new URL(encodURL);
|
||||
conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setReadTimeout(TIMEOUT_IN_MILLIONS);
|
||||
conn.setConnectTimeout(TIMEOUT_IN_MILLIONS);
|
||||
conn.setRequestMethod("GET");
|
||||
conn.setRequestProperty("accept", "*/*");
|
||||
conn.setRequestProperty("connection", "Keep-Alive");
|
||||
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
||||
conn.setRequestProperty("charset", "utf-8");
|
||||
if(token != null) {
|
||||
conn.setRequestProperty("X-Auth-Token", token);
|
||||
}
|
||||
int retCode = conn.getResponseCode();
|
||||
if (retCode == 200) {
|
||||
if (token == null) {
|
||||
token = conn.getHeaderField("X-Auth-Token");
|
||||
}
|
||||
is = conn.getInputStream();
|
||||
|
||||
baos = new ByteArrayOutputStream();
|
||||
int len = -1;
|
||||
byte[] buf = new byte[128];
|
||||
|
||||
while ((len = is.read(buf)) != -1) {
|
||||
baos.write(buf, 0, len);
|
||||
}
|
||||
baos.flush();
|
||||
if (baos.toString()==null||baos.toString().equals("")) {
|
||||
Log.i("http", "result为空");
|
||||
} else {
|
||||
Log.i("http", baos.toString());
|
||||
}
|
||||
return baos.toString();
|
||||
} else {
|
||||
throw new RuntimeException(" responseCode :" + retCode);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
try {
|
||||
if (is != null)
|
||||
is.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
try {
|
||||
if (baos != null)
|
||||
baos.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
conn.disconnect();
|
||||
}
|
||||
// return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 向指定 URL 发送POST方法的请求
|
||||
*
|
||||
* @param url
|
||||
* 发送请求的 URL
|
||||
* @param param
|
||||
* 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
|
||||
* @return 所代表远程资源的响应结果
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String doPost(String url, String param) {
|
||||
PrintWriter out = null;
|
||||
BufferedReader in = null;
|
||||
String result = "";
|
||||
try {
|
||||
URL realUrl = new URL(url);
|
||||
// 打开和URL之间的连接
|
||||
HttpURLConnection conn = (HttpURLConnection) realUrl.openConnection();
|
||||
// 设置通用的请求属性
|
||||
conn.setRequestProperty("accept", "*/*");
|
||||
conn.setRequestProperty("connection", "Keep-Alive");
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
||||
conn.setRequestProperty("charset", "utf-8");
|
||||
if(token != null) {
|
||||
conn.setRequestProperty("X-Auth-Token", token);
|
||||
}
|
||||
conn.setUseCaches(false);
|
||||
// 发送POST请求必须设置如下两行
|
||||
conn.setDoOutput(true);
|
||||
conn.setDoInput(true);
|
||||
conn.setReadTimeout(TIMEOUT_IN_MILLIONS);
|
||||
conn.setConnectTimeout(TIMEOUT_IN_MILLIONS);
|
||||
|
||||
if (param != null && !param.trim().equals("")) {
|
||||
// 获取URLConnection对象对应的输出流
|
||||
out = new PrintWriter(conn.getOutputStream());
|
||||
// 发送请求参数
|
||||
out.print(param);
|
||||
// flush输出流的缓冲
|
||||
out.flush();
|
||||
}
|
||||
// 定义BufferedReader输入流来读取URL的响应
|
||||
in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
|
||||
String line;
|
||||
while ((line = in.readLine()) != null) {
|
||||
result += line;
|
||||
}
|
||||
if (result .equals("{}")){
|
||||
result = conn.getResponseCode()+"";
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Log.i("http", e.toString());
|
||||
}
|
||||
// 使用finally块来关闭输出流、输入流
|
||||
finally {
|
||||
try {
|
||||
if (out != null) {
|
||||
out.close();
|
||||
}
|
||||
if (in != null) {
|
||||
in.close();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (result==null&&result.equals("")) {
|
||||
Log.i("http", "result为空");
|
||||
} else {
|
||||
Log.i("http", result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用Post上传文件
|
||||
*
|
||||
* @param actionUrl
|
||||
* @param params
|
||||
* @param files
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
public static String post(String actionUrl, Map<String, String> params, Map<String, File> files)
|
||||
throws IOException {
|
||||
|
||||
String BOUNDARY = java.util.UUID.randomUUID().toString();
|
||||
String PREFIX = "--", LINEND = "\r\n";
|
||||
String MULTIPART_FROM_DATA = "multipart/form-data";
|
||||
String CHARSET = "UTF-8";
|
||||
URL uri = new URL(actionUrl);
|
||||
HttpURLConnection conn = (HttpURLConnection) uri.openConnection();
|
||||
conn.setReadTimeout(5 * 1000);
|
||||
conn.setDoInput(true);// 允许输入
|
||||
conn.setDoOutput(true);// 允许输出
|
||||
conn.setUseCaches(false);
|
||||
conn.setRequestMethod("POST"); // Post方式
|
||||
conn.setRequestProperty("connection", "keep-alive");
|
||||
conn.setRequestProperty("Charsert", "UTF-8");
|
||||
conn.setRequestProperty("Content-Type", MULTIPART_FROM_DATA + ";boundary=" + BOUNDARY);
|
||||
if(token != null) {
|
||||
conn.setRequestProperty("X-Auth-Token", token);
|
||||
}
|
||||
// 首先组拼文本类型的参数
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (Map.Entry<String, String> entry : params.entrySet()) {
|
||||
sb.append(PREFIX);
|
||||
sb.append(BOUNDARY);
|
||||
sb.append(LINEND);
|
||||
sb.append("Content-Disposition: form-data; name=\"" + entry.getKey() + "\"" + LINEND);
|
||||
sb.append("Content-Type: text/plain; charset=" + CHARSET + LINEND);
|
||||
sb.append("Content-Transfer-Encoding: 8bit" + LINEND);
|
||||
sb.append(LINEND);
|
||||
sb.append(entry.getValue());
|
||||
sb.append(LINEND);
|
||||
}
|
||||
|
||||
DataOutputStream outStream = new DataOutputStream(conn.getOutputStream());
|
||||
outStream.write(sb.toString().getBytes());
|
||||
|
||||
// 发送文件数据
|
||||
if (files != null)
|
||||
for (Map.Entry<String, File> file : files.entrySet()) {
|
||||
StringBuilder sb1 = new StringBuilder();
|
||||
sb1.append(PREFIX);
|
||||
sb1.append(BOUNDARY);
|
||||
sb1.append(LINEND);
|
||||
sb1.append(
|
||||
"Content-Disposition: form-data; name=\"file\"; filename=\"" + file.getKey() + "\"" + LINEND);
|
||||
sb1.append("Content-Type: application/octet-stream; charset=" + CHARSET + LINEND);
|
||||
sb1.append(LINEND);
|
||||
outStream.write(sb1.toString().getBytes());
|
||||
InputStream is = new FileInputStream(file.getValue());
|
||||
byte[] buffer = new byte[1024];
|
||||
int len = 0;
|
||||
while ((len = is.read(buffer)) != -1) {
|
||||
outStream.write(buffer, 0, len);
|
||||
}
|
||||
|
||||
is.close();
|
||||
outStream.write(LINEND.getBytes());
|
||||
}
|
||||
|
||||
// 请求结束标志
|
||||
byte[] end_data = (PREFIX + BOUNDARY + PREFIX + LINEND).getBytes();
|
||||
outStream.write(end_data);
|
||||
outStream.flush();
|
||||
|
||||
// 得到响应码
|
||||
int res = conn.getResponseCode();
|
||||
InputStream in = conn.getInputStream();
|
||||
InputStreamReader isReader = new InputStreamReader(in);
|
||||
BufferedReader bufReader = new BufferedReader(isReader);
|
||||
String line = null;
|
||||
String data = "OK";
|
||||
while ((line = bufReader.readLine()) == null)
|
||||
data += line;
|
||||
System.out.println(data);
|
||||
if (res == 200) {
|
||||
int ch;
|
||||
StringBuilder sb2 = new StringBuilder();
|
||||
while ((ch = in.read()) != -1) {
|
||||
sb2.append((char) ch);
|
||||
}
|
||||
}
|
||||
outStream.close();
|
||||
conn.disconnect();
|
||||
return in.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取网落图片资源
|
||||
*
|
||||
* @param url
|
||||
* @return
|
||||
*/
|
||||
public static Bitmap getHttpBitmap(String url) {
|
||||
URL myFileURL;
|
||||
Bitmap bitmap = null;
|
||||
try {
|
||||
myFileURL = new URL(url);
|
||||
// 获得连接
|
||||
HttpURLConnection conn = (HttpURLConnection) myFileURL.openConnection();
|
||||
// 设置超时时间为6000毫秒,conn.setConnectionTiem(0);表示没有时间限制
|
||||
conn.setConnectTimeout(6000);
|
||||
// 连接设置获得数据流
|
||||
conn.setDoInput(true);
|
||||
// 不使用缓存
|
||||
conn.setUseCaches(false);
|
||||
// 这句可有可无,没有影响
|
||||
// conn.connect();
|
||||
// 得到数据流
|
||||
InputStream is = conn.getInputStream();
|
||||
// 解析得到图片
|
||||
bitmap = BitmapFactory.decodeStream(is);
|
||||
// 关闭数据流
|
||||
is.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
||||
return bitmap;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
11
app/src/main/java/com/tianrun/sipcall/utils/logmy.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package com.tianrun.sipcall.utils;
|
||||
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
public class logmy {
|
||||
public static final String tag = "测试";
|
||||
public static void e(String str){
|
||||
Log.e(tag,str);
|
||||
}
|
||||
}
|
||||
BIN
app/src/main/res/drawable-hdpi/add.png
Normal file
|
After Width: | Height: | Size: 535 B |
BIN
app/src/main/res/drawable-hdpi/add_bg.png
Normal file
|
After Width: | Height: | Size: 396 B |
BIN
app/src/main/res/drawable-hdpi/answerbutton.png
Normal file
|
After Width: | Height: | Size: 3.1 KiB |
BIN
app/src/main/res/drawable-hdpi/backup.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
app/src/main/res/drawable-hdpi/bg.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
app/src/main/res/drawable-hdpi/bg2.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
app/src/main/res/drawable-hdpi/bg_half.png
Normal file
|
After Width: | Height: | Size: 923 B |
BIN
app/src/main/res/drawable-hdpi/circle.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
app/src/main/res/drawable-hdpi/empty.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
app/src/main/res/drawable-hdpi/hangupbutton.png
Normal file
|
After Width: | Height: | Size: 3.1 KiB |
BIN
app/src/main/res/drawable-hdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 7.5 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_call.png
Normal file
|
After Width: | Height: | Size: 5.3 KiB |
BIN
app/src/main/res/drawable-hdpi/input.9.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
app/src/main/res/drawable-hdpi/noruser.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
app/src/main/res/drawable-hdpi/onuser.png
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
app/src/main/res/drawable-hdpi/phone.png
Normal file
|
After Width: | Height: | Size: 848 B |
BIN
app/src/main/res/drawable-hdpi/phone3.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
app/src/main/res/drawable-hdpi/play.png
Normal file
|
After Width: | Height: | Size: 160 B |
BIN
app/src/main/res/drawable-hdpi/tree_ec.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/drawable-hdpi/tree_ex.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/drawable-hdpi/video.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
app/src/main/res/drawable-hdpi/voice.png
Normal file
|
After Width: | Height: | Size: 454 B |
BIN
app/src/main/res/drawable-hdpi/voice2.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
app/src/main/res/drawable-hdpi/voice_add.png
Normal file
|
After Width: | Height: | Size: 1022 B |
BIN
app/src/main/res/drawable-hdpi/voice_less.png
Normal file
|
After Width: | Height: | Size: 853 B |
BIN
app/src/main/res/drawable-ldpi/icon_call.png
Normal file
|
After Width: | Height: | Size: 5.3 KiB |
BIN
app/src/main/res/drawable-mdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
app/src/main/res/drawable-mdpi/icon_call.png
Normal file
|
After Width: | Height: | Size: 5.3 KiB |
34
app/src/main/res/drawable-v24/ic_launcher_foreground.xml
Normal file
@@ -0,0 +1,34 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="78.5885"
|
||||
android:endY="90.9159"
|
||||
android:startX="48.7653"
|
||||
android:startY="61.0927"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000" />
|
||||
</vector>
|
||||
BIN
app/src/main/res/drawable-v24/icon_call.png
Normal file
|
After Width: | Height: | Size: 5.3 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
app/src/main/res/drawable-xhdpi/icon_call.png
Normal file
|
After Width: | Height: | Size: 5.3 KiB |
BIN
app/src/main/res/drawable-xxhdpi/callbackground.png
Normal file
|
After Width: | Height: | Size: 55 KiB |
BIN
app/src/main/res/drawable-xxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
app/src/main/res/drawable-xxhdpi/icon_call.png
Normal file
|
After Width: | Height: | Size: 5.3 KiB |
12
app/src/main/res/drawable/bt_bg.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<corners
|
||||
android:bottomLeftRadius="7dp"
|
||||
android:bottomRightRadius="7dp"
|
||||
android:topLeftRadius="7dp"
|
||||
android:topRightRadius="7dp" />
|
||||
|
||||
<solid android:color="@color/login_bt" />
|
||||
|
||||
</shape>
|
||||
12
app/src/main/res/drawable/bt_bgd.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<corners
|
||||
android:bottomLeftRadius="7dp"
|
||||
android:bottomRightRadius="7dp"
|
||||
android:topLeftRadius="7dp"
|
||||
android:topRightRadius="7dp" />
|
||||
|
||||
<solid android:color="@color/login_btd" />
|
||||
|
||||
</shape>
|
||||
7
app/src/main/res/drawable/call_answer_background.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:drawable="@color/answerbuttonup" android:state_pressed="false"/>
|
||||
<item android:drawable="@color/answerbuttondown" android:state_pressed="true"/>
|
||||
|
||||
</selector>
|
||||
7
app/src/main/res/drawable/call_hangup_background.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:drawable="@color/hangupbuttonup" android:state_pressed="false"/>
|
||||
<item android:drawable="@color/hangupbuttondown" android:state_pressed="true"/>
|
||||
|
||||
</selector>
|
||||
6
app/src/main/res/drawable/callpad_bg.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<item android:drawable="@color/blue_text" android:state_pressed="false"/>
|
||||
<item android:drawable="@color/hui_se" android:state_pressed="true"/>
|
||||
|
||||
</selector>
|
||||
18
app/src/main/res/drawable/corners.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<solid android:color="@color/transparent" />
|
||||
|
||||
<corners
|
||||
android:bottomLeftRadius="8dp"
|
||||
android:bottomRightRadius="8dp"
|
||||
android:topLeftRadius="8dp"
|
||||
android:topRightRadius="8dp" />
|
||||
<!-- 这是半透明,还可以设置全透明,那就是白色边框的效果了 -->
|
||||
|
||||
<stroke
|
||||
android:dashGap="0dp"
|
||||
android:width="1dp"
|
||||
android:color="#FFFFFF" />
|
||||
|
||||
</shape>
|
||||
14
app/src/main/res/drawable/corners3.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<solid android:color="#802f74ff" />
|
||||
<corners android:topLeftRadius="0dp"
|
||||
android:topRightRadius="0dp"
|
||||
android:bottomRightRadius="1dp"
|
||||
android:bottomLeftRadius="1dp"/>
|
||||
<!-- 这是半透明,还可以设置全透明,那就是白色边框的效果了 -->
|
||||
|
||||
<stroke
|
||||
android:dashGap="0dp"
|
||||
android:width="1dp"
|
||||
android:color="@color/blue_text" />
|
||||
</shape>
|
||||
18
app/src/main/res/drawable/corners_black.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<solid android:color="@color/transparent" />
|
||||
|
||||
<corners
|
||||
android:bottomLeftRadius="8dp"
|
||||
android:bottomRightRadius="8dp"
|
||||
android:topLeftRadius="8dp"
|
||||
android:topRightRadius="8dp" />
|
||||
<!-- 这是半透明,还可以设置全透明,那就是白色边框的效果了 -->
|
||||
|
||||
<stroke
|
||||
android:dashGap="0dp"
|
||||
android:width="1dp"
|
||||
android:color="#363636" />
|
||||
|
||||
</shape>
|
||||
6
app/src/main/res/drawable/green_bg.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<item android:drawable="@color/login_bt2" android:state_pressed="false"/>
|
||||
<item android:drawable="@color/hui_se" android:state_pressed="true"/>
|
||||
|
||||
</selector>
|
||||
170
app/src/main/res/drawable/ic_launcher_background.xml
Normal file
@@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:fillColor="#008577"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M9,0L9,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,0L19,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,0L29,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,0L39,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,0L49,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,0L59,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,0L69,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,0L79,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M89,0L89,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M99,0L99,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,9L108,9"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,19L108,19"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,29L108,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,39L108,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,49L108,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,59L108,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,69L108,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,79L108,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,89L108,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,99L108,99"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,29L89,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,39L89,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,49L89,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,59L89,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,69L89,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,79L89,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,19L29,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,19L39,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,19L49,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,19L59,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,19L69,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,19L79,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
</vector>
|
||||
BIN
app/src/main/res/drawable/icon_call.png
Normal file
|
After Width: | Height: | Size: 5.3 KiB |
6
app/src/main/res/drawable/login_selsctor.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<item android:drawable="@drawable/bt_bg" android:state_pressed="false"/>
|
||||
<item android:drawable="@drawable/bt_bgd" android:state_pressed="true"/>
|
||||
|
||||
</selector>
|
||||
18
app/src/main/res/drawable/max_color_corners.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<solid android:color="@color/max_callnumbershowedit" />
|
||||
|
||||
<corners
|
||||
android:bottomLeftRadius="8dp"
|
||||
android:bottomRightRadius="8dp"
|
||||
android:topLeftRadius="8dp"
|
||||
android:topRightRadius="8dp" />
|
||||
<!-- 这是半透明,还可以设置全透明,那就是白色边框的效果了 -->
|
||||
|
||||
<stroke
|
||||
android:dashGap="0dp"
|
||||
android:width="1dp"
|
||||
android:color="#FFFFFF" />
|
||||
|
||||
</shape>
|
||||
6
app/src/main/res/drawable/red_bg.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<item android:drawable="@color/settingred" android:state_pressed="false"/>
|
||||
<item android:drawable="@color/hui_se" android:state_pressed="true"/>
|
||||
|
||||
</selector>
|
||||
75
app/src/main/res/layout/activity_callactivity.xml
Normal file
@@ -0,0 +1,75 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="visible">
|
||||
|
||||
<GridView
|
||||
android:id="@+id/NumKeyBoard"
|
||||
android:layout_width="561dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginStart="100dp"
|
||||
android:layout_marginTop="150dp"
|
||||
android:layout_marginEnd="100dp"
|
||||
android:layout_marginBottom="100dp"
|
||||
android:numColumns="3"
|
||||
android:scrollbars="none"
|
||||
android:visibility="visible">
|
||||
|
||||
</GridView>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ButtonCall"
|
||||
android:layout_width="72dp"
|
||||
android:layout_height="72dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginStart="150dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:baselineAlignBottom="false"
|
||||
android:contentDescription="@string/action_settings"
|
||||
android:onClick="audiocall"
|
||||
android:visibility="visible"
|
||||
app:srcCompat="@drawable/icon_call"
|
||||
app:tint="@color/blue_text" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_callnumber"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="50sp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="70dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:autofillHints=""
|
||||
android:background="@drawable/input"
|
||||
android:gravity="center"
|
||||
android:hint="请输入"
|
||||
android:inputType="numberSigned"
|
||||
android:padding="5dp"
|
||||
android:textColor="@color/blackcolor"
|
||||
android:textColorHint="@color/colorF"
|
||||
android:textSize="15sp"
|
||||
android:visibility="visible" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ButtonVedioCall"
|
||||
android:layout_width="72dp"
|
||||
android:layout_height="72dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginEnd="150dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:contentDescription="@string/action_settings"
|
||||
android:onClick="videocall"
|
||||
android:visibility="visible"
|
||||
app:srcCompat="@android:drawable/ic_menu_camera"
|
||||
app:tint="@color/blue_text" />
|
||||
|
||||
</RelativeLayout>
|
||||
18
app/src/main/res/layout/activity_gps.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<Button
|
||||
android:textSize="30sp"
|
||||
android:text="发送gps"
|
||||
android:onClick="sendgps"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
108
app/src/main/res/layout/activity_login.xml
Normal file
@@ -0,0 +1,108 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="@color/whitesmoke"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/show"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="null"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="20sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp">
|
||||
|
||||
<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" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/userpw"
|
||||
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" />
|
||||
|
||||
<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" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/userport"
|
||||
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" />
|
||||
|
||||
<Button
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_margin="10dp"
|
||||
android:background="@drawable/callpad_bg"
|
||||
android:onClick="login"
|
||||
android:text="登录"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<Button
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="@drawable/red_bg"
|
||||
android:onClick="exit2"
|
||||
android:text="退出"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="20sp"
|
||||
android:visibility="visible" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
382
app/src/main/res/layout/activity_main.xml
Normal file
@@ -0,0 +1,382 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/Relative"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageViewLeftBg"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="161dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginStart="0dp"
|
||||
android:layout_marginTop="0dp"
|
||||
android:layout_marginBottom="0dp"
|
||||
android:background="#F4F4F4" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/Volumne"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignEnd="@+id/imageViewLeftBg"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:text="音量:100"
|
||||
android:textAlignment="center"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageViewAddVoice"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignEnd="@+id/imageViewLeftBg"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginStart="13dp"
|
||||
android:layout_marginTop="50dp"
|
||||
android:layout_marginEnd="13dp"
|
||||
android:longClickable="true"
|
||||
android:onClick="addVolume"
|
||||
app:srcCompat="@drawable/circle"
|
||||
app:tint="#999999" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageViewAddVoiceIcon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignStart="@+id/imageViewAddVoice"
|
||||
android:layout_alignTop="@+id/imageViewAddVoice"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="12dp"
|
||||
app:srcCompat="@drawable/voice_add" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageViewDelVoice"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/imageViewAddVoice"
|
||||
android:layout_alignEnd="@+id/imageViewLeftBg"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginStart="13dp"
|
||||
android:layout_marginTop="40dp"
|
||||
android:layout_marginEnd="13dp"
|
||||
android:clickable="true"
|
||||
android:longClickable="true"
|
||||
android:onClick="delVolume"
|
||||
app:srcCompat="@drawable/circle"
|
||||
app:tint="#999999" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageViewDelVoiceIcon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignStart="@+id/imageViewDelVoice"
|
||||
android:layout_alignTop="@+id/imageViewDelVoice"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="12dp"
|
||||
app:srcCompat="@drawable/voice_less" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonQuit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignEnd="@+id/imageViewLeftBg"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:layout_marginBottom="50dp"
|
||||
android:background="@drawable/bt_bgd"
|
||||
android:onClick="logout"
|
||||
android:text="退出"
|
||||
android:textColor="#FFFFFF" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewSelfNum"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignEnd="@+id/imageViewLeftBg"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:text="号码:xxxx"
|
||||
android:textAlignment="center"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonAddGroup"
|
||||
style="@style/QMUI.RoundButton"
|
||||
android:layout_width="49dp"
|
||||
android:layout_height="51dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginTop="13dp"
|
||||
android:layout_marginEnd="13dp"
|
||||
android:onClick="addGroup"
|
||||
android:visibility="visible" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageViewAddGroupIcon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignStart="@+id/buttonAddGroup"
|
||||
android:layout_alignTop="@+id/buttonAddGroup"
|
||||
android:layout_alignEnd="@+id/buttonAddGroup"
|
||||
android:layout_alignBottom="@+id/buttonAddGroup"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
app:srcCompat="@drawable/add" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonTmpMeeting"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginStart="87dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:onClick="addTmpMeeting"
|
||||
android:text="临时会议" />
|
||||
|
||||
<com.qmuiteam.qmui.widget.tab.QMUITabSegment
|
||||
android:id="@+id/HeadList"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@+id/imageViewLine"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginStart="110dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="73dp"
|
||||
android:layout_marginBottom="-70dp"
|
||||
android:layout_toEndOf="@+id/imageViewLeftBg"
|
||||
android:columnWidth="70dp"
|
||||
android:horizontalSpacing="5dp"
|
||||
android:numColumns="auto_fit"
|
||||
android:scrollbars="none" />
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/contentViewPager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:fitsSystemWindows="true" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageViewLine"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp"
|
||||
android:layout_marginStart="0dp"
|
||||
android:layout_marginTop="75dp"
|
||||
android:layout_marginEnd="0dp"
|
||||
android:layout_toEndOf="@+id/imageViewLeftBg"
|
||||
android:background="@color/colorF" />
|
||||
|
||||
<GridView
|
||||
android:id="@+id/GridUser"
|
||||
android:layout_width="642dp"
|
||||
android:layout_height="292dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginStart="13dp"
|
||||
android:layout_marginTop="135dp"
|
||||
android:layout_marginEnd="0dp"
|
||||
android:layout_marginBottom="0dp"
|
||||
android:layout_toEndOf="@+id/imageViewLeftBg"
|
||||
android:horizontalSpacing="10dp"
|
||||
android:numColumns="5">
|
||||
|
||||
</GridView>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="503dp"
|
||||
android:layout_height="45dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginTop="85dp"
|
||||
android:layout_toEndOf="@+id/imageViewLeftBg"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/StartMeetingVoice"
|
||||
android:layout_width="108dp"
|
||||
android:layout_height="match_parent"
|
||||
android:clickable="false">
|
||||
|
||||
<Button
|
||||
android:id="@+id/button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:onClick="doMeetingVoice4Group"
|
||||
android:text="语音会议"
|
||||
android:textAlignment="viewEnd" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView2"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="12dp"
|
||||
app:srcCompat="@drawable/voice2" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/StartMeetingVideo"
|
||||
android:layout_width="108dp"
|
||||
android:layout_height="match_parent"
|
||||
android:clickable="false">
|
||||
|
||||
<Button
|
||||
android:id="@+id/button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:onClick="doMeetingVideo4Group"
|
||||
android:text="视频会议"
|
||||
android:textAlignment="viewEnd" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView2"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="12dp"
|
||||
app:srcCompat="@drawable/video" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/ButtonDelGroup"
|
||||
android:layout_width="108dp"
|
||||
android:layout_height="match_parent"
|
||||
android:clickable="false"
|
||||
android:focusableInTouchMode="false">
|
||||
|
||||
<Button
|
||||
android:id="@+id/button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:onClick="deleteGroup"
|
||||
android:text="删除分组"
|
||||
android:textAlignment="viewEnd"
|
||||
android:textColor="#F44336" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView2"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="12dp"
|
||||
app:srcCompat="@android:drawable/ic_delete" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="15dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginTop="90dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
app:srcCompat="@drawable/circle"
|
||||
app:tint="#5EE463" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginStart="42dp"
|
||||
android:layout_marginTop="1dp"
|
||||
android:text="在线"
|
||||
android:textAlignment="viewStart"
|
||||
android:textSize="12sp" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
app:srcCompat="@drawable/circle"
|
||||
app:tint="#F44336" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginStart="42dp"
|
||||
android:layout_marginTop="1dp"
|
||||
android:text="通话中"
|
||||
android:textAlignment="viewStart"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
app:srcCompat="@drawable/circle"
|
||||
app:tint="#999999" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginStart="42dp"
|
||||
android:layout_marginTop="1dp"
|
||||
android:text="离线"
|
||||
android:textAlignment="viewStart"
|
||||
android:textSize="12sp" />
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
214
app/src/main/res/layout/activity_meeting.xml
Normal file
@@ -0,0 +1,214 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/BG"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="50dp"
|
||||
android:background="@color/mainfragmentbg_color" >
|
||||
|
||||
<com.example.liyflibsdemo.meeting.utils.MarqueeTextView
|
||||
android:id="@+id/titlename"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:ellipsize="marquee"
|
||||
android:gravity="center"
|
||||
android:marqueeRepeatLimit="marquee_forever"
|
||||
android:singleLine="true"
|
||||
android:text="会议名称"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/line_back_meetingactivity"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/backup" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="50dp"
|
||||
android:background="@color/blue"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<com.example.liyflibsdemo.meeting.utils.MarqueeTextView
|
||||
android:visibility="gone"
|
||||
android:id="@+id/bt4"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="marquee"
|
||||
android:gravity="center"
|
||||
android:marqueeRepeatLimit="marquee_forever"
|
||||
android:singleLine="true"
|
||||
android:text="短信"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="15sp" />
|
||||
|
||||
|
||||
<com.example.liyflibsdemo.meeting.utils.MarqueeTextView
|
||||
android:id="@+id/myphonestate"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="marquee"
|
||||
android:gravity="center"
|
||||
android:marqueeRepeatLimit="marquee_forever"
|
||||
android:singleLine="true"
|
||||
android:text="本机状态"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<com.example.liyflibsdemo.meeting.utils.MarqueeTextView
|
||||
android:id="@+id/my1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="marquee"
|
||||
android:gravity="center"
|
||||
android:marqueeRepeatLimit="marquee_forever"
|
||||
android:singleLine="true"
|
||||
android:text="不在会议"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<com.example.liyflibsdemo.meeting.utils.MarqueeTextView
|
||||
android:id="@+id/my2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="marquee"
|
||||
android:gravity="center"
|
||||
android:marqueeRepeatLimit="marquee_forever"
|
||||
android:singleLine="true"
|
||||
android:text="未禁言"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="15sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/zhukonglin"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="50dp"
|
||||
android:orientation="horizontal" >
|
||||
<Button
|
||||
android:id="@+id/bt1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@color/hui_d"
|
||||
android:text="会议详情"
|
||||
android:textColor="#FFFFFF" />
|
||||
|
||||
<Button
|
||||
android:visibility="gone"
|
||||
android:id="@+id/bt2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@color/hui_d"
|
||||
android:text="入会申请"
|
||||
android:textColor="#FFFFFF" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt3"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@color/hui_d"
|
||||
android:text="话权申请"
|
||||
android:textColor="#FFFFFF" />
|
||||
</LinearLayout>
|
||||
|
||||
<ListView
|
||||
android:id="@+id/meetinglistview"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
<ListView
|
||||
android:id="@+id/meetingapplylistview"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0dp"
|
||||
android:visibility="gone"
|
||||
android:layout_weight="1" />
|
||||
<ListView
|
||||
android:id="@+id/speekapplylistview"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0dp"
|
||||
android:visibility="gone"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="70dp"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<Button
|
||||
android:id="@+id/adduser"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/callpad_bg"
|
||||
android:text="成员管理"
|
||||
android:textColor="#FFFFFF" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/fp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/callpad_bg"
|
||||
android:text="分屏"
|
||||
android:textColor="#FFFFFF" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/ll"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/callpad_bg"
|
||||
android:text="录制"
|
||||
android:textColor="#FFFFFF" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/startmeeting"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/green_bg"
|
||||
android:text="开始"
|
||||
android:textColor="#FFFFFF" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/stopmeeting"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/red_bg"
|
||||
android:text="结束"
|
||||
android:textColor="#FFFFFF" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
59
app/src/main/res/layout/activity_meetingactivity.xml
Normal file
@@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<Button
|
||||
android:id="@+id/myroom"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="我的会议" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/otherroom"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="其他会议" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/lxr"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="联系人" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/newmeeting"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="新建会议" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<ListView
|
||||
android:id="@+id/roomlistview"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:visibility="visible" >
|
||||
</ListView>
|
||||
|
||||
<ListView
|
||||
android:visibility="gone"
|
||||
android:id="@+id/mTree"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent" >
|
||||
</ListView>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
71
app/src/main/res/layout/activity_message.xml
Normal file
@@ -0,0 +1,71 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:fresco="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:layout_margin="2dp"
|
||||
android:textSize="30sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="sendmessage"
|
||||
android:text="发送文字" />
|
||||
|
||||
<Button
|
||||
android:layout_margin="2dp"
|
||||
android:textSize="30sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="sendpic"
|
||||
android:text="发送图片" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/message_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:gravity="center"
|
||||
android:text="TextView" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="3"
|
||||
android:orientation="horizontal">
|
||||
<ImageView
|
||||
android:id="@+id/im"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="250dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
53
app/src/main/res/layout/activity_pttactivity.xml
Normal file
@@ -0,0 +1,53 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical" >
|
||||
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal" >
|
||||
<TextView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:gravity="center"
|
||||
android:id="@+id/pttshow"
|
||||
android:textColor="#000000"
|
||||
android:text="离线"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="2"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/myspinner"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/ptt"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="ptt"
|
||||
android:textSize="35sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
72
app/src/main/res/layout/activity_selectuseractivity.xml
Normal file
@@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="50dp"
|
||||
android:background="@color/mainfragmentbg_color" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:gravity="center"
|
||||
android:text="选择收件人"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/selectuser_back"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/backup" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<ListView
|
||||
android:id="@+id/selectuser_listview"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="5" >
|
||||
</ListView>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_weight="0.5"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<Button
|
||||
android:id="@+id/selectuser_ok"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/login_selsctor"
|
||||
android:text="确定"
|
||||
android:textColor="#000000" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/selectuser_cancel"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/login_selsctor"
|
||||
android:text="取消"
|
||||
android:textColor="#000000" />
|
||||
</LinearLayout>
|
||||
|
||||
47
app/src/main/res/layout/activity_sos.xml
Normal file
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="20dp">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<Button
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:onClick="sendsosquery"
|
||||
android:text="报警查询"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<Button
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:onClick="sendsos"
|
||||
android:text="报警"
|
||||
android:textSize="15sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
<com.baidu.mapapi.map.MapView
|
||||
android:id="@+id/bmapView"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:clickable="true" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
55
app/src/main/res/layout/adapterlayout_room.xml
Normal file
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/tolin"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="3"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/roomname"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="hahah"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/roomid"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="123"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/roomstate"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="adaw"
|
||||
android:textSize="20sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/room_rdel"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/red_bg"
|
||||
android:text="删除"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
48
app/src/main/res/layout/applymeeting_layout.xml
Normal file
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="60dp"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/apply_number"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:singleLine="true"
|
||||
android:text="602"
|
||||
android:textColor="#000000" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<Button
|
||||
android:id="@+id/apply_yes"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/green_bg"
|
||||
android:text="同意"
|
||||
android:textColor="#FFFFFF" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/apply_no"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/red_bg"
|
||||
android:text="拒绝"
|
||||
android:textColor="#FFFFFF" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
96
app/src/main/res/layout/creatgroup_view.xml
Normal file
@@ -0,0 +1,96 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/RelativeLayoutNewGroupRoot"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="#eaedf0">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="50dp"
|
||||
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/group_name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1.5"
|
||||
android:hint="请输入"
|
||||
android:singleLine="true"
|
||||
android:text=""
|
||||
android:textColor="#000000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
<GridView
|
||||
android:id="@+id/GridUser_select"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="292dp"
|
||||
android:layout_alignParentStart="false"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="false"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginTop="70dp"
|
||||
android:layout_marginBottom="65dp"
|
||||
android:horizontalSpacing="10dp"
|
||||
android:numColumns="5">
|
||||
|
||||
</GridView>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginBottom="0dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonBack"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:onClick="exit"
|
||||
android:text="取消"
|
||||
android:textColor="@color/redcolor"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonNewGroup"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:onClick="createGroup"
|
||||
android:text="创建分组" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
233
app/src/main/res/layout/creatmeeting_view.xml
Normal file
@@ -0,0 +1,233 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="#eaedf0">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="50dp"
|
||||
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/meeting_name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1.5"
|
||||
android:hint="可为空"
|
||||
android:singleLine="true"
|
||||
android:text="临时会议"
|
||||
android:textColor="#000000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
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/meeting_desc"
|
||||
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="50dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:background="#FFFFFF"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_weight="1.5"
|
||||
android:gravity="center_vertical"
|
||||
android:singleLine="true"
|
||||
android:text="分辨率"
|
||||
android:textColor="#000000"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/meeting_resolution"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_weight="3" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewMembers"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:singleLine="true"
|
||||
android:text="已选择:"
|
||||
android:textColor="#363636"
|
||||
android:textSize="18sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:background="#FFFFFF"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_weight="1.5"
|
||||
android:gravity="center_vertical"
|
||||
android:singleLine="true"
|
||||
android:text="录制"
|
||||
android:textColor="#000000"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/meeting_record"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_weight="3" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:background="#FFFFFF"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_weight="1.5"
|
||||
android:gravity="center_vertical"
|
||||
android:singleLine="true"
|
||||
android:text="模式"
|
||||
android:textColor="#000000"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/vismode_spinner"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_weight="3" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
<GridView
|
||||
android:id="@+id/GridUser_select"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="292dp"
|
||||
android:layout_alignParentStart="false"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="false"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginTop="110dp"
|
||||
android:layout_marginBottom="65dp"
|
||||
android:horizontalSpacing="10dp"
|
||||
android:numColumns="5">
|
||||
|
||||
</GridView>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginBottom="0dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonBack"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:onClick="exit"
|
||||
android:text="取消"
|
||||
android:textColor="@color/redcolor"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonMeetingVoice"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:onClick="createMeetingVoice"
|
||||
android:text="语音会议"
|
||||
android:textColor="#00FF00" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonMeetingVideo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:onClick="createMeetingVideo"
|
||||
android:text="视频会议"
|
||||
android:textColor="@color/blue_text" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
77
app/src/main/res/layout/incallactivity.xml
Normal file
@@ -0,0 +1,77 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="@drawable/callbackground" >
|
||||
|
||||
<blue.view.SMPercentFrameLayout
|
||||
android:id="@+id/remote_video_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginBottom="0dp"
|
||||
android:visibility="visible">
|
||||
|
||||
<blue.view.SMSurfaceViewRenderer
|
||||
android:id="@+id/remote_video_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</blue.view.SMPercentFrameLayout>
|
||||
|
||||
<blue.view.SMPercentFrameLayout
|
||||
android:id="@+id/local_video_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:visibility="visible">
|
||||
|
||||
<blue.view.SMSurfaceViewRenderer
|
||||
android:id="@+id/local_video_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="visible" />
|
||||
</blue.view.SMPercentFrameLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/incall_answer"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/call_answer_background"
|
||||
android:src="@drawable/voice2" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/incall_hangup"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/call_hangup_background"
|
||||
android:src="@drawable/phone3" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/show"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginStart="0dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginEnd="0dp"
|
||||
android:text="123"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="20sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
107
app/src/main/res/layout/incallmeetingactivity.xml
Normal file
@@ -0,0 +1,107 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="@drawable/callbackground" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView3"
|
||||
android:layout_width="130dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#15516C" />
|
||||
|
||||
<GridView
|
||||
android:id="@+id/GridUser"
|
||||
android:layout_width="130dp"
|
||||
android:layout_height="292dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginStart="0dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="0dp"
|
||||
android:horizontalSpacing="10dp"
|
||||
android:numColumns="1">
|
||||
|
||||
</GridView>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="766dp"
|
||||
android:layout_height="482dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginStart="130dp"
|
||||
android:layout_marginTop="0dp"
|
||||
android:layout_marginEnd="0dp"
|
||||
android:layout_marginBottom="50dp"
|
||||
android:visibility="visible">
|
||||
|
||||
<blue.view.SMPercentFrameLayout
|
||||
android:id="@+id/remote_video_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="visible">
|
||||
|
||||
<blue.view.SMSurfaceViewRenderer
|
||||
android:id="@+id/remote_video_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</blue.view.SMPercentFrameLayout>
|
||||
|
||||
<blue.view.SMPercentFrameLayout
|
||||
android:id="@+id/local_video_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="visible">
|
||||
|
||||
<blue.view.SMSurfaceViewRenderer
|
||||
android:id="@+id/local_video_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="visible" />
|
||||
</blue.view.SMPercentFrameLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginStart="130dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/incall_answer"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/call_answer_background"
|
||||
android:src="@drawable/voice2"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/incall_hangup"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/call_hangup_background"
|
||||
android:src="@drawable/phone3" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/show"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="30dp"
|
||||
android:text="123"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="20sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
84
app/src/main/res/layout/list_item.xml
Normal file
@@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/t_lin"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="40dip"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/id_treenode_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:src="@drawable/tree_ec" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/id_treenode_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="@string/app_name"
|
||||
android:textSize="18dip" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/b_lin"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="60dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/tree_touch"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="7"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/uimage"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_weight="1"
|
||||
android:src="@drawable/noruser" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/uname"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_weight="4"
|
||||
android:singleLine="true"
|
||||
android:text="张强 (3352)"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ustate"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_weight="2"
|
||||
android:gravity="center"
|
||||
android:text="在线"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/ucb"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
18
app/src/main/res/layout/list_item_head.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Button xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/Item_user"
|
||||
|
||||
style="@style/Widget.AppCompat.Button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/bt_bgd"
|
||||
android:clickable="true"
|
||||
android:descendantFocusability="blocksDescendants"
|
||||
android:foregroundGravity="center"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:text="全部"
|
||||
app:layout_anchorGravity="center"
|
||||
app:layout_gravity="center"></Button>
|
||||