[Switch submodule branch] Merge branch 'dev_new_java_wrapper' into dev_group_chat

This commit is contained in:
Sylvain Berfini 2017-10-19 14:07:23 +02:00
commit 172ba40611
154 changed files with 4052 additions and 2994 deletions

6
.gitmodules vendored
View file

@ -112,3 +112,9 @@
[submodule "submodules/bcmatroska2"] [submodule "submodules/bcmatroska2"]
path = submodules/bcmatroska2 path = submodules/bcmatroska2
url = git://git.linphone.org/bcmatroska2.git url = git://git.linphone.org/bcmatroska2.git
[submodule "submodules/externals/xerces-c"]
path = submodules/externals/xerces-c
url = git://git.linphone.org/xerces-c.git
[submodule "submodules/externals/libxsd"]
path = submodules/externals/libxsd
url = git://git.linphone.org/libxsd

View file

@ -2,7 +2,7 @@
<manifest package="org.linphone" <manifest package="org.linphone"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:installLocation="auto" android:installLocation="auto"
android:versionCode="3282" android:versionCode="3284"
android:versionName="3.2.8"> android:versionName="3.2.8">
<uses-sdk <uses-sdk
@ -115,6 +115,10 @@
<data android:mimeType="video/*"/> <data android:mimeType="video/*"/>
<data android:mimeType="application/*"/> <data android:mimeType="application/*"/>
</intent-filter> </intent-filter>
<intent-filter>
<action android:name="org.linphone.intent.action.CallLaunched" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity> </activity>
<activity <activity
android:name=".LinphoneActivity" android:name=".LinphoneActivity"
@ -256,6 +260,12 @@
</intent-filter> </intent-filter>
</receiver> </receiver>
<receiver android:name=".OutgoingCallReceiver"
android:permission="android.permission.PROCESS_OUTGOING_CALLS">
<intent-filter>
<action android:name="android.intent.action.NEW_OUTGOING_CALL" />
</intent-filter>
</receiver>
<!-- Needed for push notification --> <!-- Needed for push notification -->
<!-- <!--
<receiver <receiver

View file

@ -2,7 +2,7 @@
<manifest package="org.linphone" <manifest package="org.linphone"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:installLocation="auto" android:installLocation="auto"
android:versionCode="3280" android:versionCode="3284"
android:versionName="3.2.8"> android:versionName="3.2.8">
<uses-sdk <uses-sdk

View file

@ -12,6 +12,15 @@ Group changes to describe their impact on the project, as follows:
## [Incomming] ## [Incomming]
## [3.2.8]
### Added
- File sharing
### Fixed
- Crashs in new chat view
- Contacts management
## [3.2.7] - 2017-05-15 ## [3.2.7] - 2017-05-15
### Fixed ### Fixed

View file

@ -4,11 +4,11 @@ Linphone is a free VoIP and video softphone based on the SIP protocol.
## To build liblinphone for Android, you must: ## To build liblinphone for Android, you must:
1. Download the Android sdk (API 25.2.3 at max) with platform-tools and tools updated to latest revision, then add both 'tools' and 'platform-tools' folders in your path and the android-sdk folder to ANDROID_HOME environment variable. 1. Download the Android sdk (API 26.0.1 at max) with platform-tools and tools updated to latest revision, then add both 'tools' and 'platform-tools' folders in your path and the android-sdk folder to ANDROID_HOME environment variable.
2. Download the Android ndk (version r11c or 13b) from google and add it to your path (no symlink !!!) and ANDROID_NDK environment variable. 2. Download the Android ndk (version r11c or 15) from google and add it to your path (no symlink !!!) and ANDROID_NDK environment variable.
3. Install _yasm_, _nasm_, _ant_, _python_, _intltoolize_, _cmake_ and _vim-common_. 3. Install _yasm_, _nasm_, _ant_, _python_, _intltoolize_, _cmake(3.7)_ and _vim-common_.
* On 64 bits linux systems you'll need the _ia32-libs_ package. * On 64 bits linux systems you'll need the _ia32-libs_ package.
* With the latest Debian (multiarch), you need this: * With the latest Debian (multiarch), you need this:
* `dpkg --add-architecture i386` * `dpkg --add-architecture i386`

View file

@ -45,7 +45,7 @@ dependencies {
androidTestCompile 'junit:junit:+' androidTestCompile 'junit:junit:+'
compile 'org.apache.commons:commons-compress:+' compile 'org.apache.commons:commons-compress:+'
if (firebaseEnable()) { if (firebaseEnable()) {
compile 'com.google.firebase:firebase-messaging:11.2.0' compile 'com.google.firebase:firebase-messaging:11.4.0'
} else { } else {
compile fileTree(include: 'gcm.jar', dir: 'libs') compile fileTree(include: 'gcm.jar', dir: 'libs')
compile 'com.android.support:support-v4:+' compile 'com.android.support:support-v4:+'
@ -58,10 +58,7 @@ if (firebaseEnable()) {
//// Submodule Dir ///// //// Submodule Dir /////
def submoduleDir = ['submodules/mediastreamer2/java/src', def submoduleDir = ['submodules/mediastreamer2/java/src',
'submodules/linphone/java/j2se', 'liblinphone-sdk/android-arm64/share/linphonej/java/']
'submodules/linphone/java/common',
'submodules/linphone/java/impl',
'submodules/linphone/coreapi/help/examples/java']
//////////////////////// ////////////////////////
///// Exclude Files ///// ///// Exclude Files /////
@ -75,6 +72,7 @@ if (!firebaseEnable()) {
println '[Push Notification] Firebase enabled' println '[Push Notification] Firebase enabled'
} }
excludeFiles.add('**/mediastream/MediastreamerActivity.java') excludeFiles.add('**/mediastream/MediastreamerActivity.java')
excludeFiles.add('src/android/org/linphone/tutorials/*.java')
def excludePackage = [] def excludePackage = []
@ -87,7 +85,7 @@ excludePackage.add('**/LICENSE.txt')
android { android {
defaultConfig { defaultConfig {
compileSdkVersion 26 compileSdkVersion 26
buildToolsVersion "26.0.0" buildToolsVersion "26.0.2"
applicationId getPackageName() applicationId getPackageName()
multiDexEnabled true multiDexEnabled true

135
linphone.iml Normal file
View file

@ -0,0 +1,135 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="linphone" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":" />
</configuration>
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<afterSyncTasks>
<task>generateDebugSources</task>
</afterSyncTasks>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/bin/intermediates/classes/debug" />
<output-test url="file://$MODULE_DIR$/bin/intermediates/classes/test/debug" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/bin/generated/source/r/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/bin/generated/source/aidl/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/bin/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/bin/generated/source/rs/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/bin/generated/source/apt/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/bin/generated/res/google-services/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/bin/generated/res/rs/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/bin/generated/res/resValues/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/bin/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/bin/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/bin/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/bin/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/bin/generated/source/apt/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/bin/generated/res/rs/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/bin/generated/res/resValues/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build-types/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build-types/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build-types/debug/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build-types/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build-types/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build-types/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build-types/debug/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/submodules/mediastreamer2/java/src" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/liblinphone-sdk/android-arm64/share/linphonej/java" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/android" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/submodules/mediastreamer2/java/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/liblinphone-sdk/android-arm64/share/linphonej/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/android" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/submodules/mediastreamer2/java/src" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/liblinphone-sdk/android-arm64/share/linphonej/java" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/android" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/submodules/mediastreamer2/java/src" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/liblinphone-sdk/android-arm64/share/linphonej/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/android" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/bin/android-profile" />
<excludeFolder url="file://$MODULE_DIR$/bin/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/bin/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/bin/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/bin/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/bin/intermediates/incremental-safeguard" />
<excludeFolder url="file://$MODULE_DIR$/bin/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/bin/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/bin/intermediates/multi-dex" />
<excludeFolder url="file://$MODULE_DIR$/bin/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/bin/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/bin/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/bin/intermediates/shaders" />
<excludeFolder url="file://$MODULE_DIR$/bin/intermediates/sourceFolderJavaResources" />
<excludeFolder url="file://$MODULE_DIR$/bin/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/bin/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/bin/outputs" />
<excludeFolder url="file://$MODULE_DIR$/bin/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 26 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" scope="TEST" name="robotium-solo-5.6.3" level="project" />
<orderEntry type="library" exported="" name="firebase-core-11.4.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="hamcrest-library-1.3" level="project" />
<orderEntry type="library" exported="" name="firebase-iid-11.4.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="hamcrest-integration-1.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="espresso-core-3.0.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="espresso-idling-resource-3.0.1" level="project" />
<orderEntry type="library" exported="" name="support-core-ui-25.2.0" level="project" />
<orderEntry type="library" exported="" name="play-services-basement-11.4.0" level="project" />
<orderEntry type="library" exported="" name="objenesis-2.6" level="project" />
<orderEntry type="library" exported="" name="firebase-messaging-11.4.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="jsr305-2.0.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="runner-1.0.1" level="project" />
<orderEntry type="library" exported="" name="support-core-utils-25.2.0" level="project" />
<orderEntry type="library" exported="" name="support-fragment-25.2.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="multidex-instrumentation-1.0.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="javax.inject-1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="kxml2-2.3.0" level="project" />
<orderEntry type="library" exported="" name="support-v4-25.2.0" level="project" />
<orderEntry type="library" exported="" name="support-compat-25.2.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="javawriter-2.1.1" level="project" />
<orderEntry type="library" exported="" name="multidex-1.0.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="hamcrest-core-1.3" level="project" />
<orderEntry type="library" exported="" name="firebase-analytics-11.4.0" level="project" />
<orderEntry type="library" exported="" name="firebase-analytics-impl-11.4.0" level="project" />
<orderEntry type="library" exported="" name="support-media-compat-25.2.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="junit-4.12" level="project" />
<orderEntry type="library" exported="" name="commons-compress-1.15" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="rules-1.0.1" level="project" />
<orderEntry type="library" exported="" name="play-services-tasks-11.4.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-25.2.0" level="project" />
<orderEntry type="library" exported="" name="firebase-common-11.4.0" level="project" />
</component>
</module>

View file

@ -95,7 +95,7 @@ class AndroidPreparator(prepare.Preparator):
def __init__(self, targets=android_targets): def __init__(self, targets=android_targets):
prepare.Preparator.__init__(self, targets, default_targets=['armv7', 'arm64', 'x86']) prepare.Preparator.__init__(self, targets, default_targets=['armv7', 'arm64', 'x86'])
self.min_supported_ndk = 10 self.min_supported_ndk = 11
self.max_supported_ndk = 16 self.max_supported_ndk = 16
self.unsupported_ndk_version = None self.unsupported_ndk_version = None
self.min_cmake_version = "3.7" self.min_cmake_version = "3.7"

View file

@ -208,6 +208,16 @@
android:textColor="@color/colorB" android:textColor="@color/colorB"
android:textSize="12sp"/> android:textSize="12sp"/>
<TextView
android:id="@+id/estimatedDownloadBandwidth_video"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:text="@string/call_stats_estimated_download"
android:gravity="center"
android:textColor="@color/colorB"
android:textSize="12sp"/>
<TextView <TextView
android:id="@+id/ice_video" android:id="@+id/ice_video"
android:layout_width="match_parent" android:layout_width="match_parent"

View file

@ -1,6 +1,4 @@
[net]
download_bw=380
upload_bw=380
[sip] [sip]
contact="Linphone Android" <sip:linphone.android@unknown-host> contact="Linphone Android" <sip:linphone.android@unknown-host>
@ -12,7 +10,7 @@ sip_tcp_port=-1
sip_tls_port=-1 sip_tls_port=-1
[video] [video]
size=qvga size=vga
[app] [app]
tunnel=disabled tunnel=disabled

View file

@ -4,6 +4,9 @@
#Paths to resources must be set from LinphoneManager, after creating LinphoneCore. #Paths to resources must be set from LinphoneManager, after creating LinphoneCore.
[net] [net]
mtu=1300 mtu=1300
#Because dynamic bitrate adaption can increase bitrate, we must allow "no limit"
download_bw=0
upload_bw=0
[sip] [sip]
guess_hostname=1 guess_hostname=1

View file

@ -45,6 +45,7 @@
<string name="maybe_later">ربما لاحقا</string> <string name="maybe_later">ربما لاحقا</string>
<string name="later">لاحقا</string> <string name="later">لاحقا</string>
<string name="no">لا</string> <string name="no">لا</string>
<string name="ok">حسنا</string>
<string name="yes">نعم</string> <string name="yes">نعم</string>
<string name="link_account">اربط حسابك</string> <string name="link_account">اربط حسابك</string>
<!--Launch screen--> <!--Launch screen-->
@ -176,6 +177,9 @@
<string name="message_cant_be_decrypted_notif">تعذر عليك فك تعمية هذه الرسالة.</string> <string name="message_cant_be_decrypted_notif">تعذر عليك فك تعمية هذه الرسالة.</string>
<string name="lime_not_verified">إنك تحاول إرسال رسالة عبر LIME لجهة اتصال لم تتحقق منها بواسطة ZRTP.\nيُرجى الاتصال بجهة الاتصال هذه والتحقق من مفتاحها ZRTP قبل إرسال رسائلك.</string> <string name="lime_not_verified">إنك تحاول إرسال رسالة عبر LIME لجهة اتصال لم تتحقق منها بواسطة ZRTP.\nيُرجى الاتصال بجهة الاتصال هذه والتحقق من مفتاحها ZRTP قبل إرسال رسائلك.</string>
<string name="processing_image">قد تستلزم معالجة الصور بضع ثوان حسب حجم الملف.</string> <string name="processing_image">قد تستلزم معالجة الصور بضع ثوان حسب حجم الملف.</string>
<string name="displayed">قُرِأ</string>
<string name="delivered">سُلِّم</string>
<string name="resend">أعد اﻹرسال</string>
<!--Status Bar--> <!--Status Bar-->
<string name="status_connected">مُسجَّل</string> <string name="status_connected">مُسجَّل</string>
<string name="status_not_connected">غير مُسجَّل</string> <string name="status_not_connected">غير مُسجَّل</string>
@ -190,9 +194,14 @@
<!--Call--> <!--Call-->
<string name="incoming_call">مكالمة واردة</string> <string name="incoming_call">مكالمة واردة</string>
<string name="outgoing_call">مكالمة صادرة</string> <string name="outgoing_call">مكالمة صادرة</string>
<string name="add_video_dialog">يود مخاطبك تشغيل الفيديو </string>
<string name="no_current_call">لا وجود لأي مكالمة نشيطة</string> <string name="no_current_call">لا وجود لأي مكالمة نشيطة</string>
<string name="call_paused_by_remote">أوقف مخاطبك المكالمة مؤقتا </string>
<string name="couldnt_accept_call">حدث خطأ خلال قبول المكالمة</string> <string name="couldnt_accept_call">حدث خطأ خلال قبول المكالمة</string>
<string name="zrtp_dialog1">أكد رمز الاستيثاق مع نظيرك :\nقل : %s</string> <string name="zrtp_dialog1">أكد رمز الاستيثاق مع نظيرك :\nقل : %s</string>
<string name="zrtp_dialog2">\nمخاطبك يجب أن يقول : %s</string>
<string name="zrtp_notification_title">رمز الاستيثاق</string>
<string name="zrtp_notification_message">قم بتأكيد رمز الاستيثاق السابق مع مخاطبك</string>
<string name="unknown_incoming_call_name">مجهول</string> <string name="unknown_incoming_call_name">مجهول</string>
<string name="call_stats_audio">الصوت</string> <string name="call_stats_audio">الصوت</string>
<string name="call_stats_video">الفيديو</string> <string name="call_stats_video">الفيديو</string>
@ -229,6 +238,7 @@
<string name="error_user_busy">المستخدم مشغول</string> <string name="error_user_busy">المستخدم مشغول</string>
<string name="error_user_not_found">لم يعثر على المستخدم</string> <string name="error_user_not_found">لم يعثر على المستخدم</string>
<string name="error_incompatible_media">مُعامِلات الوسائط غير متوافقة</string> <string name="error_incompatible_media">مُعامِلات الوسائط غير متوافقة</string>
<string name="error_low_bandwidth">لمخاطبك سعة قناة ضيقة، لا يمكن بدء الفيديو</string>
<string name="error_network_unreachable">تعذر الوصول إلى الشبكة</string> <string name="error_network_unreachable">تعذر الوصول إلى الشبكة</string>
<string name="error_bad_credentials">الاعتمادات غير صحيحة</string> <string name="error_bad_credentials">الاعتمادات غير صحيحة</string>
<string name="error_unauthorized">غير مُصرَّح</string> <string name="error_unauthorized">غير مُصرَّح</string>
@ -319,6 +329,7 @@
<string name="pref_call_title">المكالمة</string> <string name="pref_call_title">المكالمة</string>
<string name="pref_device_ringtone">استخدم رنة الجهاز</string> <string name="pref_device_ringtone">استخدم رنة الجهاز</string>
<string name="pref_auto_answer">رد تلقائيا على المكالمات الواردة</string> <string name="pref_auto_answer">رد تلقائيا على المكالمات الواردة</string>
<string name="pref_auto_answer_time">مهلة التشغيل التلقائي (بالميلي-ثواني)</string>
<string name="pref_rfc2833_dtmf">أرسل DTMF مع التدفق (RFC2833)</string> <string name="pref_rfc2833_dtmf">أرسل DTMF مع التدفق (RFC2833)</string>
<string name="pref_sipinfo_dtmf">أرسل DTMF خارج التدفق (SIP INFO)</string> <string name="pref_sipinfo_dtmf">أرسل DTMF خارج التدفق (SIP INFO)</string>
<string name="pref_voice_mail">عنوان العلبة الصوتية</string> <string name="pref_voice_mail">عنوان العلبة الصوتية</string>
@ -443,4 +454,5 @@
<string name="content_description_call_options">خيارات المكالمة</string> <string name="content_description_call_options">خيارات المكالمة</string>
<string name="content_description_audio_route">توجيه الصوت</string> <string name="content_description_audio_route">توجيه الصوت</string>
<string name="content_description_exit_conference">مغادرة الاجتماع</string> <string name="content_description_exit_conference">مغادرة الاجتماع</string>
<string name="content_title_notification">إشعارات لِنْفُونْ</string>
</resources> </resources>

View file

@ -16,6 +16,7 @@
<string name="sync_account_name">Linphone-Kontakte</string> <string name="sync_account_name">Linphone-Kontakte</string>
<!--Common--> <!--Common-->
<string name="username">Benutzername</string> <string name="username">Benutzername</string>
<string name="userid">Benutzerkennung (optional)</string>
<string name="phone_number">Telefonnummer</string> <string name="phone_number">Telefonnummer</string>
<string name="display_name">Anzeigename</string> <string name="display_name">Anzeigename</string>
<string name="password">Passwort</string> <string name="password">Passwort</string>
@ -45,6 +46,7 @@
<string name="maybe_later">Vielleicht später</string> <string name="maybe_later">Vielleicht später</string>
<string name="later">Später</string> <string name="later">Später</string>
<string name="no">Nein</string> <string name="no">Nein</string>
<string name="ok">OK</string>
<string name="yes">Ja</string> <string name="yes">Ja</string>
<string name="link_account">Verknüpfen Sie Ihr Konto</string> <string name="link_account">Verknüpfen Sie Ihr Konto</string>
<!--Launch screen--> <!--Launch screen-->
@ -170,6 +172,7 @@
<string name="message_cant_be_decrypted_notif">Sie können diese Nachricht nicht entschlüsseln.</string> <string name="message_cant_be_decrypted_notif">Sie können diese Nachricht nicht entschlüsseln.</string>
<string name="processing_image">Bild wird verarbeitet. Je nach Größe der Datei kann dies mehrere Sekunden in Anspruch nehmen</string> <string name="processing_image">Bild wird verarbeitet. Je nach Größe der Datei kann dies mehrere Sekunden in Anspruch nehmen</string>
<string name="displayed">Lesen</string> <string name="displayed">Lesen</string>
<string name="delivered">Ausgeliefert</string>
<string name="resend">Erneut senden</string> <string name="resend">Erneut senden</string>
<!--Status Bar--> <!--Status Bar-->
<string name="status_connected">Registriert</string> <string name="status_connected">Registriert</string>
@ -185,9 +188,13 @@
<!--Call--> <!--Call-->
<string name="incoming_call">eingehender Anruf</string> <string name="incoming_call">eingehender Anruf</string>
<string name="outgoing_call">ausgehender Anruf</string> <string name="outgoing_call">ausgehender Anruf</string>
<string name="add_video_dialog">Ihr Anrufer möchte Video einschalten</string>
<string name="no_current_call">Kein aktiver Anruf</string> <string name="no_current_call">Kein aktiver Anruf</string>
<string name="call_paused_by_remote">Ihr Anrufer hat den Anruf pausiert</string> <string name="call_paused_by_remote">Ihr Anrufer hat den Anruf pausiert</string>
<string name="couldnt_accept_call">Beim Annehmen des Anrufs ist ein Fehler aufgetreten</string> <string name="couldnt_accept_call">Beim Annehmen des Anrufs ist ein Fehler aufgetreten</string>
<string name="zrtp_dialog2">\nIhr Anrufer sollte sagen: %s</string>
<string name="zrtp_notification_title">SAS</string>
<string name="zrtp_notification_message">Bestätigen Sie den vorherigen SAS-Code mit Ihrem Korrespondenten</string>
<string name="unknown_incoming_call_name">Unbekannt</string> <string name="unknown_incoming_call_name">Unbekannt</string>
<string name="call_stats_audio">Audio</string> <string name="call_stats_audio">Audio</string>
<string name="call_stats_video">Video</string> <string name="call_stats_video">Video</string>
@ -224,6 +231,7 @@
<string name="error_user_busy">Benutzer beschäftigt</string> <string name="error_user_busy">Benutzer beschäftigt</string>
<string name="error_user_not_found">Benutzer nicht gefunden</string> <string name="error_user_not_found">Benutzer nicht gefunden</string>
<string name="error_incompatible_media">Inkompatible Medienparameter</string> <string name="error_incompatible_media">Inkompatible Medienparameter</string>
<string name="error_low_bandwidth">Ihr Anrufer hat eine geringe Bandbreite, Video kann nicht gestartet werden</string>
<string name="error_network_unreachable">Netzwerk ist nicht erreichbar</string> <string name="error_network_unreachable">Netzwerk ist nicht erreichbar</string>
<string name="error_bad_credentials">Falsche Anmeldedaten</string> <string name="error_bad_credentials">Falsche Anmeldedaten</string>
<string name="error_unauthorized">Unzulässig</string> <string name="error_unauthorized">Unzulässig</string>
@ -327,6 +335,7 @@
<!--Network settings--> <!--Network settings-->
<string name="pref_network_title">Netzwerk</string> <string name="pref_network_title">Netzwerk</string>
<string name="pref_wifi_only">Nur WiFi verwenden</string> <string name="pref_wifi_only">Nur WiFi verwenden</string>
<string name="pref_doze_mode">Schlummermodus</string>
<string name="pref_stun_server">STUN / TURN-Server</string> <string name="pref_stun_server">STUN / TURN-Server</string>
<string name="pref_ice_enable">ICE aktivieren</string> <string name="pref_ice_enable">ICE aktivieren</string>
<string name="pref_turn_enable">TURN aktivieren</string> <string name="pref_turn_enable">TURN aktivieren</string>
@ -435,4 +444,5 @@
<string name="content_description_call_options">Anrufoptionen</string> <string name="content_description_call_options">Anrufoptionen</string>
<string name="content_description_audio_route">Audioroute</string> <string name="content_description_audio_route">Audioroute</string>
<string name="content_description_exit_conference">Konferenz beenden</string> <string name="content_description_exit_conference">Konferenz beenden</string>
<string name="content_title_notification">Linphone-Benachrichtigung</string>
</resources> </resources>

View file

@ -16,6 +16,7 @@
<string name="sync_account_name">linphone კონტაქტები</string> <string name="sync_account_name">linphone კონტაქტები</string>
<!--Common--> <!--Common-->
<string name="username">მომხმარებლის სახელი</string> <string name="username">მომხმარებლის სახელი</string>
<string name="userid">User-id (არასავალდებულო)</string>
<string name="phone_number">ტელეფონის ნომერი</string> <string name="phone_number">ტელეფონის ნომერი</string>
<string name="display_name">სახელი</string> <string name="display_name">სახელი</string>
<string name="password">პაროლი</string> <string name="password">პაროლი</string>
@ -45,6 +46,7 @@
<string name="maybe_later">შესაძლოა მოგვიანებით</string> <string name="maybe_later">შესაძლოა მოგვიანებით</string>
<string name="later">მოგვიანებით</string> <string name="later">მოგვიანებით</string>
<string name="no">არა</string> <string name="no">არა</string>
<string name="ok">OK</string>
<string name="yes">დიახ</string> <string name="yes">დიახ</string>
<string name="link_account">ანგარიშის მიბმა</string> <string name="link_account">ანგარიშის მიბმა</string>
<!--Launch screen--> <!--Launch screen-->
@ -197,6 +199,8 @@
<string name="couldnt_accept_call">ზარის მიღებისას მოხდა შეცდომა</string> <string name="couldnt_accept_call">ზარის მიღებისას მოხდა შეცდომა</string>
<string name="zrtp_dialog1">დაადასტურეთ შემდეგი SAS მომხმარებელთან:\nთქვით: %s</string> <string name="zrtp_dialog1">დაადასტურეთ შემდეგი SAS მომხმარებელთან:\nთქვით: %s</string>
<string name="zrtp_dialog2">\nთქვენმა მხმობელმა უნდა თქვას: %s</string> <string name="zrtp_dialog2">\nთქვენმა მხმობელმა უნდა თქვას: %s</string>
<string name="zrtp_notification_title">SAS</string>
<string name="zrtp_notification_message">დაადასტურეთ წინა SAS კოდი თქვენს მოკავშირესთან</string>
<string name="unknown_incoming_call_name">უცნობი</string> <string name="unknown_incoming_call_name">უცნობი</string>
<string name="call_stats_audio">ხმა</string> <string name="call_stats_audio">ხმა</string>
<string name="call_stats_video">ვიდეო</string> <string name="call_stats_video">ვიდეო</string>
@ -207,6 +211,8 @@
<string name="call_stats_ice">ICE კავშირი:</string> <string name="call_stats_ice">ICE კავშირი:</string>
<string name="call_stats_video_resolution_sent">გაგზავნილი ვიდეოს გაფართოება:</string> <string name="call_stats_video_resolution_sent">გაგზავნილი ვიდეოს გაფართოება:</string>
<string name="call_stats_video_resolution_received">მიღებული ვიდეოს გაფართოება:</string> <string name="call_stats_video_resolution_received">მიღებული ვიდეოს გაფართოება:</string>
<string name="call_stats_video_fps_sent">გაგზავნილი ვიდეოს კადრი/წმ:</string>
<string name="call_stats_video_fps_received">მიღებული ვიდეოს კადრი/წმ:</string>
<string name="call_stats_sender_loss_rate">გამგზავნის დაკარგვის სიხშირე:</string> <string name="call_stats_sender_loss_rate">გამგზავნის დაკარგვის სიხშირე:</string>
<string name="call_stats_receiver_loss_rate">მიმღების დაკარგვის სიხშირე:</string> <string name="call_stats_receiver_loss_rate">მიმღების დაკარგვის სიხშირე:</string>
<string name="call_stats_jitter_buffer">ჯიტერის ბუფერი:</string> <string name="call_stats_jitter_buffer">ჯიტერის ბუფერი:</string>
@ -324,8 +330,10 @@
<string name="pref_call_title">ზარი</string> <string name="pref_call_title">ზარი</string>
<string name="pref_device_ringtone">მოწყობილობის რეკვის ხმის გამოყენება</string> <string name="pref_device_ringtone">მოწყობილობის რეკვის ხმის გამოყენება</string>
<string name="pref_auto_answer">შემომავალ პასუხებზე ავტო-პასუხი</string> <string name="pref_auto_answer">შემომავალ პასუხებზე ავტო-პასუხი</string>
<string name="pref_auto_answer_time">ავტო პასუხის დრო (მილიწამებში)</string>
<string name="pref_rfc2833_dtmf">არხის-შიდა DTMF-ების გაგზავნა(RFC2833)</string> <string name="pref_rfc2833_dtmf">არხის-შიდა DTMF-ების გაგზავნა(RFC2833)</string>
<string name="pref_sipinfo_dtmf">არხის-გარე DTMF-ების გაგზავნა(SIP INFO)</string> <string name="pref_sipinfo_dtmf">არხის-გარე DTMF-ების გაგზავნა(SIP INFO)</string>
<string name="pref_call_timeout_title">ზარის ტაიმაუტი (წამებში)</string>
<string name="pref_voice_mail">ხმოვანი ფოსტის URI</string> <string name="pref_voice_mail">ხმოვანი ფოსტის URI</string>
<!--Chat settings--> <!--Chat settings-->
<string name="pref_chat_title">ჩატი</string> <string name="pref_chat_title">ჩატი</string>
@ -448,4 +456,5 @@
<string name="content_description_call_options">ზარის პარამეტრები</string> <string name="content_description_call_options">ზარის პარამეტრები</string>
<string name="content_description_audio_route">ხმის მარშრუტი</string> <string name="content_description_audio_route">ხმის მარშრუტი</string>
<string name="content_description_exit_conference">კონფერენციიდან გამოსვლა</string> <string name="content_description_exit_conference">კონფერენციიდან გამოსვლა</string>
<string name="content_title_notification">Linphone-ის შეტყობინება</string>
</resources> </resources>

View file

@ -9,16 +9,22 @@
<string name="notification_registered">%s зарегистрирован</string> <string name="notification_registered">%s зарегистрирован</string>
<string name="notification_register_failure">%s зарегистрировать не удалось</string> <string name="notification_register_failure">%s зарегистрировать не удалось</string>
<string name="tunnel_host"></string> <string name="tunnel_host"></string>
<string name="about_version">Linphone Android %s</string>
<string name="about_liblinphone_version">Linphone ядро %s</string>
<string name="about_text">GNU General Public License V2\n © 2010-2017 Belledonne Communications</string>
<string name="about_link">www.linphone.org</string>
<string name="sync_account_name">контакты linphone</string>
<!--Common--> <!--Common-->
<string name="username">Имя пользователя</string> <string name="username">Имя пользователя</string>
<string name="userid">Идентификатор пользователя (необязательно)</string>
<string name="phone_number">Номер телефона</string> <string name="phone_number">Номер телефона</string>
<string name="display_name">Отображаемое имя</string> <string name="display_name">Отображаемое имя</string>
<string name="password">Пароль</string> <string name="password">Пароль</string>
<string name="confirm_password">Подтверждение пароля</string> <string name="confirm_password">Подтверждение пароля</string>
<string name="domain">Домен</string> <string name="domain">Домен</string>
<string name="remote_provisioning_url">URL</string> <string name="remote_provisioning_url">URL-адрес</string>
<string name="email">Электронная почта</string> <string name="email">Электронная почта</string>
<string name="delete_text">Вы уверены, что хотите удалить выбранное?</string> <string name="delete_text">Вы действительно хотите удалить выбранное?</string>
<string name="delete">Удалить</string> <string name="delete">Удалить</string>
<string name="retry">Повторить</string> <string name="retry">Повторить</string>
<string name="cancel">Отменить</string> <string name="cancel">Отменить</string>
@ -35,41 +41,103 @@
<string name="connect">Подключение</string> <string name="connect">Подключение</string>
<string name="decline">Отклонить</string> <string name="decline">Отклонить</string>
<string name="conference">Конференция</string> <string name="conference">Конференция</string>
<string name="link">Ссылка</string>
<string name="link_account_popup">Вы хотите связать учетную запись %s с вашим номером телефона?</string>
<string name="maybe_later">Может быть позже</string>
<string name="later">Позже</string>
<string name="no">Нет</string> <string name="no">Нет</string>
<string name="ok">OK</string>
<string name="yes">Да</string> <string name="yes">Да</string>
<string name="link_account">Связать свою учетную запись</string>
<!--Launch screen--> <!--Launch screen-->
<string name="app_description">это <i>бесплатный</i> SIP-клиент</string>
<!--Assistant--> <!--Assistant-->
<string name="welcome">Добро пожаловать</string> <string name="welcome">Добро пожаловать</string>
<string name="assistant">Ассистент</string> <string name="assistant">Ассистент</string>
<string name="assistant_create_account">Создать аккаунт</string> <string name="assistant_create_account">Создать аккаунт</string>
<string name="assistant_link_account">Связать учетную запись</string>
<string name="assistant_continue">Продолжить</string> <string name="assistant_continue">Продолжить</string>
<string name="assistant_activate">Активировать учетную запись</string>
<string name="assistant_finish">Завершить настройку</string> <string name="assistant_finish">Завершить настройку</string>
<string name="assistant_remote_provisioning_desc">Пожалуйста, введите URL конфигурирования</string> <string name="assistant_validate_account_1">Ваша учетная запись создана. Для подтверждения учетной записи проверьте свою почту:</string>
<string name="assistant_validate_account_2">После этого вернитесь и нажмите кнопку.</string>
<string name="assistant_welcome_desc">Этот помощник поможет вам настроить и использовать свой SIP-аккаунт.</string>
<string name="assistant_linphone_login_desc">Введите имя пользователя и пароль учетной записи Linphone</string>
<string name="assistant_login_desc">Введите имя пользователя и пароль вашего домена SIP</string>
<string name="assistant_remote_provisioning_desc">Укажите URL-адрес конфигурации</string>
<string name="transport">Транспорт</string> <string name="transport">Транспорт</string>
<string name="assistant_login_linphone">Исп. аккаунт Linphone</string> <string name="assistant_create_account_phone_number_address">Ваш SIP-адрес</string>
<string name="assistant_login_generic">Исп. SIP-аккаунт</string> <string name="assistant_login_linphone">Использовать учетную запись Linphone</string>
<string name="assistant_remote_provisioning">Удалённое конфигурирование</string> <string name="assistant_login_generic">Использовать учетную запись SIP</string>
<string name="assistant_remote_provisioning">Выбор удаленной конфигурации</string>
<string name="assistant_create_account_part_1">Подтвердите код страны и введите свой номер телефона</string>
<string name="assistant_create_account_part_2">Мы отправили SMS-сообщение с кодом подтверждения на ваш номер телефона:</string>
<string name="assistant_create_account_part_3">Чтобы завершить проверку номера телефона, введите 4-значный код ниже:\n</string>
<string name="assistant_create_account_part_email">Введите имя пользователя, адрес электронной почты и пароль для вашей учетной записи Linphone</string>
<string name="assistant_display_name_optional">Отображаемое имя (необязательно)</string> <string name="assistant_display_name_optional">Отображаемое имя (необязательно)</string>
<string name="assistant_generic_account">Исп. SIP-аккаунт</string> <string name="assistant_linphone_account">Использовать учетную запись Linphone</string>
<string name="assistant_remote_provisioning_title">Удалённое конфигурирование</string> <string name="assistant_generic_account">Использовать учетную запись SIP</string>
<string name="assistant_fetch_apply">Извлечь и применить</string> <string name="assistant_remote_provisioning_title">Выбор удаленной конфигурации</string>
<string name="assistant_login">Логин</string> <string name="assistant_fetch_apply">Получить и применить</string>
<string name="assistant_login">Имя пользователя</string>
<string name="assistant_ec_calibration">Выполняется калибровка эхоподавления</string> <string name="assistant_ec_calibration">Выполняется калибровка эхоподавления</string>
<string name="assistant_remote_provisioning_login">Введите логин</string> <string name="assistant_remote_provisioning_login">Введите имя пользователя</string>
<string name="assistant_account_not_validated">Ваша учётная запись ещё не подтверждена.</string> <string name="assistant_account_not_validated">Ваша учетная запись еще не проверена.</string>
<string name="assistant_account_validated">Ваша учётная запись подтверждена.</string> <string name="assistant_error_confirmation_code">Недопустимый код подтверждения.\r\nПожалуйста, повторите попытку.</string>
<string name="assistant_account_validated">Ваша учетная запись проверена.</string>
<string name="assistant_error_bad_credentials">Неверное имя пользователя или пароль</string> <string name="assistant_error_bad_credentials">Неверное имя пользователя или пароль</string>
<string name="assistant_codec_down_question">Вы согласны загрузить OpenH264 Video Codec, предоставленный компанией Cisco Systems, Inc.?</string>
<string name="assistant_codec_downloading">Загрузка OpenH264 Video Codec, предоставленного компанией Cisco Systems, Inc.</string>
<string name="assistant_openh264_downloading">Загрузка OpenH264</string>
<string name="assistant_openh264_restart">Перед использованием кодека OpenH264 необходимо перезапустить %s.</string>
<string name="assistant_openh264_error">Извините, произошла ошибка.</string>
<string name="assistant_codec_downloaded">OpenH264 Video Codec, предоставленный компанией Cisco Systems, Inc. загружен.</string>
<string name="wizard_failed">Произошла ошибка, повторите попытку позже.</string> <string name="wizard_failed">Произошла ошибка, повторите попытку позже.</string>
<string name="wizard_server_unavailable">Сервер недоступен, проверьте подключение к сети.</string> <string name="wizard_server_unavailable">Сервер недоступен, проверьте сетевое подключение.</string>
<string name="wizard_username_unavailable">Это имя пользователя уже используется.</string> <string name="wizard_username_unavailable">Это имя пользователя уже используется.</string>
<string name="wizard_username_incorrect">Неверное имя пользователя.</string> <string name="assistant_phone_number_unavailable">Этот номер телефона уже используется.\r\nВведите другой номер.\r\nВы можете удалить свою существующую учетную запись, если хотите повторно использовать свой номер телефона.</string>
<string name="wizard_email_incorrect">Неверный адрес эл. почты.</string> <string name="wizard_username_incorrect">Недопустимое имя пользователя.</string>
<string name="wizard_password_incorrect">Неверный пароль</string> <string name="assistant_phone_number_incorrect">Недопустимый номер телефона.</string>
<string name="wizard_email_incorrect">Недопустимый адрес электронной почты.</string>
<string name="wizard_password_incorrect">Недопустимый пароль</string>
<string name="wizard_passwords_unmatched">Пароли не совпадают.</string> <string name="wizard_passwords_unmatched">Пароли не совпадают.</string>
<string name="setup_confirm_username">Ваше имя пользователя будет %s.\r\n\r\nОно может отличаться от введённого для соответствия требованиям.\r\nВы согласны?</string> <string name="setup_confirm_username">Ваше имя пользователя будет %s.\r\n\r\nОно может отличаться от выбранного вами для соответствия требованиям.\r\nВы согласны?</string>
<string name="first_launch_no_login_password">Пожалуйста, введите имя пользователя и пароль</string> <string name="first_launch_no_login_password">Введите имя пользователя и пароль</string>
<string name="forgot_password">Забыли пароль ?</string>
<string name="assistant_choose_country">Выберите страну</string>
<string name="select_your_country">Выберите свою страну</string>
<string name="country_code">(%s)</string>
<string name="use_username_instead_or_phone_number">Использовать имя пользователя (необязательно)</string>
<string name="use_email_for_validation">Использовать адрес электронной почты для проверки учетной записи</string>
<string name="login_with_username">Вместо номера телефона использовать имя пользователя и пароль</string>
<string name="phone_number_info_title">Для чего будет использоваться мой номер телефона?</string>
<string name="phone_number_info_content">\nБлагодаря номеру телефона вашим друзьям будет проще вас найти.\n\n В вашей адресной книге вы увидите, кто использует Linphone, а ваши друзья смогут узнать, что вы также зарегистрированы в Linphone.\n</string>
<string name="phone_number_link_info_content">\nВашим друзьям будет проще связаться с вами, если вы свяжете свою учетную запись со своим номером телефона.\n\nВ вашей адресной книге вы увидите, кто использует Linphone, а ваши друзья смогут узнать, что вы также зарегистрированы в Linphone.\n</string>
<string name="phone_number_link_info_content_already_account">Номер телефона можно использовать только с одной учетной записью Linphone.\n\nЕсли ваш номер уже был связан с другой учетной записью, но вы предпочитаете использовать его, просто свяжите его сейчас, и ваш номер будет автоматически перенесен в эту учетную запись.</string>
<!--Status--> <!--Status-->
<string name="invalid_email">Недопустимый адрес электронной почты</string>
<string name="account_already_exist">Учетная запись уже существует</string>
<string name="phone_number_not_exist">Эта учетная запись не существует</string>
<string name="invalid_username">Неверное имя пользователя</string>
<string name="invalid_domain">Недопустимый домен</string>
<string name="invalid_route">Недопустимый маршрут</string>
<string name="invalid_display_name">Недопустимое имя</string>
<string name="username_too_short">Слишком короткое имя пользователя</string>
<string name="username_too_long">Слишком длинное имя пользователя</string>
<string name="username_invalid_size">Недопустимая длина имени пользователя</string>
<string name="phone_number_too_long">Слишком длинный номер телефона</string>
<string name="phone_number_too_short">Слишком короткий номер телефона</string>
<string name="phone_number_invalid">Недопустимый номер телефона</string>
<string name="password_too_short">Слишком короткий пароль</string>
<string name="password_too_long">Слишком длинный пароль</string>
<string name="request_failed">Не удалось запросить сервер. Повторите попытку позже</string>
<string name="transport_unsupported">Неподдерживаемый транспорт</string>
<string name="country_code_invalid">Недопустимый код страны</string>
<!--In-app--> <!--In-app-->
<string name="inapp">В приложении</string>
<string name="inapp_notification_title">Покупка в приложении</string>
<string name="inapp_notification_trial_expire">Пробный период истекает %s</string>
<string name="inapp_notification_account_expire">Срок действия подписки истекает %s</string>
<!--Dailer--> <!--Dailer-->
<string name="address_bar_hint">Введите номер или адрес</string> <string name="address_bar_hint">Введите номер или адрес</string>
<!--History--> <!--History-->
@ -86,10 +154,11 @@
<string name="sip_address">Адрес SIP</string> <string name="sip_address">Адрес SIP</string>
<string name="contact_first_name">Имя</string> <string name="contact_first_name">Имя</string>
<string name="contact_last_name">Фамилия</string> <string name="contact_last_name">Фамилия</string>
<string name="contact_organization">Организация</string>
<!--Chat--> <!--Chat-->
<string name="no_chat_history">Нет разговоров</string> <string name="no_chat_history">Нет разговоров</string>
<string name="delete_conversation">Вы действительно хотите удалить выбранный разговор?</string> <string name="delete_conversation">Вы действительно хотите удалить выбранный разговор?</string>
<string name="delete_message">Вы действительно хотите удалить выбранные сообщения?</string> <string name="delete_message">Вы действительно хотите удалить выбранное сообщение?</string>
<string name="remote_composing">Собеседник пишет...</string> <string name="remote_composing">Собеседник пишет...</string>
<string name="share_picture_size_small">Маленький</string> <string name="share_picture_size_small">Маленький</string>
<string name="share_picture_size_medium">Средний</string> <string name="share_picture_size_medium">Средний</string>
@ -100,13 +169,21 @@
<string name="image_picker_title">Выбрать источник</string> <string name="image_picker_title">Выбрать источник</string>
<string name="image_saved">Картинка сохранена</string> <string name="image_saved">Картинка сохранена</string>
<string name="image_not_saved">Ошибка, картинка не сохранена</string> <string name="image_not_saved">Ошибка, картинка не сохранена</string>
<string name="wait">Пожалуйста, подождите...</string> <string name="wait">Подождите...</string>
<string name="image_transfert_error">При передаче файла произошла ошибка</string>
<string name="message_not_encrypted">Это сообщение не зашифровано</string>
<string name="message_cant_be_decrypted">От %s получено зашифрованное сообщение, которое вы не можете расшифровать.\nВы должны позвонить своему собеседнику для обмена ключами ZRTP. Это необходимо для расшифровки будущих сообщений, которые вы получите.</string>
<string name="message_cant_be_decrypted_notif">Вы не можете расшифровать это сообщение.</string>
<string name="lime_not_verified">Вы пытаетесь отправить сообщение при помощи LIME с неверифицированными ключом ZRTP.\nПожалуйста, позвоните этому контакту и подтвердите его ключ ZRTP перед отправкой сообщений.</string>
<string name="processing_image">Обработка изображения может занять несколько секунд в зависимости от размера файла</string> <string name="processing_image">Обработка изображения может занять несколько секунд в зависимости от размера файла</string>
<string name="displayed">Прочитано</string>
<string name="delivered">Доставлено</string>
<string name="resend">Переслать</string>
<!--Status Bar--> <!--Status Bar-->
<string name="status_connected">Зарегистрирован</string> <string name="status_connected">Зарегистрирован</string>
<string name="status_not_connected">Не зарегистрирован</string> <string name="status_not_connected">Не зарегистрирован</string>
<string name="status_in_progress">В процессе регистрации</string> <string name="status_in_progress">Выполняется регистрация</string>
<string name="status_error">Ошибка регистрации</string> <string name="status_error">Регистрация не удалась</string>
<string name="voicemail_unread"> непрочитанных сообщений</string> <string name="voicemail_unread"> непрочитанных сообщений</string>
<!--Side Menu--> <!--Side Menu-->
<string name="menu_assistant">Ассистент</string> <string name="menu_assistant">Ассистент</string>
@ -116,41 +193,62 @@
<!--Call--> <!--Call-->
<string name="incoming_call">входящий вызов</string> <string name="incoming_call">входящий вызов</string>
<string name="outgoing_call">исходящий вызов</string> <string name="outgoing_call">исходящий вызов</string>
<string name="add_video_dialog">Ваш собеседник хотел бы включить видео</string>
<string name="no_current_call">Нет активного вызова</string> <string name="no_current_call">Нет активного вызова</string>
<string name="call_paused_by_remote">Ваш собеседник поставил вызов на удержание</string>
<string name="couldnt_accept_call">Произошла ошибка во время принятия вызова</string> <string name="couldnt_accept_call">Произошла ошибка во время принятия вызова</string>
<string name="zrtp_dialog1">Подтвердите следующие SAS с одноранговым узлом:\nСкажите: %s</string>
<string name="zrtp_dialog2">\nВаш собеседник должен сказать: %s</string>
<string name="zrtp_notification_title">SAS</string>
<string name="zrtp_notification_message">Подтвердить предыдущий код SAS с вашим собеседником</string>
<string name="unknown_incoming_call_name">Неизвестный</string> <string name="unknown_incoming_call_name">Неизвестный</string>
<string name="call_stats_audio">Аудио</string> <string name="call_stats_audio">Аудио</string>
<string name="call_stats_video">Видео</string> <string name="call_stats_video">Видео</string>
<string name="call_stats_codec">Кодек:</string> <string name="call_stats_codec">Кодек:</string>
<string name="call_stats_upload">Полоса пропускания загрузки:</string> <string name="call_stats_ip">Семейство IP:</string>
<string name="call_stats_download">Полоса пропускания скачивания:</string> <string name="call_stats_upload">Пропускная способность передачи:</string>
<string name="call_stats_ice">Подключение ICE:</string> <string name="call_stats_download">Пропускная способность приема:</string>
<string name="call_stats_estimated_download">Предполагаемая пропускная способность на прием:</string>
<string name="call_stats_ice">ICE-соединение:</string>
<string name="call_stats_video_resolution_sent">Разрешение передаваемого видео:</string>
<string name="call_stats_video_resolution_received">Разрешение принимаемого видео:</string>
<string name="call_stats_video_fps_sent">fps передаваемого видео:</string>
<string name="call_stats_video_fps_received">fps принимаемого видео:</string>
<string name="call_stats_sender_loss_rate">Коэффициент потерь отправителя:</string>
<string name="call_stats_receiver_loss_rate">Коэффициент потерь приемника:</string>
<string name="call_stats_jitter_buffer">Буфер джиттера:</string>
<string name="call_stats_encoder_name">Кодер:</string>
<string name="call_stats_decoder_name">Декодер</string>
<string name="call">Вызов</string> <string name="call">Вызов</string>
<!--About--> <!--About-->
<string name="menu_send_log">Отправить журнал</string> <string name="menu_send_log">Отправить журнал</string>
<string name="menu_reset_log">Сброс журнала</string> <string name="menu_reset_log">Сброс журнала</string>
<!--Service--> <!--Service-->
<string name="incall_notif_active">Идёт аудиозвонок</string> <string name="incall_notif_active">Установлено аудиосоединение</string>
<string name="incall_notif_paused">Звонок на паузе</string> <string name="incall_notif_paused">Вызов на удержании</string>
<string name="incall_notif_video">Идёт видеозвонок</string> <string name="incall_notif_video">Установлено видеосоединение</string>
<string name="notification_started">начат</string> <string name="notification_started">начат</string>
<string name="unread_messages">%i непрочитанных сообщений</string> <string name="unread_messages">%i непрочитанных сообщений</string>
<string name="missed_calls_notif_title">Пропущенный вызов</string>
<string name="missed_calls_notif_body">%i пропущенных вызовов</string>
<!--Errors--> <!--Errors-->
<string name="skipable_error_service_not_ready">Внимание: сервис не готов</string> <string name="skipable_error_service_not_ready">Предупреждение: служба не готова</string>
<string name="error">Ошибка</string> <string name="error">Ошибка</string>
<string name="warning_wrong_destination_address">Невозможно установить адрес назначения из %s</string> <string name="warning_wrong_destination_address">Невозможно создать адрес назначения из %s</string>
<string name="error_unknown">Неизвестная ошибка</string> <string name="error_unknown">Неизвестная ошибка</string>
<string name="error_call_declined">Вызов сброшен</string> <string name="error_call_declined">Вызов отклонен</string>
<string name="error_user_not_found">Пользователь не найден</string> <string name="error_user_busy">Абонент занят</string>
<string name="error_user_not_found">Абонент не найден</string>
<string name="error_incompatible_media">Несовместимые параметры потока</string> <string name="error_incompatible_media">Несовместимые параметры потока</string>
<string name="error_low_bandwidth">У вашего собеседника низкая пропускная способность, видео не может быть запущено</string>
<string name="error_network_unreachable">Сеть недоступна</string> <string name="error_network_unreachable">Сеть недоступна</string>
<string name="error_bad_credentials">Неверные учетные данные</string> <string name="error_bad_credentials">Неверные учетные данные</string>
<string name="error_unauthorized">Неавторизован</string> <string name="error_unauthorized">Неавторизован</string>
<string name="error_io_error">Ошибка сети</string> <string name="error_io_error">Ошибка сети</string>
<string name="download_image_failed">Скачать не удалось. Пожалуйста, проверьте сетевое подключение или повторите попытку позже.</string> <string name="download_image_failed">Загрузка не удалась. Проверьте сетевое подключение или повторите попытку позже.</string>
<string name="remote_provisioning_failure">Не удалось скачать или применить профиль удалённого конфигурирования...</string> <string name="remote_provisioning_failure">Не удалось загрузить или применить профиль удаленного конфигурирования...</string>
<string name="remote_provisioning_again_title">Удаленное конфигурирование</string> <string name="remote_provisioning_again_title">Удаленное конфигурирование</string>
<string name="remote_provisioning_again_message">Вы действительно хотите изменить URI конфигурирования?</string> <string name="remote_provisioning_again_message">Вы хотите изменить URI конфигурирования?</string>
<!--Account Settings--> <!--Account Settings-->
<string name="pref_sipaccount">SIP-аккаунт</string> <string name="pref_sipaccount">SIP-аккаунт</string>
<string name="pref_manage_title">Управление</string> <string name="pref_manage_title">Управление</string>
@ -160,15 +258,16 @@
<string name="pref_passwd">Пароль*</string> <string name="pref_passwd">Пароль*</string>
<string name="pref_username">Имя пользователя*</string> <string name="pref_username">Имя пользователя*</string>
<string name="pref_enable_outbound_proxy">Исходящий прокси</string> <string name="pref_enable_outbound_proxy">Исходящий прокси</string>
<string name="pref_help_proxy">Имя сервера SIP прокси или ip адрес (необязательно)</string> <string name="pref_help_proxy">Имя прокси-сервера SIP или ip адрес (необязательно)</string>
<string name="pref_help_outbound_proxy">Отправлять все вызовы через SIP прокси</string> <string name="pref_help_outbound_proxy">Маршрутизация всех вызовов через SIP-прокси</string>
<string name="pref_help_username">Например: john если ваш адрес john@sip.example.org</string> <string name="pref_help_username">Например: john если ваш адрес john@sip.example.org</string>
<string name="pref_help_domain">sip.example.org если ваш адрес john@sip.example.org</string> <string name="pref_help_domain">sip.example.org если ваш адрес john@sip.example.org</string>
<string name="pref_help_password">Вы должны повторно ввести ваш пароль, если вы измените имя пользователя и/или домен</string> <string name="pref_help_password">Необходимо повторно ввести пароль, если вы измените имя пользователя и/или домен</string>
<string name="pref_expire_title">Истекает</string> <string name="pref_expire_title">Истекает</string>
<string name="pref_avpf">AVPF</string> <string name="pref_avpf">AVPF</string>
<string name="pref_avpf_rr_interval"> AVPF регулярный интервал RTCP в секундах (от 1 до 5)</string> <string name="pref_avpf_rr_interval"> AVPF регулярный интервал RTCP в секундах (от 1 до 5)</string>
<string name="pref_escape_plus">Заменить + на 00</string> <string name="pref_escape_plus">Заменить + на 00</string>
<string name="pref_link_account">Связать свою учетную запись</string>
<string name="pref_auth_userid">Имя для аутентификации</string> <string name="pref_auth_userid">Имя для аутентификации</string>
<string name="pref_help_auth_userid">Введите имя для аутентификации (необязательно)</string> <string name="pref_help_auth_userid">Введите имя для аутентификации (необязательно)</string>
<string name="pref_display_name">Отображаемое имя</string> <string name="pref_display_name">Отображаемое имя</string>
@ -179,11 +278,14 @@
<string name="pref_transport_tcp">TCP</string> <string name="pref_transport_tcp">TCP</string>
<string name="pref_transport_tls">TLS</string> <string name="pref_transport_tls">TLS</string>
<string name="pref_delete_account">Удалить аккаунт</string> <string name="pref_delete_account">Удалить аккаунт</string>
<string name="pref_change_password">Изменить пароль</string>
<string name="pref_default_account">Использовать по умолчанию</string> <string name="pref_default_account">Использовать по умолчанию</string>
<string name="pref_password_changed">Пароль изменен</string>
<!--Settings--> <!--Settings-->
<string name="pref_sipaccounts">SIP-аккаунты</string> <string name="pref_sipaccounts">Учетные записи SIP</string>
<string name="default_account_flag">Аккаунт по умолчанию</string> <string name="default_account_flag">Учетная запись по умолчанию</string>
<string name="pref_add_account">Добавить аккаунт</string> <string name="pref_add_account">Добавить учетную запись</string>
<string name="pref_in_app_store">In-app Store</string>
<string name="pref_tunnel">Туннель</string> <string name="pref_tunnel">Туннель</string>
<string name="pref_tunnel_host">Сервер</string> <string name="pref_tunnel_host">Сервер</string>
<string name="pref_tunnel_port">Порт</string> <string name="pref_tunnel_port">Порт</string>
@ -196,42 +298,62 @@
<item>авто</item> <item>авто</item>
</string-array> </string-array>
<string name="pref_none">Нет</string> <string name="pref_none">Нет</string>
<string name="pref_preferences_title">Настройки</string> <string name="pref_preferences_title">Предпочтения</string>
<string name="pref_video_enable_title">Включить видео</string> <string name="pref_video_enable_title">Включить видео</string>
<!--Audio settings--> <!--Audio settings-->
<string name="pref_audio_title">Аудио</string> <string name="pref_audio_title">Аудио</string>
<string name="pref_echo_cancellation">Эхоподавление</string> <string name="pref_echo_cancellation">Эхоподавление</string>
<string name="pref_echo_cancellation_summary">Устраняет эхо, слышимое другой стороной</string> <string name="pref_echo_cancellation_summary">Устраняет эхо, слышимое другой стороной</string>
<string name="pref_echo_canceller_calibration">Калибровка эхоподавления</string> <string name="pref_echo_canceller_calibration">Калибровка эхоподавления</string>
<string name="pref_echo_tester">Тест эхо</string>
<string name="ec_calibrating">Калибровка…</string> <string name="ec_calibrating">Калибровка…</string>
<string name="ec_calibrated">Откалибровано в %s мс</string> <string name="ec_calibrated">Откалибровано в %s мс</string>
<string name="no_echo">Нет эха</string> <string name="no_echo">Нет эха</string>
<string name="failed">не удалось</string> <string name="failed">не удалось</string>
<string name="pref_adaptive_rate_control">Адаптивное управление скорость</string> <string name="pref_adaptive_rate_control">Адаптивный контроль скорости</string>
<string name="pref_codec_bitrate_limit">Ограничение битрейта кодека</string> <string name="pref_codec_bitrate_limit">Предельная скорость кодека</string>
<string name="pref_codecs">Кодеки</string> <string name="pref_codecs">Кодеки</string>
<!--Video settings--> <!--Video settings-->
<string name="pref_video_title">Видео</string> <string name="pref_video_title">Видео</string>
<string name="pref_overlay">Наложение видео</string>
<string name="pref_overlay_summary">Отображать видеовызов наложением на стороннем приложении</string>
<string name="pref_video_use_front_camera_title">Использовать фронтальную камеру</string> <string name="pref_video_use_front_camera_title">Использовать фронтальную камеру</string>
<string name="pref_video_initiate_call_with_video_title">Начинать видеозвонки</string> <string name="pref_video_initiate_call_with_video_title">Инициирование видеозвонков</string>
<string name="pref_video_initiate_call_with_video">Всегда посылать видео запросы</string> <string name="pref_video_initiate_call_with_video">Всегда отправлять запросы на видео</string>
<string name="pref_video_automatically_accept_video_title">Принимать входящие видеозвонки</string> <string name="pref_video_automatically_accept_video_title">Принимать входящие запросы на видео</string>
<string name="pref_video_automatically_accept_video">Всегда принимать видео запросы</string> <string name="pref_video_automatically_accept_video">Всегда принимать запросы на видео</string>
<string name="pref_video_preset">Предустановка видео</string> <string name="pref_video_preset">Параметры видео</string>
<string name="pref_preferred_video_size">Предпочтительный размер видео</string> <string name="pref_preferred_video_size">Предпочитаемый размер видео</string>
<string name="pref_preferred_fps">Предпочтительный FPS</string> <string name="pref_preferred_fps">Предпочитаемый FPS</string>
<string name="pref_bandwidth_limit">Ограничение пропускной способности в Кбит/с</string> <string name="pref_bandwidth_limit">Ограничение пропускной способности в кбит/с</string>
<string name="pref_video_codecs_title">Кодеки</string> <string name="pref_video_codecs_title">Кодеки</string>
<!--Call settings--> <!--Call settings-->
<string name="pref_call_title">Вызов</string> <string name="pref_call_title">Вызов</string>
<string name="pref_device_ringtone">Использовать мелодию звонка устройства</string>
<string name="pref_auto_answer">Автоматический ответ на входящие звонки</string>
<string name="pref_auto_answer_time">Время автоматического ответа (в миллисекундах)</string>
<string name="pref_rfc2833_dtmf">Отправить в потоке DTMFs(RFC2833)</string>
<string name="pref_sipinfo_dtmf">Отправить вне потока DTMFs(SIP INFO)</string>
<string name="pref_call_timeout_title">Таймаут вызова(в секундах)</string>
<string name="pref_voice_mail">URI голосовой почты</string> <string name="pref_voice_mail">URI голосовой почты</string>
<!--Chat settings--> <!--Chat settings-->
<string name="pref_chat_title">Чат</string> <string name="pref_chat_title">Чат</string>
<string name="pref_image_sharing_server_title">Сервер обмена</string> <string name="pref_image_sharing_server_title">Сервер обмена</string>
<string name="pref_image_sharing_server_desc">Не изменяйте, если вы не знаете, что делаете!</string>
<string name="pref_use_lime_encryption">Использовать шифрование LIME</string>
<string name="lime_encryption_entry_disabled">Отключено</string>
<string name="lime_encryption_entry_mandatory">Обязательно</string>
<string name="lime_encryption_entry_preferred">Предпочтительно</string>
<string name="lime_encryption_enable_zrtp">LIME требует шифрования ZRTP.\nПри активации LIME вы автоматически активируете шифрование ZRTP.</string>
<!--Network settings--> <!--Network settings-->
<string name="pref_network_title">Сеть</string> <string name="pref_network_title">Сеть</string>
<string name="pref_wifi_only">Использовать только WiFi</string> <string name="pref_wifi_only">Использовать только WiFi</string>
<string name="pref_doze_mode">Режим Doze</string>
<string name="pref_stun_server">Сервер STUN / TURN</string>
<string name="pref_ice_enable">Включить ICE</string> <string name="pref_ice_enable">Включить ICE</string>
<string name="pref_turn_enable">Включить TURN</string>
<string name="pref_turn_username_title">Имя пользователя STUN / TURN (необязательно)</string>
<string name="pref_turn_passwd_title">Пароль STUN / TURN (необязательно)</string>
<string name="pref_upnp_enable">Включить UPNP</string> <string name="pref_upnp_enable">Включить UPNP</string>
<string name="pref_transport_use_random_ports">Использовать случайный порт</string> <string name="pref_transport_use_random_ports">Использовать случайный порт</string>
<string name="pref_sip_port_title">SIP порт занят</string> <string name="pref_sip_port_title">SIP порт занят</string>
@ -246,17 +368,20 @@
<string name="pref_advanced_title">Дополнительно</string> <string name="pref_advanced_title">Дополнительно</string>
<string name="pref_debug_title">Отладка</string> <string name="pref_debug_title">Отладка</string>
<string name="pref_debug">Отладка</string> <string name="pref_debug">Отладка</string>
<string name="pref_friendlist_subscribe">Подписка</string>
<string name="pref_background_mode">Фоновый режим</string> <string name="pref_background_mode">Фоновый режим</string>
<string name="pref_animation_enable_title">Включить анимацию</string> <string name="pref_animation_enable_title">Включить анимацию</string>
<string name="pref_autostart">Запуск при загрузке</string> <string name="pref_service_notification">Включить сервисное уведомление</string>
<string name="pref_autostart">Запуск во время загрузки</string>
<string name="pref_incoming_call_timeout_title">Отклонение входящего вызова (в секундах)</string> <string name="pref_incoming_call_timeout_title">Отклонение входящего вызова (в секундах)</string>
<string name="pref_remote_provisioning_title">Удалённое конфигурирование</string> <string name="pref_remote_provisioning_title">Удаленное конфигурирование</string>
<string name="pref_android_app_settings_title">Параметры приложения в Android</string>
<string name="pref_primary_account_title">Основной аккаунт</string> <string name="pref_primary_account_title">Основной аккаунт</string>
<string name="pref_display_name_title">Отображаемое имя</string> <string name="pref_display_name_title">Отображаемое имя</string>
<string name="pref_user_name_title">Имя пользователя</string> <string name="pref_user_name_title">Имя пользователя</string>
<!--Audio hack settings--> <!--Audio hack settings-->
<string name="pref_audio_hacks_title">Audio хаки</string> <string name="pref_audio_hacks_title">Аудио хаки</string>
<string name="pref_audio_use_specific_mode_title">Использовать хаки спец. режима</string> <string name="pref_audio_use_specific_mode_title">Использовать хаки определенного режима</string>
<string name="pref_audio_use_specific_mode_summary">0=MODE_NORMAL (по умолчанию), 2=MODE_IN_CALL</string> <string name="pref_audio_use_specific_mode_summary">0=MODE_NORMAL (по умолчанию), 2=MODE_IN_CALL</string>
<string name="pref_audio_hacks_use_routing_api_title">Использовать хак API маршрутизации</string> <string name="pref_audio_hacks_use_routing_api_title">Использовать хак API маршрутизации</string>
<string name="pref_audio_hacks_use_galaxys_hack_title">Использовать аудио хак Galaxy S</string> <string name="pref_audio_hacks_use_galaxys_hack_title">Использовать аудио хак Galaxy S</string>
@ -267,14 +392,17 @@
<string name="content_description_toggle_micro">Переключить микрофон</string> <string name="content_description_toggle_micro">Переключить микрофон</string>
<string name="content_description_toggle_speaker">Переключить динамик</string> <string name="content_description_toggle_speaker">Переключить динамик</string>
<string name="content_description_decline">Отклонить</string> <string name="content_description_decline">Отклонить</string>
<string name="content_description_hang_up">Положить трубку</string> <string name="content_description_hang_up">Завершить вызов</string>
<string name="content_description_accept">Принять</string> <string name="content_description_accept">Принять</string>
<string name="content_description_edit">Редактировать</string> <string name="content_description_edit">Редактировать</string>
<string name="content_description_edit_list">Редактировать список</string> <string name="content_description_edit_list">Редактировать список</string>
<string name="content_description_valid">Действительный</string>
<string name="content_description_add_contact">Добавить в контакты</string> <string name="content_description_add_contact">Добавить в контакты</string>
<string name="content_description_new_contact">Новый контакт</string> <string name="content_description_new_contact">Новый контакт</string>
<string name="content_description_call">Вызов</string> <string name="content_description_call">Вызов</string>
<string name="content_description_backspace">Возврат</string>
<string name="content_description_chat">Чат</string> <string name="content_description_chat">Чат</string>
<string name="content_description_dial_back">Перезвонить</string>
<string name="content_description_dialer_back">Вернуться к номеронабирателю</string> <string name="content_description_dialer_back">Вернуться к номеронабирателю</string>
<string name="content_description_contact_picture">Изображение контакта</string> <string name="content_description_contact_picture">Изображение контакта</string>
<string name="content_description_send_message">Отправить сообщение</string> <string name="content_description_send_message">Отправить сообщение</string>
@ -284,6 +412,7 @@
<string name="content_description_new_discussion">Новая дискуссия</string> <string name="content_description_new_discussion">Новая дискуссия</string>
<string name="content_description_search">Поиск</string> <string name="content_description_search">Поиск</string>
<string name="content_description_search_contact">Поиск контакта</string> <string name="content_description_search_contact">Поиск контакта</string>
<string name="content_description_search_country">Поиск страны</string>
<string name="content_description_all_contacts">Все контакты</string> <string name="content_description_all_contacts">Все контакты</string>
<string name="content_description_linphone_contacts">Контакты Linphone</string> <string name="content_description_linphone_contacts">Контакты Linphone</string>
<string name="content_description_call_direction">Направление вызова</string> <string name="content_description_call_direction">Направление вызова</string>
@ -304,24 +433,29 @@
<string name="content_description_conference">Конференция</string> <string name="content_description_conference">Конференция</string>
<string name="content_description_username_field">Поле имени пользователя</string> <string name="content_description_username_field">Поле имени пользователя</string>
<string name="content_description_activation_code_field">Поле имени пользователя</string> <string name="content_description_activation_code_field">Поле имени пользователя</string>
<string name="content_description_phone_number_field">Поле номера телефона</string>
<string name="content_description_display_field">Поле отображаемого имени</string> <string name="content_description_display_field">Поле отображаемого имени</string>
<string name="content_description_domain_field">Поле домена</string> <string name="content_description_domain_field">Поле домена</string>
<string name="content_description_url_field">Поле удалённого конфигурирования</string> <string name="content_description_url_field">Поле удаленного конфигурирования</string>
<string name="content_description_confirm_password_field">Поле подтверждения пароля</string> <string name="content_description_confirm_password_field">Поле подтверждения пароля</string>
<string name="content_description_email_field">Поле электронной почты</string> <string name="content_description_email_field">Поле электронной почты</string>
<string name="content_description_default_account">Аккаунт по умолчанию</string> <string name="content_description_default_account">Учетная запись по умолчанию</string>
<string name="content_description_deselect_all">Отменить выбор</string> <string name="content_description_deselect_all">Отменить выбор</string>
<string name="content_description_select_all">Выбрать всё</string> <string name="content_description_select_all">Выбрать все</string>
<string name="content_description_delete_selection">Удалить выбранное</string> <string name="content_description_delete_selection">Удалить выбранное</string>
<string name="content_description_contact_first_name">Имя</string> <string name="content_description_contact_first_name">Имя</string>
<string name="content_description_contact_last_name">Фамилия</string> <string name="content_description_contact_last_name">Фамилия</string>
<string name="content_description_contact_organization">Организация</string>
<string name="content_description_back_call">Вернуться к вызову</string> <string name="content_description_back_call">Вернуться к вызову</string>
<string name="content_description_send_file">Отправить файл</string> <string name="content_description_send_file">Отправить файл</string>
<string name="content_description_incoming_file">Входящий файл</string>
<string name="content_description_message">Сообщение</string> <string name="content_description_message">Сообщение</string>
<string name="content_description_unread_chat_message">Непрочитанное сообщение чата</string> <string name="content_description_unread_chat_message">Непрочитанное сообщение чата</string>
<string name="content_description_transfer">Перевести</string> <string name="content_description_transfer">Перевод</string>
<string name="content_description_earpiece">Наушник</string> <string name="content_description_earpiece">Наушник</string>
<string name="content_description_bluetooth">Bluetooth</string> <string name="content_description_bluetooth">Bluetooth</string>
<string name="content_description_call_options">Параметры вызова</string> <string name="content_description_call_options">Параметры вызова</string>
<string name="content_description_audio_route">Аудио маршрут</string>
<string name="content_description_exit_conference">Выйти из конференции</string> <string name="content_description_exit_conference">Выйти из конференции</string>
<string name="content_title_notification">Уведомление Linphone</string>
</resources> </resources>

View file

@ -6,13 +6,25 @@
<string name="addressbook_label">Linphone</string> <string name="addressbook_label">Linphone</string>
<string name="notification_title">Linphone</string> <string name="notification_title">Linphone</string>
<string name="wait_dialog_text">Startar upp</string> <string name="wait_dialog_text">Startar upp</string>
<string name="notification_registered">%s registrerad</string>
<string name="notification_register_failure">%s misslyckades med att registrera sig</string>
<string name="tunnel_host"></string> <string name="tunnel_host"></string>
<string name="about_version">Linphone Android %s</string>
<string name="about_liblinphone_version">Linphone Core %s</string>
<string name="about_text">GNU General Public License V2\n © 2010-2017 Belledonne Communications</string>
<string name="about_link">www.linphone.org</string>
<string name="sync_account_name">linphone-kontakter</string> <string name="sync_account_name">linphone-kontakter</string>
<!--Common--> <!--Common-->
<string name="username">Användarnamn</string> <string name="username">Användarnamn</string>
<string name="userid">Användar-ID (valfritt)</string>
<string name="phone_number">Telefonnummer</string> <string name="phone_number">Telefonnummer</string>
<string name="display_name">Visningsnamn</string> <string name="display_name">Visningsnamn</string>
<string name="password">Lösenord</string> <string name="password">Lösenord</string>
<string name="confirm_password">Lösenordsbekräftelse</string>
<string name="domain">Domän</string>
<string name="remote_provisioning_url">Webbadress</string>
<string name="email">E-post</string>
<string name="delete_text">Är du säker på att du vill radera ta bort val?</string>
<string name="delete">Ta bort</string> <string name="delete">Ta bort</string>
<string name="retry">Försök igen</string> <string name="retry">Försök igen</string>
<string name="cancel">Avbryt</string> <string name="cancel">Avbryt</string>
@ -20,57 +32,193 @@
<string name="continue_text">Fortsätt</string> <string name="continue_text">Fortsätt</string>
<string name="about">Om</string> <string name="about">Om</string>
<string name="deny">Neka</string> <string name="deny">Neka</string>
<string name="no_account">Inget konto konfigurerat</string>
<string name="search">Sök</string> <string name="search">Sök</string>
<string name="outgoing">Utgående</string> <string name="outgoing">Utgående</string>
<string name="incoming">Inkommande</string> <string name="incoming">Inkommande</string>
<string name="missed">Missade</string> <string name="missed">Missade</string>
<string name="settings">Inställningar</string> <string name="settings">Inställningar</string>
<string name="connect">Anslutning</string>
<string name="decline">Avvisa</string> <string name="decline">Avvisa</string>
<string name="conference">Konferens</string> <string name="conference">Konferens</string>
<string name="link">Länk</string>
<string name="link_account_popup">Vill du länka kontot%s med ditt telefonnummer ?</string>
<string name="maybe_later">Kanske senare</string>
<string name="later">Senare</string>
<string name="no">Nej</string> <string name="no">Nej</string>
<string name="ok">OK</string>
<string name="yes">Ja</string> <string name="yes">Ja</string>
<string name="link_account">Länka ditt konto</string>
<!--Launch screen--> <!--Launch screen-->
<string name="app_description"><i>libre</i> SIP-klient</string>
<!--Assistant--> <!--Assistant-->
<string name="welcome">Välkommen</string>
<string name="assistant">Assistent</string>
<string name="assistant_create_account">Skapa konto</string>
<string name="assistant_link_account">Länka konto</string>
<string name="assistant_continue">Fortsätt</string> <string name="assistant_continue">Fortsätt</string>
<string name="assistant_activate">Aktivera ditt konto</string>
<string name="assistant_finish">Slutför konfiguration</string>
<string name="assistant_validate_account_1">Ditt konto har skapats. Kontrollera dina mejl för att validera ditt konto:</string>
<string name="assistant_validate_account_2">När det är klart, kom tillbaka hit och klicka på knappen.</string>
<string name="assistant_welcome_desc">Den här assistenten hjälper dig att konfigurera och använda ditt SIP-konto.</string>
<string name="assistant_linphone_login_desc">Ange ditt användarnamn och lösenord för Linphone-kontot</string>
<string name="assistant_login_desc">Ange ditt användarnamn och lösenord med din SIP-domän</string>
<string name="assistant_remote_provisioning_desc">Ange din provisioneringsadress</string>
<string name="transport">Transport</string>
<string name="assistant_create_account_phone_number_address">Din SIP-adress är</string>
<string name="assistant_login_linphone">Använd Linphone-konto</string>
<string name="assistant_login_generic">Använd SIP-konto</string>
<string name="assistant_remote_provisioning">Hämta fjärrkonfiguration</string>
<string name="assistant_create_account_part_1">Bekräfta landskoden och ange ditt telefonnummer</string>
<string name="assistant_create_account_part_2">Vi har skickat ett SMS med en validerings kod till ditt telefonnummer:</string>
<string name="assistant_create_account_part_3">För att slutföra ditt telefonnummer verifiering ange den 4-siffriga koden nedan:\n</string>
<string name="assistant_create_account_part_email">Ange ett användarnamn, e-postadress och lösenord för ditt Linphone-konto</string>
<string name="assistant_display_name_optional">Visningsnamn (valfritt)</string>
<string name="assistant_linphone_account">Använd ditt Linphone-konto</string>
<string name="assistant_generic_account">Använd SIP-konto</string>
<string name="assistant_remote_provisioning_title">Hämta fjärrkonfiguration</string>
<string name="assistant_fetch_apply">Hämta och tillämpa</string>
<string name="assistant_login">Logga in</string>
<string name="assistant_ec_calibration">Ekoeliminerare kalibrering pågår</string>
<string name="assistant_remote_provisioning_login">Ange din inloggning</string>
<string name="assistant_account_not_validated">Ditt konto har ännu inte validerats.</string>
<string name="assistant_error_confirmation_code">Bekräftelsekoden är ogiltig.\r\nFörsök igen.</string>
<string name="assistant_account_validated">Ditt konto har validerats.</string>
<string name="assistant_error_bad_credentials">Felaktigt användarnamn eller lösenord</string>
<string name="assistant_codec_down_question">Vill du hämta OpenH264 video kodek tillhandahållen av Cisco Systems, Inc.?</string>
<string name="assistant_codec_downloading">Hämtar OpenH264 video kodek tillhandahållen av Cisco Systems, Inc.</string>
<string name="assistant_openh264_downloading">Hämtar OpenH264</string>
<string name="assistant_openh264_restart">Innan du använder OpenH264 kodek måste du starta om %s.</string>
<string name="assistant_openh264_error">Tyvärr har ett fel inträffat.</string>
<string name="assistant_codec_downloaded">OpenH264 video kodek tillhandahållen av Cisco Systems, Inc. hämtad.</string>
<string name="wizard_failed">Ett fel inträffade, försök igen senare.</string>
<string name="wizard_server_unavailable">Server onåbar, verifiera din nätverksanslutning.</string>
<string name="wizard_username_unavailable">Detta användarnamn används redan.</string> <string name="wizard_username_unavailable">Detta användarnamn används redan.</string>
<string name="assistant_phone_number_unavailable">Det här telefonnumret är redan i bruk.\r\nAnge ett annat nummer.\r\nDu kan ta bort ditt befintliga konto om du vill återanvända ditt telefonnummer.</string>
<string name="wizard_username_incorrect">Ditt användarnamn är ogiltigt.</string>
<string name="assistant_phone_number_incorrect">Ditt telefonnummer är ogiltigt.</string>
<string name="wizard_email_incorrect">Din e-postadress är ogiltig.</string>
<string name="wizard_password_incorrect">Ditt lösenord är ogiltigt</string>
<string name="wizard_passwords_unmatched">Lösenorden matchar inte.</string>
<string name="setup_confirm_username">Your username will be %s.\r\n\r\nDet kan skilja sig från din inmatning för att matcha kraven.\r\nVill du acceptera?</string>
<string name="first_launch_no_login_password">Ange din inloggning och lösenord</string> <string name="first_launch_no_login_password">Ange din inloggning och lösenord</string>
<string name="forgot_password">Glömt lösenord ?</string>
<string name="assistant_choose_country">Välj ett land</string>
<string name="select_your_country">Välj ditt land</string>
<string name="country_code">(%s)</string>
<string name="use_username_instead_or_phone_number">Använd ett användarnamn (valfritt)</string>
<string name="use_email_for_validation">Använd e-postadress för kontovalidering</string>
<string name="login_with_username">Använd ditt användarnamn och lösenord istället för ditt telefonnummer</string>
<string name="phone_number_info_title">Vad ska mitt telefonnummer användas för?</string>
<string name="phone_number_info_content">\nTack vare ditt telefonnummer kommer dina vänner att hitta dig lättare.\n\nDu kommer att se i din adressbok vem som använder Linphone och dina vänner kommer att veta att de även kan nå dig på Linphone.\n</string>
<string name="phone_number_link_info_content">\nDina vänner hittar dig lättare om du kopplar ditt konto till ditt telefonnummer\n\nDu ser i din adressbok vilka som använder Linphone och dina vänner vet att de når dig på Linphone också.\n</string>
<string name="phone_number_link_info_content_already_account">Du kan bara använda ditt telefonnummer med ett Linphone-konto.\n\nOm du redan har länkat ditt nummer till ett annat konto, men du föredrar att använda det här, kopplar du bara det nu och ditt nummer flyttas automatiskt till det här kontot.</string>
<!--Status--> <!--Status-->
<string name="invalid_email">Ogiltig e-post</string>
<string name="account_already_exist">Konto finns redan</string>
<string name="phone_number_not_exist">Det här kontot finns inte</string>
<string name="invalid_username">Ogiltigt användarnamn</string>
<string name="invalid_domain">Ogiltig domän</string>
<string name="invalid_route">Ogiltig rutt</string>
<string name="invalid_display_name">Ogiltigt visningsnamn</string>
<string name="username_too_short">Användarnamn för kort</string>
<string name="username_too_long">Användarnamn för långt</string>
<string name="username_invalid_size">Användarnamnslängd ogiltig</string>
<string name="phone_number_too_long">Telefonnummer för långt</string>
<string name="phone_number_too_short">Telefonnummer för kort</string>
<string name="phone_number_invalid">Ogiltigt telefonnummer</string>
<string name="password_too_short">Lösenordet för kort</string>
<string name="password_too_long">Lösenord för långt</string>
<string name="request_failed">Misslyckades med att fråga servern. Vänligen försök igen senare</string>
<string name="transport_unsupported">Transport stöds inte</string>
<string name="country_code_invalid">Landskod är ogiltig</string>
<!--In-app--> <!--In-app-->
<string name="inapp">Inom appen</string>
<string name="inapp_notification_title">Köp inom appen</string>
<string name="inapp_notification_trial_expire">Försöksperioden löper ut den %s</string>
<string name="inapp_notification_account_expire">Teckningsperioden löper ut den %s</string>
<!--Dailer--> <!--Dailer-->
<string name="address_bar_hint">Ange ett nummer eller en adress</string>
<!--History--> <!--History-->
<string name="no_call_history">Inget samtal i din historia</string>
<string name="no_missed_call_history">Inget missat samtal i din historia</string>
<string name="delete_history_log">Vill du ta bort vald samtalslog?</string>
<string name="today">Idag</string> <string name="today">Idag</string>
<string name="yesterday">Igår</string> <string name="yesterday">Igår</string>
<!--Contacts--> <!--Contacts-->
<string name="no_contact">Inga kontakter i din adressbok.</string> <string name="no_contact">Inga kontakter i din adressbok.</string>
<string name="no_sip_contact">Inga SIP-kontakter i din adressbok.</string> <string name="no_sip_contact">Inga SIP-kontakter i din adressbok.</string>
<string name="delete_contacts">Vill du ta bort valda kontakter?</string>
<string name="delete_contact">Vill du ta bort vald kontakt?</string>
<string name="sip_address">SIP-adress</string> <string name="sip_address">SIP-adress</string>
<string name="contact_first_name">Förnamn</string> <string name="contact_first_name">Förnamn</string>
<string name="contact_last_name">Efternamn</string> <string name="contact_last_name">Efternamn</string>
<string name="contact_organization">Organisation</string>
<!--Chat--> <!--Chat-->
<string name="no_chat_history">Inga konversationer</string>
<string name="delete_conversation">Vill du ta bort vald konversation?</string>
<string name="delete_message">Vill du ta bort valt meddelande?</string>
<string name="remote_composing">Fjärr skriver...</string>
<string name="share_picture_size_small">Liten</string> <string name="share_picture_size_small">Liten</string>
<string name="share_picture_size_medium">Mellan</string> <string name="share_picture_size_medium">Mellan</string>
<string name="share_picture_size_large">Stor</string> <string name="share_picture_size_large">Stor</string>
<string name="share_picture_size_real">Riktig storlek</string> <string name="share_picture_size_real">Riktig storlek</string>
<string name="text_copied_to_clipboard">Text kopierades till urklipp</string>
<string name="copy_text">Kopiera text</string> <string name="copy_text">Kopiera text</string>
<string name="image_picker_title">Välj källa</string> <string name="image_picker_title">Välj källa</string>
<string name="image_saved">Bild sparad</string> <string name="image_saved">Bild sparad</string>
<string name="image_not_saved">Fel, bild ej sparad</string> <string name="image_not_saved">Fel, bild ej sparad</string>
<string name="wait">Vänta...</string> <string name="wait">Vänta...</string>
<string name="image_transfert_error">Ett fel inträffade under filöverföringen</string>
<string name="message_not_encrypted">Detta meddelande är inte krypterat</string>
<string name="message_cant_be_decrypted">Du har fått ett krypterat meddelande som du inte kan dekryptera från %s\nDu behöver ringa din korrespondent för att utbyta dina ZRTP-nycklar om du vill dekryptera de framtida meddelanden som du kommer att få.</string>
<string name="message_cant_be_decrypted_notif">Du behöver ringa din korrespondent för att utbyta dina ZRTP-nycklar om du vill dekryptera de framtida meddelanden som du kommer att få.</string>
<string name="lime_not_verified">Du försöker skicka ett meddelande med hjälp av LIME till en kontakt som inte verifierats av ZRTP.\nRing den här kontakten och verifiera hans ZRTP-nyckel innan du skickar dina meddelanden.</string>
<string name="processing_image">Bearbetning av bild kan ta upp till några sekunder beroende på filens storlek</string>
<string name="displayed">Läs</string>
<string name="delivered">Levererades</string>
<string name="resend">Skicka igen</string>
<!--Status Bar--> <!--Status Bar-->
<string name="status_connected">Registrerad</string> <string name="status_connected">Registrerad</string>
<string name="status_not_connected">Inte registrerad</string>
<string name="status_in_progress">Registrering pågår</string> <string name="status_in_progress">Registrering pågår</string>
<string name="status_error">Registrering misslyckades</string> <string name="status_error">Registrering misslyckades</string>
<string name="voicemail_unread">olästa meddelanden</string> <string name="voicemail_unread">olästa meddelanden</string>
<!--Side Menu--> <!--Side Menu-->
<string name="menu_assistant">Assistent</string>
<string name="menu_settings">Inställningar</string> <string name="menu_settings">Inställningar</string>
<string name="menu_about">Om</string> <string name="menu_about">Om</string>
<string name="quit">Avsluta</string>
<!--Call--> <!--Call-->
<string name="incoming_call">inkommande samtal</string>
<string name="outgoing_call">utgående samtal</string>
<string name="add_video_dialog">Din uppringare vill slå på video</string>
<string name="no_current_call">Inget aktivt samtal</string>
<string name="call_paused_by_remote">Din uppringare pausade samtalet</string>
<string name="couldnt_accept_call">Ett fel uppstod när du accepterade samtalet</string>
<string name="zrtp_dialog1">Bekräfta följande SAS med jämlike:\nSäg:%s</string>
<string name="zrtp_dialog2">\Din uppringare bör säga: %s</string>
<string name="zrtp_notification_title">SAS</string>
<string name="zrtp_notification_message">Bekräfta tidigare SAS-kod med din korrespondent</string>
<string name="unknown_incoming_call_name">Okänd</string> <string name="unknown_incoming_call_name">Okänd</string>
<string name="call_stats_audio">Ljud</string> <string name="call_stats_audio">Ljud</string>
<string name="call_stats_video">Video</string> <string name="call_stats_video">Video</string>
<string name="call_stats_codec">Kodek:</string>
<string name="call_stats_ip">IP-familj:</string>
<string name="call_stats_upload">Uppladdningsbandbredd:</string> <string name="call_stats_upload">Uppladdningsbandbredd:</string>
<string name="call_stats_download">Nerladdningsbandbredd:</string> <string name="call_stats_download">Nerladdningsbandbredd:</string>
<string name="call_stats_estimated_download">Beräknad hämtningsbandbredd:</string>
<string name="call_stats_ice">ICE-anslutning:</string> <string name="call_stats_ice">ICE-anslutning:</string>
<string name="call_stats_video_resolution_sent">Skickad videoupplösning:</string>
<string name="call_stats_video_resolution_received">Mottagen videoupplösning:</string>
<string name="call_stats_video_fps_sent">Skickade video fps:</string>
<string name="call_stats_video_fps_received">Mottagna video fps:</string>
<string name="call_stats_sender_loss_rate">Avsändare förlustfrekvens:</string>
<string name="call_stats_receiver_loss_rate">Mottagare förlustfrekvens:</string>
<string name="call_stats_jitter_buffer">Jitterbuffert:</string>
<string name="call_stats_encoder_name">Kodare:</string>
<string name="call_stats_decoder_name">Avkodare:</string>
<string name="call">Ring</string> <string name="call">Ring</string>
<!--About--> <!--About-->
<string name="menu_send_log">Skicka logg</string> <string name="menu_send_log">Skicka logg</string>
@ -78,18 +226,29 @@
<!--Service--> <!--Service-->
<string name="incall_notif_active">Ljudsamtal pågår</string> <string name="incall_notif_active">Ljudsamtal pågår</string>
<string name="incall_notif_paused">Pausat samtal pågår</string> <string name="incall_notif_paused">Pausat samtal pågår</string>
<string name="incall_notif_video">Videofångstsamtal pågående</string>
<string name="notification_started">startad</string> <string name="notification_started">startad</string>
<string name="unread_messages">%i olästa meddelanden</string> <string name="unread_messages">%i olästa meddelanden</string>
<string name="missed_calls_notif_title">Missat samtal</string>
<string name="missed_calls_notif_body">%i missat samtal</string>
<!--Errors--> <!--Errors-->
<string name="skipable_error_service_not_ready">Varning: tjänst inte redo</string> <string name="skipable_error_service_not_ready">Varning: tjänst inte redo</string>
<string name="error">Fel</string> <string name="error">Fel</string>
<string name="warning_wrong_destination_address">Kan inte bygga destinationsadress från %s</string>
<string name="error_unknown">Okänt fel</string> <string name="error_unknown">Okänt fel</string>
<string name="error_call_declined">Samtal avvisat</string> <string name="error_call_declined">Samtal avvisat</string>
<string name="error_user_busy">Användare upptagen</string>
<string name="error_user_not_found">Användare ej funnen</string> <string name="error_user_not_found">Användare ej funnen</string>
<string name="error_incompatible_media">Okompatibla mediaparametrar</string> <string name="error_incompatible_media">Okompatibla mediaparametrar</string>
<string name="error_low_bandwidth">Din uppringare har låg bandbredd, video kan inte startas</string>
<string name="error_network_unreachable">Nätverk otillgängligt</string> <string name="error_network_unreachable">Nätverk otillgängligt</string>
<string name="error_bad_credentials">Felaktigt inloggningsuppgifter</string> <string name="error_bad_credentials">Felaktigt inloggningsuppgifter</string>
<string name="error_unauthorized">Obehörig</string>
<string name="error_io_error">Nätverksfel</string> <string name="error_io_error">Nätverksfel</string>
<string name="download_image_failed">Hämtning misslyckad. Kontrollera din nätverksanslutning eller försök igen senare.</string>
<string name="remote_provisioning_failure">Misslyckades med att ladda ner eller tillämpa fjärrleveransprofil...</string>
<string name="remote_provisioning_again_title">Fjärrleverans</string>
<string name="remote_provisioning_again_message">Vill du ändra leverans-URI?</string>
<!--Account Settings--> <!--Account Settings-->
<string name="pref_sipaccount">SIP-konto</string> <string name="pref_sipaccount">SIP-konto</string>
<string name="pref_manage_title">Hantera</string> <string name="pref_manage_title">Hantera</string>
@ -99,85 +258,162 @@
<string name="pref_passwd">Lösenord*</string> <string name="pref_passwd">Lösenord*</string>
<string name="pref_username">Användarnamn*</string> <string name="pref_username">Användarnamn*</string>
<string name="pref_enable_outbound_proxy">Utgående proxy</string> <string name="pref_enable_outbound_proxy">Utgående proxy</string>
<string name="pref_help_proxy">SIP proxy värdnamn eller ip-adress (valfritt)</string>
<string name="pref_help_outbound_proxy">Dirigera alla samtal via SIP-proxy</string>
<string name="pref_help_username">Exempel: john om ditt konto är john@sip.exempel.org</string>
<string name="pref_help_domain">sip.exempel.org om ditt konto är john@sip.exempel.org</string>
<string name="pref_help_password">Du måste skriva in ditt lösenord igen om du redigerar ditt användarnamn och/eller domänen</string>
<string name="pref_expire_title">Upphör</string>
<string name="pref_avpf">AVPF</string> <string name="pref_avpf">AVPF</string>
<string name="pref_avpf_rr_interval">AVPF-regelbundet RTCP-intervall i sekunder (mellan 1 och 5)</string>
<string name="pref_escape_plus">Ersätt + med 00</string> <string name="pref_escape_plus">Ersätt + med 00</string>
<string name="pref_link_account">Länka ditt konto</string>
<string name="pref_auth_userid">Auth userid</string>
<string name="pref_help_auth_userid">Ange autentisering userid (valfritt)</string>
<string name="pref_display_name">Visningsnamn</string> <string name="pref_display_name">Visningsnamn</string>
<string name="pref_help_display_name">Ange visningsnamn (valfritt)</string>
<string name="pref_prefix">Prefix</string> <string name="pref_prefix">Prefix</string>
<string name="pref_transport">Transport</string>
<string name="pref_transport_udp">UDP</string> <string name="pref_transport_udp">UDP</string>
<string name="pref_transport_tcp">TCP</string> <string name="pref_transport_tcp">TCP</string>
<string name="pref_transport_tls">TLS</string> <string name="pref_transport_tls">TLS</string>
<string name="pref_delete_account">Ta bort detta konto</string> <string name="pref_delete_account">Ta bort detta konto</string>
<string name="pref_change_password">Ändra lösenord</string>
<string name="pref_default_account">Använd som standard</string> <string name="pref_default_account">Använd som standard</string>
<string name="pref_password_changed">Lösenordet ändrat</string>
<!--Settings--> <!--Settings-->
<string name="pref_sipaccounts">SIP-konton</string> <string name="pref_sipaccounts">SIP-konton</string>
<string name="default_account_flag">Standardkonto</string> <string name="default_account_flag">Standardkonto</string>
<string name="pref_add_account">Lägg till konto</string> <string name="pref_add_account">Lägg till konto</string>
<string name="pref_in_app_store">Butik inom app</string>
<string name="pref_tunnel">Tunnel</string> <string name="pref_tunnel">Tunnel</string>
<string name="pref_tunnel_host">Värdnamn</string> <string name="pref_tunnel_host">Värdnamn</string>
<string name="pref_tunnel_port">Port</string> <string name="pref_tunnel_port">Port</string>
<string name="pref_tunnel_mode">Läge</string> <string name="pref_tunnel_mode">Läge</string>
<!--do not change order without changing corresponding entry_values in non_localizable_strings.xml--> <!--do not change order without changing corresponding entry_values in non_localizable_strings.xml-->
<string-array name="tunnel_mode_entries">
<item>inaktiverad</item>
<item>Endast 3G</item>
<item>alltid</item>
<item>automatisk</item>
</string-array>
<string name="pref_none">Ingen</string> <string name="pref_none">Ingen</string>
<string name="pref_preferences_title">Inställningar</string> <string name="pref_preferences_title">Inställningar</string>
<string name="pref_video_enable_title">Aktivera video</string> <string name="pref_video_enable_title">Aktivera video</string>
<!--Audio settings--> <!--Audio settings-->
<string name="pref_audio_title">Ljud</string> <string name="pref_audio_title">Ljud</string>
<string name="pref_echo_cancellation">Ekoeliminering</string>
<string name="pref_echo_cancellation_summary">Ta bort ekot som hörs av andra änden</string>
<string name="pref_echo_canceller_calibration">Ekoeliminerarkalibrering</string>
<string name="pref_echo_tester">Testa eko</string>
<string name="ec_calibrating">Kalibrerar...</string> <string name="ec_calibrating">Kalibrerar...</string>
<string name="ec_calibrated">Kalibrerad om %s ms</string>
<string name="no_echo">Inget eko</string> <string name="no_echo">Inget eko</string>
<string name="failed">misslyckades</string> <string name="failed">misslyckades</string>
<string name="pref_adaptive_rate_control">Adaptiv hastighetskontroll</string>
<string name="pref_codec_bitrate_limit">Kodek bithastighetsgräns</string>
<string name="pref_codecs">Kodek</string>
<!--Video settings--> <!--Video settings-->
<string name="pref_video_title">Video</string> <string name="pref_video_title">Video</string>
<string name="pref_overlay">Videoöverlagring</string>
<string name="pref_overlay_summary">Visningsvideo i överlagring när det är utanför applikationen</string>
<string name="pref_video_use_front_camera_title">Använd front-kamera</string> <string name="pref_video_use_front_camera_title">Använd front-kamera</string>
<string name="pref_video_initiate_call_with_video_title">Initiera videosamtal</string> <string name="pref_video_initiate_call_with_video_title">Initiera videosamtal</string>
<string name="pref_video_initiate_call_with_video">Skicka alltid videoförfrågningar</string> <string name="pref_video_initiate_call_with_video">Skicka alltid videoförfrågningar</string>
<string name="pref_video_automatically_accept_video_title">Acceptera inkommande videoförfrågningar</string> <string name="pref_video_automatically_accept_video_title">Acceptera inkommande videoförfrågningar</string>
<string name="pref_video_automatically_accept_video">Acceptera alltid videoförfrågningar</string> <string name="pref_video_automatically_accept_video">Acceptera alltid videoförfrågningar</string>
<string name="pref_video_preset">Förinställd video</string>
<string name="pref_preferred_video_size">Föredragen videostorlek</string> <string name="pref_preferred_video_size">Föredragen videostorlek</string>
<string name="pref_preferred_fps">Föredragen FPS</string>
<string name="pref_bandwidth_limit">Bandbreddsgräns i kbit/s</string> <string name="pref_bandwidth_limit">Bandbreddsgräns i kbit/s</string>
<string name="pref_video_codecs_title">Kodek</string>
<!--Call settings--> <!--Call settings-->
<string name="pref_call_title">Ring</string> <string name="pref_call_title">Ring</string>
<string name="pref_device_ringtone">Använd enhetens ringsignal</string>
<string name="pref_auto_answer">Automatiskt svara på inkommande samtal</string>
<string name="pref_auto_answer_time">Automatisk svarstid (i millisekunder)</string>
<string name="pref_rfc2833_dtmf">Skicka in-band DTMF (RFC2833)</string>
<string name="pref_sipinfo_dtmf">Skicka ut-band DTMF (SIP INFO)</string>
<string name="pref_voice_mail">Röstbrevlåda URI</string>
<!--Chat settings--> <!--Chat settings-->
<string name="pref_chat_title">Chatt</string> <string name="pref_chat_title">Chatt</string>
<string name="pref_image_sharing_server_title">Delar server</string> <string name="pref_image_sharing_server_title">Delar server</string>
<string name="pref_image_sharing_server_desc">Redigera inte om du inte vet vad du gör!</string>
<string name="pref_use_lime_encryption">Använd LIME-kryptering</string>
<string name="lime_encryption_entry_disabled">Inaktiverad</string>
<string name="lime_encryption_entry_mandatory">Obligatorisk</string>
<string name="lime_encryption_entry_preferred">Föredragen</string>
<string name="lime_encryption_enable_zrtp">LIME kräver ZRTP-kryptering.\nGenom att aktivera LIME aktiverar du automatiskt ZRTP-mediekryptering.</string>
<!--Network settings--> <!--Network settings-->
<string name="pref_network_title">Nätverk</string> <string name="pref_network_title">Nätverk</string>
<string name="pref_wifi_only">Använd endast wifi</string>
<string name="pref_doze_mode">Doze-läge</string>
<string name="pref_stun_server">STUN / TURN-server</string>
<string name="pref_ice_enable">Aktivera ICE</string> <string name="pref_ice_enable">Aktivera ICE</string>
<string name="pref_turn_enable">Aktivera TURN</string>
<string name="pref_turn_username_title">STUN / TURN användarnamn (valfritt)</string>
<string name="pref_turn_passwd_title">STUN / TURN lösenord (valfritt)</string>
<string name="pref_upnp_enable">Aktivera UPNP</string> <string name="pref_upnp_enable">Aktivera UPNP</string>
<string name="pref_transport_use_random_ports">Använd slumpade portar</string> <string name="pref_transport_use_random_ports">Använd slumpade portar</string>
<string name="pref_sip_port_title">SIP-port att använda</string> <string name="pref_sip_port_title">SIP-port att använda</string>
<string name="pref_video_port_title">Videoport eller portintervall</string>
<string name="pref_audio_port_title">Ljudport eller portintervall</string>
<string name="pref_video_port_description">Videoport eller portintervall (minport-maxport)</string>
<string name="pref_audio_port_description">Ljudport eller portintervall (minport-maxport)</string>
<string name="pref_media_encryption">Media-kryptering</string> <string name="pref_media_encryption">Media-kryptering</string>
<string name="pref_push_notification">Aktivera push-meddelanden</string>
<string name="pref_ipv6_title">Tillåt IPv6</string>
<!--Advanced settings--> <!--Advanced settings-->
<string name="pref_advanced_title">Avancerat</string> <string name="pref_advanced_title">Avancerat</string>
<string name="pref_debug_title">Felsök</string>
<string name="pref_debug">Felsök</string>
<string name="pref_friendlist_subscribe">Prenumerera på vänlista</string>
<string name="pref_background_mode">Bakgrundsläge</string> <string name="pref_background_mode">Bakgrundsläge</string>
<string name="pref_animation_enable_title">Aktivera animeringar</string> <string name="pref_animation_enable_title">Aktivera animeringar</string>
<string name="pref_service_notification">Aktivera serviceanmälan</string>
<string name="pref_autostart">Starta vid uppstart</string> <string name="pref_autostart">Starta vid uppstart</string>
<string name="pref_remote_provisioning_title">Fjärrleverans</string>
<string name="pref_android_app_settings_title">Android-appinställningar</string>
<string name="pref_primary_account_title">Primärt konto</string> <string name="pref_primary_account_title">Primärt konto</string>
<string name="pref_display_name_title">Visningsnamn</string> <string name="pref_display_name_title">Visningsnamn</string>
<string name="pref_user_name_title">Användarnamn</string> <string name="pref_user_name_title">Användarnamn</string>
<!--Audio hack settings--> <!--Audio hack settings-->
<string name="pref_audio_hacks_title">Ljud-hacks</string> <string name="pref_audio_hacks_title">Ljud-hacks</string>
<string name="pref_audio_use_specific_mode_title">Använd specifikt läge hack</string>
<string name="pref_audio_use_specific_mode_summary">0=MODE_NORMAL (standard), 2=MODE_IN_CALL</string>
<string name="pref_audio_hacks_use_routing_api_title">Använd rutt API hack</string>
<string name="pref_audio_hacks_use_galaxys_hack_title">Använd Galaxy S-ljudhack</string> <string name="pref_audio_hacks_use_galaxys_hack_title">Använd Galaxy S-ljudhack</string>
<!--Content description--> <!--Content description-->
<string name="content_description_back">Tillbaka</string> <string name="content_description_back">Tillbaka</string>
<string name="content_description_dialer">Uppringare</string>
<string name="content_description_menu">Meny</string>
<string name="content_description_toggle_micro">Växla micro</string> <string name="content_description_toggle_micro">Växla micro</string>
<string name="content_description_toggle_speaker">Växla högtalare</string> <string name="content_description_toggle_speaker">Växla högtalare</string>
<string name="content_description_decline">Avvisa</string> <string name="content_description_decline">Avvisa</string>
<string name="content_description_hang_up">Lägg på</string> <string name="content_description_hang_up">Lägg på</string>
<string name="content_description_accept">Acceptera</string> <string name="content_description_accept">Acceptera</string>
<string name="content_description_edit">Redigera</string> <string name="content_description_edit">Redigera</string>
<string name="content_description_edit_list">Redigera lista</string>
<string name="content_description_valid">Giltig</string>
<string name="content_description_add_contact">Lägg till kontakter</string> <string name="content_description_add_contact">Lägg till kontakter</string>
<string name="content_description_new_contact">Ny kontakt</string> <string name="content_description_new_contact">Ny kontakt</string>
<string name="content_description_call">Ring</string> <string name="content_description_call">Ring</string>
<string name="content_description_backspace">Baksteg</string>
<string name="content_description_chat">Chatt</string> <string name="content_description_chat">Chatt</string>
<string name="content_description_dial_back">Ring tillbaka</string> <string name="content_description_dial_back">Ring tillbaka</string>
<string name="content_description_dialer_back">Återgå till uppringare</string>
<string name="content_description_contact_picture">Kontakt-bild</string> <string name="content_description_contact_picture">Kontakt-bild</string>
<string name="content_description_send_message">Skicka meddelande</string> <string name="content_description_send_message">Skicka meddelande</string>
<string name="content_description_detail">Detaljer</string>
<string name="content_description_delete">Ta bort</string> <string name="content_description_delete">Ta bort</string>
<string name="content_description_add">Lägg till samtal</string> <string name="content_description_add">Lägg till samtal</string>
<string name="content_description_new_discussion">Ny diskussion</string> <string name="content_description_new_discussion">Ny diskussion</string>
<string name="content_description_search">Sök</string> <string name="content_description_search">Sök</string>
<string name="content_description_search_contact">Sök kontakt</string>
<string name="content_description_search_country">Sök land</string>
<string name="content_description_all_contacts">Alla kontakter</string> <string name="content_description_all_contacts">Alla kontakter</string>
<string name="content_description_linphone_contacts">Linphone-kontakter</string> <string name="content_description_linphone_contacts">Linphone-kontakter</string>
<string name="content_description_call_direction">Samtalsriktning</string>
<string name="content_description_all_calls">Alla samtal</string> <string name="content_description_all_calls">Alla samtal</string>
<string name="content_description_missed_calls">Missade samtal</string> <string name="content_description_missed_calls">Missade samtal</string>
<string name="content_description_switch_video">Växla video</string> <string name="content_description_switch_video">Växla video</string>
@ -192,9 +428,31 @@
<string name="content_description_cancel_button">Avbryt-knapp</string> <string name="content_description_cancel_button">Avbryt-knapp</string>
<string name="content_description_message_status">Meddelandestatus</string> <string name="content_description_message_status">Meddelandestatus</string>
<string name="content_description_conference">Konferens</string> <string name="content_description_conference">Konferens</string>
<string name="content_description_username_field">Användarnamn fält</string>
<string name="content_description_activation_code_field">Användarnamn fält</string>
<string name="content_description_phone_number_field">Telefonnummerfält</string>
<string name="content_description_display_field">Visningsnamn fält</string>
<string name="content_description_domain_field">Domänfält</string>
<string name="content_description_url_field">Fjärrleverans fält</string>
<string name="content_description_confirm_password_field">Bekräfta lösenordsfält</string>
<string name="content_description_email_field">E-postfält</string>
<string name="content_description_default_account">Standardkonto</string> <string name="content_description_default_account">Standardkonto</string>
<string name="content_description_deselect_all">Avmarkera alla</string>
<string name="content_description_select_all">Markera alla</string>
<string name="content_description_delete_selection">Ta bort markering</string>
<string name="content_description_contact_first_name">Förnamn</string> <string name="content_description_contact_first_name">Förnamn</string>
<string name="content_description_contact_last_name">Efternamn</string> <string name="content_description_contact_last_name">Efternamn</string>
<string name="content_description_contact_organization">Organisation</string>
<string name="content_description_back_call">Tillbaka till samtal</string>
<string name="content_description_send_file">Skicka en fil</string>
<string name="content_description_incoming_file">Inkommande fil</string>
<string name="content_description_message">Meddelande</string>
<string name="content_description_unread_chat_message">Oläst chattmeddelande</string>
<string name="content_description_transfer">Överför</string> <string name="content_description_transfer">Överför</string>
<string name="content_description_earpiece">Hörlur</string>
<string name="content_description_bluetooth">Bluetooth</string> <string name="content_description_bluetooth">Bluetooth</string>
<string name="content_description_call_options">Samtalsalternativ</string>
<string name="content_description_audio_route">Ljudväg</string>
<string name="content_description_exit_conference">Avsluta konferens</string>
<string name="content_title_notification">Linphone-avisering</string>
</resources> </resources>

View file

@ -135,6 +135,7 @@
<string name="pref_rfc2833_dtmf_key">pref_rfc2833_dtmf_key</string> <string name="pref_rfc2833_dtmf_key">pref_rfc2833_dtmf_key</string>
<string name="pref_sipinfo_dtmf_key">pref_sipinfo_dtmf_key</string> <string name="pref_sipinfo_dtmf_key">pref_sipinfo_dtmf_key</string>
<string name="pref_voice_mail_key">pref_voice_mail_key</string> <string name="pref_voice_mail_key">pref_voice_mail_key</string>
<string name="pref_dialer_call_key">pref_dialer_call_key</string>
<string name="pref_upnp_enable_key">pref_upnp_enable_key</string> <string name="pref_upnp_enable_key">pref_upnp_enable_key</string>
<string name="pref_first_time_linphone_chat_storage">pref_first_time_linphone_chat_storage</string> <string name="pref_first_time_linphone_chat_storage">pref_first_time_linphone_chat_storage</string>

View file

@ -223,6 +223,7 @@
<string name="call_stats_ip">IP Family:</string> <string name="call_stats_ip">IP Family:</string>
<string name="call_stats_upload">Upload bandwidth:</string> <string name="call_stats_upload">Upload bandwidth:</string>
<string name="call_stats_download">Download bandwidth:</string> <string name="call_stats_download">Download bandwidth:</string>
<string name="call_stats_estimated_download">Estimated download bandwidth:</string>
<string name="call_stats_ice">ICE connectivity:</string> <string name="call_stats_ice">ICE connectivity:</string>
<string name="call_stats_video_resolution_sent">Sent video resolution:</string> <string name="call_stats_video_resolution_sent">Sent video resolution:</string>
<string name="call_stats_video_resolution_received">Received video resolution:</string> <string name="call_stats_video_resolution_received">Received video resolution:</string>
@ -359,6 +360,7 @@
<string name="pref_sipinfo_dtmf">Send out-band DTMFs(SIP INFO)</string> <string name="pref_sipinfo_dtmf">Send out-band DTMFs(SIP INFO)</string>
<string name="pref_call_timeout_title">Call timeout(in seconds)</string> <string name="pref_call_timeout_title">Call timeout(in seconds)</string>
<string name="pref_voice_mail">Voice mail URI</string> <string name="pref_voice_mail">Voice mail URI</string>
<string name="pref_dialer_call">Use Linphone as default phone app</string>
<!-- Chat settings --> <!-- Chat settings -->
<string name="pref_chat_title">Chat</string> <string name="pref_chat_title">Chat</string>

View file

@ -225,6 +225,12 @@
android:key="@string/pref_voice_mail_key" android:key="@string/pref_voice_mail_key"
android:persistent="false"/> android:persistent="false"/>
<CheckBoxPreference
android:title="@string/pref_dialer_call"
android:key="@string/pref_dialer_call_key"
android:persistent="false"/>
</PreferenceCategory> </PreferenceCategory>
</PreferenceScreen> </PreferenceScreen>
@ -264,11 +270,6 @@
android:key="@string/pref_wifi_only_key" android:key="@string/pref_wifi_only_key"
android:persistent="false"/> android:persistent="false"/>
<CheckBoxPreference
android:title="@string/pref_doze_mode"
android:key="@string/pref_doze_mode_key"
android:persistent="false"/>
<EditTextPreference <EditTextPreference
android:title="@string/pref_stun_server" android:title="@string/pref_stun_server"
android:key="@string/pref_stun_server_key" android:key="@string/pref_stun_server_key"

View file

@ -1,7 +1,8 @@
package org.linphone.mini; package org.linphone.mini;
/* /*
LinphoneMiniActivity.java LinphoneMiniActivity.java
Copyright (C) 2014 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -21,9 +22,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import android.app.Activity; import android.app.Activity;
import android.os.Bundle; import android.os.Bundle;
/**
* @author Sylvain Berfini
*/
public class LinphoneMiniActivity extends Activity { public class LinphoneMiniActivity extends Activity {
private LinphoneMiniManager mManager; private LinphoneMiniManager mManager;

View file

@ -1,7 +1,8 @@
package org.linphone.mini; package org.linphone.mini;
/* /*
LinphoneMiniManager.java LinphoneMiniManager.java
Copyright (C) 2014 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -51,9 +52,6 @@ import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration.
import android.content.Context; import android.content.Context;
import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.PackageManager.NameNotFoundException;
/**
* @author Sylvain Berfini
*/
public class LinphoneMiniManager implements LinphoneCoreListener { public class LinphoneMiniManager implements LinphoneCoreListener {
private static LinphoneMiniManager mInstance; private static LinphoneMiniManager mInstance;
private Context mContext; private Context mContext;

View file

@ -1,7 +1,8 @@
package org.linphone.mini; package org.linphone.mini;
/* /*
LinphoneMiniUtils.java LinphoneMiniUtils.java
Copyright (C) 2014 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -25,9 +26,6 @@ import java.io.InputStream;
import android.content.Context; import android.content.Context;
/**
* @author Sylvain Berfini
*/
public class LinphoneMiniUtils { public class LinphoneMiniUtils {
public static void copyIfNotExist(Context context, int ressourceId, String target) throws IOException { public static void copyIfNotExist(Context context, int ressourceId, String target) throws IOException {
File lFileToCopy = new File(target); File lFileToCopy = new File(target);

View file

@ -1,7 +1,7 @@
package org.linphone; package org.linphone;
/* /*
AboutFragment.java AboutFragment.java
Copyright (C) 2012 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -18,9 +18,9 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
import org.linphone.core.LinphoneCore; import org.linphone.core.Core;
import org.linphone.core.LinphoneCore.LogCollectionUploadState; import org.linphone.core.Core.LogCollectionUploadState;
import org.linphone.core.LinphoneCoreListenerBase; import org.linphone.core.CoreListenerStub;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
import android.app.Fragment; import android.app.Fragment;
@ -40,14 +40,11 @@ import android.view.WindowManager;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
/**
* @author Sylvain Berfini
*/
public class AboutFragment extends Fragment implements OnClickListener { public class AboutFragment extends Fragment implements OnClickListener {
View sendLogButton = null; View sendLogButton = null;
View resetLogButton = null; View resetLogButton = null;
ImageView cancel; ImageView cancel;
LinphoneCoreListenerBase mListener; CoreListenerStub mListener;
private ProgressDialog progress; private ProgressDialog progress;
private boolean uploadInProgress; private boolean uploadInProgress;
@ -75,19 +72,19 @@ public class AboutFragment extends Fragment implements OnClickListener {
resetLogButton.setOnClickListener(this); resetLogButton.setOnClickListener(this);
resetLogButton.setVisibility(LinphonePreferences.instance().isDebugEnabled() ? View.VISIBLE : View.GONE); resetLogButton.setVisibility(LinphonePreferences.instance().isDebugEnabled() ? View.VISIBLE : View.GONE);
mListener = new LinphoneCoreListenerBase() { mListener = new CoreListenerStub() {
@Override @Override
public void uploadProgressIndication(LinphoneCore lc, int offset, int total) { public void onLogCollectionUploadProgressIndication(Core lc, int offset, int total) {
} }
@Override @Override
public void uploadStateChanged(LinphoneCore lc, LogCollectionUploadState state, String info) { public void onLogCollectionUploadStateChanged(Core lc, LogCollectionUploadState state, String info) {
if (state == LogCollectionUploadState.LogCollectionUploadStateInProgress) { if (state == LogCollectionUploadState.InProgress) {
displayUploadLogsInProgress(); displayUploadLogsInProgress();
} else if (state == LogCollectionUploadState.LogCollectionUploadStateDelivered || state == LogCollectionUploadState.LogCollectionUploadStateNotDelivered) { } else if (state == LogCollectionUploadState.Delivered || state == LogCollectionUploadState.NotDelivered) {
uploadInProgress = false; uploadInProgress = false;
if (progress != null) progress.dismiss(); if (progress != null) progress.dismiss();
if (state == LogCollectionUploadState.LogCollectionUploadStateDelivered) { if (state == LogCollectionUploadState.Delivered) {
sendLogs(LinphoneService.instance().getApplicationContext(), info); sendLogs(LinphoneService.instance().getApplicationContext(), info);
} }
} }
@ -130,7 +127,7 @@ public class AboutFragment extends Fragment implements OnClickListener {
@Override @Override
public void onPause() { public void onPause() {
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) { if (lc != null) {
lc.removeListener(mListener); lc.removeListener(mListener);
} }
@ -140,7 +137,7 @@ public class AboutFragment extends Fragment implements OnClickListener {
@Override @Override
public void onResume() { public void onResume() {
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) { if (lc != null) {
lc.addListener(mListener); lc.addListener(mListener);
} }
@ -155,7 +152,7 @@ public class AboutFragment extends Fragment implements OnClickListener {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (LinphoneActivity.isInstanciated()) { if (LinphoneActivity.isInstanciated()) {
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (v == sendLogButton) { if (v == sendLogButton) {
if (lc != null) { if (lc != null) {
lc.uploadLogCollection(); lc.uploadLogCollection();

View file

@ -1,7 +1,8 @@
package org.linphone; package org.linphone;
/* /*
RemoteProvisioningActivity.java AccountEnableReceiver.java
Copyright (C) 2014 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -18,15 +19,11 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.util.Log; import android.util.Log;
/**
* @author Graham Barnett
*/
public class AccountEnableReceiver extends BroadcastReceiver { public class AccountEnableReceiver extends BroadcastReceiver {
private static final String TAG = "AccountEnableReceiver"; private static final String TAG = "AccountEnableReceiver";
private static final String FIELD_ID = "id"; private static final String FIELD_ID = "id";

View file

@ -1,7 +1,7 @@
package org.linphone; package org.linphone;
/* /*
AccountPreferencesFragment.java AccountPreferencesFragment.java
Copyright (C) 2012 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -23,11 +23,12 @@ import java.util.List;
import org.linphone.LinphonePreferences.AccountBuilder; import org.linphone.LinphonePreferences.AccountBuilder;
import org.linphone.assistant.AssistantActivity; import org.linphone.assistant.AssistantActivity;
import org.linphone.core.LinphoneAccountCreator; import org.linphone.core.AccountCreator;
import org.linphone.core.LinphoneCoreException; import org.linphone.core.AccountCreatorListener;
import org.linphone.core.LinphoneCoreFactory; import org.linphone.core.CoreException;
import org.linphone.core.LinphoneNatPolicy; import org.linphone.core.Factory;
import org.linphone.core.LinphoneProxyConfig; import org.linphone.core.NatPolicy;
import org.linphone.core.ProxyConfig;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
import org.linphone.ui.PreferencesListFragment; import org.linphone.ui.PreferencesListFragment;
@ -53,17 +54,14 @@ import android.view.WindowManager;
import android.widget.CheckBox; import android.widget.CheckBox;
import android.widget.EditText; import android.widget.EditText;
/** public class AccountPreferencesFragment extends PreferencesListFragment implements AccountCreatorListener {
* @author Sylvain Berfini
*/
public class AccountPreferencesFragment extends PreferencesListFragment implements LinphoneAccountCreator.LinphoneAccountCreatorListener {
private int n; private int n;
private boolean isNewAccount=false; private boolean isNewAccount=false;
private LinphonePreferences mPrefs; private LinphonePreferences mPrefs;
private EditTextPreference mProxyPreference; private EditTextPreference mProxyPreference;
private ListPreference mTransportPreference; private ListPreference mTransportPreference;
private AccountBuilder builder; private AccountBuilder builder;
private LinphoneAccountCreator accountCreator; private AccountCreator accountCreator;
private ProgressDialog progress; private ProgressDialog progress;
public AccountPreferencesFragment() { public AccountPreferencesFragment() {
@ -107,7 +105,7 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen
@Override @Override
public boolean onPreferenceChange(Preference preference, Object newValue) { public boolean onPreferenceChange(Preference preference, Object newValue) {
if (isNewAccount) { if (isNewAccount) {
builder.setUserId(newValue.toString()); builder.setUserid(newValue.toString());
} else { } else {
mPrefs.setAccountUserId(n, newValue.toString()); mPrefs.setAccountUserId(n, newValue.toString());
} }
@ -157,7 +155,7 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen
public boolean onPreferenceChange(Preference preference, Object newValue) { public boolean onPreferenceChange(Preference preference, Object newValue) {
String value = newValue.toString(); String value = newValue.toString();
if (isNewAccount) { if (isNewAccount) {
builder.setProxy(newValue.toString()); builder.setServerAddr(newValue.toString());
preference.setSummary(newValue.toString()); preference.setSummary(newValue.toString());
} else { } else {
mPrefs.setAccountProxy(n, value); mPrefs.setAccountProxy(n, value);
@ -214,7 +212,7 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen
if (isNewAccount) { if (isNewAccount) {
builder.setAvpfEnabled(value); builder.setAvpfEnabled(value);
} else { } else {
mPrefs.enableAvpf(n, value); mPrefs.setAvpfMode(n, value);
} }
return true; return true;
} }
@ -232,7 +230,7 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen
if (isNewAccount) { if (isNewAccount) {
//TODO //TODO
} else { } else {
mPrefs.setAvpfRRInterval(n, value); mPrefs.setAvpfRrInterval(n, value);
} }
preference.setSummary(value); preference.setSummary(value);
return true; return true;
@ -323,11 +321,11 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen
private void initAccountPreferencesFields(PreferenceScreen parent) { private void initAccountPreferencesFields(PreferenceScreen parent) {
boolean isDefaultAccount = mPrefs.getDefaultAccountIndex() == n; boolean isDefaultAccount = mPrefs.getDefaultAccountIndex() == n;
LinphoneNatPolicy natPolicy = null; NatPolicy natPolicy = null;
if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null && if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null &&
LinphoneManager.getLc().getProxyConfigList() != null && LinphoneManager.getLc().getProxyConfigList() != null &&
LinphoneManager.getLc().getProxyConfigList().length > n) { LinphoneManager.getLc().getProxyConfigList().length > n) {
LinphoneProxyConfig proxy = LinphoneManager.getLc().getProxyConfigList()[n]; ProxyConfig proxy = LinphoneManager.getLc().getProxyConfigList()[n];
natPolicy = proxy.getNatPolicy(); natPolicy = proxy.getNatPolicy();
if (natPolicy == null) { if (natPolicy == null) {
natPolicy = LinphoneManager.getLc().createNatPolicy(); natPolicy = LinphoneManager.getLc().createNatPolicy();
@ -337,8 +335,7 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen
} }
} }
accountCreator = LinphoneCoreFactory.instance().createAccountCreator(LinphoneManager.getLc() accountCreator = LinphoneManager.getLc().createAccountCreator(LinphonePreferences.instance().getXmlrpcUrl());
, LinphonePreferences.instance().getXmlrpcUrl());
accountCreator.setListener(this); accountCreator.setListener(this);
PreferenceCategory account = (PreferenceCategory) getPreferenceScreen().findPreference(getString(R.string.pref_sipaccount_key)); PreferenceCategory account = (PreferenceCategory) getPreferenceScreen().findPreference(getString(R.string.pref_sipaccount_key));
@ -433,8 +430,8 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen
EditTextPreference avpfRRInterval = (EditTextPreference) advanced.getPreference(8); EditTextPreference avpfRRInterval = (EditTextPreference) advanced.getPreference(8);
avpfRRInterval.setOnPreferenceChangeListener(avpfRRIntervalChangedListener); avpfRRInterval.setOnPreferenceChangeListener(avpfRRIntervalChangedListener);
if (!isNewAccount){ if (!isNewAccount){
avpfRRInterval.setText(mPrefs.getAvpfRRInterval(n)); avpfRRInterval.setText(mPrefs.getAvpfRrInterval(n));
avpfRRInterval.setSummary(mPrefs.getAvpfRRInterval(n)); avpfRRInterval.setSummary(mPrefs.getAvpfRrInterval(n));
} }
CheckBoxPreference escape = (CheckBoxPreference) advanced.getPreference(9); CheckBoxPreference escape = (CheckBoxPreference) advanced.getPreference(9);
@ -486,17 +483,17 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen
dialog.dismiss(); dialog.dismiss();
} }
}); });
alert.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { /*alert.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
LinphoneAccountCreator.PasswordCheck status = accountCreator.setPassword(pass1.getText().toString()); AccountCreator.PasswordStatus status = accountCreator.setPassword(pass1.getText().toString());
if (status.equals(LinphoneAccountCreator.PasswordCheck.Ok)) { if (status.equals(AccountCreator.PasswordStatus.Ok)) {
if (pass1.getText().toString().compareTo(pass2.getText().toString()) == 0) { if (pass1.getText().toString().compareTo(pass2.getText().toString()) == 0) {
accountCreator.setUsername(mPrefs.getAccountUsername(n)); accountCreator.setUsername(mPrefs.getAccountUsername(n));
accountCreator.setHa1(mPrefs.getAccountHa1(n)); accountCreator.setHa1(mPrefs.getAccountHa1(n));
LinphoneAccountCreator.RequestStatus req_status = accountCreator.updatePassword(pass1.getText().toString()); AccountCreator.Status req_status = accountCreator.updatePassword(pass1.getText().toString());
if (!req_status.equals(LinphoneAccountCreator.RequestStatus.Ok)) { if (!req_status.equals(AccountCreator.Status.RequestOk)) {
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForRequestStatus(req_status) LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(req_status)
, LinphoneActivity.instance()); , LinphoneActivity.instance());
} else { } else {
progress = ProgressDialog.show(LinphoneActivity.instance(), null, null); progress = ProgressDialog.show(LinphoneActivity.instance(), null, null);
@ -515,7 +512,7 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen
} }
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForPasswordStatus(status), LinphoneActivity.instance()); LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForPasswordStatus(status), LinphoneActivity.instance());
} }
}); });*/ // TODO FIXME
alert.setView(layout); alert.setView(layout);
alert.show(); alert.show();
@ -590,7 +587,7 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen
if(isNewAccount){ if(isNewAccount){
builder.saveNewAccount(); builder.saveNewAccount();
} }
} catch (LinphoneCoreException e) { } catch (CoreException e) {
Log.e(e); Log.e(e);
} }
LinphoneActivity.instance().isNewProxyConfig(); LinphoneActivity.instance().isNewProxyConfig();
@ -600,58 +597,58 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen
} }
@Override @Override
public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onIsAccountExist(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
@Override @Override
public void onAccountCreatorAccountCreated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onCreateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
@Override @Override
public void onAccountCreatorAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onActivateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
@Override @Override
public void onAccountCreatorAccountLinkedWithPhoneNumber(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onLinkAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
@Override @Override
public void onAccountCreatorPhoneNumberLinkActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onActivateAlias(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
@Override @Override
public void onAccountCreatorIsAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onIsAccountActivated(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
@Override @Override
public void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onRecoverAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
@Override @Override
public void onAccountCreatorIsAccountLinked(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onIsAccountLinked(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
@Override @Override
public void onAccountCreatorIsPhoneNumberUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onIsAliasUsed(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
@Override @Override
public void onAccountCreatorPasswordUpdated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onUpdateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
if (progress != null) progress.dismiss(); if (progress != null) progress.dismiss();
if (status.equals(LinphoneAccountCreator.RequestStatus.Ok)) { if (status.equals(AccountCreator.Status.RequestOk)) {
mPrefs.setAccountPassword(n, accountCreator.getPassword()); mPrefs.setAccountPassword(n, accountCreator.getPassword());
PreferenceCategory account = (PreferenceCategory) getPreferenceScreen().findPreference(getString(R.string.pref_sipaccount_key)); PreferenceCategory account = (PreferenceCategory) getPreferenceScreen().findPreference(getString(R.string.pref_sipaccount_key));
((EditTextPreference) account.getPreference(2)).setText(mPrefs.getAccountPassword(n)); ((EditTextPreference) account.getPreference(2)).setText(mPrefs.getAccountPassword(n));
LinphoneUtils.displayErrorAlert(getString(R.string.pref_password_changed), LinphoneActivity.instance()); LinphoneUtils.displayErrorAlert(getString(R.string.pref_password_changed), LinphoneActivity.instance());
} else { } else {
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForRequestStatus(status), LinphoneActivity.instance()); LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status), LinphoneActivity.instance());
} }
} }
} }

View file

@ -1,6 +1,8 @@
package org.linphone;
/* /*
BandwithManager.java BandwithManager.java
Copyright (C) 2010 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -16,10 +18,9 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
package org.linphone;
import org.linphone.core.LinphoneCallParams; import org.linphone.core.CallParams;
import org.linphone.core.LinphoneCore; import org.linphone.core.Core;
public class BandwidthManager { public class BandwidthManager {
@ -46,15 +47,15 @@ public class BandwidthManager {
} }
public void updateWithProfileSettings(LinphoneCore lc, LinphoneCallParams callParams) { public void updateWithProfileSettings(Core lc, CallParams callParams) {
if (callParams != null) { // in call if (callParams != null) { // in call
// Update video parm if // Update video parm if
if (!isVideoPossible()) { // NO VIDEO if (!isVideoPossible()) { // NO VIDEO
callParams.setVideoEnabled(false); callParams.enableVideo(false);
callParams.setAudioBandwidth(40); callParams.setAudioBandwidthLimit(40);
} else { } else {
callParams.setVideoEnabled(true); callParams.enableVideo(true);
callParams.setAudioBandwidth(0); // disable limitation callParams.setAudioBandwidthLimit(0); // disable limitation
} }
} }
} }

View file

@ -1,7 +1,7 @@
package org.linphone; package org.linphone;
/* /*
BluetoothManager.java BluetoothManager.java
Copyright (C) 2012 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
import java.util.List; import java.util.List;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
@ -34,9 +35,6 @@ import android.content.IntentFilter;
import android.media.AudioManager; import android.media.AudioManager;
import android.os.Build; import android.os.Build;
/**
* @author Sylvain Berfini
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @TargetApi(Build.VERSION_CODES.HONEYCOMB)
public class BluetoothManager extends BroadcastReceiver { public class BluetoothManager extends BroadcastReceiver {
public int PLANTRONICS_BUTTON_PRESS = 1; public int PLANTRONICS_BUTTON_PRESS = 1;

View file

@ -1,6 +1,8 @@
package org.linphone;
/* /*
BootReceiver.java BootReceiver.java
Copyright (C) 2010 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -16,10 +18,9 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
package org.linphone;
import org.linphone.core.LinphoneCoreFactory; import org.linphone.core.Factory;
import org.linphone.core.LpConfig; import org.linphone.core.Config;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
@ -31,12 +32,10 @@ public class BootReceiver extends BroadcastReceiver {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
if (intent.getAction().equalsIgnoreCase(Intent.ACTION_SHUTDOWN)) { if (intent.getAction().equalsIgnoreCase(Intent.ACTION_SHUTDOWN)) {
android.util.Log.d("LinphoneBootReceiver", "Device is shutting down, destroying LinphoneCore to unregister"); android.util.Log.d("LinphoneBootReceiver", "Device is shutting down, destroying Core to unregister");
LinphoneManager.destroy(); LinphoneManager.destroy();
} else { } else {
String path = context.getFilesDir().getAbsolutePath() + "/.linphonerc"; boolean autostart = LinphonePreferences.instance().isAutoStartEnabled();
LpConfig lpConfig = LinphoneCoreFactory.instance().createLpConfig(path);
boolean autostart = lpConfig.getBool("app", "auto_start", false);
android.util.Log.i("LinphoneBootReceiver", "Device is starting, auto_start is " + autostart); android.util.Log.i("LinphoneBootReceiver", "Device is starting, auto_start is " + autostart);
if (autostart) { if (autostart) {
Intent lLinphoneServiceIntent = new Intent(Intent.ACTION_MAIN); Intent lLinphoneServiceIntent = new Intent(Intent.ACTION_MAIN);

View file

@ -1,7 +1,8 @@
package org.linphone; package org.linphone;
/* /*
CallActivity.java CallActivity.java
Copyright (C) 2015 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -17,6 +18,7 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
import android.Manifest; import android.Manifest;
import android.app.Activity; import android.app.Activity;
import android.app.Dialog; import android.app.Dialog;
@ -60,19 +62,20 @@ import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import org.linphone.core.LinphoneAddress; import org.linphone.core.Address;
import org.linphone.core.LinphoneCall; import org.linphone.core.Call;
import org.linphone.core.LinphoneCall.State; import org.linphone.core.Call.State;
import org.linphone.core.LinphoneCallParams; import org.linphone.core.CallParams;
import org.linphone.core.LinphoneCallStats; import org.linphone.core.CallStats;
import org.linphone.core.LinphoneCallStats.LinphoneAddressFamily; import org.linphone.core.CallStats.AddressFamily;
import org.linphone.core.LinphoneChatMessage; import org.linphone.core.ChatMessage;
import org.linphone.core.LinphoneChatRoom; import org.linphone.core.ChatRoom;
import org.linphone.core.LinphoneCore; import org.linphone.core.Core;
import org.linphone.core.LinphoneCoreException; import org.linphone.core.CoreException;
import org.linphone.core.LinphoneCoreListenerBase; import org.linphone.core.CoreListenerStub;
import org.linphone.core.LinphonePlayer; import org.linphone.core.Player;
import org.linphone.core.PayloadType; import org.linphone.core.PayloadType;
import org.linphone.core.StreamType;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration; import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
import org.linphone.ui.Numpad; import org.linphone.ui.Numpad;
@ -84,9 +87,6 @@ import java.util.List;
import java.util.Timer; import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
/**
* @author Sylvain Berfini
*/
public class CallActivity extends LinphoneGenericActivity implements OnClickListener, ActivityCompat.OnRequestPermissionsResultCallback { public class CallActivity extends LinphoneGenericActivity implements OnClickListener, ActivityCompat.OnRequestPermissionsResultCallback {
private final static int SECONDS_BEFORE_HIDING_CONTROLS = 4000; private final static int SECONDS_BEFORE_HIDING_CONTROLS = 4000;
private final static int SECONDS_BEFORE_DENYING_CALL_UPDATE = 30000; private final static int SECONDS_BEFORE_DENYING_CALL_UPDATE = 30000;
@ -121,7 +121,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
private LayoutInflater inflater; private LayoutInflater inflater;
private ViewGroup container; private ViewGroup container;
private boolean isConferenceRunning = false; private boolean isConferenceRunning = false;
private LinphoneCoreListenerBase mListener; private CoreListenerStub mListener;
private DrawerLayout sideMenu; private DrawerLayout sideMenu;
private Handler mHandler = new Handler(); private Handler mHandler = new Handler();
@ -157,14 +157,14 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
mEncoderTexts = new HashMap<String, String>(); mEncoderTexts = new HashMap<String, String>();
mDecoderTexts = new HashMap<String, String>(); mDecoderTexts = new HashMap<String, String>();
mListener = new LinphoneCoreListenerBase() { mListener = new CoreListenerStub() {
@Override @Override
public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) { public void onMessageReceived(Core lc, ChatRoom cr, ChatMessage message) {
displayMissedChats(); displayMissedChats();
} }
@Override @Override
public void callState(LinphoneCore lc, final LinphoneCall call, LinphoneCall.State state, String message) { public void onCallStateChanged(Core lc, final Call call, Call.State state, String message) {
if (LinphoneManager.getLc().getCallsNb() == 0) { if (LinphoneManager.getLc().getCallsNb() == 0) {
if (status != null) { if (status != null) {
LinphoneService.instance().removeSasNotification(); LinphoneService.instance().removeSasNotification();
@ -187,7 +187,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
} else if (state == State.Resuming) { } else if (state == State.Resuming) {
if(LinphonePreferences.instance().isVideoEnabled()){ if(LinphonePreferences.instance().isVideoEnabled()){
status.refreshStatusItems(call, isVideoEnabled(call)); status.refreshStatusItems(call, isVideoEnabled(call));
if(call.getCurrentParams().getVideoEnabled()){ if(call.getCurrentParams().videoEnabled()){
showVideoView(); showVideoView();
} }
} }
@ -202,21 +202,21 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
videoProgress.setVisibility(View.GONE); videoProgress.setVisibility(View.GONE);
status.refreshStatusItems(call, isVideoEnabled(call)); status.refreshStatusItems(call, isVideoEnabled(call));
} }
} else if (state == State.CallUpdatedByRemote) { } else if (state == State.UpdatedByRemote) {
// If the correspondent proposes video while audio call // If the correspondent proposes video while audio call
boolean videoEnabled = LinphonePreferences.instance().isVideoEnabled(); boolean videoEnabled = LinphonePreferences.instance().isVideoEnabled();
if (!videoEnabled) { if (!videoEnabled) {
acceptCallUpdate(false); acceptCallUpdate(false);
} }
boolean remoteVideo = call.getRemoteParams().getVideoEnabled(); boolean remoteVideo = call.getRemoteParams().videoEnabled();
boolean localVideo = call.getCurrentParams().getVideoEnabled(); boolean localVideo = call.getCurrentParams().videoEnabled();
boolean autoAcceptCameraPolicy = LinphonePreferences.instance().shouldAutomaticallyAcceptVideoRequests(); boolean autoAcceptCameraPolicy = LinphonePreferences.instance().shouldAutomaticallyAcceptVideoRequests();
if (remoteVideo && !localVideo && !autoAcceptCameraPolicy && !LinphoneManager.getLc().isInConference()) { if (remoteVideo && !localVideo && !autoAcceptCameraPolicy && !(LinphoneManager.getLc().getConference() != null)) {
showAcceptCallUpdateDialog(); showAcceptCallUpdateDialog();
createTimerForDialog(SECONDS_BEFORE_DENYING_CALL_UPDATE); createTimerForDialog(SECONDS_BEFORE_DENYING_CALL_UPDATE);
} }
// else if (remoteVideo && !LinphoneManager.getLc().isInConference() && autoAcceptCameraPolicy) { // else if (remoteVideo && !LinphoneManager.getLc().(getConference() != null) && autoAcceptCameraPolicy) {
// mHandler.post(new Runnable() { // mHandler.post(new Runnable() {
// @Override // @Override
// public void run() { // public void run() {
@ -231,12 +231,12 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
} }
@Override @Override
public void callEncryptionChanged(LinphoneCore lc, final LinphoneCall call, boolean encrypted, String authenticationToken) { public void onCallEncryptionChanged(Core lc, final Call call, boolean encrypted, String authenticationToken) {
if (status != null) { if (status != null) {
if(call.getCurrentParams().getMediaEncryption().equals(LinphoneCore.MediaEncryption.ZRTP) && !call.isAuthenticationTokenVerified()){ if(call.getCurrentParams().getMediaEncryption().equals(Core.MediaEncryption.ZRTP) && !call.getAuthenticationTokenVerified()){
status.showZRTPDialog(call); status.showZRTPDialog(call);
} }
status.refreshStatusItems(call, call.getCurrentParams().getVideoEnabled()); status.refreshStatusItems(call, call.getCurrentParams().videoEnabled());
} }
} }
@ -246,7 +246,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
initUI(); initUI();
if (LinphoneManager.getLc().getCallsNb() > 0) { if (LinphoneManager.getLc().getCallsNb() > 0) {
LinphoneCall call = LinphoneManager.getLc().getCalls()[0]; Call call = LinphoneManager.getLc().getCalls()[0];
if (LinphoneUtils.isCallEstablished(call)) { if (LinphoneUtils.isCallEstablished(call)) {
enableAndRefreshInCallActions(); enableAndRefreshInCallActions();
@ -268,8 +268,8 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
refreshInCallActions(); refreshInCallActions();
return; return;
} else { } else {
isSpeakerEnabled = LinphoneManager.getLc().isSpeakerEnabled(); isSpeakerEnabled = LinphoneManager.getInstance().isSpeakerEnabled();
isMicMuted = LinphoneManager.getLc().isMicMuted(); isMicMuted = !LinphoneManager.getLc().micEnabled();
} }
Fragment callFragment; Fragment callFragment;
@ -308,17 +308,17 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
}.start(); }.start();
} }
private boolean isVideoEnabled(LinphoneCall call) { private boolean isVideoEnabled(Call call) {
if(call != null){ if(call != null){
return call.getCurrentParams().getVideoEnabled(); return call.getCurrentParams().videoEnabled();
} }
return false; return false;
} }
@Override @Override
protected void onSaveInstanceState(Bundle outState) { protected void onSaveInstanceState(Bundle outState) {
outState.putBoolean("Speaker", LinphoneManager.getLc().isSpeakerEnabled()); outState.putBoolean("Speaker", LinphoneManager.getInstance().isSpeakerEnabled());
outState.putBoolean("Mic", LinphoneManager.getLc().isMicMuted()); outState.putBoolean("Mic", !LinphoneManager.getLc().micEnabled());
outState.putBoolean("VideoCallPaused", isVideoCallPaused); outState.putBoolean("VideoCallPaused", isVideoCallPaused);
outState.putBoolean("AskingVideo", isVideoAsk); outState.putBoolean("AskingVideo", isVideoAsk);
outState.putLong("TimeRemind", TimeRemind); outState.putLong("TimeRemind", TimeRemind);
@ -574,8 +574,8 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
private void enableAndRefreshInCallActions() { private void enableAndRefreshInCallActions() {
int confsize = 0; int confsize = 0;
if(LinphoneManager.getLc().isInConference()) { if( LinphoneManager.getLc().getConference() != null) {
confsize = LinphoneManager.getLc().getConferenceSize() - (LinphoneManager.getLc().isInConference() ? 1 : 0); confsize = LinphoneManager.getLc().getConferenceSize() - (LinphoneManager.getLc().getConference() != null ? 1 : 0);
} }
//Enabled transfer button //Enabled transfer button
@ -707,7 +707,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
} }
else if (id == R.id.call_pause) { else if (id == R.id.call_pause) {
LinphoneCall call = (LinphoneCall) v.getTag(); Call call = (Call) v.getTag();
pauseOrResumeCall(call); pauseOrResumeCall(call);
} }
else if (id == R.id.conference_pause) { else if (id == R.id.conference_pause) {
@ -750,18 +750,18 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
} }
private void disableVideo(final boolean videoDisabled) { private void disableVideo(final boolean videoDisabled) {
final LinphoneCall call = LinphoneManager.getLc().getCurrentCall(); final Call call = LinphoneManager.getLc().getCurrentCall();
if (call == null) { if (call == null) {
return; return;
} }
if (videoDisabled) { if (videoDisabled) {
LinphoneCallParams params = LinphoneManager.getLc().createCallParams(call); CallParams params = LinphoneManager.getLc().createCallParams(call);
params.setVideoEnabled(false); params.enableVideo(false);
LinphoneManager.getLc().updateCall(call, params); LinphoneManager.getLc().updateCall(call, params);
} else { } else {
videoProgress.setVisibility(View.VISIBLE); videoProgress.setVisibility(View.VISIBLE);
if (call.getRemoteParams() != null && !call.getRemoteParams().isLowBandwidthEnabled()) { if (call.getRemoteParams() != null && !call.getRemoteParams().lowBandwidthEnabled()) {
LinphoneManager.getInstance().addVideo(); LinphoneManager.getInstance().addVideo();
} else { } else {
displayCustomToast(getString(R.string.error_low_bandwidth), Toast.LENGTH_LONG); displayCustomToast(getString(R.string.error_low_bandwidth), Toast.LENGTH_LONG);
@ -784,18 +784,18 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
} }
private void switchVideo(final boolean displayVideo) { private void switchVideo(final boolean displayVideo) {
final LinphoneCall call = LinphoneManager.getLc().getCurrentCall(); final Call call = LinphoneManager.getLc().getCurrentCall();
if (call == null) { if (call == null) {
return; return;
} }
//Check if the call is not terminated //Check if the call is not terminated
if(call.getState() == State.CallEnd || call.getState() == State.CallReleased) return; if(call.getState() == State.End || call.getState() == State.Released) return;
if (!displayVideo) { if (!displayVideo) {
showAudioView(); showAudioView();
} else { } else {
if (!call.getRemoteParams().isLowBandwidthEnabled()) { if (!call.getRemoteParams().lowBandwidthEnabled()) {
LinphoneManager.getInstance().addVideo(); LinphoneManager.getInstance().addVideo();
if (videoCallFragment == null || !videoCallFragment.isVisible()) if (videoCallFragment == null || !videoCallFragment.isVisible())
showVideoView(); showVideoView();
@ -880,9 +880,9 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
} }
private void toggleMicro() { private void toggleMicro() {
LinphoneCore lc = LinphoneManager.getLc(); Core lc = LinphoneManager.getLc();
isMicMuted = !isMicMuted; isMicMuted = !isMicMuted;
lc.muteMic(isMicMuted); lc.enableMic(!isMicMuted);
if (isMicMuted) { if (isMicMuted) {
micro.setImageResource(R.drawable.micro_selected); micro.setImageResource(R.drawable.micro_selected);
} else { } else {
@ -898,7 +898,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
if (isSpeakerEnabled) { if (isSpeakerEnabled) {
LinphoneManager.getInstance().routeAudioToSpeaker(); LinphoneManager.getInstance().routeAudioToSpeaker();
speaker.setImageResource(R.drawable.speaker_selected); speaker.setImageResource(R.drawable.speaker_selected);
LinphoneManager.getLc().enableSpeaker(isSpeakerEnabled); LinphoneManager.getInstance().enableSpeaker(isSpeakerEnabled);
} else { } else {
Log.d("Toggle speaker off, routing back to earpiece"); Log.d("Toggle speaker off, routing back to earpiece");
LinphoneManager.getInstance().routeAudioToReceiver(); LinphoneManager.getInstance().routeAudioToReceiver();
@ -906,8 +906,8 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
} }
} }
public void pauseOrResumeCall(LinphoneCall call) { public void pauseOrResumeCall(Call call) {
LinphoneCore lc = LinphoneManager.getLc(); Core lc = LinphoneManager.getLc();
if (call != null && LinphoneManager.getLc().getCurrentCall() == call) { if (call != null && LinphoneManager.getLc().getCurrentCall() == call) {
lc.pauseCall(call); lc.pauseCall(call);
if (isVideoEnabled(LinphoneManager.getLc().getCurrentCall())) { if (isVideoEnabled(LinphoneManager.getLc().getCurrentCall())) {
@ -926,12 +926,12 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
} }
private void hangUp() { private void hangUp() {
LinphoneCore lc = LinphoneManager.getLc(); Core lc = LinphoneManager.getLc();
LinphoneCall currentCall = lc.getCurrentCall(); Call currentCall = lc.getCurrentCall();
if (currentCall != null) { if (currentCall != null) {
lc.terminateCall(currentCall); lc.terminateCall(currentCall);
} else if (lc.isInConference()) { } else if (lc.getConference() != null) {
lc.terminateConference(); lc.terminateConference();
} else { } else {
lc.terminateAllCalls(); lc.terminateAllCalls();
@ -1077,22 +1077,19 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
timer.cancel(); timer.cancel();
} }
LinphoneCall call = LinphoneManager.getLc().getCurrentCall(); Call call = LinphoneManager.getLc().getCurrentCall();
if (call == null) { if (call == null) {
return; return;
} }
LinphoneCallParams params = LinphoneManager.getLc().createCallParams(call); CallParams params = LinphoneManager.getLc().createCallParams(call);
if (accept) { if (accept) {
params.setVideoEnabled(true); params.enableVideo(true);
LinphoneManager.getLc().enableVideo(true, true); LinphoneManager.getLc().enableVideoCapture(true);
LinphoneManager.getLc().enableVideoDisplay(true);
} }
try {
LinphoneManager.getLc().acceptCallUpdate(call, params); LinphoneManager.getLc().acceptCallUpdate(call, params);
} catch (LinphoneCoreException e) {
Log.e(e);
}
} }
public void startIncomingCallActivity() { public void startIncomingCallActivity() {
@ -1177,11 +1174,11 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
instance = this; instance = this;
super.onResume(); super.onResume();
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) { if (lc != null) {
lc.addListener(mListener); lc.addListener(mListener);
} }
isSpeakerEnabled = LinphoneManager.getLc().isSpeakerEnabled(); isSpeakerEnabled = LinphoneManager.getInstance().isSpeakerEnabled();
refreshIncallUi(); refreshIncallUi();
handleViewIntent(); handleViewIntent();
@ -1201,32 +1198,32 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
private void handleViewIntent() { private void handleViewIntent() {
Intent intent = getIntent(); Intent intent = getIntent();
if(intent != null && intent.getAction() == "android.intent.action.VIEW") { if(intent != null && intent.getAction() == "android.intent.action.VIEW") {
LinphoneCall call = LinphoneManager.getLc().getCurrentCall(); Call call = LinphoneManager.getLc().getCurrentCall();
if(call != null && isVideoEnabled(call)) { if(call != null && isVideoEnabled(call)) {
LinphonePlayer player = call.getPlayer(); Player player = call.getPlayer();
String path = intent.getData().getPath(); String path = intent.getData().getPath();
Log.i("Openning " + path); Log.i("Openning " + path);
int openRes = player.open(path); /*int openRes = */player.open(path);
if(openRes == -1) { /*if(openRes == -1) {
String message = "Could not open " + path; String message = "Could not open " + path;
Log.e(message); Log.e(message);
Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show(); Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show();
return; return;
} }*/
Log.i("Start playing"); Log.i("Start playing");
if(player.start() == -1) { /*if(*/player.start()/* == -1) {*/;
player.close(); /*player.close();
String message = "Could not start playing " + path; String message = "Could not start playing " + path;
Log.e(message); Log.e(message);
Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show(); Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show();
} }*/
} }
} }
} }
@Override @Override
protected void onPause() { protected void onPause() {
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) { if (lc != null) {
lc.removeListener(mListener); lc.removeListener(mListener);
} }
@ -1301,14 +1298,14 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
//CALL INFORMATION //CALL INFORMATION
private void displayCurrentCall(LinphoneCall call){ private void displayCurrentCall(Call call){
LinphoneAddress lAddress = call.getRemoteAddress(); Address lAddress = call.getRemoteAddress();
TextView contactName = (TextView) findViewById(R.id.current_contact_name); TextView contactName = (TextView) findViewById(R.id.current_contact_name);
setContactInformation(contactName, contactPicture, lAddress); setContactInformation(contactName, contactPicture, lAddress);
registerCallDurationTimer(null, call); registerCallDurationTimer(null, call);
} }
private void displayPausedCalls(Resources resources, final LinphoneCall call, int index) { private void displayPausedCalls(Resources resources, final Call call, int index) {
// Control Row // Control Row
LinearLayout callView; LinearLayout callView;
@ -1328,7 +1325,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
TextView contactName = (TextView) callView.findViewById(R.id.contact_name); TextView contactName = (TextView) callView.findViewById(R.id.contact_name);
ImageView contactImage = (ImageView) callView.findViewById(R.id.contact_picture); ImageView contactImage = (ImageView) callView.findViewById(R.id.contact_picture);
LinphoneAddress lAddress = call.getRemoteAddress(); Address lAddress = call.getRemoteAddress();
setContactInformation(contactName, contactImage, lAddress); setContactInformation(contactName, contactImage, lAddress);
displayCallStatusIconAndReturnCallPaused(callView, call); displayCallStatusIconAndReturnCallPaused(callView, call);
registerCallDurationTimer(callView, call); registerCallDurationTimer(callView, call);
@ -1336,7 +1333,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
callsList.addView(callView); callsList.addView(callView);
} }
private void setContactInformation(TextView contactName, ImageView contactPicture, LinphoneAddress lAddress) { private void setContactInformation(TextView contactName, ImageView contactPicture, Address lAddress) {
LinphoneContact lContact = ContactsManager.getInstance().findContactFromAddress(lAddress); LinphoneContact lContact = ContactsManager.getInstance().findContactFromAddress(lAddress);
if (lContact == null) { if (lContact == null) {
contactName.setText(LinphoneUtils.getAddressDisplayName(lAddress)); contactName.setText(LinphoneUtils.getAddressDisplayName(lAddress));
@ -1347,28 +1344,28 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
} }
} }
private boolean displayCallStatusIconAndReturnCallPaused(LinearLayout callView, LinphoneCall call) { private boolean displayCallStatusIconAndReturnCallPaused(LinearLayout callView, Call call) {
boolean isCallPaused, isInConference; boolean isCallPaused, isInConference;
ImageView callState = (ImageView) callView.findViewById(R.id.call_pause); ImageView onCallStateChanged = (ImageView) callView.findViewById(R.id.call_pause);
callState.setTag(call); onCallStateChanged.setTag(call);
callState.setOnClickListener(this); onCallStateChanged.setOnClickListener(this);
if (call.getState() == State.Paused || call.getState() == State.PausedByRemote || call.getState() == State.Pausing) { if (call.getState() == State.Paused || call.getState() == State.PausedByRemote || call.getState() == State.Pausing) {
callState.setImageResource(R.drawable.pause); onCallStateChanged.setImageResource(R.drawable.pause);
isCallPaused = true; isCallPaused = true;
isInConference = false; isInConference = false;
} else if (call.getState() == State.OutgoingInit || call.getState() == State.OutgoingProgress || call.getState() == State.OutgoingRinging) { } else if (call.getState() == State.OutgoingInit || call.getState() == State.OutgoingProgress || call.getState() == State.OutgoingRinging) {
isCallPaused = false; isCallPaused = false;
isInConference = false; isInConference = false;
} else { } else {
isInConference = isConferenceRunning && call.isInConference(); isInConference = isConferenceRunning && call.getConference() != null;
isCallPaused = false; isCallPaused = false;
} }
return isCallPaused || isInConference; return isCallPaused || isInConference;
} }
private void registerCallDurationTimer(View v, LinphoneCall call) { private void registerCallDurationTimer(View v, Call call) {
int callDuration = call.getDuration(); int callDuration = call.getDuration();
if (callDuration == 0 && call.getState() != State.StreamsRunning) { if (callDuration == 0 && call.getState() != State.StreamsRunning) {
return; return;
@ -1390,8 +1387,8 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
} }
public void refreshCallList(Resources resources) { public void refreshCallList(Resources resources) {
isConferenceRunning = LinphoneManager.getLc().isInConference(); isConferenceRunning = LinphoneManager.getLc().getConference() != null;
List<LinphoneCall> pausedCalls = LinphoneUtils.getCallsInState(LinphoneManager.getLc(), Arrays.asList(State.PausedByRemote)); List<Call> pausedCalls = LinphoneUtils.getCallsInState(LinphoneManager.getLc(), Arrays.asList(State.PausedByRemote));
//MultiCalls //MultiCalls
if(LinphoneManager.getLc().getCallsNb() > 1){ if(LinphoneManager.getLc().getCallsNb() > 1){
@ -1431,12 +1428,12 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
} }
boolean isConfPaused = false; boolean isConfPaused = false;
for (LinphoneCall call : LinphoneManager.getLc().getCalls()) { for (Call call : LinphoneManager.getLc().getCalls()) {
if (call.isInConference() && !isConferenceRunning) { if (call.getConference() != null && !isConferenceRunning) {
isConfPaused = true; isConfPaused = true;
index++; index++;
} else { } else {
if (call != LinphoneManager.getLc().getCurrentCall() && !call.isInConference()) { if (call != LinphoneManager.getLc().getCurrentCall() && !(call.getConference() != null)) {
displayPausedCalls(resources, call, index); displayPausedCalls(resources, call, index);
index++; index++;
} else { } else {
@ -1464,10 +1461,10 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
} }
//Conference //Conference
private void exitConference(final LinphoneCall call){ private void exitConference(final Call call){
LinphoneCore lc = LinphoneManager.getLc(); Core lc = LinphoneManager.getLc();
if (call.isInConference()) { if (call.getConference() != null) {
lc.removeFromConference(call); lc.removeFromConference(call);
if (lc.getConferenceSize() <= 1) { if (lc.getConferenceSize() <= 1) {
lc.leaveConference(); lc.leaveConference();
@ -1481,10 +1478,10 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
} }
public void pauseOrResumeConference() { public void pauseOrResumeConference() {
LinphoneCore lc = LinphoneManager.getLc(); Core lc = LinphoneManager.getLc();
conferenceStatus = (ImageView) findViewById(R.id.conference_pause); conferenceStatus = (ImageView) findViewById(R.id.conference_pause);
if(conferenceStatus != null) { if(conferenceStatus != null) {
if (lc.isInConference()) { if (lc.getConference() != null) {
conferenceStatus.setImageResource(R.drawable.pause_big_over_selected); conferenceStatus.setImageResource(R.drawable.pause_big_over_selected);
lc.leaveConference(); lc.leaveConference();
} else { } else {
@ -1495,14 +1492,14 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
refreshCallList(getResources()); refreshCallList(getResources());
} }
private void displayConferenceParticipant(int index, final LinphoneCall call){ private void displayConferenceParticipant(int index, final Call call){
LinearLayout confView = (LinearLayout) inflater.inflate(R.layout.conf_call_control_row, container, false); LinearLayout confView = (LinearLayout) inflater.inflate(R.layout.conf_call_control_row, container, false);
conferenceList.setId(index + 1); conferenceList.setId(index + 1);
TextView contact = (TextView) confView.findViewById(R.id.contactNameOrNumber); TextView contact = (TextView) confView.findViewById(R.id.contactNameOrNumber);
LinphoneContact lContact = ContactsManager.getInstance().findContactFromAddress(call.getRemoteAddress()); LinphoneContact lContact = ContactsManager.getInstance().findContactFromAddress(call.getRemoteAddress());
if (lContact == null) { if (lContact == null) {
contact.setText(call.getRemoteAddress().getUserName()); contact.setText(call.getRemoteAddress().getUsername());
} else { } else {
contact.setText(lContact.getFullName()); contact.setText(lContact.getFullName());
} }
@ -1541,8 +1538,8 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
//Conference participant //Conference participant
int index = 1; int index = 1;
for (LinphoneCall call : LinphoneManager.getLc().getCalls()) { for (Call call : LinphoneManager.getLc().getCalls()) {
if (call.isInConference()) { if (call.getConference() != null) {
displayConferenceParticipant(index, call); displayConferenceParticipant(index, call);
index++; index++;
} }
@ -1555,8 +1552,8 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
private void displayMissedChats() { private void displayMissedChats() {
int count = 0; int count = 0;
LinphoneChatRoom[] chats = LinphoneManager.getLc().getChatRooms(); ChatRoom[] chats = LinphoneManager.getLc().getChatRooms();
for (LinphoneChatRoom chatroom : chats) { for (ChatRoom chatroom : chats) {
count += chatroom.getUnreadMessagesCount(); count += chatroom.getUnreadMessagesCount();
} }
@ -1577,7 +1574,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
private String getEncoderText(String mime){ private String getEncoderText(String mime){
String ret = mEncoderTexts.get(mime); String ret = mEncoderTexts.get(mime);
if (ret == null){ if (ret == null){
org.linphone.mediastream.Factory msfactory = LinphoneManager.getLc().getMSFactory(); org.linphone.mediastream.Factory msfactory = LinphoneManager.getLc().getMediastreamerFactory();
ret = msfactory.getEncoderText(mime); ret = msfactory.getEncoderText(mime);
mEncoderTexts.put(mime, ret); mEncoderTexts.put(mime, ret);
} }
@ -1586,16 +1583,16 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
private String getDecoderText(String mime){ private String getDecoderText(String mime){
String ret = mDecoderTexts.get(mime); String ret = mDecoderTexts.get(mime);
if (ret == null){ if (ret == null){
org.linphone.mediastream.Factory msfactory = LinphoneManager.getLc().getMSFactory(); org.linphone.mediastream.Factory msfactory = LinphoneManager.getLc().getMediastreamerFactory();
ret = msfactory.getDecoderText(mime); ret = msfactory.getDecoderText(mime);
mDecoderTexts.put(mime, ret); mDecoderTexts.put(mime, ret);
} }
return ret; return ret;
} }
private void displayMediaStats(LinphoneCallParams params, LinphoneCallStats stats private void displayMediaStats(CallParams params, CallStats stats
, PayloadType media , View layout, TextView title, TextView codec, TextView dl , PayloadType media , View layout, TextView title, TextView codec, TextView dl
, TextView ul, TextView ice, TextView ip, TextView senderLossRate , TextView ul, TextView edl, TextView ice, TextView ip, TextView senderLossRate
, TextView receiverLossRate, TextView enc, TextView dec, TextView videoResolutionSent , TextView receiverLossRate, TextView enc, TextView dec, TextView videoResolutionSent
, TextView videoResolutionReceived, TextView videoFpsSent, TextView videoFpsReceived , TextView videoResolutionReceived, TextView videoFpsSent, TextView videoFpsReceived
, boolean isVideo, TextView jitterBuffer) { , boolean isVideo, TextView jitterBuffer) {
@ -1605,9 +1602,9 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
layout.setVisibility(View.VISIBLE); layout.setVisibility(View.VISIBLE);
title.setVisibility(TextView.VISIBLE); title.setVisibility(TextView.VISIBLE);
if (media != null) { if (media != null) {
mime = media.getMime(); mime = media.getMimeType();
formatText(codec, getString(R.string.call_stats_codec), formatText(codec, getString(R.string.call_stats_codec),
mime + " / " + (media.getRate() / 1000) + "kHz"); mime + " / " + (media.getClockRate() / 1000) + "kHz");
} }
if (mime != null ){ if (mime != null ){
formatText(enc, getString(R.string.call_stats_encoder_name), getEncoderText(mime)); formatText(enc, getString(R.string.call_stats_encoder_name), getEncoderText(mime));
@ -1617,11 +1614,15 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
String.valueOf((int) stats.getDownloadBandwidth()) + " kbits/s"); String.valueOf((int) stats.getDownloadBandwidth()) + " kbits/s");
formatText(ul, getString(R.string.call_stats_upload), formatText(ul, getString(R.string.call_stats_upload),
String.valueOf((int) stats.getUploadBandwidth()) + " kbits/s"); String.valueOf((int) stats.getUploadBandwidth()) + " kbits/s");
if (isVideo) {
formatText(edl, getString(R.string.call_stats_estimated_download),
String.valueOf(0/*(int) stats.getEstimatedDownloadBandwidth()*/) + " kbits/s");
}
formatText(ice, getString(R.string.call_stats_ice), formatText(ice, getString(R.string.call_stats_ice),
stats.getIceState().toString()); stats.getIceState().toString());
formatText(ip, getString(R.string.call_stats_ip), formatText(ip, getString(R.string.call_stats_ip),
(stats.getIpFamilyOfRemote() == LinphoneAddressFamily.INET_6.getInt()) ? (stats.getIpFamilyOfRemote() == AddressFamily.Inet6) ?
"IpV6" : (stats.getIpFamilyOfRemote() == LinphoneAddressFamily.INET.getInt()) ? "IpV6" : (stats.getIpFamilyOfRemote() == AddressFamily.Inet) ?
"IpV4" : "Unknown"); "IpV4" : "Unknown");
formatText(senderLossRate, getString(R.string.call_stats_sender_loss_rate), formatText(senderLossRate, getString(R.string.call_stats_sender_loss_rate),
new DecimalFormat("##.##").format(stats.getSenderLossRate()) + "%"); new DecimalFormat("##.##").format(stats.getSenderLossRate()) + "%");
@ -1630,10 +1631,10 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
if (isVideo) { if (isVideo) {
formatText(videoResolutionSent, formatText(videoResolutionSent,
getString(R.string.call_stats_video_resolution_sent), getString(R.string.call_stats_video_resolution_sent),
"\u2191 " + params.getSentVideoSize().toDisplayableString()); "\u2191 " + params.getSentVideoDefinition().getName());
formatText(videoResolutionReceived, formatText(videoResolutionReceived,
getString(R.string.call_stats_video_resolution_received), getString(R.string.call_stats_video_resolution_received),
"\u2193 " + params.getReceivedVideoSize().toDisplayableString()); "\u2193 " + params.getReceivedVideoDefinition().getName());
formatText(videoFpsSent, formatText(videoFpsSent,
getString(R.string.call_stats_video_fps_sent), getString(R.string.call_stats_video_fps_sent),
"\u2191 " + params.getSentFramerate()); "\u2191 " + params.getSentFramerate());
@ -1642,7 +1643,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
"\u2193 " + params.getReceivedFramerate()); "\u2193 " + params.getReceivedFramerate());
} else { } else {
formatText(jitterBuffer, getString(R.string.call_stats_jitter_buffer), formatText(jitterBuffer, getString(R.string.call_stats_jitter_buffer),
new DecimalFormat("##.##").format(stats.getJitterBufferSize()) + " ms"); new DecimalFormat("##.##").format(stats.getJitterBufferSizeMs()) + " ms");
} }
} else { } else {
layout.setVisibility(View.GONE); layout.setVisibility(View.GONE);
@ -1650,7 +1651,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
} }
} }
public void initCallStatsRefresher(final LinphoneCall call, final View view) { public void initCallStatsRefresher(final Call call, final View view) {
if (mTimer != null && mTask != null) { if (mTimer != null && mTask != null) {
return; return;
} }
@ -1667,6 +1668,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
final TextView ulAudio = (TextView) view.findViewById(R.id.uploadBandwith_audio); final TextView ulAudio = (TextView) view.findViewById(R.id.uploadBandwith_audio);
final TextView dlVideo = (TextView) view.findViewById(R.id.downloadBandwith_video); final TextView dlVideo = (TextView) view.findViewById(R.id.downloadBandwith_video);
final TextView ulVideo = (TextView) view.findViewById(R.id.uploadBandwith_video); final TextView ulVideo = (TextView) view.findViewById(R.id.uploadBandwith_video);
final TextView edlVideo = (TextView) view.findViewById(R.id.estimatedDownloadBandwidth_video);
final TextView iceAudio = (TextView) view.findViewById(R.id.ice_audio); final TextView iceAudio = (TextView) view.findViewById(R.id.ice_audio);
final TextView iceVideo = (TextView) view.findViewById(R.id.ice_video); final TextView iceVideo = (TextView) view.findViewById(R.id.ice_video);
final TextView videoResolutionSent = (TextView) view.findViewById(R.id.video_resolution_sent); final TextView videoResolutionSent = (TextView) view.findViewById(R.id.video_resolution_sent);
@ -1693,7 +1695,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
return; return;
} }
if (titleAudio == null || codecAudio == null || dlVideo == null || iceAudio == null if (titleAudio == null || codecAudio == null || dlVideo == null || edlVideo == null || iceAudio == null
|| videoResolutionSent == null || videoLayout == null || titleVideo == null || videoResolutionSent == null || videoLayout == null || titleVideo == null
|| ipVideo == null || ipAudio == null || codecVideo == null || ipVideo == null || ipAudio == null || codecVideo == null
|| dlAudio == null || ulAudio == null || ulVideo == null || iceVideo == null || dlAudio == null || ulAudio == null || ulVideo == null || iceVideo == null
@ -1708,25 +1710,25 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() == null) return; if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() == null) return;
synchronized(LinphoneManager.getLc()) { synchronized(LinphoneManager.getLc()) {
if (LinphoneActivity.isInstanciated()) { if (LinphoneActivity.isInstanciated()) {
LinphoneCallParams params = call.getCurrentParams(); CallParams params = call.getCurrentParams();
if (params != null) { if (params != null) {
LinphoneCallStats audioStats = call.getAudioStats(); CallStats audioStats = call.getStats(StreamType.Audio);
LinphoneCallStats videoStats = null; CallStats videoStats = null;
if (params.getVideoEnabled()) if (params.videoEnabled())
videoStats = call.getVideoStats(); videoStats = call.getStats(StreamType.Video);
PayloadType payloadAudio = params.getUsedAudioCodec(); PayloadType payloadAudio = params.getUsedAudioPayloadType();
PayloadType payloadVideo = params.getUsedVideoCodec(); PayloadType payloadVideo = params.getUsedVideoPayloadType();
displayMediaStats(params, audioStats, payloadAudio, audioLayout displayMediaStats(params, audioStats, payloadAudio, audioLayout
, titleAudio, codecAudio, dlAudio, ulAudio, iceAudio , titleAudio, codecAudio, dlAudio, ulAudio, null, iceAudio
, ipAudio, senderLossRateAudio, receiverLossRateAudio , ipAudio, senderLossRateAudio, receiverLossRateAudio
, encoderAudio, decoderAudio, null, null, null, null , encoderAudio, decoderAudio, null, null, null, null
, false, jitterBufferAudio); , false, jitterBufferAudio);
displayMediaStats(params, videoStats, payloadVideo, videoLayout displayMediaStats(params, videoStats, payloadVideo, videoLayout
, titleVideo, codecVideo, dlVideo, ulVideo, iceVideo , titleVideo, codecVideo, dlVideo, ulVideo, edlVideo, iceVideo
, ipVideo, senderLossRateVideo, receiverLossRateVideo , ipVideo, senderLossRateVideo, receiverLossRateVideo
, encoderVideo, decoderVideo , encoderVideo, decoderVideo
, videoResolutionSent, videoResolutionReceived , videoResolutionSent, videoResolutionReceived

View file

@ -1,7 +1,8 @@
package org.linphone; package org.linphone;
/* /*
CallAudioFragment.java CallAudioFragment.java
Copyright (C) 2015 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -25,9 +26,6 @@ import android.view.View;
import android.view.View.OnTouchListener; import android.view.View.OnTouchListener;
import android.view.ViewGroup; import android.view.ViewGroup;
/**
* @author Sylvain Berfini
*/
public class CallAudioFragment extends Fragment { public class CallAudioFragment extends Fragment {
private CallActivity incallActvityInstance; private CallActivity incallActvityInstance;

View file

@ -1,6 +1,8 @@
package org.linphone;
/* /*
CallIncomingActivity.java CallIncomingActivity.java
Copyright (C) 2015 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -16,7 +18,6 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
package org.linphone;
import android.Manifest; import android.Manifest;
import android.content.pm.ActivityInfo; import android.content.pm.ActivityInfo;
@ -32,12 +33,12 @@ import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import org.linphone.core.LinphoneAddress; import org.linphone.core.Address;
import org.linphone.core.LinphoneCall; import org.linphone.core.Call;
import org.linphone.core.LinphoneCall.State; import org.linphone.core.Call.State;
import org.linphone.core.LinphoneCallParams; import org.linphone.core.CallParams;
import org.linphone.core.LinphoneCore; import org.linphone.core.Core;
import org.linphone.core.LinphoneCoreListenerBase; import org.linphone.core.CoreListenerStub;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
import org.linphone.ui.LinphoneSliders.LinphoneSliderTriggered; import org.linphone.ui.LinphoneSliders.LinphoneSliderTriggered;
@ -49,8 +50,8 @@ public class CallIncomingActivity extends LinphoneGenericActivity implements Lin
private TextView name, number; private TextView name, number;
private ImageView contactPicture, accept, decline, arrow; private ImageView contactPicture, accept, decline, arrow;
private LinphoneCall mCall; private Call mCall;
private LinphoneCoreListenerBase mListener; private CoreListenerStub mListener;
private LinearLayout acceptUnlock; private LinearLayout acceptUnlock;
private LinearLayout declineUnlock; private LinearLayout declineUnlock;
private boolean alreadyAcceptedOrDeniedCall, begin; private boolean alreadyAcceptedOrDeniedCall, begin;
@ -93,7 +94,7 @@ public class CallIncomingActivity extends LinphoneGenericActivity implements Lin
lookupCurrentCall(); lookupCurrentCall();
if (LinphonePreferences.instance() != null && mCall != null && mCall.getRemoteParams() != null && if (LinphonePreferences.instance() != null && mCall != null && mCall.getRemoteParams() != null &&
LinphonePreferences.instance().shouldAutomaticallyAcceptVideoRequests() && LinphonePreferences.instance().shouldAutomaticallyAcceptVideoRequests() &&
mCall.getRemoteParams().getVideoEnabled()) { mCall.getRemoteParams().videoEnabled()) {
accept.setImageResource(R.drawable.call_video_start); accept.setImageResource(R.drawable.call_video_start);
} }
decline = (ImageView) findViewById(R.id.decline); decline = (ImageView) findViewById(R.id.decline);
@ -181,16 +182,16 @@ public class CallIncomingActivity extends LinphoneGenericActivity implements Lin
} }
}); });
mListener = new LinphoneCoreListenerBase(){ mListener = new CoreListenerStub(){
@Override @Override
public void callState(LinphoneCore lc, LinphoneCall call, State state, String message) { public void onCallStateChanged(Core lc, Call call, State state, String message) {
if (call == mCall && State.CallEnd == state) { if (call == mCall && State.End == state) {
finish(); finish();
} }
if (state == State.StreamsRunning) { if (state == State.StreamsRunning) {
Log.e("CallIncommingActivity - onCreate - State.StreamsRunning - speaker = "+LinphoneManager.getLc().isSpeakerEnabled()); Log.e("CallIncommingActivity - onCreate - State.StreamsRunning - speaker = "+LinphoneManager.getInstance().isSpeakerEnabled());
// The following should not be needed except some devices need it (e.g. Galaxy S). // The following should not be needed except some devices need it (e.g. Galaxy S).
LinphoneManager.getLc().enableSpeaker(LinphoneManager.getLc().isSpeakerEnabled()); LinphoneManager.getInstance().enableSpeaker(LinphoneManager.getInstance().isSpeakerEnabled());
} }
} }
}; };
@ -203,7 +204,7 @@ public class CallIncomingActivity extends LinphoneGenericActivity implements Lin
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
instance = this; instance = this;
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) { if (lc != null) {
lc.addListener(mListener); lc.addListener(mListener);
} }
@ -221,7 +222,7 @@ public class CallIncomingActivity extends LinphoneGenericActivity implements Lin
} }
LinphoneAddress address = mCall.getRemoteAddress(); Address address = mCall.getRemoteAddress();
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(address); LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(address);
if (contact != null) { if (contact != null) {
LinphoneUtils.setImagePictureFromUri(this, contactPicture, contact.getPhotoUri(), contact.getThumbnailUri()); LinphoneUtils.setImagePictureFromUri(this, contactPicture, contact.getPhotoUri(), contact.getThumbnailUri());
@ -240,7 +241,7 @@ public class CallIncomingActivity extends LinphoneGenericActivity implements Lin
@Override @Override
protected void onPause() { protected void onPause() {
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) { if (lc != null) {
lc.removeListener(mListener); lc.removeListener(mListener);
} }
@ -264,8 +265,8 @@ public class CallIncomingActivity extends LinphoneGenericActivity implements Lin
private void lookupCurrentCall() { private void lookupCurrentCall() {
if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null) { if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null) {
List<LinphoneCall> calls = LinphoneUtils.getLinphoneCalls(LinphoneManager.getLc()); List<Call> calls = LinphoneUtils.getCalls(LinphoneManager.getLc());
for (LinphoneCall call : calls) { for (Call call : calls) {
if (State.IncomingReceived == call.getState()) { if (State.IncomingReceived == call.getState()) {
mCall = call; mCall = call;
break; break;
@ -290,7 +291,7 @@ public class CallIncomingActivity extends LinphoneGenericActivity implements Lin
} }
alreadyAcceptedOrDeniedCall = true; alreadyAcceptedOrDeniedCall = true;
LinphoneCallParams params = LinphoneManager.getLc().createCallParams(mCall); CallParams params = LinphoneManager.getLc().createCallParams(mCall);
boolean isLowBandwidthConnection = !LinphoneUtils.isHighBandwidthConnection(LinphoneService.instance().getApplicationContext()); boolean isLowBandwidthConnection = !LinphoneUtils.isHighBandwidthConnection(LinphoneService.instance().getApplicationContext());

View file

@ -1,6 +1,8 @@
package org.linphone;
/* /*
CallManager.java CallManager.java
Copyright (C) 2010 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -16,21 +18,17 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
package org.linphone;
import org.linphone.core.LinphoneAddress; import org.linphone.core.Address;
import org.linphone.core.LinphoneCall; import org.linphone.core.Call;
import org.linphone.core.LinphoneCallParams; import org.linphone.core.CallParams;
import org.linphone.core.LinphoneCore; import org.linphone.core.Core;
import org.linphone.core.LinphoneCoreException; import org.linphone.core.CoreException;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
/** /**
* Handle call updating, reinvites. * Handle call updating, reinvites.
*
* @author Guillaume Beraudo
*
*/ */
public class CallManager { public class CallManager {
@ -49,16 +47,16 @@ public class CallManager {
public void inviteAddress(LinphoneAddress lAddress, boolean videoEnabled, boolean lowBandwidth) throws LinphoneCoreException { public void inviteAddress(Address lAddress, boolean videoEnabled, boolean lowBandwidth) throws CoreException {
LinphoneCore lc = LinphoneManager.getLc(); Core lc = LinphoneManager.getLc();
LinphoneCallParams params = lc.createCallParams(null); CallParams params = lc.createCallParams(null);
bm().updateWithProfileSettings(lc, params); bm().updateWithProfileSettings(lc, params);
if (videoEnabled && params.getVideoEnabled()) { if (videoEnabled && params.videoEnabled()) {
params.setVideoEnabled(true); params.enableVideo(true);
} else { } else {
params.setVideoEnabled(false); params.enableVideo(false);
} }
if (lowBandwidth) { if (lowBandwidth) {
@ -79,22 +77,22 @@ public class CallManager {
* @return if updateCall called * @return if updateCall called
*/ */
boolean reinviteWithVideo() { boolean reinviteWithVideo() {
LinphoneCore lc = LinphoneManager.getLc(); Core lc = LinphoneManager.getLc();
LinphoneCall lCall = lc.getCurrentCall(); Call lCall = lc.getCurrentCall();
if (lCall == null) { if (lCall == null) {
Log.e("Trying to reinviteWithVideo while not in call: doing nothing"); Log.e("Trying to reinviteWithVideo while not in call: doing nothing");
return false; return false;
} }
LinphoneCallParams params = lc.createCallParams(lCall); CallParams params = lc.createCallParams(lCall);
if (params.getVideoEnabled()) return false; if (params.videoEnabled()) return false;
// Check if video possible regarding bandwidth limitations // Check if video possible regarding bandwidth limitations
bm().updateWithProfileSettings(lc, params); bm().updateWithProfileSettings(lc, params);
// Abort if not enough bandwidth... // Abort if not enough bandwidth...
if (!params.getVideoEnabled()) { if (!params.videoEnabled()) {
return false; return false;
} }
@ -109,13 +107,13 @@ public class CallManager {
* Re-invite with parameters updated from profile. * Re-invite with parameters updated from profile.
*/ */
void reinvite() { void reinvite() {
LinphoneCore lc = LinphoneManager.getLc(); Core lc = LinphoneManager.getLc();
LinphoneCall lCall = lc.getCurrentCall(); Call lCall = lc.getCurrentCall();
if (lCall == null) { if (lCall == null) {
Log.e("Trying to reinvite while not in call: doing nothing"); Log.e("Trying to reinvite while not in call: doing nothing");
return; return;
} }
LinphoneCallParams params = lc.createCallParams(lCall); CallParams params = lc.createCallParams(lCall);
bm().updateWithProfileSettings(lc, params); bm().updateWithProfileSettings(lc, params);
lc.updateCall(lCall, params); lc.updateCall(lCall, params);
} }
@ -126,13 +124,13 @@ public class CallManager {
* The camera will be restarted when mediastreamer chain is recreated and setParameters is called. * The camera will be restarted when mediastreamer chain is recreated and setParameters is called.
*/ */
public void updateCall() { public void updateCall() {
LinphoneCore lc = LinphoneManager.getLc(); Core lc = LinphoneManager.getLc();
LinphoneCall lCall = lc.getCurrentCall(); Call lCall = lc.getCurrentCall();
if (lCall == null) { if (lCall == null) {
Log.e("Trying to updateCall while not in call: doing nothing"); Log.e("Trying to updateCall while not in call: doing nothing");
return; return;
} }
LinphoneCallParams params = lc.createCallParams(lCall); CallParams params = lc.createCallParams(lCall);
bm().updateWithProfileSettings(lc, params); bm().updateWithProfileSettings(lc, params);
lc.updateCall(lCall, null); lc.updateCall(lCall, null);
} }

View file

@ -1,6 +1,8 @@
package org.linphone;
/* /*
CallOutgoingActivity.java CallOutgoingActivity.java
Copyright (C) 2015 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -16,16 +18,15 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
package org.linphone;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.linphone.core.LinphoneAddress; import org.linphone.core.Address;
import org.linphone.core.LinphoneCall; import org.linphone.core.Call;
import org.linphone.core.LinphoneCall.State; import org.linphone.core.Call.State;
import org.linphone.core.LinphoneCore; import org.linphone.core.Core;
import org.linphone.core.LinphoneCoreListenerBase; import org.linphone.core.CoreListenerStub;
import org.linphone.core.Reason; import org.linphone.core.Reason;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
@ -50,8 +51,8 @@ public class CallOutgoingActivity extends LinphoneGenericActivity implements OnC
private TextView name, number; private TextView name, number;
private ImageView contactPicture, micro, speaker, hangUp; private ImageView contactPicture, micro, speaker, hangUp;
private LinphoneCall mCall; private Call mCall;
private LinphoneCoreListenerBase mListener; private CoreListenerStub mListener;
private boolean isMicMuted, isSpeakerEnabled; private boolean isMicMuted, isSpeakerEnabled;
public static CallOutgoingActivity instance() { public static CallOutgoingActivity instance() {
@ -92,9 +93,9 @@ public class CallOutgoingActivity extends LinphoneGenericActivity implements OnC
hangUp = (ImageView) findViewById(R.id.outgoing_hang_up); hangUp = (ImageView) findViewById(R.id.outgoing_hang_up);
hangUp.setOnClickListener(this); hangUp.setOnClickListener(this);
mListener = new LinphoneCoreListenerBase(){ mListener = new CoreListenerStub(){
@Override @Override
public void callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State state, String message) { public void onCallStateChanged(Core lc, Call call, Call.State state, String message) {
if (call == mCall && State.Connected == state) { if (call == mCall && State.Connected == state) {
if (!LinphoneActivity.isInstanciated()) { if (!LinphoneActivity.isInstanciated()) {
return; return;
@ -103,14 +104,14 @@ public class CallOutgoingActivity extends LinphoneGenericActivity implements OnC
finish(); finish();
return; return;
} else if (state == State.Error) { } else if (state == State.Error) {
// Convert LinphoneCore message for internalization // Convert Core message for internalization
if (call.getErrorInfo().getReason() == Reason.Declined) { if (call.getErrorInfo().getReason() == Reason.Declined) {
displayCustomToast(getString(R.string.error_call_declined), Toast.LENGTH_SHORT); displayCustomToast(getString(R.string.error_call_declined), Toast.LENGTH_SHORT);
decline(); decline();
} else if (call.getErrorInfo().getReason() == Reason.NotFound) { } else if (call.getErrorInfo().getReason() == Reason.NotFound) {
displayCustomToast(getString(R.string.error_user_not_found), Toast.LENGTH_SHORT); displayCustomToast(getString(R.string.error_user_not_found), Toast.LENGTH_SHORT);
decline(); decline();
} else if (call.getErrorInfo().getReason() == Reason.Media) { } else if (call.getErrorInfo().getReason() == Reason.NotAcceptable) {
displayCustomToast(getString(R.string.error_incompatible_media), Toast.LENGTH_SHORT); displayCustomToast(getString(R.string.error_incompatible_media), Toast.LENGTH_SHORT);
decline(); decline();
} else if (call.getErrorInfo().getReason() == Reason.Busy) { } else if (call.getErrorInfo().getReason() == Reason.Busy) {
@ -120,8 +121,8 @@ public class CallOutgoingActivity extends LinphoneGenericActivity implements OnC
displayCustomToast(getString(R.string.error_unknown) + " - " + message, Toast.LENGTH_SHORT); displayCustomToast(getString(R.string.error_unknown) + " - " + message, Toast.LENGTH_SHORT);
decline(); decline();
} }
}else if (state == State.CallEnd) { }else if (state == State.End) {
// Convert LinphoneCore message for internalization // Convert Core message for internalization
if (call.getErrorInfo().getReason() == Reason.Declined) { if (call.getErrorInfo().getReason() == Reason.Declined) {
displayCustomToast(getString(R.string.error_call_declined), Toast.LENGTH_SHORT); displayCustomToast(getString(R.string.error_call_declined), Toast.LENGTH_SHORT);
decline(); decline();
@ -141,7 +142,7 @@ public class CallOutgoingActivity extends LinphoneGenericActivity implements OnC
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
instance = this; instance = this;
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) { if (lc != null) {
lc.addListener(mListener); lc.addListener(mListener);
} }
@ -150,8 +151,8 @@ public class CallOutgoingActivity extends LinphoneGenericActivity implements OnC
// Only one call ringing at a time is allowed // Only one call ringing at a time is allowed
if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null) { if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null) {
List<LinphoneCall> calls = LinphoneUtils.getLinphoneCalls(LinphoneManager.getLc()); List<Call> calls = LinphoneUtils.getCalls(LinphoneManager.getLc());
for (LinphoneCall call : calls) { for (Call call : calls) {
State cstate = call.getState(); State cstate = call.getState();
if (State.OutgoingInit == cstate || State.OutgoingProgress == cstate if (State.OutgoingInit == cstate || State.OutgoingProgress == cstate
|| State.OutgoingRinging == cstate || State.OutgoingEarlyMedia == cstate) { || State.OutgoingRinging == cstate || State.OutgoingEarlyMedia == cstate) {
@ -174,7 +175,7 @@ public class CallOutgoingActivity extends LinphoneGenericActivity implements OnC
return; return;
} }
LinphoneAddress address = mCall.getRemoteAddress(); Address address = mCall.getRemoteAddress();
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(address); LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(address);
if (contact != null) { if (contact != null) {
LinphoneUtils.setImagePictureFromUri(this, contactPicture, contact.getPhotoUri(), contact.getThumbnailUri()); LinphoneUtils.setImagePictureFromUri(this, contactPicture, contact.getPhotoUri(), contact.getThumbnailUri());
@ -193,7 +194,7 @@ public class CallOutgoingActivity extends LinphoneGenericActivity implements OnC
@Override @Override
protected void onPause() { protected void onPause() {
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) { if (lc != null) {
lc.removeListener(mListener); lc.removeListener(mListener);
} }
@ -217,7 +218,7 @@ public class CallOutgoingActivity extends LinphoneGenericActivity implements OnC
} else { } else {
micro.setImageResource(R.drawable.micro_default); micro.setImageResource(R.drawable.micro_default);
} }
LinphoneManager.getLc().muteMic(isMicMuted); LinphoneManager.getLc().enableMic(!isMicMuted);
} }
if (id == R.id.speaker) { if (id == R.id.speaker) {
isSpeakerEnabled = !isSpeakerEnabled; isSpeakerEnabled = !isSpeakerEnabled;
@ -226,7 +227,7 @@ public class CallOutgoingActivity extends LinphoneGenericActivity implements OnC
} else { } else {
speaker.setImageResource(R.drawable.speaker_default); speaker.setImageResource(R.drawable.speaker_default);
} }
LinphoneManager.getLc().enableSpeaker(isSpeakerEnabled); LinphoneManager.getInstance().enableSpeaker(isSpeakerEnabled);
} }
if (id == R.id.outgoing_hang_up) { if (id == R.id.outgoing_hang_up) {
decline(); decline();

View file

@ -1,7 +1,8 @@
package org.linphone; package org.linphone;
/* /*
CallVideoFragment.java CallVideoFragment.java
Copyright (C) 2015 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -17,10 +18,11 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
import org.linphone.compatibility.Compatibility; import org.linphone.compatibility.Compatibility;
import org.linphone.compatibility.CompatibilityScaleGestureDetector; import org.linphone.compatibility.CompatibilityScaleGestureDetector;
import org.linphone.compatibility.CompatibilityScaleGestureListener; import org.linphone.compatibility.CompatibilityScaleGestureListener;
import org.linphone.core.LinphoneCall; import org.linphone.core.Call;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
import org.linphone.mediastream.video.AndroidVideoWindowImpl; import org.linphone.mediastream.video.AndroidVideoWindowImpl;
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration; import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
@ -39,9 +41,6 @@ import android.view.View.OnTouchListener;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
/**
* @author Sylvain Berfini
*/
public class CallVideoFragment extends Fragment implements OnGestureListener, OnDoubleTapListener, CompatibilityScaleGestureListener { public class CallVideoFragment extends Fragment implements OnGestureListener, OnDoubleTapListener, CompatibilityScaleGestureListener {
private SurfaceView mVideoView; private SurfaceView mVideoView;
private SurfaceView mCaptureView; private SurfaceView mCaptureView;
@ -58,7 +57,7 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
View view; View view;
if (LinphoneManager.getLc().hasCrappyOpenGL()) { if (LinphoneManager.getLc().hasCrappyOpengl()) {
view = inflater.inflate(R.layout.video_no_opengl, container, false); view = inflater.inflate(R.layout.video_no_opengl, container, false);
} else { } else {
view = inflater.inflate(R.layout.video, container, false); view = inflater.inflate(R.layout.video, container, false);
@ -73,7 +72,7 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
androidVideoWindowImpl = new AndroidVideoWindowImpl(mVideoView, mCaptureView, new AndroidVideoWindowImpl.VideoWindowListener() { androidVideoWindowImpl = new AndroidVideoWindowImpl(mVideoView, mCaptureView, new AndroidVideoWindowImpl.VideoWindowListener() {
public void onVideoRenderingSurfaceReady(AndroidVideoWindowImpl vw, SurfaceView surface) { public void onVideoRenderingSurfaceReady(AndroidVideoWindowImpl vw, SurfaceView surface) {
mVideoView = surface; mVideoView = surface;
LinphoneManager.getLc().setVideoWindow(vw); LinphoneManager.getLc().setNativeVideoWindowId(vw);
} }
public void onVideoRenderingSurfaceDestroyed(AndroidVideoWindowImpl vw) { public void onVideoRenderingSurfaceDestroyed(AndroidVideoWindowImpl vw) {
@ -82,7 +81,7 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
public void onVideoPreviewSurfaceReady(AndroidVideoWindowImpl vw, SurfaceView surface) { public void onVideoPreviewSurfaceReady(AndroidVideoWindowImpl vw, SurfaceView surface) {
mCaptureView = surface; mCaptureView = surface;
LinphoneManager.getLc().setPreviewWindow(mCaptureView); LinphoneManager.getLc().setNativePreviewWindowId(mCaptureView);
} }
public void onVideoPreviewSurfaceDestroyed(AndroidVideoWindowImpl vw) { public void onVideoPreviewSurfaceDestroyed(AndroidVideoWindowImpl vw) {
@ -148,15 +147,24 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
public void switchCamera() { public void switchCamera() {
try { try {
int videoDeviceId = LinphoneManager.getLc().getVideoDevice(); String currentDevice = LinphoneManager.getLc().getVideoDevice();
videoDeviceId = (videoDeviceId + 1) % AndroidCameraConfiguration.retrieveCameras().length; String[] devices = LinphoneManager.getLc().getVideoDevicesList();
LinphoneManager.getLc().setVideoDevice(videoDeviceId); int index = 0;
for (String d : devices) {
if (d == currentDevice) {
break;
}
index++;
}
String newDevice = devices[(index + 1) % devices.length];
LinphoneManager.getLc().setVideoDevice(newDevice);
CallManager.getInstance().updateCall(); CallManager.getInstance().updateCall();
// previous call will cause graph reconstruction -> regive preview // previous call will cause graph reconstruction -> regive preview
// window // window
if (mCaptureView != null) { if (mCaptureView != null) {
LinphoneManager.getLc().setPreviewWindow(mCaptureView); LinphoneManager.getLc().setNativePreviewWindowId(mCaptureView);
} }
} catch (ArithmeticException ae) { } catch (ArithmeticException ae) {
Log.e("Cannot swtich camera : no camera"); Log.e("Cannot swtich camera : no camera");
@ -172,7 +180,7 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
} }
if (androidVideoWindowImpl != null) { if (androidVideoWindowImpl != null) {
synchronized (androidVideoWindowImpl) { synchronized (androidVideoWindowImpl) {
LinphoneManager.getLc().setVideoWindow(androidVideoWindowImpl); LinphoneManager.getLc().setNativeVideoWindowId(androidVideoWindowImpl);
} }
} }
@ -188,7 +196,7 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
* this call will destroy native opengl renderer which is used by * this call will destroy native opengl renderer which is used by
* androidVideoWindowImpl * androidVideoWindowImpl
*/ */
LinphoneManager.getLc().setVideoWindow(null); LinphoneManager.getLc().setNativeVideoWindowId(null);
} }
} }
if (LinphonePreferences.instance().isOverlayEnabled()) { if (LinphonePreferences.instance().isOverlayEnabled()) {
@ -207,9 +215,9 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
float landscapeZoomFactor = ((float) mVideoView.getWidth()) / (float) ((3 * mVideoView.getHeight()) / 4); float landscapeZoomFactor = ((float) mVideoView.getWidth()) / (float) ((3 * mVideoView.getHeight()) / 4);
mZoomFactor = Math.max(0.1f, Math.min(mZoomFactor, Math.max(portraitZoomFactor, landscapeZoomFactor))); mZoomFactor = Math.max(0.1f, Math.min(mZoomFactor, Math.max(portraitZoomFactor, landscapeZoomFactor)));
LinphoneCall currentCall = LinphoneManager.getLc().getCurrentCall(); Call currentCall = LinphoneManager.getLc().getCurrentCall();
if (currentCall != null) { if (currentCall != null) {
currentCall.zoomVideo(mZoomFactor, mZoomCenterX, mZoomCenterY); currentCall.zoom(mZoomFactor, mZoomCenterX, mZoomCenterY);
return true; return true;
} }
return false; return false;
@ -240,7 +248,7 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
if (mZoomCenterY < 0) if (mZoomCenterY < 0)
mZoomCenterY = 0; mZoomCenterY = 0;
LinphoneManager.getLc().getCurrentCall().zoomVideo(mZoomFactor, mZoomCenterX, mZoomCenterY); LinphoneManager.getLc().getCurrentCall().zoom(mZoomFactor, mZoomCenterX, mZoomCenterY);
return true; return true;
} }
} }
@ -263,7 +271,7 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
resetZoom(); resetZoom();
} }
LinphoneManager.getLc().getCurrentCall().zoomVideo(mZoomFactor, mZoomCenterX, mZoomCenterY); LinphoneManager.getLc().getCurrentCall().zoom(mZoomFactor, mZoomCenterX, mZoomCenterY);
return true; return true;
} }

View file

@ -1,4 +1,5 @@
package org.linphone; package org.linphone;
/* /*
ChatFragment.java ChatFragment.java
Copyright (C) 2017 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
@ -76,16 +77,18 @@ import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import org.linphone.compatibility.Compatibility; import org.linphone.compatibility.Compatibility;
import org.linphone.core.LinphoneAddress; import org.linphone.core.Address;
import org.linphone.core.LinphoneBuffer; import org.linphone.core.Buffer;
import org.linphone.core.LinphoneChatMessage; import org.linphone.core.ChatMessage;
import org.linphone.core.LinphoneChatMessage.State; import org.linphone.core.ChatMessage.State;
import org.linphone.core.LinphoneChatRoom; import org.linphone.core.ChatMessageListener;
import org.linphone.core.LinphoneContent; import org.linphone.core.ChatRoom;
import org.linphone.core.LinphoneCore; import org.linphone.core.Content;
import org.linphone.core.LinphoneCoreFactory; import org.linphone.core.Core;
import org.linphone.core.LinphoneCoreListenerBase; import org.linphone.core.Factory;
import org.linphone.core.LinphoneFriend; import org.linphone.core.CoreListenerStub;
import org.linphone.core.Friend;
import org.linphone.core.FriendList;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
@ -100,11 +103,16 @@ import java.util.Arrays;
import java.util.Calendar; import java.util.Calendar;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.regex.Pattern;
import static android.content.Intent.FLAG_GRANT_READ_URI_PERMISSION; import static android.content.Intent.FLAG_GRANT_READ_URI_PERMISSION;
import static org.linphone.FragmentsAvailable.CHAT;
interface ChatUpdatedListener {
void onChatUpdated();
}
public class ChatFragment extends Fragment implements OnClickListener, LinphoneChatMessage.LinphoneChatMessageListener, ContactsUpdatedListener{ public class ChatFragment extends Fragment implements OnClickListener, ChatMessageListener, ContactsUpdatedListener {
private static final int ADD_PHOTO = 1337; private static final int ADD_PHOTO = 1337;
private static final int MENU_DELETE_MESSAGE = 0; private static final int MENU_DELETE_MESSAGE = 0;
private static final int MENU_PICTURE_SMALL = 2; private static final int MENU_PICTURE_SMALL = 2;
@ -118,7 +126,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
private static final int SIZE_LARGE = 1500; private static final int SIZE_LARGE = 1500;
private static final int SIZE_MAX = 2048; private static final int SIZE_MAX = 2048;
private LinphoneChatRoom chatRoom; private ChatRoom chatRoom;
private String sipUri; private String sipUri;
private EditText message; private EditText message;
private ImageView edit, selectAll, deselectAll, startCall, delete, sendImage, sendMessage, cancel; private ImageView edit, selectAll, deselectAll, startCall, delete, sendImage, sendMessage, cancel;
@ -139,10 +147,24 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
private ViewTreeObserver.OnGlobalLayoutListener keyboardListener; private ViewTreeObserver.OnGlobalLayoutListener keyboardListener;
private ChatMessageAdapter adapter; private ChatMessageAdapter adapter;
private LinphoneCoreListenerBase mListener; private CoreListenerStub mListener;
private boolean newChatConversation = false; private boolean newChatConversation = false;
private String fileSharedUri, fileAlreadySharedUri; private String fileSharedUri, fileAlreadySharedUri;
private static ArrayList<ChatUpdatedListener> ChatUpdatedListeners;
public static void createIfNotExist() {
if (ChatUpdatedListeners == null)
ChatUpdatedListeners = new ArrayList<>();
}
public static void addChatListener(ChatUpdatedListener listener) {
ChatUpdatedListeners.add(listener);
}
public static void removeChatListener(ChatUpdatedListener listener) {
ChatUpdatedListeners.remove(listener);
}
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -218,8 +240,8 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
sendImage.setOnClickListener(new View.OnClickListener() { sendImage.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (LinphoneManager.getLc().getLimeEncryption() == LinphoneCore.LinphoneLimeState.Mandatory if (LinphoneManager.getLc().limeEnabled() == Core.LimeState.Mandatory
&& (chatRoom == null || !chatRoom.islimeAvailable())){ && (chatRoom == null || !chatRoom.limeAvailable())){
askingForLimeCall(); askingForLimeCall();
return; return;
} }
@ -239,10 +261,10 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
back.setOnClickListener(this); back.setOnClickListener(this);
} }
mListener = new LinphoneCoreListenerBase(){ mListener = new CoreListenerStub(){
@Override @Override
public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) { public void onMessageReceived(Core lc, ChatRoom cr, ChatMessage message) {
LinphoneAddress from = cr.getPeerAddress(); Address from = cr.getPeerAddress();
if (from.asStringUriOnly().equals(sipUri)) { if (from.asStringUriOnly().equals(sipUri)) {
//LinphoneService.instance().removeMessageNotification(); //LinphoneService.instance().removeMessageNotification();
cr.markAsRead(); cr.markAsRead();
@ -250,15 +272,20 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
adapter.addMessage(message); adapter.addMessage(message);
String externalBodyUrl = message.getExternalBodyUrl(); String externalBodyUrl = message.getExternalBodyUrl();
LinphoneContent fileTransferContent = message.getFileTransferInformation(); Content fileTransferContent = message.getFileTransferInformation();
if (externalBodyUrl != null || fileTransferContent != null) { if (externalBodyUrl != null || fileTransferContent != null) {
LinphoneActivity.instance().checkAndRequestExternalStoragePermission(); LinphoneActivity.instance().checkAndRequestExternalStoragePermission();
} }
} }
if (getResources().getBoolean(R.bool.isTablet)) {
for (ChatUpdatedListener c : ChatUpdatedListeners) {
c.onChatUpdated();
}
}
} }
@Override @Override
public void isComposingReceived(LinphoneCore lc, LinphoneChatRoom room) { public void onIsComposingReceived(Core lc, ChatRoom room) {
if (chatRoom != null && room != null && chatRoom.getPeerAddress().asStringUriOnly().equals(room.getPeerAddress().asStringUriOnly())) { if (chatRoom != null && room != null && chatRoom.getPeerAddress().asStringUriOnly().equals(room.getPeerAddress().asStringUriOnly())) {
remoteComposing.setVisibility(chatRoom.isRemoteComposing() ? View.VISIBLE : View.GONE); remoteComposing.setVisibility(chatRoom.isRemoteComposing() ? View.VISIBLE : View.GONE);
} }
@ -365,14 +392,15 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
} }
public void initChatRoom(String sipUri) { public void initChatRoom(String sipUri) {
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
LinphoneAddress lAddress = null; Address lAddress = null;
if (sipUri == null) { if (sipUri == null) {
contact = null; // Tablet rotation issue contact = null; // Tablet rotation issue
initNewChatConversation(); initNewChatConversation();
} else { } else {
try { try {
lAddress = lc.interpretUrl(sipUri); lAddress = lc.interpretUrl(sipUri);
if (lAddress == null) LinphoneActivity.instance().goToDialerFragment();
} catch (Exception e) { } catch (Exception e) {
//TODO Error popup //TODO Error popup
LinphoneActivity.instance().goToDialerFragment(); LinphoneActivity.instance().goToDialerFragment();
@ -387,7 +415,8 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
searchContactField.setVisibility(View.GONE); searchContactField.setVisibility(View.GONE);
resultContactsSearch.setVisibility(View.GONE); resultContactsSearch.setVisibility(View.GONE);
displayChatHeader(lAddress); displayChatHeader(lAddress);
displayMessageList(); removedList();
remoteComposing.setVisibility(chatRoom.isRemoteComposing() ? View.VISIBLE : View.GONE);
} }
} }
} }
@ -400,7 +429,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
//messagesList.invalidateViews(); //messagesList.invalidateViews();
} }
private void displayMessageList() { private void removedList() {
if (chatRoom != null) { if (chatRoom != null) {
if (adapter != null) { if (adapter != null) {
adapter.refreshHistory(); adapter.refreshHistory();
@ -412,7 +441,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
messagesList.setVisibility(ListView.VISIBLE); messagesList.setVisibility(ListView.VISIBLE);
} }
private void displayChatHeader(LinphoneAddress address) { private void displayChatHeader(Address address) {
if (contact != null || address != null) { if (contact != null || address != null) {
if (contact != null) { if (contact != null) {
contactName.setText(contact.getFullName()); contactName.setText(contact.getFullName());
@ -447,8 +476,8 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
menu.add(v.getId(), MENU_COPY_TEXT, 0, getString(R.string.copy_text)); menu.add(v.getId(), MENU_COPY_TEXT, 0, getString(R.string.copy_text));
} }
/* LinphoneChatMessage msg = getMessageForId(v.getId()); /* ChatMessage msg = getMessageForId(v.getId());
if (msg != null && msg.getStatus() == LinphoneChatMessage.State.NotDelivered) { if (msg != null && msg.getStatus() == ChatMessage.State.NotDelivered) {
menu.add(v.getId(), MENU_RESEND_MESSAGE, 0, getString(R.string.retry)); menu.add(v.getId(), MENU_RESEND_MESSAGE, 0, getString(R.string.retry));
} }
*/ */
@ -459,7 +488,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
switch (item.getItemId()) { switch (item.getItemId()) {
case MENU_DELETE_MESSAGE: case MENU_DELETE_MESSAGE:
if (chatRoom != null) { if (chatRoom != null) {
LinphoneChatMessage message = getMessageForId(item.getGroupId()); ChatMessage message = getMessageForId(item.getGroupId());
if (message != null) { if (message != null) {
chatRoom.deleteMessage(message); chatRoom.deleteMessage(message);
if (getResources().getBoolean(R.bool.isTablet) && chatRoom.getHistorySize() <= 0) { if (getResources().getBoolean(R.bool.isTablet) && chatRoom.getHistorySize() <= 0) {
@ -503,7 +532,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
LinphoneService.instance().removeMessageNotification(); LinphoneService.instance().removeMessageNotification();
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) { if (lc != null) {
lc.removeListener(mListener); lc.removeListener(mListener);
} }
@ -538,13 +567,13 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
message.addTextChangedListener(textWatcher); message.addTextChangedListener(textWatcher);
addVirtualKeyboardVisiblityListener(); addVirtualKeyboardVisiblityListener();
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) { if (lc != null) {
lc.addListener(mListener); lc.addListener(mListener);
} }
if (LinphoneActivity.isInstanciated()) { if (LinphoneActivity.isInstanciated()) {
LinphoneActivity.instance().selectMenu(FragmentsAvailable.CHAT); LinphoneActivity.instance().selectMenu(CHAT);
} }
LinphoneManager.addListener(this); LinphoneManager.addListener(this);
@ -570,7 +599,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
newChatConversation = true; newChatConversation = true;
} }
if(LinphoneManager.getLc().isIncall()){ if(LinphoneManager.getLc().inCall()){
backToCall.setVisibility(View.VISIBLE); backToCall.setVisibility(View.VISIBLE);
startCall.setVisibility(View.GONE); startCall.setVisibility(View.GONE);
} else { } else {
@ -606,7 +635,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
int size = messagesList.getAdapter().getCount(); int size = messagesList.getAdapter().getCount();
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
if (messagesList.isItemChecked(i)) { if (messagesList.isItemChecked(i)) {
LinphoneChatMessage message = (LinphoneChatMessage) messagesList.getAdapter().getItem(i); ChatMessage message = (ChatMessage) messagesList.getAdapter().getItem(i);
chatRoom.deleteMessage(message); chatRoom.deleteMessage(message);
} }
} }
@ -701,14 +730,16 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
} }
private void sendTextMessage() { private void sendTextMessage() {
if (!LinphoneManager.isInstanciated() || LinphoneManager.getLc() == null) if (!LinphoneManager.isInstanciated() || LinphoneManager.getLc() == null ||
(searchContactField.getVisibility() == View.VISIBLE
&& searchContactField.getText().toString().length() < 1))
return; return;
LinphoneCore.LinphoneLimeState state = LinphoneManager.getLc().getLimeEncryption(); Core.LimeState state = LinphoneManager.getLc().limeEnabled();
if ((state == LinphoneCore.LinphoneLimeState.Disabled if ((state == Core.LimeState.Disabled
|| state == LinphoneCore.LinphoneLimeState.Preferred) || state == Core.LimeState.Preferred)
|| (state == LinphoneCore.LinphoneLimeState.Mandatory || (state == Core.LimeState.Mandatory
&& chatRoom != null && chatRoom.islimeAvailable())){ && chatRoom != null && chatRoom.limeAvailable())){
sendTextMessage(message.getText().toString()); sendTextMessage(message.getText().toString());
message.setText(""); message.setText("");
invalidate(); invalidate();
@ -719,9 +750,9 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
} }
private void sendTextMessage(String messageToSend) { private void sendTextMessage(String messageToSend) {
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
boolean isNetworkReachable = lc == null ? false : lc.isNetworkReachable(); boolean isNetworkReachable = lc == null ? false : lc.isNetworkReachable();
LinphoneAddress lAddress = null; Address lAddress = null;
//Start new conversation in fast chat //Start new conversation in fast chat
if(newChatConversation && chatRoom == null) { if(newChatConversation && chatRoom == null) {
@ -731,7 +762,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
} }
} }
if (chatRoom != null && messageToSend != null && messageToSend.length() > 0 && isNetworkReachable) { if (chatRoom != null && messageToSend != null && messageToSend.length() > 0 && isNetworkReachable) {
LinphoneChatMessage message = chatRoom.createLinphoneChatMessage(messageToSend); ChatMessage message = chatRoom.createMessage(messageToSend);
chatRoom.sendChatMessage(message); chatRoom.sendChatMessage(message);
lAddress = chatRoom.getPeerAddress(); lAddress = chatRoom.getPeerAddress();
@ -746,7 +777,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
adapter.addMessage(message); adapter.addMessage(message);
} }
Log.i("Sent message current status: " + message.getStatus()); Log.i("Sent message current status: " + message.getState());
} else if (!isNetworkReachable && LinphoneActivity.isInstanciated()) { } else if (!isNetworkReachable && LinphoneActivity.isInstanciated()) {
LinphoneActivity.instance().displayCustomToast(getString(R.string.error_network_unreachable), Toast.LENGTH_LONG); LinphoneActivity.instance().displayCustomToast(getString(R.string.error_network_unreachable), Toast.LENGTH_LONG);
} }
@ -759,7 +790,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
if(path.contains("%20")) { if(path.contains("%20")) {
path = path.replace("%20", "-"); path = path.replace("%20", "-");
} }
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
boolean isNetworkReachable = lc == null ? false : lc.isNetworkReachable(); boolean isNetworkReachable = lc == null ? false : lc.isNetworkReachable();
if(newChatConversation && chatRoom == null) { if(newChatConversation && chatRoom == null) {
String address = searchContactField.getText().toString(); String address = searchContactField.getText().toString();
@ -798,7 +829,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
if(path.contains("%20")) { if(path.contains("%20")) {
path = path.replace("%20", "-"); path = path.replace("%20", "-");
} }
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
boolean isNetworkReachable = lc == null ? false : lc.isNetworkReachable(); boolean isNetworkReachable = lc == null ? false : lc.isNetworkReachable();
if (newChatConversation && chatRoom == null) { if (newChatConversation && chatRoom == null) {
String address = searchContactField.getText().toString(); String address = searchContactField.getText().toString();
@ -854,14 +885,14 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
dialog.dismiss(); dialog.dismiss();
} }
}); });
if(LinphoneManager.getLc().getLimeEncryption() == LinphoneCore.LinphoneLimeState.Mandatory) if(LinphoneManager.getLc().limeEnabled() == Core.LimeState.Mandatory)
dialog.show(); dialog.show();
} }
private LinphoneChatMessage getMessageForId(int id) { private ChatMessage getMessageForId(int id) {
if (adapter == null) return null; if (adapter == null) return null;
for (int i = 0; i < adapter.getCount(); i++) { for (int i = 0; i < adapter.getCount(); i++) {
LinphoneChatMessage message = adapter.getItem(i); ChatMessage message = adapter.getItem(i);
if (message.getStorageId() == id) { if (message.getStorageId() == id) {
return message; return message;
} }
@ -872,31 +903,36 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
private void invalidate() { private void invalidate() {
adapter.refreshHistory(); adapter.refreshHistory();
chatRoom.markAsRead(); chatRoom.markAsRead();
if (getResources().getBoolean(R.bool.isTablet)) {
for (ChatUpdatedListener c : ChatUpdatedListeners) {
c.onChatUpdated();
}
}
} }
private void resendMessage(LinphoneChatMessage message) { private void resendMessage(ChatMessage message) {
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (message == null || message.getStatus() != State.NotDelivered || !lc.isNetworkReachable()) if (message == null || message.getState() != State.NotDelivered || !lc.isNetworkReachable())
return; return;
message.reSend(); message.resend();
invalidate(); invalidate();
} }
private void resendMessage(int id) { private void resendMessage(int id) {
LinphoneChatMessage message = getMessageForId(id); ChatMessage message = getMessageForId(id);
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (message == null || message.getStatus() != State.NotDelivered || !lc.isNetworkReachable()){ if (message == null || message.getState() != State.NotDelivered || !lc.isNetworkReachable()){
return; return;
} }
message.reSend(); message.resend();
invalidate(); invalidate();
} }
private void copyTextMessageToClipboard(int id) { private void copyTextMessageToClipboard(int id) {
LinphoneChatMessage message = null; ChatMessage message = null;
for (int i = 0; i < adapter.getCount(); i++) { for (int i = 0; i < adapter.getCount(); i++) {
LinphoneChatMessage msg = adapter.getItem(i); ChatMessage msg = adapter.getItem(i);
if (msg.getStorageId() == id) { if (msg.getStorageId() == id) {
message = msg; message = msg;
break; break;
@ -954,14 +990,16 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
public Uri getCVSPathFromLookupUri(String content) { public Uri getCVSPathFromLookupUri(String content) {
String contactId = LinphoneUtils.getNameFromFilePath(content); String contactId = LinphoneUtils.getNameFromFilePath(content);
LinphoneFriend[] friendList = LinphoneManager.getLc().getFriendList(); FriendList[] friendList = LinphoneManager.getLc().getFriendsLists();
for(LinphoneFriend friend : friendList){ for (FriendList list : friendList) {
for (Friend friend : list.getFriends()) {
if (friend.getRefKey().toString().equals(contactId)) { if (friend.getRefKey().toString().equals(contactId)) {
String contactVcard = friend.getVcardToString(); String contactVcard = friend.getVcard().asVcard4String();
Uri path = LinphoneUtils.createCvsFromString(contactVcard); Uri path = LinphoneUtils.createCvsFromString(contactVcard);
return path; return path;
} }
} }
}
return null; return null;
} }
@ -973,7 +1011,9 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
@Override @Override
public void onContactsUpdated() { public void onContactsUpdated() {
if(fileSharedUri != null || message.getText() != null){ if(LinphoneActivity.isInstanciated()
&& LinphoneActivity.instance().getCurrentFragment() == CHAT
&& fileSharedUri != null || message.getText() != null){
initNewChatConversation(); initNewChatConversation();
} }
} }
@ -1060,15 +1100,16 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
if (progressDialog != null && progressDialog.isShowing()) { if (progressDialog != null && progressDialog.isShowing()) {
progressDialog.dismiss(); progressDialog.dismiss();
} }
String fileName = path.substring(path.lastIndexOf("/") + 1); String fileName = path.substring(path.lastIndexOf("/") + 1);
String extension = LinphoneUtils.getExtensionFromFileName(fileName); String extension = LinphoneUtils.getExtensionFromFileName(fileName);
LinphoneContent content = LinphoneCoreFactory.instance().createLinphoneContent("image", extension, result, null); Content content = Factory.instance().createContent(); // "image", extension, result, null
content.setType("image");
content.setSubtype(extension);
content.setBuffer(result, result.length);
content.setName(fileName); content.setName(fileName);
ChatMessage message = chatRoom.createFileTransferMessage(content);
LinphoneChatMessage message = chatRoom.createFileTransferMessage(content);
message.setListener(LinphoneManager.getInstance()); message.setListener(LinphoneManager.getInstance());
message.setAppData(path); message.setAppdata(path);
LinphoneManager.getInstance().setUploadPendingFileMessage(message); LinphoneManager.getInstance().setUploadPendingFileMessage(message);
LinphoneManager.getInstance().setUploadingImage(result); LinphoneManager.getInstance().setUploadingImage(result);
@ -1118,12 +1159,16 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
String fileName = path.substring(path.lastIndexOf("/") + 1); String fileName = path.substring(path.lastIndexOf("/") + 1);
String extension = LinphoneUtils.getExtensionFromFileName(fileName); String extension = LinphoneUtils.getExtensionFromFileName(fileName);
LinphoneContent content = LinphoneCoreFactory.instance().createLinphoneContent("file", extension, result, null); Content content = Factory.instance().createContent();//"file", extension, result, null
content.setType("file");
content.setSubtype(extension);
content.setBuffer(result, result.length);
content.setName(fileName);
content.setName(fileName); content.setName(fileName);
LinphoneChatMessage message = chatRoom.createFileTransferMessage(content); ChatMessage message = chatRoom.createFileTransferMessage(content);
message.setListener(LinphoneManager.getInstance()); message.setListener(LinphoneManager.getInstance());
message.setAppData(path); message.setAppdata(path);
LinphoneManager.getInstance().setUploadPendingFileMessage(message); LinphoneManager.getInstance().setUploadPendingFileMessage(message);
LinphoneManager.getInstance().setUploadingImage(result); LinphoneManager.getInstance().setUploadingImage(result);
@ -1163,7 +1208,8 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
super.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data);
} }
} else { } else {
LinphoneActivity.instance().displayCustomToast("Something wrong happened", Toast.LENGTH_LONG); if (LinphoneUtils.isExtensionImage(imageToUploadUri.getPath()))
sendImageMessage(imageToUploadUri.getPath(), 0);
} }
} }
@ -1233,7 +1279,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
} }
class ChatMessageAdapter extends BaseAdapter { class ChatMessageAdapter extends BaseAdapter {
private class ViewHolder implements LinphoneChatMessage.LinphoneChatMessageListener { private class ViewHolder implements ChatMessageListener {
public int id; public int id;
public RelativeLayout bubbleLayout; public RelativeLayout bubbleLayout;
public CheckBox delete; public CheckBox delete;
@ -1277,32 +1323,32 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
} }
@Override @Override
public void onLinphoneChatMessageStateChanged(LinphoneChatMessage msg, State state) { public void onMsgStateChanged(ChatMessage msg, State state) {
} }
@Override @Override
public void onLinphoneChatMessageFileTransferReceived(LinphoneChatMessage msg, LinphoneContent content, LinphoneBuffer buffer) { public void onFileTransferRecv(ChatMessage msg, Content content, Buffer buffer) {
} }
@Override @Override
public void onLinphoneChatMessageFileTransferSent(LinphoneChatMessage msg, LinphoneContent content, int offset, int size, LinphoneBuffer bufferToFill) { public Buffer onFileTransferSend(ChatMessage message, Content content, int offset, int size) {
return null;
} }
@Override @Override
public void onLinphoneChatMessageFileTransferProgressChanged(LinphoneChatMessage msg, LinphoneContent content, int offset, int total) { public void onFileTransferProgressIndication(ChatMessage msg, Content content, int offset, int total) {
if (msg.getStorageId() == id) fileTransferProgressBar.setProgress(offset * 100 / total); if (msg.getStorageId() == id) fileTransferProgressBar.setProgress(offset * 100 / total);
} }
} }
ArrayList<LinphoneChatMessage> history; ArrayList<ChatMessage> history;
Context context; Context context;
public ChatMessageAdapter(Context c) { public ChatMessageAdapter(Context c) {
context = c; context = c;
history = new ArrayList<LinphoneChatMessage>(); history = new ArrayList<ChatMessage>();
refreshHistory(); refreshHistory();
} }
@ -1313,19 +1359,20 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
} }
public void refreshHistory() { public void refreshHistory() {
if (history == null || chatRoom == null) return;
history.clear(); history.clear();
LinphoneChatMessage[] messages = chatRoom.getHistory(); ChatMessage[] messages = chatRoom.getHistory(0);
history.addAll(Arrays.asList(messages)); history.addAll(Arrays.asList(messages));
notifyDataSetChanged(); notifyDataSetChanged();
} }
public void addMessage(LinphoneChatMessage message) { public void addMessage(ChatMessage message) {
history.add(message); history.add(message);
notifyDataSetChanged(); notifyDataSetChanged();
messagesList.setSelection(getCount() - 1); messagesList.setSelection(getCount() - 1);
} }
public void refreshMessageCell(LinphoneChatMessage msg){ public void refreshMessageCell(ChatMessage msg){
} }
@ -1335,7 +1382,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
} }
@Override @Override
public LinphoneChatMessage getItem(int position) { public ChatMessage getItem(int position) {
return history.get(position); return history.get(position);
} }
@ -1346,7 +1393,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
@Override @Override
public View getView(final int position, View convertView, ViewGroup parent) { public View getView(final int position, View convertView, ViewGroup parent) {
final LinphoneChatMessage message = history.get(position); final ChatMessage message = history.get(position);
View view = null; View view = null;
final ViewHolder holder; final ViewHolder holder;
boolean sameMessage = false; boolean sameMessage = false;
@ -1365,8 +1412,8 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
if (holder.id == message.getStorageId()) { if (holder.id == message.getStorageId()) {
// Horrible workaround to not reload image on edit chat list // Horrible workaround to not reload image on edit chat list
if (holder.messageImage.getTag() != null if (holder.messageImage.getTag() != null
&& (holder.messageImage.getTag().equals(message.getAppData()) && (holder.messageImage.getTag().equals(message.getAppdata())
|| ((String) holder.messageImage.getTag()).substring(7).equals(message.getAppData())) || ((String) holder.messageImage.getTag()).substring(7).equals(message.getAppdata()))
){ ){
sameMessage = true; sameMessage = true;
} }
@ -1379,19 +1426,19 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (!message.isSecured() && !message.isOutgoing() && if (!message.isSecured() && !message.isOutgoing() &&
LinphoneManager.getLc().getLimeEncryption() == LinphoneCore.LinphoneLimeState.Mandatory) { LinphoneManager.getLc().limeEnabled() == Core.LimeState.Mandatory) {
LinphoneUtils.displayErrorAlert(getString(R.string.message_not_encrypted), LinphoneActivity.instance()); LinphoneUtils.displayErrorAlert(getString(R.string.message_not_encrypted), LinphoneActivity.instance());
} }
if(message.getStatus() == State.NotDelivered) { if(message.getState() == State.NotDelivered) {
resendMessage(message); resendMessage(message);
//resendMessage(holder.id); //resendMessage(holder.id);
} }
} }
}); });
LinphoneChatMessage.State status = message.getStatus(); ChatMessage.State status = message.getState();
String externalBodyUrl = message.getExternalBodyUrl(); String externalBodyUrl = message.getExternalBodyUrl();
LinphoneContent fileTransferContent = message.getFileTransferInformation(); Content fileTransferContent = message.getFileTransferInformation();
holder.delete.setVisibility(View.GONE); holder.delete.setVisibility(View.GONE);
holder.messageText.setVisibility(View.GONE); holder.messageText.setVisibility(View.GONE);
@ -1404,9 +1451,9 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
holder.messageStatus.setVisibility(View.INVISIBLE); holder.messageStatus.setVisibility(View.INVISIBLE);
holder.messageSendingInProgress.setVisibility(View.GONE); holder.messageSendingInProgress.setVisibility(View.GONE);
String displayName = message.getFrom().getDisplayName(); String displayName = message.getFromAddress().getDisplayName();
if (displayName == null) { if (displayName == null) {
displayName = message.getFrom().getUserName(); displayName = message.getFromAddress().getUsername();
} }
if (!message.isOutgoing()) { if (!message.isOutgoing()) {
if (contact != null) { if (contact != null) {
@ -1414,7 +1461,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
displayName = contact.getFullName(); displayName = contact.getFullName();
} }
if (contact.hasPhoto()) { if (contact.hasPhoto()) {
LinphoneUtils.setThumbnailPictureFromUri(getActivity(), holder.contactPicture, contact.getThumbnailUri()); LinphoneUtils.setThumbnailPictureFromUri(LinphoneActivity.instance(), holder.contactPicture, contact.getThumbnailUri());
} else { } else {
holder.contactPicture.setImageBitmap(ContactsManager.getInstance().getDefaultAvatarBitmap()); holder.contactPicture.setImageBitmap(ContactsManager.getInstance().getDefaultAvatarBitmap());
} }
@ -1426,11 +1473,11 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
} }
holder.contactName.setText(timestampToHumanDate(context, message.getTime()) + " - " + displayName); holder.contactName.setText(timestampToHumanDate(context, message.getTime()) + " - " + displayName);
if (status == LinphoneChatMessage.State.InProgress) { if (status == ChatMessage.State.InProgress) {
holder.messageSendingInProgress.setVisibility(View.VISIBLE); holder.messageSendingInProgress.setVisibility(View.VISIBLE);
} }
if (!message.isSecured() && !message.isOutgoing() && if (!message.isSecured() && !message.isOutgoing() &&
LinphoneManager.getLc().getLimeEncryption() == LinphoneCore.LinphoneLimeState.Mandatory && status != LinphoneChatMessage.State.InProgress) { LinphoneManager.getLc().limeEnabled() == Core.LimeState.Mandatory && status != ChatMessage.State.InProgress) {
holder.messageStatus.setVisibility(View.VISIBLE); holder.messageStatus.setVisibility(View.VISIBLE);
holder.messageStatus.setImageResource(R.drawable.chat_unsecure); holder.messageStatus.setImageResource(R.drawable.chat_unsecure);
} }
@ -1458,18 +1505,15 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
} }
if (externalBodyUrl != null || fileTransferContent != null) { if (externalBodyUrl != null || fileTransferContent != null) {
String appData = message.getAppData(); String appData = message.getAppdata();
if (message.isOutgoing() && appData != null) { if (message.isOutgoing() && appData != null) {
holder.messageImage.setVisibility(View.VISIBLE); holder.messageImage.setVisibility(View.VISIBLE);
if (!sameMessage) { if (!sameMessage) {
loadBitmap(message.getAppData(), holder.messageImage); loadBitmap(message.getAppdata(), holder.messageImage);
holder.messageImage.setTag(message.getAppData()); holder.messageImage.setTag(message.getAppdata());
} }
if (LinphoneManager.getInstance().getMessageUploadPending() != null && LinphoneManager.getInstance().getMessageUploadPending().getStorageId() == message.getStorageId()) { if (LinphoneManager.getInstance().getMessageUploadPending() != null && LinphoneManager.getInstance().getMessageUploadPending().getStorageId() == message.getStorageId()) {
@ -1502,8 +1546,9 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
holder.messageImage.setVisibility(View.VISIBLE); holder.messageImage.setVisibility(View.VISIBLE);
if (!sameMessage) { if (!sameMessage) {
loadBitmap(appData, holder.messageImage); loadBitmap(appData, holder.messageImage);
holder.messageImage.setTag(message.getAppData()); holder.messageImage.setTag(message.getAppdata());
} }
//removedList();
} }
} }
} }
@ -1544,7 +1589,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
String filename = message.getFileTransferInformation().getName(); String filename = message.getFileTransferInformation().getName();
String filename2 = context.getString(R.string.temp_photo_name_with_date).replace("%s", String.valueOf(System.currentTimeMillis())) ; //+ "." + extension; String filename2 = context.getString(R.string.temp_photo_name_with_date).replace("%s", String.valueOf(System.currentTimeMillis())) ; //+ "." + extension;
File file = new File(Environment.getExternalStorageDirectory(), filename); File file = new File(Environment.getExternalStorageDirectory(), filename);
message.setAppData(file.getPath()); message.setAppdata(file.getPath());
LinphoneManager.getInstance().addDownloadMessagePending(message); LinphoneManager.getInstance().addDownloadMessagePending(message);
message.setListener(LinphoneManager.getInstance()); message.setListener(LinphoneManager.getInstance());
message.setFileTransferFilepath(file.getPath()); message.setFileTransferFilepath(file.getPath());
@ -1558,6 +1603,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
chatRoom.markAsRead(); chatRoom.markAsRead();
} }
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
if (message.isOutgoing()) { if (message.isOutgoing()) {
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
@ -1583,12 +1629,12 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
} }
holder.bubbleLayout.setLayoutParams(layoutParams); holder.bubbleLayout.setLayoutParams(layoutParams);
if(message.getAppData() != null && holder.fileTransferLayout.getVisibility() != View.VISIBLE){ if(message.getAppdata() != null && holder.fileTransferLayout.getVisibility() != View.VISIBLE){
if(LinphoneUtils.isExtensionImage(message.getAppData())){ if(LinphoneUtils.isExtensionImage(message.getAppdata())){
holder.fileExtensionLabel.setVisibility(View.GONE); holder.fileExtensionLabel.setVisibility(View.GONE);
holder.fileNameLabel.setVisibility(View.GONE); holder.fileNameLabel.setVisibility(View.GONE);
}else { }else {
String extension = (LinphoneUtils.getExtensionFromFileName(message.getAppData())); String extension = (LinphoneUtils.getExtensionFromFileName(message.getAppdata()));
if(extension != null) if(extension != null)
extension = extension.toUpperCase(); extension = extension.toUpperCase();
else else
@ -1599,7 +1645,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
holder.fileExtensionLabel.setText(extension); holder.fileExtensionLabel.setText(extension);
holder.fileExtensionLabel.setVisibility(View.VISIBLE); holder.fileExtensionLabel.setVisibility(View.VISIBLE);
holder.fileNameLabel.setText(LinphoneUtils.getNameFromFilePath(message.getAppData())); holder.fileNameLabel.setText(LinphoneUtils.getNameFromFilePath(message.getAppdata()));
holder.fileNameLabel.setVisibility(View.VISIBLE); holder.fileNameLabel.setVisibility(View.VISIBLE);
holder.fileExtensionLabel.setOnClickListener(new OnClickListener() { holder.fileExtensionLabel.setOnClickListener(new OnClickListener() {
@Override @Override
@ -1613,7 +1659,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
file = new File(imageUri); file = new File(imageUri);
contentUri = FileProvider.getUriForFile(getActivity(), "org.linphone.provider", file); contentUri = FileProvider.getUriForFile(getActivity(), "org.linphone.provider", file);
} else if (imageUri.startsWith("content://")) { } else if (imageUri.startsWith("content://")) {
Log.e("===>>> ChatFragment - getView() - imageUri = "+imageUri);
contentUri = Uri.parse(imageUri); contentUri = Uri.parse(imageUri);
} else { } else {
file = new File(imageUri); file = new File(imageUri);
@ -1667,6 +1712,12 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
} }
} }
if (getResources().getBoolean(R.bool.isTablet)) {
for (ChatUpdatedListener c : ChatUpdatedListeners) {
c.onChatUpdated();
}
}
return view; return view;
} }
@ -1717,14 +1768,14 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
int indexFinHttp = text.indexOf(" ", indexHttp) == -1 ? text.length() : text.indexOf(" ", indexHttp); int indexFinHttp = text.indexOf(" ", indexHttp) == -1 ? text.length() : text.indexOf(" ", indexHttp);
String link = text.substring(indexHttp, indexFinHttp); String link = text.substring(indexHttp, indexFinHttp);
String linkWithoutScheme = link.replace("http://", ""); String linkWithoutScheme = link.replace("http://", "");
text = text.replaceFirst(link, "<a href=\"" + link + "\">" + linkWithoutScheme + "</a>"); text = text.replaceFirst(Pattern.quote(link), "<a href=\"" + link + "\">" + linkWithoutScheme + "</a>");
} }
if (text.contains("https://")) { if (text.contains("https://")) {
int indexHttp = text.indexOf("https://"); int indexHttp = text.indexOf("https://");
int indexFinHttp = text.indexOf(" ", indexHttp) == -1 ? text.length() : text.indexOf(" ", indexHttp); int indexFinHttp = text.indexOf(" ", indexHttp) == -1 ? text.length() : text.indexOf(" ", indexHttp);
String link = text.substring(indexHttp, indexFinHttp); String link = text.substring(indexHttp, indexFinHttp);
String linkWithoutScheme = link.replace("https://", ""); String linkWithoutScheme = link.replace("https://", "");
text = text.replaceFirst(link, "<a href=\"" + link + "\">" + linkWithoutScheme + "</a>"); text = text.replaceFirst(Pattern.quote(link), "<a href=\"" + link + "\">" + linkWithoutScheme + "</a>");
} }
return Compatibility.fromHtml(text); return Compatibility.fromHtml(text);
@ -1817,6 +1868,9 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
final BitmapWorkerTask bitmapWorkerTask = getBitmapWorkerTask(imageView); final BitmapWorkerTask bitmapWorkerTask = getBitmapWorkerTask(imageView);
if (this == bitmapWorkerTask && imageView != null) { if (this == bitmapWorkerTask && imageView != null) {
imageView.setImageBitmap(bitmap); imageView.setImageBitmap(bitmap);
//Force scroll too bottom with setSelection() after image loaded and last messages
if(((messagesList.getLastVisiblePosition() >= (getCount() - 1)) && (messagesList.getFirstVisiblePosition() <= (getCount() - 1))))
messagesList.setSelection(getCount() - 1);
imageView.setTag(path); imageView.setTag(path);
imageView.setOnClickListener(new OnClickListener() { imageView.setOnClickListener(new OnClickListener() {
@Override @Override
@ -1897,18 +1951,20 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
} }
} }
//LinphoneChatMessage Listener //ChatMessage Listener
@Override @Override
public void onLinphoneChatMessageStateChanged(LinphoneChatMessage msg, State state) { public void onMsgStateChanged(ChatMessage msg, State state) {
redrawMessageList(); redrawMessageList();
} }
@Override @Override
public void onLinphoneChatMessageFileTransferReceived(LinphoneChatMessage msg, LinphoneContent content, LinphoneBuffer buffer) {} public void onFileTransferRecv(ChatMessage msg, Content content, Buffer buffer) {}
@Override @Override
public void onLinphoneChatMessageFileTransferSent(LinphoneChatMessage msg, LinphoneContent content, int offset, int size, LinphoneBuffer bufferToFill) {} public Buffer onFileTransferSend(ChatMessage msg, Content content, int offset, int size) {
return null;
@Override }
public void onLinphoneChatMessageFileTransferProgressChanged(LinphoneChatMessage msg, LinphoneContent content, int offset, int total) {}
@Override
public void onFileTransferProgressIndication(ChatMessage msg, Content content, int offset, int total) {}
} }

View file

@ -1,7 +1,8 @@
package org.linphone; package org.linphone;
/* /*
ChatListFragment.java ChatListFragment.java
Copyright (C) 2012 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -17,6 +18,7 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
import android.app.Dialog; import android.app.Dialog;
import android.app.Fragment; import android.app.Fragment;
import android.graphics.Typeface; import android.graphics.Typeface;
@ -41,21 +43,20 @@ import android.widget.LinearLayout;
import android.widget.ListView; import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
import org.linphone.core.LinphoneAddress; import org.linphone.core.Address;
import org.linphone.core.LinphoneChatMessage; import org.linphone.core.ChatMessage;
import org.linphone.core.LinphoneChatRoom; import org.linphone.core.ChatRoom;
import org.linphone.core.LinphoneCore; import org.linphone.core.Core;
import org.linphone.core.LinphoneCoreException; import org.linphone.core.CoreException;
import org.linphone.core.LinphoneCoreFactory; import org.linphone.core.Factory;
import org.linphone.core.LinphoneCoreListenerBase; import org.linphone.core.CoreListenerStub;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
import java.util.List; import java.util.List;
/** import static org.linphone.FragmentsAvailable.CHAT_LIST;
* @author Sylvain Berfini
*/ public class ChatListFragment extends Fragment implements OnClickListener, OnItemClickListener, ContactsUpdatedListener, ChatUpdatedListener {
public class ChatListFragment extends Fragment implements OnClickListener, OnItemClickListener, ContactsUpdatedListener {
private LayoutInflater mInflater; private LayoutInflater mInflater;
private List<String> mConversations; private List<String> mConversations;
private ListView chatList; private ListView chatList;
@ -63,7 +64,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
private ImageView edit, selectAll, deselectAll, delete, newDiscussion, cancel, backInCall; private ImageView edit, selectAll, deselectAll, delete, newDiscussion, cancel, backInCall;
private LinearLayout editList, topbar; private LinearLayout editList, topbar;
private boolean isEditMode = false; private boolean isEditMode = false;
private LinphoneCoreListenerBase mListener; private CoreListenerStub mListener;
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
@ -101,12 +102,15 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
delete = (ImageView) view.findViewById(R.id.delete); delete = (ImageView) view.findViewById(R.id.delete);
delete.setOnClickListener(this); delete.setOnClickListener(this);
mListener = new LinphoneCoreListenerBase() { mListener = new CoreListenerStub() {
@Override @Override
public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) { public void onMessageReceived(Core lc, ChatRoom cr, ChatMessage message) {
refresh(); refresh();
} }
}; };
ChatFragment.createIfNotExist();
ChatFragment.addChatListener(this);
return view; return view;
} }
@ -123,7 +127,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
if (chatList.isItemChecked(i)) { if (chatList.isItemChecked(i)) {
String sipUri = chatList.getAdapter().getItem(i).toString(); String sipUri = chatList.getAdapter().getItem(i).toString();
if (sipUri != null) { if (sipUri != null) {
LinphoneChatRoom chatroom = LinphoneManager.getLc().getOrCreateChatRoom(sipUri); ChatRoom chatroom = LinphoneManager.getLc().getChatRoomFromUri(sipUri);
if (chatroom != null) { if (chatroom != null) {
chatroom.deleteHistory(); chatroom.deleteHistory();
} }
@ -181,9 +185,6 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
public void refresh() { public void refresh() {
mConversations = LinphoneActivity.instance().getChatList(); mConversations = LinphoneActivity.instance().getChatList();
if (getResources().getBoolean(R.bool.isTablet)) {
LinphoneActivity.instance().displayChat("", null, null);
}
hideAndDisplayMessageIfNoChat(); hideAndDisplayMessageIfNoChat();
} }
@ -211,7 +212,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
LinphoneActivity.instance().hideTabBar(false); LinphoneActivity.instance().hideTabBar(false);
} }
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) { if (lc != null) {
lc.addListener(mListener); lc.addListener(mListener);
} }
@ -221,7 +222,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
@Override @Override
public void onPause() { public void onPause() {
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) { if (lc != null) {
lc.removeListener(mListener); lc.removeListener(mListener);
} }
@ -231,6 +232,9 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
@Override @Override
public void onContactsUpdated() { public void onContactsUpdated() {
if (!LinphoneActivity.isInstanciated() || LinphoneActivity.instance().getCurrentFragment() != CHAT_LIST)
return;
ChatListAdapter adapter = (ChatListAdapter)chatList.getAdapter(); ChatListAdapter adapter = (ChatListAdapter)chatList.getAdapter();
if (adapter != null) { if (adapter != null) {
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
@ -349,6 +353,11 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
} }
} }
@Override
public void onChatUpdated() {
refresh();
}
class ChatListAdapter extends BaseAdapter { class ChatListAdapter extends BaseAdapter {
private class ViewHolder { private class ViewHolder {
public TextView lastMessageView; public TextView lastMessageView;
@ -396,24 +405,19 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
view.setTag(holder); view.setTag(holder);
} }
LinphoneAddress address; Address address;
try { address = Factory.instance().createAddress(sipUri);
address = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
} catch (LinphoneCoreException e) {
Log.e("Chat view cannot parse address", e);
return view;
}
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(address); LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(address);
String message = ""; String message = "";
Long time; Long time;
LinphoneChatRoom chatRoom = LinphoneManager.getLc().getChatRoom(address); ChatRoom chatRoom = LinphoneManager.getLc().getChatRoom(address);
int unreadMessagesCount = chatRoom.getUnreadMessagesCount(); int unreadMessagesCount = chatRoom.getUnreadMessagesCount();
LinphoneChatMessage[] history = chatRoom.getHistory(1); ChatMessage[] history = chatRoom.getHistory(1);
LinphoneChatMessage msg = history[0]; ChatMessage msg = history[0];
if(msg.getFileTransferInformation() != null || msg.getExternalBodyUrl() != null || msg.getAppData() != null ){ if(msg.getFileTransferInformation() != null || msg.getExternalBodyUrl() != null || msg.getAppdata() != null ){
holder.lastMessageView.setBackgroundResource(R.drawable.chat_file_message); holder.lastMessageView.setBackgroundResource(R.drawable.chat_file_message);
time = msg.getTime(); time = msg.getTime();
holder.date.setText(LinphoneUtils.timestampToHumanDate(getActivity(),time,getString(R.string.messages_list_date_format))); holder.date.setText(LinphoneUtils.timestampToHumanDate(getActivity(),time,getString(R.string.messages_list_date_format)));
@ -431,7 +435,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
if (contact != null) { if (contact != null) {
LinphoneUtils.setThumbnailPictureFromUri(getActivity(), holder.contactPicture, contact.getThumbnailUri()); LinphoneUtils.setThumbnailPictureFromUri(LinphoneActivity.instance(), holder.contactPicture, contact.getThumbnailUri());
} else { } else {
holder.contactPicture.setImageBitmap(ContactsManager.getInstance().getDefaultAvatarBitmap()); holder.contactPicture.setImageBitmap(ContactsManager.getInstance().getDefaultAvatarBitmap());
} }

View file

@ -1,7 +1,8 @@
package org.linphone; package org.linphone;
/* /*
ContactDetailsFragment.java ContactDetailsFragment.java
Copyright (C) 2015 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -17,7 +18,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
import org.linphone.core.LinphoneProxyConfig;
import org.linphone.core.ProxyConfig;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.Dialog; import android.app.Dialog;
@ -32,9 +34,6 @@ import android.widget.ImageView;
import android.widget.TableLayout; import android.widget.TableLayout;
import android.widget.TextView; import android.widget.TextView;
/**
* @author Sylvain Berfini
*/
public class ContactDetailsFragment extends Fragment implements OnClickListener { public class ContactDetailsFragment extends Fragment implements OnClickListener {
private LinphoneContact contact; private LinphoneContact contact;
private ImageView editContact, deleteContact, back; private ImageView editContact, deleteContact, back;
@ -137,13 +136,13 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener
tv.setSelected(true); tv.setSelected(true);
LinphoneProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig(); ProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig();
if (lpc != null) { if (lpc != null) {
String username = lpc.normalizePhoneNumber(displayednumberOrAddress); String username = lpc.normalizePhoneNumber(displayednumberOrAddress);
value = LinphoneUtils.getFullAddressFromUsername(username); value = LinphoneUtils.getFullAddressFromUsername(username);
} }
String contactAddress = contact.getPresenceModelForUri(noa.getValue()); String contactAddress = contact.getPresenceModelForUriOrTel(noa.getValue());
if (contactAddress != null) { if (contactAddress != null) {
v.findViewById(R.id.friendLinphone).setVisibility(View.VISIBLE); v.findViewById(R.id.friendLinphone).setVisibility(View.VISIBLE);
} }

View file

@ -1,7 +1,8 @@
package org.linphone; package org.linphone;
/* /*
ContactEditorFragment.java ContactEditorFragment.java
Copyright (C) 2012 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -18,16 +19,6 @@ package org.linphone;
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import org.linphone.mediastream.Log;
import org.linphone.mediastream.Version;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;
import android.app.Dialog; import android.app.Dialog;
@ -57,6 +48,16 @@ import android.widget.EditText;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import org.linphone.mediastream.Log;
import org.linphone.mediastream.Version;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
public class ContactEditorFragment extends Fragment { public class ContactEditorFragment extends Fragment {
private View view; private View view;
private ImageView cancel, deleteContact, ok; private ImageView cancel, deleteContact, ok;
@ -73,7 +74,7 @@ public class ContactEditorFragment extends Fragment {
private List<LinphoneNumberOrAddress> numbersAndAddresses; private List<LinphoneNumberOrAddress> numbersAndAddresses;
private int firstSipAddressIndex = -1; private int firstSipAddressIndex = -1;
private LinearLayout sipAddresses, numbers; private LinearLayout sipAddresses, numbers;
private String newSipOrNumberToAdd; private String newSipOrNumberToAdd, newDisplayName;
private Uri pickedPhotoForContactUri; private Uri pickedPhotoForContactUri;
private byte[] photoToAdd; private byte[] photoToAdd;
@ -90,9 +91,14 @@ public class ContactEditorFragment extends Fragment {
isNewContact = false; isNewContact = false;
if (getArguments().getString("NewSipAdress") != null) { if (getArguments().getString("NewSipAdress") != null) {
newSipOrNumberToAdd = getArguments().getString("NewSipAdress"); newSipOrNumberToAdd = getArguments().getString("NewSipAdress");
}if (getArguments().getString("NewDisplayName") != null) {
newDisplayName = getArguments().getString("NewDisplayName");
} }
} else if (getArguments().getString("NewSipAdress") != null) { } else if (getArguments().getString("NewSipAdress") != null) {
newSipOrNumberToAdd = getArguments().getString("NewSipAdress"); newSipOrNumberToAdd = getArguments().getString("NewSipAdress");
if (getArguments().getString("NewDisplayName") != null) {
newDisplayName = getArguments().getString("NewDisplayName");
}
} }
} }
@ -439,6 +445,12 @@ public class ContactEditorFragment extends Fragment {
} }
} }
if (newDisplayName != null) {
EditText lastNameEditText = (EditText) view.findViewById(R.id.contactLastName);
if (view != null)
lastNameEditText.setText(newDisplayName);
}
if (controls.getChildCount() == 0) { if (controls.getChildCount() == 0) {
addEmptyRowToAllowNewNumberOrAddress(controls,false); addEmptyRowToAllowNewNumberOrAddress(controls,false);
} }

View file

@ -1,3 +1,5 @@
package org.linphone;
/* /*
ContactsListFragment.java ContactsListFragment.java
Copyright (C) 2017 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
@ -17,13 +19,6 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
package org.linphone;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import android.app.Dialog; import android.app.Dialog;
import android.app.Fragment; import android.app.Fragment;
@ -49,9 +44,14 @@ import android.widget.ProgressBar;
import android.widget.SectionIndexer; import android.widget.SectionIndexer;
import android.widget.TextView; import android.widget.TextView;
/** import java.util.ArrayList;
* @author Sylvain Berfini import java.util.LinkedHashMap;
*/ import java.util.List;
import java.util.Locale;
import java.util.Map;
import static org.linphone.FragmentsAvailable.CONTACTS_LIST;
public class ContactsListFragment extends Fragment implements OnClickListener, OnItemClickListener, ContactsUpdatedListener { public class ContactsListFragment extends Fragment implements OnClickListener, OnItemClickListener, ContactsUpdatedListener {
private LayoutInflater mInflater; private LayoutInflater mInflater;
private ListView contactsList; private ListView contactsList;
@ -62,7 +62,7 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
private LinearLayout editList, topbar; private LinearLayout editList, topbar;
private int lastKnownPosition; private int lastKnownPosition;
private boolean editOnClick = false, editConsumed = false, onlyDisplayChatAddress = false; private boolean editOnClick = false, editConsumed = false, onlyDisplayChatAddress = false;
private String sipAddressToAdd; private String sipAddressToAdd, displayName = null;
private ImageView clearSearchField; private ImageView clearSearchField;
private EditText searchField; private EditText searchField;
private ProgressBar contactsFetchInProgress; private ProgressBar contactsFetchInProgress;
@ -75,7 +75,8 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
if (getArguments() != null) { if (getArguments() != null) {
editOnClick = getArguments().getBoolean("EditOnClick"); editOnClick = getArguments().getBoolean("EditOnClick");
sipAddressToAdd = getArguments().getString("SipAddress"); sipAddressToAdd = getArguments().getString("SipAddress");
if(getArguments().getString("DisplayName") != null)
displayName = getArguments().getString("DisplayName");
onlyDisplayChatAddress = getArguments().getBoolean("ChatAddressOnly"); onlyDisplayChatAddress = getArguments().getBoolean("ChatAddressOnly");
} }
@ -254,6 +255,9 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
if (id == R.id.newContact) { if (id == R.id.newContact) {
editConsumed = true; editConsumed = true;
if(displayName != null)
LinphoneActivity.instance().addContact(displayName, sipAddressToAdd);
else
LinphoneActivity.instance().addContact(null, sipAddressToAdd); LinphoneActivity.instance().addContact(null, sipAddressToAdd);
} }
else if (id == R.id.clearSearchField) { else if (id == R.id.clearSearchField) {
@ -415,6 +419,8 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
@Override @Override
public void onContactsUpdated() { public void onContactsUpdated() {
if (!LinphoneActivity.isInstanciated() || LinphoneActivity.instance().getCurrentFragment() != CONTACTS_LIST)
return;
ContactsListAdapter adapter = (ContactsListAdapter)contactsList.getAdapter(); ContactsListAdapter adapter = (ContactsListAdapter)contactsList.getAdapter();
if (adapter != null) { if (adapter != null) {
contactsList.setFastScrollEnabled(false); contactsList.setFastScrollEnabled(false);
@ -537,14 +543,14 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
holder.separator.setVisibility(View.GONE); holder.separator.setVisibility(View.GONE);
} }
if (contact.isInLinphoneFriendList()) { if (contact.isInFriendList()) {
holder.linphoneFriend.setVisibility(View.VISIBLE); holder.linphoneFriend.setVisibility(View.VISIBLE);
} else { } else {
holder.linphoneFriend.setVisibility(View.GONE); holder.linphoneFriend.setVisibility(View.GONE);
} }
if (contact.hasPhoto()) { if (contact.hasPhoto()) {
LinphoneUtils.setThumbnailPictureFromUri(getActivity(), holder.contactPicture, contact.getThumbnailUri()); LinphoneUtils.setThumbnailPictureFromUri(LinphoneActivity.instance(), holder.contactPicture, contact.getThumbnailUri());
} else { } else {
holder.contactPicture.setImageBitmap(ContactsManager.getInstance().getDefaultAvatarBitmap()); holder.contactPicture.setImageBitmap(ContactsManager.getInstance().getDefaultAvatarBitmap());
} }
@ -590,7 +596,7 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
holder.delete.setVisibility(View.INVISIBLE); holder.delete.setVisibility(View.INVISIBLE);
} }
/*LinphoneFriend[] friends = LinphoneManager.getLc().getFriendList(); /*Friend[] friends = LinphoneManager.getLc().getFriendsLists();
if (!ContactsManager.getInstance().isContactPresenceDisabled() && friends != null) { if (!ContactsManager.getInstance().isContactPresenceDisabled() && friends != null) {
holder.friendStatus.setVisibility(View.VISIBLE); holder.friendStatus.setVisibility(View.VISIBLE);
PresenceActivityType presenceActivity = friends[0].getPresenceModel().getActivity().getType(); PresenceActivityType presenceActivity = friends[0].getPresenceModel().getActivity().getType();

View file

@ -1,6 +1,8 @@
package org.linphone;
/* /*
ContactsManager.java ContactsManager.java
Copyright (C) 2015 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -17,9 +19,6 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
package org.linphone;
import android.Manifest;
import android.accounts.Account; import android.accounts.Account;
import android.accounts.AccountManager; import android.accounts.AccountManager;
import android.content.ContentProviderOperation; import android.content.ContentProviderOperation;
@ -37,13 +36,12 @@ import android.provider.ContactsContract;
import android.provider.ContactsContract.CommonDataKinds; import android.provider.ContactsContract.CommonDataKinds;
import android.provider.ContactsContract.Data; import android.provider.ContactsContract.Data;
import org.linphone.core.LinphoneAddress; import org.linphone.core.Address;
import org.linphone.core.LinphoneCore; import org.linphone.core.Core;
import org.linphone.core.LinphoneFriend; import org.linphone.core.Friend;
import org.linphone.core.LinphoneFriendImpl; import org.linphone.core.FriendList;
import org.linphone.core.LinphoneProxyConfig; import org.linphone.core.ProxyConfig;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
import org.linphone.mediastream.Version;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
@ -213,30 +211,31 @@ public class ContactsManager extends ContentObserver {
initializeContactManager(context, contentResolver); initializeContactManager(context, contentResolver);
} }
public synchronized LinphoneContact findContactFromAddress(LinphoneAddress address) { public synchronized LinphoneContact findContactFromAddress(Address address) {
String sipUri = address.asStringUriOnly(); String sipUri = address.asStringUriOnly();
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
LinphoneFriend lf = lc.findFriendByAddress(sipUri); Friend lf = lc.findFriend(address);
if (lf != null) { if (lf != null) {
LinphoneContact contact = (LinphoneContact)((LinphoneFriendImpl)lf).getUserData(); LinphoneContact contact = (LinphoneContact)lf.getUserData();
return contact; return contact;
} }
return null; return null;
} }
public synchronized LinphoneContact findContactFromPhoneNumber(String phoneNumber) { public synchronized LinphoneContact findContactFromPhoneNumber(String phoneNumber) {
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
LinphoneProxyConfig lpc = null; ProxyConfig lpc = null;
if (lc != null) { if (lc != null) {
lpc = lc.getDefaultProxyConfig(); lpc = lc.getDefaultProxyConfig();
} }
if (lpc == null) return null; if (lpc == null) return null;
String normalized = lpc.normalizePhoneNumber(phoneNumber); String normalized = lpc.normalizePhoneNumber(phoneNumber);
LinphoneAddress addr = lpc.normalizeSipUri(normalized); Address addr = lpc.normalizeSipUri(normalized);
LinphoneFriend lf = lc.findFriendByAddress(addr.asStringUriOnly() + ";user=phone"); // Without this, the hashmap inside liblinphone won't find it... addr.setMethodParam(";user=phone");
Friend lf = lc.findFriend(addr); // Without this, the hashmap inside liblinphone won't find it...
if (lf != null) { if (lf != null) {
LinphoneContact contact = (LinphoneContact)((LinphoneFriendImpl)lf).getUserData(); LinphoneContact contact = (LinphoneContact)lf.getUserData();
return contact; return contact;
} }
return null; return null;
@ -250,8 +249,8 @@ public class ContactsManager extends ContentObserver {
sipContacts = c; sipContacts = c;
} }
public synchronized void refreshSipContact(LinphoneFriend lf) { public synchronized void refreshSipContact(Friend lf) {
LinphoneContact contact = (LinphoneContact)((LinphoneFriendImpl)lf).getUserData(); LinphoneContact contact = (LinphoneContact)lf.getUserData();
if (contact != null && !sipContacts.contains(contact)) { if (contact != null && !sipContacts.contains(contact)) {
sipContacts.add(contact); sipContacts.add(contact);
Collections.sort(sipContacts); Collections.sort(sipContacts);
@ -276,10 +275,11 @@ public class ContactsManager extends ContentObserver {
Date contactsTime = new Date(); Date contactsTime = new Date();
androidContactsCache.clear(); androidContactsCache.clear();
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) { if (lc != null) {
for (LinphoneFriend friend : lc.getFriendList()) { for (FriendList list : lc.getFriendsLists()) {
LinphoneContact contact = (LinphoneContact)((LinphoneFriendImpl)friend).getUserData(); for (Friend friend : list.getFriends()) {
LinphoneContact contact = (LinphoneContact) friend.getUserData();
if (contact != null) { if (contact != null) {
contact.clearAddresses(); contact.clearAddresses();
contacts.add(contact); contacts.add(contact);
@ -289,7 +289,7 @@ public class ContactsManager extends ContentObserver {
} else { } else {
if (friend.getRefKey() != null) { if (friend.getRefKey() != null) {
// Friend has a refkey and but no LinphoneContact => represents a native contact stored in db from a previous version of Linphone, remove it // Friend has a refkey and but no LinphoneContact => represents a native contact stored in db from a previous version of Linphone, remove it
lc.removeFriend(friend); list.removeFriend(friend);
} else { } else {
// No refkey so it's a standalone contact // No refkey so it's a standalone contact
contact = new LinphoneContact(); contact = new LinphoneContact();
@ -303,6 +303,7 @@ public class ContactsManager extends ContentObserver {
} }
} }
} }
}
long timeElapsed = (new Date()).getTime() - contactsTime.getTime(); long timeElapsed = (new Date()).getTime() - contactsTime.getTime();
String time = String.format("%02d:%02d", String time = String.format("%02d:%02d",
@ -358,7 +359,9 @@ public class ContactsManager extends ContentObserver {
String id = contact.getAndroidId(); String id = contact.getAndroidId();
if (id != null && !nativeIds.contains(id)) { if (id != null && !nativeIds.contains(id)) {
// Has been removed since last fetch // Has been removed since last fetch
lc.removeFriend(contact.getLinphoneFriend()); for (FriendList list : lc.getFriendsLists()) {
list.removeFriend(contact.getFriend());
}
contacts.remove(contact); contacts.remove(contact);
} }
} }
@ -407,8 +410,8 @@ public class ContactsManager extends ContentObserver {
Log.i("[ContactsManager] Step 2 for " + contacts.size() + " contacts: " + time + " elapsed since starting"); Log.i("[ContactsManager] Step 2 for " + contacts.size() + " contacts: " + time + " elapsed since starting");
for (LinphoneContact contact : contacts) { for (LinphoneContact contact : contacts) {
// Create the LinphoneFriends matching the native contacts // Create the Friends matching the native contacts
contact.createOrUpdateLinphoneFriendFromNativeContact(); contact.createOrUpdateFriendFromNativeContact();
} }
timeElapsed = (new Date()).getTime() - contactsTime.getTime(); timeElapsed = (new Date()).getTime() - contactsTime.getTime();
time = String.format("%02d:%02d", time = String.format("%02d:%02d",
@ -419,7 +422,7 @@ public class ContactsManager extends ContentObserver {
androidContactsCache.clear(); androidContactsCache.clear();
} else { } else {
Log.w("[Permission] Read contacts permission wasn't granted, only fetch LinphoneFriends"); Log.w("[Permission] Read contacts permission wasn't granted, only fetch Friends");
} }
Collections.sort(contacts); Collections.sort(contacts);
@ -429,9 +432,9 @@ public class ContactsManager extends ContentObserver {
if (LinphonePreferences.instance() != null && LinphonePreferences.instance().isFriendlistsubscriptionEnabled()) { if (LinphonePreferences.instance() != null && LinphonePreferences.instance().isFriendlistsubscriptionEnabled()) {
if (getString(R.string.rls_uri) != null) { if (getString(R.string.rls_uri) != null) {
LinphoneManager.getLc().getFriendLists()[0].setRLSUri(getString(R.string.rls_uri)); LinphoneManager.getLc().getFriendsLists()[0].setRlsUri(getString(R.string.rls_uri));
} }
LinphoneManager.getLc().getFriendLists()[0].updateSubscriptions(); LinphoneManager.getLc().getFriendsLists()[0].updateSubscriptions();
} }
for (ContactsUpdatedListener listener : contactsUpdatedListeners) { for (ContactsUpdatedListener listener : contactsUpdatedListeners) {
listener.onContactsUpdated(); listener.onContactsUpdated();

View file

@ -1,7 +1,8 @@
package org.linphone; package org.linphone;
/* /*
DialerFragment.java DialerFragment.java
Copyright (C) 2012 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -17,18 +18,12 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
import org.linphone.core.LinphoneCore;
import org.linphone.mediastream.Log;
import org.linphone.ui.AddressAware;
import org.linphone.ui.AddressText;
import org.linphone.ui.CallButton;
import org.linphone.ui.EraseButton;
import android.app.Fragment;
import android.content.Intent; import android.content.Intent;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.app.Fragment;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
@ -36,9 +31,13 @@ import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
/** import org.linphone.core.Core;
* @author Sylvain Berfini import org.linphone.mediastream.Log;
*/ import org.linphone.ui.AddressAware;
import org.linphone.ui.AddressText;
import org.linphone.ui.CallButton;
import org.linphone.ui.EraseButton;
public class DialerFragment extends Fragment { public class DialerFragment extends Fragment {
private static DialerFragment instance; private static DialerFragment instance;
private static boolean isCallTransferOngoing = false; private static boolean isCallTransferOngoing = false;
@ -63,14 +62,14 @@ public class DialerFragment extends Fragment {
mCall = (CallButton) view.findViewById(R.id.call); mCall = (CallButton) view.findViewById(R.id.call);
mCall.setAddressWidget(mAddress); mCall.setAddressWidget(mAddress);
if (LinphoneActivity.isInstanciated() && LinphoneManager.getLc().getCallsNb() > 0) { if (LinphoneActivity.isInstanciated() && LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null && LinphoneManager.getLcIfManagerNotDestroyedOrNull().getCallsNb() > 0) {
if (isCallTransferOngoing) { if (isCallTransferOngoing) {
mCall.setImageResource(R.drawable.call_transfer); mCall.setImageResource(R.drawable.call_transfer);
} else { } else {
mCall.setImageResource(R.drawable.call_add); mCall.setImageResource(R.drawable.call_add);
} }
} else { } else {
if (LinphoneManager.getLc().getVideoAutoInitiatePolicy()) { if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null && LinphoneManager.getLcIfManagerNotDestroyedOrNull().getVideoActivationPolicy().getAutomaticallyInitiate()) {
mCall.setImageResource(R.drawable.call_video_start); mCall.setImageResource(R.drawable.call_video_start);
} else { } else {
mCall.setImageResource(R.drawable.call_audio_start); mCall.setImageResource(R.drawable.call_audio_start);
@ -83,7 +82,7 @@ public class DialerFragment extends Fragment {
} }
mAddContact = (ImageView) view.findViewById(R.id.add_contact); mAddContact = (ImageView) view.findViewById(R.id.add_contact);
mAddContact.setEnabled(!(LinphoneActivity.isInstanciated() && LinphoneManager.getLc().getCallsNb() > 0)); mAddContact.setEnabled(!(LinphoneActivity.isInstanciated() && LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null && LinphoneManager.getLc().getCallsNb() > 0));
addContactListener = new OnClickListener() { addContactListener = new OnClickListener() {
@Override @Override
@ -100,7 +99,7 @@ public class DialerFragment extends Fragment {
transferListener = new OnClickListener() { transferListener = new OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
LinphoneCore lc = LinphoneManager.getLc(); Core lc = LinphoneManager.getLc();
if (lc.getCurrentCall() == null) { if (lc.getCurrentCall() == null) {
return; return;
} }
@ -185,7 +184,7 @@ public class DialerFragment extends Fragment {
return; return;
} }
isCallTransferOngoing = LinphoneActivity.instance().isCallTransfer(); isCallTransferOngoing = LinphoneActivity.instance().isCallTransfer();
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc == null) { if (lc == null) {
return; return;
} }
@ -202,7 +201,7 @@ public class DialerFragment extends Fragment {
mAddContact.setImageResource(R.drawable.call_alt_back); mAddContact.setImageResource(R.drawable.call_alt_back);
mAddContact.setOnClickListener(cancelListener); mAddContact.setOnClickListener(cancelListener);
} else { } else {
if (LinphoneManager.getLc().getVideoAutoInitiatePolicy()) { if (LinphoneManager.getLc().getVideoActivationPolicy().getAutomaticallyInitiate()) {
mCall.setImageResource(R.drawable.call_video_start); mCall.setImageResource(R.drawable.call_video_start);
} else { } else {
mCall.setImageResource(R.drawable.call_audio_start); mCall.setImageResource(R.drawable.call_audio_start);
@ -215,7 +214,7 @@ public class DialerFragment extends Fragment {
} }
public void enableDisableAddContact() { public void enableDisableAddContact() {
mAddContact.setEnabled(LinphoneManager.getLc().getCallsNb() > 0 || !mAddress.getText().toString().equals("")); mAddContact.setEnabled(LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null && LinphoneManager.getLc().getCallsNb() > 0 || !mAddress.getText().toString().equals(""));
} }
public void displayTextInAddressBar(String numberOrSipAddress) { public void displayTextInAddressBar(String numberOrSipAddress) {

View file

@ -1,7 +1,27 @@
package org.linphone; package org.linphone;
import org.linphone.core.LinphoneCore; /*
import org.linphone.core.LinphoneCoreFactory; DozeReceiver.java
Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import org.linphone.core.Core;
import org.linphone.core.Factory;
import org.linphone.core.LogCollectionState;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
import android.content.Context; import android.content.Context;
@ -19,9 +39,9 @@ public class DozeReceiver extends android.content.BroadcastReceiver {
if (!LinphoneService.isReady()) return; if (!LinphoneService.isReady()) return;
boolean isDebugEnabled = LinphonePreferences.instance().isDebugEnabled(); boolean isDebugEnabled = LinphonePreferences.instance().isDebugEnabled();
LinphoneCoreFactory.instance().enableLogCollection(isDebugEnabled); Factory.instance().enableLogCollection(isDebugEnabled ? LogCollectionState.Enabled : LogCollectionState.Disabled);
LinphoneCoreFactory.instance().setDebugMode(isDebugEnabled, context.getString(R.string.app_name)); Factory.instance().setDebugMode(isDebugEnabled, context.getString(R.string.app_name));
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc == null) return; if (lc == null) return;
pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);

View file

@ -1,7 +1,8 @@
package org.linphone; package org.linphone;
/* /*
AboutFragment.java EmptyFragment.java
Copyright (C) 2012 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -24,9 +25,6 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
/**
* @author Sylvain Berfini
*/
public class EmptyFragment extends Fragment { public class EmptyFragment extends Fragment {
@Override @Override

View file

@ -1,7 +1,8 @@
package org.linphone; package org.linphone;
/* /*
FragmentsAvailable.java FragmentsAvailable.java
Copyright (C) 2012 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -17,9 +18,7 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
/**
* @author Sylvain Berfini
*/
public enum FragmentsAvailable { public enum FragmentsAvailable {
UNKNOW, UNKNOW,
DIALER, DIALER,

View file

@ -1,7 +1,8 @@
package org.linphone; package org.linphone;
/* /*
HistoryDetailFragment.java HistoryDetailFragment.java
Copyright (C) 2012 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -17,6 +18,7 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
import android.app.Fragment; import android.app.Fragment;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
@ -27,14 +29,11 @@ import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import org.linphone.core.LinphoneAddress; import org.linphone.core.Address;
import org.linphone.core.LinphoneCoreException; import org.linphone.core.CoreException;
import org.linphone.core.LinphoneCoreFactory; import org.linphone.core.Factory;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
/**
* @author Sylvain Berfini
*/
public class HistoryDetailFragment extends Fragment implements OnClickListener { public class HistoryDetailFragment extends Fragment implements OnClickListener {
private ImageView dialBack, chat, addToContacts, goToContact, back; private ImageView dialBack, chat, addToContacts, goToContact, back;
private View view; private View view;
@ -104,12 +103,8 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
Long longDate = Long.parseLong(callDate); Long longDate = Long.parseLong(callDate);
date.setText(LinphoneUtils.timestampToHumanDate(getActivity(),longDate,getString(R.string.history_detail_date_format))); date.setText(LinphoneUtils.timestampToHumanDate(getActivity(),longDate,getString(R.string.history_detail_date_format)));
LinphoneAddress lAddress = null; Address lAddress = null;
try { lAddress = Factory.instance().createAddress(sipUri);
lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
} catch (LinphoneCoreException e) {
Log.e(e);
}
if (lAddress != null) { if (lAddress != null) {
contactAddress.setText(lAddress.asStringUriOnly()); contactAddress.setText(lAddress.asStringUriOnly());
@ -164,12 +159,12 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
LinphoneActivity.instance().displayChat(sipUri, null, null); LinphoneActivity.instance().displayChat(sipUri, null, null);
} else if (id == R.id.add_contact) { } else if (id == R.id.add_contact) {
String uri = sipUri; String uri = sipUri;
try { Address addr = null;
LinphoneAddress addr = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri); addr = Factory.instance().createAddress(sipUri);
uri = addr.asStringUriOnly(); uri = addr.asStringUriOnly();
} catch (LinphoneCoreException e) { if (addr != null && addr.getDisplayName() != null)
Log.e(e); LinphoneActivity.instance().displayContactsForEdition(addr.asStringUriOnly(), addr.getDisplayName());
} else
LinphoneActivity.instance().displayContactsForEdition(uri); LinphoneActivity.instance().displayContactsForEdition(uri);
} else if (id == R.id.goto_contact) { } else if (id == R.id.goto_contact) {
LinphoneActivity.instance().displayContact(contact, false); LinphoneActivity.instance().displayContact(contact, false);

View file

@ -1,7 +1,8 @@
package org.linphone; package org.linphone;
/* /*
HistoryListFragment.java HistoryListFragment.java
Copyright (C) 2015 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -17,16 +18,18 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Calendar; import java.util.Calendar;
import java.util.List; import java.util.List;
import org.linphone.core.CallDirection; import org.linphone.core.Call;
import org.linphone.core.LinphoneAddress; import org.linphone.core.Call.Dir;
import org.linphone.core.LinphoneCallLog; import org.linphone.core.Address;
import org.linphone.core.LinphoneCallLog.CallStatus; import org.linphone.core.CallLog;
import org.linphone.core.CallLog.CallStatus;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.Dialog; import android.app.Dialog;
@ -50,9 +53,8 @@ import android.widget.ListView;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
/** import static org.linphone.FragmentsAvailable.HISTORY_LIST;
* @author Sylvain Berfini
*/
public class HistoryListFragment extends Fragment implements OnClickListener, OnItemClickListener, ContactsUpdatedListener { public class HistoryListFragment extends Fragment implements OnClickListener, OnItemClickListener, ContactsUpdatedListener {
private ListView historyList; private ListView historyList;
private LayoutInflater mInflater; private LayoutInflater mInflater;
@ -61,7 +63,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
private View allCallsSelected, missedCallsSelected; private View allCallsSelected, missedCallsSelected;
private LinearLayout editList, topBar; private LinearLayout editList, topBar;
private boolean onlyDisplayMissedCalls, isEditMode; private boolean onlyDisplayMissedCalls, isEditMode;
private List<LinphoneCallLog> mLogs; private List<CallLog> mLogs;
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
@ -122,11 +124,11 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
public void displayFirstLog(){ public void displayFirstLog(){
if (mLogs != null && mLogs.size() > 0) { if (mLogs != null && mLogs.size() > 0) {
LinphoneCallLog log = mLogs.get(0); CallLog log = mLogs.get(0);
if (log.getDirection() == CallDirection.Incoming) { if (log.getDir() == Call.Dir.Incoming) {
LinphoneActivity.instance().displayHistoryDetail(mLogs.get(0).getFrom().toString(), mLogs.get(0)); LinphoneActivity.instance().displayHistoryDetail(mLogs.get(0).getFromAddress().toString(), mLogs.get(0));
} else { } else {
LinphoneActivity.instance().displayHistoryDetail(mLogs.get(0).getTo().toString(), mLogs.get(0)); LinphoneActivity.instance().displayHistoryDetail(mLogs.get(0).getToAddress().toString(), mLogs.get(0));
} }
} else { } else {
LinphoneActivity.instance().displayEmptyFragment(); LinphoneActivity.instance().displayEmptyFragment();
@ -137,7 +139,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
int size = historyList.getAdapter().getCount(); int size = historyList.getAdapter().getCount();
for(int i=0; i<size; i++) { for(int i=0; i<size; i++) {
if(historyList.isItemChecked(i)){ if(historyList.isItemChecked(i)){
LinphoneCallLog log = mLogs.get(i); CallLog log = mLogs.get(i);
LinphoneManager.getLc().removeCallLog(log); LinphoneManager.getLc().removeCallLog(log);
} }
} }
@ -166,8 +168,8 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
private void removeNotMissedCallsFromLogs() { private void removeNotMissedCallsFromLogs() {
if (onlyDisplayMissedCalls) { if (onlyDisplayMissedCalls) {
List<LinphoneCallLog> missedCalls = new ArrayList<LinphoneCallLog>(); List<CallLog> missedCalls = new ArrayList<CallLog>();
for (LinphoneCallLog log : mLogs) { for (CallLog log : mLogs) {
if (log.getStatus() == CallStatus.Missed) { if (log.getStatus() == CallStatus.Missed) {
missedCalls.add(log); missedCalls.add(log);
} }
@ -222,6 +224,8 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
@Override @Override
public void onContactsUpdated() { public void onContactsUpdated() {
if (!LinphoneActivity.isInstanciated() || LinphoneActivity.instance().getCurrentFragment() != HISTORY_LIST)
return;
CallHistoryAdapter adapter = (CallHistoryAdapter)historyList.getAdapter(); CallHistoryAdapter adapter = (CallHistoryAdapter)historyList.getAdapter();
if (adapter != null) { if (adapter != null) {
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
@ -320,7 +324,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
@Override @Override
public void onItemClick(AdapterView<?> adapter, View view, int position, long id) { public void onItemClick(AdapterView<?> adapter, View view, int position, long id) {
if (isEditMode) { if (isEditMode) {
LinphoneCallLog log = mLogs.get(position); CallLog log = mLogs.get(position);
LinphoneManager.getLc().removeCallLog(log); LinphoneManager.getLc().removeCallLog(log);
mLogs = Arrays.asList(LinphoneManager.getLc().getCallLogs()); mLogs = Arrays.asList(LinphoneManager.getLc().getCallLogs());
} }
@ -423,9 +427,11 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
view.setTag(holder); view.setTag(holder);
} }
final LinphoneCallLog log = mLogs.get(position); if (mLogs == null || mLogs.size() < position) return view;
long timestamp = log.getTimestamp();
LinphoneAddress address; final CallLog log = mLogs.get(position);
long timestamp = log.getStartDate();
Address address;
holder.contact.setSelected(true); // For automated horizontal scrolling of long texts holder.contact.setSelected(true); // For automated horizontal scrolling of long texts
@ -436,8 +442,8 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
separatorText.setText(timestampToHumanDate(logTime)); separatorText.setText(timestampToHumanDate(logTime));
if (position > 0) { if (position > 0) {
LinphoneCallLog previousLog = mLogs.get(position-1); CallLog previousLog = mLogs.get(position-1);
long previousTimestamp = previousLog.getTimestamp(); long previousTimestamp = previousLog.getStartDate();
Calendar previousLogTime = Calendar.getInstance(); Calendar previousLogTime = Calendar.getInstance();
previousLogTime.setTimeInMillis(previousTimestamp); previousLogTime.setTimeInMillis(previousTimestamp);
@ -450,15 +456,15 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
separator.setVisibility(View.VISIBLE); separator.setVisibility(View.VISIBLE);
} }
if (log.getDirection() == CallDirection.Incoming) { if (log.getDir() == Call.Dir.Incoming) {
address = log.getFrom(); address = log.getFromAddress();
if (log.getStatus() == CallStatus.Missed) { if (log.getStatus() == CallStatus.Missed) {
holder.callDirection.setImageResource(R.drawable.call_status_missed); holder.callDirection.setImageResource(R.drawable.call_status_missed);
} else { } else {
holder.callDirection.setImageResource(R.drawable.call_status_incoming); holder.callDirection.setImageResource(R.drawable.call_status_incoming);
} }
} else { } else {
address = log.getTo(); address = log.getToAddress();
holder.callDirection.setImageResource(R.drawable.call_status_outgoing); holder.callDirection.setImageResource(R.drawable.call_status_outgoing);
} }
@ -467,7 +473,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
final String sipUri = address.asString(); final String sipUri = address.asString();
if (c != null) { if (c != null) {
displayName = c.getFullName(); displayName = c.getFullName();
LinphoneUtils.setThumbnailPictureFromUri(getActivity(), holder.contactPicture, c.getThumbnailUri()); LinphoneUtils.setThumbnailPictureFromUri(LinphoneActivity.instance(), holder.contactPicture, c.getThumbnailUri());
} else { } else {
holder.contactPicture.setImageBitmap(ContactsManager.getInstance().getDefaultAvatarBitmap()); holder.contactPicture.setImageBitmap(ContactsManager.getInstance().getDefaultAvatarBitmap());
} }
@ -523,12 +529,12 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (LinphoneActivity.isInstanciated()) { if (LinphoneActivity.isInstanciated()) {
LinphoneCallLog log = mLogs.get(position); CallLog log = mLogs.get(position);
LinphoneAddress address; Address address;
if (log.getDirection() == CallDirection.Incoming) { if (log.getDir() == Call.Dir.Incoming) {
address = log.getFrom(); address = log.getFromAddress();
} else { } else {
address = log.getTo(); address = log.getToAddress();
} }
LinphoneActivity.instance().setAddresGoToDialerAndCall(address.asStringUriOnly(), address.getDisplayName(), null); LinphoneActivity.instance().setAddresGoToDialerAndCall(address.asStringUriOnly(), address.getDisplayName(), null);
} }

View file

@ -1,5 +1,24 @@
package org.linphone; package org.linphone;
/*
HookReceiver.java
Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
@ -17,7 +36,7 @@ public class HookReceiver extends BroadcastReceiver {
if(b){ if(b){
//handset on //handset on
Log.i(" ======>>>>>> HookReceiver - handset ON"); Log.i(" ======>>>>>> HookReceiver - handset ON");
LinphoneManager.getLc().enableSpeaker(false); LinphoneManager.getInstance().enableSpeaker(false);
if(!LinphoneManager.getInstance().isHansetModeOn()) if(!LinphoneManager.getInstance().isHansetModeOn())
LinphoneManager.getInstance().setHandsetMode(true); LinphoneManager.getInstance().setHandsetMode(true);
@ -25,7 +44,7 @@ public class HookReceiver extends BroadcastReceiver {
}else{ }else{
//handset off //handset off
Log.i(" ======>>>>>> HookReceiver - handset OFF"); Log.i(" ======>>>>>> HookReceiver - handset OFF");
LinphoneManager.getLc().enableSpeaker(true); LinphoneManager.getInstance().enableSpeaker(true);
LinphoneManager.getInstance().setHandsetMode(false); LinphoneManager.getInstance().setHandsetMode(false);
} }
} }

View file

@ -1,6 +1,8 @@
package org.linphone;
/* /*
KeepAliveReceiver.java KeepAliveReceiver.java
Copyright (C) 2010 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -16,11 +18,11 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
package org.linphone;
import org.linphone.compatibility.Compatibility; import org.linphone.compatibility.Compatibility;
import org.linphone.core.LinphoneCore; import org.linphone.core.Core;
import org.linphone.core.LinphoneCoreFactory; import org.linphone.core.Factory;
import org.linphone.core.LogCollectionState;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
import android.app.AlarmManager; import android.app.AlarmManager;
@ -40,9 +42,9 @@ public class KeepAliveReceiver extends BroadcastReceiver {
return; return;
} else { } else {
boolean isDebugEnabled = LinphonePreferences.instance().isDebugEnabled(); boolean isDebugEnabled = LinphonePreferences.instance().isDebugEnabled();
LinphoneCoreFactory.instance().enableLogCollection(isDebugEnabled); Factory.instance().enableLogCollection(isDebugEnabled ? LogCollectionState.Enabled : LogCollectionState.Disabled);
LinphoneCoreFactory.instance().setDebugMode(isDebugEnabled, context.getString(R.string.app_name)); Factory.instance().setDebugMode(isDebugEnabled, context.getString(R.string.app_name));
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc == null) return; if (lc == null) return;
String action = intent.getAction(); String action = intent.getAction();

View file

@ -2,7 +2,7 @@ package org.linphone;
/* /*
LinphoneActivity.java LinphoneActivity.java
Copyright (C) 2012 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -66,21 +66,21 @@ import org.linphone.LinphoneManager.AddressType;
import org.linphone.assistant.AssistantActivity; import org.linphone.assistant.AssistantActivity;
import org.linphone.assistant.RemoteProvisioningLoginActivity; import org.linphone.assistant.RemoteProvisioningLoginActivity;
import org.linphone.compatibility.Compatibility; import org.linphone.compatibility.Compatibility;
import org.linphone.core.CallDirection; import org.linphone.core.Call.Dir;
import org.linphone.core.LinphoneAddress; import org.linphone.core.Address;
import org.linphone.core.LinphoneAuthInfo; import org.linphone.core.AuthInfo;
import org.linphone.core.LinphoneCall; import org.linphone.core.Call;
import org.linphone.core.LinphoneCall.State; import org.linphone.core.Call.State;
import org.linphone.core.LinphoneCallLog; import org.linphone.core.CallLog;
import org.linphone.core.LinphoneCallLog.CallStatus; import org.linphone.core.CallLog.CallStatus;
import org.linphone.core.LinphoneChatMessage; import org.linphone.core.ChatMessage;
import org.linphone.core.LinphoneChatRoom; import org.linphone.core.ChatRoom;
import org.linphone.core.LinphoneCore; import org.linphone.core.Core;
import org.linphone.core.LinphoneCore.RegistrationState; import org.linphone.core.Core.RegistrationState;
import org.linphone.core.LinphoneCoreException; import org.linphone.core.CoreException;
import org.linphone.core.LinphoneCoreFactory; import org.linphone.core.Factory;
import org.linphone.core.LinphoneCoreListenerBase; import org.linphone.core.CoreListenerStub;
import org.linphone.core.LinphoneProxyConfig; import org.linphone.core.ProxyConfig;
import org.linphone.core.Reason; import org.linphone.core.Reason;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
import org.linphone.purchase.InAppPurchaseActivity; import org.linphone.purchase.InAppPurchaseActivity;
@ -103,9 +103,6 @@ import java.util.List;
import static org.linphone.LinphoneActivity.ChatRoomContainer.createChatroomContainer; import static org.linphone.LinphoneActivity.ChatRoomContainer.createChatroomContainer;
/**
* @author Sylvain Berfini
*/
public class LinphoneActivity extends LinphoneGenericActivity implements OnClickListener, ContactPicked, ActivityCompat.OnRequestPermissionsResultCallback { public class LinphoneActivity extends LinphoneGenericActivity implements OnClickListener, ContactPicked, ActivityCompat.OnRequestPermissionsResultCallback {
public static final String PREF_FIRST_LAUNCH = "pref_first_launch"; public static final String PREF_FIRST_LAUNCH = "pref_first_launch";
private static final int SETTINGS_ACTIVITY = 123; private static final int SETTINGS_ACTIVITY = 123;
@ -133,7 +130,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
private boolean emptyFragment = false; private boolean emptyFragment = false;
private boolean isTrialAccount = false; private boolean isTrialAccount = false;
private OrientationEventListener mOrientationHelper; private OrientationEventListener mOrientationHelper;
private LinphoneCoreListenerBase mListener; private CoreListenerStub mListener;
private LinearLayout mTabBar; private LinearLayout mTabBar;
private DrawerLayout sideMenu; private DrawerLayout sideMenu;
@ -215,16 +212,16 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
currentFragment = (FragmentsAvailable) savedInstanceState.getSerializable("currentFragment"); currentFragment = (FragmentsAvailable) savedInstanceState.getSerializable("currentFragment");
} }
mListener = new LinphoneCoreListenerBase(){ mListener = new CoreListenerStub(){
@Override @Override
public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) { public void onMessageReceived(Core lc, ChatRoom cr, ChatMessage message) {
displayMissedChats(getUnreadMessageCount()); displayMissedChats(getUnreadMessageCount());
} }
@Override @Override
public void registrationState(LinphoneCore lc, LinphoneProxyConfig proxy, LinphoneCore.RegistrationState state, String smessage) { public void onRegistrationStateChanged(Core lc, ProxyConfig proxy, Core.RegistrationState state, String smessage) {
LinphoneAuthInfo authInfo = lc.findAuthInfo(proxy.getIdentity(), proxy.getRealm(), proxy.getDomain()); AuthInfo authInfo = lc.findAuthInfo(proxy.getRealm(), proxy.getIdentityAddress().getUsername(), proxy.getDomain());
if (state.equals(RegistrationState.RegistrationCleared)) { if (state.equals(RegistrationState.Cleared)) {
if (lc != null) { if (lc != null) {
if (authInfo != null) if (authInfo != null)
lc.removeAuthInfo(authInfo); lc.removeAuthInfo(authInfo);
@ -235,14 +232,14 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
if(getResources().getBoolean(R.bool.use_phone_number_validation) if(getResources().getBoolean(R.bool.use_phone_number_validation)
&& authInfo != null && authInfo.getDomain().equals(getString(R.string.default_domain))) { && authInfo != null && authInfo.getDomain().equals(getString(R.string.default_domain))) {
if (state.equals(RegistrationState.RegistrationOk)) { if (state.equals(RegistrationState.Ok)) {
LinphoneManager.getInstance().isAccountWithAlias(); LinphoneManager.getInstance().isAccountWithAlias();
} }
} }
if(state.equals(RegistrationState.RegistrationFailed) && newProxyConfig) { if(state.equals(RegistrationState.Failed) && newProxyConfig) {
newProxyConfig = false; newProxyConfig = false;
if (proxy.getError() == Reason.BadCredentials) { if (proxy.getError() == Reason.Forbidden) {
//displayCustomToast(getString(R.string.error_bad_credentials), Toast.LENGTH_LONG); //displayCustomToast(getString(R.string.error_bad_credentials), Toast.LENGTH_LONG);
} }
if (proxy.getError() == Reason.Unauthorized) { if (proxy.getError() == Reason.Unauthorized) {
@ -255,12 +252,12 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
} }
@Override @Override
public void callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State state, String message) { public void onCallStateChanged(Core lc, Call call, Call.State state, String message) {
if (state == State.IncomingReceived) { if (state == State.IncomingReceived) {
startActivity(new Intent(LinphoneActivity.instance(), CallIncomingActivity.class)); startActivity(new Intent(LinphoneActivity.instance(), CallIncomingActivity.class));
} else if (state == State.OutgoingInit || state == State.OutgoingProgress) { } else if (state == State.OutgoingInit || state == State.OutgoingProgress) {
startActivity(new Intent(LinphoneActivity.instance(), CallOutgoingActivity.class)); startActivity(new Intent(LinphoneActivity.instance(), CallOutgoingActivity.class));
} else if (state == State.CallEnd || state == State.Error || state == State.CallReleased) { } else if (state == State.End || state == State.Error || state == State.Released) {
resetClassicMenuLayoutAndGoBackToCallIfStillRunning(); resetClassicMenuLayoutAndGoBackToCallIfStillRunning();
} }
@ -548,22 +545,16 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
} }
} }
public void displayHistoryDetail(String sipUri, LinphoneCallLog log) { public void displayHistoryDetail(String sipUri, CallLog log) {
LinphoneAddress lAddress; Address lAddress;
try { lAddress = Factory.instance().createAddress(sipUri);
lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
} catch (LinphoneCoreException e) {
Log.e("Cannot display history details",e);
//TODO display error message
return;
}
LinphoneContact c = ContactsManager.getInstance().findContactFromAddress(lAddress); LinphoneContact c = ContactsManager.getInstance().findContactFromAddress(lAddress);
String displayName = c != null ? c.getFullName() : LinphoneUtils.getAddressDisplayName(sipUri); String displayName = c != null ? c.getFullName() : LinphoneUtils.getAddressDisplayName(sipUri);
String pictureUri = c != null && c.getPhotoUri() != null ? c.getPhotoUri().toString() : null; String pictureUri = c != null && c.getPhotoUri() != null ? c.getPhotoUri().toString() : null;
String status; String status;
if (log.getDirection() == CallDirection.Outgoing) { if (log.getDir() == Call.Dir.Outgoing) {
status = getString(R.string.outgoing); status = getString(R.string.outgoing);
} else { } else {
if (log.getStatus() == CallStatus.Missed) { if (log.getStatus() == CallStatus.Missed) {
@ -573,8 +564,8 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
} }
} }
String callTime = secondsToDisplayableString(log.getCallDuration()); String callTime = secondsToDisplayableString(log.getDuration());
String callDate = String.valueOf(log.getTimestamp()); String callDate = String.valueOf(log.getStartDate());
Fragment fragment2 = getFragmentManager().findFragmentById(R.id.fragmentContainer2); Fragment fragment2 = getFragmentManager().findFragmentById(R.id.fragmentContainer2);
if (fragment2 != null && fragment2.isVisible() && currentFragment == FragmentsAvailable.HISTORY_DETAIL) { if (fragment2 != null && fragment2.isVisible() && currentFragment == FragmentsAvailable.HISTORY_DETAIL) {
@ -637,6 +628,14 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
changeCurrentFragment(FragmentsAvailable.ABOUT, null); changeCurrentFragment(FragmentsAvailable.ABOUT, null);
} }
public void displayContactsForEdition(String sipAddress, String displayName) {
Bundle extras = new Bundle();
extras.putBoolean("EditOnClick", true);
extras.putString("SipAddress", sipAddress);
extras.putString("DisplayName", displayName);
changeCurrentFragment(FragmentsAvailable.CONTACTS_LIST, extras);
}
public void displayAssistant() { public void displayAssistant() {
startActivity(new Intent(LinphoneActivity.this, AssistantActivity.class)); startActivity(new Intent(LinphoneActivity.this, AssistantActivity.class));
} }
@ -649,8 +648,8 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
public int getUnreadMessageCount() { public int getUnreadMessageCount() {
int count = 0; int count = 0;
LinphoneChatRoom[] chats = LinphoneManager.getLc().getChatRooms(); ChatRoom[] chats = LinphoneManager.getLc().getChatRooms();
for (LinphoneChatRoom chatroom : chats) { for (ChatRoom chatroom : chats) {
count += chatroom.getUnreadMessagesCount(); count += chatroom.getUnreadMessagesCount();
} }
return count; return count;
@ -661,8 +660,8 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
ArrayList<String> listUri = new ArrayList<String>(); ArrayList<String> listUri = new ArrayList<String>();
if (LinphoneManager.isInstanciated() && LinphoneManager.getLc() != null if (LinphoneManager.isInstanciated() && LinphoneManager.getLc() != null
&& LinphoneManager.getLc().getDefaultProxyConfig() != null && LinphoneManager.getLc().getDefaultProxyConfig() != null
&& LinphoneManager.getLc().getDefaultProxyConfig().getIdentity() != null) { && LinphoneManager.getLc().getDefaultProxyConfig().getIdentityAddress() != null) {
listUri.add(LinphoneManager.getLc().getDefaultProxyConfig().getAddress().asStringUriOnly()); listUri.add(LinphoneManager.getLc().getDefaultProxyConfig().getIdentityAddress().asStringUriOnly());
} }
for (ContactAddress ca : list) { for (ContactAddress ca : list) {
listUri.add(ca.getAddress()); listUri.add(ca.getAddress());
@ -671,7 +670,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
changeCurrentFragment(FragmentsAvailable.INFO_GROUP_CHAT, extras); changeCurrentFragment(FragmentsAvailable.INFO_GROUP_CHAT, extras);
} }
private void displayChat(String sipUri, String message, String fileUri, String pictureUri, String thumbnailUri, String displayName, LinphoneAddress lAddress) { private void displayChat(String sipUri, String message, String fileUri, String pictureUri, String thumbnailUri, String displayName, Address lAddress) {
Bundle extras = new Bundle(); Bundle extras = new Bundle();
extras.putString("SipUri", sipUri); extras.putString("SipUri", sipUri);
if(message != null) if(message != null)
@ -699,15 +698,10 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
String thumbnailUri = null; String thumbnailUri = null;
String displayName = null; String displayName = null;
LinphoneAddress lAddress = null; Address lAddress = null;
if(sipUri != null) { if(sipUri != null) {
try {
lAddress = LinphoneManager.getLc().interpretUrl(sipUri); lAddress = LinphoneManager.getLc().interpretUrl(sipUri);
} catch (LinphoneCoreException e) { if (lAddress == null) return;
//TODO display error message
Log.e("Cannot display chat", e);
return;
}
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(lAddress); LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(lAddress);
displayName = contact != null ? contact.getFullName() : null; displayName = contact != null ? contact.getFullName() : null;
@ -857,20 +851,20 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
} }
static class ChatRoomContainer{ static class ChatRoomContainer{
private LinphoneChatRoom mCr; private ChatRoom mCr;
long mTime; long mTime;
static public ChatRoomContainer createChatroomContainer(LinphoneChatRoom chatRoom) { static public ChatRoomContainer createChatroomContainer(ChatRoom chatRoom) {
if (chatRoom.getHistorySize() <= 0) return null; if (chatRoom.getHistorySize() <= 0) return null;
return new ChatRoomContainer(chatRoom); return new ChatRoomContainer(chatRoom);
} }
public ChatRoomContainer(LinphoneChatRoom chatroom){ public ChatRoomContainer(ChatRoom chatroom){
mCr = chatroom; mCr = chatroom;
LinphoneChatMessage[] lastMsg = chatroom.getHistory(1); ChatMessage[] lastMsg = chatroom.getHistory(1);
if (lastMsg != null && lastMsg.length > 0 && lastMsg[0] != null) { if (lastMsg != null && lastMsg.length > 0 && lastMsg[0] != null) {
mTime = lastMsg[0].getTime(); mTime = lastMsg[0].getTime();
}else mTime = 0; }else mTime = 0;
} }
LinphoneChatRoom getChatRoom(){ ChatRoom getChatRoom(){
return mCr; return mCr;
} }
long getTime(){ long getTime(){
@ -880,10 +874,10 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
public List<String> getChatList() { public List<String> getChatList() {
ArrayList<String> chatList = new ArrayList<String>(); ArrayList<String> chatList = new ArrayList<String>();
LinphoneChatRoom[] chats = LinphoneManager.getLc().getChatRooms(); ChatRoom[] chats = LinphoneManager.getLc().getChatRooms();
List<ChatRoomContainer> rooms = new ArrayList<ChatRoomContainer>(); List<ChatRoomContainer> rooms = new ArrayList<ChatRoomContainer>();
for (LinphoneChatRoom chatroom : chats) { for (ChatRoom chatroom : chats) {
ChatRoomContainer crc = createChatroomContainer(chatroom); ChatRoomContainer crc = createChatroomContainer(chatroom);
if (crc != null) rooms.add(crc); if (crc != null) rooms.add(crc);
} }
@ -913,7 +907,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
} }
public void removeFromChatList(String sipUri) { public void removeFromChatList(String sipUri) {
LinphoneChatRoom chatroom = LinphoneManager.getLc().getOrCreateChatRoom(sipUri); ChatRoom chatroom = LinphoneManager.getLc().getChatRoomFromUri(sipUri);
chatroom.deleteHistory(); chatroom.deleteHistory();
} }
@ -989,7 +983,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
@Override @Override
public void onClick(View view) { public void onClick(View view) {
String newPassword = ((EditText) dialog.findViewById(R.id.password)).getText().toString(); String newPassword = ((EditText) dialog.findViewById(R.id.password)).getText().toString();
LinphoneAuthInfo authInfo = LinphoneCoreFactory.instance().createAuthInfo(username, null, newPassword, null, realm, domain); AuthInfo authInfo = Factory.instance().createAuthInfo(username, null, newPassword, null, realm, domain);
LinphoneManager.getLc().addAuthInfo(authInfo); LinphoneManager.getLc().addAuthInfo(authInfo);
LinphoneManager.getLc().refreshRegisters(); LinphoneManager.getLc().refreshRegisters();
dialog.dismiss(); dialog.dismiss();
@ -1020,7 +1014,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
LinphoneManager.getInstance().newOutgoingCall(address); LinphoneManager.getInstance().newOutgoingCall(address);
} }
public void startIncallActivity(LinphoneCall currentCall) { public void startIncallActivity(Call currentCall) {
Intent intent = new Intent(this, CallActivity.class); Intent intent = new Intent(this, CallActivity.class);
startOrientationSensor(); startOrientationSensor();
startActivityForResult(intent, CALL_ACTIVITY); startActivityForResult(intent, CALL_ACTIVITY);
@ -1064,11 +1058,11 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
Log.d("Phone orientation changed to ", degrees); Log.d("Phone orientation changed to ", degrees);
int rotation = (360 - degrees) % 360; int rotation = (360 - degrees) % 360;
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) { if (lc != null) {
lc.setDeviceRotation(rotation); lc.setDeviceRotation(rotation);
LinphoneCall currentCall = lc.getCurrentCall(); Call currentCall = lc.getCurrentCall();
if (currentCall != null && currentCall.cameraEnabled() && currentCall.getCurrentParams().getVideoEnabled()) { if (currentCall != null && currentCall.cameraEnabled() && currentCall.getCurrentParams().videoEnabled()) {
lc.updateCall(currentCall, null); lc.updateCall(currentCall, null);
} }
} }
@ -1094,8 +1088,8 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
} }
if (LinphoneManager.isInstanciated() && LinphoneManager.getLc().getCallsNb() > 0) { if (LinphoneManager.isInstanciated() && LinphoneManager.getLc().getCallsNb() > 0) {
LinphoneCall call = LinphoneManager.getLc().getCalls()[0]; Call call = LinphoneManager.getLc().getCalls()[0];
if (call.getState() == LinphoneCall.State.IncomingReceived) { if (call.getState() == Call.State.IncomingReceived) {
startActivity(new Intent(LinphoneActivity.this, CallIncomingActivity.class)); startActivity(new Intent(LinphoneActivity.this, CallIncomingActivity.class));
} else { } else {
startIncallActivity(call); startIncallActivity(call);
@ -1111,6 +1105,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
{ {
Bundle extras = new Bundle(); Bundle extras = new Bundle();
extras.putSerializable("NewSipAdress", sipUri); extras.putSerializable("NewSipAdress", sipUri);
extras.putSerializable("NewDisplayName", displayName);
changeCurrentFragment(FragmentsAvailable.CONTACT_EDITOR, extras); changeCurrentFragment(FragmentsAvailable.CONTACT_EDITOR, extras);
} }
@ -1180,7 +1175,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
protected void onPause() { protected void onPause() {
getIntent().putExtra("PreviousActivity", 0); getIntent().putExtra("PreviousActivity", 0);
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) { if (lc != null) {
lc.removeListener(mListener); lc.removeListener(mListener);
} }
@ -1392,7 +1387,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
startService(new Intent(Intent.ACTION_MAIN).setClass(this, LinphoneService.class)); startService(new Intent(Intent.ACTION_MAIN).setClass(this, LinphoneService.class));
} }
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) { if (lc != null) {
lc.addListener(mListener); lc.addListener(mListener);
if (!LinphoneService.instance().displayServiceNotification()) { if (!LinphoneService.instance().displayServiceNotification()) {
@ -1425,12 +1420,12 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
if (getIntent().getIntExtra("PreviousActivity", 0) != CALL_ACTIVITY && !doNotGoToCallActivity) { if (getIntent().getIntExtra("PreviousActivity", 0) != CALL_ACTIVITY && !doNotGoToCallActivity) {
if (LinphoneManager.getLc().getCalls().length > 0) { if (LinphoneManager.getLc().getCalls().length > 0) {
LinphoneCall call = LinphoneManager.getLc().getCalls()[0]; Call call = LinphoneManager.getLc().getCalls()[0];
LinphoneCall.State callState = call.getState(); Call.State onCallStateChanged = call.getState();
if (callState == State.IncomingReceived) { if (onCallStateChanged == State.IncomingReceived) {
startActivity(new Intent(this, CallIncomingActivity.class)); startActivity(new Intent(this, CallIncomingActivity.class));
} else if (callState == State.OutgoingInit || callState == State.OutgoingProgress || callState == State.OutgoingRinging) { } else if (onCallStateChanged == State.OutgoingInit || onCallStateChanged == State.OutgoingProgress || onCallStateChanged == State.OutgoingRinging) {
startActivity(new Intent(this, CallOutgoingActivity.class)); startActivity(new Intent(this, CallOutgoingActivity.class));
} else { } else {
startIncallActivity(call); startIncallActivity(call);
@ -1495,7 +1490,6 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
((SettingsFragment) fragment).closePreferenceScreen(); ((SettingsFragment) fragment).closePreferenceScreen();
} }
} }
Bundle extras = intent.getExtras(); Bundle extras = intent.getExtras();
if (extras != null && extras.getBoolean("GoToChat", false)) { if (extras != null && extras.getBoolean("GoToChat", false)) {
LinphoneService.instance().removeMessageNotification(); LinphoneService.instance().removeMessageNotification();
@ -1511,9 +1505,18 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
displayInapp(); displayInapp();
} else if (extras != null && extras.getBoolean("Notification", false)) { } else if (extras != null && extras.getBoolean("Notification", false)) {
if (LinphoneManager.getLc().getCallsNb() > 0) { if (LinphoneManager.getLc().getCallsNb() > 0) {
LinphoneCall call = LinphoneManager.getLc().getCalls()[0]; Call call = LinphoneManager.getLc().getCalls()[0];
startIncallActivity(call); startIncallActivity(call);
} }
}else if (extras != null && extras.getBoolean("StartCall", false)) {
boolean extraBool = extras.getBoolean("StartCall", false);
if (CallActivity.isInstanciated()) {
CallActivity.instance().startIncomingCallActivity();
} else {
mAddressWaitingToBeCalled = extras.getString("NumberToCall");
goToDialerFragment();
//startActivity(new Intent(this, CallIncomingActivity.class));
}
} else { } else {
DialerFragment dialerFragment = DialerFragment.instance(); DialerFragment dialerFragment = DialerFragment.instance();
if (dialerFragment != null) { if (dialerFragment != null) {
@ -1534,8 +1537,8 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
} }
if (LinphoneManager.getLc().getCalls().length > 0) { if (LinphoneManager.getLc().getCalls().length > 0) {
// If a call is ringing, start incomingcallactivity // If a call is ringing, start incomingcallactivity
Collection<LinphoneCall.State> incoming = new ArrayList<LinphoneCall.State>(); Collection<Call.State> incoming = new ArrayList<Call.State>();
incoming.add(LinphoneCall.State.IncomingReceived); incoming.add(Call.State.IncomingReceived);
if (LinphoneUtils.getCallsInState(LinphoneManager.getLc(), incoming).size() > 0) { if (LinphoneUtils.getCallsInState(LinphoneManager.getLc(), incoming).size() > 0) {
if (CallActivity.isInstanciated()) { if (CallActivity.isInstanciated()) {
CallActivity.instance().startIncomingCallActivity(); CallActivity.instance().startIncomingCallActivity();
@ -1635,13 +1638,13 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
}); });
} }
private int getStatusIconResource(LinphoneCore.RegistrationState state) { private int getStatusIconResource(Core.RegistrationState state) {
try { try {
if (state == RegistrationState.RegistrationOk) { if (state == RegistrationState.Ok) {
return R.drawable.led_connected; return R.drawable.led_connected;
} else if (state == RegistrationState.RegistrationProgress) { } else if (state == RegistrationState.Progress) {
return R.drawable.led_inprogress; return R.drawable.led_inprogress;
} else if (state == RegistrationState.RegistrationFailed) { } else if (state == RegistrationState.Failed) {
return R.drawable.led_error; return R.drawable.led_error;
} else { } else {
return R.drawable.led_disconnected; return R.drawable.led_disconnected;
@ -1660,7 +1663,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
TextView displayName = (TextView) defaultAccount.findViewById(R.id.main_account_display_name); TextView displayName = (TextView) defaultAccount.findViewById(R.id.main_account_display_name);
LinphoneProxyConfig proxy = LinphoneManager.getLc().getDefaultProxyConfig(); ProxyConfig proxy = LinphoneManager.getLc().getDefaultProxyConfig();
if(proxy == null) { if(proxy == null) {
displayName.setText(getString(R.string.no_account)); displayName.setText(getString(R.string.no_account));
status.setVisibility(View.GONE); status.setVisibility(View.GONE);
@ -1670,8 +1673,8 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
defaultAccount.setOnClickListener(null); defaultAccount.setOnClickListener(null);
} else { } else {
address.setText(proxy.getAddress().asStringUriOnly()); address.setText(proxy.getIdentityAddress().asStringUriOnly());
displayName.setText(LinphoneUtils.getAddressDisplayName(proxy.getAddress())); displayName.setText(LinphoneUtils.getAddressDisplayName(proxy.getIdentityAddress()));
status.setImageResource(getStatusIconResource(proxy.getState())); status.setImageResource(getStatusIconResource(proxy.getState()));
status.setVisibility(View.VISIBLE); status.setVisibility(View.VISIBLE);
@ -1686,7 +1689,8 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
} }
public void refreshAccounts(){ public void refreshAccounts(){
if (LinphoneManager.getLc().getProxyConfigList().length > 1) { if (LinphoneManager.getLc().getProxyConfigList() != null &&
LinphoneManager.getLc().getProxyConfigList().length > 1) {
accountsList.setVisibility(View.VISIBLE); accountsList.setVisibility(View.VISIBLE);
accountsList.setAdapter(new AccountsListAdapter()); accountsList.setAdapter(new AccountsListAdapter());
accountsList.setOnItemClickListener(new AdapterView.OnItemClickListener() { accountsList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@ -1711,16 +1715,16 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
} }
class AccountsListAdapter extends BaseAdapter { class AccountsListAdapter extends BaseAdapter {
List<LinphoneProxyConfig> proxy_list; List<ProxyConfig> proxy_list;
AccountsListAdapter() { AccountsListAdapter() {
proxy_list = new ArrayList<LinphoneProxyConfig>(); proxy_list = new ArrayList<ProxyConfig>();
refresh(); refresh();
} }
public void refresh(){ public void refresh(){
proxy_list = new ArrayList<LinphoneProxyConfig>(); proxy_list = new ArrayList<ProxyConfig>();
for(LinphoneProxyConfig proxyConfig : LinphoneManager.getLc().getProxyConfigList()){ for(ProxyConfig proxyConfig : LinphoneManager.getLc().getProxyConfigList()){
if(proxyConfig != LinphoneManager.getLc().getDefaultProxyConfig()){ if(proxyConfig != LinphoneManager.getLc().getDefaultProxyConfig()){
proxy_list.add(proxyConfig); proxy_list.add(proxyConfig);
} }
@ -1745,7 +1749,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
public View getView(final int position, View convertView, ViewGroup parent) { public View getView(final int position, View convertView, ViewGroup parent) {
View view = null; View view = null;
LinphoneProxyConfig lpc = (LinphoneProxyConfig) getItem(position); ProxyConfig lpc = (ProxyConfig) getItem(position);
if (convertView != null) { if (convertView != null) {
view = convertView; view = convertView;
} else { } else {
@ -1754,7 +1758,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
ImageView status = (ImageView) view.findViewById(R.id.account_status); ImageView status = (ImageView) view.findViewById(R.id.account_status);
TextView address = (TextView) view.findViewById(R.id.account_address); TextView address = (TextView) view.findViewById(R.id.account_address);
String sipAddress = lpc.getAddress().asStringUriOnly(); String sipAddress = lpc.getIdentityAddress().asStringUriOnly();
address.setText(sipAddress); address.setText(sipAddress);

View file

@ -1,6 +1,8 @@
package org.linphone;
/* /*
LinphoneContact.java LinphoneContact.java
Copyright (C) 2016 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -16,7 +18,6 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
package org.linphone;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
@ -24,12 +25,12 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import org.linphone.core.LinphoneAddress; import org.linphone.core.Address;
import org.linphone.core.LinphoneCore; import org.linphone.core.Core;
import org.linphone.core.LinphoneCoreException; import org.linphone.core.CoreException;
import org.linphone.core.LinphoneFriend; import org.linphone.core.Friend;
import org.linphone.core.LinphoneFriendImpl; import org.linphone.core.Friend.SubscribePolicy;
import org.linphone.core.LinphoneFriend.SubscribePolicy; import org.linphone.core.FriendList;
import org.linphone.core.PresenceBasicStatus; import org.linphone.core.PresenceBasicStatus;
import org.linphone.core.PresenceModel; import org.linphone.core.PresenceModel;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
@ -44,12 +45,9 @@ import android.provider.ContactsContract;
import android.provider.ContactsContract.CommonDataKinds; import android.provider.ContactsContract.CommonDataKinds;
public class LinphoneContact implements Serializable, Comparable<LinphoneContact> { public class LinphoneContact implements Serializable, Comparable<LinphoneContact> {
/**
*
*/
private static final long serialVersionUID = 9015568163905205244L; private static final long serialVersionUID = 9015568163905205244L;
private transient LinphoneFriend friend; private transient Friend friend;
private String fullName, firstName, lastName, androidId, androidRawId, androidTagId, organization; private String fullName, firstName, lastName, androidId, androidRawId, androidTagId, organization;
private transient Uri photoUri, thumbnailUri; private transient Uri photoUri, thumbnailUri;
private List<LinphoneNumberOrAddress> addresses; private List<LinphoneNumberOrAddress> addresses;
@ -260,7 +258,7 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
} }
} }
if (isLinphoneFriend()) { if (isFriend()) {
if (noa.isSIPAddress()) { if (noa.isSIPAddress()) {
if (!noa.getOldValue().startsWith("sip:")) { if (!noa.getOldValue().startsWith("sip:")) {
noa.setOldValue("sip:" + noa.getOldValue()); noa.setOldValue("sip:" + noa.getOldValue());
@ -366,7 +364,7 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
} }
} }
} }
if (isLinphoneFriend()) { if (isFriend()) {
if (noa.isSIPAddress()) { if (noa.isSIPAddress()) {
if (!noa.getValue().startsWith("sip:")) { if (!noa.getValue().startsWith("sip:")) {
noa.setValue("sip:" + noa.getValue()); noa.setValue("sip:" + noa.getValue());
@ -401,35 +399,35 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
return androidId; return androidId;
} }
public LinphoneFriend getLinphoneFriend() { public Friend getFriend() {
return friend; return friend;
} }
private void createOrUpdateFriend() { private void createOrUpdateFriend() {
boolean created = false; boolean created = false;
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (!isLinphoneFriend()) { if (!isFriend()) {
friend = LinphoneManager.getLc().createFriend(); friend = LinphoneManager.getLc().createFriend();
friend.enableSubscribes(false); friend.enableSubscribes(false);
friend.setIncSubscribePolicy(SubscribePolicy.SPDeny); friend.setIncSubscribePolicy(SubscribePolicy.SPDeny);
if (isAndroidContact()) { if (isAndroidContact()) {
friend.setRefKey(getAndroidId()); friend.setRefKey(getAndroidId());
} }
((LinphoneFriendImpl)friend).setUserData(this); friend.setUserData(this);
created = true; created = true;
} }
if (isLinphoneFriend()) { if (isFriend()) {
friend.edit(); friend.edit();
friend.setName(fullName); friend.setName(fullName);
friend.setFamilyName(lastName); friend.getVcard().setFamilyName(lastName);
friend.setGivenName(firstName); friend.getVcard().setGivenName(firstName);
if (organization != null) { if (organization != null) {
friend.setOrganization(organization); friend.getVcard().setOrganization(organization);
} }
if (!created) { if (!created) {
for (LinphoneAddress address : friend.getAddresses()) { for (Address address : friend.getAddresses()) {
friend.removeAddress(address); friend.removeAddress(address);
} }
for (String phone : friend.getPhoneNumbers()) { for (String phone : friend.getPhoneNumbers()) {
@ -438,14 +436,10 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
} }
for (LinphoneNumberOrAddress noa : addresses) { for (LinphoneNumberOrAddress noa : addresses) {
if (noa.isSIPAddress()) { if (noa.isSIPAddress()) {
try { Address addr = lc.interpretUrl(noa.getValue());
LinphoneAddress addr = lc.interpretUrl(noa.getValue());
if (addr != null) { if (addr != null) {
friend.addAddress(addr); friend.addAddress(addr);
} }
} catch (LinphoneCoreException e) {
Log.e(e);
}
} else { } else {
friend.addPhoneNumber(noa.getValue()); friend.addPhoneNumber(noa.getValue());
} }
@ -453,15 +447,11 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
friend.done(); friend.done();
} }
if (created) { if (created) {
try {
lc.addFriend(friend); lc.addFriend(friend);
} catch (LinphoneCoreException e) {
Log.e(e);
}
} }
if (!ContactsManager.getInstance().hasContactsAccess()) { if (!ContactsManager.getInstance().hasContactsAccess()) {
// This refresh is only needed if app has no contacts permission to refresh the list of LinphoneFriends. // This refresh is only needed if app has no contacts permission to refresh the list of Friends.
// Otherwise contacts will be refreshed due to changes in native contact and the handler in ContactsManager // Otherwise contacts will be refreshed due to changes in native contact and the handler in ContactsManager
ContactsManager.getInstance().fetchContactsAsync(); ContactsManager.getInstance().fetchContactsAsync();
} }
@ -491,14 +481,17 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
save(); save();
ContactsManager.getInstance().delete(getAndroidId()); ContactsManager.getInstance().delete(getAndroidId());
} }
if (isLinphoneFriend()) { if (isFriend()) {
deleteFriend(); deleteFriend();
} }
} }
public void deleteFriend() { public void deleteFriend() {
if (friend != null) { Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
LinphoneManager.getLcIfManagerNotDestroyedOrNull().removeFriend(friend); if (friend != null && lc != null) {
for (FriendList list : lc.getFriendsLists()) {
list.removeFriend(friend);
}
} }
} }
@ -516,18 +509,18 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
for (LinphoneNumberOrAddress noa : getAddressesAndNumbersForAndroidContact()) { for (LinphoneNumberOrAddress noa : getAddressesAndNumbersForAndroidContact()) {
addNumberOrAddress(noa); addNumberOrAddress(noa);
} }
} else if (isLinphoneFriend()) { } else if (isFriend()) {
fullName = friend.getName(); fullName = friend.getName();
lastName = friend.getFamilyName(); lastName = friend.getVcard().getFamilyName();
firstName = friend.getGivenName(); firstName = friend.getVcard().getGivenName();
thumbnailUri = null; thumbnailUri = null;
photoUri = null; photoUri = null;
hasSipAddress = friend.getAddress() != null; hasSipAddress = friend.getAddress() != null;
organization = friend.getOrganization(); organization = friend.getVcard().getOrganization();
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null && lc.isVCardSupported()) { if (lc != null && lc.vcardSupported()) {
for (LinphoneAddress addr : friend.getAddresses()) { for (Address addr : friend.getAddresses()) {
if (addr != null) { if (addr != null) {
addNumberOrAddress(new LinphoneNumberOrAddress(addr.asStringUriOnly(), true)); addNumberOrAddress(new LinphoneNumberOrAddress(addr.asStringUriOnly(), true));
} }
@ -538,13 +531,13 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
} }
} }
} else { } else {
LinphoneAddress addr = friend.getAddress(); Address addr = friend.getAddress();
addNumberOrAddress(new LinphoneNumberOrAddress(addr.asStringUriOnly(), true)); addNumberOrAddress(new LinphoneNumberOrAddress(addr.asStringUriOnly(), true));
} }
} }
} }
public void createOrUpdateLinphoneFriendFromNativeContact() { public void createOrUpdateFriendFromNativeContact() {
if (isAndroidContact()) { if (isAndroidContact()) {
createOrUpdateFriend(); createOrUpdateFriend();
} }
@ -554,14 +547,14 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
return androidId != null; return androidId != null;
} }
public boolean isLinphoneFriend() { public boolean isFriend() {
return friend != null; return friend != null;
} }
public boolean isInLinphoneFriendList() { public boolean isInFriendList() {
if (friend == null) return false; if (friend == null) return false;
for (LinphoneNumberOrAddress noa : addresses) { for (LinphoneNumberOrAddress noa : addresses) {
PresenceModel pm = friend.getPresenceModelForUri(noa.getValue()); PresenceModel pm = friend.getPresenceModelForUriOrTel(noa.getValue());
if (pm != null && pm.getBasicStatus().equals(PresenceBasicStatus.Open)) { if (pm != null && pm.getBasicStatus().equals(PresenceBasicStatus.Open)) {
return true; return true;
} }
@ -569,16 +562,16 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
return false; return false;
} }
public String getPresenceModelForUri(String uri) { public String getPresenceModelForUriOrTel(String uri) {
if (friend != null && friend.getPresenceModelForUri(uri) != null) { if (friend != null && friend.getPresenceModelForUriOrTel(uri) != null) {
return friend.getPresenceModelForUri(uri).getContact(); return friend.getPresenceModelForUriOrTel(uri).getContact();
} }
return null; return null;
} }
public void setFriend(LinphoneFriend f) { public void setFriend(Friend f) {
friend = f; friend = f;
((LinphoneFriendImpl)friend).setUserData(this); friend.setUserData(this);
} }
public void getAndroidIds() { public void getAndroidIds() {
@ -592,7 +585,7 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
if (ContactsManager.getInstance().hasContactsAccess()) { if (ContactsManager.getInstance().hasContactsAccess()) {
return createAndroidContact(); return createAndroidContact();
} }
return createLinphoneFriend(); return createFriend();
} }
private Uri getContactThumbnailPictureUri() { private Uri getContactThumbnailPictureUri() {
@ -703,14 +696,14 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
return contact; return contact;
} }
private static LinphoneContact createLinphoneFriend() { private static LinphoneContact createFriend() {
LinphoneContact contact = new LinphoneContact(); LinphoneContact contact = new LinphoneContact();
LinphoneFriend friend = LinphoneManager.getLc().createFriend(); Friend friend = LinphoneManager.getLc().createFriend();
// Disable subscribes for now // Disable subscribes for now
friend.enableSubscribes(false); friend.enableSubscribes(false);
friend.setIncSubscribePolicy(SubscribePolicy.SPDeny); friend.setIncSubscribePolicy(SubscribePolicy.SPDeny);
contact.friend = friend; contact.friend = friend;
((LinphoneFriendImpl)friend).setUserData(contact); friend.setUserData(contact);
return contact; return contact;
} }

View file

@ -1,6 +1,8 @@
package org.linphone;
/* /*
LinphoneCoreException.java CoreException.java
Copyright (C) 2010 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -16,7 +18,6 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
package org.linphone;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class LinphoneException extends Exception { public class LinphoneException extends Exception {

View file

@ -1,5 +1,24 @@
package org.linphone; package org.linphone;
/*
LinphoneGenericActivity.java
Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import android.app.Activity; import android.app.Activity;
import android.os.Bundle; import android.os.Bundle;

View file

@ -1,6 +1,8 @@
package org.linphone;
/* /*
LinphoneLauncherActivity.java LinphoneLauncherActivity.java
Copyright (C) 2011 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -16,7 +18,6 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
package org.linphone;
import android.app.Activity; import android.app.Activity;
import android.content.Intent; import android.content.Intent;
@ -28,19 +29,16 @@ import android.os.Handler;
import org.linphone.assistant.RemoteProvisioningActivity; import org.linphone.assistant.RemoteProvisioningActivity;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
import org.linphone.mediastream.Version; import org.linphone.mediastream.Version;
import org.linphone.tutorials.TutorialLauncherActivity;
import static android.content.Intent.ACTION_MAIN; import static android.content.Intent.ACTION_MAIN;
/** /**
*
* Launch Linphone main activity when Service is ready. * Launch Linphone main activity when Service is ready.
*
* @author Guillaume Beraudo
*
*/ */
public class LinphoneLauncherActivity extends Activity { public class LinphoneLauncherActivity extends Activity {
private final String ACTION_CALL_LINPHONE = "org.linphone.intent.action.CallLaunched";
private Handler mHandler; private Handler mHandler;
private ServiceWaitThread mServiceThread; private ServiceWaitThread mServiceThread;
private String addressToCall; private String addressToCall;
@ -100,9 +98,9 @@ public class LinphoneLauncherActivity extends Activity {
protected void onServiceReady() { protected void onServiceReady() {
final Class<? extends Activity> classToStart; final Class<? extends Activity> classToStart;
if (getResources().getBoolean(R.bool.show_tutorials_instead_of_app)) { /*if (getResources().getBoolean(R.bool.show_tutorials_instead_of_app)) {
classToStart = TutorialLauncherActivity.class; classToStart = TutorialLauncherActivity.class;
} else if (getResources().getBoolean(R.bool.display_sms_remote_provisioning_activity) && LinphonePreferences.instance().isFirstRemoteProvisioning()) { } else */if (getResources().getBoolean(R.bool.display_sms_remote_provisioning_activity) && LinphonePreferences.instance().isFirstRemoteProvisioning()) {
classToStart = RemoteProvisioningActivity.class; classToStart = RemoteProvisioningActivity.class;
} else { } else {
classToStart = LinphoneActivity.class; classToStart = LinphoneActivity.class;
@ -148,6 +146,13 @@ public class LinphoneLauncherActivity extends Activity {
} }
newIntent.putExtra("fileShared", stringUriFileShared); newIntent.putExtra("fileShared", stringUriFileShared);
} }
}else if( ACTION_CALL_LINPHONE.equals(action) && (intent.getStringExtra("NumberToCall") != null)) {
String numberToCall = intent.getStringExtra("NumberToCall");
if (CallActivity.isInstanciated()) {
CallActivity.instance().startIncomingCallActivity();
} else {
LinphoneManager.getInstance().newOutgoingCall(numberToCall, null);
}
} }
} }
if (uriToResolve != null) { if (uriToResolve != null) {

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,8 @@
package org.linphone;
/* /*
LinphoneNumberOrAddress.java LinphoneNumberOrAddress.java
Copyright (C) 2016 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -17,14 +19,9 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
package org.linphone;
import java.io.Serializable; import java.io.Serializable;
public class LinphoneNumberOrAddress implements Serializable, Comparable<LinphoneNumberOrAddress> { public class LinphoneNumberOrAddress implements Serializable, Comparable<LinphoneNumberOrAddress> {
/**
*
*/
private static final long serialVersionUID = -2301689469730072896L; private static final long serialVersionUID = -2301689469730072896L;
private boolean isSIPAddress; private boolean isSIPAddress;

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,8 @@
package org.linphone;
/* /*
LinphoneService.java LinphoneService.java
Copyright (C) 2010 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -16,24 +18,24 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
package org.linphone;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.ArrayList; import java.util.ArrayList;
import org.linphone.compatibility.Compatibility; import org.linphone.compatibility.Compatibility;
import org.linphone.core.LinphoneAddress; import org.linphone.core.Address;
import org.linphone.core.LinphoneCall; import org.linphone.core.Call;
import org.linphone.core.LinphoneCall.State; import org.linphone.core.Call.State;
import org.linphone.core.LinphoneCallLog.CallStatus; import org.linphone.core.CallLog.CallStatus;
import org.linphone.core.LinphoneCore; import org.linphone.core.Core;
import org.linphone.core.LinphoneCore.GlobalState; import org.linphone.core.Core.GlobalState;
import org.linphone.core.LinphoneCore.RegistrationState; import org.linphone.core.Core.RegistrationState;
import org.linphone.core.LinphoneCoreException; import org.linphone.core.CoreException;
import org.linphone.core.LinphoneCoreFactory; import org.linphone.core.Factory;
import org.linphone.core.LinphoneCoreListenerBase; import org.linphone.core.CoreListenerStub;
import org.linphone.core.LinphoneProxyConfig; import org.linphone.core.LogCollectionState;
import org.linphone.core.ProxyConfig;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
import org.linphone.mediastream.Version; import org.linphone.mediastream.Version;
import org.linphone.ui.LinphoneOverlay; import org.linphone.ui.LinphoneOverlay;
@ -63,7 +65,6 @@ import android.provider.MediaStore;
import android.view.WindowManager; import android.view.WindowManager;
/** /**
*
* Linphone service, reacting to Incoming calls, ...<br /> * Linphone service, reacting to Incoming calls, ...<br />
* *
* Roles include:<ul> * Roles include:<ul>
@ -71,10 +72,6 @@ import android.view.WindowManager;
* <li>Starting C libLinphone through LinphoneManager</li> * <li>Starting C libLinphone through LinphoneManager</li>
* <li>Reacting to LinphoneManager state changes</li> * <li>Reacting to LinphoneManager state changes</li>
* <li>Delegating GUI state change actions to GUI listener</li> * <li>Delegating GUI state change actions to GUI listener</li>
*
*
* @author Guillaume Beraudo
*
*/ */
public final class LinphoneService extends Service { public final class LinphoneService extends Service {
/* Listener needs to be implemented in the Service as it calls /* Listener needs to be implemented in the Service as it calls
@ -123,7 +120,7 @@ public final class LinphoneService extends Service {
private PendingIntent mNotifContentIntent; private PendingIntent mNotifContentIntent;
private String mNotificationTitle; private String mNotificationTitle;
private boolean mDisableRegistrationStatus; private boolean mDisableRegistrationStatus;
private LinphoneCoreListenerBase mListener; private CoreListenerStub mListener;
public static int notifcationsPriority = (Version.sdkAboveOrEqual(Version.API16_JELLY_BEAN_41) ? Notification.PRIORITY_MIN : 0); public static int notifcationsPriority = (Version.sdkAboveOrEqual(Version.API16_JELLY_BEAN_41) ? Notification.PRIORITY_MIN : 0);
private WindowManager mWindowManager; private WindowManager mWindowManager;
private LinphoneOverlay mOverlay; private LinphoneOverlay mOverlay;
@ -272,11 +269,11 @@ public final class LinphoneService extends Service {
public void showServiceNotification() { public void showServiceNotification() {
startForegroundCompat(NOTIF_ID, mNotif); startForegroundCompat(NOTIF_ID, mNotif);
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc == null) return; if (lc == null) return;
LinphoneProxyConfig lpc = lc.getDefaultProxyConfig(); ProxyConfig lpc = lc.getDefaultProxyConfig();
if (lpc != null) { if (lpc != null) {
if (lpc.isRegistered()) { if (lpc.getState() == RegistrationState.Ok) {
sendNotification(IC_LEVEL_ORANGE, R.string.notification_registered); sendNotification(IC_LEVEL_ORANGE, R.string.notification_registered);
} else { } else {
sendNotification(IC_LEVEL_ORANGE, R.string.notification_register_failure); sendNotification(IC_LEVEL_ORANGE, R.string.notification_register_failure);
@ -301,10 +298,10 @@ public final class LinphoneService extends Service {
// Needed in order for the two next calls to succeed, libraries must have been loaded first // Needed in order for the two next calls to succeed, libraries must have been loaded first
LinphonePreferences.instance().setContext(getBaseContext()); LinphonePreferences.instance().setContext(getBaseContext());
LinphoneCoreFactory.instance().setLogCollectionPath(getFilesDir().getAbsolutePath()); Factory.instance().setLogCollectionPath(getFilesDir().getAbsolutePath());
boolean isDebugEnabled = LinphonePreferences.instance().isDebugEnabled(); boolean isDebugEnabled = LinphonePreferences.instance().isDebugEnabled();
LinphoneCoreFactory.instance().enableLogCollection(isDebugEnabled); Factory.instance().enableLogCollection(LogCollectionState.Enabled);
LinphoneCoreFactory.instance().setDebugMode(isDebugEnabled, getString(R.string.app_name)); Factory.instance().setDebugMode(isDebugEnabled, getString(R.string.app_name));
// Dump some debugging information to the logs // Dump some debugging information to the logs
Log.i(START_LINPHONE_LOGS); Log.i(START_LINPHONE_LOGS);
@ -340,19 +337,20 @@ public final class LinphoneService extends Service {
Log.e(e); Log.e(e);
} }
LinphoneManager.getLc().addListener(mListener = new LinphoneCoreListenerBase() { LinphoneManager.getLc().addListener(mListener = new CoreListenerStub() {
@Override @Override
public void callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State state, String message) { public void onCallStateChanged(Core lc, Call call, Call.State state, String message) {
if (instance == null) { if (instance == null) {
Log.i("Service not ready, discarding call state change to ",state.toString()); Log.i("Service not ready, discarding call state change to ",state.toString());
return; return;
} }
if (state == LinphoneCall.State.IncomingReceived) { if (state == Call.State.IncomingReceived) {
if(! LinphoneManager.getInstance().getCallGsmON())
onIncomingReceived(); onIncomingReceived();
} }
if (state == State.CallEnd || state == State.CallReleased || state == State.Error) { if (state == State.End || state == State.Released || state == State.Error) {
if (LinphoneManager.isInstanciated() && LinphoneManager.getLc() != null && LinphoneManager.getLc().getCallsNb() == 0) { if (LinphoneManager.isInstanciated() && LinphoneManager.getLc() != null && LinphoneManager.getLc().getCallsNb() == 0) {
if (LinphoneActivity.isInstanciated() && LinphoneActivity.instance().getStatusFragment() != null) { if (LinphoneActivity.isInstanciated() && LinphoneActivity.instance().getStatusFragment() != null) {
removeSasNotification(); removeSasNotification();
@ -362,13 +360,13 @@ public final class LinphoneService extends Service {
destroyOverlay(); destroyOverlay();
} }
if (state == State.CallEnd && call.getCallLog().getStatus() == CallStatus.Missed) { if (state == State.End && call.getCallLog().getStatus() == CallStatus.Missed) {
int missedCallCount = LinphoneManager.getLcIfManagerNotDestroyedOrNull().getMissedCallsCount(); int missedCallCount = LinphoneManager.getLcIfManagerNotDestroyedOrNull().getMissedCallsCount();
String body; String body;
if (missedCallCount > 1) { if (missedCallCount > 1) {
body = getString(R.string.missed_calls_notif_body).replace("%i", String.valueOf(missedCallCount)); body = getString(R.string.missed_calls_notif_body).replace("%i", String.valueOf(missedCallCount));
} else { } else {
LinphoneAddress address = call.getRemoteAddress(); Address address = call.getRemoteAddress();
LinphoneContact c = ContactsManager.getInstance().findContactFromAddress(address); LinphoneContact c = ContactsManager.getInstance().findContactFromAddress(address);
if (c != null) { if (c != null) {
body = c.getFullName(); body = c.getFullName();
@ -399,28 +397,28 @@ public final class LinphoneService extends Service {
} }
@Override @Override
public void globalState(LinphoneCore lc,LinphoneCore.GlobalState state, String message) { public void onGlobalStateChanged(Core lc,Core.GlobalState state, String message) {
if (state == GlobalState.GlobalOn && displayServiceNotification()) { if (state == Core.GlobalState.On && displayServiceNotification()) {
sendNotification(IC_LEVEL_ORANGE, R.string.notification_started); sendNotification(IC_LEVEL_ORANGE, R.string.notification_started);
} }
} }
@Override @Override
public void registrationState(LinphoneCore lc, LinphoneProxyConfig cfg, LinphoneCore.RegistrationState state, String smessage) { public void onRegistrationStateChanged(Core lc, ProxyConfig cfg, Core.RegistrationState state, String smessage) {
// if (instance == null) { // if (instance == null) {
// Log.i("Service not ready, discarding registration state change to ",state.toString()); // Log.i("Service not ready, discarding registration state change to ",state.toString());
// return; // return;
// } // }
if (!mDisableRegistrationStatus) { if (!mDisableRegistrationStatus) {
if (displayServiceNotification() && state == RegistrationState.RegistrationOk && LinphoneManager.getLc().getDefaultProxyConfig() != null && LinphoneManager.getLc().getDefaultProxyConfig().isRegistered()) { if (displayServiceNotification() && state == RegistrationState.Ok && LinphoneManager.getLc().getDefaultProxyConfig() != null && LinphoneManager.getLc().getDefaultProxyConfig().getState() == RegistrationState.Ok) {
sendNotification(IC_LEVEL_ORANGE, R.string.notification_registered); sendNotification(IC_LEVEL_ORANGE, R.string.notification_registered);
} }
if (displayServiceNotification() && (state == RegistrationState.RegistrationFailed || state == RegistrationState.RegistrationCleared) && (LinphoneManager.getLc().getDefaultProxyConfig() == null || !LinphoneManager.getLc().getDefaultProxyConfig().isRegistered())) { if (displayServiceNotification() && (state == RegistrationState.Failed || state == RegistrationState.Cleared) && (LinphoneManager.getLc().getDefaultProxyConfig() == null || !(LinphoneManager.getLc().getDefaultProxyConfig().getState() == RegistrationState.Ok))) {
sendNotification(IC_LEVEL_ORANGE, R.string.notification_register_failure); sendNotification(IC_LEVEL_ORANGE, R.string.notification_register_failure);
} }
if (displayServiceNotification() && state == RegistrationState.RegistrationNone) { if (displayServiceNotification() && state == RegistrationState.None) {
sendNotification(IC_LEVEL_ORANGE, R.string.notification_started); sendNotification(IC_LEVEL_ORANGE, R.string.notification_started);
} }
} }
@ -465,8 +463,8 @@ public final class LinphoneService extends Service {
public void createOverlay() { public void createOverlay() {
if (mOverlay != null) destroyOverlay(); if (mOverlay != null) destroyOverlay();
LinphoneCall call = LinphoneManager.getLc().getCurrentCall(); Call call = LinphoneManager.getLc().getCurrentCall();
if (call == null || !call.getCurrentParams().getVideoEnabled()) return; if (call == null || !call.getCurrentParams().videoEnabled()) return;
mOverlay = new LinphoneOverlay(this); mOverlay = new LinphoneOverlay(this);
WindowManager.LayoutParams params = mOverlay.getWindowManagerLayoutParams(); WindowManager.LayoutParams params = mOverlay.getWindowManagerLayoutParams();
@ -520,11 +518,11 @@ public final class LinphoneService extends Service {
return; return;
} }
LinphoneCall call = LinphoneManager.getLc().getCalls()[0]; Call call = LinphoneManager.getLc().getCalls()[0];
String userName = call.getRemoteAddress().getUserName(); String userName = call.getRemoteAddress().getUsername();
String domain = call.getRemoteAddress().getDomain(); String domain = call.getRemoteAddress().getDomain();
String displayName = call.getRemoteAddress().getDisplayName(); String displayName = call.getRemoteAddress().getDisplayName();
LinphoneAddress address = LinphoneCoreFactory.instance().createLinphoneAddress(userName,domain,null); Address address = Factory.instance().createAddress(userName + "@" + domain);
address.setDisplayName(displayName); address.setDisplayName(displayName);
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(address); LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(address);
@ -535,7 +533,7 @@ public final class LinphoneService extends Service {
} catch (Exception e) { } catch (Exception e) {
bm = BitmapFactory.decodeResource(getResources(), R.drawable.avatar); bm = BitmapFactory.decodeResource(getResources(), R.drawable.avatar);
} }
String name = address.getDisplayName() == null ? address.getUserName() : address.getDisplayName(); String name = address.getDisplayName() == null ? address.getUsername() : address.getDisplayName();
Intent notifIntent = new Intent(this, incomingReceivedActivity); Intent notifIntent = new Intent(this, incomingReceivedActivity);
notifIntent.putExtra("Notification", true); notifIntent.putExtra("Notification", true);
mNotifContentIntent = PendingIntent.getActivity(this, 0, notifIntent, PendingIntent.FLAG_UPDATE_CURRENT); mNotifContentIntent = PendingIntent.getActivity(this, 0, notifIntent, PendingIntent.FLAG_UPDATE_CURRENT);
@ -548,10 +546,10 @@ public final class LinphoneService extends Service {
} }
} }
public void refreshIncallIcon(LinphoneCall currentCall) { public void refreshIncallIcon(Call currentCall) {
LinphoneCore lc = LinphoneManager.getLc(); Core lc = LinphoneManager.getLc();
if (currentCall != null) { if (currentCall != null) {
if (currentCall.getCurrentParams().getVideoEnabled() && currentCall.cameraEnabled()) { if (currentCall.getCurrentParams().videoEnabled() && currentCall.cameraEnabled()) {
// checking first current params is mandatory // checking first current params is mandatory
setIncallIcon(IncallIconState.VIDEO); setIncallIcon(IncallIconState.VIDEO);
} else { } else {
@ -559,7 +557,7 @@ public final class LinphoneService extends Service {
} }
} else if (lc.getCallsNb() == 0) { } else if (lc.getCallsNb() == 0) {
setIncallIcon(IncallIconState.IDLE); setIncallIcon(IncallIconState.IDLE);
} else if (lc.isInConference()) { } else if (lc.getConference() != null) {
setIncallIcon(IncallIconState.INCALL); setIncallIcon(IncallIconState.INCALL);
} else { } else {
setIncallIcon(IncallIconState.PAUSE); setIncallIcon(IncallIconState.PAUSE);
@ -593,7 +591,7 @@ public final class LinphoneService extends Service {
resetIntentLaunchedOnNotificationClick(); resetIntentLaunchedOnNotificationClick();
} }
public void displayMessageNotification(String to, String fromSipUri, String fromName, String message) { public void removedNotification(String to, String fromSipUri, String fromName, String message) {
Intent notifIntent = new Intent(this, LinphoneActivity.class); Intent notifIntent = new Intent(this, LinphoneActivity.class);
notifIntent.putExtra("GoToChat", true); notifIntent.putExtra("GoToChat", true);
notifIntent.putExtra("ChatContactSipUri", fromSipUri); notifIntent.putExtra("ChatContactSipUri", fromSipUri);
@ -611,13 +609,9 @@ public final class LinphoneService extends Service {
} }
Uri pictureUri = null; Uri pictureUri = null;
try { LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(Factory.instance().createAddress(fromSipUri));
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(LinphoneCoreFactory.instance().createLinphoneAddress(fromSipUri));
if (contact != null) if (contact != null)
pictureUri = contact.getThumbnailUri(); pictureUri = contact.getThumbnailUri();
} catch (LinphoneCoreException e1) {
Log.e("Cannot parse from address ", e1);
}
Bitmap bm = null; Bitmap bm = null;
if (pictureUri != null) { if (pictureUri != null) {
@ -767,8 +761,8 @@ public final class LinphoneService extends Service {
String text = getString(textId); String text = getString(textId);
if (text.contains("%s") && LinphoneManager.getLc() != null) { if (text.contains("%s") && LinphoneManager.getLc() != null) {
// Test for null lc is to avoid a NPE when Android mess up badly with the String resources. // Test for null lc is to avoid a NPE when Android mess up badly with the String resources.
LinphoneProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig(); ProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig();
String id = lpc != null ? lpc.getIdentity() : ""; String id = lpc != null ? lpc.getIdentityAddress().asString() : "";
text = String.format(text, id); text = String.format(text, id);
} }
@ -808,7 +802,7 @@ public final class LinphoneService extends Service {
// If push is enabled, don't unregister account, otherwise do unregister // If push is enabled, don't unregister account, otherwise do unregister
if (LinphonePreferences.instance().isPushNotificationEnabled()) { if (LinphonePreferences.instance().isPushNotificationEnabled()) {
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) lc.setNetworkReachable(false); if (lc != null) lc.setNetworkReachable(false);
} }
stopSelf(); stopSelf();
@ -825,7 +819,7 @@ public final class LinphoneService extends Service {
} }
destroyOverlay(); destroyOverlay();
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) { if (lc != null) {
lc.removeListener(mListener); lc.removeListener(mListener);
} }
@ -880,7 +874,7 @@ public final class LinphoneService extends Service {
public void tryingNewOutgoingCallButWrongDestinationAddress() { public void tryingNewOutgoingCallButWrongDestinationAddress() {
} }
public void onCallEncryptionChanged(final LinphoneCall call, final boolean encrypted, public void onCallEncryptionChanged(final Call call, final boolean encrypted,
final String authenticationToken) { final String authenticationToken) {
} }
} }

View file

@ -1,6 +1,8 @@
package org.linphone;
/* /*
SoftVolume.java SoftVolume.java
Copyright (C) 2011 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -16,7 +18,6 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
package org.linphone;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
@ -48,17 +49,18 @@ import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
import org.linphone.core.DialPlan; import org.linphone.core.DialPlan;
import org.linphone.core.LinphoneAccountCreator; import org.linphone.core.AccountCreator;
import org.linphone.core.LinphoneAddress; import org.linphone.core.Address;
import org.linphone.core.LinphoneCall; import org.linphone.core.Call;
import org.linphone.core.LinphoneCall.State; import org.linphone.core.Call.State;
import org.linphone.core.LinphoneChatMessage; import org.linphone.core.ChatMessage;
import org.linphone.core.LinphoneCore; import org.linphone.core.Core;
import org.linphone.core.LinphoneCoreException; import org.linphone.core.CoreException;
import org.linphone.core.LinphoneCoreFactory; import org.linphone.core.Factory;
import org.linphone.core.LinphoneProxyConfig; import org.linphone.core.ProxyConfig;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
import org.linphone.mediastream.video.capture.hwconf.Hacks; import org.linphone.mediastream.video.capture.hwconf.Hacks;
@ -92,8 +94,6 @@ import static android.view.View.VISIBLE;
/** /**
* Helpers. * Helpers.
* @author Guillaume Beraudo
*
*/ */
public final class LinphoneUtils { public final class LinphoneUtils {
private static Context context = null; private static Context context = null;
@ -104,16 +104,12 @@ public final class LinphoneUtils {
//private static final String strictSipAddressRegExp = "^sip:(\\+)?[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\\.-][a-z0-9]+)*)+\\.[a-z]{2,}$"; //private static final String strictSipAddressRegExp = "^sip:(\\+)?[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\\.-][a-z0-9]+)*)+\\.[a-z]{2,}$";
public static boolean isSipAddress(String numberOrAddress) { public static boolean isSipAddress(String numberOrAddress) {
try { Factory.instance().createAddress(numberOrAddress);
LinphoneCoreFactory.instance().createLinphoneAddress(numberOrAddress);
return true; return true;
} catch (LinphoneCoreException e) {
return false;
}
} }
public static boolean isNumberAddress(String numberOrAddress) { public static boolean isNumberAddress(String numberOrAddress) {
LinphoneProxyConfig proxy = LinphoneManager.getLc().createProxyConfig(); ProxyConfig proxy = LinphoneManager.getLc().createProxyConfig();
return proxy.normalizePhoneNumber(numberOrAddress) != null; return proxy.normalizePhoneNumber(numberOrAddress) != null;
} }
@ -122,21 +118,17 @@ public final class LinphoneUtils {
} }
public static String getAddressDisplayName(String uri){ public static String getAddressDisplayName(String uri){
LinphoneAddress lAddress; Address lAddress;
try { lAddress = Factory.instance().createAddress(uri);
lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(uri);
return getAddressDisplayName(lAddress); return getAddressDisplayName(lAddress);
} catch (LinphoneCoreException e) {
return null;
}
} }
public static String getAddressDisplayName(LinphoneAddress address){ public static String getAddressDisplayName(Address address){
if(address.getDisplayName() != null) { if(address.getDisplayName() != null) {
return address.getDisplayName(); return address.getDisplayName();
} else { } else {
if(address.getUserName() != null){ if(address.getUsername() != null){
return address.getUserName(); return address.getUsername();
} else { } else {
return address.asStringUriOnly(); return address.asStringUriOnly();
} }
@ -278,6 +270,8 @@ public final class LinphoneUtils {
try { try {
bm = MediaStore.Images.Media.getBitmap(c.getContentResolver(),tUri); bm = MediaStore.Images.Media.getBitmap(c.getContentResolver(),tUri);
} catch (IOException e) { } catch (IOException e) {
Log.e("Error in setThumbnailPictureFromUri: " + e);
return;
} }
if (bm != null) { if (bm != null) {
view.setImageBitmap(bm); view.setImageBitmap(bm);
@ -287,33 +281,33 @@ public final class LinphoneUtils {
} }
} }
public static final List<LinphoneCall> getLinphoneCallsNotInConf(LinphoneCore lc) { public static final List<Call> getCallsNotInConf(Core lc) {
List<LinphoneCall> l=new ArrayList<LinphoneCall>(); List<Call> l=new ArrayList<Call>();
for(LinphoneCall c : lc.getCalls()){ for(Call c : lc.getCalls()){
if (!c.isInConference()){ if (!(c.getConference() != null)){
l.add(c); l.add(c);
} }
} }
return l; return l;
} }
public static final List<LinphoneCall> getLinphoneCallsInConf(LinphoneCore lc) { public static final List<Call> getCallsInConf(Core lc) {
List<LinphoneCall> l=new ArrayList<LinphoneCall>(); List<Call> l=new ArrayList<Call>();
for(LinphoneCall c : lc.getCalls()){ for(Call c : lc.getCalls()){
if (c.isInConference()){ if ((c.getConference() != null)){
l.add(c); l.add(c);
} }
} }
return l; return l;
} }
public static final List<LinphoneCall> getLinphoneCalls(LinphoneCore lc) { public static final List<Call> getCalls(Core lc) {
// return a modifiable list // return a modifiable list
return new ArrayList<LinphoneCall>(Arrays.asList(lc.getCalls())); return new ArrayList<Call>(Arrays.asList(lc.getCalls()));
} }
public static final boolean hasExistingResumeableCall(LinphoneCore lc) { public static final boolean hasExistingResumeableCall(Core lc) {
for (LinphoneCall c : getLinphoneCalls(lc)) { for (Call c : getCalls(lc)) {
if (c.getState() == State.Paused) { if (c.getState() == State.Paused) {
return true; return true;
} }
@ -321,32 +315,32 @@ public final class LinphoneUtils {
return false; return false;
} }
public static final List<LinphoneCall> getCallsInState(LinphoneCore lc, Collection<State> states) { public static final List<Call> getCallsInState(Core lc, Collection<State> states) {
List<LinphoneCall> foundCalls = new ArrayList<LinphoneCall>(); List<Call> foundCalls = new ArrayList<Call>();
for (LinphoneCall call : getLinphoneCalls(lc)) { for (Call call : getCalls(lc)) {
if (states.contains(call.getState())) { if (states.contains(call.getState())) {
foundCalls.add(call); foundCalls.add(call);
} }
} }
return foundCalls; return foundCalls;
} }
public static final List<LinphoneCall> getRunningOrPausedCalls(LinphoneCore lc) { public static final List<Call> getRunningOrPausedCalls(Core lc) {
return getCallsInState(lc, Arrays.asList( return getCallsInState(lc, Arrays.asList(
State.Paused, State.Paused,
State.PausedByRemote, State.PausedByRemote,
State.StreamsRunning)); State.StreamsRunning));
} }
public static final int countConferenceCalls(LinphoneCore lc) { public static final int countConferenceCalls(Core lc) {
int count = lc.getConferenceSize(); int count = lc.getConferenceSize();
if (lc.isInConference()) count--; if ((lc.getConference() != null)) count--;
return count; return count;
} }
public static int countVirtualCalls(LinphoneCore lc) { public static int countVirtualCalls(Core lc) {
return lc.getCallsNb() - countConferenceCalls(lc); return lc.getCallsNb() - countConferenceCalls(lc);
} }
public static int countNonConferenceCalls(LinphoneCore lc) { public static int countNonConferenceCalls(Core lc) {
return lc.getCallsNb() - countConferenceCalls(lc); return lc.getCallsNb() - countConferenceCalls(lc);
} }
@ -366,32 +360,32 @@ public final class LinphoneUtils {
return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, (float) pixels, res.getDisplayMetrics()); return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, (float) pixels, res.getDisplayMetrics());
} }
public static boolean isCallRunning(LinphoneCall call) public static boolean isCallRunning(Call call)
{ {
if (call == null) { if (call == null) {
return false; return false;
} }
LinphoneCall.State state = call.getState(); Call.State state = call.getState();
return state == LinphoneCall.State.Connected || return state == Call.State.Connected ||
state == LinphoneCall.State.CallUpdating || state == Call.State.Updating ||
state == LinphoneCall.State.CallUpdatedByRemote || state == Call.State.UpdatedByRemote ||
state == LinphoneCall.State.StreamsRunning || state == Call.State.StreamsRunning ||
state == LinphoneCall.State.Resuming; state == Call.State.Resuming;
} }
public static boolean isCallEstablished(LinphoneCall call) { public static boolean isCallEstablished(Call call) {
if (call == null) { if (call == null) {
return false; return false;
} }
LinphoneCall.State state = call.getState(); Call.State state = call.getState();
return isCallRunning(call) || return isCallRunning(call) ||
state == LinphoneCall.State.Paused || state == Call.State.Paused ||
state == LinphoneCall.State.PausedByRemote || state == Call.State.PausedByRemote ||
state == LinphoneCall.State.Pausing; state == Call.State.Pausing;
} }
public static boolean isHighBandwidthConnection(Context context){ public static boolean isHighBandwidthConnection(Context context){
@ -521,7 +515,7 @@ public final class LinphoneUtils {
public static String getDisplayableUsernameFromAddress(String sipAddress) { public static String getDisplayableUsernameFromAddress(String sipAddress) {
String username = sipAddress; String username = sipAddress;
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc == null) return username; if (lc == null) return username;
if (username.startsWith("sip:")) { if (username.startsWith("sip:")) {
@ -530,7 +524,7 @@ public final class LinphoneUtils {
if (username.contains("@")) { if (username.contains("@")) {
String domain = username.split("@")[1]; String domain = username.split("@")[1];
LinphoneProxyConfig lpc = lc.getDefaultProxyConfig(); ProxyConfig lpc = lc.getDefaultProxyConfig();
if (lpc != null) { if (lpc != null) {
if (domain.equals(lpc.getDomain())) { if (domain.equals(lpc.getDomain())) {
return username.split("@")[0]; return username.split("@")[0];
@ -546,15 +540,15 @@ public final class LinphoneUtils {
public static String getFullAddressFromUsername(String username) { public static String getFullAddressFromUsername(String username) {
String sipAddress = username; String sipAddress = username;
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc == null) return sipAddress; if (lc == null || username == null) return sipAddress;
if (!sipAddress.startsWith("sip:")) { if (!sipAddress.startsWith("sip:")) {
sipAddress = "sip:" + sipAddress; sipAddress = "sip:" + sipAddress;
} }
if (!sipAddress.contains("@")) { if (!sipAddress.contains("@")) {
LinphoneProxyConfig lpc = lc.getDefaultProxyConfig(); ProxyConfig lpc = lc.getDefaultProxyConfig();
if (lpc != null) { if (lpc != null) {
sipAddress = sipAddress + "@" + lpc.getDomain(); sipAddress = sipAddress + "@" + lpc.getDomain();
} else { } else {
@ -564,9 +558,9 @@ public final class LinphoneUtils {
return sipAddress; return sipAddress;
} }
public static void storeImage(Context context, LinphoneChatMessage msg) { public static void storeImage(Context context, ChatMessage msg) {
if (msg == null || msg.getFileTransferInformation() == null || msg.getAppData() == null) return; if (msg == null || msg.getFileTransferInformation() == null || msg.getAppdata() == null) return;
File file = new File(Environment.getExternalStorageDirectory(), msg.getAppData()); File file = new File(Environment.getExternalStorageDirectory(), msg.getAppdata());
Bitmap bm = BitmapFactory.decodeFile(file.getPath()); Bitmap bm = BitmapFactory.decodeFile(file.getPath());
if (bm == null) return; if (bm == null) return;
@ -590,7 +584,7 @@ public final class LinphoneUtils {
file.delete(); file.delete();
bm.recycle(); bm.recycle();
msg.setAppData(path.toString()); msg.setAppdata(path.toString());
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
Log.e(e); Log.e(e);
} catch (IOException e) { } catch (IOException e) {
@ -617,83 +611,83 @@ public final class LinphoneUtils {
public static String errorForPhoneNumberStatus(int status) { public static String errorForPhoneNumberStatus(int status) {
Context ctxt = getContext(); Context ctxt = getContext();
if (ctxt != null) { if (ctxt != null) {
if (LinphoneAccountCreator.PhoneNumberCheck.CountryCodeInvalid.value() if (AccountCreator.PhoneNumberStatus.InvalidCountryCode.toInt()
== (status & LinphoneAccountCreator.PhoneNumberCheck.CountryCodeInvalid.value())) == (status & AccountCreator.PhoneNumberStatus.InvalidCountryCode.toInt()))
return ctxt.getString(R.string.country_code_invalid); return ctxt.getString(R.string.country_code_invalid);
if (LinphoneAccountCreator.PhoneNumberCheck.TooShort.value() if (AccountCreator.PhoneNumberStatus.TooShort.toInt()
== (status & LinphoneAccountCreator.PhoneNumberCheck.TooShort.value())) == (status & AccountCreator.PhoneNumberStatus.TooShort.toInt()))
return ctxt.getString(R.string.phone_number_too_short); return ctxt.getString(R.string.phone_number_too_short);
if (LinphoneAccountCreator.PhoneNumberCheck.TooLong.value() if (AccountCreator.PhoneNumberStatus.TooLong.toInt()
== (status & LinphoneAccountCreator.PhoneNumberCheck.TooLong.value())) == (status & AccountCreator.PhoneNumberStatus.TooLong.toInt()))
return ctxt.getString(R.string.phone_number_too_long); return ctxt.getString(R.string.phone_number_too_long);
if (LinphoneAccountCreator.PhoneNumberCheck.Invalid.value() if (AccountCreator.PhoneNumberStatus.Invalid.toInt()
== (status & LinphoneAccountCreator.PhoneNumberCheck.Invalid.value())) == (status & AccountCreator.PhoneNumberStatus.Invalid.toInt()))
return ctxt.getString(R.string.phone_number_invalid); return ctxt.getString(R.string.phone_number_invalid);
} }
return null; return null;
} }
public static String errorForEmailStatus(LinphoneAccountCreator.EmailCheck status) { public static String errorForEmailStatus(AccountCreator.EmailStatus status) {
Context ctxt = getContext(); Context ctxt = getContext();
if (ctxt != null) { if (ctxt != null) {
if (status.equals(LinphoneAccountCreator.EmailCheck.InvalidCharacters) if (status.equals(AccountCreator.EmailStatus.InvalidCharacters)
|| status.equals(LinphoneAccountCreator.EmailCheck.Malformed)) || status.equals(AccountCreator.EmailStatus.Malformed))
return ctxt.getString(R.string.invalid_email); return ctxt.getString(R.string.invalid_email);
} }
return null; return null;
} }
public static String errorForUsernameStatus(LinphoneAccountCreator.UsernameCheck status) { public static String errorForUsernameStatus(AccountCreator.UsernameStatus status) {
Context ctxt = getContext(); Context ctxt = getContext();
if (ctxt != null) { if (ctxt != null) {
if (status.equals(LinphoneAccountCreator.UsernameCheck.InvalidCharacters)) if (status.equals(AccountCreator.UsernameStatus.InvalidCharacters))
return ctxt.getString(R.string.invalid_username); return ctxt.getString(R.string.invalid_username);
if (status.equals(LinphoneAccountCreator.UsernameCheck.TooShort)) if (status.equals(AccountCreator.UsernameStatus.TooShort))
return ctxt.getString(R.string.username_too_short); return ctxt.getString(R.string.username_too_short);
if (status.equals(LinphoneAccountCreator.UsernameCheck.TooLong)) if (status.equals(AccountCreator.UsernameStatus.TooLong))
return ctxt.getString(R.string.username_too_long); return ctxt.getString(R.string.username_too_long);
if (status.equals(LinphoneAccountCreator.UsernameCheck.Invalid)) if (status.equals(AccountCreator.UsernameStatus.Invalid))
return ctxt.getString(R.string.username_invalid_size); return ctxt.getString(R.string.username_invalid_size);
if (status.equals(LinphoneAccountCreator.UsernameCheck.InvalidCharacters)) if (status.equals(AccountCreator.UsernameStatus.InvalidCharacters))
return ctxt.getString(R.string.invalid_display_name); return ctxt.getString(R.string.invalid_display_name);
} }
return null; return null;
} }
public static String errorForPasswordStatus(LinphoneAccountCreator.PasswordCheck status) { public static String errorForPasswordStatus(AccountCreator.PasswordStatus status) {
Context ctxt = getContext(); Context ctxt = getContext();
if (ctxt != null) { if (ctxt != null) {
if (status.equals(LinphoneAccountCreator.PasswordCheck.TooShort)) if (status.equals(AccountCreator.PasswordStatus.TooShort))
return ctxt.getString(R.string.password_too_short); return ctxt.getString(R.string.password_too_short);
if (status.equals(LinphoneAccountCreator.PasswordCheck.TooLong)) if (status.equals(AccountCreator.PasswordStatus.TooLong))
return ctxt.getString(R.string.password_too_long); return ctxt.getString(R.string.password_too_long);
} }
return null; return null;
} }
public static String errorForRequestStatus(LinphoneAccountCreator.RequestStatus status) { public static String errorForStatus(AccountCreator.Status status) {
Context ctxt = getContext(); Context ctxt = getContext();
if (ctxt != null) { if (ctxt != null) {
if (status.equals(LinphoneAccountCreator.RequestStatus.Failed)) if (status.equals(AccountCreator.Status.RequestFailed))
return ctxt.getString(R.string.request_failed); return ctxt.getString(R.string.request_failed);
if (status.equals(LinphoneAccountCreator.RequestStatus.ErrorServer)) if (status.equals(AccountCreator.Status.ServerError))
return ctxt.getString(R.string.wizard_failed); return ctxt.getString(R.string.wizard_failed);
if (status.equals(LinphoneAccountCreator.RequestStatus.AccountExist) if (status.equals(AccountCreator.Status.AccountExist)
|| status.equals(LinphoneAccountCreator.RequestStatus.AccountExistWithAlias)) || status.equals(AccountCreator.Status.AccountExistWithAlias))
return ctxt.getString(R.string.account_already_exist); return ctxt.getString(R.string.account_already_exist);
if (status.equals(LinphoneAccountCreator.RequestStatus.AliasIsAccount) if (status.equals(AccountCreator.Status.AliasIsAccount)
|| status.equals(LinphoneAccountCreator.RequestStatus.AliasExist)) || status.equals(AccountCreator.Status.AliasExist))
return ctxt.getString(R.string.assistant_phone_number_unavailable); return ctxt.getString(R.string.assistant_phone_number_unavailable);
if (status.equals(LinphoneAccountCreator.RequestStatus.AccountNotExist)) if (status.equals(AccountCreator.Status.AccountNotExist))
return ctxt.getString(R.string.assistant_error_bad_credentials); return ctxt.getString(R.string.assistant_error_bad_credentials);
if (status.equals(LinphoneAccountCreator.RequestStatus.AliasNotExist)) if (status.equals(AccountCreator.Status.AliasNotExist))
return ctxt.getString(R.string.phone_number_not_exist); return ctxt.getString(R.string.phone_number_not_exist);
if (status.equals(LinphoneAccountCreator.RequestStatus.AliasNotExist) if (status.equals(AccountCreator.Status.AliasNotExist)
|| status.equals(LinphoneAccountCreator.RequestStatus.AccountNotActivated) || status.equals(AccountCreator.Status.AccountNotActivated)
|| status.equals(LinphoneAccountCreator.RequestStatus.AccountAlreadyActivated) || status.equals(AccountCreator.Status.AccountAlreadyActivated)
|| status.equals(LinphoneAccountCreator.RequestStatus.AccountActivated) || status.equals(AccountCreator.Status.AccountActivated)
|| status.equals(LinphoneAccountCreator.RequestStatus.AccountNotCreated) || status.equals(AccountCreator.Status.AccountNotCreated)
|| status.equals(LinphoneAccountCreator.RequestStatus.Ok)) || status.equals(AccountCreator.Status.RequestOk))
return ""; return "";
} }
return null; return null;
@ -712,8 +706,8 @@ public final class LinphoneUtils {
public static void setCountry(DialPlan c, EditText dialCode, Button selectCountry, int countryCode) { public static void setCountry(DialPlan c, EditText dialCode, Button selectCountry, int countryCode) {
if( c != null && dialCode != null && selectCountry != null) { if( c != null && dialCode != null && selectCountry != null) {
dialCode.setText(c.getCountryCode()); dialCode.setText(c.getCountryCallingCode());
selectCountry.setText(c.getCountryName()); selectCountry.setText(c.getCountry());
} else { } else {
if(countryCode != -1){ if(countryCode != -1){
dialCode.setText("+" + countryCode); dialCode.setText("+" + countryCode);
@ -796,7 +790,7 @@ public final class LinphoneUtils {
} }
} }
public static String getTimestamp() { public static String getStartDate() {
try { try {
return new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.ROOT).format(new Date()); return new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.ROOT).format(new Date());
} catch (RuntimeException e) { } catch (RuntimeException e) {
@ -806,7 +800,7 @@ public final class LinphoneUtils {
public static File createFile(Context context, String imageFileName, String type) throws IOException { public static File createFile(Context context, String imageFileName, String type) throws IOException {
if (TextUtils.isEmpty(imageFileName)) if (TextUtils.isEmpty(imageFileName))
imageFileName = getTimestamp()+"."+type; // make random filename if you want. imageFileName = getStartDate()+"."+type; // make random filename if you want.
final File root; final File root;
imageFileName = imageFileName; imageFileName = imageFileName;

View file

@ -1,6 +1,8 @@
package org.linphone;
/* /*
ContactPickerActivity.java ContactPickerActivity.java
Copyright (C) 2010 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -16,15 +18,12 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
package org.linphone;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.net.ConnectivityManager; import android.net.ConnectivityManager;
/** /**
* *
* Intercept network state changes and update linphone core through LinphoneManager. * Intercept network state changes and update linphone core through LinphoneManager.

View file

@ -0,0 +1,54 @@
package org.linphone;
/*
OutgoingCallReceiver.java
Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
public class OutgoingCallReceiver extends BroadcastReceiver {
private final static String TAG = "CallHandler";
private final String ACTION_CALL_LINPHONE = "org.linphone.intent.action.CallLaunched";
private LinphonePreferences mPrefs;
@Override
public void onReceive(Context context, Intent intent) {
mPrefs = LinphonePreferences.instance();
Log.e(TAG, "===>>>> Linphone OutgoingCallReceiver ");
if (intent.getAction().equals(Intent.ACTION_NEW_OUTGOING_CALL)) {
Log.e(TAG, "===>>>> Linphone OutgoingCallReceiver : ACTION_NEW_OUTGOING_CALL");
String number = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
if(mPrefs.getConfig() != null && mPrefs.getNativeDialerCall()){
abortBroadcast();
setResultData(null);
Intent newIntent = new Intent(ACTION_CALL_LINPHONE);
newIntent.setFlags(FLAG_ACTIVITY_NEW_TASK);
newIntent.putExtra("StartCall", true);
newIntent.putExtra("NumberToCall", number);
context.startActivity(newIntent);
}
}
}
}

View file

@ -1,6 +1,8 @@
package org.linphone;
/* /*
PhoneStateReceiver.java PhoneStateReceiver.java
Copyright (C) 2011 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -16,7 +18,6 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
package org.linphone;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
@ -25,9 +26,6 @@ import android.telephony.TelephonyManager;
/** /**
* Pause current SIP calls when GSM phone rings or is active. * Pause current SIP calls when GSM phone rings or is active.
*
* @author Guillaume Beraudo
*
*/ */
public class PhoneStateChangedReceiver extends BroadcastReceiver { public class PhoneStateChangedReceiver extends BroadcastReceiver {
@Override @Override
@ -37,7 +35,7 @@ public class PhoneStateChangedReceiver extends BroadcastReceiver {
if (!LinphoneManager.isInstanciated()) if (!LinphoneManager.isInstanciated())
return; return;
if (TelephonyManager.EXTRA_STATE_OFFHOOK.equals(extraState)) { if (TelephonyManager.EXTRA_STATE_OFFHOOK.equals(extraState) || TelephonyManager.EXTRA_STATE_RINGING.equals(extraState)) {
LinphoneManager.getInstance().setCallGsmON(true); LinphoneManager.getInstance().setCallGsmON(true);
LinphoneManager.getLc().pauseAllCalls(); LinphoneManager.getLc().pauseAllCalls();
} else if (TelephonyManager.EXTRA_STATE_IDLE.equals(extraState)) { } else if (TelephonyManager.EXTRA_STATE_IDLE.equals(extraState)) {

View file

@ -2,7 +2,7 @@ package org.linphone;
/* /*
PreferencesMigrator.java PreferencesMigrator.java
Copyright (C) 2013 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -20,10 +20,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
import org.linphone.LinphonePreferences.AccountBuilder; import org.linphone.LinphonePreferences.AccountBuilder;
import org.linphone.core.LinphoneCore; import org.linphone.core.Core;
import org.linphone.core.LinphoneCoreException; import org.linphone.core.CoreException;
import org.linphone.core.LinphoneProxyConfig; import org.linphone.core.ProxyConfig;
import org.linphone.core.LpConfig; import org.linphone.core.Config;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
import android.content.Context; import android.content.Context;
@ -32,9 +32,6 @@ import android.content.SharedPreferences.Editor;
import android.content.res.Resources; import android.content.res.Resources;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
/**
* @author Sylvain Berfini
*/
public class PreferencesMigrator { public class PreferencesMigrator {
private LinphonePreferences mNewPrefs; private LinphonePreferences mNewPrefs;
private SharedPreferences mOldPrefs; private SharedPreferences mOldPrefs;
@ -47,7 +44,7 @@ public class PreferencesMigrator {
} }
public boolean isEchoMigratioNeeded() { public boolean isEchoMigratioNeeded() {
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc == null) { if (lc == null) {
return false; return false;
} }
@ -56,7 +53,7 @@ public class PreferencesMigrator {
return false; return false;
} }
return (!lc.needsEchoCalibration() && mNewPrefs.isEchoCancellationEnabled()); return (!lc.isEchoCancellerCalibrationRequired() && mNewPrefs.echoCancellationEnabled());
} }
public boolean isMigrationNeeded() { public boolean isMigrationNeeded() {
@ -102,9 +99,9 @@ public class PreferencesMigrator {
} }
private void doAccountsMigration() { private void doAccountsMigration() {
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
lc.clearAuthInfos(); lc.clearAllAuthInfo();
lc.clearProxyConfigs(); lc.clearProxyConfig();
for (int i = 0; i < mOldPrefs.getInt(getString(R.string.pref_extra_accounts), 1); i++) { for (int i = 0; i < mOldPrefs.getInt(getString(R.string.pref_extra_accounts), 1); i++) {
doAccountMigration(i, i == getPrefInt(R.string.pref_default_account_key, 0)); doAccountMigration(i, i == getPrefInt(R.string.pref_default_account_key, 0));
@ -124,10 +121,10 @@ public class PreferencesMigrator {
AccountBuilder builder = new AccountBuilder(LinphoneManager.getLc()) AccountBuilder builder = new AccountBuilder(LinphoneManager.getLc())
.setUsername(username) .setUsername(username)
.setUserId(userid) .setUserid(userid)
.setDomain(domain) .setDomain(domain)
.setPassword(password) .setPassword(password)
.setProxy(proxy) .setServerAddr(proxy)
.setExpires(expire); .setExpires(expire);
if (getPrefBoolean(getString(R.string.pref_enable_outbound_proxy_key) + key, false)) { if (getPrefBoolean(getString(R.string.pref_enable_outbound_proxy_key) + key, false)) {
@ -144,7 +141,7 @@ public class PreferencesMigrator {
try { try {
builder.saveNewAccount(); builder.saveNewAccount();
} catch (LinphoneCoreException e) { } catch (CoreException e) {
Log.e(e); Log.e(e);
} }
@ -155,10 +152,10 @@ public class PreferencesMigrator {
} }
public void doPresenceMigrationIfNeeded() { public void doPresenceMigrationIfNeeded() {
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
LpConfig cfg = lc.getConfig(); Config cfg = lc.getConfig();
if (cfg.getString("app", "friendlist_subscription_enabled", null) == null){ if (cfg.getString("app", "friendlist_subscription_enabled", null) == null){
LinphoneProxyConfig proxy = lc.getDefaultProxyConfig(); ProxyConfig proxy = lc.getDefaultProxyConfig();
if (proxy != null) { if (proxy != null) {
String domain = proxy.getDomain(); String domain = proxy.getDomain();
if (domain!=null && domain.equals(getString(R.string.default_domain))) { if (domain!=null && domain.equals(getString(R.string.default_domain))) {

View file

@ -28,7 +28,7 @@ import android.widget.ListView;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import org.linphone.core.LinphoneAddress; import org.linphone.core.Address;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -114,17 +114,18 @@ public class SearchContactsListAdapter extends BaseAdapter {
public List<ContactAddress> getContactsList() { public List<ContactAddress> getContactsList() {
List<ContactAddress> list = new ArrayList<ContactAddress>(); List<ContactAddress> list = new ArrayList<ContactAddress>();
if (ContactsManager.getInstance().hasContacts()) { if (ContactsManager.getInstance().hasContacts()) {
for (LinphoneAddress addr : LinphoneManager.getLc().findContactsByChar("", mOnlySipContact)) { //TODO FIXME
/*for (Address addr : LinphoneManager.getLc().findContactsByChar("", mOnlySipContact)) {
LinphoneContact cont = ContactsManager.getInstance().findContactFromAddress(addr); LinphoneContact cont = ContactsManager.getInstance().findContactFromAddress(addr);
if (cont == null) { if (cont == null) {
cont = new LinphoneContact(); cont = new LinphoneContact();
cont.setFullName(addr.getUserName()); cont.setFullName(addr.getUsername());
} }
// TODO Rechercher si un contact est associé à cette sip uri // TODO Rechercher si un contact est associé à cette sip uri
// TODO Rechercher si un displayname est associé à cette sip uri // TODO Rechercher si un displayname est associé à cette sip uri
ContactAddress ca = new ContactAddress(cont , addr.asString(), cont.isLinphoneFriend()); ContactAddress ca = new ContactAddress(cont , addr.asString(), cont.isFriend());
list.add(ca); list.add(ca);
} }*/
} }
for (ContactAddress caS : contactsSelected) { for (ContactAddress caS : contactsSelected) {

View file

@ -2,7 +2,7 @@ package org.linphone;
/* /*
SettingsFragment.java SettingsFragment.java
Copyright (C) 2013 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -23,19 +23,21 @@ import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.linphone.core.LinphoneAddress; import org.linphone.core.Address;
import org.linphone.core.LinphoneCore; import org.linphone.core.Core;
import org.linphone.core.LinphoneCore.EcCalibratorStatus; import org.linphone.core.Core.EcCalibratorStatus;
import org.linphone.core.LinphoneCore.LinphoneLimeState; import org.linphone.core.Core.LimeState;
import org.linphone.core.LinphoneCore.MediaEncryption; import org.linphone.core.Core.MediaEncryption;
import org.linphone.core.LinphoneCoreException; import org.linphone.core.CoreException;
import org.linphone.core.LinphoneCoreListenerBase; import org.linphone.core.CoreListenerStub;
import org.linphone.core.LinphoneProxyConfig; import org.linphone.core.Factory;
import org.linphone.core.ProxyConfig;
import org.linphone.core.PayloadType; import org.linphone.core.PayloadType;
import org.linphone.core.VideoDefinition;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
import org.linphone.mediastream.Version; import org.linphone.mediastream.Version;
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration; import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
import org.linphone.tools.OpenH264DownloadHelper; import org.linphone.core.tools.OpenH264DownloadHelper;
import org.linphone.ui.LedPreference; import org.linphone.ui.LedPreference;
import org.linphone.ui.PreferencesListFragment; import org.linphone.ui.PreferencesListFragment;
@ -48,6 +50,8 @@ import android.content.SharedPreferences;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.media.AudioManager; import android.media.AudioManager;
import android.net.Uri; import android.net.Uri;
import android.net.wifi.WifiManager;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.preference.CheckBoxPreference; import android.preference.CheckBoxPreference;
@ -60,13 +64,10 @@ import android.preference.PreferenceCategory;
import android.preference.PreferenceScreen; import android.preference.PreferenceScreen;
import android.provider.Settings; import android.provider.Settings;
/**
* @author Sylvain Berfini
*/
public class SettingsFragment extends PreferencesListFragment { public class SettingsFragment extends PreferencesListFragment {
private LinphonePreferences mPrefs; private LinphonePreferences mPrefs;
private Handler mHandler = new Handler(); private Handler mHandler = new Handler();
private LinphoneCoreListenerBase mListener; private CoreListenerStub mListener;
private PreferenceScreen currentPreferenceScreen; private PreferenceScreen currentPreferenceScreen;
private Preference.OnPreferenceClickListener prefClickListener = new Preference.OnPreferenceClickListener() { private Preference.OnPreferenceClickListener prefClickListener = new Preference.OnPreferenceClickListener() {
@Override @Override
@ -94,9 +95,10 @@ public class SettingsFragment extends PreferencesListFragment {
mPrefs = LinphonePreferences.instance(); mPrefs = LinphonePreferences.instance();
removePreviousPreferencesFile(); // Required when updating the preferences order removePreviousPreferencesFile(); // Required when updating the preferences order
mListener = new LinphoneCoreListenerBase() { mListener = new CoreListenerStub() {
@Override @Override
public void ecCalibrationStatus(LinphoneCore lc, final EcCalibratorStatus status, final int delayMs, Object data) { public void onEcCalibrationResult(Core lc, Core.EcCalibratorStatus status, int delayMs) {
lc.removeListener(mListener);
LinphoneManager.getInstance().routeAudioToReceiver(); LinphoneManager.getInstance().routeAudioToReceiver();
CheckBoxPreference echoCancellation = (CheckBoxPreference) findPreference(getString(R.string.pref_echo_cancellation_key)); CheckBoxPreference echoCancellation = (CheckBoxPreference) findPreference(getString(R.string.pref_echo_cancellation_key));
@ -109,7 +111,7 @@ public class SettingsFragment extends PreferencesListFragment {
((AudioManager)getActivity().getSystemService(Context.AUDIO_SERVICE)).setMode(AudioManager.MODE_NORMAL); ((AudioManager)getActivity().getSystemService(Context.AUDIO_SERVICE)).setMode(AudioManager.MODE_NORMAL);
Log.i("Set audio mode on 'Normal'"); Log.i("Set audio mode on 'Normal'");
} else if (status == EcCalibratorStatus.Done) { } else if (status == EcCalibratorStatus.Done) {
echoCancellerCalibration.setSummary(String.format(getString(R.string.ec_calibrated), delayMs)); echoCancellerCalibration.setSummary(String.format(getString(R.string.ec_calibrated), String.valueOf(delayMs)));
echoCancellation.setChecked(true); echoCancellation.setChecked(true);
LinphonePreferences.instance().setEchoCancellation(true); LinphonePreferences.instance().setEchoCancellation(true);
((AudioManager)getActivity().getSystemService(Context.AUDIO_SERVICE)).setMode(AudioManager.MODE_NORMAL); ((AudioManager)getActivity().getSystemService(Context.AUDIO_SERVICE)).setMode(AudioManager.MODE_NORMAL);
@ -196,7 +198,7 @@ public class SettingsFragment extends PreferencesListFragment {
hidePreference(R.string.pref_push_notification_key); hidePreference(R.string.pref_push_notification_key);
} }
if (!Version.isVideoCapable() || !LinphoneManager.getLcIfManagerNotDestroyedOrNull().isVideoSupported()) { if (!Version.isVideoCapable() || !LinphoneManager.getLcIfManagerNotDestroyedOrNull().videoSupported()) {
emptyAndHidePreference(R.string.pref_video_key); emptyAndHidePreference(R.string.pref_video_key);
} else { } else {
if (!AndroidCameraConfiguration.hasFrontCamera()) { if (!AndroidCameraConfiguration.hasFrontCamera()) {
@ -204,7 +206,7 @@ public class SettingsFragment extends PreferencesListFragment {
} }
} }
if (!LinphoneManager.getLc().isTunnelAvailable()) { if (!LinphoneManager.getLc().tunnelAvailable()) {
emptyAndHidePreference(R.string.pref_tunnel_key); emptyAndHidePreference(R.string.pref_tunnel_key);
} }
@ -278,20 +280,20 @@ public class SettingsFragment extends PreferencesListFragment {
} }
private void initTunnelSettings() { private void initTunnelSettings() {
if (!LinphoneManager.isInstanciated() || !LinphoneManager.getLc().isTunnelAvailable()) { if (!LinphoneManager.isInstanciated() || !LinphoneManager.getLc().tunnelAvailable()) {
return; return;
} }
setPreferenceDefaultValueAndSummary(R.string.pref_tunnel_host_key, mPrefs.getTunnelHost()); /*setPreferenceDefaultValueAndSummary(R.string.pref_tunnel_host_key, mPrefs.getTunnelHost());
setPreferenceDefaultValueAndSummary(R.string.pref_tunnel_port_key, String.valueOf(mPrefs.getTunnelPort())); setPreferenceDefaultValueAndSummary(R.string.pref_tunnel_port_key, String.valueOf(mPrefs.getTunnelPort()));
ListPreference tunnelModePref = (ListPreference) findPreference(getString(R.string.pref_tunnel_mode_key)); ListPreference tunnelModePref = (ListPreference) findPreference(getString(R.string.pref_tunnel_mode_key));
String tunnelMode = mPrefs.getTunnelMode(); String tunnelMode = mPrefs.getTunnelMode();
tunnelModePref.setSummary(tunnelMode); tunnelModePref.setSummary(tunnelMode);
tunnelModePref.setValue(tunnelMode); tunnelModePref.setValue(tunnelMode);*/
} }
private void setTunnelPreferencesListener() { private void setTunnelPreferencesListener() {
findPreference(getString(R.string.pref_tunnel_host_key)).setOnPreferenceChangeListener(new OnPreferenceChangeListener() { /*findPreference(getString(R.string.pref_tunnel_host_key)).setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override @Override
public boolean onPreferenceChange(Preference preference, Object newValue) { public boolean onPreferenceChange(Preference preference, Object newValue) {
String host = newValue.toString(); String host = newValue.toString();
@ -321,7 +323,7 @@ public class SettingsFragment extends PreferencesListFragment {
preference.setSummary(mode); preference.setSummary(mode);
return true; return true;
} }
}); });*/
} }
private void initAccounts() { private void initAccounts() {
@ -368,14 +370,14 @@ public class SettingsFragment extends PreferencesListFragment {
} }
if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null) { if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null) {
for (LinphoneProxyConfig lpc : LinphoneManager.getLc().getProxyConfigList()) { for (ProxyConfig lpc : LinphoneManager.getLc().getProxyConfigList()) {
LinphoneAddress addr = lpc.getAddress(); Address addr = lpc.getIdentityAddress();
if (addr.getUserName().equals(username) && addr.getDomain().equals(domain)) { if (addr.getUsername().equals(username) && addr.getDomain().equals(domain)) {
if (lpc.getState() == LinphoneCore.RegistrationState.RegistrationOk) { if (lpc.getState() == Core.RegistrationState.Ok) {
me.setLed(R.drawable.led_connected); me.setLed(R.drawable.led_connected);
} else if (lpc.getState() == LinphoneCore.RegistrationState.RegistrationFailed) { } else if (lpc.getState() == Core.RegistrationState.Failed) {
me.setLed(R.drawable.led_error); me.setLed(R.drawable.led_error);
} else if (lpc.getState() == LinphoneCore.RegistrationState.RegistrationProgress) { } else if (lpc.getState() == Core.RegistrationState.Progress) {
me.setLed(R.drawable.led_inprogress); me.setLed(R.drawable.led_inprogress);
mHandler.postDelayed(new Runnable() { mHandler.postDelayed(new Runnable() {
@Override @Override
@ -398,7 +400,7 @@ public class SettingsFragment extends PreferencesListFragment {
entries.add(getString(R.string.pref_none)); entries.add(getString(R.string.pref_none));
values.add(getString(R.string.pref_media_encryption_key_none)); values.add(getString(R.string.pref_media_encryption_key_none));
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc == null || getResources().getBoolean(R.bool.disable_all_security_features_for_markets)) { if (lc == null || getResources().getBoolean(R.bool.disable_all_security_features_for_markets)) {
setListPreferenceValues(pref, entries, values); setListPreferenceValues(pref, entries, values);
return; return;
@ -443,9 +445,9 @@ public class SettingsFragment extends PreferencesListFragment {
private void initializePreferredVideoSizePreferences(ListPreference pref) { private void initializePreferredVideoSizePreferences(ListPreference pref) {
List<CharSequence> entries = new ArrayList<CharSequence>(); List<CharSequence> entries = new ArrayList<CharSequence>();
List<CharSequence> values = new ArrayList<CharSequence>(); List<CharSequence> values = new ArrayList<CharSequence>();
for (String name : LinphoneManager.getLc().getSupportedVideoSizes()) { for (VideoDefinition vd : Factory.instance().getSupportedVideoDefinitions()) {
entries.add(name); entries.add(vd.getName());
values.add(name); values.add(vd.getName());
} }
setListPreferenceValues(pref, entries, values); setListPreferenceValues(pref, entries, values);
@ -478,27 +480,27 @@ public class SettingsFragment extends PreferencesListFragment {
List<CharSequence> entries = new ArrayList<CharSequence>(); List<CharSequence> entries = new ArrayList<CharSequence>();
List<CharSequence> values = new ArrayList<CharSequence>(); List<CharSequence> values = new ArrayList<CharSequence>();
entries.add(getString(R.string.lime_encryption_entry_disabled)); entries.add(getString(R.string.lime_encryption_entry_disabled));
values.add(LinphoneLimeState.Disabled.toString()); values.add(LimeState.Disabled.toString());
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc == null || !lc.isLimeEncryptionAvailable()) { if (lc == null || !lc.limeAvailable()) {
setListPreferenceValues(pref, entries, values); setListPreferenceValues(pref, entries, values);
pref.setEnabled(false); pref.setEnabled(false);
return; return;
} }
entries.add(getString(R.string.lime_encryption_entry_mandatory)); entries.add(getString(R.string.lime_encryption_entry_mandatory));
values.add(LinphoneLimeState.Mandatory.toString()); values.add(LimeState.Mandatory.toString());
entries.add(getString(R.string.lime_encryption_entry_preferred)); entries.add(getString(R.string.lime_encryption_entry_preferred));
values.add(LinphoneLimeState.Preferred.toString()); values.add(LimeState.Preferred.toString());
setListPreferenceValues(pref, entries, values); setListPreferenceValues(pref, entries, values);
LinphoneLimeState lime = mPrefs.getLimeEncryption(); LimeState lime = mPrefs.limeEnabled();
if (lime == LinphoneLimeState.Disabled) { if (lime == LimeState.Disabled) {
pref.setSummary(getString(R.string.lime_encryption_entry_disabled)); pref.setSummary(getString(R.string.lime_encryption_entry_disabled));
} else if (lime == LinphoneLimeState.Mandatory) { } else if (lime == LimeState.Mandatory) {
pref.setSummary(getString(R.string.lime_encryption_entry_mandatory)); pref.setSummary(getString(R.string.lime_encryption_entry_mandatory));
} else if (lime == LinphoneLimeState.Preferred) { } else if (lime == LimeState.Preferred) {
pref.setSummary(getString(R.string.lime_encryption_entry_preferred)); pref.setSummary(getString(R.string.lime_encryption_entry_preferred));
} }
pref.setValue(lime.toString()); pref.setValue(lime.toString());
@ -517,37 +519,29 @@ public class SettingsFragment extends PreferencesListFragment {
PreferenceCategory codecs = (PreferenceCategory) findPreference(getString(R.string.pref_codecs_key)); PreferenceCategory codecs = (PreferenceCategory) findPreference(getString(R.string.pref_codecs_key));
codecs.removeAll(); codecs.removeAll();
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
for (final PayloadType pt : lc.getAudioCodecs()) { for (final PayloadType pt : lc.getAudioPayloadTypes()) {
CheckBoxPreference codec = new CheckBoxPreference(getActivity()); CheckBoxPreference codec = new CheckBoxPreference(getActivity());
codec.setTitle(pt.getMime()); codec.setTitle(pt.getMimeType());
/* Special case */ /* Special case */
if (pt.getMime().equals("mpeg4-generic")) { if (pt.getMimeType().equals("mpeg4-generic")) {
if (android.os.Build.VERSION.SDK_INT < 16) { if (android.os.Build.VERSION.SDK_INT < 16) {
/* Make sure AAC is disabled */ /* Make sure AAC is disabled */
try { pt.enable(false);
lc.enablePayloadType(pt, false);
} catch (LinphoneCoreException e) {
Log.e(e);
}
continue; continue;
} else { } else {
codec.setTitle("AAC-ELD"); codec.setTitle("AAC-ELD");
} }
} }
codec.setSummary(pt.getRate() + " Hz"); codec.setSummary(pt.getClockRate() + " Hz");
codec.setChecked(lc.isPayloadTypeEnabled(pt)); codec.setDefaultValue(pt.enabled());
codec.setOnPreferenceChangeListener(new OnPreferenceChangeListener() { codec.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override @Override
public boolean onPreferenceChange(Preference preference, Object newValue) { public boolean onPreferenceChange(Preference preference, Object newValue) {
boolean enable = (Boolean) newValue; boolean enable = (Boolean) newValue;
try { pt.enable(enable);
LinphoneManager.getLcIfManagerNotDestroyedOrNull().enablePayloadType(pt, enable);
} catch (LinphoneCoreException e) {
Log.e(e);
}
return true; return true;
} }
}); });
@ -556,15 +550,15 @@ public class SettingsFragment extends PreferencesListFragment {
} }
CheckBoxPreference echoCancellation = (CheckBoxPreference) findPreference(getString(R.string.pref_echo_cancellation_key)); CheckBoxPreference echoCancellation = (CheckBoxPreference) findPreference(getString(R.string.pref_echo_cancellation_key));
echoCancellation.setChecked(mPrefs.isEchoCancellationEnabled()); echoCancellation.setChecked(mPrefs.echoCancellationEnabled());
if (mPrefs.isEchoCancellationEnabled()) { if (mPrefs.echoCancellationEnabled()) {
Preference echoCalibration = findPreference(getString(R.string.pref_echo_canceller_calibration_key)); Preference echoCalibration = findPreference(getString(R.string.pref_echo_canceller_calibration_key));
echoCalibration.setSummary(String.format(getString(R.string.ec_calibrated), mPrefs.getEchoCalibration())); echoCalibration.setSummary(String.format(getString(R.string.ec_calibrated), String.valueOf(mPrefs.getEchoCalibration())));
} }
CheckBoxPreference adaptiveRateControl = (CheckBoxPreference) findPreference(getString(R.string.pref_adaptive_rate_control_key)); CheckBoxPreference adaptiveRateControl = (CheckBoxPreference) findPreference(getString(R.string.pref_adaptive_rate_control_key));
adaptiveRateControl.setChecked(mPrefs.isAdaptiveRateControlEnabled()); adaptiveRateControl.setChecked(mPrefs.adaptiveRateControlEnabled());
ListPreference bitrateLimit = (ListPreference) findPreference(getString(R.string.pref_codec_bitrate_limit_key)); ListPreference bitrateLimit = (ListPreference) findPreference(getString(R.string.pref_codec_bitrate_limit_key));
bitrateLimit.setSummary(String.valueOf(mPrefs.getCodecBitrateLimit())); bitrateLimit.setSummary(String.valueOf(mPrefs.getCodecBitrateLimit()));
@ -594,12 +588,12 @@ public class SettingsFragment extends PreferencesListFragment {
@Override @Override
public boolean onPreferenceChange(Preference preference, Object newValue) { public boolean onPreferenceChange(Preference preference, Object newValue) {
mPrefs.setCodecBitrateLimit(Integer.parseInt(newValue.toString())); mPrefs.setCodecBitrateLimit(Integer.parseInt(newValue.toString()));
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
int bitrate = Integer.parseInt(newValue.toString()); int bitrate = Integer.parseInt(newValue.toString());
for (final PayloadType pt : lc.getAudioCodecs()) { for (final PayloadType pt : lc.getAudioPayloadTypes()) {
if (lc.payloadTypeIsVbr(pt)) { if (pt.isVbr()) {
lc.setPayloadTypeBitrate(pt, bitrate); pt.setNormalBitrate(bitrate);
} }
} }
@ -650,7 +644,7 @@ public class SettingsFragment extends PreferencesListFragment {
if (LinphoneManager.getInstance().startEchoTester() > 0) { if (LinphoneManager.getInstance().startEchoTester() > 0) {
preference.setSummary("Is running"); preference.setSummary("Is running");
} }
} catch (LinphoneCoreException e) { } catch (CoreException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -661,7 +655,7 @@ public class SettingsFragment extends PreferencesListFragment {
if (LinphoneManager.getInstance().stopEchoTester() > 0) { if (LinphoneManager.getInstance().stopEchoTester() > 0) {
preference.setSummary("Is stopped"); preference.setSummary("Is stopped");
} }
} catch (LinphoneCoreException e) { } catch (CoreException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -670,8 +664,9 @@ public class SettingsFragment extends PreferencesListFragment {
try { try {
if (LinphoneManager.getInstance().getEchoTesterStatus()) if (LinphoneManager.getInstance().getEchoTesterStatus())
stopEchoTester(); stopEchoTester();
LinphoneManager.getInstance().startEcCalibration(mListener); LinphoneManager.getLc().addListener(mListener);
} catch (LinphoneCoreException e) { LinphoneManager.getInstance().startEcCalibration();
} catch (CoreException e) {
Log.e(e); Log.e(e);
} }
} }
@ -696,19 +691,19 @@ public class SettingsFragment extends PreferencesListFragment {
PreferenceCategory codecs = (PreferenceCategory) findPreference(getString(R.string.pref_video_codecs_key)); PreferenceCategory codecs = (PreferenceCategory) findPreference(getString(R.string.pref_video_codecs_key));
codecs.removeAll(); codecs.removeAll();
final LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); final Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
final OpenH264DownloadHelper mCodecDownloader = LinphoneManager.getInstance().getOpenH264DownloadHelper(); final OpenH264DownloadHelper mCodecDownloader = LinphoneManager.getInstance().getOpenH264DownloadHelper();
for (final PayloadType pt : lc.getVideoCodecs()) { for (final PayloadType pt : lc.getVideoPayloadTypes()) {
final CheckBoxPreference codec = new CheckBoxPreference(getActivity()); final CheckBoxPreference codec = new CheckBoxPreference(getActivity());
codec.setTitle(pt.getMime()); codec.setTitle(pt.getMimeType());
if (!pt.getMime().equals("VP8")) { if (!pt.getMimeType().equals("VP8")) {
if (getResources().getBoolean(R.bool.disable_all_patented_codecs_for_markets)) { if (getResources().getBoolean(R.bool.disable_all_patented_codecs_for_markets)) {
continue; continue;
} else { } else {
if (!Version.hasFastCpuWithAsmOptim() && pt.getMime().equals("H264")) if (!Version.hasFastCpuWithAsmOptim() && pt.getMimeType().equals("H264"))
{ {
// Android without neon doesn't support H264 // Android without neon doesn't support H264
Log.w("CPU does not have asm optimisations available, disabling H264"); Log.w("CPU does not have asm optimisations available, disabling H264");
@ -716,22 +711,21 @@ public class SettingsFragment extends PreferencesListFragment {
} }
} }
} }
if (lc.downloadOpenH264Enabled()) { if (OpenH264DownloadHelper.isOpenH264DownloadEnabled()) {
if (pt.getMime().equals("H264") && mCodecDownloader.isCodecFound()) { if (pt.getMimeType().equals("H264") && mCodecDownloader.isCodecFound()) {
codec.setSummary(mCodecDownloader.getLicenseMessage()); codec.setSummary(mCodecDownloader.getLicenseMessage());
codec.setTitle("OpenH264"); codec.setTitle("OpenH264");
} }
} }
codec.setChecked(lc.isPayloadTypeEnabled(pt)); codec.setDefaultValue(pt.enabled());
codec.setOnPreferenceChangeListener(new OnPreferenceChangeListener() { codec.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override @Override
public boolean onPreferenceChange(Preference preference, Object newValue) { public boolean onPreferenceChange(Preference preference, Object newValue) {
boolean enable = (Boolean) newValue; boolean enable = (Boolean) newValue;
try { if (OpenH264DownloadHelper.isOpenH264DownloadEnabled()) {
if (lc.downloadOpenH264Enabled()) {
if (enable && Version.getCpuAbis().contains("armeabi-v7a") && !Version.getCpuAbis().contains("x86") if (enable && Version.getCpuAbis().contains("armeabi-v7a") && !Version.getCpuAbis().contains("x86")
&& pt.getMime().equals("H264") && !mCodecDownloader.isCodecFound()) { && pt.getMimeType().equals("H264") && !mCodecDownloader.isCodecFound()) {
mCodecDownloader.setOpenH264HelperListener(LinphoneManager.getInstance().getOpenH264HelperListener()); mCodecDownloader.setOpenH264HelperListener(LinphoneManager.getInstance().getOpenH264HelperListener());
mCodecDownloader.setUserData(0, LinphoneManager.getInstance().getContext()); mCodecDownloader.setUserData(0, LinphoneManager.getInstance().getContext());
mCodecDownloader.setUserData(1, codec); mCodecDownloader.setUserData(1, codec);
@ -755,10 +749,7 @@ public class SettingsFragment extends PreferencesListFragment {
}).show(); }).show();
} }
} }
LinphoneManager.getLcIfManagerNotDestroyedOrNull().enablePayloadType(pt, enable); pt.enable(enable);
} catch (LinphoneCoreException e) {
Log.e(e);
}
return true; return true;
} }
}); });
@ -885,6 +876,7 @@ public class SettingsFragment extends PreferencesListFragment {
CheckBoxPreference autoAnswer = (CheckBoxPreference) findPreference(getString(R.string.pref_auto_answer_key)); CheckBoxPreference autoAnswer = (CheckBoxPreference) findPreference(getString(R.string.pref_auto_answer_key));
CheckBoxPreference rfc2833 = (CheckBoxPreference) findPreference(getString(R.string.pref_rfc2833_dtmf_key)); CheckBoxPreference rfc2833 = (CheckBoxPreference) findPreference(getString(R.string.pref_rfc2833_dtmf_key));
CheckBoxPreference sipInfo = (CheckBoxPreference) findPreference(getString(R.string.pref_sipinfo_dtmf_key)); CheckBoxPreference sipInfo = (CheckBoxPreference) findPreference(getString(R.string.pref_sipinfo_dtmf_key));
CheckBoxPreference dialerCall = (CheckBoxPreference) findPreference(getString(R.string.pref_dialer_call_key));
EditTextPreference incTimeout = (EditTextPreference) findPreference(getString(R.string.pref_incoming_call_timeout_key)); EditTextPreference incTimeout = (EditTextPreference) findPreference(getString(R.string.pref_incoming_call_timeout_key));
EditTextPreference autoAnswerTime = (EditTextPreference) findPreference(getString(R.string.pref_auto_answer_time_key)); EditTextPreference autoAnswerTime = (EditTextPreference) findPreference(getString(R.string.pref_auto_answer_time_key));
@ -904,6 +896,7 @@ public class SettingsFragment extends PreferencesListFragment {
} }
setPreferenceDefaultValueAndSummary(R.string.pref_voice_mail_key, mPrefs.getVoiceMailUri()); setPreferenceDefaultValueAndSummary(R.string.pref_voice_mail_key, mPrefs.getVoiceMailUri());
dialerCall.setChecked(mPrefs.getNativeDialerCall());
} }
public void enableDeviceRingtone(boolean enabled) { public void enableDeviceRingtone(boolean enabled) {
@ -997,6 +990,15 @@ public class SettingsFragment extends PreferencesListFragment {
} }
}); });
findPreference(getString(R.string.pref_dialer_call_key)).setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
boolean use = (Boolean) newValue;
mPrefs.setNativeDialerCall(use);
return true;
}
});
findPreference(getString(R.string.pref_incoming_call_timeout_key)).setOnPreferenceChangeListener(new OnPreferenceChangeListener() { findPreference(getString(R.string.pref_incoming_call_timeout_key)).setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override @Override
public boolean onPreferenceChange(Preference preference, Object newValue) { public boolean onPreferenceChange(Preference preference, Object newValue) {
@ -1044,20 +1046,20 @@ public class SettingsFragment extends PreferencesListFragment {
@Override @Override
public boolean onPreferenceChange(Preference preference, Object newValue) { public boolean onPreferenceChange(Preference preference, Object newValue) {
String value = newValue.toString(); String value = newValue.toString();
LinphoneLimeState lime = LinphoneLimeState.Disabled; LimeState lime = LimeState.Disabled;
if (value.equals(LinphoneLimeState.Mandatory.toString())) if (value.equals(LimeState.Mandatory.toString()))
lime = LinphoneLimeState.Mandatory; lime = LimeState.Mandatory;
else if (value.equals(LinphoneLimeState.Preferred.toString())) else if (value.equals(LimeState.Preferred.toString()))
lime = LinphoneLimeState.Preferred; lime = LimeState.Preferred;
mPrefs.setLimeEncryption(lime); mPrefs.enableLime(lime);
lime = mPrefs.getLimeEncryption(); lime = mPrefs.limeEnabled();
if (lime == LinphoneLimeState.Disabled) { if (lime == LimeState.Disabled) {
preference.setSummary(getString(R.string.lime_encryption_entry_disabled)); preference.setSummary(getString(R.string.lime_encryption_entry_disabled));
} else if (lime == LinphoneLimeState.Mandatory) { } else if (lime == LimeState.Mandatory) {
setEncryptionZrtp(); setEncryptionZrtp();
preference.setSummary(getString(R.string.lime_encryption_entry_mandatory)); preference.setSummary(getString(R.string.lime_encryption_entry_mandatory));
} else if (lime == LinphoneLimeState.Preferred) { } else if (lime == LimeState.Preferred) {
setEncryptionZrtp(); setEncryptionZrtp();
preference.setSummary(getString(R.string.lime_encryption_entry_preferred)); preference.setSummary(getString(R.string.lime_encryption_entry_preferred));
} }
@ -1070,8 +1072,6 @@ public class SettingsFragment extends PreferencesListFragment {
private void initNetworkSettings() { private void initNetworkSettings() {
((CheckBoxPreference) findPreference(getString(R.string.pref_wifi_only_key))).setChecked(mPrefs.isWifiOnlyEnabled()); ((CheckBoxPreference) findPreference(getString(R.string.pref_wifi_only_key))).setChecked(mPrefs.isWifiOnlyEnabled());
((CheckBoxPreference) findPreference(getString(R.string.pref_doze_mode_key))).setChecked(mPrefs.isDozeModeEnabled());
// Disable UPnP if ICE si enabled, or disable ICE if UPnP is enabled // Disable UPnP if ICE si enabled, or disable ICE if UPnP is enabled
CheckBoxPreference ice = (CheckBoxPreference) findPreference(getString(R.string.pref_ice_enable_key)); CheckBoxPreference ice = (CheckBoxPreference) findPreference(getString(R.string.pref_ice_enable_key));
CheckBoxPreference turn = (CheckBoxPreference) findPreference(getString(R.string.pref_turn_enable_key)); CheckBoxPreference turn = (CheckBoxPreference) findPreference(getString(R.string.pref_turn_enable_key));
@ -1112,15 +1112,6 @@ public class SettingsFragment extends PreferencesListFragment {
} }
}); });
findPreference(getString(R.string.pref_doze_mode_key)).setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
mPrefs.enableDozeMode((Boolean) newValue);
LinphoneManager.getInstance().dozeManager((Boolean) newValue);
return true;
}
});
findPreference(getString(R.string.pref_stun_server_key)).setOnPreferenceChangeListener(new OnPreferenceChangeListener() { findPreference(getString(R.string.pref_stun_server_key)).setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override @Override
public boolean onPreferenceChange(Preference preference, Object newValue) { public boolean onPreferenceChange(Preference preference, Object newValue) {
@ -1350,9 +1341,11 @@ public class SettingsFragment extends PreferencesListFragment {
@Override @Override
public void onPause() { public void onPause() {
if (LinphoneActivity.isInstanciated() && LinphoneManager.isInstanciated()) {
if (LinphoneManager.getInstance().getEchoTesterStatus()) if (LinphoneManager.getInstance().getEchoTesterStatus())
stopEchoTester(); stopEchoTester();
LinphoneActivity.instance().hideTopBar(); LinphoneActivity.instance().hideTopBar();
}
super.onPause(); super.onPause();
} }
} }

View file

@ -1,7 +1,7 @@
package org.linphone; package org.linphone;
/* /*
StatusFragment.java StatusFragment.java
Copyright (C) 2012 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -18,15 +18,15 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
import org.linphone.assistant.AssistantActivity; import org.linphone.assistant.AssistantActivity;
import org.linphone.core.CallDirection; import org.linphone.core.Call.Dir;
import org.linphone.core.LinphoneCall; import org.linphone.core.Call;
import org.linphone.core.LinphoneContent; import org.linphone.core.Content;
import org.linphone.core.LinphoneCore; import org.linphone.core.Core;
import org.linphone.core.LinphoneCore.MediaEncryption; import org.linphone.core.Core.MediaEncryption;
import org.linphone.core.LinphoneCore.RegistrationState; import org.linphone.core.Core.RegistrationState;
import org.linphone.core.LinphoneCoreListenerBase; import org.linphone.core.CoreListenerStub;
import org.linphone.core.LinphoneEvent; import org.linphone.core.Event;
import org.linphone.core.LinphoneProxyConfig; import org.linphone.core.ProxyConfig;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
import android.app.Activity; import android.app.Activity;
@ -48,16 +48,13 @@ import android.widget.Button;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
/**
* @author Sylvain Berfini
*/
public class StatusFragment extends Fragment { public class StatusFragment extends Fragment {
private Handler refreshHandler = new Handler(); private Handler refreshHandler = new Handler();
private TextView statusText, voicemailCount; private TextView statusText, voicemailCount;
private ImageView statusLed, callQuality, encryption, menu, voicemail; private ImageView statusLed, callQuality, encryption, menu, voicemail;
private Runnable mCallQualityUpdater; private Runnable mCallQualityUpdater;
private boolean isInCall, isAttached = false, isZrtpAsk; private boolean isInCall, isAttached = false, isZrtpAsk;
private LinphoneCoreListenerBase mListener; private CoreListenerStub mListener;
private Dialog ZRTPdialog = null; private Dialog ZRTPdialog = null;
private int mDisplayedQuality = -1; private int mDisplayedQuality = -1;
@ -77,9 +74,9 @@ public class StatusFragment extends Fragment {
// We create it once to not delay the first display // We create it once to not delay the first display
populateSliderContent(); populateSliderContent();
mListener = new LinphoneCoreListenerBase(){ mListener = new CoreListenerStub(){
@Override @Override
public void registrationState(final LinphoneCore lc, final LinphoneProxyConfig proxy, final LinphoneCore.RegistrationState state, String smessage) { public void onRegistrationStateChanged(final Core lc, final ProxyConfig proxy, final Core.RegistrationState state, String smessage) {
if (!isAttached || !LinphoneService.isReady()) { if (!isAttached || !LinphoneService.isReady()) {
return; return;
} }
@ -110,15 +107,15 @@ public class StatusFragment extends Fragment {
} }
@Override @Override
public void notifyReceived(LinphoneCore lc, LinphoneEvent ev, String eventName, LinphoneContent content) { public void onNotifyReceived(Core lc, Event ev, String eventName, Content content) {
if(!content.getType().equals("application")) return; if(!content.getType().equals("application")) return;
if(!content.getSubtype().equals("simple-message-summary")) return; if(!content.getSubtype().equals("simple-message-summary")) return;
if (content.getData() == null) return; if (content.getSize() == 0) return;
int unreadCount = -1; int unreadCount = -1;
String data = content.getDataAsString(); String data = content.getStringBuffer();
String[] voiceMail = data.split("voice-message: "); String[] voiceMail = data.split("voice-message: ");
final String[] intToParse = voiceMail[1].split("/",0); final String[] intToParse = voiceMail[1].split("/",0);
@ -152,14 +149,14 @@ public class StatusFragment extends Fragment {
return view; return view;
} }
public void setLinphoneCoreListener() { public void setCoreListener() {
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) { if (lc != null) {
lc.addListener(mListener); lc.addListener(mListener);
LinphoneProxyConfig lpc = lc.getDefaultProxyConfig(); ProxyConfig lpc = lc.getDefaultProxyConfig();
if (lpc != null) { if (lpc != null) {
mListener.registrationState(lc, lpc, lpc.getState(), null); mListener.onRegistrationStateChanged(lc, lpc, lpc.getState(), null);
} }
} }
} }
@ -177,7 +174,7 @@ public class StatusFragment extends Fragment {
voicemailCount.setVisibility(View.GONE); voicemailCount.setVisibility(View.GONE);
if (isInCall && isAttached) { if (isInCall && isAttached) {
//LinphoneCall call = LinphoneManager.getLc().getCurrentCall(); //Call call = LinphoneManager.getLc().getCurrentCall();
//initCallStatsRefresher(call, callStats); //initCallStatsRefresher(call, callStats);
} else if (!isInCall) { } else if (!isInCall) {
voicemailCount.setVisibility(View.VISIBLE); voicemailCount.setVisibility(View.VISIBLE);
@ -201,15 +198,15 @@ public class StatusFragment extends Fragment {
menu.setEnabled(enabled); menu.setEnabled(enabled);
} }
private int getStatusIconResource(LinphoneCore.RegistrationState state, boolean isDefaultAccount) { private int getStatusIconResource(Core.RegistrationState state, boolean isDefaultAccount) {
try { try {
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
boolean defaultAccountConnected = (isDefaultAccount && lc != null && lc.getDefaultProxyConfig() != null && lc.getDefaultProxyConfig().isRegistered()) || !isDefaultAccount; boolean defaultAccountConnected = (isDefaultAccount && lc != null && lc.getDefaultProxyConfig() != null && lc.getDefaultProxyConfig().getState() == RegistrationState.Ok) || !isDefaultAccount;
if (state == RegistrationState.RegistrationOk && defaultAccountConnected) { if (state == RegistrationState.Ok && defaultAccountConnected) {
return R.drawable.led_connected; return R.drawable.led_connected;
} else if (state == RegistrationState.RegistrationProgress) { } else if (state == RegistrationState.Progress) {
return R.drawable.led_inprogress; return R.drawable.led_inprogress;
} else if (state == RegistrationState.RegistrationFailed) { } else if (state == RegistrationState.Failed) {
return R.drawable.led_error; return R.drawable.led_error;
} else { } else {
return R.drawable.led_disconnected; return R.drawable.led_disconnected;
@ -221,7 +218,7 @@ public class StatusFragment extends Fragment {
return R.drawable.led_disconnected; return R.drawable.led_disconnected;
} }
private String getStatusIconText(LinphoneCore.RegistrationState state) { private String getStatusIconText(Core.RegistrationState state) {
Context context = getActivity(); Context context = getActivity();
if (!isAttached && LinphoneActivity.isInstanciated()) if (!isAttached && LinphoneActivity.isInstanciated())
context = LinphoneActivity.instance(); context = LinphoneActivity.instance();
@ -229,11 +226,11 @@ public class StatusFragment extends Fragment {
context = LinphoneService.instance(); context = LinphoneService.instance();
try { try {
if (state == RegistrationState.RegistrationOk && LinphoneManager.getLcIfManagerNotDestroyedOrNull().getDefaultProxyConfig().isRegistered()) { if (state == RegistrationState.Ok && LinphoneManager.getLcIfManagerNotDestroyedOrNull().getDefaultProxyConfig().getState() == RegistrationState.Ok) {
return context.getString(R.string.status_connected); return context.getString(R.string.status_connected);
} else if (state == RegistrationState.RegistrationProgress) { } else if (state == RegistrationState.Progress) {
return context.getString(R.string.status_in_progress); return context.getString(R.string.status_in_progress);
} else if (state == RegistrationState.RegistrationFailed) { } else if (state == RegistrationState.Failed) {
return context.getString(R.string.status_error); return context.getString(R.string.status_error);
} else { } else {
return context.getString(R.string.status_not_connected); return context.getString(R.string.status_not_connected);
@ -249,7 +246,7 @@ public class StatusFragment extends Fragment {
private void startCallQuality() { private void startCallQuality() {
callQuality.setVisibility(View.VISIBLE); callQuality.setVisibility(View.VISIBLE);
refreshHandler.postDelayed(mCallQualityUpdater = new Runnable() { refreshHandler.postDelayed(mCallQualityUpdater = new Runnable() {
LinphoneCall mCurrentCall = LinphoneManager.getLc() Call mCurrentCall = LinphoneManager.getLc()
.getCurrentCall(); .getCurrentCall();
public void run() { public void run() {
@ -300,19 +297,19 @@ public class StatusFragment extends Fragment {
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) { if (lc != null) {
lc.addListener(mListener); lc.addListener(mListener);
LinphoneProxyConfig lpc = lc.getDefaultProxyConfig(); ProxyConfig lpc = lc.getDefaultProxyConfig();
if (lpc != null) { if (lpc != null) {
mListener.registrationState(lc, lpc, lpc.getState(), null); mListener.onRegistrationStateChanged(lc, lpc, lpc.getState(), null);
} }
LinphoneCall call = lc.getCurrentCall(); Call call = lc.getCurrentCall();
if (isInCall && (call != null || lc.getConferenceSize() > 1 || lc.getCallsNb() > 0)) { if (isInCall && (call != null || lc.getConferenceSize() > 1 || lc.getCallsNb() > 0)) {
if (call != null) { if (call != null) {
startCallQuality(); startCallQuality();
refreshStatusItems(call, call.getCurrentParams().getVideoEnabled()); refreshStatusItems(call, call.getCurrentParams().videoEnabled());
} }
menu.setVisibility(View.INVISIBLE); menu.setVisibility(View.INVISIBLE);
encryption.setVisibility(View.VISIBLE); encryption.setVisibility(View.VISIBLE);
@ -337,7 +334,7 @@ public class StatusFragment extends Fragment {
public void onPause() { public void onPause() {
super.onPause(); super.onPause();
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) { if (lc != null) {
lc.removeListener(mListener); lc.removeListener(mListener);
} }
@ -348,7 +345,7 @@ public class StatusFragment extends Fragment {
} }
} }
public void refreshStatusItems(final LinphoneCall call, boolean isVideoEnabled) { public void refreshStatusItems(final Call call, boolean isVideoEnabled) {
if (call != null) { if (call != null) {
voicemailCount.setVisibility(View.GONE); voicemailCount.setVisibility(View.GONE);
MediaEncryption mediaEncryption = call.getCurrentParams().getMediaEncryption(); MediaEncryption mediaEncryption = call.getCurrentParams().getMediaEncryption();
@ -359,9 +356,9 @@ public class StatusFragment extends Fragment {
//background.setVisibility(View.VISIBLE); //background.setVisibility(View.VISIBLE);
} }
if (mediaEncryption == MediaEncryption.SRTP || (mediaEncryption == MediaEncryption.ZRTP && call.isAuthenticationTokenVerified()) || mediaEncryption == MediaEncryption.DTLS) { if (mediaEncryption == MediaEncryption.SRTP || (mediaEncryption == MediaEncryption.ZRTP && call.getAuthenticationTokenVerified()) || mediaEncryption == MediaEncryption.DTLS) {
encryption.setImageResource(R.drawable.security_ok); encryption.setImageResource(R.drawable.security_ok);
} else if (mediaEncryption == MediaEncryption.ZRTP && !call.isAuthenticationTokenVerified()) { } else if (mediaEncryption == MediaEncryption.ZRTP && !call.getAuthenticationTokenVerified()) {
encryption.setImageResource(R.drawable.security_pending); encryption.setImageResource(R.drawable.security_pending);
} else { } else {
encryption.setImageResource(R.drawable.security_ko); encryption.setImageResource(R.drawable.security_ko);
@ -380,7 +377,7 @@ public class StatusFragment extends Fragment {
} }
} }
public void showZRTPDialog(final LinphoneCall call) { public void showZRTPDialog(final Call call) {
if (getActivity() == null) { if (getActivity() == null) {
Log.w("Can't display ZRTP popup, no Activity"); Log.w("Can't display ZRTP popup, no Activity");
return; return;
@ -408,7 +405,7 @@ public class StatusFragment extends Fragment {
String zrtpToRead, zrtpToListen; String zrtpToRead, zrtpToListen;
isZrtpAsk = true; isZrtpAsk = true;
if (call.getDirection().equals(CallDirection.Incoming)) { if (call.getDir().equals(Call.Dir.Incoming)) {
zrtpToRead = token.substring(0,2); zrtpToRead = token.substring(0,2);
zrtpToListen = token.substring(2); zrtpToListen = token.substring(2);
} else { } else {

View file

@ -1,6 +1,8 @@
package org.linphone;
/* /*
UIThreadDispatcher.java UIThreadDispatcher.java
Copyright (C) 2014 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -16,7 +18,6 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
package org.linphone;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;

View file

@ -1,7 +1,7 @@
package org.linphone.assistant; package org.linphone.assistant;
/* /*
AssistantActivity.java AssistantActivity.java
Copyright (C) 2015 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -32,20 +32,21 @@ import org.linphone.LinphoneService;
import org.linphone.LinphoneUtils; import org.linphone.LinphoneUtils;
import org.linphone.R; import org.linphone.R;
import org.linphone.StatusFragment; import org.linphone.StatusFragment;
import org.linphone.core.AccountCreatorListener;
import org.linphone.core.DialPlan; import org.linphone.core.DialPlan;
import org.linphone.core.LinphoneAccountCreator; import org.linphone.core.AccountCreator;
import org.linphone.core.LinphoneAddress; import org.linphone.core.Address;
import org.linphone.core.LinphoneAddress.TransportType; import org.linphone.core.Address.TransportType;
import org.linphone.core.LinphoneAuthInfo; import org.linphone.core.AuthInfo;
import org.linphone.core.LinphoneCore; import org.linphone.core.Core;
import org.linphone.core.LinphoneCore.RegistrationState; import org.linphone.core.Core.RegistrationState;
import org.linphone.core.LinphoneCoreException; import org.linphone.core.CoreException;
import org.linphone.core.LinphoneCoreFactory; import org.linphone.core.Factory;
import org.linphone.core.LinphoneCoreListenerBase; import org.linphone.core.CoreListenerStub;
import org.linphone.core.LinphoneProxyConfig; import org.linphone.core.ProxyConfig;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
import org.linphone.mediastream.Version; import org.linphone.mediastream.Version;
import org.linphone.tools.OpenH264DownloadHelper; import org.linphone.core.tools.OpenH264DownloadHelper;
import android.Manifest; import android.Manifest;
import android.app.Activity; import android.app.Activity;
@ -81,10 +82,7 @@ import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
/** public class AssistantActivity extends Activity implements OnClickListener, ActivityCompat.OnRequestPermissionsResultCallback, AccountCreatorListener {
* @author Sylvain Berfini
*/
public class AssistantActivity extends Activity implements OnClickListener, ActivityCompat.OnRequestPermissionsResultCallback, LinphoneAccountCreator.LinphoneAccountCreatorListener {
private static AssistantActivity instance; private static AssistantActivity instance;
private ImageView back, cancel; private ImageView back, cancel;
private AssistantFragmentsEnum currentFragment; private AssistantFragmentsEnum currentFragment;
@ -93,15 +91,15 @@ private static AssistantActivity instance;
private Fragment fragment; private Fragment fragment;
private LinphonePreferences mPrefs; private LinphonePreferences mPrefs;
private boolean accountCreated = false, newAccount = false, isLink = false, fromPref = false; private boolean accountCreated = false, newAccount = false, isLink = false, fromPref = false;
private LinphoneCoreListenerBase mListener; private CoreListenerStub mListener;
private LinphoneAddress address; private Address address;
private StatusFragment status; private StatusFragment status;
private ProgressDialog progress; private ProgressDialog progress;
private Dialog dialog; private Dialog dialog;
private boolean remoteProvisioningInProgress; private boolean remoteProvisioningInProgress;
private boolean echoCancellerAlreadyDone; private boolean echoCancellerAlreadyDone;
private static final int PERMISSIONS_REQUEST_RECORD_AUDIO = 201; private static final int PERMISSIONS_REQUEST_RECORD_AUDIO = 201;
private LinphoneAccountCreator accountCreator; private AccountCreator accountCreator;
private CountryListAdapter countryListAdapter; private CountryListAdapter countryListAdapter;
public DialPlan country; public DialPlan country;
@ -141,49 +139,49 @@ private static AssistantActivity instance;
mPrefs = LinphonePreferences.instance(); mPrefs = LinphonePreferences.instance();
status.enableSideMenu(false); status.enableSideMenu(false);
accountCreator = LinphoneCoreFactory.instance().createAccountCreator(LinphoneManager.getLc(), LinphonePreferences.instance().getXmlrpcUrl()); accountCreator = LinphoneManager.getLc().createAccountCreator(LinphonePreferences.instance().getXmlrpcUrl());
accountCreator.setListener(this); accountCreator.setListener(this);
countryListAdapter = new CountryListAdapter(getApplicationContext()); countryListAdapter = new CountryListAdapter(getApplicationContext());
mListener = new LinphoneCoreListenerBase() { mListener = new CoreListenerStub() {
@Override @Override
public void configuringStatus(LinphoneCore lc, final LinphoneCore.RemoteProvisioningState state, String message) { public void onConfiguringStatus(Core lc, final Core.ConfiguringState state, String message) {
if (progress != null) progress.dismiss(); if (progress != null) progress.dismiss();
if (state == LinphoneCore.RemoteProvisioningState.ConfiguringSuccessful) { if (state == Core.ConfiguringState.Successful) {
goToLinphoneActivity(); goToLinphoneActivity();
} else if (state == LinphoneCore.RemoteProvisioningState.ConfiguringFailed) { } else if (state == Core.ConfiguringState.Failed) {
Toast.makeText(AssistantActivity.instance(), getString(R.string.remote_provisioning_failure), Toast.LENGTH_LONG).show(); Toast.makeText(AssistantActivity.instance(), getString(R.string.remote_provisioning_failure), Toast.LENGTH_LONG).show();
} }
} }
@Override @Override
public void registrationState(LinphoneCore lc, LinphoneProxyConfig cfg, RegistrationState state, String smessage) { public void onRegistrationStateChanged(Core lc, ProxyConfig cfg, RegistrationState state, String smessage) {
if (remoteProvisioningInProgress) { if (remoteProvisioningInProgress) {
if (progress != null) progress.dismiss(); if (progress != null) progress.dismiss();
if (state == RegistrationState.RegistrationOk) { if (state == RegistrationState.Ok) {
remoteProvisioningInProgress = false; remoteProvisioningInProgress = false;
success(); success();
} }
} else if (accountCreated && !newAccount){ } else if (accountCreated && !newAccount){
if (address != null && address.asString().equals(cfg.getAddress().asString()) ) { if (address != null && address.asString().equals(cfg.getIdentityAddress().asString()) ) {
if (state == RegistrationState.RegistrationOk) { if (state == RegistrationState.Ok) {
if (progress != null) progress.dismiss(); if (progress != null) progress.dismiss();
if (getResources().getBoolean(R.bool.use_phone_number_validation) if (getResources().getBoolean(R.bool.use_phone_number_validation)
&& cfg.getDomain().equals(getString(R.string.default_domain)) && cfg.getDomain().equals(getString(R.string.default_domain))
&& LinphoneManager.getLc().getDefaultProxyConfig() != null) { && LinphoneManager.getLc().getDefaultProxyConfig() != null) {
accountCreator.isAccountUsed(); accountCreator.isAccountExist();
} else { } else {
success(); success();
} }
} else if (state == RegistrationState.RegistrationFailed) { } else if (state == RegistrationState.Failed) {
if (progress != null) progress.dismiss(); if (progress != null) progress.dismiss();
if (dialog == null || !dialog.isShowing()) { if (dialog == null || !dialog.isShowing()) {
dialog = createErrorDialog(cfg, smessage); dialog = createErrorDialog(cfg, smessage);
dialog.setCancelable(false); dialog.setCancelable(false);
dialog.show(); dialog.show();
} }
} else if(!(state == RegistrationState.RegistrationProgress)) { } else if(!(state == RegistrationState.Progress)) {
if (progress != null) progress.dismiss(); if (progress != null) progress.dismiss();
} }
} }
@ -197,7 +195,7 @@ private static AssistantActivity instance;
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) { if (lc != null) {
lc.addListener(mListener); lc.addListener(mListener);
} }
@ -205,7 +203,7 @@ private static AssistantActivity instance;
@Override @Override
protected void onPause() { protected void onPause() {
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) { if (lc != null) {
lc.removeListener(mListener); lc.removeListener(mListener);
} }
@ -347,36 +345,35 @@ private static AssistantActivity instance;
} }
} }
public void configureLinphoneProxyConfig(LinphoneAccountCreator accountCreator) { public void configureProxyConfig(AccountCreator accountCreator) {
LinphoneCore lc = LinphoneManager.getLc(); Core lc = LinphoneManager.getLc();
LinphoneProxyConfig proxyConfig = lc.createProxyConfig(); ProxyConfig proxyConfig = lc.createProxyConfig();
LinphoneAddress addr; Address addr;
LinphoneAuthInfo authInfo; AuthInfo authInfo;
try { String identity = proxyConfig.getIdentityAddress().asStringUriOnly();
String identity = proxyConfig.getIdentity();
if (identity == null || accountCreator.getUsername() == null) { if (identity == null || accountCreator.getUsername() == null) {
LinphoneUtils.displayErrorAlert(getString(R.string.error), this); LinphoneUtils.displayErrorAlert(getString(R.string.error), this);
return; return;
} }
identity = identity.replace("?", accountCreator.getUsername()); identity = identity.replace("?", accountCreator.getUsername());
addr = LinphoneCoreFactory.instance().createLinphoneAddress(identity); addr = Factory.instance().createAddress(identity);
addr.setDisplayName(accountCreator.getUsername()); addr.setDisplayName(accountCreator.getUsername());
address = addr; address = addr;
proxyConfig.edit(); proxyConfig.edit();
proxyConfig.setIdentity(addr.asString()); proxyConfig.setIdentityAddress(addr);
if (LinphonePreferences.instance() != null) if (LinphonePreferences.instance() != null)
proxyConfig.setContactUriParameters(LinphonePreferences.instance().getPushNotificationRegistrationID()); proxyConfig.setContactUriParameters(LinphonePreferences.instance().getPushNotificationRegistrationID());
if (accountCreator.getPhoneNumber() != null && accountCreator.getPhoneNumber().length() > 0) if (accountCreator.getPhoneNumber() != null && accountCreator.getPhoneNumber().length() > 0)
proxyConfig.setDialPrefix(accountCreator.getPrefix(accountCreator.getPhoneNumber())); proxyConfig.setDialPrefix(org.linphone.core.Utils.getPrefixFromE164(accountCreator.getPhoneNumber()));
proxyConfig.done(); proxyConfig.done();
authInfo = LinphoneCoreFactory.instance().createAuthInfo( authInfo = Factory.instance().createAuthInfo(
accountCreator.getUsername(), accountCreator.getUsername(),
null, null,
accountCreator.getPassword(), accountCreator.getPassword(),
@ -403,14 +400,11 @@ private static AssistantActivity instance;
displayRegistrationInProgressDialog(); displayRegistrationInProgressDialog();
} }
accountCreated = true; accountCreated = true;
} catch (LinphoneCoreException e) {
Log.e("Can't configure proxy config ", e);
}
} }
public void linphoneLogIn(LinphoneAccountCreator accountCreator) { public void linphoneLogIn(AccountCreator accountCreator) {
LinphoneManager.getLc().getConfig().loadXmlFile(LinphoneManager.getInstance().getmDynamicConfigFile()); LinphoneManager.getLc().getConfig().loadFromXmlFile(LinphoneManager.getInstance().getmDynamicConfigFile());
configureLinphoneProxyConfig(accountCreator); configureProxyConfig(accountCreator);
} }
public void genericLogIn(String username, String userid, String password, String prefix, String domain, TransportType transport) { public void genericLogIn(String username, String userid, String password, String prefix, String domain, TransportType transport) {
@ -485,8 +479,8 @@ private static AssistantActivity instance;
} }
private void launchDownloadCodec() { private void launchDownloadCodec() {
if (LinphoneManager.getLc().downloadOpenH264Enabled()) { if (OpenH264DownloadHelper.isOpenH264DownloadEnabled()) {
OpenH264DownloadHelper downloadHelper = LinphoneCoreFactory.instance().createOpenH264DownloadHelper(); OpenH264DownloadHelper downloadHelper = Factory.instance().createOpenH264DownloadHelper(this);
if (Version.getCpuAbis().contains("armeabi-v7a") && !Version.getCpuAbis().contains("x86") && !downloadHelper.isCodecFound()) { if (Version.getCpuAbis().contains("armeabi-v7a") && !Version.getCpuAbis().contains("x86") && !downloadHelper.isCodecFound()) {
CodecDownloaderFragment codecFragment = new CodecDownloaderFragment(); CodecDownloaderFragment codecFragment = new CodecDownloaderFragment();
changeFragment(codecFragment); changeFragment(codecFragment);
@ -506,7 +500,7 @@ private static AssistantActivity instance;
public String getPhoneWithCountry() { public String getPhoneWithCountry() {
if(country == null || phone_number == null) return ""; if(country == null || phone_number == null) return "";
String phoneNumberWithCountry = country.getCountryCode() + phone_number.replace("\\D", ""); String phoneNumberWithCountry = country.getCountryCallingCode() + phone_number.replace("\\D", "");
return phoneNumberWithCountry; return phoneNumberWithCountry;
} }
@ -516,17 +510,13 @@ private static AssistantActivity instance;
domain = LinphoneUtils.getDisplayableUsernameFromAddress(domain); domain = LinphoneUtils.getDisplayableUsernameFromAddress(domain);
String identity = "sip:" + username + "@" + domain; String identity = "sip:" + username + "@" + domain;
try { address = Factory.instance().createAddress(identity);
address = LinphoneCoreFactory.instance().createLinphoneAddress(identity);
} catch (LinphoneCoreException e) {
Log.e(e);
}
AccountBuilder builder = new AccountBuilder(LinphoneManager.getLc()) AccountBuilder builder = new AccountBuilder(LinphoneManager.getLc())
.setUsername(username) .setUsername(username)
.setDomain(domain) .setDomain(domain)
.setHa1(ha1) .setHa1(ha1)
.setUserId(userid) .setUserid(userid)
.setPassword(password); .setPassword(password);
if (prefix != null) { if (prefix != null) {
@ -535,9 +525,9 @@ private static AssistantActivity instance;
String forcedProxy = ""; String forcedProxy = "";
if (!TextUtils.isEmpty(forcedProxy)) { if (!TextUtils.isEmpty(forcedProxy)) {
builder.setProxy(forcedProxy) builder.setServerAddr(forcedProxy)
.setOutboundProxyEnabled(true) .setOutboundProxyEnabled(true)
.setAvpfRRInterval(5); .setAvpfRrInterval(5);
} }
if (transport != null) { if (transport != null) {
builder.setTransport(transport); builder.setTransport(transport);
@ -549,7 +539,7 @@ private static AssistantActivity instance;
displayRegistrationInProgressDialog(); displayRegistrationInProgressDialog();
} }
accountCreated = true; accountCreated = true;
} catch (LinphoneCoreException e) { } catch (CoreException e) {
Log.e(e); Log.e(e);
} }
} }
@ -631,7 +621,7 @@ private static AssistantActivity instance;
launchDownloadCodec(); launchDownloadCodec();
} }
public Dialog createErrorDialog(LinphoneProxyConfig proxy, String message){ public Dialog createErrorDialog(ProxyConfig proxy, String message){
AlertDialog.Builder builder = new AlertDialog.Builder(this); AlertDialog.Builder builder = new AlertDialog.Builder(this);
if(message.equals("Forbidden")) { if(message.equals("Forbidden")) {
message = getString(R.string.assistant_error_bad_credentials); message = getString(R.string.assistant_error_bad_credentials);
@ -655,7 +645,7 @@ private static AssistantActivity instance;
} }
public void success() { public void success() {
boolean needsEchoCalibration = LinphoneManager.getLc().needsEchoCalibration(); boolean needsEchoCalibration = LinphoneManager.getLc().isEchoCancellerCalibrationRequired();
if (needsEchoCalibration && mPrefs.isFirstLaunch()) { if (needsEchoCalibration && mPrefs.isFirstLaunch()) {
launchEchoCancellerCalibration(true); launchEchoCancellerCalibration(true);
} else { } else {
@ -669,13 +659,13 @@ private static AssistantActivity instance;
finish(); finish();
} }
public void setLinphoneCoreListener() { public void setCoreListener() {
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) { if (lc != null) {
lc.addListener(mListener); lc.addListener(mListener);
} }
if (status != null) { if (status != null) {
status.setLinphoneCoreListener(); status.setCoreListener();
} }
} }
@ -695,8 +685,8 @@ private static AssistantActivity instance;
} }
@Override @Override
public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onIsAccountExist(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
if(status.equals(LinphoneAccountCreator.RequestStatus.AccountExistWithAlias)){ if(status.equals(AccountCreator.Status.AccountExistWithAlias)){
success(); success();
} else { } else {
isLink = true; isLink = true;
@ -706,47 +696,47 @@ private static AssistantActivity instance;
} }
@Override @Override
public void onAccountCreatorAccountCreated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onCreateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
@Override @Override
public void onAccountCreatorAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onActivateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
@Override @Override
public void onAccountCreatorAccountLinkedWithPhoneNumber(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onLinkAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
@Override @Override
public void onAccountCreatorPhoneNumberLinkActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onActivateAlias(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
@Override @Override
public void onAccountCreatorIsAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onIsAccountActivated(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
@Override @Override
public void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onRecoverAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
@Override @Override
public void onAccountCreatorIsAccountLinked(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onIsAccountLinked(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
@Override @Override
public void onAccountCreatorIsPhoneNumberUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onIsAliasUsed(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
@Override @Override
public void onAccountCreatorPasswordUpdated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onUpdateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
@ -767,7 +757,7 @@ private static AssistantActivity instance;
public CountryListAdapter(Context ctx) { public CountryListAdapter(Context ctx) {
context = ctx; context = ctx;
allCountries = LinphoneCoreFactory.instance().getAllDialPlan(); allCountries = Factory.instance().getDialPlans();
filteredCountries = new ArrayList<DialPlan>(Arrays.asList(allCountries)); filteredCountries = new ArrayList<DialPlan>(Arrays.asList(allCountries));
} }
@ -813,7 +803,7 @@ private static AssistantActivity instance;
DialPlan c = filteredCountries.get(position); DialPlan c = filteredCountries.get(position);
TextView name = (TextView) view.findViewById(R.id.country_name); TextView name = (TextView) view.findViewById(R.id.country_name);
name.setText(c.getCountryName()); name.setText(c.getCountry());
TextView dial_code = (TextView) view.findViewById(R.id.country_prefix); TextView dial_code = (TextView) view.findViewById(R.id.country_prefix);
if (context != null) if (context != null)
@ -830,7 +820,7 @@ private static AssistantActivity instance;
protected FilterResults performFiltering(CharSequence constraint) { protected FilterResults performFiltering(CharSequence constraint) {
ArrayList<DialPlan> filteredCountries = new ArrayList<DialPlan>(); ArrayList<DialPlan> filteredCountries = new ArrayList<DialPlan>();
for (DialPlan c : allCountries) { for (DialPlan c : allCountries) {
if (c.getCountryName().toLowerCase().contains(constraint) if (c.getCountry().toLowerCase().contains(constraint)
|| c.getCountryCallingCode().contains(constraint)) { || c.getCountryCallingCode().contains(constraint)) {
filteredCountries.add(c); filteredCountries.add(c);
} }

View file

@ -1,7 +1,7 @@
package org.linphone.assistant; package org.linphone.assistant;
/* /*
AssistantFragmentsEnum.java AssistantFragmentsEnum.java
Copyright (C) 2015 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -17,9 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
/**
* @author Sylvain Berfini
*/
public enum AssistantFragmentsEnum { public enum AssistantFragmentsEnum {
WELCOME, WELCOME,
CREATE_ACCOUNT, CREATE_ACCOUNT,

View file

@ -2,7 +2,7 @@ package org.linphone.assistant;
/* /*
CodecDownloaderFragment.java CodecDownloaderFragment.java
Copyright (C) 2016 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -21,10 +21,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import org.linphone.LinphoneManager; import org.linphone.LinphoneManager;
import org.linphone.R; import org.linphone.R;
import org.linphone.core.LinphoneCoreException; import org.linphone.core.CoreException;
import org.linphone.core.OpenH264DownloadHelperListener; import org.linphone.core.tools.OpenH264DownloadHelperListener;
import org.linphone.core.PayloadType; import org.linphone.core.PayloadType;
import org.linphone.tools.OpenH264DownloadHelper; import org.linphone.core.tools.OpenH264DownloadHelper;
import android.app.Fragment; import android.app.Fragment;
import android.os.Build; import android.os.Build;
@ -37,9 +37,6 @@ import android.widget.Button;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
/**
* @author Erwan CROZE
*/
public class CodecDownloaderFragment extends Fragment { public class CodecDownloaderFragment extends Fragment {
private Handler mHandler = new Handler(); private Handler mHandler = new Handler();
private TextView question; private TextView question;
@ -198,16 +195,12 @@ public class CodecDownloaderFragment extends Fragment {
private void enabledH264(boolean enable) { private void enabledH264(boolean enable) {
PayloadType h264 = null; PayloadType h264 = null;
for (PayloadType pt : LinphoneManager.getLc().getVideoCodecs()) { for (PayloadType pt : LinphoneManager.getLc().getVideoPayloadTypes()) {
if (pt.getMime().equals("H264")) h264 = pt; if (pt.getMimeType().equals("H264")) h264 = pt;
} }
if (h264 != null) { if (h264 != null) {
try { h264.enable(enable);
LinphoneManager.getLc().enablePayloadType(h264, enable);
} catch (LinphoneCoreException e) {
e.printStackTrace();
}
} }
} }
} }

View file

@ -1,5 +1,24 @@
package org.linphone.assistant; package org.linphone.assistant;
/*
CountryListFragment.java
Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import org.linphone.R; import org.linphone.R;
import org.linphone.core.DialPlan; import org.linphone.core.DialPlan;

View file

@ -1,7 +1,7 @@
package org.linphone.assistant; package org.linphone.assistant;
/* /*
CreateAccountActivationFragment.java CreateAccountActivationFragment.java
Copyright (C) 2015 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -30,25 +30,22 @@ import android.widget.Toast;
import org.linphone.LinphoneManager; import org.linphone.LinphoneManager;
import org.linphone.LinphonePreferences; import org.linphone.LinphonePreferences;
import org.linphone.R; import org.linphone.R;
import org.linphone.core.LinphoneAccountCreator; import org.linphone.core.AccountCreator;
import org.linphone.core.LinphoneAccountCreator.LinphoneAccountCreatorListener; import org.linphone.core.AccountCreatorListener;
import org.linphone.core.LinphoneCoreFactory; import org.linphone.core.Factory;
/**
* @author Sylvain Berfini public class CreateAccountActivationFragment extends Fragment implements OnClickListener, AccountCreatorListener {
*/
public class CreateAccountActivationFragment extends Fragment implements OnClickListener, LinphoneAccountCreatorListener {
private String username, password; private String username, password;
private Button checkAccount; private Button checkAccount;
private TextView email; private TextView email;
private LinphoneAccountCreator accountCreator; private AccountCreator accountCreator;
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.assistant_account_creation_email_activation, container, false); View view = inflater.inflate(R.layout.assistant_account_creation_email_activation, container, false);
accountCreator = LinphoneCoreFactory.instance().createAccountCreator(LinphoneManager.getLc() accountCreator = LinphoneManager.getLc().createAccountCreator(LinphonePreferences.instance().getXmlrpcUrl());
, LinphonePreferences.instance().getXmlrpcUrl());
accountCreator.setListener(this); accountCreator.setListener(this);
username = getArguments().getString("Username"); username = getArguments().getString("Username");
@ -75,33 +72,33 @@ public class CreateAccountActivationFragment extends Fragment implements OnClick
} }
@Override @Override
public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onIsAccountExist(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
@Override @Override
public void onAccountCreatorAccountCreated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onCreateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
@Override @Override
public void onAccountCreatorAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onActivateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
@Override @Override
public void onAccountCreatorAccountLinkedWithPhoneNumber(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onLinkAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
@Override @Override
public void onAccountCreatorPhoneNumberLinkActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onActivateAlias(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
@Override @Override
public void onAccountCreatorIsAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onIsAccountActivated(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
if (AssistantActivity.instance() == null) { if (AssistantActivity.instance() == null) {
return; return;
} }
if (status.equals(LinphoneAccountCreator.RequestStatus.AccountNotActivated)) { if (status.equals(AccountCreator.Status.AccountNotActivated)) {
Toast.makeText(getActivity(), getString(R.string.assistant_account_not_validated), Toast.LENGTH_LONG).show(); Toast.makeText(getActivity(), getString(R.string.assistant_account_not_validated), Toast.LENGTH_LONG).show();
} else if (status.equals(LinphoneAccountCreator.RequestStatus.AccountActivated)) { } else if (status.equals(AccountCreator.Status.AccountActivated)) {
AssistantActivity.instance().linphoneLogIn(accountCreator); AssistantActivity.instance().linphoneLogIn(accountCreator);
AssistantActivity.instance().isAccountVerified(username); AssistantActivity.instance().isAccountVerified(username);
} else { } else {
@ -111,19 +108,19 @@ public class CreateAccountActivationFragment extends Fragment implements OnClick
} }
@Override @Override
public void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onRecoverAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
@Override @Override
public void onAccountCreatorIsAccountLinked(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onIsAccountLinked(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
@Override @Override
public void onAccountCreatorIsPhoneNumberUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onIsAliasUsed(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
@Override @Override
public void onAccountCreatorPasswordUpdated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onUpdateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
} }

View file

@ -1,7 +1,7 @@
package org.linphone.assistant; package org.linphone.assistant;
/* /*
CreateAccountCodeActivationFragment.java CreateAccountCodeActivationFragment.java
Copyright (C) 2015 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -21,9 +21,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
import org.linphone.LinphoneManager; import org.linphone.LinphoneManager;
import org.linphone.LinphonePreferences; import org.linphone.LinphonePreferences;
import org.linphone.R; import org.linphone.R;
import org.linphone.core.LinphoneAccountCreator; import org.linphone.core.AccountCreator;
import org.linphone.core.LinphoneAccountCreator.LinphoneAccountCreatorListener; import org.linphone.core.AccountCreatorListener;
import org.linphone.core.LinphoneCoreFactory; import org.linphone.core.Factory;
import android.app.Fragment; import android.app.Fragment;
import android.os.Bundle; import android.os.Bundle;
@ -39,7 +39,7 @@ import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
public class CreateAccountCodeActivationFragment extends Fragment implements LinphoneAccountCreatorListener { public class CreateAccountCodeActivationFragment extends Fragment implements AccountCreatorListener {
private String username, phone, dialcode; private String username, phone, dialcode;
private TextView title, phonenumber; private TextView title, phonenumber;
private EditText code; private EditText code;
@ -47,7 +47,7 @@ public class CreateAccountCodeActivationFragment extends Fragment implements Lin
private int code_length, accountNumber; private int code_length, accountNumber;
private ImageView back; private ImageView back;
private Button checkAccount; private Button checkAccount;
private LinphoneAccountCreator accountCreator; private AccountCreator accountCreator;
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
@ -62,7 +62,7 @@ public class CreateAccountCodeActivationFragment extends Fragment implements Lin
accountNumber = getArguments().getInt("AccountNumber"); accountNumber = getArguments().getInt("AccountNumber");
code_length = LinphonePreferences.instance().getCodeLength(); code_length = LinphonePreferences.instance().getCodeLength();
accountCreator = LinphoneCoreFactory.instance().createAccountCreator(LinphoneManager.getLc(), LinphonePreferences.instance().getXmlrpcUrl()); accountCreator = LinphoneManager.getLc().createAccountCreator(LinphonePreferences.instance().getXmlrpcUrl());
accountCreator.setListener(this); accountCreator.setListener(this);
accountCreator.setUsername(username); accountCreator.setUsername(username);
accountCreator.setPhoneNumber(phone, dialcode); accountCreator.setPhoneNumber(phone, dialcode);
@ -121,7 +121,7 @@ public class CreateAccountCodeActivationFragment extends Fragment implements Lin
private void linkAccount(){ private void linkAccount(){
accountCreator.setUsername(LinphonePreferences.instance().getAccountUsername(accountNumber)); accountCreator.setUsername(LinphonePreferences.instance().getAccountUsername(accountNumber));
accountCreator.setHa1(LinphonePreferences.instance().getAccountHa1(accountNumber)); accountCreator.setHa1(LinphonePreferences.instance().getAccountHa1(accountNumber));
accountCreator.activatePhoneNumberLink(); accountCreator.activateAlias();
} }
private void activateAccount() { private void activateAccount() {
@ -132,19 +132,19 @@ public class CreateAccountCodeActivationFragment extends Fragment implements Lin
} }
@Override @Override
public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onIsAccountExist(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
@Override @Override
public void onAccountCreatorAccountCreated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onCreateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
@Override @Override
public void onAccountCreatorAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onActivateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
if (AssistantActivity.instance() == null) { if (AssistantActivity.instance() == null) {
return; return;
} }
if (status.equals(LinphoneAccountCreator.RequestStatus.AccountActivated)) { if (status.equals(AccountCreator.Status.AccountActivated)) {
checkAccount.setEnabled(true); checkAccount.setEnabled(true);
if (accountCreator.getUsername() != null) { if (accountCreator.getUsername() != null) {
AssistantActivity.instance().linphoneLogIn(accountCreator); AssistantActivity.instance().linphoneLogIn(accountCreator);
@ -161,7 +161,7 @@ public class CreateAccountCodeActivationFragment extends Fragment implements Lin
AssistantActivity.instance().success(); AssistantActivity.instance().success();
} }
} }
} else if (status.equals(LinphoneAccountCreator.RequestStatus.Failed)) { } else if (status.equals(AccountCreator.Status.RequestFailed)) {
Toast.makeText(getActivity(), getString(R.string.wizard_server_unavailable), Toast.LENGTH_LONG).show(); Toast.makeText(getActivity(), getString(R.string.wizard_server_unavailable), Toast.LENGTH_LONG).show();
} else { } else {
Toast.makeText(getActivity(), getString(R.string.assistant_error_confirmation_code), Toast.LENGTH_LONG).show(); Toast.makeText(getActivity(), getString(R.string.assistant_error_confirmation_code), Toast.LENGTH_LONG).show();
@ -170,17 +170,17 @@ public class CreateAccountCodeActivationFragment extends Fragment implements Lin
} }
@Override @Override
public void onAccountCreatorAccountLinkedWithPhoneNumber(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onLinkAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
@Override @Override
public void onAccountCreatorPhoneNumberLinkActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onActivateAlias(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
if (AssistantActivity.instance() == null) { if (AssistantActivity.instance() == null) {
return; return;
} }
if(status.equals(LinphoneAccountCreator.RequestStatus.AccountActivated)){ if(status.equals(AccountCreator.Status.AccountActivated)){
LinphonePreferences.instance().setPrefix(accountNumber, accountCreator.getPrefix(accountCreator.getPhoneNumber())); LinphonePreferences.instance().setPrefix(accountNumber, org.linphone.core.Utils.getPrefixFromE164(accountCreator.getPhoneNumber()));
LinphonePreferences.instance().setLinkPopupTime(""); LinphonePreferences.instance().setLinkPopupTime("");
AssistantActivity.instance().hideKeyboard(); AssistantActivity.instance().hideKeyboard();
AssistantActivity.instance().success(); AssistantActivity.instance().success();
@ -188,26 +188,26 @@ public class CreateAccountCodeActivationFragment extends Fragment implements Lin
} }
@Override @Override
public void onAccountCreatorIsAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onIsAccountActivated(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
@Override @Override
public void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onRecoverAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
@Override @Override
public void onAccountCreatorIsAccountLinked(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onIsAccountLinked(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
@Override @Override
public void onAccountCreatorIsPhoneNumberUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onIsAliasUsed(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
@Override @Override
public void onAccountCreatorPasswordUpdated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onUpdateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
} }

View file

@ -1,7 +1,7 @@
package org.linphone.assistant; package org.linphone.assistant;
/* /*
CreateAccountFragment.java CreateAccountFragment.java
Copyright (C) 2015 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -28,11 +28,11 @@ import org.linphone.LinphonePreferences;
import org.linphone.LinphoneUtils; import org.linphone.LinphoneUtils;
import org.linphone.R; import org.linphone.R;
import org.linphone.core.DialPlan; import org.linphone.core.DialPlan;
import org.linphone.core.LinphoneAccountCreator; import org.linphone.core.AccountCreator;
import org.linphone.core.LinphoneAccountCreator.LinphoneAccountCreatorListener; import org.linphone.core.AccountCreatorListener;
import org.linphone.core.LinphoneAccountCreator.RequestStatus; import org.linphone.core.AccountCreator.Status;
import org.linphone.core.LinphoneCoreFactory; import org.linphone.core.Factory;
import org.linphone.core.LinphoneProxyConfig; import org.linphone.core.ProxyConfig;
import android.accounts.Account; import android.accounts.Account;
import android.accounts.AccountManager; import android.accounts.AccountManager;
@ -58,11 +58,8 @@ import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
/**
* @author Sylvain Berfini
*/
public class CreateAccountFragment extends Fragment implements CompoundButton.OnCheckedChangeListener public class CreateAccountFragment extends Fragment implements CompoundButton.OnCheckedChangeListener
, OnClickListener, LinphoneAccountCreatorListener { , OnClickListener, AccountCreatorListener {
private EditText phoneNumberEdit, usernameEdit, passwordEdit, passwordConfirmEdit private EditText phoneNumberEdit, usernameEdit, passwordEdit, passwordConfirmEdit
, emailEdit, dialCode; , emailEdit, dialCode;
private TextView phoneNumberError, passwordError, passwordConfirmError private TextView phoneNumberError, passwordError, passwordConfirmError
@ -79,15 +76,14 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
private int countryCode; private int countryCode;
private LinearLayout phoneNumberLayout, usernameLayout, emailLayout, passwordLayout, passwordConfirmLayout; private LinearLayout phoneNumberLayout, usernameLayout, emailLayout, passwordLayout, passwordConfirmLayout;
private final Pattern UPPER_CASE_REGEX = Pattern.compile("[A-Z]"); private final Pattern UPPER_CASE_REGEX = Pattern.compile("[A-Z]");
private LinphoneAccountCreator accountCreator; private AccountCreator accountCreator;
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.assistant_account_creation, container, false); View view = inflater.inflate(R.layout.assistant_account_creation, container, false);
//Initialize accountCreator //Initialize accountCreator
accountCreator = LinphoneCoreFactory.instance().createAccountCreator(LinphoneManager.getLc() accountCreator = LinphoneManager.getLc().createAccountCreator(LinphonePreferences.instance().getXmlrpcUrl());
, LinphonePreferences.instance().getXmlrpcUrl());
accountCreator.setListener(this); accountCreator.setListener(this);
instruction = (TextView) view.findViewById(R.id.message_create_account); instruction = (TextView) view.findViewById(R.id.message_create_account);
@ -134,8 +130,8 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
(TelephonyManager) getActivity().getApplicationContext().getSystemService( (TelephonyManager) getActivity().getApplicationContext().getSystemService(
Context.TELEPHONY_SERVICE); Context.TELEPHONY_SERVICE);
String countryIso = tm.getNetworkCountryIso(); String countryIso = tm.getNetworkCountryIso();
LinphoneProxyConfig proxyConfig = LinphoneManager.getLc().createProxyConfig(); ProxyConfig proxyConfig = LinphoneManager.getLc().createProxyConfig();
countryCode = proxyConfig.lookupCCCFromIso(countryIso.toUpperCase()); countryCode = org.linphone.core.Utils.getCccFromIso(countryIso.toUpperCase());
phoneNumberLayout.setVisibility(View.VISIBLE); phoneNumberLayout.setVisibility(View.VISIBLE);
@ -148,14 +144,14 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
} }
DialPlan c = AssistantActivity.instance().country; DialPlan c = AssistantActivity.instance().country;
if (c != null) { if (c != null) {
selectCountry.setText(c.getCountryName()); selectCountry.setText(c.getCountry());
dialCode.setText(c.getCountryCallingCode().contains("+") ? dialCode.setText(c.getCountryCallingCode().contains("+") ?
c.getCountryCallingCode() : "+" + c.getCountryCallingCode()); c.getCountryCallingCode() : "+" + c.getCountryCallingCode());
} else { } else {
c = AssistantActivity.instance().getCountryListAdapter() c = AssistantActivity.instance().getCountryListAdapter()
.getCountryFromCountryCode(String.valueOf(countryCode)); .getCountryFromCountryCode(String.valueOf(countryCode));
if (c != null) { if (c != null) {
selectCountry.setText(c.getCountryName()); selectCountry.setText(c.getCountry());
dialCode.setText(c.getCountryCallingCode().contains("+") ? dialCode.setText(c.getCountryCallingCode().contains("+") ?
c.getCountryCallingCode() : "+" + c.getCountryCallingCode()); c.getCountryCallingCode() : "+" + c.getCountryCallingCode());
} }
@ -328,9 +324,9 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
} else { } else {
if (useEmail.isChecked()) accountCreator.setPhoneNumber(null, null); if (useEmail.isChecked()) accountCreator.setPhoneNumber(null, null);
if (!getResources().getBoolean(R.bool.isTablet) || getUsername().length() > 0) { if (!getResources().getBoolean(R.bool.isTablet) || getUsername().length() > 0) {
accountCreator.isAccountUsed(); accountCreator.isAccountExist();
} else { } else {
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForUsernameStatus(LinphoneAccountCreator.UsernameCheck.TooShort) LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForUsernameStatus(AccountCreator.UsernameStatus.TooShort)
, AssistantActivity.instance()); , AssistantActivity.instance());
createAccount.setEnabled(true); createAccount.setEnabled(true);
} }
@ -353,9 +349,9 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
); );
int status = accountCreator.setPhoneNumber( int status = accountCreator.setPhoneNumber(
phoneNumberEdit.getText().toString(), LinphoneUtils.getCountryCode(dialCode)); phoneNumberEdit.getText().toString(), LinphoneUtils.getCountryCode(dialCode));
boolean isOk = status == LinphoneAccountCreator.PhoneNumberCheck.Ok.value(); boolean isOk = status == AccountCreator.PhoneNumberStatus.Ok.toInt();
if (isOk) { if (isOk) {
accountCreator.linkPhoneNumberWithAccount(); accountCreator.linkAccount();
} else { } else {
createAccount.setEnabled(true); createAccount.setEnabled(true);
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForPhoneNumberStatus(status), AssistantActivity.instance()); LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForPhoneNumberStatus(status), AssistantActivity.instance());
@ -366,8 +362,8 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
private void createAccount() { private void createAccount() {
if ((getResources().getBoolean(R.bool.isTablet) || !getResources().getBoolean(R.bool.use_phone_number_validation)) if ((getResources().getBoolean(R.bool.isTablet) || !getResources().getBoolean(R.bool.use_phone_number_validation))
&& useEmail.isChecked()) { && useEmail.isChecked()) {
LinphoneAccountCreator.EmailCheck emailStatus; AccountCreator.EmailStatus emailStatus;
LinphoneAccountCreator.PasswordCheck passwordStatus; AccountCreator.PasswordStatus passwordStatus;
passwordStatus = accountCreator.setPassword(passwordEdit.getText().toString()); passwordStatus = accountCreator.setPassword(passwordEdit.getText().toString());
emailStatus = accountCreator.setEmail(emailEdit.getText().toString()); emailStatus = accountCreator.setEmail(emailEdit.getText().toString());
@ -398,7 +394,7 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
boolean isOk; boolean isOk;
phoneStatus = accountCreator.setPhoneNumber( phoneStatus = accountCreator.setPhoneNumber(
phoneNumberEdit.getText().toString(), LinphoneUtils.getCountryCode(dialCode)); phoneNumberEdit.getText().toString(), LinphoneUtils.getCountryCode(dialCode));
isOk = phoneStatus == LinphoneAccountCreator.PhoneNumberCheck.Ok.value(); isOk = phoneStatus == AccountCreator.PhoneNumberStatus.Ok.toInt();
if (!useUsername.isChecked() && accountCreator.getUsername() == null) { if (!useUsername.isChecked() && accountCreator.getUsername() == null) {
accountCreator.setUsername(accountCreator.getPhoneNumber()); accountCreator.setUsername(accountCreator.getPhoneNumber());
} else { } else {
@ -435,7 +431,7 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
if (!useEmail.isChecked() && getResources().getBoolean(R.bool.use_phone_number_validation)) { if (!useEmail.isChecked() && getResources().getBoolean(R.bool.use_phone_number_validation)) {
int status = getPhoneNumberStatus(); int status = getPhoneNumberStatus();
boolean isOk = (status == LinphoneAccountCreator.PhoneNumberCheck.Ok.value()); boolean isOk = (status == AccountCreator.PhoneNumberStatus.Ok.toInt());
LinphoneUtils.displayError(isOk, phoneNumberError, LinphoneUtils.errorForPhoneNumberStatus(status)); LinphoneUtils.displayError(isOk, phoneNumberError, LinphoneUtils.errorForPhoneNumberStatus(status));
// Username or phone number // Username or phone number
@ -444,7 +440,7 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
} }
if (!isOk) { if (!isOk) {
if (status == LinphoneAccountCreator.PhoneNumberCheck.CountryCodeInvalid.value()) { if (status == AccountCreator.PhoneNumberStatus.InvalidCountryCode.toInt()) {
dialCode.setBackgroundResource(R.drawable.resizable_textfield_error); dialCode.setBackgroundResource(R.drawable.resizable_textfield_error);
phoneNumberEdit.setBackgroundResource(R.drawable.resizable_textfield); phoneNumberEdit.setBackgroundResource(R.drawable.resizable_textfield);
} else { } else {
@ -478,7 +474,7 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
.getCountryFromCountryCode(dialCode.getText().toString()); .getCountryFromCountryCode(dialCode.getText().toString());
if (c != null) { if (c != null) {
AssistantActivity.instance().country = c; AssistantActivity.instance().country = c;
selectCountry.setText(c.getCountryName()); selectCountry.setText(c.getCountry());
} else { } else {
selectCountry.setText(R.string.select_your_country); selectCountry.setText(R.string.select_your_country);
} }
@ -516,8 +512,8 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
field.addTextChangedListener(new TextWatcher() { field.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) { public void afterTextChanged(Editable s) {
emailOk = false; emailOk = false;
LinphoneAccountCreator.EmailCheck status = accountCreator.setEmail(field.getText().toString()); AccountCreator.EmailStatus status = accountCreator.setEmail(field.getText().toString());
if (status.equals(LinphoneAccountCreator.EmailCheck.Ok)) { if (status.equals(AccountCreator.EmailStatus.Ok)) {
emailOk = true; emailOk = true;
LinphoneUtils.displayError(emailOk, emailError, ""); LinphoneUtils.displayError(emailOk, emailError, "");
} }
@ -539,7 +535,7 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
TextWatcher passwordListener = new TextWatcher() { TextWatcher passwordListener = new TextWatcher() {
public void afterTextChanged(Editable s) { public void afterTextChanged(Editable s) {
passwordOk = false; passwordOk = false;
LinphoneAccountCreator.PasswordCheck status = accountCreator.setPassword(field1.getText().toString()); AccountCreator.PasswordStatus status = accountCreator.setPassword(field1.getText().toString());
if (isPasswordCorrect(field1.getText().toString())) { if (isPasswordCorrect(field1.getText().toString())) {
passwordOk = true; passwordOk = true;
LinphoneUtils.displayError(passwordOk, passwordError, ""); LinphoneUtils.displayError(passwordOk, passwordError, "");
@ -587,14 +583,14 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
} }
@Override @Override
public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, final RequestStatus status) { public void onIsAccountExist(AccountCreator accountCreator, final Status status, String resp) {
if (status.equals(RequestStatus.AccountExist) || status.equals(RequestStatus.AccountExistWithAlias)) { if (status.equals(Status.AccountExist) || status.equals(Status.AccountExistWithAlias)) {
if (useEmail.isChecked()) { if (useEmail.isChecked()) {
createAccount.setEnabled(true); createAccount.setEnabled(true);
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForRequestStatus(status) LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status)
, AssistantActivity.instance()); , AssistantActivity.instance());
} else { } else {
accountCreator.isPhoneNumberUsed(); accountCreator.isAliasUsed();
} }
} else { } else {
createAccount(); createAccount();
@ -602,8 +598,8 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
} }
@Override @Override
public void onAccountCreatorAccountCreated(LinphoneAccountCreator accountCreator, RequestStatus status) { public void onCreateAccount(AccountCreator accountCreator, Status status, String resp) {
if (status.equals(RequestStatus.AccountCreated)) { if (status.equals(Status.AccountCreated)) {
if (useEmail.isChecked() || !getResources().getBoolean(R.bool.use_phone_number_validation)) { if (useEmail.isChecked() || !getResources().getBoolean(R.bool.use_phone_number_validation)) {
AssistantActivity.instance().displayAssistantConfirm(getUsername() AssistantActivity.instance().displayAssistantConfirm(getUsername()
, passwordEdit.getText().toString(), emailEdit.getText().toString()); , passwordEdit.getText().toString(), emailEdit.getText().toString());
@ -614,21 +610,21 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
} }
} else { } else {
createAccount.setEnabled(true); createAccount.setEnabled(true);
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForRequestStatus(status) LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status)
, AssistantActivity.instance()); , AssistantActivity.instance());
} }
} }
@Override @Override
public void onAccountCreatorAccountActivated(LinphoneAccountCreator accountCreator, RequestStatus status) { public void onActivateAccount(AccountCreator accountCreator, Status status, String resp) {
} }
@Override @Override
public void onAccountCreatorAccountLinkedWithPhoneNumber(LinphoneAccountCreator accountCreator, RequestStatus status) { public void onLinkAccount(AccountCreator accountCreator, Status status, String resp) {
if (AssistantActivity.instance() == null) { if (AssistantActivity.instance() == null) {
return; return;
} }
if (status.equals(RequestStatus.Ok)) { if (status.equals(Status.RequestOk)) {
AssistantActivity.instance().displayAssistantCodeConfirm(getUsername() AssistantActivity.instance().displayAssistantCodeConfirm(getUsername()
, phoneNumberEdit.getText().toString() , phoneNumberEdit.getText().toString()
, LinphoneUtils.getCountryCode(dialCode), false); , LinphoneUtils.getCountryCode(dialCode), false);
@ -636,11 +632,11 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
} }
@Override @Override
public void onAccountCreatorPhoneNumberLinkActivated(LinphoneAccountCreator accountCreator, RequestStatus status) { public void onActivateAlias(AccountCreator accountCreator, Status status, String resp) {
if (AssistantActivity.instance() == null) { if (AssistantActivity.instance() == null) {
return; return;
} }
if (status.equals(RequestStatus.Ok)) { if (status.equals(Status.RequestOk)) {
AssistantActivity.instance().displayAssistantCodeConfirm(getUsername() AssistantActivity.instance().displayAssistantCodeConfirm(getUsername()
, phoneNumberEdit.getText().toString() , phoneNumberEdit.getText().toString()
, LinphoneUtils.getCountryCode(dialCode), false); , LinphoneUtils.getCountryCode(dialCode), false);
@ -648,30 +644,30 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
} }
@Override @Override
public void onAccountCreatorIsAccountActivated(LinphoneAccountCreator accountCreator, RequestStatus status) { public void onIsAccountActivated(AccountCreator accountCreator, Status status, String resp) {
if (AssistantActivity.instance() == null) { if (AssistantActivity.instance() == null) {
return; return;
} }
if (status.equals(RequestStatus.AccountNotActivated)) { if (status.equals(Status.AccountNotActivated)) {
if (getResources().getBoolean(R.bool.isTablet) if (getResources().getBoolean(R.bool.isTablet)
|| !getResources().getBoolean(R.bool.use_phone_number_validation)) { || !getResources().getBoolean(R.bool.use_phone_number_validation)) {
//accountCreator.activateAccount(); // Resend email TODO //accountCreator.activateAccount(); // Resend email TODO
} else { } else {
accountCreator.recoverPhoneAccount(); // Resend SMS accountCreator.recoverAccount(); // Resend SMS
} }
} else { } else {
createAccount.setEnabled(true); createAccount.setEnabled(true);
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForRequestStatus(status) LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status)
, AssistantActivity.instance()); , AssistantActivity.instance());
} }
} }
@Override @Override
public void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, RequestStatus status) { public void onRecoverAccount(AccountCreator accountCreator, Status status, String resp) {
if (AssistantActivity.instance() == null) { if (AssistantActivity.instance() == null) {
return; return;
} }
if (status.equals(RequestStatus.Ok)) { if (status.equals(Status.RequestOk)) {
AssistantActivity.instance().displayAssistantCodeConfirm(getUsername() AssistantActivity.instance().displayAssistantCodeConfirm(getUsername()
, phoneNumberEdit.getText().toString(), dialCode.getText().toString(), false); , phoneNumberEdit.getText().toString(), dialCode.getText().toString(), false);
} else { } else {
@ -683,21 +679,21 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
} }
@Override @Override
public void onAccountCreatorIsAccountLinked(LinphoneAccountCreator accountCreator, RequestStatus status) { public void onIsAccountLinked(AccountCreator accountCreator, Status status, String resp) {
} }
@Override @Override
public void onAccountCreatorIsPhoneNumberUsed(LinphoneAccountCreator ac, RequestStatus status) { public void onIsAliasUsed(AccountCreator ac, Status status, String resp) {
if (AssistantActivity.instance() == null) { if (AssistantActivity.instance() == null) {
return; return;
} }
if (status.equals(RequestStatus.AliasIsAccount) || status.equals(RequestStatus.AliasExist)) { if (status.equals(Status.AliasIsAccount) || status.equals(Status.AliasExist)) {
if (accountCreator.getPhoneNumber() != null && accountCreator.getUsername() != null if (accountCreator.getPhoneNumber() != null && accountCreator.getUsername() != null
&& accountCreator.getPhoneNumber().compareTo(accountCreator.getUsername()) == 0) { && accountCreator.getPhoneNumber().compareTo(accountCreator.getUsername()) == 0) {
accountCreator.isAccountActivated(); accountCreator.isAccountActivated();
} else { } else {
createAccount.setEnabled(true); createAccount.setEnabled(true);
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForRequestStatus(status) LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status)
, AssistantActivity.instance()); , AssistantActivity.instance());
} }
} else { } else {
@ -706,7 +702,7 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
} }
@Override @Override
public void onAccountCreatorPasswordUpdated(LinphoneAccountCreator accountCreator, RequestStatus status) { public void onUpdateAccount(AccountCreator accountCreator, Status status, String resp) {
} }
} }

View file

@ -2,7 +2,7 @@ package org.linphone.assistant;
/* /*
EchoCancellerCalibrationFragment.java EchoCancellerCalibrationFragment.java
Copyright (C) 2015 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -22,15 +22,15 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import org.linphone.LinphoneManager; import org.linphone.LinphoneManager;
import org.linphone.LinphonePreferences; import org.linphone.LinphonePreferences;
import org.linphone.R; import org.linphone.R;
import org.linphone.core.LinphoneCore; import org.linphone.core.Core;
import org.linphone.core.LinphoneCore.EcCalibratorStatus; import org.linphone.core.Core.EcCalibratorStatus;
import org.linphone.core.LinphoneCoreException; import org.linphone.core.CoreException;
import org.linphone.core.LinphoneCoreListenerBase; import org.linphone.core.CoreListenerStub;
import org.linphone.core.LinphoneXmlRpcRequest; import org.linphone.core.XmlRpcRequest;
import org.linphone.core.LinphoneXmlRpcRequest.LinphoneXmlRpcRequestListener; import org.linphone.core.XmlRpcRequestListener;
import org.linphone.core.LinphoneXmlRpcRequestImpl; //import org.linphone.core.XmlRpcRequestImpl;
import org.linphone.core.LinphoneXmlRpcSession; import org.linphone.core.XmlRpcSession;
import org.linphone.core.LinphoneXmlRpcSessionImpl; //import org.linphone.core.XmlRpcSessionImpl;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
import android.app.Fragment; import android.app.Fragment;
@ -41,15 +41,12 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
/** public class EchoCancellerCalibrationFragment extends Fragment implements XmlRpcRequestListener {
* @author Ghislain MARY
*/
public class EchoCancellerCalibrationFragment extends Fragment implements LinphoneXmlRpcRequestListener {
private Handler mHandler = new Handler(); private Handler mHandler = new Handler();
private boolean mSendEcCalibrationResult = false; private boolean mSendEcCalibrationResult = false;
private LinphoneCoreListenerBase mListener; private CoreListenerStub mListener;
private LinphoneXmlRpcSession xmlRpcSession; private XmlRpcSession xmlRpcSession;
private LinphoneXmlRpcRequest xmlRpcRequest; private XmlRpcRequest xmlRpcRequest;
private Runnable runFinished; private Runnable runFinished;
@Override @Override
@ -57,9 +54,10 @@ public class EchoCancellerCalibrationFragment extends Fragment implements Linpho
Bundle savedInstanceState) { Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.assistant_ec_calibration, container, false); View view = inflater.inflate(R.layout.assistant_ec_calibration, container, false);
mListener = new LinphoneCoreListenerBase(){ mListener = new CoreListenerStub(){
@Override @Override
public void ecCalibrationStatus(LinphoneCore lc, LinphoneCore.EcCalibratorStatus status, int delay_ms, Object data) { public void onEcCalibrationResult(Core lc, Core.EcCalibratorStatus status, int delay_ms) {
lc.removeListener(mListener);
LinphoneManager.getInstance().routeAudioToReceiver(); LinphoneManager.getInstance().routeAudioToReceiver();
if (mSendEcCalibrationResult) { if (mSendEcCalibrationResult) {
sendEcCalibrationResult(status, delay_ms); sendEcCalibrationResult(status, delay_ms);
@ -74,13 +72,14 @@ public class EchoCancellerCalibrationFragment extends Fragment implements Linpho
} }
}; };
xmlRpcSession = new LinphoneXmlRpcSessionImpl(LinphoneManager.getLcIfManagerNotDestroyedOrNull(), LinphonePreferences.instance().getXmlrpcUrl()); xmlRpcSession = LinphoneManager.getLcIfManagerNotDestroyedOrNull().createXmlRpcSession(LinphonePreferences.instance().getXmlrpcUrl());
xmlRpcRequest = new LinphoneXmlRpcRequestImpl("add_ec_calibration_result", LinphoneXmlRpcRequest.ArgType.None); xmlRpcRequest = xmlRpcSession.createRequest(XmlRpcRequest.ArgType.None, "add_ec_calibration_result");
xmlRpcRequest.setListener(this); xmlRpcRequest.setListener(this);
try { try {
LinphoneManager.getInstance().startEcCalibration(mListener); LinphoneManager.getLc().addListener(mListener);
} catch (LinphoneCoreException e) { LinphoneManager.getInstance().startEcCalibration();
} catch (CoreException e) {
Log.e(e, "Unable to calibrate EC"); Log.e(e, "Unable to calibrate EC");
AssistantActivity.instance().isEchoCalibrationFinished(); AssistantActivity.instance().isEchoCalibrationFinished();
} }
@ -92,12 +91,12 @@ public class EchoCancellerCalibrationFragment extends Fragment implements Linpho
} }
@Override @Override
public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) { public void onResponse(XmlRpcRequest request) {
mHandler.post(runFinished); mHandler.post(runFinished);
} }
private void sendEcCalibrationResult(EcCalibratorStatus status, int delayMs) { private void sendEcCalibrationResult(EcCalibratorStatus status, int delayMs) {
Boolean hasBuiltInEchoCanceler = LinphoneManager.getLc().hasBuiltInEchoCanceler(); Boolean hasBuiltInEchoCanceler = LinphoneManager.getLc().hasBuiltinEchoCanceller();
Log.i("Add echo canceller calibration result: manufacturer=" + Build.MANUFACTURER + " model=" + Build.MODEL + " status=" + status + " delay=" + delayMs + "ms" + " hasBuiltInEchoCanceler " + hasBuiltInEchoCanceler); Log.i("Add echo canceller calibration result: manufacturer=" + Build.MANUFACTURER + " model=" + Build.MODEL + " status=" + status + " delay=" + delayMs + "ms" + " hasBuiltInEchoCanceler " + hasBuiltInEchoCanceler);
xmlRpcRequest.addStringArg(Build.MANUFACTURER); xmlRpcRequest.addStringArg(Build.MANUFACTURER);
xmlRpcRequest.addStringArg(Build.MODEL); xmlRpcRequest.addStringArg(Build.MODEL);

View file

@ -1,7 +1,7 @@
package org.linphone.assistant; package org.linphone.assistant;
/* /*
LinphoneLoginFragment.java LinphoneLoginFragment.java
Copyright (C) 2015 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -24,10 +24,11 @@ import org.linphone.LinphonePreferences;
import org.linphone.LinphoneUtils; import org.linphone.LinphoneUtils;
import org.linphone.R; import org.linphone.R;
import org.linphone.compatibility.Compatibility; import org.linphone.compatibility.Compatibility;
import org.linphone.core.AccountCreatorListener;
import org.linphone.core.DialPlan; import org.linphone.core.DialPlan;
import org.linphone.core.LinphoneAccountCreator; import org.linphone.core.AccountCreator;
import org.linphone.core.LinphoneCoreFactory; import org.linphone.core.Factory;
import org.linphone.core.LinphoneProxyConfig; import org.linphone.core.ProxyConfig;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Fragment; import android.app.Fragment;
@ -50,17 +51,14 @@ import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
/** public class LinphoneLoginFragment extends Fragment implements CompoundButton.OnCheckedChangeListener, OnClickListener, TextWatcher, AccountCreatorListener {
* @author Sylvain Berfini
*/
public class LinphoneLoginFragment extends Fragment implements CompoundButton.OnCheckedChangeListener, OnClickListener, TextWatcher, LinphoneAccountCreator.LinphoneAccountCreatorListener {
private EditText login, password, phoneNumberEdit, dialCode; private EditText login, password, phoneNumberEdit, dialCode;
private Button apply, selectCountry; private Button apply, selectCountry;
private CheckBox useUsername; private CheckBox useUsername;
private LinearLayout phoneNumberLayout, usernameLayout, passwordLayout; private LinearLayout phoneNumberLayout, usernameLayout, passwordLayout;
private TextView forgotPassword, messagePhoneNumber, phoneNumberError; private TextView forgotPassword, messagePhoneNumber, phoneNumberError;
private Boolean recoverAccount; private Boolean recoverAccount;
private LinphoneAccountCreator accountCreator; private AccountCreator accountCreator;
private int countryCode; private int countryCode;
private String phone, dialcode, username, pwd; private String phone, dialcode, username, pwd;
private ImageView phoneNumberInfo; private ImageView phoneNumberInfo;
@ -70,7 +68,7 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
Bundle savedInstanceState) { Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.assistant_linphone_login, container, false); View view = inflater.inflate(R.layout.assistant_linphone_login, container, false);
accountCreator = LinphoneCoreFactory.instance().createAccountCreator(LinphoneManager.getLc(), LinphonePreferences.instance().getXmlrpcUrl()); accountCreator = LinphoneManager.getLc().createAccountCreator(LinphonePreferences.instance().getXmlrpcUrl());
accountCreator.setListener(this); accountCreator.setListener(this);
String url = "http://linphone.org/free-sip-service.html&action=recover"; String url = "http://linphone.org/free-sip-service.html&action=recover";
@ -113,20 +111,20 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
(TelephonyManager) getActivity().getApplicationContext().getSystemService( (TelephonyManager) getActivity().getApplicationContext().getSystemService(
Context.TELEPHONY_SERVICE); Context.TELEPHONY_SERVICE);
String countryIso = tm.getNetworkCountryIso(); String countryIso = tm.getNetworkCountryIso();
LinphoneProxyConfig proxyConfig = LinphoneManager.getLc().createProxyConfig(); ProxyConfig proxyConfig = LinphoneManager.getLc().createProxyConfig();
countryCode = proxyConfig.lookupCCCFromIso(countryIso.toUpperCase()); countryCode = org.linphone.core.Utils.getCccFromIso(countryIso.toUpperCase());
DialPlan c = AssistantActivity.instance().country; DialPlan c = AssistantActivity.instance().country;
if (c != null) { if (c != null) {
selectCountry.setText(c.getCountryName()); selectCountry.setText(c.getCountry());
dialCode.setText(c.getCountryCallingCode().contains("+") ? dialCode.setText(c.getCountryCallingCode().contains("+") ?
c.getCountryCallingCode() : "+" + c.getCountryCallingCode()); c.getCountryCallingCode() : "+" + c.getCountryCallingCode());
} else { } else {
c = AssistantActivity.instance().getCountryListAdapter() c = AssistantActivity.instance().getCountryListAdapter()
.getCountryFromCountryCode(String.valueOf(countryCode)); .getCountryFromCountryCode(String.valueOf(countryCode));
if (c != null) { if (c != null) {
selectCountry.setText(c.getCountryName()); selectCountry.setText(c.getCountry());
dialCode.setText(c.getCountryCallingCode().contains("+") ? dialCode.setText(c.getCountryCallingCode().contains("+") ?
c.getCountryCallingCode() : "+" + c.getCountryCallingCode()); c.getCountryCallingCode() : "+" + c.getCountryCallingCode());
} }
@ -198,7 +196,7 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
} }
accountCreator.setUsername(login.getText().toString()); accountCreator.setUsername(login.getText().toString());
accountCreator.setPassword(password.getText().toString()); accountCreator.setPassword(password.getText().toString());
accountCreator.isAccountUsed(); accountCreator.isAccountExist();
} }
private int getPhoneNumberStatus() { private int getPhoneNumberStatus() {
@ -212,7 +210,7 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
DialPlan c = AssistantActivity.instance().getCountryListAdapter().getCountryFromCountryCode(dialCode.getText().toString()); DialPlan c = AssistantActivity.instance().getCountryListAdapter().getCountryFromCountryCode(dialCode.getText().toString());
if (c != null) { if (c != null) {
AssistantActivity.instance().country = c; AssistantActivity.instance().country = c;
selectCountry.setText(c.getCountryName()); selectCountry.setText(c.getCountry());
} else { } else {
selectCountry.setText(R.string.select_your_country); selectCountry.setText(R.string.select_your_country);
} }
@ -263,10 +261,10 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
private void recoverAccount() { private void recoverAccount() {
if (phoneNumberEdit.length() > 0 || dialCode.length() > 1) { if (phoneNumberEdit.length() > 0 || dialCode.length() > 1) {
int status = getPhoneNumberStatus(); int status = getPhoneNumberStatus();
boolean isOk = status == LinphoneAccountCreator.PhoneNumberCheck.Ok.value(); boolean isOk = status == AccountCreator.PhoneNumberStatus.Ok.toInt();
if (isOk) { if (isOk) {
LinphoneManager.getLc().getConfig().loadXmlFile(LinphoneManager.getInstance().getmDynamicConfigFile()); LinphoneManager.getLc().getConfig().loadFromXmlFile(LinphoneManager.getInstance().getmDynamicConfigFile());
accountCreator.isPhoneNumberUsed(); accountCreator.isAliasUsed();
} else { } else {
apply.setEnabled(true); apply.setEnabled(true);
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForPhoneNumberStatus(status), LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForPhoneNumberStatus(status),
@ -285,10 +283,10 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
public void onTextChanged2() { public void onTextChanged2() {
int status = getPhoneNumberStatus(); int status = getPhoneNumberStatus();
boolean isOk = status == LinphoneAccountCreator.PhoneNumberCheck.Ok.value(); boolean isOk = status == AccountCreator.PhoneNumberStatus.Ok.toInt();
LinphoneUtils.displayError(isOk, phoneNumberError, LinphoneUtils.errorForPhoneNumberStatus(status)); LinphoneUtils.displayError(isOk, phoneNumberError, LinphoneUtils.errorForPhoneNumberStatus(status));
if (!isOk) { if (!isOk) {
if ((1 == (status & LinphoneAccountCreator.PhoneNumberCheck.CountryCodeInvalid.value()))) { if ((1 == (status & AccountCreator.PhoneNumberStatus.InvalidCountryCode.toInt()))) {
dialCode.setBackgroundResource(R.drawable.resizable_textfield_error); dialCode.setBackgroundResource(R.drawable.resizable_textfield_error);
phoneNumberEdit.setBackgroundResource(R.drawable.resizable_textfield); phoneNumberEdit.setBackgroundResource(R.drawable.resizable_textfield);
} else { } else {
@ -332,47 +330,47 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
} }
@Override @Override
public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onIsAccountExist(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
if (AssistantActivity.instance() == null) { if (AssistantActivity.instance() == null) {
apply.setEnabled(true); apply.setEnabled(true);
return; return;
} }
if (status.equals(LinphoneAccountCreator.RequestStatus.AccountExist) || status.equals(LinphoneAccountCreator.RequestStatus.AccountExistWithAlias)) { if (status.equals(AccountCreator.Status.AccountExist) || status.equals(AccountCreator.Status.AccountExistWithAlias)) {
AssistantActivity.instance().linphoneLogIn(accountCreator); AssistantActivity.instance().linphoneLogIn(accountCreator);
} else { } else {
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForRequestStatus(status), AssistantActivity.instance()); LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status), AssistantActivity.instance());
} }
apply.setEnabled(true); apply.setEnabled(true);
} }
@Override @Override
public void onAccountCreatorAccountCreated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onCreateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
@Override @Override
public void onAccountCreatorAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onActivateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
@Override @Override
public void onAccountCreatorAccountLinkedWithPhoneNumber(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onLinkAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
@Override @Override
public void onAccountCreatorPhoneNumberLinkActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onActivateAlias(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
@Override @Override
public void onAccountCreatorIsAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onIsAccountActivated(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
@Override @Override
public void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onRecoverAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
if (AssistantActivity.instance() == null) { if (AssistantActivity.instance() == null) {
apply.setEnabled(true); apply.setEnabled(true);
return; return;
} }
if (status.equals(LinphoneAccountCreator.RequestStatus.ErrorServer)) { if (status.equals(AccountCreator.Status.ServerError)) {
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForRequestStatus(LinphoneAccountCreator.RequestStatus.Failed), AssistantActivity.instance()); LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(AccountCreator.Status.RequestFailed), AssistantActivity.instance());
apply.setEnabled(true); apply.setEnabled(true);
} else { } else {
AssistantActivity.instance().displayAssistantCodeConfirm(accountCreator.getUsername(), phoneNumberEdit.getText().toString(), LinphoneUtils.getCountryCode(dialCode), true); AssistantActivity.instance().displayAssistantCodeConfirm(accountCreator.getUsername(), phoneNumberEdit.getText().toString(), LinphoneUtils.getCountryCode(dialCode), true);
@ -380,25 +378,25 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
} }
@Override @Override
public void onAccountCreatorIsAccountLinked(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onIsAccountLinked(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
@Override @Override
public void onAccountCreatorIsPhoneNumberUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onIsAliasUsed(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
if (AssistantActivity.instance() == null) { if (AssistantActivity.instance() == null) {
apply.setEnabled(true); apply.setEnabled(true);
return; return;
} }
if (status.equals(LinphoneAccountCreator.RequestStatus.AliasIsAccount) || status.equals(LinphoneAccountCreator.RequestStatus.AliasExist)) { if (status.equals(AccountCreator.Status.AliasIsAccount) || status.equals(AccountCreator.Status.AliasExist)) {
accountCreator.recoverPhoneAccount(); accountCreator.recoverAccount();
} else { } else {
apply.setEnabled(true); apply.setEnabled(true);
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForRequestStatus(status), AssistantActivity.instance()); LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status), AssistantActivity.instance());
} }
} }
@Override @Override
public void onAccountCreatorPasswordUpdated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) { public void onUpdateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
} }

View file

@ -1,7 +1,7 @@
package org.linphone.assistant; package org.linphone.assistant;
/* /*
LoginFragment.java LoginFragment.java
Copyright (C) 2015 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
import org.linphone.R; import org.linphone.R;
import org.linphone.core.LinphoneAddress.TransportType; import org.linphone.core.Address.TransportType;
import android.app.Fragment; import android.app.Fragment;
import android.os.Bundle; import android.os.Bundle;
@ -32,9 +32,7 @@ import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.RadioGroup; import android.widget.RadioGroup;
import android.widget.Toast; import android.widget.Toast;
/**
* @author Sylvain Berfini
*/
public class LoginFragment extends Fragment implements OnClickListener, TextWatcher { public class LoginFragment extends Fragment implements OnClickListener, TextWatcher {
private EditText login, userid, password, domain; private EditText login, userid, password, domain;
private RadioGroup transports; private RadioGroup transports;
@ -73,12 +71,12 @@ public class LoginFragment extends Fragment implements OnClickListener, TextWatc
TransportType transport; TransportType transport;
if(transports.getCheckedRadioButtonId() == R.id.transport_udp){ if(transports.getCheckedRadioButtonId() == R.id.transport_udp){
transport = TransportType.LinphoneTransportUdp; transport = TransportType.Udp;
} else { } else {
if(transports.getCheckedRadioButtonId() == R.id.transport_tcp){ if(transports.getCheckedRadioButtonId() == R.id.transport_tcp){
transport = TransportType.LinphoneTransportTcp; transport = TransportType.Tcp;
} else { } else {
transport = TransportType.LinphoneTransportTls; transport = TransportType.Tls;
} }
} }

View file

@ -1,7 +1,7 @@
package org.linphone.assistant; package org.linphone.assistant;
/* /*
RemoteProvisioningActivity.java RemoteProvisioningActivity.java
Copyright (C) 2014 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -27,9 +27,9 @@ import org.linphone.LinphoneManager;
import org.linphone.LinphonePreferences; import org.linphone.LinphonePreferences;
import org.linphone.LinphoneService; import org.linphone.LinphoneService;
import org.linphone.R; import org.linphone.R;
import org.linphone.core.LinphoneCore; import org.linphone.core.Core;
import org.linphone.core.LinphoneCore.RemoteProvisioningState; import org.linphone.core.Core.ConfiguringState;
import org.linphone.core.LinphoneCoreListenerBase; import org.linphone.core.CoreListenerStub;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
import android.app.Activity; import android.app.Activity;
@ -43,14 +43,11 @@ import android.view.View;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.Toast; import android.widget.Toast;
/**
* @author Sylvain Berfini
*/
public class RemoteProvisioningActivity extends Activity { public class RemoteProvisioningActivity extends Activity {
private Handler mHandler = new Handler(); private Handler mHandler = new Handler();
private String configUriParam = null; private String configUriParam = null;
private ProgressBar spinner; private ProgressBar spinner;
private LinphoneCoreListenerBase mListener; private CoreListenerStub mListener;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@ -58,13 +55,13 @@ public class RemoteProvisioningActivity extends Activity {
setContentView(R.layout.remote_provisioning); setContentView(R.layout.remote_provisioning);
spinner = (ProgressBar) findViewById(R.id.spinner); spinner = (ProgressBar) findViewById(R.id.spinner);
mListener = new LinphoneCoreListenerBase(){ mListener = new CoreListenerStub(){
@Override @Override
public void configuringStatus(LinphoneCore lc, final RemoteProvisioningState state, String message) { public void onConfiguringStatus(Core lc, final ConfiguringState state, String message) {
if (spinner != null) spinner.setVisibility(View.GONE); if (spinner != null) spinner.setVisibility(View.GONE);
if (state == RemoteProvisioningState.ConfiguringSuccessful) { if (state == ConfiguringState.Successful) {
goToLinphoneActivity(); goToLinphoneActivity();
} else if (state == RemoteProvisioningState.ConfiguringFailed) { } else if (state == ConfiguringState.Failed) {
Toast.makeText(RemoteProvisioningActivity.this, R.string.remote_provisioning_failure, Toast.LENGTH_LONG).show(); Toast.makeText(RemoteProvisioningActivity.this, R.string.remote_provisioning_failure, Toast.LENGTH_LONG).show();
} }
} }
@ -74,7 +71,7 @@ public class RemoteProvisioningActivity extends Activity {
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) { if (lc != null) {
lc.addListener(mListener); lc.addListener(mListener);
} }
@ -85,7 +82,7 @@ public class RemoteProvisioningActivity extends Activity {
@Override @Override
protected void onPause() { protected void onPause() {
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) { if (lc != null) {
lc.removeListener(mListener); lc.removeListener(mListener);
} }
@ -185,7 +182,7 @@ public class RemoteProvisioningActivity extends Activity {
mHandler.postDelayed(new Runnable() { mHandler.postDelayed(new Runnable() {
@Override @Override
public void run() { public void run() {
LinphoneManager.getInstance().restartLinphoneCore(); LinphoneManager.getInstance().restartCore();
} }
}, 1000); }, 1000);
} }

View file

@ -1,7 +1,7 @@
package org.linphone.assistant; package org.linphone.assistant;
/* /*
RemoteProvisioningFragment.java RemoteProvisioningFragment.java
Copyright (C) 2015 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -60,8 +60,8 @@ public class RemoteProvisioningFragment extends Fragment implements OnClickListe
String url = remoteProvisioningUrl.getText().toString(); String url = remoteProvisioningUrl.getText().toString();
AssistantActivity.instance().displayRemoteProvisioningInProgressDialog(); AssistantActivity.instance().displayRemoteProvisioningInProgressDialog();
LinphonePreferences.instance().setRemoteProvisioningUrl(url); LinphonePreferences.instance().setRemoteProvisioningUrl(url);
LinphoneManager.getInstance().restartLinphoneCore(); LinphoneManager.getInstance().restartCore();
AssistantActivity.instance().setLinphoneCoreListener(); AssistantActivity.instance().setCoreListener();
} }
} }

View file

@ -1,7 +1,7 @@
package org.linphone.assistant; package org.linphone.assistant;
/* /*
RemoteProvisioningLoginActivity.java RemoteProvisioningLoginActivity.java
Copyright (C) 2014 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -21,8 +21,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import org.linphone.LinphoneManager; import org.linphone.LinphoneManager;
import org.linphone.LinphonePreferences; import org.linphone.LinphonePreferences;
import org.linphone.R; import org.linphone.R;
import org.linphone.core.LinphoneCore; import org.linphone.core.Core;
import org.linphone.core.LinphoneCoreListenerBase; import org.linphone.core.CoreListenerStub;
import org.linphone.xmlrpc.XmlRpcHelper; import org.linphone.xmlrpc.XmlRpcHelper;
import org.linphone.xmlrpc.XmlRpcListenerBase; import org.linphone.xmlrpc.XmlRpcListenerBase;
@ -34,13 +34,10 @@ import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.Toast; import android.widget.Toast;
/**
* @author Sylvain Berfini
*/
public class RemoteProvisioningLoginActivity extends Activity implements OnClickListener { public class RemoteProvisioningLoginActivity extends Activity implements OnClickListener {
private EditText login, password, domain; private EditText login, password, domain;
private Button connect; private Button connect;
private LinphoneCoreListenerBase mListener; private CoreListenerStub mListener;
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
@ -60,12 +57,12 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick
domain.setEnabled(false); domain.setEnabled(false);
} }
mListener = new LinphoneCoreListenerBase(){ mListener = new CoreListenerStub(){
@Override @Override
public void configuringStatus(LinphoneCore lc, final LinphoneCore.RemoteProvisioningState state, String message) { public void onConfiguringStatus(Core lc, final Core.ConfiguringState state, String message) {
if (state == LinphoneCore.RemoteProvisioningState.ConfiguringSuccessful) { if (state == Core.ConfiguringState.Successful) {
//TODO //TODO
} else if (state == LinphoneCore.RemoteProvisioningState.ConfiguringFailed) { } else if (state == Core.ConfiguringState.Failed) {
Toast.makeText(RemoteProvisioningLoginActivity.this, R.string.remote_provisioning_failure, Toast.LENGTH_LONG).show(); Toast.makeText(RemoteProvisioningLoginActivity.this, R.string.remote_provisioning_failure, Toast.LENGTH_LONG).show();
} }
} }
@ -86,7 +83,7 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick
@Override @Override
public void onRemoteProvisioningFilenameSent(String result) { public void onRemoteProvisioningFilenameSent(String result) {
LinphonePreferences.instance().setRemoteProvisioningUrl(result); LinphonePreferences.instance().setRemoteProvisioningUrl(result);
LinphoneManager.getInstance().restartLinphoneCore(); LinphoneManager.getInstance().restartCore();
} }
}, username.toString(), password.toString(), domain.toString()); }, username.toString(), password.toString(), domain.toString());
@ -94,16 +91,16 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick
setResult(Activity.RESULT_OK); setResult(Activity.RESULT_OK);
finish(); finish();
/*String identity = "sip:" + username + "@" + domain; /*String identity = "sip:" + username + "@" + domain;
LinphoneProxyConfig prxCfg = lc.createProxyConfig(); ProxyConfig prxCfg = lc.createProxyConfig();
try { try {
prxCfg.setIdentity(identity); prxCfg.setIdentityAddress(identity);
lc.addProxyConfig(prxCfg); lc.addProxyConfig(prxCfg);
} catch (LinphoneCoreException e) { } catch (CoreException e) {
Log.e(e); Log.e(e);
return false; return false;
} }
LinphoneAuthInfo authInfo = LinphoneCoreFactory.instance().createAuthInfo(username, null, password, null, null, domain); AuthInfo authInfo = Factory.instance().createAuthInfo(username, null, password, null, null, domain);
lc.addAuthInfo(authInfo); lc.addAuthInfo(authInfo);
if (LinphonePreferences.instance().getAccountCount() == 1) if (LinphonePreferences.instance().getAccountCount() == 1)
@ -115,7 +112,7 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) { if (lc != null) {
lc.addListener(mListener); lc.addListener(mListener);
} }
@ -123,7 +120,7 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick
@Override @Override
protected void onPause() { protected void onPause() {
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) { if (lc != null) {
lc.removeListener(mListener); lc.removeListener(mListener);
} }

View file

@ -1,7 +1,7 @@
package org.linphone.assistant; package org.linphone.assistant;
/* /*
WelcomeFragment.java WelcomeFragment.java
Copyright (C) 2015 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -27,9 +27,6 @@ import android.view.View.OnClickListener;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.Button; import android.widget.Button;
/**
* @author Sylvain Berfini
*/
public class WelcomeFragment extends Fragment implements OnClickListener { public class WelcomeFragment extends Fragment implements OnClickListener {
private Button createAccount, logLinphoneAccount, logGenericAccount, remoteProvisioning; private Button createAccount, logLinphoneAccount, logGenericAccount, remoteProvisioning;

View file

@ -38,9 +38,7 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
/**
* @author Sylvain Berfini
*/
@TargetApi(11) @TargetApi(11)
public class ApiElevenPlus { public class ApiElevenPlus {

View file

@ -21,9 +21,7 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
/**
* @author Sylvain Berfini
*/
@TargetApi(19) @TargetApi(19)
public class ApiNineteenPlus { public class ApiNineteenPlus {
public static void scheduleAlarm(AlarmManager alarmManager, int type, long triggerAtMillis, PendingIntent operation) { public static void scheduleAlarm(AlarmManager alarmManager, int type, long triggerAtMillis, PendingIntent operation) {

View file

@ -27,9 +27,7 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
/**
* @author Sylvain Berfini
*/
@TargetApi(16) @TargetApi(16)
public class ApiSixteenPlus { public class ApiSixteenPlus {

View file

@ -28,9 +28,7 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
/**
* @author Sylvain Berfini
*/
@TargetApi(21) @TargetApi(21)
public class ApiTwentyOnePlus { public class ApiTwentyOnePlus {

View file

@ -31,9 +31,6 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
/**
* @author Erwan Croze
*/
@TargetApi(26) @TargetApi(26)
public class ApiTwentySixPlus { public class ApiTwentySixPlus {

View file

@ -21,9 +21,7 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
/**
* @author Sylvain Berfini
*/
@TargetApi(23) @TargetApi(23)
public class ApiTwentyThreePlus { public class ApiTwentyThreePlus {
public static void setTextAppearance(TextView textview, int style) { public static void setTextAppearance(TextView textview, int style) {

View file

@ -32,9 +32,7 @@ import android.text.Spanned;
import android.view.ViewTreeObserver; import android.view.ViewTreeObserver;
import android.view.ViewTreeObserver.OnGlobalLayoutListener; import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import android.widget.TextView; import android.widget.TextView;
/**
* @author Sylvain Berfini
*/
public class Compatibility { public class Compatibility {
public static void CreateChannel(Context context) { public static void CreateChannel(Context context) {
if (Version.sdkAboveOrEqual(Version.API26_O_80)) { if (Version.sdkAboveOrEqual(Version.API26_O_80)) {

View file

@ -1,5 +1,24 @@
package org.linphone.compatibility; package org.linphone.compatibility;
/*
CompatibilityScaleGestureDetector.java
Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.content.Context; import android.content.Context;
import android.view.MotionEvent; import android.view.MotionEvent;

View file

@ -1,5 +1,23 @@
package org.linphone.compatibility; package org.linphone.compatibility;
/*
CompatibilityScaleGestureListener.java
Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
public interface CompatibilityScaleGestureListener { public interface CompatibilityScaleGestureListener {
public boolean onScale(CompatibilityScaleGestureDetector detector); public boolean onScale(CompatibilityScaleGestureDetector detector);

View file

@ -25,9 +25,7 @@ import com.google.firebase.iid.FirebaseInstanceIdService;
import org.linphone.LinphonePreferences; import org.linphone.LinphonePreferences;
import org.linphone.UIThreadDispatcher; import org.linphone.UIThreadDispatcher;
/**
* @author Erwan Croze
*/
public class FirebaseIdService extends FirebaseInstanceIdService { public class FirebaseIdService extends FirebaseInstanceIdService {
@Override @Override
public void onTokenRefresh() { public void onTokenRefresh() {

View file

@ -1,3 +1,5 @@
package org.linphone.firebase;
/* /*
FirebaseMessaging.java FirebaseMessaging.java
Copyright (C) 2017 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
@ -17,8 +19,6 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
package org.linphone.firebase;
import android.content.Intent; import android.content.Intent;
import com.google.firebase.messaging.FirebaseMessagingService; import com.google.firebase.messaging.FirebaseMessagingService;
@ -29,9 +29,7 @@ import org.linphone.LinphoneService;
import org.linphone.UIThreadDispatcher; import org.linphone.UIThreadDispatcher;
import static android.content.Intent.ACTION_MAIN; import static android.content.Intent.ACTION_MAIN;
/**
* @author Erwan Croze
*/
public class FirebaseMessaging extends FirebaseMessagingService { public class FirebaseMessaging extends FirebaseMessagingService {
public FirebaseMessaging() { public FirebaseMessaging() {
} }

View file

@ -1,7 +1,7 @@
package org.linphone.gcm; package org.linphone.gcm;
/* /*
GCMReceiver.java GCMReceiver.java
Copyright (C) 2012 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -22,9 +22,7 @@ import android.content.Context;
import com.google.android.gcm.GCMBroadcastReceiver; import com.google.android.gcm.GCMBroadcastReceiver;
/**
* @author Sylvain Berfini
*/
public class GCMReceiver extends GCMBroadcastReceiver { public class GCMReceiver extends GCMBroadcastReceiver {
@Override @Override
protected String getGCMIntentServiceClassName(Context context) { protected String getGCMIntentServiceClassName(Context context) {

View file

@ -1,7 +1,7 @@
package org.linphone.gcm; package org.linphone.gcm;
/* /*
GCMService.java GCMService.java
Copyright (C) 2012 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -25,7 +25,7 @@ import org.linphone.LinphonePreferences;
import org.linphone.LinphoneService; import org.linphone.LinphoneService;
import org.linphone.R; import org.linphone.R;
import org.linphone.UIThreadDispatcher; import org.linphone.UIThreadDispatcher;
import org.linphone.core.LinphoneCoreFactory; import org.linphone.core.Factory;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
import android.content.Context; import android.content.Context;
@ -33,9 +33,6 @@ import android.content.Intent;
import com.google.android.gcm.GCMBaseIntentService; import com.google.android.gcm.GCMBaseIntentService;
/**
* @author Sylvain Berfini
*/
// Warning ! Do not rename the service ! // Warning ! Do not rename the service !
public class GCMService extends GCMBaseIntentService { public class GCMService extends GCMBaseIntentService {
@ -46,8 +43,8 @@ public class GCMService extends GCMBaseIntentService {
private void initLogger(Context context) { private void initLogger(Context context) {
LinphonePreferences.instance().setContext(context); LinphonePreferences.instance().setContext(context);
boolean isDebugEnabled = LinphonePreferences.instance().isDebugEnabled(); boolean isDebugEnabled = LinphonePreferences.instance().isDebugEnabled();
LinphoneCoreFactory.instance().enableLogCollection(isDebugEnabled); Factory.instance().enableLogCollection(isDebugEnabled);
LinphoneCoreFactory.instance().setDebugMode(isDebugEnabled, context.getString(R.string.app_name)); Factory.instance().setDebugMode(isDebugEnabled, context.getString(R.string.app_name));
} }
@Override @Override
@ -62,7 +59,7 @@ public class GCMService extends GCMBaseIntentService {
Log.d("[Push Notification] Received"); Log.d("[Push Notification] Received");
if (!LinphoneService.isReady()) { if (!LinphoneService.isReady()) {
startService(new Intent(ACTION_MAIN).setClass(this, LinphoneService.class)); context.startService(new Intent(ACTION_MAIN).setClass(context, LinphoneService.class));
} else if (LinphoneManager.isInstanciated() && LinphoneManager.getLc().getCallsNb() == 0) { } else if (LinphoneManager.isInstanciated() && LinphoneManager.getLc().getCallsNb() == 0) {
UIThreadDispatcher.dispatch(new Runnable(){ UIThreadDispatcher.dispatch(new Runnable(){
@Override @Override

View file

@ -1,7 +1,7 @@
package org.linphone.purchase; package org.linphone.purchase;
/* /*
InAppPurchaseListener.java InAppPurchaseListener.java
Copyright (C) 2015 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -39,9 +39,6 @@ import android.widget.ImageView;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.Toast; import android.widget.Toast;
/**
* @author Sylvain Berfini
*/
public class InAppPurchaseActivity extends Activity implements InAppPurchaseListener, OnClickListener { public class InAppPurchaseActivity extends Activity implements InAppPurchaseListener, OnClickListener {
private static InAppPurchaseActivity instance; private static InAppPurchaseActivity instance;
private InAppPurchaseHelper inAppPurchaseHelper; private InAppPurchaseHelper inAppPurchaseHelper;

View file

@ -1,7 +1,7 @@
package org.linphone.purchase; package org.linphone.purchase;
/* /*
InAppPurchaseFragment.java InAppPurchaseFragment.java
Copyright (C) 2016 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -23,7 +23,7 @@ import java.util.Locale;
import org.linphone.LinphoneManager; import org.linphone.LinphoneManager;
import org.linphone.LinphonePreferences; import org.linphone.LinphonePreferences;
import org.linphone.R; import org.linphone.R;
import org.linphone.core.LinphoneProxyConfig; import org.linphone.core.ProxyConfig;
import android.app.Fragment; import android.app.Fragment;
import android.os.Bundle; import android.os.Bundle;
@ -116,7 +116,7 @@ public class InAppPurchaseFragment extends Fragment implements View.OnClickListe
} }
private boolean isUsernameCorrect(String username) { private boolean isUsernameCorrect(String username) {
LinphoneProxyConfig lpc = LinphoneManager.getLc().createProxyConfig(); ProxyConfig lpc = LinphoneManager.getLc().createProxyConfig();
return lpc.isPhoneNumber(username); return lpc.isPhoneNumber(username);
} }
@ -139,7 +139,7 @@ public class InAppPurchaseFragment extends Fragment implements View.OnClickListe
private String getUsername() { private String getUsername() {
String username = this.username.getText().toString(); String username = this.username.getText().toString();
LinphoneProxyConfig lpc = LinphoneManager.getLc().createProxyConfig(); ProxyConfig lpc = LinphoneManager.getLc().createProxyConfig();
username = lpc.normalizePhoneNumber(username); username = lpc.normalizePhoneNumber(username);
return username.toLowerCase(Locale.getDefault()); return username.toLowerCase(Locale.getDefault());
} }

View file

@ -1,7 +1,7 @@
package org.linphone.purchase; package org.linphone.purchase;
/* /*
InAppPurchaseHelper.java InAppPurchaseHelper.java
Copyright (C) 2015 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -45,9 +45,6 @@ import android.util.Patterns;
import com.android.vending.billing.IInAppBillingService; import com.android.vending.billing.IInAppBillingService;
/**
* @author Sylvain Berfini
*/
public class InAppPurchaseHelper { public class InAppPurchaseHelper {
public static final int API_VERSION = 3; public static final int API_VERSION = 3;
public static final int ACTIVITY_RESULT_CODE_PURCHASE_ITEM = 11089; public static final int ACTIVITY_RESULT_CODE_PURCHASE_ITEM = 11089;

View file

@ -2,7 +2,7 @@ package org.linphone.purchase;
/* /*
InAppPurchaseListFragment.java InAppPurchaseListFragment.java
Copyright (C) 2016 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View file

@ -1,7 +1,7 @@
package org.linphone.purchase; package org.linphone.purchase;
/* /*
InAppPurchaseListener.java InAppPurchaseListener.java
Copyright (C) 2015 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -20,9 +20,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import java.util.ArrayList; import java.util.ArrayList;
/**
* @author Sylvain Berfini
*/
public interface InAppPurchaseListener { public interface InAppPurchaseListener {
/** /**
* Callback called when the in-app purchase listener is connected and available for queries * Callback called when the in-app purchase listener is connected and available for queries

View file

@ -1,5 +1,24 @@
package org.linphone.purchase; package org.linphone.purchase;
/*
InAppPurchaseListenerBase.java
Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import java.util.ArrayList; import java.util.ArrayList;
public class InAppPurchaseListenerBase implements InAppPurchaseListener { public class InAppPurchaseListenerBase implements InAppPurchaseListener {

View file

@ -7,7 +7,7 @@ import java.util.Locale;
/* /*
Purchasable.java Purchasable.java
Copyright (C) 2015 Belledonne Communications, Grenoble, France Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -24,9 +24,6 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
/**
* @author Sylvain Berfini
*/
public class Purchasable { public class Purchasable {
private String id, title, description, price; private String id, title, description, price;
private long expire; private long expire;

Some files were not shown because too many files have changed in this diff Show more