From 848cbfebefab08cc49b0285155edb84463aed862 Mon Sep 17 00:00:00 2001 From: panlili2024 <14743743+panlili2024@user.noreply.gitee.com> Date: 星期三, 13 十一月 2024 17:19:53 +0800 Subject: [PATCH] 提交home项目所用可视对讲sdk --- HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/oval_color_white_18.xml | 12 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/values-zh/strings.xml | 7 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/values/strings.xml | 9 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/dialog_ok_btn_selector.xml | 6 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/dialog_cancel_btn_press_bg.xml | 10 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/ic_esvideo_on_hangupall.png | 0 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/dialog/LinphoneCommonDialog.java | 110 +++++ HDLLinphoneSDKDemoNew/.idea/compiler.xml | 2 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/callback/OnHDLLinphoneCallListener.java | 4 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/core/service/HDLLinphoneService.java | 32 HDLLinphoneSDKDemoNew/.idea/jarRepositories.xml | 20 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/values/colors.xml | 7 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/dialog_ok_btn_press_bg.xml | 10 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/activity/HDLLinphoneMonitorActivity.java | 137 +++--- HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/activity/HDLLinphoneIntercomActivity.java | 121 ++++- HDLLinphoneSDKDemoNew/gradle.properties | 8 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/receiver/CallBroadcastReceiver.java | 37 + HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/dialog_cancel_btn_selector.xml | 6 HDLLinphoneSDKDemoNew/app/src/main/java/com/example/hdllinphonesdkdemo/LinphoneTestActivity.java | 10 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/ic_esvideo_on_hangup.png | 0 HDLLinphoneSDKDemoNew/.idea/misc.xml | 18 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/AndroidManifest.xml | 25 + HDLLinphoneSDKDemoNew/.idea/migrations.xml | 10 HDLLinphoneSDKDemoNew/app/src/main/AndroidManifest.xml | 2 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/activity/LPCheckPermissionsActivity.java | 69 -- HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/layout/linphone_dialog_content_and_twobutton.xml | 65 +++ HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/layout/activity_hdllinphone_monitor.xml | 72 +- HDLLinphoneSDKDemoNew/gradle/wrapper/gradle-wrapper.properties | 4 HDLLinphoneSDKDemoNew/.idea/deploymentTargetSelector.xml | 10 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/activity/HDLLinphoneReverseCallActivity.java | 197 +++++--- HDLLinphoneSDKDemoNew/app/src/main/res/layout/activity_main.xml | 2 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/build.gradle | 31 + HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/dialog_cancel_btn_normal_bg.xml | 10 HDLLinphoneSDKDemoNew/app/src/main/java/com/example/hdllinphonesdkdemo/MainActivity.java | 9 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/HDLLinphoneKit.java | 48 + HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/values/styles.xml | 17 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/dialog_ok_btn_normal_bg.xml | 10 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/layout/activity_hdllinphone_intercom.xml | 52 ++ HDLLinphoneSDKDemoNew/app/src/main/res/layout/activity_linphone_test.xml | 4 39 files changed, 869 insertions(+), 334 deletions(-) diff --git a/HDLLinphoneSDKDemoNew/.idea/compiler.xml b/HDLLinphoneSDKDemoNew/.idea/compiler.xml index fb7f4a8..b589d56 100644 --- a/HDLLinphoneSDKDemoNew/.idea/compiler.xml +++ b/HDLLinphoneSDKDemoNew/.idea/compiler.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="CompilerConfiguration"> - <bytecodeTargetLevel target="11" /> + <bytecodeTargetLevel target="17" /> </component> </project> \ No newline at end of file diff --git a/HDLLinphoneSDKDemoNew/.idea/deploymentTargetSelector.xml b/HDLLinphoneSDKDemoNew/.idea/deploymentTargetSelector.xml new file mode 100644 index 0000000..b268ef3 --- /dev/null +++ b/HDLLinphoneSDKDemoNew/.idea/deploymentTargetSelector.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="deploymentTargetSelector"> + <selectionStates> + <SelectionState runConfigName="app"> + <option name="selectionMode" value="DROPDOWN" /> + </SelectionState> + </selectionStates> + </component> +</project> \ No newline at end of file diff --git a/HDLLinphoneSDKDemoNew/.idea/jarRepositories.xml b/HDLLinphoneSDKDemoNew/.idea/jarRepositories.xml index d9f0af1..98a3f89 100644 --- a/HDLLinphoneSDKDemoNew/.idea/jarRepositories.xml +++ b/HDLLinphoneSDKDemoNew/.idea/jarRepositories.xml @@ -26,5 +26,25 @@ <option name="name" value="maven" /> <option name="url" value="https://linphone.org/maven_repository" /> </remote-repository> + <remote-repository> + <option name="id" value="MavenRepo" /> + <option name="name" value="MavenRepo" /> + <option name="url" value="https://repo.maven.apache.org/maven2/" /> + </remote-repository> + <remote-repository> + <option name="id" value="maven2" /> + <option name="name" value="maven2" /> + <option name="url" value="https://plugins.gradle.org/m2/" /> + </remote-repository> + <remote-repository> + <option name="id" value="maven" /> + <option name="name" value="maven" /> + <option name="url" value="https://maven.aliyun.com/nexus/content/groups/public/" /> + </remote-repository> + <remote-repository> + <option name="id" value="maven3" /> + <option name="name" value="maven3" /> + <option name="url" value="https://jitpack.io" /> + </remote-repository> </component> </project> \ No newline at end of file diff --git a/HDLLinphoneSDKDemoNew/.idea/migrations.xml b/HDLLinphoneSDKDemoNew/.idea/migrations.xml new file mode 100644 index 0000000..f8051a6 --- /dev/null +++ b/HDLLinphoneSDKDemoNew/.idea/migrations.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ProjectMigrations"> + <option name="MigrateToGradleLocalJavaHome"> + <set> + <option value="$PROJECT_DIR$" /> + </set> + </option> + </component> +</project> \ No newline at end of file diff --git a/HDLLinphoneSDKDemoNew/.idea/misc.xml b/HDLLinphoneSDKDemoNew/.idea/misc.xml index bc936fa..4a12ecb 100644 --- a/HDLLinphoneSDKDemoNew/.idea/misc.xml +++ b/HDLLinphoneSDKDemoNew/.idea/misc.xml @@ -1,10 +1,20 @@ -<?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="DesignSurface"> <option name="filePathToZoomLevelMap"> <map> - <entry key="..\:/HDL/ProjectCode/AndroidLinphoneSdk/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/layout/activity_hdllinphone_intercom.xml" value="0.178125" /> - <entry key="..\:/HDL/ProjectCode/AndroidLinphoneSdk/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/layout/activity_hdllinphone_monitor.xml" value="0.16354166666666667" /> + <entry key="..\:/HDL/ProjectCode/AndroidLinphoneSdk/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/btn_click_lp_screenshot.xml" value="0.1785" /> + <entry key="..\:/HDL/ProjectCode/AndroidLinphoneSdk/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/btn_click_lp_unlock.xml" value="0.188" /> + <entry key="..\:/HDL/ProjectCode/AndroidLinphoneSdk/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/dialog_cancel_btn_normal_bg.xml" value="0.1695" /> + <entry key="..\:/HDL/ProjectCode/AndroidLinphoneSdk/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/dialog_cancel_btn_press_bg.xml" value="0.1695" /> + <entry key="..\:/HDL/ProjectCode/AndroidLinphoneSdk/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/dialog_cancel_btn_selector.xml" value="0.1695" /> + <entry key="..\:/HDL/ProjectCode/AndroidLinphoneSdk/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/dialog_ok_btn_normal_bg.xml" value="0.1695" /> + <entry key="..\:/HDL/ProjectCode/AndroidLinphoneSdk/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/dialog_ok_btn_press_bg.xml" value="0.1695" /> + <entry key="..\:/HDL/ProjectCode/AndroidLinphoneSdk/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/dialog_ok_btn_selector.xml" value="0.1695" /> + <entry key="..\:/HDL/ProjectCode/AndroidLinphoneSdk/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/lp_dialog_background.xml" value="0.159" /> + <entry key="..\:/HDL/ProjectCode/AndroidLinphoneSdk/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/oval_color_white_18.xml" value="0.1695" /> + <entry key="..\:/HDL/ProjectCode/AndroidLinphoneSdk/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/layout/activity_hdllinphone_intercom.xml" value="0.33" /> + <entry key="..\:/HDL/ProjectCode/AndroidLinphoneSdk/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/layout/activity_hdllinphone_monitor.xml" value="0.5" /> + <entry key="..\:/HDL/ProjectCode/AndroidLinphoneSdk/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/layout/linphone_dialog_content_and_twobutton.xml" value="0.3536458333333333" /> <entry key="..\:/HDL/ProjectCode/AndroidLinphoneSdk/HDLLinphoneSDKDemoNew/app/src/main/res/layout/activity_linphone_test.xml" value="0.3536458333333333" /> <entry key="..\:/HDL/ProjectCode/AndroidLinphoneSdk/HDLLinphoneSDKDemoNew/app/src/main/res/layout/activity_main.xml" value="0.3536458333333333" /> <entry key="HDLLinphoneSDK/src/main/res/drawable/lp_dialog_background.xml" value="0.22291666666666668" /> @@ -14,7 +24,7 @@ </option> </component> <component name="ExternalStorageConfigurationManager" enabled="true" /> - <component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK"> + <component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK"> <output url="file://$PROJECT_DIR$/build/classes" /> </component> <component name="ProjectType"> diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/build.gradle b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/build.gradle index 86cfb30..934f42e 100644 --- a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/build.gradle +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/build.gradle @@ -4,14 +4,18 @@ apply plugin: 'com.kezong.fat-aar' android { - compileSdkVersion 28 + compileSdkVersion 31 buildToolsVersion "28.0.0" defaultConfig { minSdkVersion 23 - targetSdkVersion 28 - versionCode 1 - versionName "1.0.3" + targetSdkVersion 31 + versionCode 5 + versionName "1.0.7" + + ndk { + abiFilters 'arm64-v8a' + } // consumerProguardFiles "consumer-rules.pro" } @@ -42,8 +46,19 @@ } repositories { - google() + /*google() jcenter() + maven { + // Replace snapshots by releases for releases ! + url "https://linphone.org/maven_repository" + }*/ + google() + mavenCentral() + maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' } + maven { url = uri("https://plugins.gradle.org/m2/") } + maven { + url "https://jitpack.io" + } maven { // Replace snapshots by releases for releases ! url "https://linphone.org/maven_repository" @@ -51,14 +66,14 @@ } 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 "org.linphone:linphone-sdk-android:4.5.0" embed "org.linphone:linphone-sdk-android:4.5.0" implementation 'com.google.code.gson:gson:2.9.0' -// implementation 'com.android.support.constraint:constraint-layout:2.0.4' - embed 'com.tencent.tinker:tinker-patch-gradle-plugin:1.9.1' embed 'com.tencent.tinker:tinker-android-lib:1.9.1' + //娣诲姞StatusBarUtil鐨勪緷璧� + implementation 'com.jaeger.statusbarutil:library:1.5.1' + } \ No newline at end of file diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/AndroidManifest.xml b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/AndroidManifest.xml index f7da630..6ec55b0 100644 --- a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/AndroidManifest.xml +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/AndroidManifest.xml @@ -19,17 +19,34 @@ <application android:allowBackup="true" + android:exported="true" android:label="@string/app_name" android:supportsRtl="true"> - <activity android:name=".activity.HDLLinphoneReverseCallActivity"> + <activity + android:name=".activity.HDLLinphoneReverseCallActivity" + android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN" /> </intent-filter> </activity> - <activity android:name=".activity.HDLLinphoneMonitorActivity" /> - <activity android:name=".activity.HDLLinphoneIntercomActivity" /> + <activity + android:name=".activity.HDLLinphoneMonitorActivity" + android:exported="true" /> + <activity + android:name=".activity.HDLLinphoneIntercomActivity" + android:exported="true" /> + <service + android:name=".core.service.HDLLinphoneService" + android:exported="true" /> - <service android:name=".core.service.HDLLinphoneService" /> + <receiver + android:name=".receiver.CallBroadcastReceiver" + android:enabled="true" + android:exported="true"> + <intent-filter> + <action android:name="com.hdl.homepro.call.action" /> + </intent-filter> + </receiver> </application> </manifest> \ No newline at end of file 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 efd4222..4410e57 100644 --- a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/HDLLinphoneKit.java +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/HDLLinphoneKit.java @@ -1,17 +1,17 @@ package com.hdl.hdllinphonesdk; +import static java.lang.Thread.sleep; + import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; -import android.os.Build; import android.os.IBinder; 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,16 +25,13 @@ import org.linphone.core.AuthInfo; import org.linphone.core.Call; import org.linphone.core.CallParams; +import org.linphone.core.ChatMessage; +import org.linphone.core.ChatRoom; import org.linphone.core.Core; import org.linphone.core.CoreException; import org.linphone.core.Factory; 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. @@ -64,6 +61,7 @@ public static final String KEY_TITLE_NAME = "lpTitleName"; public static final String KEY_SIP_ACCOUNT = "lpSipAccount"; public static final String HDLLinphoneKitNAME = "HDLLinphoneKit"; + public static final String KEY_CALL_ALL_REJECTION = "callAllRejection"; private volatile static HDLLinphoneKit instance; private Context viewContext; private ServiceWaitThread mServiceWaitThread; @@ -411,7 +409,7 @@ mAccountCreator.setUsername(name); mAccountCreator.setDomain(host); mAccountCreator.setPassword(password); - mAccountCreator.setTransport(TransportType.Udp); + mAccountCreator.setTransport(TransportType.Tcp); ProxyConfig prxCfg = mAccountCreator.createProxyConfig(); prxCfg.enableQualityReporting(false); @@ -446,7 +444,7 @@ prxCfg.setQualityReportingInterval(0); prxCfg.enableRegister(true); //鍏ㄨ閫氶渶瑕佽缃浐瀹氫唬鐞嗘湇鍔″櫒ip - prxCfg.setServerAddr("sip:139.159.157.75:46000;transport=udp"); + prxCfg.setServerAddr("sip:" + domain + ";transport=udp"); mLinphoneCore.addProxyConfig(prxCfg);//娣诲姞浠g悊閰嶇疆銆傚鏋滃惎鐢ㄤ簡娉ㄥ唽锛岃繖灏嗗紑濮嬪湪浠g悊涓婃敞鍐屻�� mLinphoneCore.addAuthInfo(authInfo);//娣诲姞璁よ瘉淇℃伅鍒�,璇ヤ俊鎭墖娈靛皢鍦ㄦ墍鏈夐渶瑕佺殑SIP浜嬪姟涓娇鐢ㄨ韩浠介獙璇� @@ -478,10 +476,12 @@ if (addressToCall != null) { call = core.inviteAddressWithParams(addressToCall, params); - // 璁剧疆澶栨斁 - for (AudioDevice audioDevice : HDLLinphoneService.getCore().getAudioDevices()) { - if (audioDevice.getType() == AudioDevice.Type.Speaker) { - call.setOutputAudioDevice(audioDevice); + if (call != null) { + // 璁剧疆澶栨斁 + for (AudioDevice audioDevice : HDLLinphoneService.getCore().getAudioDevices()) { + if (audioDevice.getType() == AudioDevice.Type.Speaker) { + call.setOutputAudioDevice(audioDevice); + } } } } @@ -555,6 +555,28 @@ } } + public void sendSipMessage(String sipAccount, String sipAddress, String message) { + try { + Core mLinphoneCore = HDLLinphoneService.getCore(); + if (mLinphoneCore == null) return; + + //瀵规柟鐨剆ip鍦板潃,sipAddress:"sip:瀵规柟璐﹀彿@鏈嶅姟鍣ㄥ湴鍧�" + Address address = mLinphoneCore.interpretUrl("sip:" + sipAccount + "@" + sipAddress); + + //寤虹珛瀵硅瘽 + ChatRoom chatRoom = mLinphoneCore.getChatRoom(address); + + //鍒涘缓娑堟伅 + ChatMessage chatMessage = chatRoom.createMessageFromUtf8(message); + + //鍙戦�佹秷鎭� + chatMessage.send(); + + } catch (Exception e) { + e.printStackTrace(); + } + } + /** * 鏄惁闈欓煶 * 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 df27cb0..d5aa789 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 @@ -1,10 +1,9 @@ package com.hdl.hdllinphonesdk.activity; -import android.content.BroadcastReceiver; +import android.Manifest; import android.content.Context; -import android.content.DialogInterface; -import android.content.Intent; import android.content.IntentFilter; +import android.content.pm.PackageManager; import android.graphics.Bitmap; import android.media.AudioAttributes; import android.os.Build; @@ -12,7 +11,9 @@ import android.os.CountDownTimer; import android.os.SystemClock; import android.os.Vibrator; -import android.support.v7.app.AlertDialog; +import android.support.annotation.NonNull; +import android.support.v4.app.ActivityCompat; +import android.support.v4.content.ContextCompat; import android.text.TextUtils; import android.util.DisplayMetrics; import android.util.Log; @@ -28,12 +29,15 @@ import android.widget.Toast; import com.hdl.hdllinphonesdk.HDLLinphoneKit; -import com.hdl.hdllinphonesdk.callback.OnLPOpenDoorCallBack; import com.hdl.hdllinphonesdk.R; +import com.hdl.hdllinphonesdk.callback.OnLPOpenDoorCallBack; +import com.hdl.hdllinphonesdk.dialog.LinphoneCommonDialog; +import com.hdl.hdllinphonesdk.receiver.CallBroadcastReceiver; import com.hdl.hdllinphonesdk.utils.HDLImageUtils; import com.hdl.hdllinphonesdk.utils.HDLLog; import org.linphone.core.Call; +import org.linphone.core.CallParams; import org.linphone.core.Core; import org.linphone.core.CoreListenerStub; @@ -43,6 +47,7 @@ public class HDLLinphoneIntercomActivity extends LPCheckPermissionsActivity implements View.OnClickListener { private static final String TAG = "HDLLinphoneIntercomActivity"; + private RelativeLayout ll_lp_btn_back; //鎺т欢 private TextView tv_lp_title; private ImageView iv_lp_screenshot; @@ -74,7 +79,10 @@ //Linphone private CoreListenerStub mCoreListener; + private boolean enableVideo = false; + private CallBroadcastReceiver callBroadcastReceiver; + private IntentFilter callFilter; @Override protected void onCreate(Bundle savedInstanceState) { @@ -117,6 +125,11 @@ //5. onDestroyLinphone(); + if (callBroadcastReceiver != null) { + unregisterReceiver(callBroadcastReceiver); + callBroadcastReceiver = null; + } + HDLLog.i(TAG, "onDestroy"); } @@ -126,6 +139,7 @@ * initView */ private void initView() { + ll_lp_btn_back = findViewById(R.id.ll_lp_btn_back); tv_lp_title = findViewById(R.id.tv_lp_title); iv_lp_screenshot = findViewById(R.id.iv_lp_screenshot); iv_lp_unlock = findViewById(R.id.iv_lp_unlock); @@ -151,11 +165,33 @@ */ private void initData() { Bundle extras = getIntent().getExtras(); + String interphoneType = ""; if (extras != null) { String titleName = extras.getString(HDLLinphoneKit.KEY_TITLE_NAME); if (!TextUtils.isEmpty(titleName)) { tv_lp_title.setText(titleName); } + interphoneType = extras.getString("interphoneType"); + } + + //鐩戝惉鍛煎彨骞挎挱 + callFilter = new IntentFilter(); + callFilter.addAction("com.hdl.homepro.call.action"); + callBroadcastReceiver = new CallBroadcastReceiver(); + registerReceiver(callBroadcastReceiver, callFilter); + + if (callBroadcastReceiver != null) { + String finalInterphoneType = interphoneType; + callBroadcastReceiver.setOnReceivedCallBroadcastListener(new CallBroadcastReceiver.CallBroadcastListener() { + @Override + public void onReceived(String callFrom) { + //濡傛灉鏀跺埌鎺ㄩ�侀�氱煡鎶婄洃瑙嗛〉闈inish + if (!TextUtils.isEmpty(callFrom) && !finalInterphoneType.equals(callFrom)) { + Log.d("panlili", "HDLLinphoneIntercomActivity.java:onReceived-----> " + callFrom); + finish();//缁撴潫褰撳墠椤甸潰 + } + } + }); } } @@ -181,6 +217,7 @@ * init OnClickListener */ private void initOnClick() { + ll_lp_btn_back.setOnClickListener(this); iv_lp_screenshot.setOnClickListener(this); iv_lp_unlock.setOnClickListener(this); iv_lp_hangUp.setOnClickListener(this); @@ -232,8 +269,14 @@ public void onClick(View view) { int id = view.getId(); if (id == R.id.iv_lp_screenshot) { - //鎴浘 - onClickScreenshot(); + //鍔ㄦ�佹潈闄愮敵璇� + if (ContextCompat.checkSelfPermission(HDLLinphoneIntercomActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED + && ActivityCompat.checkSelfPermission(HDLLinphoneIntercomActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { + ActivityCompat.requestPermissions(HDLLinphoneIntercomActivity.this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1); + } else { + //鎴浘 + onClickScreenshot(); + } } else if (id == R.id.iv_lp_unlock) { //寮�閿� onClickUnlock(); @@ -243,6 +286,28 @@ } else if (id == R.id.iv_lp_answer || id == R.id.tv_lp_answer) { //鎺ュ惉 onClickAnswer(); + } else if (id == R.id.ll_lp_btn_back) { + //杩斿洖鎸夐挳 鎸傛柇 + if (isAnswer) { + HDLLinphoneKit.getInstance().hangUp(); + } + finish(); + } + } + + @Override + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { + super.onRequestPermissionsResult(requestCode, permissions, grantResults); + switch (requestCode) { + case 1: + if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { + //鎴浘 + onClickScreenshot(); + } else { + LinphoneCommonDialog.getInstance().showSettingPermissionDialog(HDLLinphoneIntercomActivity.this, getString(R.string.open_save_permission)); + } + break; + default: } } @@ -265,38 +330,14 @@ * 寮�閿佺偣鍑讳簨浠� */ private void onClickUnlock() { - try { - AlertDialog.Builder builder = new AlertDialog.Builder(this,R.style.CustomAlertDialog); - builder.setTitle(R.string.lp_tipStr); - builder.setMessage(R.string.tip_confirm_unlock); - - builder.setPositiveButton(R.string.lp_confirm, new DialogInterface.OnClickListener() { + LinphoneCommonDialog.getInstance().showDialog(HDLLinphoneIntercomActivity.this, getString(R.string.tip_confirm_unlock), getString(R.string.lp_confirm), new LinphoneCommonDialog.OnOKClickListener() { @Override - public void onClick(DialogInterface dialog, int which) { - // 鍦ㄧ‘瀹氭寜閽鐐瑰嚮鏃舵墽琛岀殑鎿嶄綔 - // 鍙互鍦ㄨ繖閲屾坊鍔犱綘鎯宠鎵ц鐨勯�昏緫 + public void onOKClick() { if (HDLLinphoneKit.getInstance().getOnHDLLinphoneCallListener() != null) { HDLLinphoneKit.getInstance().getOnHDLLinphoneCallListener().onUnlockAction(); } - dialog.dismiss(); // 鍏抽棴寮圭獥 } }); - builder.setNegativeButton(R.string.lp_cancel, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - // 鍦ㄥ彇娑堟寜閽鐐瑰嚮鏃舵墽琛岀殑鎿嶄綔 - // 鍙互鍦ㄨ繖閲屾坊鍔犱綘鎯宠鎵ц鐨勯�昏緫 - dialog.dismiss(); // 鍏抽棴寮圭獥 - } - }); - - AlertDialog dialog = builder.create(); - dialog.show(); - }catch (Exception exception) { - Log.e(TAG, exception.getMessage()); - } - - } /** @@ -417,6 +458,7 @@ // Once call is finished (end state), terminate the activity // We also check for released state (called a few seconds later) just in case // we missed the first one + enableVideo = false; showToast(getString(R.string.lp_endOfCallStr)); finish(); } @@ -432,7 +474,20 @@ core.addListener(mCoreListener); core.enableMic(true);//寮�鍚害鍏嬮 } + } + void enableVideo(Core core, Call call) { +// Call currentCall = HDLLinphoneService.getCore().getCurrentCall(); + + CallParams params = call.getCurrentParams(); + if (params == null) { + params = core.createCallParams(call); + } + params.enableVideo(true); + params.enableLowBandwidth(false); + params.setAudioBandwidthLimit(0); // disable limitation + + call.update(params); } /** 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 3863ab2..a339f9c 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 @@ -1,15 +1,15 @@ package com.hdl.hdllinphonesdk.activity; +import android.Manifest; import android.annotation.SuppressLint; -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.DialogInterface; -import android.content.Intent; import android.content.IntentFilter; +import android.content.pm.PackageManager; import android.graphics.Bitmap; -import android.os.CountDownTimer; import android.os.Bundle; -import android.support.v7.app.AlertDialog; +import android.os.CountDownTimer; +import android.support.annotation.NonNull; +import android.support.v4.app.ActivityCompat; +import android.support.v4.content.ContextCompat; import android.text.TextUtils; import android.util.DisplayMetrics; import android.util.Log; @@ -26,6 +26,8 @@ import com.hdl.hdllinphonesdk.HDLLinphoneKit; import com.hdl.hdllinphonesdk.R; import com.hdl.hdllinphonesdk.callback.OnLPOpenDoorCallBack; +import com.hdl.hdllinphonesdk.dialog.LinphoneCommonDialog; +import com.hdl.hdllinphonesdk.receiver.CallBroadcastReceiver; import com.hdl.hdllinphonesdk.utils.HDLImageUtils; import com.hdl.hdllinphonesdk.utils.HDLLog; @@ -43,11 +45,9 @@ private RelativeLayout ll_lp_btn_back; //鎺т欢 private TextView tv_lp_title; - private ImageView iv_lp_screenshot; - private TextView tv_lp_screenshot; + private ImageView iv_lp_screenshot; private ImageView iv_lp_unlock; - private TextView tv_lp_unlock; private LinearLayout ll_video_lp_rendering; private TextureView video_lp_rendering; @@ -58,6 +58,9 @@ //Linphone private CoreListenerStub mCoreListener; private boolean enableVideo = false; + + private CallBroadcastReceiver callBroadcastReceiver; + private IntentFilter callFilter; @Override protected void onCreate(Bundle savedInstanceState) { @@ -94,6 +97,11 @@ onDestroyLinphone(); + if (callBroadcastReceiver != null) { + unregisterReceiver(callBroadcastReceiver); + callBroadcastReceiver = null; + } + HDLLog.i(TAG, "onDestroy"); } @@ -105,10 +113,7 @@ ll_lp_btn_back = findViewById(R.id.ll_lp_btn_back); tv_lp_title = findViewById(R.id.tv_lp_title); iv_lp_screenshot = findViewById(R.id.iv_lp_screenshot); - tv_lp_screenshot = findViewById(R.id.tv_lp_screenshot); - iv_lp_unlock = findViewById(R.id.iv_lp_unlock); - tv_lp_unlock = findViewById(R.id.tv_lp_unlock); ll_video_lp_rendering = findViewById(R.id.ll_video_lp_rendering); video_lp_rendering = findViewById(R.id.video_lp_rendering); @@ -122,11 +127,33 @@ */ private void initData() { Bundle extras = getIntent().getExtras(); + String interphoneType = ""; if (extras != null) { String titleName = extras.getString(HDLLinphoneKit.KEY_TITLE_NAME); if (!TextUtils.isEmpty(titleName)) { tv_lp_title.setText(titleName); } + interphoneType = extras.getString("interphoneType"); + } + + //鐩戝惉鍛煎彨骞挎挱 + callFilter = new IntentFilter(); + callFilter.addAction("com.hdl.homepro.call.action"); + callBroadcastReceiver = new CallBroadcastReceiver(); + registerReceiver(callBroadcastReceiver, callFilter); + + if (callBroadcastReceiver != null) { + String finalInterphoneType = interphoneType; + callBroadcastReceiver.setOnReceivedCallBroadcastListener(new CallBroadcastReceiver.CallBroadcastListener() { + @Override + public void onReceived(String callFrom) { + //濡傛灉鏀跺埌鎺ㄩ�侀�氱煡鎶婄洃瑙嗛〉闈inish + if (!TextUtils.isEmpty(callFrom) && !finalInterphoneType.equals(callFrom)) { + Log.d("panlili", "HDLLinphoneMonitorActivity finish-----> "); + finish();//缁撴潫褰撳墠椤甸潰 + } + } + }); } } @@ -153,12 +180,8 @@ */ private void initOnClick() { ll_lp_btn_back.setOnClickListener(this); - iv_lp_screenshot.setOnClickListener(this); - tv_lp_screenshot.setOnClickListener(this); - iv_lp_unlock.setOnClickListener(this); - tv_lp_unlock.setOnClickListener(this); } /** @@ -206,14 +229,36 @@ public void onClick(View view) { int id = view.getId(); if (id == R.id.iv_lp_screenshot) { - //鎴浘 - onClickScreenshot(); + //鍔ㄦ�佹潈闄愮敵璇� + if (ContextCompat.checkSelfPermission(HDLLinphoneMonitorActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED + && ActivityCompat.checkSelfPermission(HDLLinphoneMonitorActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { + ActivityCompat.requestPermissions(HDLLinphoneMonitorActivity.this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1); + } else { + //鎴浘 + onClickScreenshot(); + } } else if (id == R.id.iv_lp_unlock) { //寮�閿� onClickUnlock(); } else if (id == R.id.ll_lp_btn_back) { - //杩斿洖鎸夐挳 鎸傛柇 - onClickHangUp(); + //杩斿洖鎸夐挳 + finish(); + } + } + + @Override + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { + super.onRequestPermissionsResult(requestCode, permissions, grantResults); + switch (requestCode) { + case 1: + if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { + //鎴浘 + onClickScreenshot(); + } else { + LinphoneCommonDialog.getInstance().showSettingPermissionDialog(HDLLinphoneMonitorActivity.this, getString(R.string.open_save_permission)); + } + break; + default: } } @@ -236,47 +281,16 @@ * 寮�閿佺偣鍑讳簨浠� */ private void onClickUnlock() { - try { - AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.CustomAlertDialog); - builder.setTitle(R.string.lp_tipStr); - builder.setMessage(R.string.tip_confirm_unlock); - builder.setPositiveButton(R.string.lp_confirm, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - // 鍦ㄧ‘瀹氭寜閽鐐瑰嚮鏃舵墽琛岀殑鎿嶄綔 - // 鍙互鍦ㄨ繖閲屾坊鍔犱綘鎯宠鎵ц鐨勯�昏緫 - if (HDLLinphoneKit.getInstance().getOnHDLLinphoneCallListener() != null) { - HDLLinphoneKit.getInstance().getOnHDLLinphoneCallListener().onUnlockAction(); - } - dialog.dismiss(); // 鍏抽棴寮圭獥 + LinphoneCommonDialog.getInstance().showDialog(HDLLinphoneMonitorActivity.this, getString(R.string.tip_confirm_unlock), getString(R.string.lp_confirm), new LinphoneCommonDialog.OnOKClickListener() { + @Override + public void onOKClick() { + if (HDLLinphoneKit.getInstance().getOnHDLLinphoneCallListener() != null) { + HDLLinphoneKit.getInstance().getOnHDLLinphoneCallListener().onUnlockAction(); } - }); - builder.setNegativeButton(R.string.lp_cancel, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - // 鍦ㄥ彇娑堟寜閽鐐瑰嚮鏃舵墽琛岀殑鎿嶄綔 - // 鍙互鍦ㄨ繖閲屾坊鍔犱綘鎯宠鎵ц鐨勯�昏緫 - dialog.dismiss(); // 鍏抽棴寮圭獥 - } - }); + } + }); - AlertDialog dialog = builder.create(); - dialog.show(); - } catch (Exception exception) { - Log.e(TAG, exception.getMessage()); - } - - } - - /** - * 鎸傛柇鐐瑰嚮浜嬩欢 - */ - private void onClickHangUp() { - //1.鎸傛柇 - HDLLinphoneKit.getInstance().hangUp(); - //2.椤甸潰鍏抽棴 - finish(); } /****************寮�閿佹垚鍔�********/ @@ -338,13 +352,6 @@ enableVideo = false; showToast(getString(R.string.lp_endMonitoringStr)); finish(); - } else if (state == Call.State.StreamsRunning) { - if (HDLLinphoneKit.getInstance().getIntercomeType().equals(HDLLinphoneKit.INTER_PHONE_TYPE_HDL)) { - if (!enableVideo) { - enableVideo(core, call); - enableVideo = true; - } - } } } }; diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/activity/HDLLinphoneReverseCallActivity.java b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/activity/HDLLinphoneReverseCallActivity.java index 362b933..e55dce7 100644 --- a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/activity/HDLLinphoneReverseCallActivity.java +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/activity/HDLLinphoneReverseCallActivity.java @@ -1,16 +1,19 @@ package com.hdl.hdllinphonesdk.activity; +import android.Manifest; import android.content.Context; -import android.content.DialogInterface; +import android.content.IntentFilter; +import android.content.pm.PackageManager; import android.graphics.Bitmap; import android.media.AudioAttributes; import android.os.Build; +import android.os.Bundle; import android.os.CountDownTimer; import android.os.SystemClock; import android.os.Vibrator; -import android.support.v7.app.AlertDialog; -import android.support.v7.app.AppCompatActivity; -import android.os.Bundle; +import android.support.annotation.NonNull; +import android.support.v4.app.ActivityCompat; +import android.support.v4.content.ContextCompat; import android.text.TextUtils; import android.util.DisplayMetrics; import android.util.Log; @@ -28,6 +31,8 @@ import com.hdl.hdllinphonesdk.HDLLinphoneKit; import com.hdl.hdllinphonesdk.R; import com.hdl.hdllinphonesdk.callback.OnLPOpenDoorCallBack; +import com.hdl.hdllinphonesdk.dialog.LinphoneCommonDialog; +import com.hdl.hdllinphonesdk.receiver.CallBroadcastReceiver; import com.hdl.hdllinphonesdk.utils.HDLImageUtils; import com.hdl.hdllinphonesdk.utils.HDLLog; @@ -42,6 +47,7 @@ public class HDLLinphoneReverseCallActivity extends LPCheckPermissionsActivity implements View.OnClickListener { private static final String TAG = "HDLLinphoneReverseCallActivity"; + private RelativeLayout ll_lp_btn_back; //鎺т欢 private TextView tv_lp_title; private ImageView iv_lp_screenshot; @@ -53,6 +59,10 @@ private ImageView iv_lp_answer; private TextView tv_lp_answer; private RelativeLayout rl_lp_answerView; + + private ImageView iv_lp_rejectall; + private TextView tv_lp_rejectall; + private RelativeLayout rl_lp_rejectallView; private LinearLayout ll_video_lp_rendering; private TextureView video_lp_rendering; @@ -77,6 +87,11 @@ private String deviceSipAccount;//璁惧SIP璐﹀彿 private boolean enableVideo = false; + private CallBroadcastReceiver callBroadcastReceiver; + private IntentFilter callFilter; + + private boolean callAllRejection = false;//鑷爺闂ㄥ彛鏈烘槸鍚︽敮鎸佸叏閮ㄦ嫆鎺� + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -90,7 +105,6 @@ initCallBack(); initCountDownTimer(); initLinphone(); -// initVibrator(); } /** @@ -107,14 +121,19 @@ } //3.娉ㄩ攢callBack HDLLinphoneKit.getInstance().setOpenOpenDoorCallBack(null); - //4.鍙栨秷闇囧姩鍣� - cancelVibrator(); - //5. + + //4. if (mCountDownTimer != null) { mCountDownTimer.cancel(); mCountDownTimer = null; } onDestroyLinphone(); + + if (callBroadcastReceiver != null) { + unregisterReceiver(callBroadcastReceiver); + callBroadcastReceiver = null; + } + HDLLog.i(TAG, "onDestroy"); } @@ -122,6 +141,7 @@ * initView */ private void initView() { + ll_lp_btn_back = findViewById(R.id.ll_lp_btn_back); tv_lp_title = findViewById(R.id.tv_lp_title); iv_lp_screenshot = findViewById(R.id.iv_lp_screenshot); iv_lp_unlock = findViewById(R.id.iv_lp_unlock); @@ -130,6 +150,9 @@ iv_lp_answer = findViewById(R.id.iv_lp_answer); tv_lp_answer = findViewById(R.id.tv_lp_answer); rl_lp_answerView = findViewById(R.id.rl_lp_answerView); + iv_lp_rejectall = findViewById(R.id.iv_lp_hangUpall); + tv_lp_rejectall = findViewById(R.id.tv_lp_hangUpall); + rl_lp_rejectallView = findViewById(R.id.rl_lp_hangUpallView); ll_video_lp_rendering = findViewById(R.id.ll_video_lp_rendering); video_lp_rendering = findViewById(R.id.video_lp_rendering); video_lp_rendering2 = findViewById(R.id.video_lp_rendering2); @@ -147,12 +170,37 @@ */ private void initData() { Bundle extras = getIntent().getExtras(); + String interphoneType = ""; if (extras != null) { String titleName = extras.getString(HDLLinphoneKit.KEY_TITLE_NAME); if (!TextUtils.isEmpty(titleName)) { tv_lp_title.setText(titleName); } deviceSipAccount = extras.getString(HDLLinphoneKit.KEY_SIP_ACCOUNT); + interphoneType = extras.getString("interphoneType"); + callAllRejection = extras.getBoolean(HDLLinphoneKit.KEY_CALL_ALL_REJECTION); + } + + rl_lp_rejectallView.setVisibility(callAllRejection ? View.VISIBLE : View.GONE); + + //鐩戝惉鍛煎彨骞挎挱 + callFilter = new IntentFilter(); + callFilter.addAction("com.hdl.homepro.call.action"); + callBroadcastReceiver = new CallBroadcastReceiver(); + registerReceiver(callBroadcastReceiver, callFilter); + + if (callBroadcastReceiver != null) { + String finalInterphoneType = interphoneType; + callBroadcastReceiver.setOnReceivedCallBroadcastListener(new CallBroadcastReceiver.CallBroadcastListener() { + @Override + public void onReceived(String callFrom) { + //濡傛灉鏀跺埌鎺ㄩ�侀�氱煡鎶婄洃瑙嗛〉闈inish + if (!TextUtils.isEmpty(callFrom) && !finalInterphoneType.equals(callFrom)) { + Log.d("panlili", "HDLLinphoneIntercomActivity.java:onReceived-----> " + callFrom); + finish();//缁撴潫褰撳墠椤甸潰 + } + } + }); } } @@ -178,12 +226,15 @@ * init OnClickListener */ private void initOnClick() { + ll_lp_btn_back.setOnClickListener(this); iv_lp_screenshot.setOnClickListener(this); iv_lp_unlock.setOnClickListener(this); iv_lp_hangUp.setOnClickListener(this); tv_lp_hangUp.setOnClickListener(this); iv_lp_answer.setOnClickListener(this); tv_lp_answer.setOnClickListener(this); + iv_lp_rejectall.setOnClickListener(this); + tv_lp_rejectall.setOnClickListener(this); } /** @@ -232,8 +283,14 @@ public void onClick(View view) { int id = view.getId(); if (id == R.id.iv_lp_screenshot) { - //鎴浘 - onClickScreenshot(); + //鍔ㄦ�佹潈闄愮敵璇� + if (ContextCompat.checkSelfPermission(HDLLinphoneReverseCallActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED + && ActivityCompat.checkSelfPermission(HDLLinphoneReverseCallActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { + ActivityCompat.requestPermissions(HDLLinphoneReverseCallActivity.this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1); + } else { + //鎴浘 + onClickScreenshot(); + } } else if (id == R.id.iv_lp_unlock) { //寮�閿� onClickUnlock(); @@ -243,6 +300,31 @@ } else if (id == R.id.iv_lp_answer || id == R.id.tv_lp_answer) { //鎺ュ惉 onClickAnswer(); + } else if (id == R.id.iv_lp_hangUpall || id == R.id.tv_lp_hangUpall) { + //鎷掓帴鍏ㄩ儴 + onClickRejectAll(); + } else if (id == R.id.ll_lp_btn_back) { + //杩斿洖鎸夐挳 鎸傛柇 + if (isAnswer) { + HDLLinphoneKit.getInstance().hangUp(); + } + finish(); + } + } + + @Override + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { + super.onRequestPermissionsResult(requestCode, permissions, grantResults); + switch (requestCode) { + case 1: + if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { + //鎴浘 + onClickScreenshot(); + } else { + LinphoneCommonDialog.getInstance().showSettingPermissionDialog(HDLLinphoneReverseCallActivity.this, getString(R.string.open_save_permission)); + } + break; + default: } } @@ -266,37 +348,14 @@ * 寮�閿佺偣鍑讳簨浠� */ private void onClickUnlock() { - try { - AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.CustomAlertDialog); - builder.setTitle(R.string.lp_tipStr); - builder.setMessage(R.string.tip_confirm_unlock); - - builder.setPositiveButton(R.string.lp_confirm, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - // 鍦ㄧ‘瀹氭寜閽鐐瑰嚮鏃舵墽琛岀殑鎿嶄綔 - // 鍙互鍦ㄨ繖閲屾坊鍔犱綘鎯宠鎵ц鐨勯�昏緫 - if (HDLLinphoneKit.getInstance().getOnHDLLinphoneCallListener() != null) { - HDLLinphoneKit.getInstance().getOnHDLLinphoneCallListener().onUnlockAction(); - } - dialog.dismiss(); // 鍏抽棴寮圭獥 + LinphoneCommonDialog.getInstance().showDialog(HDLLinphoneReverseCallActivity.this, getString(R.string.tip_confirm_unlock), getString(R.string.lp_confirm), new LinphoneCommonDialog.OnOKClickListener() { + @Override + public void onOKClick() { + if (HDLLinphoneKit.getInstance().getOnHDLLinphoneCallListener() != null) { + HDLLinphoneKit.getInstance().getOnHDLLinphoneCallListener().onUnlockAction(); } - }); - builder.setNegativeButton(R.string.lp_cancel, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - // 鍦ㄥ彇娑堟寜閽鐐瑰嚮鏃舵墽琛岀殑鎿嶄綔 - // 鍙互鍦ㄨ繖閲屾坊鍔犱綘鎯宠鎵ц鐨勯�昏緫 - dialog.dismiss(); // 鍏抽棴寮圭獥 - } - }); - - AlertDialog dialog = builder.create(); - dialog.show(); - } catch (Exception exception) { - Log.e(TAG, exception.getMessage()); - } - + } + }); } /** @@ -319,6 +378,19 @@ finish(); } + + /** + * 鎷掓帴鍏ㄩ儴鐐瑰嚮浜嬩欢 + */ + private void onClickRejectAll() { + //1.鍥炶皟浜嬩欢 + if (HDLLinphoneKit.getInstance().getOnHDLLinphoneCallListener() != null) { + HDLLinphoneKit.getInstance().getOnHDLLinphoneCallListener().onRejectCallAllAction(); + } + //2.椤甸潰鍏抽棴 + finish(); + } + /** * 鎺ュ惉鎸夐挳鐐瑰嚮浜嬩欢 */ @@ -330,12 +402,11 @@ } HDLLinphoneKit.getInstance().callTo(deviceSipAccount, true); - //2.鍙栨秷闇囧姩 - cancelVibrator(); - //3.淇敼UI + //2.淇敼UI isAnswer = true; tv_lp_hangUp.setText(getString(R.string.lp_hangupStr)); setViewGone(rl_lp_answerView); + setViewGone(rl_lp_rejectallView); setViewGone(tv_lp_calltime); setViewVisible(timer_lp_calltime); startCallTimeCountdown(); @@ -419,15 +490,9 @@ // Once call is finished (end state), terminate the activity // We also check for released state (called a few seconds later) just in case // we missed the first one + enableVideo = false; showToast(getString(R.string.lp_endOfCallStr)); finish(); - } else if (state == Call.State.StreamsRunning) { - if (HDLLinphoneKit.getInstance().getIntercomeType().equals(HDLLinphoneKit.INTER_PHONE_TYPE_HDL)) { - if (!enableVideo) { - enableVideo(core, call); - enableVideo = true; - } - } } } }; @@ -473,36 +538,4 @@ video_lp_rendering2 = null; } - /** - * 鍒濆鍖栭渿鍔ㄥ櫒 - */ - void initVibrator() { - mVibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); - if (mVibrator.hasVibrator()) { - long[] patern = {0, 1000, 1000}; - AudioAttributes audioAttributes = null; - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - audioAttributes = new AudioAttributes.Builder() - .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION) - .setUsage(AudioAttributes.USAGE_NOTIFICATION_RINGTONE) //key - .build(); - mVibrator.vibrate(patern, 1, audioAttributes); - } else { - mVibrator.vibrate(patern, 1); - } - } else { - HDLLog.E("褰撳墠鎵嬫満娌℃湁闇囧姩鍣�"); - } - } - - /** - * 鍏抽棴闇囧姩鍣� - */ - void cancelVibrator() { - if (mVibrator != null) { - mVibrator.cancel(); - mVibrator = null; - } - - } } \ No newline at end of file diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/activity/LPCheckPermissionsActivity.java b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/activity/LPCheckPermissionsActivity.java index 772aca8..df3a066 100644 --- a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/activity/LPCheckPermissionsActivity.java +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/activity/LPCheckPermissionsActivity.java @@ -13,6 +13,8 @@ import android.provider.Settings; import android.view.KeyEvent; +import com.jaeger.library.StatusBarUtil; + import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; @@ -33,14 +35,10 @@ * 闇�瑕佽繘琛屾娴嬬殑鏉冮檺鏁扮粍 */ protected String[] needPermissions = { - Manifest.permission.INTERNET, - Manifest.permission.ACCESS_NETWORK_STATE, Manifest.permission.WAKE_LOCK, Manifest.permission.RECORD_AUDIO, Manifest.permission.MODIFY_AUDIO_SETTINGS, - Manifest.permission.CAMERA, - Manifest.permission.READ_EXTERNAL_STORAGE, - Manifest.permission.WRITE_EXTERNAL_STORAGE, + Manifest.permission.CAMERA }; public static final int PERMISSON_REQUESTCODE = 0; @@ -51,16 +49,13 @@ if(Build.VERSION.SDK_INT > 28 && getApplicationContext().getApplicationInfo().targetSdkVersion > 28) { needPermissions = new String[] { - Manifest.permission.INTERNET, - Manifest.permission.ACCESS_NETWORK_STATE, Manifest.permission.WAKE_LOCK, Manifest.permission.RECORD_AUDIO, Manifest.permission.MODIFY_AUDIO_SETTINGS, - Manifest.permission.CAMERA, - Manifest.permission.READ_EXTERNAL_STORAGE, - Manifest.permission.WRITE_EXTERNAL_STORAGE, + Manifest.permission.CAMERA }; } + setStatusBarTranslucent(); } /** @@ -158,53 +153,6 @@ return true; } -// @TargetApi(23) -// public void onRequestPermissionsResult(int requestCode, -// String[] permissions, int[] paramArrayOfInt) { -// if (requestCode == PERMISSON_REQUESTCODE) { -// if (!verifyPermissions(paramArrayOfInt)) { -// showMissingPermissionDialog(); -// isNeedCheck = false; -// }else{ -// //鎺堟潈鎴愬姛 -// -// } -// } -// } - -// /** -// * 鏄剧ず鎻愮ず淇℃伅 -// * -// * @since 2.5.0 -// * -// */ -// public void showMissingPermissionDialog() { -// AlertDialog.Builder builder = new AlertDialog.Builder(this); -// builder.setTitle(R.string.gd_notifyTitle); -// builder.setMessage(R.string.gd_notifyMsg); -// -// // 鎷掔粷, 閫�鍑哄簲鐢� -// builder.setNegativeButton(R.string.gd_cancel, -// new DialogInterface.OnClickListener() { -// @Override -// public void onClick(DialogInterface dialog, int which) { -// finish(); -// } -// }); -// -// builder.setPositiveButton(R.string.gd_setting, -// new DialogInterface.OnClickListener() { -// @Override -// public void onClick(DialogInterface dialog, int which) { -// startAppSettings(); -// } -// }); -// -// builder.setCancelable(false); -// -// builder.show(); -// } - /** * 鍚姩搴旂敤鐨勮缃� * @@ -240,4 +188,11 @@ public void setRequestPermissionsListener(RequestPermissionsListener mRequestPermissionsListener) { mRequestPermissionsListener = mRequestPermissionsListener; } + + // 灏哠tatusBar璁剧疆涓洪�忔槑 + public void setStatusBarTranslucent() { + StatusBarUtil.setTranslucentForImageViewInFragment(this, + 0, null); + StatusBarUtil.setLightMode(this); + } } diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/callback/OnHDLLinphoneCallListener.java b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/callback/OnHDLLinphoneCallListener.java index 10ca1db..888748a 100644 --- a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/callback/OnHDLLinphoneCallListener.java +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/callback/OnHDLLinphoneCallListener.java @@ -15,6 +15,10 @@ */ void onRejectCallAction(); /** + * 鎷掓帴鍏ㄩ儴鍥炶皟 + */ + void onRejectCallAllAction(); + /** * 寮�閿佸洖璋� */ void onUnlockAction(); 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 dacd5a1..ada707d 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 @@ -1,15 +1,12 @@ package com.hdl.hdllinphonesdk.core.service; +import static com.hdl.hdllinphonesdk.HDLLinphoneKit.HDLLinphoneKitNAME; + import android.app.AlarmManager; -import android.app.Notification; -import android.app.NotificationChannel; -import android.app.NotificationManager; import android.app.PendingIntent; import android.app.Service; -import android.content.ComponentName; import android.content.Context; import android.content.Intent; -import android.content.ServiceConnection; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.os.Binder; @@ -17,14 +14,9 @@ import android.os.Handler; import android.os.IBinder; import android.os.SystemClock; -import android.support.v4.app.NotificationCompat; -import android.telecom.ConnectionService; - import com.google.gson.Gson; 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; @@ -38,7 +30,6 @@ import org.linphone.core.PayloadType; import org.linphone.core.ProxyConfig; import org.linphone.core.RegistrationState; -import org.linphone.core.ToneID; import org.linphone.core.VideoActivationPolicy; import org.linphone.core.VideoDefinition; import org.linphone.core.tools.Log; @@ -50,8 +41,6 @@ import java.io.InputStream; import java.util.Timer; import java.util.TimerTask; - -import static com.hdl.hdllinphonesdk.HDLLinphoneKit.HDLLinphoneKitNAME; public class HDLLinphoneService extends Service { private static final String START_LINPHONE_LOGS = " ==== HDLLinphoneService ===="; @@ -147,7 +136,14 @@ hdlStartForeground(); initLinphone(); Intent intent = new Intent(this, KeepAliveHandler.class); - mKeepAlivePendingIntent = PendingIntent.getBroadcast(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); +// mKeepAlivePendingIntent = PendingIntent.getBroadcast(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); + + if (android.os.Build.VERSION.SDK_INT >= 31) { + mKeepAlivePendingIntent = PendingIntent.getBroadcast(this, 0, intent, PendingIntent.FLAG_IMMUTABLE); + } else { + mKeepAlivePendingIntent = PendingIntent.getBroadcast(this, 0, intent, PendingIntent.FLAG_ONE_SHOT); + } + ((AlarmManager) this.getSystemService(Context.ALARM_SERVICE)).setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + 60000, 60000, mKeepAlivePendingIntent); } @@ -399,8 +395,12 @@ //2.璁剧疆VP8銆丠264銆丠265 绛夊惎鐢� PayloadType[] ptVideoList = mCore.getVideoPayloadTypes(); for (PayloadType pt : ptVideoList) { -// HDLLog.i("VideoPayload", pt.getMimeType()); - pt.enable(true); + HDLLog.i("VideoPayload", pt.getMimeType()); + if ("VP8".equals(pt.getMimeType())){ + pt.enable(false); + }else { + pt.enable(true); + } } mCore.setVideoPayloadTypes(ptVideoList); } diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/dialog/LinphoneCommonDialog.java b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/dialog/LinphoneCommonDialog.java new file mode 100644 index 0000000..cc0acaa --- /dev/null +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/dialog/LinphoneCommonDialog.java @@ -0,0 +1,110 @@ +package com.hdl.hdllinphonesdk.dialog; + +import android.app.Dialog; +import android.content.Context; +import android.content.Intent; +import android.net.Uri; +import android.provider.Settings; +import android.util.Log; +import android.view.Display; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.view.WindowManager; +import android.widget.TextView; + +import com.hdl.hdllinphonesdk.R; + +public class LinphoneCommonDialog { + + private Dialog commonPd; + private volatile static LinphoneCommonDialog mInstance; + + public LinphoneCommonDialog() { + } + + public static LinphoneCommonDialog getInstance() { + if (mInstance == null) { + synchronized (LinphoneCommonDialog.class) { + if (mInstance == null) { + mInstance = new LinphoneCommonDialog(); + } + } + } + return mInstance; + } + + public void showDialog(Context context, String tip, String okButton, OnOKClickListener listener) { + + if (commonPd != null) { + try { + commonPd.show(); + } catch (Exception e) { + + } + } else { + Dialog dialog = new Dialog(context, R.style.common_dialog); + View view = LayoutInflater.from(context).inflate(R.layout.linphone_dialog_content_and_twobutton, null); + dialog.setContentView(view, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); + + TextView tvTitle = view.findViewById(R.id.tv_content_tip); + tvTitle.setText(tip); + + TextView tvCancel = view.findViewById(R.id.dialog_cancel_btn); + TextView tvOk = view.findViewById(R.id.dialog_ok_btn); + tvOk.setText(okButton); + tvCancel.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + dismiss(); + } + }); + tvOk.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + dismiss(); + listener.onOKClick(); + } + }); + + WindowManager windowManager = dialog.getWindow().getWindowManager(); + Display display = windowManager.getDefaultDisplay(); + WindowManager.LayoutParams lp = dialog.getWindow().getAttributes(); + lp.width = (int) (display.getWidth() * 0.8); //璁剧疆瀹藉害 + dialog.getWindow().setAttributes(lp); + + commonPd = dialog; + commonPd.show(); + } + } + + public void dismiss() { + try { + if (commonPd != null) { + commonPd.dismiss(); + commonPd = null; + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + public interface OnOKClickListener { + void onOKClick(); + } + + public void showSettingPermissionDialog(Context context, String permission) { + Log.d("panlili", "LinphoneCommonDialog.java:showSettingPermissionDialog-----> "); + showDialog(context, permission, context.getString(R.string.linphone_text_open_settings), new LinphoneCommonDialog.OnOKClickListener() { + @Override + public void onOKClick() { + Intent intent = new Intent(); + intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); + Uri uri = Uri.fromParts("package", context.getPackageName(), null); + intent.setData(uri); + context.startActivity(intent); + } + }); + } + +} diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/receiver/CallBroadcastReceiver.java b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/receiver/CallBroadcastReceiver.java new file mode 100644 index 0000000..934a2a2 --- /dev/null +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/receiver/CallBroadcastReceiver.java @@ -0,0 +1,37 @@ +package com.hdl.hdllinphonesdk.receiver; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.text.TextUtils; + +/** + * Created by panlili on 2023/10/11 + * description: + */ +public class CallBroadcastReceiver extends BroadcastReceiver { + + private static CallBroadcastListener listener; + public static final String CALL_RECEIVED_ACTION = "com.hdl.homepro.call.action"; + + @Override + public void onReceive(Context context, Intent intent) { + if (intent.getAction().equals(CALL_RECEIVED_ACTION)) { + String callFrom = intent.getStringExtra("callFrom"); + if (!TextUtils.isEmpty(callFrom)) { + if (listener != null) { + listener.onReceived(callFrom); + } + } + } + } + + //鍥炶皟鎺ュ彛 + public interface CallBroadcastListener { + public void onReceived(String callFrom); + } + + public void setOnReceivedCallBroadcastListener(CallBroadcastListener listener) { + this.listener = listener; + } +} diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/dialog_cancel_btn_normal_bg.xml b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/dialog_cancel_btn_normal_bg.xml new file mode 100644 index 0000000..c633139 --- /dev/null +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/dialog_cancel_btn_normal_bg.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android"> + + <!-- 鍦嗚 --> + <corners android:bottomLeftRadius="18dp" /> + + <!-- 濉厖 --> + <solid android:color="@android:color/white" /><!-- 濉厖鐨勯鑹� --> + +</shape> \ No newline at end of file diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/dialog_cancel_btn_press_bg.xml b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/dialog_cancel_btn_press_bg.xml new file mode 100644 index 0000000..0a651d9 --- /dev/null +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/dialog_cancel_btn_press_bg.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android"> + + <!-- 鍦嗚 --> + <corners android:bottomLeftRadius="18dp" /> + + <!-- 濉厖 --> + <solid android:color="@color/color_F5F5F5" /><!-- 濉厖鐨勯鑹� --> + +</shape> \ No newline at end of file diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/dialog_cancel_btn_selector.xml b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/dialog_cancel_btn_selector.xml new file mode 100644 index 0000000..210c025 --- /dev/null +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/dialog_cancel_btn_selector.xml @@ -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/dialog_cancel_btn_press_bg" android:state_pressed="true" /> + <item android:drawable="@drawable/dialog_cancel_btn_press_bg" android:state_focused="true" /> + <item android:drawable="@drawable/dialog_cancel_btn_normal_bg" /> +</selector> \ No newline at end of file diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/dialog_ok_btn_normal_bg.xml b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/dialog_ok_btn_normal_bg.xml new file mode 100644 index 0000000..76ee54d --- /dev/null +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/dialog_ok_btn_normal_bg.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android"> + + <!-- 鍦嗚 --> + <corners android:bottomRightRadius="18dp" /> + + <!-- 濉厖 --> + <solid android:color="@android:color/white" /><!-- 濉厖鐨勯鑹� --> + +</shape> \ No newline at end of file diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/dialog_ok_btn_press_bg.xml b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/dialog_ok_btn_press_bg.xml new file mode 100644 index 0000000..2455340 --- /dev/null +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/dialog_ok_btn_press_bg.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android"> + + <!-- 鍦嗚 --> + <corners android:bottomRightRadius="18dp" /> + + <!-- 濉厖 --> + <solid android:color="@color/color_F5F5F5" /><!-- 濉厖鐨勯鑹� --> + +</shape> \ No newline at end of file diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/dialog_ok_btn_selector.xml b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/dialog_ok_btn_selector.xml new file mode 100644 index 0000000..c7ce7dc --- /dev/null +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/dialog_ok_btn_selector.xml @@ -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/dialog_ok_btn_press_bg" android:state_pressed="true" /> + <item android:drawable="@drawable/dialog_ok_btn_press_bg" android:state_focused="true" /> + <item android:drawable="@drawable/dialog_ok_btn_normal_bg" /> +</selector> \ No newline at end of file diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/ic_esvideo_on_hangup.png b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/ic_esvideo_on_hangup.png index 01258fc..1b51f15 100644 --- a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/ic_esvideo_on_hangup.png +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/ic_esvideo_on_hangup.png Binary files differ diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/ic_esvideo_on_hangupall.png b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/ic_esvideo_on_hangupall.png new file mode 100644 index 0000000..01258fc --- /dev/null +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/ic_esvideo_on_hangupall.png Binary files differ diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/oval_color_white_18.xml b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/oval_color_white_18.xml new file mode 100644 index 0000000..ba27960 --- /dev/null +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/drawable/oval_color_white_18.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item> + <shape> + <solid android:color="@color/white" /> + <corners android:topLeftRadius="18dp" + android:topRightRadius="18dp" + android:bottomLeftRadius="18dp" + android:bottomRightRadius="18dp"/> + </shape> + </item> +</selector> \ 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 0306a53..60bf26e 100644 --- a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/layout/activity_hdllinphone_intercom.xml +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/layout/activity_hdllinphone_intercom.xml @@ -5,11 +5,31 @@ android:background="@android:color/white" android:orientation="vertical"> + <View + android:id="@+id/id_top" + android:layout_width="match_parent" + android:layout_height="44dp" + android:background="@color/white" /> + <RelativeLayout android:id="@+id/rl_lp_topView" android:layout_width="match_parent" android:layout_height="44dp" - android:background="@color/lpsdk_app_bg"> + android:background="@color/white"> + + <RelativeLayout + android:id="@+id/ll_lp_btn_back" + android:layout_width="64dp" + android:layout_height="44dp"> + + <ImageView + android:layout_width="20dp" + android:layout_height="20dp" + android:layout_centerVertical="true" + android:layout_marginStart="16dp" + android:src="@drawable/ic_esvideo_on_back" /> + + </RelativeLayout> <TextView android:id="@+id/tv_lp_title" @@ -21,7 +41,7 @@ android:gravity="center" android:text="瀹ゅ唴鏈�" android:textColor="@color/lpsdk_textColor" - android:textSize="18sp"/> + android:textSize="18sp"></TextView> </RelativeLayout> @@ -44,6 +64,7 @@ android:orientation="horizontal"> <RelativeLayout + android:id="@+id/rl_lp_screenshot" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1"> @@ -62,6 +83,7 @@ </RelativeLayout> <RelativeLayout + android:id="@+id/rl_lp_unlock" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1"> @@ -155,6 +177,32 @@ </RelativeLayout> <RelativeLayout + android:id="@+id/rl_lp_hangUpallView" + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_weight="1"> + + <ImageView + android:id="@+id/iv_lp_hangUpall" + android:layout_width="66dp" + android:layout_height="66dp" + android:layout_centerHorizontal="true" + android:scaleType="fitCenter" + android:src="@drawable/ic_esvideo_on_hangupall" /> + + <TextView + android:id="@+id/tv_lp_hangUpall" + android:layout_width="match_parent" + android:layout_height="20dp" + android:layout_alignParentBottom="true" + android:gravity="center" + android:text="@string/lp_hangupStr_all" + android:textColor="@color/lpsdk_textColor" + android:textSize="14sp" /> + + </RelativeLayout> + + <RelativeLayout android:id="@+id/rl_lp_answerView" android:layout_width="0dp" android:layout_height="match_parent" diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/layout/activity_hdllinphone_monitor.xml b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/layout/activity_hdllinphone_monitor.xml index 0439297..db38897 100644 --- a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/layout/activity_hdllinphone_monitor.xml +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/layout/activity_hdllinphone_monitor.xml @@ -1,26 +1,33 @@ <?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" android:orientation="vertical"> + <View + android:id="@+id/id_top" + android:layout_width="match_parent" + android:layout_height="44dp" + android:background="@color/white" /> + <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/white"> <RelativeLayout android:id="@+id/ll_lp_btn_back" - android:layout_width="44dp" + android:layout_width="64dp" android:layout_height="44dp"> + <ImageView android:layout_width="20dp" android:layout_height="20dp" - android:layout_centerInParent="true" - android:src="@drawable/ic_esvideo_on_back"/> + android:layout_centerVertical="true" + android:layout_marginStart="16dp" + android:src="@drawable/ic_esvideo_on_back" /> </RelativeLayout> @@ -28,14 +35,13 @@ 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> @@ -45,10 +51,11 @@ 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> <RelativeLayout @@ -58,7 +65,7 @@ <TextureView android:id="@+id/video_lp_rendering2" android:layout_width="1dp" - android:layout_height="1dp"/> + android:layout_height="1dp" /> <LinearLayout @@ -68,51 +75,54 @@ android:layout_marginTop="66dp"> <RelativeLayout + android:id="@+id/rl_screenshot" 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="66dp" android:layout_height="66dp" - android:scaleType="fitCenter" + android:layout_centerHorizontal="true" android:background="@drawable/btn_click_lp_screenshot" - android:layout_centerHorizontal="true"/> + android:scaleType="fitCenter" /> + <TextView android:id="@+id/tv_lp_screenshot" android:layout_width="match_parent" android:layout_height="20dp" - android:text="@string/lp_screenshotStr" + android:layout_alignParentBottom="true" android:gravity="center" + android:text="@string/lp_screenshotStr" android:textColor="@color/lpsdk_textColor" - android:textSize="14sp" - android:layout_alignParentBottom="true"/> + android:textSize="14sp" /> </RelativeLayout> <RelativeLayout - android:id="@+id/rl_lp_unlock" + android:id="@+id/rl_unlock" 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="66dp" android:layout_height="66dp" - android:scaleType="fitCenter" - android:background="@drawable/btn_click_lp_unlock" android:layout_centerHorizontal="true" - ></ImageView> + android:background="@drawable/btn_click_lp_unlock" + android:scaleType="fitCenter"></ImageView> + <TextView android:id="@+id/tv_lp_unlock" android:layout_width="match_parent" android:layout_height="20dp" - android:text="@string/lp_unlockStr" - android:gravity="center" - android:textColor="@color/lpsdk_textColor" - android:textSize="14sp" android:layout_alignParentBottom="true" - ></TextView> + android:gravity="center" + android:text="@string/lp_unlockStr" + android:textColor="@color/lpsdk_textColor" + android:textSize="14sp"></TextView> </RelativeLayout> diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/layout/linphone_dialog_content_and_twobutton.xml b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/layout/linphone_dialog_content_and_twobutton.xml new file mode 100644 index 0000000..8f122e2 --- /dev/null +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/layout/linphone_dialog_content_and_twobutton.xml @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <RelativeLayout + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_centerInParent="true" + android:background="@drawable/oval_color_white_18"> + + <TextView + android:id="@+id/tv_content_tip" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_centerHorizontal="true" + android:layout_marginTop="43dp" + android:textColor="@color/color_222222" + android:textSize="18sp" /> + + <View + android:id="@+id/view_split" + android:layout_width="match_parent" + android:layout_height="1dp" + android:layout_below="@id/tv_content_tip" + android:layout_marginTop="56dp" + android:background="@color/white" /> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_below="@id/view_split" + android:gravity="center_vertical" + android:orientation="horizontal"> + + <TextView + android:id="@+id/dialog_cancel_btn" + android:layout_width="0dp" + android:layout_height="52dp" + android:layout_weight="1" + android:background="@drawable/dialog_cancel_btn_selector" + android:gravity="center" + android:text="@string/lp_cancel" + android:textColor="@color/color_999999" + android:textSize="18sp" /> + + <View + android:layout_width="1dp" + android:layout_height="23dp" + android:background="@color/color_E1E1E1" /> + + <TextView + android:id="@+id/dialog_ok_btn" + android:layout_width="0dp" + android:layout_height="52dp" + android:layout_weight="1" + android:background="@drawable/dialog_ok_btn_selector" + android:gravity="center" + android:textColor="@color/color_5C62FE" + android:textSize="18sp" /> + </LinearLayout> + + </RelativeLayout> + +</RelativeLayout> \ No newline at end of file diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/values-zh/strings.xml b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/values-zh/strings.xml index f8c1f37..d000d09 100644 --- a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/values-zh/strings.xml +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/values-zh/strings.xml @@ -3,11 +3,12 @@ <string name="lp_tipStr">鎻愮ず</string> <string name="lp_okStr">纭</string> - <string name="lp_saveToTheAlbumsStr">宸蹭繚瀛樿嚦鎵嬫満鐩稿唽."</string> + <string name="lp_saveToTheAlbumsStr">宸蹭繚瀛樿嚦鎵嬫満鐩稿唽</string> <string name="lp_operationFailedStr">鎿嶄綔澶辫触</string> - <string name="lp_refuseStr">鎷掔粷</string> + <string name="lp_refuseStr">鎷掓帴</string> <string name="lp_answerStr">鎺ュ惉</string> <string name="lp_hangupStr">鎸傛柇</string> + <string name="lp_hangupStr_all">鍏ㄩ儴鎷掓帴</string> <string name="lp_unlockSuccessfullyStr">寮�閿佹垚鍔�</string> <string name="lp_unlockfailureStr">寮�閿佸け璐�</string> <string name="lp_callingStr">鏉ョ數涓�...</string> @@ -23,4 +24,6 @@ <string name="lp_confirm">纭</string> <string name="tip_confirm_unlock">纭畾鎵撳紑闂ㄩ攣鍚楋紵</string> + <string name="open_save_permission">璇峰厛寮�鍚瓨鍌ㄦ巿鏉�</string> + <string name="linphone_text_open_settings">璁剧疆</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 8f0c108..3012cbc 100644 --- a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/values/colors.xml +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/values/colors.xml @@ -5,5 +5,12 @@ <color name="lpsdk_app_line">#6D798D</color> <color name="lpsdk_textColor">#1B2D4D</color> <color name="lpsdk_color_white">#FFFFFF</color> + <color name="transparent">#00000000</color> + <color name="white">#FFFFFFFF</color> + <color name="color_222222">#222222</color> + <color name="color_F5F5F5">#F5F5F5</color> + <color name="color_999999">#999999</color> + <color name="color_E1E1E1">#E1E1E1</color> + <color name="color_5C62FE">#5C62FE</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 ead4430..63f8e21 100644 --- a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/values/strings.xml +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/values/strings.xml @@ -2,11 +2,12 @@ <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_saveToTheAlbumsStr">Saved to the albums</string> + <string name="lp_operationFailedStr">Operation failed</string> + <string name="lp_refuseStr">Reject</string> <string name="lp_answerStr">Answer</string> <string name="lp_hangupStr">Hang up</string> + <string name="lp_hangupStr_all">Reject All</string> <string name="lp_unlockSuccessfullyStr">Unlock successfully</string> <string name="lp_unlockfailureStr">Unlock failure</string> <string name="lp_callingStr">Incoming call</string> @@ -21,5 +22,7 @@ <string name="lp_confirm">Confirm</string> <string name="tip_confirm_unlock">Are you sure to open the door lock?</string> + <string name="open_save_permission">Please enable storage authorization first</string> + <string name="linphone_text_open_settings">Settings</string> </resources> diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/values/styles.xml b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/values/styles.xml index 7d055ad..12cf380 100644 --- a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/values/styles.xml +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/values/styles.xml @@ -29,5 +29,22 @@ <item name="android:windowMinWidthMinor">75%</item> </style> + <style name="common_dialog" parent="@android:style/Theme.Dialog"> + <!-- 鑳屾櫙棰滆壊鍙婂拰閫忔槑绋嬪害 --> + <item name="android:windowBackground">@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:windowIsTranslucent">true</item> + <!-- 鏄惁寮�鍚崐閫忔槑鐨勮儗鏅� --> + <item name="android:backgroundDimEnabled">true</item> + <!-- 鍗婇�忔槑鐨勮儗鏅殑閫忔槑搴� --> + <item name="android:backgroundDimAmount">0.2</item> + <item name="android:background">@color/transparent</item> + </style> + </resources> diff --git a/HDLLinphoneSDKDemoNew/app/src/main/AndroidManifest.xml b/HDLLinphoneSDKDemoNew/app/src/main/AndroidManifest.xml index 7253355..109fe10 100644 --- a/HDLLinphoneSDKDemoNew/app/src/main/AndroidManifest.xml +++ b/HDLLinphoneSDKDemoNew/app/src/main/AndroidManifest.xml @@ -11,7 +11,7 @@ android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/Theme.HDLLinphoneSDKDemo"> - <activity android:name=".LinphoneTestActivity"> + <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> diff --git a/HDLLinphoneSDKDemoNew/app/src/main/java/com/example/hdllinphonesdkdemo/LinphoneTestActivity.java b/HDLLinphoneSDKDemoNew/app/src/main/java/com/example/hdllinphonesdkdemo/LinphoneTestActivity.java index 9a5cc42..5662fe4 100644 --- a/HDLLinphoneSDKDemoNew/app/src/main/java/com/example/hdllinphonesdkdemo/LinphoneTestActivity.java +++ b/HDLLinphoneSDKDemoNew/app/src/main/java/com/example/hdllinphonesdkdemo/LinphoneTestActivity.java @@ -16,7 +16,7 @@ public class LinphoneTestActivity extends Activity { - private static final String password = "xFNxyrTIM8gLAOGDw3OiuzV5F"; + private static final String password = "Wc7SeYXb0oyGOXVvtUYtju2Dy"; private static final String serverIP = "47.96.88.250:25060";//""116.62.26.215:35060"; private String account = ""; @@ -26,7 +26,7 @@ // 鍛煎彨 private EditText numberEdit; - private Button callBtn,monitorBtn; + private Button callBtn, monitorBtn; @Override protected void onCreate(Bundle savedInstanceState) { @@ -54,7 +54,6 @@ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.putExtra(HDLLinphoneKit.KEY_SIP_ACCOUNT, number); startActivity(intent); -// HDLLinphoneKit.getInstance().callTo(number, true); }); monitorBtn = findViewById(R.id.monitor_btn); @@ -88,6 +87,11 @@ } @Override + public void onRejectCallAllAction() { + + } + + @Override public void onUnlockAction() { // } 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 a8c50eb..da988a8 100644 --- a/HDLLinphoneSDKDemoNew/app/src/main/java/com/example/hdllinphonesdkdemo/MainActivity.java +++ b/HDLLinphoneSDKDemoNew/app/src/main/java/com/example/hdllinphonesdkdemo/MainActivity.java @@ -48,11 +48,11 @@ HDLLinphoneKit.INTER_PHONE_TYPE_HDL )); - mTextView4.setOnClickListener(v -> HDLLinphoneKit.getInstance().setAccountAndLogin("8888", "85521566", "47.96.88.250:35060", HDLLinphoneKit.INTER_PHONE_TYPE_FREEVIEW)); + mTextView4.setOnClickListener(v -> HDLLinphoneKit.getInstance().setAccountAndLogin("A183372453821457", "592436", "139.159.157.75:47000", HDLLinphoneKit.INTER_PHONE_TYPE_FREEVIEW)); 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("sip:D26-11-1@139.159.157.75:46000", true); // HDLLinphoneKit.getInstance().callTo("D22-1-21-1", true); startActivity(HDLLinphoneMonitorActivity.class); }); @@ -87,6 +87,11 @@ } @Override + public void onRejectCallAllAction() { + + } + + @Override public void onUnlockAction() { // } diff --git a/HDLLinphoneSDKDemoNew/app/src/main/res/layout/activity_linphone_test.xml b/HDLLinphoneSDKDemoNew/app/src/main/res/layout/activity_linphone_test.xml index 4436191..1cb6f00 100644 --- a/HDLLinphoneSDKDemoNew/app/src/main/res/layout/activity_linphone_test.xml +++ b/HDLLinphoneSDKDemoNew/app/src/main/res/layout/activity_linphone_test.xml @@ -28,7 +28,7 @@ android:layout_height="wrap_content" android:layout_weight="1" android:inputType="number" - android:text="1677890543690887170" + android:text="1701147661269118978" /> <Button @@ -64,7 +64,7 @@ android:layout_height="wrap_content" android:layout_weight="1" android:inputType="number" - android:text="1684889786171437057" + android:text="1701147553936879618" /> <Button diff --git a/HDLLinphoneSDKDemoNew/app/src/main/res/layout/activity_main.xml b/HDLLinphoneSDKDemoNew/app/src/main/res/layout/activity_main.xml index ed7cc22..5b71e67 100644 --- a/HDLLinphoneSDKDemoNew/app/src/main/res/layout/activity_main.xml +++ b/HDLLinphoneSDKDemoNew/app/src/main/res/layout/activity_main.xml @@ -22,7 +22,7 @@ android:layout_marginTop="30dp" android:background="@android:color/holo_blue_light" android:gravity="center" - android:text="鐧诲綍2" + android:text="鍏ㄨ閫氱櫥褰�" android:textColor="@android:color/white" /> <TextView diff --git a/HDLLinphoneSDKDemoNew/gradle.properties b/HDLLinphoneSDKDemoNew/gradle.properties index fbf26e6..612fd84 100644 --- a/HDLLinphoneSDKDemoNew/gradle.properties +++ b/HDLLinphoneSDKDemoNew/gradle.properties @@ -10,4 +10,10 @@ # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true \ No newline at end of file +# org.gradle.parallel=true +#android.useAndroidX=true +## Enables namespacing of each library's R class so that its R class includes only the +## resources declared in the library itself and none from the library's dependencies, +## thereby reducing the size of the R class for that library +#android.nonTransitiveRClass=true +#android.enableJetifier=true \ No newline at end of file diff --git a/HDLLinphoneSDKDemoNew/gradle/wrapper/gradle-wrapper.properties b/HDLLinphoneSDKDemoNew/gradle/wrapper/gradle-wrapper.properties index a09e6bb..ffed3a2 100644 --- a/HDLLinphoneSDKDemoNew/gradle/wrapper/gradle-wrapper.properties +++ b/HDLLinphoneSDKDemoNew/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,5 @@ -#Tue Aug 03 14:20:14 CST 2021 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -#distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip -- Gitblit v1.8.0