From ff886457f58791eea4532f6167af51184d9dfe43 Mon Sep 17 00:00:00 2001 From: lss <lsc@hdlchina.com.cn> Date: 星期四, 26 五月 2022 17:31:42 +0800 Subject: [PATCH] 送测 --- HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/dialog/LpTimeDialog.java | 222 ++++++++++ HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/values-zh/strings.xml | 4 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/values/strings.xml | 3 Shared.Droid.HDLLinphone/Shared.Droid.HDLLinphone/Jars/HDLLinphoneSDK-V1.0.1.aar | 0 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/layout/dialog_lpsdk_time_select.xml | 58 ++ HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/core/service/HDLLinphoneService.java | 53 + HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/dialog/LpTipDialog.java | 101 ++++ HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/values/colors.xml | 1 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/lp_dialog_background.xml | 9 HDLLinphoneSDKDemoNew/app/src/main/res/values/integers.xml | 5 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/activity/HDLLinphoneMonitorActivity.java | 2 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/raw/lpconfig.xsd | 83 ++- HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/activity/HDLLinphoneIntercomActivity.java | 8 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/raw/hdl_rootca.pem | 0 .DS_Store | 0 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/.DS_Store | 0 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/lp_dialog_confirm_background.xml | 9 HDLLinphoneSDKDemoNew/.DS_Store | 0 Shared.Droid.HDLLinphone/Shared.Droid.HDLLinphone/Shared.Droid.HDLLinphone.csproj | 6 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/utils/HDLImageUtils.java | 36 + HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/interfaces/AddressType.java | 11 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/AndroidManifest.xml | 6 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/layout/dialog_lpsdk_tip.xml | 56 ++ HDLLinphoneSDKDemoNew/app/src/main/res/values/colors.xml | 13 HDLLinphoneSDKDemoNew/app/build.gradle | 7 HDLLinphoneSDKDemoNew/app/src/main/res/values/strings.xml | 21 HDLLinphoneSDKDemoNew/app/src/main/res/values/themes.xml | 6 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/lp_dialog_cancel_background.xml | 17 /dev/null | 10 HDLLinphoneSDKDemoNew/app/src/main/res/values/styles.xml | 5 HDLLinphoneSDKDemoNew/app/src/main/res/layout/activity_main.xml | 38 + HDLLinphoneSDKDemoNew/app/src/main/java/com/example/hdllinphonesdkdemo/MainActivity.java | 214 ++------- HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/HDLLinphoneKit.java | 154 +++++- HDLLinphoneSDKDemoNew/app/src/main/res/values/dimens.xml | 15 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/core/callback/PhoneCallback.java | 2 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/values/styles.xml | 18 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/layout/activity_hdllinphone_intercom.xml | 127 ++--- 37 files changed, 932 insertions(+), 388 deletions(-) diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..058440d --- /dev/null +++ b/.DS_Store Binary files differ diff --git a/HDLLinphoneSDKDemoNew/.DS_Store b/HDLLinphoneSDKDemoNew/.DS_Store new file mode 100644 index 0000000..2c0e996 --- /dev/null +++ b/HDLLinphoneSDKDemoNew/.DS_Store Binary files differ diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/.DS_Store b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/.DS_Store new file mode 100644 index 0000000..f93ad88 --- /dev/null +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/.DS_Store Binary files differ diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/AndroidManifest.xml b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/AndroidManifest.xml index 16b10b4..f7da630 100644 --- a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/AndroidManifest.xml +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/AndroidManifest.xml @@ -21,7 +21,11 @@ android:allowBackup="true" android:label="@string/app_name" android:supportsRtl="true"> - <activity android:name=".activity.HDLLinphoneReverseCallActivity"></activity> + <activity android:name=".activity.HDLLinphoneReverseCallActivity"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + </intent-filter> + </activity> <activity android:name=".activity.HDLLinphoneMonitorActivity" /> <activity android:name=".activity.HDLLinphoneIntercomActivity" /> diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/HDLLinphoneKit.java b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/HDLLinphoneKit.java index 8f82f11..29227e3 100644 --- a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/HDLLinphoneKit.java +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/HDLLinphoneKit.java @@ -2,10 +2,12 @@ import android.content.Context; import android.content.Intent; +import android.util.Log; import android.view.TextureView; import android.widget.Toast; import com.hdl.hdllinphonesdk.activity.HDLLinphoneIntercomActivity; +import com.hdl.hdllinphonesdk.activity.HDLLinphoneReverseCallActivity; import com.hdl.hdllinphonesdk.callback.OnHDLLinphoneCallListener; import com.hdl.hdllinphonesdk.callback.OnLPOpenDoorCallBack; import com.hdl.hdllinphonesdk.core.callback.PhoneCallback; @@ -25,12 +27,36 @@ import org.linphone.core.ProxyConfig; import org.linphone.core.TransportType; +import java.io.FileOutputStream; +import java.io.InputStream; + import static java.lang.Thread.sleep; /** * Created by jlchen on 2021/8/4. */ public class HDLLinphoneKit { + /** + * 涓版灄鍙瀵硅 + */ + public static final String INTER_PHONE_TYPE_FLVI = "FLVI"; + /** + * 澶у崕鍙瀵硅 + */ + public static final String INTER_PHONE_TYPE_IMOUVISIAL = "IMOUVISIAL"; + /** + * 钀ょ煶鐚溂 + */ + public static final String INTER_PHONE_TYPE_EZVIZ = "EZVIZ"; + /** + * HDL鍙瀵硅 + */ + public static final String INTER_PHONE_TYPE_HDL = "HDL"; + /** + * 鍏ㄨ閫氬彲瑙嗗璁� + */ + public static final String INTER_PHONE_TYPE_FREEVIEW = "FREEVIEW"; + public static final String KEY_TITLE_NAME = "lpTitleName"; public static final String KEY_SIP_ACCOUNT = "lpSipAccount"; public static final String HDLLinphoneKitNAME = "HDLLinphoneKit"; @@ -38,7 +64,7 @@ private Context viewContext; private ServiceWaitThread mServiceWaitThread; private String mUsername, mPassword, mServerIP; -// private TextureView mRenderingView, mPreviewView; + // private TextureView mRenderingView, mPreviewView; private boolean isAutoJumpCallView;//鏄惁鑷姩璺宠浆鍛煎彨椤甸潰 private HDLLinphoneKit() { @@ -47,6 +73,7 @@ /** * getInstance + * * @return HDLLinphoneKit */ public static synchronized HDLLinphoneKit getInstance() { @@ -66,16 +93,17 @@ * @return Core */ public Core getCore() { - if(!HDLLinphoneService.isReady()){ + if (!HDLLinphoneService.isReady()) { CheckIfNeedstartService(); return null; - }else { + } else { return HDLLinphoneService.getCore(); } } /** * 鍒濆鍖朙inphone + * * @param context */ public void initLinphone(Context context) { @@ -83,14 +111,13 @@ if (!HDLLinphoneService.isReady()) { CheckIfNeedstartService(); } else { - } } /** * startService */ - private synchronized void CheckIfNeedstartService(){ + private synchronized void CheckIfNeedstartService() { startService(viewContext); addCallback(new RegistrationCallback() { @Override @@ -98,7 +125,6 @@ super.registrationOk(); HDLLog.e(HDLLinphoneKitNAME, "registrationOk: "); callBackRegistrationOk(viewContext); - } @Override @@ -159,9 +185,13 @@ * 璺宠浆鎵撳紑鍛煎彨椤甸潰 */ public void gotoHDLLinphoneIntercomActivity() { - Intent intent = new Intent(viewContext, HDLLinphoneIntercomActivity.class); - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - viewContext.startActivity(intent); + try { + Intent intent = new Intent(viewContext, HDLLinphoneIntercomActivity.class); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + viewContext.startActivity(intent); + } catch (Exception e) { + e.printStackTrace(); + } } /** @@ -215,11 +245,11 @@ * @param password 瀵嗙爜 * @param serverIP sip 鏈嶅姟鍣� */ - public void setAccountAndLogin(String username, String password, String serverIP) { + public void setAccountAndLogin(String username, String password, String serverIP, String inter_type) { mUsername = username; mPassword = password; mServerIP = serverIP; - login(); + login(inter_type); } /** @@ -228,8 +258,7 @@ * @param phoneCallback 閫氳瘽鍥炶皟 * @param registrationCallback 娉ㄥ唽鐘舵�佸洖璋� */ - public void addCallback(RegistrationCallback registrationCallback, - PhoneCallback phoneCallback) { + public void addCallback(RegistrationCallback registrationCallback, PhoneCallback phoneCallback) { if (HDLLinphoneService.isReady()) { HDLLinphoneService.addRegistrationCallback(registrationCallback); HDLLinphoneService.addPhoneCallback(phoneCallback); @@ -242,19 +271,16 @@ /** * 鐧诲綍鍒� SIP 鏈嶅姟鍣� */ - public void login() { - new Thread(new Runnable() { - @Override - public void run() { - while (!HDLLinphoneService.isReady()) { - try { - sleep(80); - } catch (InterruptedException e) { - e.printStackTrace(); - } + public void login(String inter_type) { + new Thread(() -> { + while (!HDLLinphoneService.isReady()) { + try { + sleep(80); + } catch (InterruptedException e) { + e.printStackTrace(); } - loginToServer(); } + loginToServer(inter_type); }).start(); } @@ -283,7 +309,7 @@ /** * 娓呴櫎閰嶇疆琛�, 鍒囨崲璐﹀彿鏃朵細鐢ㄥ埌 */ - public void clearProxyConfig(){ + public void clearProxyConfig() { Core core = HDLLinphoneService.getCore(); if (core != null) { core.setDefaultProxyConfig(null); @@ -323,16 +349,23 @@ /** * 鐧诲綍 SIP 鏈嶅姟鍣� */ - private void loginToServer() { + private void loginToServer(String inter_type) { try { if (mUsername == null || mPassword == null || mServerIP == null) { throw new RuntimeException("The sip account is not configured."); } - registerUserAuth(mUsername, mPassword, mServerIP); + if (inter_type.equals(INTER_PHONE_TYPE_FREEVIEW)) { + // 鍏ㄨ閫氬彲瑙嗗璁叉敞鍐� + freeViewRegisterUserAuth(mUsername, mPassword, mServerIP); + } else { + // 鍏朵粬鍙瀵硅娉ㄥ唽 + registerUserAuth(mUsername, mPassword, mServerIP); + } } catch (CoreException e) { e.printStackTrace(); } } + /** * 鎻愪氦璐﹀彿鍜屽瘑鐮佹敞鍐屽埌鏈嶅姟鍣� * @@ -343,11 +376,9 @@ */ public void registerUserAuth(String name, String password, String host) throws CoreException { Core mLinphoneCore = HDLLinphoneService.getCore(); - if(mLinphoneCore == null) return; + if (mLinphoneCore == null) return; - AuthInfo authInfo = Factory.instance().createAuthInfo(name, null, password, - null, null, host); - + AuthInfo authInfo = Factory.instance().createAuthInfo(name, null, password, null, null, host); AccountCreator mAccountCreator = mLinphoneCore.createAccountCreator(null); mAccountCreator.setUsername(name); mAccountCreator.setDomain(host); @@ -365,15 +396,45 @@ } /** - * 鍛煎彨 + * 鎻愪氦璐﹀彿鍜屽瘑鐮佹敞鍐屽埌鍏ㄨ閫氭湇鍔″櫒 + * + * @throws CoreException + */ + public void freeViewRegisterUserAuth(String userName, String password, String domain) throws CoreException { + Core mLinphoneCore = HDLLinphoneService.getCore(); + if (mLinphoneCore == null) return; + + AuthInfo authInfo = Factory.instance().createAuthInfo(userName, "", password, null, null, domain); + + AccountCreator mAccountCreator = mLinphoneCore.createAccountCreator(null); + mAccountCreator.setUsername(userName); + mAccountCreator.setDomain("yun"); + mAccountCreator.setPassword(password); + mAccountCreator.setTransport(TransportType.Udp); + + ProxyConfig prxCfg = mAccountCreator.createProxyConfig(); + prxCfg.enableQualityReporting(false); + prxCfg.setQualityReportingCollector(null); + prxCfg.setQualityReportingInterval(0); + prxCfg.enableRegister(true); + prxCfg.setServerAddr("sip:139.159.157.75:46000;transport=udp"); + + mLinphoneCore.addProxyConfig(prxCfg);//娣诲姞浠g悊閰嶇疆銆傚鏋滃惎鐢ㄤ簡娉ㄥ唽锛岃繖灏嗗紑濮嬪湪浠g悊涓婃敞鍐屻�� + mLinphoneCore.addAuthInfo(authInfo);//娣诲姞璁よ瘉淇℃伅鍒�,璇ヤ俊鎭墖娈靛皢鍦ㄦ墍鏈夐渶瑕佺殑SIP浜嬪姟涓娇鐢ㄨ韩浠介獙璇� + mLinphoneCore.setDefaultProxyConfig(prxCfg);//璁剧疆榛樿浠g悊銆� + } + + /** + * 鍛煎彨,鍏ㄨ閫氬彲瑙嗗璁查渶瑕佸皢 澶栧嚭浠g悊鏈嶅姟鍣ㄦ墦寮�锛屾墠鑳戒娇鐢� 绌洪棿鍙峰懠鍙紱 + * 鏆傛椂娌℃壘鍒版�庝箞鎵撳紑锛屾墍浠ラ渶瑕佹墜鍔ㄥ姞涓妏roxy */ public Call startSingleCallingTo(String userName, boolean isVideoCall) { Core mLinphoneCore = HDLLinphoneService.getCore(); - if(mLinphoneCore == null) return null; + if (mLinphoneCore == null) return null; Call call = null; Core core = HDLLinphoneService.getCore(); - if(core != null) { + if (core != null) { Address addressToCall = core.interpretUrl(userName); CallParams params = core.createCallParams(null); @@ -412,7 +473,7 @@ */ public void acceptCall() { try { - if(HDLLinphoneService.getCore() == null) return; + if (HDLLinphoneService.getCore() == null) return; Call currentCall = HDLLinphoneService.getCore().getCurrentCall(); CallParams params = HDLLinphoneService.getCore().createCallParams(currentCall); params.enableVideo(true); @@ -428,7 +489,7 @@ */ public void acceptCallWithVideo(boolean enableVideo) { try { - if(HDLLinphoneService.getCore() == null) return; + if (HDLLinphoneService.getCore() == null) return; Call currentCall = HDLLinphoneService.getCore().getCurrentCall(); CallParams params = HDLLinphoneService.getCore().createCallParams(currentCall); params.enableVideo(enableVideo); @@ -444,7 +505,7 @@ */ public void hangUp() { Core mLinphoneCore = HDLLinphoneService.getCore(); - if(mLinphoneCore == null) return; + if (mLinphoneCore == null) return; Call currentCall = mLinphoneCore.getCurrentCall(); if (currentCall != null) { // mLinphoneCore.terminateCall(currentCall); @@ -463,7 +524,7 @@ */ public void toggleMicro(boolean isMicMuted) { Core mLinphoneCore = HDLLinphoneService.getCore(); - if(mLinphoneCore == null) return; + if (mLinphoneCore == null) return; mLinphoneCore.enableMic(!isMicMuted); } @@ -482,7 +543,7 @@ private void routeAudioToSpeakerHelper(boolean speakerOn) { org.linphone.core.tools.Log.w("[Audio Manager] Routing audio to " + (speakerOn ? "speaker" : "earpiece")); try { - if(HDLLinphoneService.getCore() == null) return; + if (HDLLinphoneService.getCore() == null) return; if (HDLLinphoneService.getCore().getCallsNb() == 0) return; Call currentCall = HDLLinphoneService.getCore().getCurrentCall(); if (currentCall == null) currentCall = HDLLinphoneService.getCore().getCalls()[0]; @@ -518,6 +579,7 @@ /** * 璁剧疆鎾斁View + * * @param o */ private void setVideoWindow(Object o) { @@ -526,6 +588,7 @@ linphoneCore.setNativeVideoWindowId(o); } } + /** * 绉婚櫎鎾斁View */ @@ -538,6 +601,7 @@ /** * 璁剧疆鏈満鎽勫儚澶撮噰闆嗙殑View + * * @param o */ private void setPreviewWindow(Object o) { @@ -546,6 +610,7 @@ linphoneCore.setNativePreviewWindowId(o); } } + /** * 绉婚櫎瑙嗛閲囬泦View */ @@ -560,9 +625,9 @@ * 鑾峰彇褰撳墠閫氳瘽鐘舵�� */ public Call.State getCallState() { - if(HDLLinphoneService.getInstance() == null) { + if (HDLLinphoneService.getInstance() == null) { return null; - }else { + } else { return HDLLinphoneService.getInstance().getCurrentCallState(); } } @@ -571,9 +636,9 @@ * 鑾峰彇褰撳墠閫氳瘽鐘舵�佹槸鍚︿负鏉ョ數涓� */ public boolean isIncomingReceivedCallState() { - if(HDLLinphoneService.getInstance() == null || HDLLinphoneService.getInstance().getCurrentCallState() == null){ + if (HDLLinphoneService.getInstance() == null || HDLLinphoneService.getInstance().getCurrentCallState() == null) { return false; - }else{ + } else { return (HDLLinphoneService.getInstance().getCurrentCallState() == Call.State.IncomingReceived); } } @@ -587,6 +652,7 @@ /** * 璁剧疆鏄惁鑷姩璺宠浆鍛煎彨椤甸潰鏍囧織 + * * @param autoJumpCallView */ public void setAutoJumpCallView(boolean autoJumpCallView) { @@ -631,6 +697,7 @@ /** * 鑾峰彇onHDLLinphoneCallListener * 鎺ュ惉銆佹寕鏂�佸紑閿佺瓑 Listener瀹炵幇 + * * @return OnHDLLinphoneCallListener */ public OnHDLLinphoneCallListener getOnHDLLinphoneCallListener() { @@ -639,6 +706,7 @@ /** * 璁剧疆onHDLLinphoneCallListener + * * @param onHDLLinphoneCallListener */ public void setOnHDLLinphoneCallListener(OnHDLLinphoneCallListener onHDLLinphoneCallListener) { diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/activity/HDLLinphoneIntercomActivity.java b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/activity/HDLLinphoneIntercomActivity.java index d05a347..0a48ba6 100644 --- a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/activity/HDLLinphoneIntercomActivity.java +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/activity/HDLLinphoneIntercomActivity.java @@ -139,8 +139,6 @@ timer_lp_calltime = (Chronometer) findViewById(R.id.timer_lp_calltime); tv_lp_calltime = findViewById(R.id.tv_lp_calltime); setWidthHeightWithRatio(ll_video_lp_rendering, 16, 9); - - } /** @@ -261,7 +259,6 @@ showToast(getString(R.string.lp_operationFailedStr)); } } - /** * 寮�閿佺偣鍑讳簨浠� @@ -419,7 +416,6 @@ video_lp_rendering2 = null; } - /** * 鍒濆鍖栭渿鍔ㄥ櫒 */ @@ -445,8 +441,8 @@ /** * 鍏抽棴闇囧姩鍣� */ - void cancelVibrator(){ - if(mVibrator != null){ + void cancelVibrator() { + if (mVibrator != null) { mVibrator.cancel(); mVibrator = null; } diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/activity/HDLLinphoneMonitorActivity.java b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/activity/HDLLinphoneMonitorActivity.java index cc91875..d50ac3b 100644 --- a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/activity/HDLLinphoneMonitorActivity.java +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/activity/HDLLinphoneMonitorActivity.java @@ -195,9 +195,7 @@ // showToast("寮�閿乷nFinish"); iv_lp_unlock.setEnabled(true); } - }; -// } @Override diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/core/callback/PhoneCallback.java b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/core/callback/PhoneCallback.java index 62fe585..a82c239 100644 --- a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/core/callback/PhoneCallback.java +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/core/callback/PhoneCallback.java @@ -36,5 +36,5 @@ /** * 杩炴帴澶辫触 */ - public void error() {} + public void error(String error) {} } diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/core/service/HDLLinphoneService.java b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/core/service/HDLLinphoneService.java index e84e103..936ed14 100644 --- a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/core/service/HDLLinphoneService.java +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/core/service/HDLLinphoneService.java @@ -18,6 +18,8 @@ import com.hdl.hdllinphonesdk.R; +import com.hdl.hdllinphonesdk.activity.HDLLinphoneIntercomActivity; +import com.hdl.hdllinphonesdk.activity.HDLLinphoneReverseCallActivity; import com.hdl.hdllinphonesdk.core.callback.PhoneCallback; import com.hdl.hdllinphonesdk.core.callback.RegistrationCallback; import com.hdl.hdllinphonesdk.core.linphone.KeepAliveHandler; @@ -76,12 +78,11 @@ } public static Core getCore() { - if(sInstance == null){ + if (sInstance == null) { return null; } return sInstance.mCore; } - @Override public IBinder onBind(Intent intent) { @@ -90,11 +91,13 @@ /** * 娣诲姞閫氳瘽鐘舵�佸洖璋� + * * @param phoneCallback */ public static void addPhoneCallback(PhoneCallback phoneCallback) { sPhoneCallback = phoneCallback; } + public static void removePhoneCallback() { if (sPhoneCallback != null) { sPhoneCallback = null; @@ -103,11 +106,13 @@ /** * 娣诲姞娉ㄥ唽鐘舵�佸洖璋� + * * @param registrationCallback */ public static void addRegistrationCallback(RegistrationCallback registrationCallback) { sRegistrationCallback = registrationCallback; } + public static void removeRegistrationCallback() { if (sRegistrationCallback != null) { sRegistrationCallback = null; @@ -154,15 +159,11 @@ new TimerTask() { @Override public void run() { - mHandler.post( - new Runnable() { - @Override - public void run() { - if (mCore != null) { - mCore.iterate(); - } - } - }); + mHandler.post(() -> { + if (mCore != null) { + mCore.iterate(); + } + }); } }; mTimer = new Timer("Linphone scheduler"); @@ -176,11 +177,11 @@ removeAllCallback(); logout(); - if(mTimer != null) { + if (mTimer != null) { mTimer.cancel(); } - if(mCore != null){ + if (mCore != null) { mCore.removeListener(mCoreListener); mCore.stop(); // A stopped Core can be started again @@ -222,8 +223,8 @@ initCoreListener(); copyAssetsFromPackage(basePath); // Create the Core and add our listener - mCore = Factory.instance() - .createCore(basePath + "/.linphonerc", basePath + "/linphonerc", this); + mCore = Factory.instance().createCore(basePath + "/.linphonerc", + basePath + "/linphonerc", this); mCore.addListener(mCoreListener); // Core is ready to be configured configureCore(); @@ -237,6 +238,7 @@ @Override public void onCallStateChanged(Core core, Call linphoneCall, Call.State state, String message) { HDLLog.e(START_LINPHONE_LOGS, "callState: " + state.toString()); + HDLLog.e(START_LINPHONE_LOGS, "state.toInt()=" + state.toInt() + "==============message=========: " + message); currentCallState = state; if (sPhoneCallback != null) { if (state == Call.State.IncomingReceived) { @@ -246,7 +248,7 @@ } else if (state == Call.State.Connected) { sPhoneCallback.callConnected(); } else if (state == Call.State.Error) { - sPhoneCallback.error(); + sPhoneCallback.error(message); } else if (state == Call.State.End) { sPhoneCallback.callEnd(); } else if (state == Call.State.Released) { @@ -261,11 +263,11 @@ HDLLog.i(START_LINPHONE_LOGS, "registrationState: " + state); if (state.equals(RegistrationState.None.toString())) { - if (sRegistrationCallback != null){ + if (sRegistrationCallback != null) { sRegistrationCallback.registrationNone(); } } else if (state.equals(RegistrationState.Progress.toString())) { - if (sRegistrationCallback != null){ + if (sRegistrationCallback != null) { sRegistrationCallback.registrationProgress(); } } else if (state.equals(RegistrationState.Ok.toString())) { @@ -288,6 +290,7 @@ /** * 鏀跺埌娉ㄩ攢鎴愬姛鍚庣Щ闄ゅ綋鍓嶄唬鐞� + * * @param core * @param proxyConfig */ @@ -318,7 +321,8 @@ } //1.璁剧疆瀛樺偍鐢ㄦ埛x509璇佷功鐨勭洰褰曠殑璺緞 - mCore.setUserCertificatesPath(userCerts); + //mCore.setUserCertificatesPath(userCerts); + mCore.setUserCertificatesPath(basePath); //2.璁剧疆UserAgent setUserAgent(); //3.璁剧疆鎾斁閾冨0 @@ -353,6 +357,9 @@ mCore.setVideoActivationPolicy(vap); //11.璁剧疆缂栫爜鏍煎紡 setCodecMime(); + + // 鍏ㄨ閫歴ip璁剧疆ca璇佷功 + //mCore.setRootCa(basePath + "/rootca.pem"); } /** @@ -381,6 +388,7 @@ /** * 璁剧疆鏄惁鍚敤閾冨0锛岀洰鍓嶅彂鐜拌缃棤鏁堝緟鍒嗘瀽鍘熷洜 + * * @param use */ public void enableDeviceRingtone(boolean use) { @@ -460,6 +468,9 @@ // mPauseSoundFile = basePath + "/toy_mono.wav"; // copyIfNotExist(R.raw.toy_mono, basePath + "/toy_mono.wav"); +// String mRootca = basePath + "/rootca.pem"; // 2022-05-23 瀵规帴鍏ㄨ閫氬彲瑙嗗璁叉坊鍔犵殑璇佷功 +// copyIfNotExist(R.raw.freeview_rootca, mRootca); + String mLPConfigXsd = basePath + "/lpconfig.xsd"; copyIfNotExist(R.raw.lpconfig, mLPConfigXsd); @@ -471,6 +482,7 @@ /** * copyIfNotExist + * * @param ressourceId * @param target * @throws IOException @@ -484,6 +496,7 @@ /** * copyFromPackage + * * @param ressourceId * @param target * @throws IOException @@ -533,12 +546,14 @@ //閫氱煡ID public static final int NOTIFICATION_ID = 2; + /** * 瑙e喅android8.0浠ヤ笂鏃犳硶鍚姩鏈嶅姟鐨勯棶棰� */ void hdlStartForeground() { } + /** * stopForeground */ diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/dialog/LpTimeDialog.java b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/dialog/LpTimeDialog.java new file mode 100644 index 0000000..d0dd0ee --- /dev/null +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/dialog/LpTimeDialog.java @@ -0,0 +1,222 @@ +package com.hdl.hdllinphonesdk.dialog; + +import android.app.Activity; +import android.app.Dialog; +import android.content.Context; +import android.content.res.Resources; +import android.graphics.Point; +import android.graphics.drawable.ColorDrawable; +import android.os.Build; +import android.os.Bundle; +import android.util.DisplayMetrics; +import android.view.Display; +import android.view.Gravity; +import android.view.View; +import android.view.WindowManager; +import android.widget.DatePicker; +import android.widget.EditText; +import android.widget.LinearLayout; +import android.widget.NumberPicker; +import android.widget.TextView; +import android.widget.TimePicker; + +import com.hdl.hdllinphonesdk.R; + +import java.lang.reflect.Field; + +public class LpTimeDialog extends Dialog { + + private Context mContext; + private DatePicker datePicker; + private TimePicker timePicker; + private TextView cancelBtn, confirmBtn; + private ClickListenerInterface mClickListener; + + public LpTimeDialog(Context context, ClickListenerInterface listener) { + super(context, R.style.video_dialog); + this.mContext = context; + this.mClickListener = listener; + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.dialog_lpsdk_time_select); + initView(); + initData(); + Display display = ((Activity) mContext).getWindowManager().getDefaultDisplay(); + WindowManager.LayoutParams p = getWindow().getAttributes(); + Point point = new Point(); + display.getSize(point); + p.width = point.x; + getWindow().setGravity(Gravity.BOTTOM); + } + + /** + * initView + */ + private void initView() { + datePicker = findViewById(R.id.lp_dialog_data_picker); + timePicker = findViewById(R.id.lp_dialog_time_picker); + cancelBtn = findViewById(R.id.lp_dialog_cancel_tv); + cancelBtn.setOnClickListener(view -> { + if (mClickListener != null) + mClickListener.onCancelClick(this); + }); + confirmBtn = findViewById(R.id.lp_dialog_confirm_tv); + confirmBtn.setOnClickListener(view -> { + String time = datePicker.getYear() + "-" + getMonth(datePicker) + "-" + getDay(datePicker) + + " " + getHour(timePicker) + ":" + getMinute(timePicker); + + if (mClickListener != null) + mClickListener.onConfirmClick(this, time); + }); + } + + // 鑾峰彇鏈堜唤 + private String getMonth(DatePicker _datePicker) { + String moth_str = ""; + int month_int = _datePicker.getMonth() + 1; + if (month_int < 10) + moth_str = "0" + month_int; + else + moth_str = month_int + ""; + return moth_str; + } + + // 鑾峰彇鏃� + private String getDay(DatePicker _datePicker) { + String day_str = ""; + int day_int = _datePicker.getDayOfMonth(); + if (day_int < 10) + day_str = "0" + day_int; + else + day_str = day_int + ""; + return day_str; + } + + // 鑾峰彇灏忔椂 + private String getHour(TimePicker _timePicker) { + String hour_str = ""; + int hour_int = _timePicker.getHour(); + if (hour_int < 10) + hour_str = "0" + hour_int; + else + hour_str = hour_int + ""; + return hour_str; + } + + // 鑾峰彇鍒嗛挓 + private String getMinute(TimePicker _timePicker) { + String minute_str = ""; + int minute_int = _timePicker.getMinute(); + if (minute_int < 10) + minute_str = "0" + minute_int; + else + minute_str = minute_int + ""; + return minute_str; + } + + /** + * initData + */ + private void initData() { + timePicker.setIs24HourView(true); + timePicker.setDescendantFocusability(TimePicker.FOCUS_BLOCK_DESCENDANTS); + + // setDataPickerDividerColor(datePicker); + //setTimePickerDividerColor(timePicker); + } + + private void setDataPickerDividerColor(DatePicker timePicker) { + LinearLayout llFirst = (LinearLayout) timePicker.getChildAt(0); + LinearLayout mSpinners = (LinearLayout) llFirst.getChildAt(1); + for (int i = 0; i < mSpinners.getChildCount(); i++) { + if (mSpinners.getChildAt(i) instanceof NumberPicker) { + Field[] pickerFields = NumberPicker.class.getDeclaredFields(); + setPickerMargin((NumberPicker) mSpinners.getChildAt(i)); + for (Field pf : pickerFields) { + if (pf.getName().equals("mSelectionDivider")) { + pf.setAccessible(true); + try { + pf.set(mSpinners.getChildAt(i), new ColorDrawable()); + } catch (IllegalArgumentException e) { + e.printStackTrace(); + } catch (Resources.NotFoundException e) { + e.printStackTrace(); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + break; + } + } + } + } + } + + private void setTimePickerDividerColor(TimePicker timePicker) { + LinearLayout llFirst = (LinearLayout) timePicker.getChildAt(0); + LinearLayout mSpinners = (LinearLayout) llFirst.getChildAt(1); + for (int i = 0; i < mSpinners.getChildCount(); i++) { + if (mSpinners.getChildAt(i) instanceof NumberPicker) { + Field[] pickerFields = NumberPicker.class.getDeclaredFields(); + setPickerMargin((NumberPicker) mSpinners.getChildAt(i)); + for (Field pf : pickerFields) { + if (pf.getName().equals("mSelectionDivider")) { + pf.setAccessible(true); + try { + pf.set(mSpinners.getChildAt(i), new ColorDrawable()); + } catch (IllegalArgumentException e) { + e.printStackTrace(); + } catch (Resources.NotFoundException e) { + e.printStackTrace(); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + break; + } + } + } + } + } + + /** + * 璁剧疆picker涔嬮棿鐨勯棿璺� + */ + private void setPickerMargin(NumberPicker picker) { + LinearLayout.LayoutParams p = (LinearLayout.LayoutParams) picker.getLayoutParams(); + p.setMargins(-getDensityValue(16, mContext), 0, -getDensityValue(16, mContext), 0); + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR1) { + p.setMarginStart(-getDensityValue(16, mContext)); + p.setMarginEnd(-getDensityValue(16, mContext)); + } + setEditTextSize(picker); + } + + /** + * 璁剧疆picker瀛椾綋澶у皬 + */ + private void setEditTextSize(NumberPicker np) { + if (null != np) { + for (int i = 0; i < np.getChildCount(); i++) { + View child = np.getChildAt(i); + if (child instanceof EditText) { + EditText editText = (EditText) child; + editText.setTextSize(18); + } + } + } + } + + public interface ClickListenerInterface { + void onCancelClick(LpTimeDialog dialog); + + void onConfirmClick(LpTimeDialog dialog, String startTime); + } + + public static int getDensityValue(float value, Context activity) { + DisplayMetrics displayMetrics = activity.getResources().getDisplayMetrics(); + return (int) Math.ceil(value * displayMetrics.density); + } + +} diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/dialog/LpTipDialog.java b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/dialog/LpTipDialog.java new file mode 100644 index 0000000..ce77f5c --- /dev/null +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/dialog/LpTipDialog.java @@ -0,0 +1,101 @@ +package com.hdl.hdllinphonesdk.dialog; + +import android.app.Activity; +import android.app.Dialog; +import android.content.Context; +import android.graphics.Point; +import android.os.Bundle; +import android.view.Display; +import android.view.Gravity; +import android.view.WindowManager; +import android.widget.TextView; + +import com.hdl.hdllinphonesdk.R; + +public class LpTipDialog extends Dialog { + + private Context mContext; + private ClickListenerInterface mClickListener; + private String mTitleStr = getContext().getResources().getString(R.string.lp_tipStr); + private String mMessageStr = ""; + + private TextView contentTv; + private TextView titleTv; + private TextView cancelTv; + private TextView confirmTv; + + public LpTipDialog(Context context) { + super(context, R.style.video_dialog); + mContext = context; + } + + public LpTipDialog(Context context, String title, String content) { + super(context, R.style.video_dialog); + mContext = context; + this.mTitleStr = title; + this.mMessageStr = content; + } + + public LpTipDialog(Context context, String title, String content, ClickListenerInterface listener) { + super(context, R.style.video_dialog); + mContext = context; + this.mTitleStr = title; + this.mMessageStr = content; + setClickListener(listener); + } + + public void setClickListener(ClickListenerInterface clickListenerInterfacel) { + this.mClickListener = clickListenerInterfacel; + } + + public interface ClickListenerInterface { + + void SureClick(LpTipDialog dialog); + + void CancelClick(LpTipDialog dialog); + } + + public void setTitle(String title) { + this.mTitleStr = title; + } + + public void setMessage(String message) { + this.mMessageStr = message; + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + setContentView(R.layout.dialog_lpsdk_tip); + contentTv = findViewById(R.id.lpsdk_dialog_content_tv); + contentTv.setText(mMessageStr); + titleTv = findViewById(R.id.lpsdk_dialog_title_tv); + titleTv.setText(mTitleStr); + cancelTv = findViewById(R.id.lpsdk_dialog_cancel_tv); + cancelTv.setOnClickListener(view -> { + if (mClickListener != null) + mClickListener.CancelClick(LpTipDialog.this); + }); + confirmTv = findViewById(R.id.lpsdk_dialog_confirm_tv); + confirmTv.setOnClickListener(view -> { + if (mClickListener != null) + mClickListener.SureClick(LpTipDialog.this); + }); + } + + @Override + public void onWindowFocusChanged(boolean hasFocus) { + super.onWindowFocusChanged(hasFocus); + + try { + Display display = ((Activity) mContext).getWindowManager().getDefaultDisplay(); + WindowManager.LayoutParams p = getWindow().getAttributes(); + Point point = new Point(); + display.getSize(point); + p.width = (int) (point.x * 0.8); + getWindow().setGravity(Gravity.CENTER); + } catch (Exception e) { + } + } +} diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/interfaces/AddressType.java b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/interfaces/AddressType.java new file mode 100644 index 0000000..d03b91a --- /dev/null +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/interfaces/AddressType.java @@ -0,0 +1,11 @@ +package com.hdl.hdllinphonesdk.interfaces; + +public interface AddressType { + void setText(CharSequence var1); + + CharSequence getText(); + + void setDisplayedName(String var1); + + String getDisplayedName(); +} diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/utils/HDLImageUtils.java b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/utils/HDLImageUtils.java index 4896f19..c8961c7 100644 --- a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/utils/HDLImageUtils.java +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/utils/HDLImageUtils.java @@ -5,6 +5,7 @@ import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; +import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.media.MediaScannerConnection; import android.net.Uri; @@ -18,12 +19,15 @@ import com.hdl.hdllinphonesdk.R; import java.io.BufferedOutputStream; +import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; +import java.io.InputStream; import java.io.OutputStream; +import java.lang.ref.SoftReference; /** * Created by jlchen on 2021/8/16. @@ -101,6 +105,38 @@ } + /** + * 淇濆瓨鍥剧墖鑷崇浉鍐� + * 闇�瑕佽鍐欐潈闄� + */ + public static boolean saveImageToGallery(Context context, byte[] image_bytes) { + Bitmap bitmap = byteToBitmap(image_bytes); + return saveImageToGallery(context, bitmap); + } + + public static Bitmap byteToBitmap(byte[] imgByte) { + InputStream input = null; + Bitmap bitmap = null; + BitmapFactory.Options options = new BitmapFactory.Options(); + options.inSampleSize = 1; + input = new ByteArrayInputStream(imgByte); + SoftReference softRef = new SoftReference(BitmapFactory.decodeStream(input, null, options)); //杞紩鐢ㄩ槻姝OM + bitmap = (Bitmap) softRef.get(); + if (imgByte != null) { + imgByte = null; + } + + try { + if (input != null) { + input.close(); + } + } catch (IOException e) { + // 寮傚父鎹曡幏 + e.printStackTrace(); + } + return bitmap; + } + /** * 灏嗘枃浠朵繚瀛樺埌鍏叡鐨勫獟浣撴枃浠跺す diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/lp_dialog_background.xml b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/lp_dialog_background.xml new file mode 100644 index 0000000..4863622 --- /dev/null +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/lp_dialog_background.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> + <item> + <shape> + <corners android:radius="15dp" /> + <solid android:color="@color/lpsdk_color_white" /> + </shape> + </item> +</layer-list> \ No newline at end of file diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/lp_dialog_cancel_background.xml b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/lp_dialog_cancel_background.xml new file mode 100644 index 0000000..dc2fc33 --- /dev/null +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/lp_dialog_cancel_background.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> + <item> + <shape android:shape="rectangle"> + <corners android:bottomLeftRadius="15dp" /> + <solid android:color="@color/lpsdk_color_white" /> + <stroke + android:width="1px" + android:color="#2108141F" /> + <padding + android:bottom="2dp" + android:left="2dp" + android:right="2dp" /> + + </shape> + </item> +</layer-list> \ No newline at end of file diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/lp_dialog_confirm_background.xml b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/lp_dialog_confirm_background.xml new file mode 100644 index 0000000..c348462 --- /dev/null +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/lp_dialog_confirm_background.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> + <item> + <shape> + <corners android:bottomRightRadius="15dp"/> + <solid android:color="#4484F4" /> + </shape> + </item> +</layer-list> \ No newline at end of file diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/layout/activity_hdllinphone_intercom.xml b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/layout/activity_hdllinphone_intercom.xml index 8866342..11caacd 100644 --- a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/layout/activity_hdllinphone_intercom.xml +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/layout/activity_hdllinphone_intercom.xml @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<LinearLayout - xmlns:android="http://schemas.android.com/apk/res/android" +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/white" @@ -9,21 +8,20 @@ <RelativeLayout android:id="@+id/rl_lp_topView" android:layout_width="match_parent" - android:background="@color/lpsdk_app_bg" - android:layout_height="44dp"> + android:layout_height="44dp" + android:background="@color/lpsdk_app_bg"> <TextView android:id="@+id/tv_lp_title" android:layout_width="match_parent" android:layout_height="25dp" - android:layout_marginTop="10dp" android:layout_marginLeft="50dp" + android:layout_marginTop="10dp" android:layout_marginRight="50dp" android:gravity="center" - android:textColor="@color/lpsdk_textColor" - android:textSize="18sp" android:text="瀹ゅ唴鏈�" - ></TextView> + android:textColor="@color/lpsdk_textColor" + android:textSize="18sp"></TextView> </RelativeLayout> @@ -36,12 +34,12 @@ android:layout_width="wrap_content" android:layout_height="210dp" android:background="@android:color/black"> + <TextureView android:id="@+id/video_lp_rendering" android:layout_width="match_parent" - android:layout_height="match_parent"/> + android:layout_height="match_parent" /> </LinearLayout> - <LinearLayout @@ -51,16 +49,17 @@ <RelativeLayout android:layout_width="0dp" - android:layout_weight="1" - android:layout_height="match_parent"> + android:layout_height="match_parent" + android:layout_weight="1"> + <ImageView android:id="@+id/iv_lp_screenshot" android:layout_width="40dp" android:layout_height="40dp" android:layout_centerHorizontal="true" android:layout_centerVertical="true" - android:scaleType="fitCenter" - android:background="@drawable/btn_click_lp_screenshot"> + android:background="@drawable/btn_click_lp_screenshot" + android:scaleType="fitCenter"> </ImageView> @@ -68,25 +67,24 @@ <RelativeLayout android:layout_width="0dp" - android:layout_weight="1" - android:layout_height="match_parent"> + android:layout_height="match_parent" + android:layout_weight="1"> + <ImageView android:id="@+id/iv_lp_unlock" android:layout_width="40dp" android:layout_height="40dp" android:layout_centerHorizontal="true" android:layout_centerVertical="true" - android:scaleType="fitCenter" - android:background="@drawable/btn_click_lp_unlock"> - </ImageView> + android:background="@drawable/btn_click_lp_unlock" + android:scaleType="fitCenter" /> </RelativeLayout> </LinearLayout> <View android:layout_width="match_parent" android:layout_height="1dp" - android:background="@color/lpsdk_app_line" - ></View> + android:background="@color/lpsdk_app_line" /> <RelativeLayout android:layout_width="match_parent" @@ -95,57 +93,39 @@ <TextureView android:id="@+id/video_lp_rendering2" android:layout_width="1dp" - android:layout_height="1dp"/> + android:layout_height="1dp" /> -<!-- <TextView--> -<!-- android:id="@+id/tv_lp_calltime"--> -<!-- android:layout_width="wrap_content"--> -<!-- android:layout_centerHorizontal="true"--> -<!-- android:text="00:00"--> -<!-- android:textColor="@android:color/white"--> -<!-- android:textSize="14sp"--> -<!-- android:gravity="center_vertical"--> -<!-- android:paddingLeft="38dp"--> -<!-- android:paddingRight="38dp"--> -<!-- android:layout_marginTop="38dp"--> -<!-- android:background="@drawable/lp_calltime_shape"--> -<!-- android:visibility="gone"--> -<!-- android:layout_height="40dp">--> - -<!-- </TextView>--> <Chronometer android:id="@+id/timer_lp_calltime" android:layout_width="wrap_content" + android:layout_height="40dp" android:layout_centerHorizontal="true" + android:layout_marginTop="38dp" + android:background="@drawable/lp_calltime_shape" android:format="%s" - android:textColor="@android:color/white" - android:textSize="14sp" android:gravity="center_vertical" android:paddingLeft="38dp" android:paddingRight="38dp" - android:layout_marginTop="38dp" - android:background="@drawable/lp_calltime_shape" - android:visibility="gone" - android:layout_height="40dp"> + android:textColor="@android:color/white" + android:textSize="14sp" + android:visibility="gone"> </Chronometer> <TextView android:id="@+id/tv_lp_calltime" android:layout_width="wrap_content" + android:layout_height="40dp" android:layout_centerHorizontal="true" - android:textColor="@android:color/white" - android:textSize="14sp" + android:layout_marginTop="38dp" + android:background="@drawable/lp_calltime_shape_gray" android:gravity="center_vertical" android:paddingLeft="38dp" android:paddingRight="38dp" android:text="@string/lp_callingStr" - android:layout_marginTop="38dp" - android:background="@drawable/lp_calltime_shape_gray" - android:visibility="visible" - android:layout_height="40dp"> - </TextView> - + android:textColor="@android:color/white" + android:textSize="14sp" + android:visibility="visible" /> <LinearLayout android:layout_width="match_parent" @@ -155,54 +135,53 @@ <RelativeLayout android:layout_width="0dp" - android:layout_weight="1" - android:layout_height="match_parent"> + android:layout_height="match_parent" + android:layout_weight="1"> + <ImageView android:id="@+id/iv_lp_hangUp" android:layout_width="66dp" android:layout_height="66dp" - android:scaleType="fitCenter" - android:src="@drawable/ic_esvideo_on_hangup" android:layout_centerHorizontal="true" - ></ImageView> + android:scaleType="fitCenter" + android:src="@drawable/ic_esvideo_on_hangup" /> + <TextView android:id="@+id/tv_lp_hangUp" android:layout_width="match_parent" android:layout_height="20dp" - android:text="@string/lp_refuseStr" - android:gravity="center" - android:textColor="@color/lpsdk_textColor" - android:textSize="14sp" android:layout_alignParentBottom="true" - ></TextView> - + android:gravity="center" + android:text="@string/lp_refuseStr" + android:textColor="@color/lpsdk_textColor" + android:textSize="14sp" /> + </RelativeLayout> <RelativeLayout android:id="@+id/rl_lp_answerView" android:layout_width="0dp" - android:layout_weight="1" - android:layout_height="match_parent"> + android:layout_height="match_parent" + android:layout_weight="1"> + <ImageView android:id="@+id/iv_lp_answer" android:layout_width="66dp" android:layout_height="66dp" - android:scaleType="fitCenter" - android:src="@drawable/ic_esvideo_on_answer" android:layout_centerHorizontal="true" - ></ImageView> + android:scaleType="fitCenter" + android:src="@drawable/ic_esvideo_on_answer" /> + <TextView android:id="@+id/tv_lp_answer" android:layout_width="match_parent" android:layout_height="20dp" - android:text="@string/lp_answerStr" - android:gravity="center" - android:textColor="@color/lpsdk_textColor" - android:textSize="14sp" android:layout_alignParentBottom="true" - ></TextView> + android:gravity="center" + android:text="@string/lp_answerStr" + android:textColor="@color/lpsdk_textColor" + android:textSize="14sp" /> </RelativeLayout> - </LinearLayout> </RelativeLayout> diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/layout/dialog_lpsdk_time_select.xml b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/layout/dialog_lpsdk_time_select.xml new file mode 100644 index 0000000..63bd18f --- /dev/null +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/layout/dialog_lpsdk_time_select.xml @@ -0,0 +1,58 @@ +<?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="wrap_content" + android:background="#FFFFFF" + android:orientation="vertical"> + + <RelativeLayout + android:layout_width="match_parent" + android:layout_height="44dp" + android:background="#21C0C7D4"> + + <TextView + android:id="@+id/lp_dialog_cancel_tv" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_centerVertical="true" + android:layout_marginStart="10dp" + android:text="@string/lp_cancel" + android:textColor="@color/lpsdk_textColor" + android:textSize="14sp" /> + + <TextView + android:id="@+id/lp_dialog_confirm_tv" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentEnd="true" + android:layout_centerVertical="true" + android:layout_marginEnd="10dp" + android:text="@string/lp_confirm" + android:textColor="#4484F4" + android:textSize="14sp" /> + + </RelativeLayout> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal"> + + <DatePicker + android:id="@+id/lp_dialog_data_picker" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:datePickerMode="spinner" + android:calendarViewShown="false" + android:theme="@style/time_picker_style" /> + + <TimePicker + android:id="@+id/lp_dialog_time_picker" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="0.75" + android:theme="@style/time_picker_style" + android:timePickerMode="spinner" /> + </LinearLayout> +</LinearLayout> \ No newline at end of file diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/layout/dialog_lpsdk_tip.xml b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/layout/dialog_lpsdk_tip.xml new file mode 100644 index 0000000..d68cf16 --- /dev/null +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/layout/dialog_lpsdk_tip.xml @@ -0,0 +1,56 @@ +<?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="wrap_content" + android:background="@drawable/lp_dialog_background" + android:orientation="vertical"> + + <TextView + android:id="@+id/lpsdk_dialog_title_tv" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="20dp" + android:gravity="center" + android:text="鎻愮ず" + android:textColor="#4484F4" + android:textSize="16sp" /> + + <TextView + android:id="@+id/lpsdk_dialog_content_tv" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_margin="20dp" + android:gravity="center" + android:text="鍐呭" + android:textColor="@color/lpsdk_textColor" + android:textSize="12sp" /> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="44dp" + android:layout_marginTop="10dp" + android:orientation="horizontal"> + + <TextView + android:id="@+id/lpsdk_dialog_cancel_tv" + android:layout_width="0dp" + android:layout_height="match_parent" + android:text="@string/lp_cancel" + android:gravity="center" + android:textSize="16sp" + android:background="@drawable/lp_dialog_cancel_background" + android:textColor="@color/lpsdk_textColor" + android:layout_weight="1" /> + + <TextView + android:id="@+id/lpsdk_dialog_confirm_tv" + android:layout_width="0dp" + android:layout_height="match_parent" + android:gravity="center" + android:textColor="@color/lpsdk_color_white" + android:text="@string/lp_confirm" + android:background="@drawable/lp_dialog_confirm_background" + android:layout_weight="1" /> + </LinearLayout> + +</LinearLayout> \ No newline at end of file diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/raw/rootca.pem b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/raw/hdl_rootca.pem similarity index 100% rename from HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/raw/rootca.pem rename to HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/raw/hdl_rootca.pem diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/raw/lpconfig.xsd b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/raw/lpconfig.xsd index 49bb561..de6a78a 100644 --- a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/raw/lpconfig.xsd +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/raw/lpconfig.xsd @@ -1,45 +1,60 @@ <?xml version="1.0" encoding="UTF-8"?> -<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" - targetNamespace="http://www.linphone.org/xsds/lpconfig.xsd" - xmlns:tns="http://www.linphone.org/xsds/lpconfig.xsd" - elementFormDefault="qualified"> +<xs:schema xmlns:tns="http://www.linphone.org/xsds/lpconfig.xsd" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + elementFormDefault="qualified" + targetNamespace="http://www.linphone.org/xsds/lpconfig.xsd"> - <xs:element name="config" type="tns:LPConfig"></xs:element> + <xs:element + name="config" + type="tns:LPConfig"></xs:element> <xs:complexType name="LPConfig"> - <xs:sequence> - <xs:element name="section" type="tns:LPSection" minOccurs="0" maxOccurs="unbounded"></xs:element> - </xs:sequence> + <xs:sequence> + <xs:element + name="section" + maxOccurs="unbounded" + minOccurs="0" + type="tns:LPSection"></xs:element> + </xs:sequence> </xs:complexType> - + <xs:complexType name="LPSection"> - <xs:sequence> - <xs:element name="entry" type="tns:LPEntry" maxOccurs="unbounded" minOccurs="0"> - </xs:element> - </xs:sequence> - <xs:attribute name="name" use="required"> - <xs:simpleType> - <xs:restriction base="xs:string"> - <xs:minLength value="1"></xs:minLength> - </xs:restriction> - </xs:simpleType> - </xs:attribute> + <xs:sequence> + <xs:element + name="entry" + maxOccurs="unbounded" + minOccurs="0" + type="tns:LPEntry"></xs:element> + </xs:sequence> + <xs:attribute + name="name" + use="required"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:minLength value="1"></xs:minLength> + </xs:restriction> + </xs:simpleType> + </xs:attribute> </xs:complexType> <xs:complexType name="LPEntry"> - <xs:simpleContent> - <xs:extension base="xs:string"> - <xs:attribute name="overwrite" type="xs:boolean" - use="optional" default="false"> - </xs:attribute> - <xs:attribute name="name" use="required"> - <xs:simpleType> - <xs:restriction base="xs:string"> - <xs:minLength value="1"></xs:minLength> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - </xs:extension> - </xs:simpleContent> + <xs:simpleContent> + <xs:extension base="xs:string"> + <xs:attribute + name="overwrite" + default="false" + type="xs:boolean" + use="optional"></xs:attribute> + <xs:attribute + name="name" + use="required"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:minLength value="1"></xs:minLength> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + </xs:extension> + </xs:simpleContent> </xs:complexType> </xs:schema> diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/values-zh/strings.xml b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/values-zh/strings.xml index 97858f6..24b3220 100644 --- a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/values-zh/strings.xml +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/values-zh/strings.xml @@ -17,4 +17,8 @@ <string name="lp_unlockStr">寮�閿�</string> <string name="lp_outdoorUnitStr">瀹ゅ鏈�</string> <string name="lp_sipAccount_null">鎺ュ惉澶辫触锛岃澶囦笉瀛樺湪</string> + + <!--璁垮璁板綍--> + <string name="lp_cancel">鍙栨秷</string> + <string name="lp_confirm">纭</string> </resources> \ No newline at end of file diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/values/colors.xml b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/values/colors.xml index 3a4d1bd..8f0c108 100644 --- a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/values/colors.xml +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/values/colors.xml @@ -4,5 +4,6 @@ <color name="lpsdk_app_bg">#ECEDEE</color> <color name="lpsdk_app_line">#6D798D</color> <color name="lpsdk_textColor">#1B2D4D</color> + <color name="lpsdk_color_white">#FFFFFF</color> </resources> \ No newline at end of file diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/values/strings.xml b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/values/strings.xml index a39640a..f59532b 100644 --- a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/values/strings.xml +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/values/strings.xml @@ -16,4 +16,7 @@ <string name="lp_unlockStr">Unlock</string> <string name="lp_outdoorUnitStr">Outdoor unit</string> <string name="lp_sipAccount_null">Failed to answer the call. The device does not exist.</string> + <!--璁垮璁板綍--> + <string name="lp_cancel">Cancel</string> + <string name="lp_confirm">Confirm</string> </resources> diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/values/styles.xml b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/values/styles.xml index 6c0b8a3..b6fc73c 100644 --- a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/values/styles.xml +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/values/styles.xml @@ -1,5 +1,23 @@ <?xml version="1.0" encoding="utf-8"?> <resources> + <style name="video_dialog" parent="@android:style/Theme.Dialog"> + + <!-- 鑳屾櫙棰滆壊鍙婂拰閫忔槑绋嬪害 --> + <item name="android:windowBackground">@android:color/transparent</item> + <!-- 鏄惁鍘婚櫎鏍囬 --> + <item name="android:windowNoTitle">true</item> + <!-- 鏄惁鍘婚櫎杈规 --> + <item name="android:windowFrame">@null</item> + <!-- 鏄惁娴幇鍦╝ctivity涔嬩笂 --> + <item name="android:windowIsFloating">true</item> + <!-- 鏄惁妯$硦 --> + <item name="android:backgroundDimEnabled">true</item> + </style> + + <style name="time_picker_style" parent="Theme.AppCompat"> + <item name="android:textSize">14sp</item> + <item name="android:textColorPrimary">@color/lpsdk_textColor</item> + </style> </resources> diff --git a/HDLLinphoneSDKDemoNew/app/build.gradle b/HDLLinphoneSDKDemoNew/app/build.gradle index 857b5cd..0724b38 100644 --- a/HDLLinphoneSDKDemoNew/app/build.gradle +++ b/HDLLinphoneSDKDemoNew/app/build.gradle @@ -4,7 +4,6 @@ android { compileSdkVersion 28 - buildToolsVersion "28.0.0" defaultConfig { applicationId "com.example.hdllinphonesdkdemo" @@ -26,12 +25,18 @@ sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } + repositories { + flatDir { + dirs 'libs' + } + } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar']) implementation 'com.android.support:appcompat-v7:28.0.0' implementation 'com.android.support.constraint:constraint-layout:2.0.4' + implementation project(path: ':HDLLinphoneSDK') // implementation project(path: ':HDLLinphoneSDK') testImplementation 'junit:junit:4.+' androidTestImplementation 'com.android.support.test:runner:1.0.2' diff --git a/HDLLinphoneSDKDemoNew/app/libs/HDLLinphoneSDK-V1.0.1.aar b/HDLLinphoneSDKDemoNew/app/libs/HDLLinphoneSDK-V1.0.1.aar deleted file mode 100644 index f02e75e..0000000 --- a/HDLLinphoneSDKDemoNew/app/libs/HDLLinphoneSDK-V1.0.1.aar +++ /dev/null Binary files differ diff --git a/HDLLinphoneSDKDemoNew/app/src/main/java/com/example/hdllinphonesdkdemo/MainActivity.java b/HDLLinphoneSDKDemoNew/app/src/main/java/com/example/hdllinphonesdkdemo/MainActivity.java index 5388edf..0225760 100644 --- a/HDLLinphoneSDKDemoNew/app/src/main/java/com/example/hdllinphonesdkdemo/MainActivity.java +++ b/HDLLinphoneSDKDemoNew/app/src/main/java/com/example/hdllinphonesdkdemo/MainActivity.java @@ -4,111 +4,67 @@ import android.content.Intent; import android.graphics.Bitmap; import android.os.Bundle; -import android.view.View; import android.widget.TextView; import android.widget.Toast; import com.hdl.hdllinphonesdk.HDLLinphoneKit; -import com.hdl.hdllinphonesdk.activity.HDLLinphoneIntercomActivity; import com.hdl.hdllinphonesdk.activity.HDLLinphoneMonitorActivity; -import com.hdl.hdllinphonesdk.activity.HDLLinphoneReverseCallActivity; import com.hdl.hdllinphonesdk.callback.OnHDLLinphoneCallListener; -import com.hdl.hdllinphonesdk.core.service.HDLLinphoneService; -import com.hdl.hdllinphonesdk.utils.HDLLog; - -import org.linphone.core.Core; -import org.linphone.core.ProxyConfig; +import com.hdl.hdllinphonesdk.dialog.LpTipDialog; +//import com.hdl.hdllinphonesdk.core.service.HDLLinphoneService; +//import com.hdl.hdllinphonesdk.utils.HDLLog; +// +//import org.linphone.core.Core; +//import org.linphone.core.ProxyConfig; public class MainActivity extends Activity { private static final String TAG = "MainActivity"; - private TextView mTextView,mTextView2,mTextView3,mTextView4; + private TextView mTextView, mMonitorText, mTextView3, mTextView4; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); + findViewById(R.id.mDialog).setOnClickListener(view -> { + new LpTipDialog(MainActivity.this, "sss", "ddd", new LpTipDialog.ClickListenerInterface() { + @Override + public void SureClick(LpTipDialog lpTipDialog) { + lpTipDialog.dismiss(); + } + + @Override + public void CancelClick(LpTipDialog lpTipDialog) { + lpTipDialog.dismiss(); + } + }).show(); + }); mTextView = findViewById(R.id.tv_hello); - mTextView2 = findViewById(R.id.mTextView2); + mMonitorText = findViewById(R.id.mTextView2); mTextView3 = findViewById(R.id.mTextView3); mTextView4 = findViewById(R.id.mTextView4); - mTextView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { -// startActivity(HDLLinphoneMonitorActivity.class); -// EasyLinphone.callTo("0000",true); -// EasyLinphone.setAccountAndLogin("44 EasyLinphone.setAccountAndLogin("4444", "85521566", "116.62.26.215:5060");44", "85521566", "116.62.26.215:5060"); + mTextView.setOnClickListener(v -> HDLLinphoneKit.getInstance() + .setAccountAndLogin( + "A583853817423247", + "763548", + "139.159.157.75:46000", + HDLLinphoneKit.INTER_PHONE_TYPE_FREEVIEW + )); -// {"data": "{\"sipPassword\":\"8ec02ce0\",\"sipAccount\":\"61723164995710}} -// {"data": "{\"sipPassword\":\"cc6d73c1\",\"sipAccount\":\"61723164995779}} -// EasyLinphone.setAccountAndLogin("61723164995710", "8ec02ce0", "47.94.42.230:25060"); -// HDLLinphoneKit.getInstance().setAccountAndLogin("61723164995710", "8ec02ce0", "sipproxy.ucpaas.com:25060"); + mTextView4.setOnClickListener(v -> HDLLinphoneKit.getInstance().setAccountAndLogin("8888", "85521566", "47.96.88.250:35060", HDLLinphoneKit.INTER_PHONE_TYPE_FREEVIEW)); -// HDLLinphoneKit.getInstance().setAccountAndLogin("5555", "85521566", "116.62.26.215:5060"); -// HDLLinphoneKit.getInstance().setAccountAndLogin("5555", "85521566", "test-gz.hdlcontrol.com:5060"); -// HDLLinphoneKit.getInstance().setAccountAndLogin("6666", "85521566", "test-gz.hdlcontrol.com:5060"); - - HDLLinphoneKit.getInstance().setAccountAndLogin("8888", "85521566", "47.96.88.250:35060"); - - - - - // -// HDLLinphoneKit.getInstance().setAccountAndLogin("8888", "85521566", "test-gz.hdlcontrol.com:5060"); -// -// HDLLinphoneKit.getInstance().setAccountAndLogin("4444", "85521566", "test-gz.hdlcontrol.com:5060"); - - - } + mMonitorText.setOnClickListener(v -> { + // String sip_account = "sip:D" + space_code + "@yun"; + HDLLinphoneKit.getInstance().callTo("sip:D22-1-21-1@139.159.157.75:46000", true); +// HDLLinphoneKit.getInstance().callTo("D22-1-21-1", true); + startActivity(HDLLinphoneMonitorActivity.class); }); - mTextView4.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - clearProxyConfig(); - HDLLinphoneKit.getInstance().setAccountAndLogin("8888", "85521566", "47.96.88.250:35060"); - } - }); - - mTextView2.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - -// logoutLog(); -// return; -// HDLLinphoneKit.getInstance().callTo("61723164995779",true); -// HDLcallTo("61723164995779",true); -// HDLLinphoneKit.getInstance().callTo("1427186301744910338",true); - HDLLinphoneKit.getInstance().callTo("1456490719927488513",true); - startActivity(HDLLinphoneMonitorActivity.class); - - - } - }); - - mTextView3.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - -// HDLLinphoneKit.getInstance().getCore().setNetworkReachable(true); -// isOpen = !isOpen; -// showToast("褰撳墠璁剧疆鐘舵�侊細"+isOpen); -// HDLLinphoneKit.getInstance().getCore().enableVideoCapture(isOpen);//绂佺敤鎵嬫満鎽勫儚澶磋棰戦噰闆� -// //1.鍚敤PCMA 8000 -// PayloadType[] ptList = HDLLinphoneKit.getInstance().getCore().getAudioPayloadTypes(); -// for (PayloadType pt : ptList) { -//// HDLLog.i("payloadaudio", pt.getMimeType()); -// if ((pt.getMimeType().equals("PCMA") || pt.getMimeType().equals("PCMU")) && pt.getClockRate() == 8000) { -//// pt.enable(true); -// HDLLog.i("payloadaudio true", pt.getMimeType() + ": "+ pt.getClockRate()+"HZ " + pt.enabled()); -// } else { -//// pt.enable(false); -// HDLLog.i("payloadaudio false", pt.getMimeType() + ": "+ pt.getClockRate()+"HZ "+ pt.enabled()); -// } -// } -// logout(); - } + mTextView3.setOnClickListener(v -> { + HDLLinphoneKit.getInstance().callTo("D22-1-21-1", true); + startActivity(HDLLinphoneMonitorActivity.class); }); //1.鍒濆鍖朣DK锛屽苟娉ㄥ唽HDLLinphoneService @@ -117,105 +73,32 @@ HDLLinphoneKit.getInstance().setAutoJumpCallView(true); //3.鐩戝惉鍛煎彨鍜岀洃鎺ч〉闈紝鐢ㄦ埛鎿嶄綔鐨勭浉鍏充簨浠躲�佹帴鍚�佹嫆鎺ャ�佸紑閿佺瓑.... setOnHDLLinphoneCallListener(); - } - - void all(){ - Intent intent = new Intent(this, HDLLinphoneReverseCallActivity.class); - intent. - startActivity(intent); + mTextView.performClick(); } boolean isOpen; - - /** - * 閫�鍑烘竻绌鸿处鍙� - * enableRegister false - */ - public void logout() { - try { - Core core = HDLLinphoneService.getCore(); - if (core != null) { - ProxyConfig[] configs = core.getProxyConfigList(); - for (ProxyConfig config : configs) { - if (config != null) { - config.edit(); - config.enableRegister(false); - config.done(); - } - } -// core.clearAllAuthInfo();//娓呴櫎鎵�鏈夎璇佷俊鎭�� -// core.clearProxyConfig();//浠庨厤缃腑鍒犻櫎鎵�鏈変唬鐞嗐�� - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - public void clearProxyConfig() { - Core core = HDLLinphoneService.getCore(); - if (core != null) { - core.setDefaultProxyConfig(null); - core.clearAllAuthInfo(); - core.clearProxyConfig(); -// core.refreshRegisters();//寮哄埗鍦ㄤ笅涓�娆¤凯浠f椂鍚姩娉ㄥ唽鍒锋柊 -// core.ensureRegistered(); - } - - } - -// public void logoutLog() { -// try { -// Core core = HDLLinphoneService.getCore(); -// ProxyConfig[] configs = core.getProxyConfigList(); -// if(configs != null) { -// HDLLog.E("registrationState璐︽埛length" + configs.length); -// } -// -// for (ProxyConfig config : configs) { -// HDLLog.E("registrationState璐︽埛"+config.getIdentityAddress().getUsername()); -// } -// -// } catch (Exception e) { -// e.printStackTrace(); -// } -// } - boolean openSuccess; - void setOnHDLLinphoneCallListener(){ - HDLLinphoneKit.getInstance().setOnHDLLinphoneCallListener( new OnHDLLinphoneCallListener() { + + void setOnHDLLinphoneCallListener() { + HDLLinphoneKit.getInstance().setOnHDLLinphoneCallListener(new OnHDLLinphoneCallListener() { @Override public void onAnswerAction() { showToast("鎺ュ惉"); -// EasyLinphone.toggleMicro(true); } @Override public void onRejectCallAction() { showToast("鎷掓帴"); -// EasyLinphone.hangUp(); } @Override public void onUnlockAction() { -// -// HDLLinphoneKit.getInstance().getCore().clearAllAuthInfo(); - -// showToast("寮�閿�"); -// EasyLinphone.callTo("61723164995779",true); -// openSuccess = !openSuccess; -// if(openSuccess){ -// HDLLinphoneKit.getInstance().onOpenSuccess(); -// }else{ -// HDLLinphoneKit.getInstance().onOpenError("璁惧涓嶅湪绾�"); -// } - - + // } @Override public void onHangUpAction(int callDuration) { - showToast("鎸傛柇 閫氳瘽鏃堕暱锛�"+callDuration); -// EasyLinphone.hangUp(); + showToast("鎸傛柇 閫氳瘽鏃堕暱锛�" + callDuration); } @Override @@ -223,11 +106,11 @@ showToast("鎴浘"); } - @Override - public void onIncomingCall(String s) { + @Override + public void onIncomingCall(String s) { - } - }); + } + }); } /** @@ -241,7 +124,6 @@ Intent intent = new Intent(this, clazz); startActivity(intent); } - } \ No newline at end of file diff --git a/HDLLinphoneSDKDemoNew/app/src/main/res/layout/activity_main.xml b/HDLLinphoneSDKDemoNew/app/src/main/res/layout/activity_main.xml index 5032524..ed7cc22 100644 --- a/HDLLinphoneSDKDemoNew/app/src/main/res/layout/activity_main.xml +++ b/HDLLinphoneSDKDemoNew/app/src/main/res/layout/activity_main.xml @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<LinearLayout - xmlns:android="http://schemas.android.com/apk/res/android" +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/white" @@ -11,39 +10,48 @@ android:layout_width="match_parent" android:layout_height="50dp" android:layout_marginTop="30dp" - android:gravity="center" - android:textColor="@android:color/white" android:background="@android:color/holo_blue_light" + android:gravity="center" + android:text="鐧诲綍" + android:textColor="@android:color/white" /> - android:text="鐧诲綍" ></TextView> <TextView android:id="@+id/mTextView4" android:layout_width="match_parent" android:layout_height="50dp" android:layout_marginTop="30dp" - android:gravity="center" - android:textColor="@android:color/white" android:background="@android:color/holo_blue_light" - - android:text="鐧诲綍2" ></TextView> + android:gravity="center" + android:text="鐧诲綍2" + android:textColor="@android:color/white" /> <TextView android:id="@+id/mTextView2" android:layout_width="match_parent" android:layout_height="50dp" android:layout_marginTop="30dp" - android:gravity="center" - android:textColor="@android:color/white" android:background="@android:color/holo_blue_light" - android:text="鐩戣" ></TextView> + android:gravity="center" + android:text="鐩戣" + android:textColor="@android:color/white" /> <TextView android:id="@+id/mTextView3" android:layout_width="match_parent" android:layout_height="50dp" android:layout_marginTop="30dp" - android:gravity="center" - android:textColor="@android:color/white" android:background="@android:color/holo_blue_light" - android:text="娓呯┖璐﹀彿" ></TextView> + android:gravity="center" + android:text="娓呯┖璐﹀彿" + android:textColor="@android:color/white" /> + + <TextView + android:id="@+id/mDialog" + android:layout_width="match_parent" + android:layout_height="50dp" + android:layout_marginTop="30dp" + android:background="@android:color/holo_blue_light" + android:gravity="center" + android:text="寮圭獥" + android:textColor="@android:color/white" /> </LinearLayout> \ No newline at end of file diff --git a/HDLLinphoneSDKDemoNew/app/src/main/res/values-night/themes.xml b/HDLLinphoneSDKDemoNew/app/src/main/res/values-night/themes.xml deleted file mode 100644 index 1cf43cd..0000000 --- a/HDLLinphoneSDKDemoNew/app/src/main/res/values-night/themes.xml +++ /dev/null @@ -1,10 +0,0 @@ -<resources xmlns:tools="http://schemas.android.com/tools"> - <!-- Base application theme. --> - <style name="Theme.HDLLinphoneSDKDemo" parent="Theme.AppCompat.Light.DarkActionBar"> - <!-- Primary brand color. --> - <item name="colorPrimary">@color/purple_200</item> - <item name="colorPrimaryDark">@color/purple_700</item> - <item name="colorAccent">@color/teal_200</item> - <!-- Customize your theme here. --> - </style> -</resources> \ No newline at end of file diff --git a/HDLLinphoneSDKDemoNew/app/src/main/res/values/colors.xml b/HDLLinphoneSDKDemoNew/app/src/main/res/values/colors.xml index f8c6127..8f0c108 100644 --- a/HDLLinphoneSDKDemoNew/app/src/main/res/values/colors.xml +++ b/HDLLinphoneSDKDemoNew/app/src/main/res/values/colors.xml @@ -1,10 +1,9 @@ <?xml version="1.0" encoding="utf-8"?> <resources> - <color name="purple_200">#FFBB86FC</color> - <color name="purple_500">#FF6200EE</color> - <color name="purple_700">#FF3700B3</color> - <color name="teal_200">#FF03DAC5</color> - <color name="teal_700">#FF018786</color> - <color name="black">#FF000000</color> - <color name="white">#FFFFFFFF</color> + + <color name="lpsdk_app_bg">#ECEDEE</color> + <color name="lpsdk_app_line">#6D798D</color> + <color name="lpsdk_textColor">#1B2D4D</color> + <color name="lpsdk_color_white">#FFFFFF</color> + </resources> \ No newline at end of file diff --git a/HDLLinphoneSDKDemoNew/app/src/main/res/values/dimens.xml b/HDLLinphoneSDKDemoNew/app/src/main/res/values/dimens.xml new file mode 100644 index 0000000..0577f5b --- /dev/null +++ b/HDLLinphoneSDKDemoNew/app/src/main/res/values/dimens.xml @@ -0,0 +1,15 @@ +<resources> + <!-- 椤堕儴鎸夐挳鏍忛珮搴� --> + <dimen name="pickerview_topbar_height">44dp</dimen> + + <!-- 椤堕儴鎸夐挳padding --> + <dimen name="pickerview_topbar_padding">20dp</dimen> + + <!-- 椤堕儴鎸夐挳鏂囧瓧澶у皬 --> + <dimen name="pickerview_topbar_btn_textsize">17sp</dimen> + <dimen name="pickerview_topbar_title_textsize">18sp</dimen> + <!-- 閫夐」鏂囧瓧澶у皬 --> + <dimen name="pickerview_textsize">20sp</dimen> + + +</resources> diff --git a/HDLLinphoneSDKDemoNew/app/src/main/res/values/integers.xml b/HDLLinphoneSDKDemoNew/app/src/main/res/values/integers.xml new file mode 100644 index 0000000..7e9e0a5 --- /dev/null +++ b/HDLLinphoneSDKDemoNew/app/src/main/res/values/integers.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + + <integer name="animation_default_duration">300</integer> +</resources> \ No newline at end of file diff --git a/HDLLinphoneSDKDemoNew/app/src/main/res/values/strings.xml b/HDLLinphoneSDKDemoNew/app/src/main/res/values/strings.xml index 54e46a9..2ddccc0 100644 --- a/HDLLinphoneSDKDemoNew/app/src/main/res/values/strings.xml +++ b/HDLLinphoneSDKDemoNew/app/src/main/res/values/strings.xml @@ -1,3 +1,20 @@ <resources> - <string name="app_name">HDLLinphoneSDKDemo</string> -</resources> \ No newline at end of file + <string name="app_name">HDLLinphoneSDK</string> + <string name="lp_tipStr">Prompt</string> + <string name="lp_okStr">OK</string> + <string name="lp_saveToTheAlbumsStr">Saved to the albums.</string> + <string name="lp_operationFailedStr">Operation failed.</string> + <string name="lp_refuseStr">Refuse</string> + <string name="lp_answerStr">Answer</string> + <string name="lp_hangupStr">Hang up</string> + <string name="lp_unlockSuccessfullyStr">Unlock successfully</string> + <string name="lp_unlockfailureStr">Unlock failure</string> + <string name="lp_callingStr">Incoming call</string> + <string name="lp_endOfCallStr">End of call</string> + <string name="lp_endMonitoringStr">End of the monitor</string> + <string name="lp_screenshotStr">Screenshot</string> + <string name="lp_unlockStr">Unlock</string> + <string name="lp_outdoorUnitStr">Outdoor unit</string> + <string name="lp_sipAccount_null">Failed to answer the call. The device does not exist.</string> + +</resources> diff --git a/HDLLinphoneSDKDemoNew/app/src/main/res/values/styles.xml b/HDLLinphoneSDKDemoNew/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..6c0b8a3 --- /dev/null +++ b/HDLLinphoneSDKDemoNew/app/src/main/res/values/styles.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + + +</resources> diff --git a/HDLLinphoneSDKDemoNew/app/src/main/res/values/themes.xml b/HDLLinphoneSDKDemoNew/app/src/main/res/values/themes.xml index c7a2566..e71eefe 100644 --- a/HDLLinphoneSDKDemoNew/app/src/main/res/values/themes.xml +++ b/HDLLinphoneSDKDemoNew/app/src/main/res/values/themes.xml @@ -1,10 +1,8 @@ <resources xmlns:tools="http://schemas.android.com/tools"> <!-- Base application theme. --> - <style name="Theme.HDLLinphoneSDKDemo" parent="Theme.AppCompat.Light.DarkActionBar"> + <style name="Theme.HDLLinphoneSDKDemo" parent="android:Theme.Light.NoTitleBar.Fullscreen"> <!-- Primary brand color. --> - <item name="colorPrimary">@color/purple_500</item> - <item name="colorPrimaryDark">@color/purple_700</item> - <item name="colorAccent">@color/teal_200</item> + <!-- Customize your theme here. --> </style> </resources> \ No newline at end of file diff --git a/Shared.Droid.HDLLinphone/Shared.Droid.HDLLinphone/Jars/HDLLinphoneSDK-V1.0.1.aar b/Shared.Droid.HDLLinphone/Shared.Droid.HDLLinphone/Jars/HDLLinphoneSDK-V1.0.1.aar index 022291c..2f8b8eb 100644 --- a/Shared.Droid.HDLLinphone/Shared.Droid.HDLLinphone/Jars/HDLLinphoneSDK-V1.0.1.aar +++ b/Shared.Droid.HDLLinphone/Shared.Droid.HDLLinphone/Jars/HDLLinphoneSDK-V1.0.1.aar Binary files differ diff --git a/Shared.Droid.HDLLinphone/Shared.Droid.HDLLinphone/Shared.Droid.HDLLinphone.csproj b/Shared.Droid.HDLLinphone/Shared.Droid.HDLLinphone/Shared.Droid.HDLLinphone.csproj index 5108430..fb9f714 100644 --- a/Shared.Droid.HDLLinphone/Shared.Droid.HDLLinphone/Shared.Droid.HDLLinphone.csproj +++ b/Shared.Droid.HDLLinphone/Shared.Droid.HDLLinphone/Shared.Droid.HDLLinphone.csproj @@ -53,13 +53,13 @@ <TransformFile Include="Transforms\EnumMethods.xml" /> </ItemGroup> <ItemGroup> - <LibraryProjectZip Include="Jars\HDLLinphoneSDK-V1.0.1.aar" /> - </ItemGroup> - <ItemGroup> <PackageReference Include="Xamarin.Android.Support.v7.AppCompat"> <Version>28.0.0.3</Version> </PackageReference> </ItemGroup> + <ItemGroup> + <LibraryProjectZip Include="Jars\HDLLinphoneSDK-V1.0.1.aar" /> + </ItemGroup> <Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.Bindings.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. -- Gitblit v1.8.0