Clean headers
This commit is contained in:
parent
12b1618a19
commit
0d3599f745
115 changed files with 967 additions and 659 deletions
|
@ -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,33 +22,30 @@ 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;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
mManager = new LinphoneMiniManager(this);
|
mManager = new LinphoneMiniManager(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
mManager.destroy();
|
mManager.destroy();
|
||||||
|
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,25 +52,22 @@ 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;
|
||||||
private LinphoneCore mLinphoneCore;
|
private LinphoneCore mLinphoneCore;
|
||||||
private Timer mTimer;
|
private Timer mTimer;
|
||||||
|
|
||||||
public LinphoneMiniManager(Context c) {
|
public LinphoneMiniManager(Context c) {
|
||||||
mContext = c;
|
mContext = c;
|
||||||
LinphoneCoreFactory.instance().setDebugMode(true, "Linphone Mini");
|
LinphoneCoreFactory.instance().setDebugMode(true, "Linphone Mini");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String basePath = mContext.getFilesDir().getAbsolutePath();
|
String basePath = mContext.getFilesDir().getAbsolutePath();
|
||||||
copyAssetsFromPackage(basePath);
|
copyAssetsFromPackage(basePath);
|
||||||
mLinphoneCore = LinphoneCoreFactory.instance().createLinphoneCore(this, basePath + "/.linphonerc", basePath + "/linphonerc", null, mContext);
|
mLinphoneCore = LinphoneCoreFactory.instance().createLinphoneCore(this, basePath + "/.linphonerc", basePath + "/linphonerc", null, mContext);
|
||||||
initLinphoneCoreValues(basePath);
|
initLinphoneCoreValues(basePath);
|
||||||
|
|
||||||
setUserAgent();
|
setUserAgent();
|
||||||
setFrontCamAsDefault();
|
setFrontCamAsDefault();
|
||||||
startIterate();
|
startIterate();
|
||||||
|
@ -79,11 +77,11 @@ public class LinphoneMiniManager implements LinphoneCoreListener {
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LinphoneMiniManager getInstance() {
|
public static LinphoneMiniManager getInstance() {
|
||||||
return mInstance;
|
return mInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
try {
|
try {
|
||||||
mTimer.cancel();
|
mTimer.cancel();
|
||||||
|
@ -96,7 +94,7 @@ public class LinphoneMiniManager implements LinphoneCoreListener {
|
||||||
mInstance = null;
|
mInstance = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startIterate() {
|
private void startIterate() {
|
||||||
TimerTask lTask = new TimerTask() {
|
TimerTask lTask = new TimerTask() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -104,12 +102,12 @@ public class LinphoneMiniManager implements LinphoneCoreListener {
|
||||||
mLinphoneCore.iterate();
|
mLinphoneCore.iterate();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*use schedule instead of scheduleAtFixedRate to avoid iterate from being call in burst after cpu wake up*/
|
/*use schedule instead of scheduleAtFixedRate to avoid iterate from being call in burst after cpu wake up*/
|
||||||
mTimer = new Timer("LinphoneMini scheduler");
|
mTimer = new Timer("LinphoneMini scheduler");
|
||||||
mTimer.schedule(lTask, 0, 20);
|
mTimer.schedule(lTask, 0, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUserAgent() {
|
private void setUserAgent() {
|
||||||
try {
|
try {
|
||||||
String versionName = mContext.getPackageManager().getPackageInfo(mContext.getPackageName(), 0).versionName;
|
String versionName = mContext.getPackageManager().getPackageInfo(mContext.getPackageName(), 0).versionName;
|
||||||
|
@ -120,7 +118,7 @@ public class LinphoneMiniManager implements LinphoneCoreListener {
|
||||||
} catch (NameNotFoundException e) {
|
} catch (NameNotFoundException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setFrontCamAsDefault() {
|
private void setFrontCamAsDefault() {
|
||||||
int camId = 0;
|
int camId = 0;
|
||||||
AndroidCamera[] cameras = AndroidCameraConfiguration.retrieveCameras();
|
AndroidCamera[] cameras = AndroidCameraConfiguration.retrieveCameras();
|
||||||
|
@ -130,7 +128,7 @@ public class LinphoneMiniManager implements LinphoneCoreListener {
|
||||||
}
|
}
|
||||||
mLinphoneCore.setVideoDevice(camId);
|
mLinphoneCore.setVideoDevice(camId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void copyAssetsFromPackage(String basePath) throws IOException {
|
private void copyAssetsFromPackage(String basePath) throws IOException {
|
||||||
LinphoneMiniUtils.copyIfNotExist(mContext, R.raw.oldphone_mono, basePath + "/oldphone_mono.wav");
|
LinphoneMiniUtils.copyIfNotExist(mContext, R.raw.oldphone_mono, basePath + "/oldphone_mono.wav");
|
||||||
LinphoneMiniUtils.copyIfNotExist(mContext, R.raw.ringback, basePath + "/ringback.wav");
|
LinphoneMiniUtils.copyIfNotExist(mContext, R.raw.ringback, basePath + "/ringback.wav");
|
||||||
|
@ -140,21 +138,21 @@ public class LinphoneMiniManager implements LinphoneCoreListener {
|
||||||
LinphoneMiniUtils.copyIfNotExist(mContext, R.raw.lpconfig, basePath + "/lpconfig.xsd");
|
LinphoneMiniUtils.copyIfNotExist(mContext, R.raw.lpconfig, basePath + "/lpconfig.xsd");
|
||||||
LinphoneMiniUtils.copyIfNotExist(mContext, R.raw.rootca, basePath + "/rootca.pem");
|
LinphoneMiniUtils.copyIfNotExist(mContext, R.raw.rootca, basePath + "/rootca.pem");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initLinphoneCoreValues(String basePath) {
|
private void initLinphoneCoreValues(String basePath) {
|
||||||
mLinphoneCore.setContext(mContext);
|
mLinphoneCore.setContext(mContext);
|
||||||
mLinphoneCore.setRing(null);
|
mLinphoneCore.setRing(null);
|
||||||
mLinphoneCore.setRootCA(basePath + "/rootca.pem");
|
mLinphoneCore.setRootCA(basePath + "/rootca.pem");
|
||||||
mLinphoneCore.setPlayFile(basePath + "/toy_mono.wav");
|
mLinphoneCore.setPlayFile(basePath + "/toy_mono.wav");
|
||||||
mLinphoneCore.setChatDatabasePath(basePath + "/linphone-history.db");
|
mLinphoneCore.setChatDatabasePath(basePath + "/linphone-history.db");
|
||||||
|
|
||||||
int availableCores = Runtime.getRuntime().availableProcessors();
|
int availableCores = Runtime.getRuntime().availableProcessors();
|
||||||
mLinphoneCore.setCpuCount(availableCores);
|
mLinphoneCore.setCpuCount(availableCores);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void authInfoRequested(LinphoneCore lc, String realm, String username) {
|
public void authInfoRequested(LinphoneCore lc, String realm, String username) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -171,13 +169,13 @@ public class LinphoneMiniManager implements LinphoneCoreListener {
|
||||||
@Override
|
@Override
|
||||||
public void callStatsUpdated(LinphoneCore lc, LinphoneCall call,
|
public void callStatsUpdated(LinphoneCore lc, LinphoneCall call,
|
||||||
LinphoneCallStats stats) {
|
LinphoneCallStats stats) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void callEncryptionChanged(LinphoneCore lc, LinphoneCall call,
|
public void callEncryptionChanged(LinphoneCore lc, LinphoneCall call,
|
||||||
boolean encrypted, String authenticationToken) {
|
boolean encrypted, String authenticationToken) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -189,18 +187,18 @@ public class LinphoneMiniManager implements LinphoneCoreListener {
|
||||||
@Override
|
@Override
|
||||||
public void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf,
|
public void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf,
|
||||||
String url) {
|
String url) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf) {
|
public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void textReceived(LinphoneCore lc, LinphoneChatRoom cr,
|
public void textReceived(LinphoneCore lc, LinphoneChatRoom cr,
|
||||||
LinphoneAddress from, String message) {
|
LinphoneAddress from, String message) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -216,37 +214,37 @@ public class LinphoneMiniManager implements LinphoneCoreListener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dtmfReceived(LinphoneCore lc, LinphoneCall call, int dtmf) {
|
public void dtmfReceived(LinphoneCore lc, LinphoneCall call, int dtmf) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void ecCalibrationStatus(LinphoneCore lc, EcCalibratorStatus status,
|
public void ecCalibrationStatus(LinphoneCore lc, EcCalibratorStatus status,
|
||||||
int delay_ms, Object data) {
|
int delay_ms, Object data) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void notifyReceived(LinphoneCore lc, LinphoneCall call,
|
public void notifyReceived(LinphoneCore lc, LinphoneCall call,
|
||||||
LinphoneAddress from, byte[] event) {
|
LinphoneAddress from, byte[] event) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void transferState(LinphoneCore lc, LinphoneCall call,
|
public void transferState(LinphoneCore lc, LinphoneCall call,
|
||||||
State new_call_state) {
|
State new_call_state) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void infoReceived(LinphoneCore lc, LinphoneCall call,
|
public void infoReceived(LinphoneCore lc, LinphoneCall call,
|
||||||
LinphoneInfoMessage info) {
|
LinphoneInfoMessage info) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void subscriptionStateChanged(LinphoneCore lc, LinphoneEvent ev,
|
public void subscriptionStateChanged(LinphoneCore lc, LinphoneEvent ev,
|
||||||
SubscriptionState state) {
|
SubscriptionState state) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -258,7 +256,7 @@ public class LinphoneMiniManager implements LinphoneCoreListener {
|
||||||
@Override
|
@Override
|
||||||
public void publishStateChanged(LinphoneCore lc, LinphoneEvent ev,
|
public void publishStateChanged(LinphoneCore lc, LinphoneEvent ev,
|
||||||
PublishState state) {
|
PublishState state) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -269,22 +267,22 @@ public class LinphoneMiniManager implements LinphoneCoreListener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void show(LinphoneCore lc) {
|
public void show(LinphoneCore lc) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void displayStatus(LinphoneCore lc, String message) {
|
public void displayStatus(LinphoneCore lc, String message) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void displayMessage(LinphoneCore lc, String message) {
|
public void displayMessage(LinphoneCore lc, String message) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void displayWarning(LinphoneCore lc, String message) {
|
public void displayWarning(LinphoneCore lc, String message) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,19 +26,16 @@ 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);
|
||||||
if (!lFileToCopy.exists()) {
|
if (!lFileToCopy.exists()) {
|
||||||
copyFromPackage(context, ressourceId, lFileToCopy.getName());
|
copyFromPackage(context, ressourceId, lFileToCopy.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void copyFromPackage(Context context, int ressourceId, String target) throws IOException {
|
public static void copyFromPackage(Context context, int ressourceId, String target) throws IOException {
|
||||||
FileOutputStream lOutputStream = context.openFileOutput (target, 0);
|
FileOutputStream lOutputStream = context.openFileOutput (target, 0);
|
||||||
InputStream lInputStream = context.getResources().openRawResource(ressourceId);
|
InputStream lInputStream = context.getResources().openRawResource(ressourceId);
|
||||||
int readByte;
|
int readByte;
|
||||||
byte[] buff = new byte[8048];
|
byte[] buff = new byte[8048];
|
||||||
|
|
|
@ -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
|
||||||
|
@ -40,9 +40,6 @@ 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;
|
||||||
|
@ -74,12 +71,12 @@ public class AboutFragment extends Fragment implements OnClickListener {
|
||||||
resetLogButton = view.findViewById(R.id.reset_log);
|
resetLogButton = view.findViewById(R.id.reset_log);
|
||||||
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 LinphoneCoreListenerBase() {
|
||||||
@Override
|
@Override
|
||||||
public void uploadProgressIndication(LinphoneCore lc, int offset, int total) {
|
public void uploadProgressIndication(LinphoneCore lc, int offset, int total) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void uploadStateChanged(LinphoneCore lc, LogCollectionUploadState state, String info) {
|
public void uploadStateChanged(LinphoneCore lc, LogCollectionUploadState state, String info) {
|
||||||
if (state == LogCollectionUploadState.LogCollectionUploadStateInProgress) {
|
if (state == LogCollectionUploadState.LogCollectionUploadStateInProgress) {
|
||||||
|
@ -96,13 +93,13 @@ public class AboutFragment extends Fragment implements OnClickListener {
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayUploadLogsInProgress() {
|
private void displayUploadLogsInProgress() {
|
||||||
if (uploadInProgress) {
|
if (uploadInProgress) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uploadInProgress = true;
|
uploadInProgress = true;
|
||||||
|
|
||||||
progress = ProgressDialog.show(LinphoneActivity.instance(), null, null);
|
progress = ProgressDialog.show(LinphoneActivity.instance(), null, null);
|
||||||
Drawable d = new ColorDrawable(ContextCompat.getColor(getActivity(), R.color.colorE));
|
Drawable d = new ColorDrawable(ContextCompat.getColor(getActivity(), R.color.colorE));
|
||||||
d.setAlpha(200);
|
d.setAlpha(200);
|
||||||
|
@ -134,7 +131,7 @@ public class AboutFragment extends Fragment implements OnClickListener {
|
||||||
if (lc != null) {
|
if (lc != null) {
|
||||||
lc.removeListener(mListener);
|
lc.removeListener(mListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
super.onPause();
|
super.onPause();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,11 +141,11 @@ public class AboutFragment extends Fragment implements OnClickListener {
|
||||||
if (lc != null) {
|
if (lc != null) {
|
||||||
lc.addListener(mListener);
|
lc.addListener(mListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LinphoneActivity.isInstanciated()) {
|
if (LinphoneActivity.isInstanciated()) {
|
||||||
LinphoneActivity.instance().selectMenu(FragmentsAvailable.ABOUT);
|
LinphoneActivity.instance().selectMenu(FragmentsAvailable.ABOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
super.onResume();
|
super.onResume();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,7 +166,7 @@ public class AboutFragment extends Fragment implements OnClickListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
|
|
|
@ -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";
|
||||||
|
|
|
@ -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
|
||||||
|
@ -53,9 +53,6 @@ import android.view.WindowManager;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Sylvain Berfini
|
|
||||||
*/
|
|
||||||
public class AccountPreferencesFragment extends PreferencesListFragment implements LinphoneAccountCreator.LinphoneAccountCreatorListener {
|
public class AccountPreferencesFragment extends PreferencesListFragment implements LinphoneAccountCreator.LinphoneAccountCreatorListener {
|
||||||
private int n;
|
private int n;
|
||||||
private boolean isNewAccount=false;
|
private boolean isNewAccount=false;
|
||||||
|
|
|
@ -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,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 org.linphone.core.LinphoneCallParams;
|
import org.linphone.core.LinphoneCallParams;
|
||||||
import org.linphone.core.LinphoneCore;
|
import org.linphone.core.LinphoneCore;
|
||||||
|
@ -28,7 +29,7 @@ public class BandwidthManager {
|
||||||
public static final int LOW_BANDWIDTH = 2;
|
public static final int LOW_BANDWIDTH = 2;
|
||||||
|
|
||||||
private static BandwidthManager instance;
|
private static BandwidthManager instance;
|
||||||
|
|
||||||
private int currentProfile = HIGH_RESOLUTION;
|
private int currentProfile = HIGH_RESOLUTION;
|
||||||
public int getCurrentProfile() {return currentProfile;}
|
public int getCurrentProfile() {return currentProfile;}
|
||||||
|
|
||||||
|
@ -41,7 +42,7 @@ public class BandwidthManager {
|
||||||
private BandwidthManager() {
|
private BandwidthManager() {
|
||||||
// FIXME register a listener on NetworkManager to get notified of network state
|
// FIXME register a listener on NetworkManager to get notified of network state
|
||||||
// FIXME register a listener on Preference to get notified of change in video enable value
|
// FIXME register a listener on Preference to get notified of change in video enable value
|
||||||
|
|
||||||
// FIXME initially get those values
|
// FIXME initially get those values
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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,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 org.linphone.core.LinphoneCoreFactory;
|
import org.linphone.core.LinphoneCoreFactory;
|
||||||
import org.linphone.core.LpConfig;
|
import org.linphone.core.LpConfig;
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -84,9 +86,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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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,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 org.linphone.core.LinphoneAddress;
|
import org.linphone.core.LinphoneAddress;
|
||||||
import org.linphone.core.LinphoneCall;
|
import org.linphone.core.LinphoneCall;
|
||||||
|
@ -28,30 +29,27 @@ import org.linphone.mediastream.Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle call updating, reinvites.
|
* Handle call updating, reinvites.
|
||||||
*
|
|
||||||
* @author Guillaume Beraudo
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class CallManager {
|
public class CallManager {
|
||||||
|
|
||||||
private static CallManager instance;
|
private static CallManager instance;
|
||||||
|
|
||||||
private CallManager() {}
|
private CallManager() {}
|
||||||
public static final synchronized CallManager getInstance() {
|
public static final synchronized CallManager getInstance() {
|
||||||
if (instance == null) instance = new CallManager();
|
if (instance == null) instance = new CallManager();
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
private BandwidthManager bm() {
|
private BandwidthManager bm() {
|
||||||
return BandwidthManager.getInstance();
|
return BandwidthManager.getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void inviteAddress(LinphoneAddress lAddress, boolean videoEnabled, boolean lowBandwidth) throws LinphoneCoreException {
|
public void inviteAddress(LinphoneAddress lAddress, boolean videoEnabled, boolean lowBandwidth) throws LinphoneCoreException {
|
||||||
LinphoneCore lc = LinphoneManager.getLc();
|
LinphoneCore lc = LinphoneManager.getLc();
|
||||||
|
|
||||||
LinphoneCallParams params = lc.createCallParams(null);
|
LinphoneCallParams params = lc.createCallParams(null);
|
||||||
bm().updateWithProfileSettings(lc, params);
|
bm().updateWithProfileSettings(lc, params);
|
||||||
|
|
||||||
|
@ -60,7 +58,7 @@ public class CallManager {
|
||||||
} else {
|
} else {
|
||||||
params.setVideoEnabled(false);
|
params.setVideoEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lowBandwidth) {
|
if (lowBandwidth) {
|
||||||
params.enableLowBandwidth(true);
|
params.enableLowBandwidth(true);
|
||||||
Log.d("Low bandwidth enabled in call params");
|
Log.d("Low bandwidth enabled in call params");
|
||||||
|
@ -71,7 +69,7 @@ public class CallManager {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add video to a currently running voice only call.
|
* Add video to a currently running voice only call.
|
||||||
* No re-invite is sent if the current call is already video
|
* No re-invite is sent if the current call is already video
|
||||||
|
@ -88,7 +86,7 @@ public class CallManager {
|
||||||
LinphoneCallParams params = lc.createCallParams(lCall);
|
LinphoneCallParams params = lc.createCallParams(lCall);
|
||||||
|
|
||||||
if (params.getVideoEnabled()) return false;
|
if (params.getVideoEnabled()) return false;
|
||||||
|
|
||||||
|
|
||||||
// Check if video possible regarding bandwidth limitations
|
// Check if video possible regarding bandwidth limitations
|
||||||
bm().updateWithProfileSettings(lc, params);
|
bm().updateWithProfileSettings(lc, params);
|
||||||
|
@ -104,7 +102,7 @@ public class CallManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Re-invite with parameters updated from profile.
|
* Re-invite with parameters updated from profile.
|
||||||
*/
|
*/
|
||||||
|
@ -136,5 +134,5 @@ public class CallManager {
|
||||||
bm().updateWithProfileSettings(lc, params);
|
bm().updateWithProfileSettings(lc, params);
|
||||||
lc.updateCall(lCall, null);
|
lc.updateCall(lCall, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,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.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
|
@ -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,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 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;
|
||||||
|
@ -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;
|
||||||
|
@ -52,24 +51,24 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
|
||||||
private CompatibilityScaleGestureDetector mScaleDetector;
|
private CompatibilityScaleGestureDetector mScaleDetector;
|
||||||
private CallActivity inCallActivity;
|
private CallActivity inCallActivity;
|
||||||
private int previewX, previewY;
|
private int previewX, previewY;
|
||||||
|
|
||||||
@SuppressWarnings("deprecation") // Warning useless because value is ignored and automatically set by new APIs.
|
@SuppressWarnings("deprecation") // Warning useless because value is ignored and automatically set by new APIs.
|
||||||
@Override
|
@Override
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
mVideoView = (SurfaceView) view.findViewById(R.id.videoSurface);
|
mVideoView = (SurfaceView) view.findViewById(R.id.videoSurface);
|
||||||
mCaptureView = (SurfaceView) view.findViewById(R.id.videoCaptureSurface);
|
mCaptureView = (SurfaceView) view.findViewById(R.id.videoCaptureSurface);
|
||||||
mCaptureView.getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); // Warning useless because value is ignored and automatically set by new APIs.
|
mCaptureView.getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); // Warning useless because value is ignored and automatically set by new APIs.
|
||||||
|
|
||||||
fixZOrder(mVideoView, mCaptureView);
|
fixZOrder(mVideoView, mCaptureView);
|
||||||
|
|
||||||
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;
|
||||||
|
@ -77,7 +76,7 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onVideoRenderingSurfaceDestroyed(AndroidVideoWindowImpl vw) {
|
public void onVideoRenderingSurfaceDestroyed(AndroidVideoWindowImpl vw) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onVideoPreviewSurfaceReady(AndroidVideoWindowImpl vw, SurfaceView surface) {
|
public void onVideoPreviewSurfaceReady(AndroidVideoWindowImpl vw, SurfaceView surface) {
|
||||||
|
@ -86,16 +85,16 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onVideoPreviewSurfaceDestroyed(AndroidVideoWindowImpl vw) {
|
public void onVideoPreviewSurfaceDestroyed(AndroidVideoWindowImpl vw) {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mVideoView.setOnTouchListener(new OnTouchListener() {
|
mVideoView.setOnTouchListener(new OnTouchListener() {
|
||||||
public boolean onTouch(View v, MotionEvent event) {
|
public boolean onTouch(View v, MotionEvent event) {
|
||||||
if (mScaleDetector != null) {
|
if (mScaleDetector != null) {
|
||||||
mScaleDetector.onTouchEvent(event);
|
mScaleDetector.onTouchEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
mGestureDetector.onTouchEvent(event);
|
mGestureDetector.onTouchEvent(event);
|
||||||
if (inCallActivity != null) {
|
if (inCallActivity != null) {
|
||||||
inCallActivity.displayVideoCallControlsIfHidden();
|
inCallActivity.displayVideoCallControlsIfHidden();
|
||||||
|
@ -103,7 +102,7 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mCaptureView.setOnTouchListener(new OnTouchListener() {
|
mCaptureView.setOnTouchListener(new OnTouchListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouch(View view, MotionEvent motionEvent) {
|
public boolean onTouch(View view, MotionEvent motionEvent) {
|
||||||
|
@ -130,7 +129,7 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
|
||||||
});
|
});
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
|
@ -145,14 +144,14 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
|
||||||
preview.setZOrderOnTop(true);
|
preview.setZOrderOnTop(true);
|
||||||
preview.setZOrderMediaOverlay(true); // Needed to be able to display control layout over
|
preview.setZOrderMediaOverlay(true); // Needed to be able to display control layout over
|
||||||
}
|
}
|
||||||
|
|
||||||
public void switchCamera() {
|
public void switchCamera() {
|
||||||
try {
|
try {
|
||||||
int videoDeviceId = LinphoneManager.getLc().getVideoDevice();
|
int videoDeviceId = LinphoneManager.getLc().getVideoDevice();
|
||||||
videoDeviceId = (videoDeviceId + 1) % AndroidCameraConfiguration.retrieveCameras().length;
|
videoDeviceId = (videoDeviceId + 1) % AndroidCameraConfiguration.retrieveCameras().length;
|
||||||
LinphoneManager.getLc().setVideoDevice(videoDeviceId);
|
LinphoneManager.getLc().setVideoDevice(videoDeviceId);
|
||||||
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) {
|
||||||
|
@ -162,11 +161,11 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
|
||||||
Log.e("Cannot swtich camera : no camera");
|
Log.e("Cannot swtich camera : no camera");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
if (LinphonePreferences.instance().isOverlayEnabled()) {
|
if (LinphonePreferences.instance().isOverlayEnabled()) {
|
||||||
LinphoneService.instance().destroyOverlay();
|
LinphoneService.instance().destroyOverlay();
|
||||||
}
|
}
|
||||||
|
@ -175,13 +174,13 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
|
||||||
LinphoneManager.getLc().setVideoWindow(androidVideoWindowImpl);
|
LinphoneManager.getLc().setVideoWindow(androidVideoWindowImpl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mGestureDetector = new GestureDetector(inCallActivity, this);
|
mGestureDetector = new GestureDetector(inCallActivity, this);
|
||||||
mScaleDetector = Compatibility.getScaleGestureDetector(inCallActivity, this);
|
mScaleDetector = Compatibility.getScaleGestureDetector(inCallActivity, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
if (androidVideoWindowImpl != null) {
|
if (androidVideoWindowImpl != null) {
|
||||||
synchronized (androidVideoWindowImpl) {
|
synchronized (androidVideoWindowImpl) {
|
||||||
/*
|
/*
|
||||||
|
@ -194,10 +193,10 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
|
||||||
if (LinphonePreferences.instance().isOverlayEnabled()) {
|
if (LinphonePreferences.instance().isOverlayEnabled()) {
|
||||||
LinphoneService.instance().createOverlay();
|
LinphoneService.instance().createOverlay();
|
||||||
}
|
}
|
||||||
|
|
||||||
super.onPause();
|
super.onPause();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onScale(CompatibilityScaleGestureDetector detector) {
|
public boolean onScale(CompatibilityScaleGestureDetector detector) {
|
||||||
mZoomFactor *= detector.getScaleFactor();
|
mZoomFactor *= detector.getScaleFactor();
|
||||||
// Don't let the object get too small or too large.
|
// Don't let the object get too small or too large.
|
||||||
|
@ -230,7 +229,7 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
|
||||||
} else if(distanceY > 0 && mZoomCenterY > 0) {
|
} else if(distanceY > 0 && mZoomCenterY > 0) {
|
||||||
mZoomCenterY -= 0.01;
|
mZoomCenterY -= 0.01;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mZoomCenterX > 1)
|
if (mZoomCenterX > 1)
|
||||||
mZoomCenterX = 1;
|
mZoomCenterX = 1;
|
||||||
if (mZoomCenterX < 0)
|
if (mZoomCenterX < 0)
|
||||||
|
@ -239,12 +238,12 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
|
||||||
mZoomCenterY = 1;
|
mZoomCenterY = 1;
|
||||||
if (mZoomCenterY < 0)
|
if (mZoomCenterY < 0)
|
||||||
mZoomCenterY = 0;
|
mZoomCenterY = 0;
|
||||||
|
|
||||||
LinphoneManager.getLc().getCurrentCall().zoomVideo(mZoomFactor, mZoomCenterX, mZoomCenterY);
|
LinphoneManager.getLc().getCurrentCall().zoomVideo(mZoomFactor, mZoomCenterX, mZoomCenterY);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,17 +255,17 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
|
||||||
float portraitZoomFactor = ((float) mVideoView.getHeight()) / (float) ((3 * mVideoView.getWidth()) / 4);
|
float portraitZoomFactor = ((float) mVideoView.getHeight()) / (float) ((3 * mVideoView.getWidth()) / 4);
|
||||||
// Zoom to make the video fill the screen horizontally
|
// Zoom to make the video fill the screen horizontally
|
||||||
float landscapeZoomFactor = ((float) mVideoView.getWidth()) / (float) ((3 * mVideoView.getHeight()) / 4);
|
float landscapeZoomFactor = ((float) mVideoView.getWidth()) / (float) ((3 * mVideoView.getHeight()) / 4);
|
||||||
|
|
||||||
mZoomFactor = Math.max(portraitZoomFactor, landscapeZoomFactor);
|
mZoomFactor = Math.max(portraitZoomFactor, landscapeZoomFactor);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
resetZoom();
|
resetZoom();
|
||||||
}
|
}
|
||||||
|
|
||||||
LinphoneManager.getLc().getCurrentCall().zoomVideo(mZoomFactor, mZoomCenterX, mZoomCenterY);
|
LinphoneManager.getLc().getCurrentCall().zoomVideo(mZoomFactor, mZoomCenterX, mZoomCenterY);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,17 +273,17 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
|
||||||
mZoomFactor = 1.f;
|
mZoomFactor = 1.f;
|
||||||
mZoomCenterX = mZoomCenterY = 0.5f;
|
mZoomCenterX = mZoomCenterY = 0.5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
inCallActivity = null;
|
inCallActivity = null;
|
||||||
|
|
||||||
mCaptureView = null;
|
mCaptureView = null;
|
||||||
if (mVideoView != null) {
|
if (mVideoView != null) {
|
||||||
mVideoView.setOnTouchListener(null);
|
mVideoView.setOnTouchListener(null);
|
||||||
mVideoView = null;
|
mVideoView = null;
|
||||||
}
|
}
|
||||||
if (androidVideoWindowImpl != null) {
|
if (androidVideoWindowImpl != null) {
|
||||||
// Prevent linphone from crashing if correspondent hang up while you are rotating
|
// Prevent linphone from crashing if correspondent hang up while you are rotating
|
||||||
androidVideoWindowImpl.release();
|
androidVideoWindowImpl.release();
|
||||||
androidVideoWindowImpl = null;
|
androidVideoWindowImpl = null;
|
||||||
|
@ -297,10 +296,10 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
|
||||||
mScaleDetector.destroy();
|
mScaleDetector.destroy();
|
||||||
mScaleDetector = null;
|
mScaleDetector = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onDown(MotionEvent e) {
|
public boolean onDown(MotionEvent e) {
|
||||||
return true; // Needed to make the GestureDetector working
|
return true; // Needed to make the GestureDetector working
|
||||||
|
@ -324,12 +323,12 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLongPress(MotionEvent e) {
|
public void onLongPress(MotionEvent e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onShowPress(MotionEvent e) {
|
public void onShowPress(MotionEvent e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
package org.linphone;
|
package org.linphone;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ChatFragment.java
|
ChatFragment.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
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -54,9 +56,6 @@ import java.util.List;
|
||||||
|
|
||||||
import static org.linphone.FragmentsAvailable.CHAT_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, ChatUpdatedListener {
|
||||||
private LayoutInflater mInflater;
|
private LayoutInflater mInflater;
|
||||||
private List<String> mConversations;
|
private List<String> mConversations;
|
||||||
|
|
|
@ -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,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 org.linphone.core.LinphoneProxyConfig;
|
import org.linphone.core.LinphoneProxyConfig;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
|
@ -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;
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
|
package org.linphone;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ContactsListFragment.java
|
ContactsListFragment.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 +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.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
|
@ -51,9 +52,6 @@ import java.util.Map;
|
||||||
|
|
||||||
import static org.linphone.FragmentsAvailable.CONTACTS_LIST;
|
import static org.linphone.FragmentsAvailable.CONTACTS_LIST;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Sylvain Berfini
|
|
||||||
*/
|
|
||||||
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;
|
||||||
|
|
|
@ -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,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;
|
|
||||||
|
|
||||||
import android.accounts.Account;
|
import android.accounts.Account;
|
||||||
import android.accounts.AccountManager;
|
import android.accounts.AccountManager;
|
||||||
import android.content.ContentProviderOperation;
|
import android.content.ContentProviderOperation;
|
||||||
|
|
|
@ -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,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.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
|
@ -36,9 +38,6 @@ import org.linphone.ui.AddressText;
|
||||||
import org.linphone.ui.CallButton;
|
import org.linphone.ui.CallButton;
|
||||||
import org.linphone.ui.EraseButton;
|
import org.linphone.ui.EraseButton;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Sylvain Berfini
|
|
||||||
*/
|
|
||||||
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;
|
||||||
|
|
|
@ -1,5 +1,24 @@
|
||||||
package org.linphone;
|
package org.linphone;
|
||||||
|
|
||||||
|
/*
|
||||||
|
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.LinphoneCore;
|
import org.linphone.core.LinphoneCore;
|
||||||
import org.linphone.core.LinphoneCoreFactory;
|
import org.linphone.core.LinphoneCoreFactory;
|
||||||
import org.linphone.mediastream.Log;
|
import org.linphone.mediastream.Log;
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -32,9 +34,6 @@ import org.linphone.core.LinphoneCoreException;
|
||||||
import org.linphone.core.LinphoneCoreFactory;
|
import org.linphone.core.LinphoneCoreFactory;
|
||||||
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;
|
||||||
|
|
|
@ -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,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 java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -52,9 +54,6 @@ import android.widget.TextView;
|
||||||
|
|
||||||
import static org.linphone.FragmentsAvailable.HISTORY_LIST;
|
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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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,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 org.linphone.compatibility.Compatibility;
|
import org.linphone.compatibility.Compatibility;
|
||||||
import org.linphone.core.LinphoneCore;
|
import org.linphone.core.LinphoneCore;
|
||||||
|
|
|
@ -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
|
||||||
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -44,9 +45,6 @@ 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 LinphoneFriend friend;
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
|
package org.linphone;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
LinphoneCoreException.java
|
LinphoneCoreException.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 {
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -33,11 +34,7 @@ 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 {
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,25 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
package org.linphone;
|
package org.linphone;
|
||||||
|
|
||||||
|
/*
|
||||||
|
LinphoneManager.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.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
|
@ -128,8 +147,6 @@ import static android.media.AudioManager.STREAM_VOICE_CALL;
|
||||||
*
|
*
|
||||||
* Add Service Listener to react to Linphone state changes.
|
* Add Service Listener to react to Linphone state changes.
|
||||||
*
|
*
|
||||||
* @author Guillaume Beraudo
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessage.LinphoneChatMessageListener, SensorEventListener, LinphoneAccountCreator.LinphoneAccountCreatorListener {
|
public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessage.LinphoneChatMessageListener, SensorEventListener, LinphoneAccountCreator.LinphoneAccountCreatorListener {
|
||||||
|
|
||||||
|
|
|
@ -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,30 +19,25 @@ 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;
|
||||||
private String value, oldValueForUpdatePurpose;
|
private String value, oldValueForUpdatePurpose;
|
||||||
|
|
||||||
public LinphoneNumberOrAddress(String v, boolean isSIP) {
|
public LinphoneNumberOrAddress(String v, boolean isSIP) {
|
||||||
value = v;
|
value = v;
|
||||||
isSIPAddress = isSIP;
|
isSIPAddress = isSIP;
|
||||||
oldValueForUpdatePurpose = null;
|
oldValueForUpdatePurpose = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LinphoneNumberOrAddress(String v, boolean isSip, String old) {
|
public LinphoneNumberOrAddress(String v, boolean isSip, String old) {
|
||||||
this(v, isSip);
|
this(v, isSip);
|
||||||
oldValueForUpdatePurpose = old;
|
oldValueForUpdatePurpose = old;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(LinphoneNumberOrAddress noa) {
|
public int compareTo(LinphoneNumberOrAddress noa) {
|
||||||
if (noa.isSIPAddress() == isSIPAddress()) {
|
if (noa.isSIPAddress() == isSIPAddress()) {
|
||||||
|
@ -53,7 +50,7 @@ public class LinphoneNumberOrAddress implements Serializable, Comparable<Linphon
|
||||||
public boolean isSIPAddress() {
|
public boolean isSIPAddress() {
|
||||||
return isSIPAddress;
|
return isSIPAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getOldValue() {
|
public String getOldValue() {
|
||||||
return oldValueForUpdatePurpose;
|
return oldValueForUpdatePurpose;
|
||||||
}
|
}
|
||||||
|
@ -61,11 +58,11 @@ public class LinphoneNumberOrAddress implements Serializable, Comparable<Linphon
|
||||||
public void setOldValue(String v) {
|
public void setOldValue(String v) {
|
||||||
oldValueForUpdatePurpose = v;
|
oldValueForUpdatePurpose = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getValue() {
|
public String getValue() {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setValue(String v) {
|
public void setValue(String v) {
|
||||||
value = v;
|
value = v;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package org.linphone;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
LinphonePreferences.java
|
LinphonePreferences.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
|
||||||
|
@ -48,9 +48,6 @@ import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Sylvain Berfini
|
|
||||||
*/
|
|
||||||
public class LinphonePreferences {
|
public class LinphonePreferences {
|
||||||
private static final int LINPHONE_CORE_RANDOM_PORT = -1;
|
private static final int LINPHONE_CORE_RANDOM_PORT = -1;
|
||||||
private static LinphonePreferences instance;
|
private static LinphonePreferences instance;
|
||||||
|
|
|
@ -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,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.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
@ -63,7 +64,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 +71,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
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -93,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;
|
||||||
|
|
|
@ -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,17 +18,14 @@ 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.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,23 @@
|
||||||
package org.linphone;
|
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.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
@ -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;
|
||||||
|
|
|
@ -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
|
||||||
|
@ -61,9 +61,6 @@ 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();
|
||||||
|
|
|
@ -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
|
||||||
|
@ -48,9 +48,6 @@ 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;
|
||||||
|
|
|
@ -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,14 +18,13 @@ 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;
|
||||||
|
|
||||||
public class UIThreadDispatcher {
|
public class UIThreadDispatcher {
|
||||||
private static Handler mHandler = new Handler(Looper.getMainLooper());
|
private static Handler mHandler = new Handler(Looper.getMainLooper());
|
||||||
|
|
||||||
public static void dispatch(Runnable r) {
|
public static void dispatch(Runnable r) {
|
||||||
mHandler.post(r);
|
mHandler.post(r);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
@ -81,9 +81,6 @@ import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Sylvain Berfini
|
|
||||||
*/
|
|
||||||
public class AssistantActivity extends Activity implements OnClickListener, ActivityCompat.OnRequestPermissionsResultCallback, LinphoneAccountCreator.LinphoneAccountCreatorListener {
|
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;
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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
|
||||||
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
@ -33,9 +33,7 @@ import org.linphone.R;
|
||||||
import org.linphone.core.LinphoneAccountCreator;
|
import org.linphone.core.LinphoneAccountCreator;
|
||||||
import org.linphone.core.LinphoneAccountCreator.LinphoneAccountCreatorListener;
|
import org.linphone.core.LinphoneAccountCreator.LinphoneAccountCreatorListener;
|
||||||
import org.linphone.core.LinphoneCoreFactory;
|
import org.linphone.core.LinphoneCoreFactory;
|
||||||
/**
|
|
||||||
* @author Sylvain Berfini
|
|
||||||
*/
|
|
||||||
public class CreateAccountActivationFragment extends Fragment implements OnClickListener, LinphoneAccountCreatorListener {
|
public class CreateAccountActivationFragment extends Fragment implements OnClickListener, LinphoneAccountCreatorListener {
|
||||||
private String username, password;
|
private String username, password;
|
||||||
private Button checkAccount;
|
private Button checkAccount;
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
@ -58,9 +58,6 @@ 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, LinphoneAccountCreatorListener {
|
||||||
private EditText phoneNumberEdit, usernameEdit, passwordEdit, passwordConfirmEdit
|
private EditText phoneNumberEdit, usernameEdit, passwordEdit, passwordConfirmEdit
|
||||||
|
|
|
@ -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
|
||||||
|
@ -41,9 +41,6 @@ import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Ghislain MARY
|
|
||||||
*/
|
|
||||||
public class EchoCancellerCalibrationFragment extends Fragment implements LinphoneXmlRpcRequestListener {
|
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;
|
||||||
|
@ -56,7 +53,7 @@ public class EchoCancellerCalibrationFragment extends Fragment implements Linpho
|
||||||
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_ec_calibration, container, false);
|
View view = inflater.inflate(R.layout.assistant_ec_calibration, container, false);
|
||||||
|
|
||||||
mListener = new LinphoneCoreListenerBase(){
|
mListener = new LinphoneCoreListenerBase(){
|
||||||
@Override
|
@Override
|
||||||
public void ecCalibrationStatus(LinphoneCore lc, LinphoneCore.EcCalibratorStatus status, int delay_ms, Object data) {
|
public void ecCalibrationStatus(LinphoneCore lc, LinphoneCore.EcCalibratorStatus status, int delay_ms, Object data) {
|
||||||
|
@ -73,7 +70,7 @@ public class EchoCancellerCalibrationFragment extends Fragment implements Linpho
|
||||||
AssistantActivity.instance().isEchoCalibrationFinished();
|
AssistantActivity.instance().isEchoCalibrationFinished();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
xmlRpcSession = new LinphoneXmlRpcSessionImpl(LinphoneManager.getLcIfManagerNotDestroyedOrNull(), LinphonePreferences.instance().getXmlrpcUrl());
|
xmlRpcSession = new LinphoneXmlRpcSessionImpl(LinphoneManager.getLcIfManagerNotDestroyedOrNull(), LinphonePreferences.instance().getXmlrpcUrl());
|
||||||
xmlRpcRequest = new LinphoneXmlRpcRequestImpl("add_ec_calibration_result", LinphoneXmlRpcRequest.ArgType.None);
|
xmlRpcRequest = new LinphoneXmlRpcRequestImpl("add_ec_calibration_result", LinphoneXmlRpcRequest.ArgType.None);
|
||||||
xmlRpcRequest.setListener(this);
|
xmlRpcRequest.setListener(this);
|
||||||
|
|
|
@ -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
|
||||||
|
@ -50,9 +50,6 @@ 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 LinphoneLoginFragment extends Fragment implements CompoundButton.OnCheckedChangeListener, OnClickListener, TextWatcher, LinphoneAccountCreator.LinphoneAccountCreatorListener {
|
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;
|
||||||
|
|
|
@ -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
|
||||||
|
@ -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;
|
||||||
|
|
|
@ -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
|
||||||
|
@ -43,21 +43,18 @@ 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 LinphoneCoreListenerBase mListener;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
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 LinphoneCoreListenerBase(){
|
||||||
@Override
|
@Override
|
||||||
public void configuringStatus(LinphoneCore lc, final RemoteProvisioningState state, String message) {
|
public void configuringStatus(LinphoneCore lc, final RemoteProvisioningState state, String message) {
|
||||||
|
|
|
@ -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
|
||||||
|
@ -37,25 +37,25 @@ import android.widget.EditText;
|
||||||
public class RemoteProvisioningFragment extends Fragment implements OnClickListener, TextWatcher{
|
public class RemoteProvisioningFragment extends Fragment implements OnClickListener, TextWatcher{
|
||||||
private EditText remoteProvisioningUrl;
|
private EditText remoteProvisioningUrl;
|
||||||
private Button apply;
|
private Button apply;
|
||||||
|
|
||||||
@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_remote_provisioning, container, false);
|
View view = inflater.inflate(R.layout.assistant_remote_provisioning, container, false);
|
||||||
|
|
||||||
remoteProvisioningUrl = (EditText) view.findViewById(R.id.assistant_remote_provisioning_url);
|
remoteProvisioningUrl = (EditText) view.findViewById(R.id.assistant_remote_provisioning_url);
|
||||||
remoteProvisioningUrl.addTextChangedListener(this);
|
remoteProvisioningUrl.addTextChangedListener(this);
|
||||||
apply = (Button) view.findViewById(R.id.assistant_apply);
|
apply = (Button) view.findViewById(R.id.assistant_apply);
|
||||||
apply.setEnabled(false);
|
apply.setEnabled(false);
|
||||||
apply.setOnClickListener(this);
|
apply.setOnClickListener(this);
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
int id = v.getId();
|
int id = v.getId();
|
||||||
|
|
||||||
if (id == R.id.assistant_apply) {
|
if (id == R.id.assistant_apply) {
|
||||||
String url = remoteProvisioningUrl.getText().toString();
|
String url = remoteProvisioningUrl.getText().toString();
|
||||||
AssistantActivity.instance().displayRemoteProvisioningInProgressDialog();
|
AssistantActivity.instance().displayRemoteProvisioningInProgressDialog();
|
||||||
|
|
|
@ -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
|
||||||
|
@ -34,9 +34,6 @@ 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;
|
||||||
|
@ -46,7 +43,7 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.assistant_remote_provisioning_login);
|
setContentView(R.layout.assistant_remote_provisioning_login);
|
||||||
|
|
||||||
login = (EditText) findViewById(R.id.assistant_username);
|
login = (EditText) findViewById(R.id.assistant_username);
|
||||||
password = (EditText) findViewById(R.id.assistant_password);
|
password = (EditText) findViewById(R.id.assistant_password);
|
||||||
domain = (EditText) findViewById(R.id.assistant_domain);
|
domain = (EditText) findViewById(R.id.assistant_domain);
|
||||||
|
@ -71,7 +68,7 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelWizard(boolean bypassCheck) {
|
private void cancelWizard(boolean bypassCheck) {
|
||||||
if (bypassCheck || getResources().getBoolean(R.bool.allow_cancel_remote_provisioning_login_activity)) {
|
if (bypassCheck || getResources().getBoolean(R.bool.allow_cancel_remote_provisioning_login_activity)) {
|
||||||
LinphonePreferences.instance().disableProvisioningLoginView();
|
LinphonePreferences.instance().disableProvisioningLoginView();
|
||||||
|
@ -79,7 +76,7 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean storeAccount(String username, String password, String domain) {
|
private boolean storeAccount(String username, String password, String domain) {
|
||||||
XmlRpcHelper xmlRpcHelper = new XmlRpcHelper();
|
XmlRpcHelper xmlRpcHelper = new XmlRpcHelper();
|
||||||
xmlRpcHelper.getRemoteProvisioningFilenameAsync(new XmlRpcListenerBase() {
|
xmlRpcHelper.getRemoteProvisioningFilenameAsync(new XmlRpcListenerBase() {
|
||||||
|
@ -102,10 +99,10 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick
|
||||||
Log.e(e);
|
Log.e(e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
LinphoneAuthInfo authInfo = LinphoneCoreFactory.instance().createAuthInfo(username, null, password, null, null, domain);
|
LinphoneAuthInfo authInfo = LinphoneCoreFactory.instance().createAuthInfo(username, null, password, null, null, domain);
|
||||||
lc.addAuthInfo(authInfo);
|
lc.addAuthInfo(authInfo);
|
||||||
|
|
||||||
if (LinphonePreferences.instance().getAccountCount() == 1)
|
if (LinphonePreferences.instance().getAccountCount() == 1)
|
||||||
lc.setDefaultProxyConfig(prxCfg);
|
lc.setDefaultProxyConfig(prxCfg);
|
||||||
*/
|
*/
|
||||||
|
@ -133,7 +130,7 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
int id = v.getId();
|
int id = v.getId();
|
||||||
|
|
||||||
if (id == R.id.cancel) {
|
if (id == R.id.cancel) {
|
||||||
cancelWizard(false);
|
cancelWizard(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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)) {
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -9,32 +28,32 @@ import android.view.ScaleGestureDetector;
|
||||||
public class CompatibilityScaleGestureDetector extends ScaleGestureDetector.SimpleOnScaleGestureListener {
|
public class CompatibilityScaleGestureDetector extends ScaleGestureDetector.SimpleOnScaleGestureListener {
|
||||||
private ScaleGestureDetector detector;
|
private ScaleGestureDetector detector;
|
||||||
private CompatibilityScaleGestureListener listener;
|
private CompatibilityScaleGestureListener listener;
|
||||||
|
|
||||||
public CompatibilityScaleGestureDetector(Context context) {
|
public CompatibilityScaleGestureDetector(Context context) {
|
||||||
detector = new ScaleGestureDetector(context, this);
|
detector = new ScaleGestureDetector(context, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOnScaleListener(CompatibilityScaleGestureListener newListener) {
|
public void setOnScaleListener(CompatibilityScaleGestureListener newListener) {
|
||||||
listener = newListener;
|
listener = newListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onTouchEvent(MotionEvent event) {
|
public boolean onTouchEvent(MotionEvent event) {
|
||||||
return detector.onTouchEvent(event);
|
return detector.onTouchEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onScale(ScaleGestureDetector detector) {
|
public boolean onScale(ScaleGestureDetector detector) {
|
||||||
if (listener == null) {
|
if (listener == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return listener.onScale(this);
|
return listener.onScale(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getScaleFactor() {
|
public float getScaleFactor() {
|
||||||
return detector.getScaleFactor();
|
return detector.getScaleFactor();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
listener = null;
|
listener = null;
|
||||||
detector = null;
|
detector = null;
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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() {
|
||||||
|
|
|
@ -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() {
|
||||||
}
|
}
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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
|
||||||
|
@ -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 {
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -128,12 +125,12 @@ public class InAppPurchaseActivity extends Activity implements InAppPurchaseList
|
||||||
public static InAppPurchaseActivity instance() {
|
public static InAppPurchaseActivity instance() {
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onServiceAvailableForQueries() {
|
public void onServiceAvailableForQueries() {
|
||||||
//email.setText(inAppPurchaseHelper.getGmailAccount());
|
//email.setText(inAppPurchaseHelper.getGmailAccount());
|
||||||
//email.setEnabled(false);
|
//email.setEnabled(false);
|
||||||
|
|
||||||
//inAppPurchaseHelper.getPurchasedItemsAsync();
|
//inAppPurchaseHelper.getPurchasedItemsAsync();
|
||||||
inAppPurchaseHelper.getAvailableItemsForPurchaseAsync();
|
inAppPurchaseHelper.getAvailableItemsForPurchaseAsync();
|
||||||
}
|
}
|
||||||
|
@ -189,7 +186,7 @@ public class InAppPurchaseActivity extends Activity implements InAppPurchaseList
|
||||||
onBackPressed();
|
onBackPressed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
inAppPurchaseHelper.parseAndVerifyPurchaseItemResultAsync(requestCode, resultCode, data);
|
inAppPurchaseHelper.parseAndVerifyPurchaseItemResultAsync(requestCode, resultCode, data);
|
||||||
|
@ -206,7 +203,7 @@ public class InAppPurchaseActivity extends Activity implements InAppPurchaseList
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
inProgress.setVisibility(View.GONE);
|
inProgress.setVisibility(View.GONE);
|
||||||
Toast.makeText(InAppPurchaseActivity.this, error, Toast.LENGTH_LONG).show();
|
Toast.makeText(InAppPurchaseActivity.this, error, Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
@ -50,7 +50,7 @@ public class InAppPurchaseFragment extends Fragment implements View.OnClickListe
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
View view = inflater.inflate(R.layout.in_app_store, container, false);
|
View view = inflater.inflate(R.layout.in_app_store, container, false);
|
||||||
|
|
|
@ -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,23 +45,20 @@ 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;
|
||||||
|
|
||||||
public static final String SKU_DETAILS_ITEM_LIST = "ITEM_ID_LIST";
|
public static final String SKU_DETAILS_ITEM_LIST = "ITEM_ID_LIST";
|
||||||
public static final String SKU_DETAILS_LIST = "DETAILS_LIST";
|
public static final String SKU_DETAILS_LIST = "DETAILS_LIST";
|
||||||
public static final String SKU_DETAILS_PRODUCT_ID = "productId";
|
public static final String SKU_DETAILS_PRODUCT_ID = "productId";
|
||||||
public static final String SKU_DETAILS_PRICE = "price";
|
public static final String SKU_DETAILS_PRICE = "price";
|
||||||
public static final String SKU_DETAILS_TITLE = "title";
|
public static final String SKU_DETAILS_TITLE = "title";
|
||||||
public static final String SKU_DETAILS_DESC = "description";
|
public static final String SKU_DETAILS_DESC = "description";
|
||||||
|
|
||||||
public static final String ITEM_TYPE_INAPP = "inapp";
|
public static final String ITEM_TYPE_INAPP = "inapp";
|
||||||
public static final String ITEM_TYPE_SUBS = "subs";
|
public static final String ITEM_TYPE_SUBS = "subs";
|
||||||
|
|
||||||
public static final int RESPONSE_RESULT_OK = 0;
|
public static final int RESPONSE_RESULT_OK = 0;
|
||||||
public static final int RESULT_USER_CANCELED = 1;
|
public static final int RESULT_USER_CANCELED = 1;
|
||||||
public static final int RESULT_SERVICE_UNAVAILABLE = 2;
|
public static final int RESULT_SERVICE_UNAVAILABLE = 2;
|
||||||
|
@ -71,7 +68,7 @@ public class InAppPurchaseHelper {
|
||||||
public static final int RESULT_ERROR = 6;
|
public static final int RESULT_ERROR = 6;
|
||||||
public static final int RESULT_ITEM_ALREADY_OWNED = 7;
|
public static final int RESULT_ITEM_ALREADY_OWNED = 7;
|
||||||
public static final int RESULT_ITEM_NOT_OWNED = 8;
|
public static final int RESULT_ITEM_NOT_OWNED = 8;
|
||||||
|
|
||||||
public static final String RESPONSE_CODE = "RESPONSE_CODE";
|
public static final String RESPONSE_CODE = "RESPONSE_CODE";
|
||||||
public static final String RESPONSE_BUY_INTENT = "BUY_INTENT";
|
public static final String RESPONSE_BUY_INTENT = "BUY_INTENT";
|
||||||
public static final String RESPONSE_INAPP_PURCHASE_DATA = "INAPP_PURCHASE_DATA";
|
public static final String RESPONSE_INAPP_PURCHASE_DATA = "INAPP_PURCHASE_DATA";
|
||||||
|
@ -80,7 +77,7 @@ public class InAppPurchaseHelper {
|
||||||
public static final String RESPONSE_INAPP_PURCHASE_DATA_LIST = "INAPP_PURCHASE_DATA_LIST";
|
public static final String RESPONSE_INAPP_PURCHASE_DATA_LIST = "INAPP_PURCHASE_DATA_LIST";
|
||||||
public static final String RESPONSE_INAPP_SIGNATURE_LIST = "INAPP_DATA_SIGNATURE_LIST";
|
public static final String RESPONSE_INAPP_SIGNATURE_LIST = "INAPP_DATA_SIGNATURE_LIST";
|
||||||
public static final String RESPONSE_INAPP_CONTINUATION_TOKEN = "INAPP_CONTINUATION_TOKEN";
|
public static final String RESPONSE_INAPP_CONTINUATION_TOKEN = "INAPP_CONTINUATION_TOKEN";
|
||||||
|
|
||||||
public static final String PURCHASE_DETAILS_PRODUCT_ID = "productId";
|
public static final String PURCHASE_DETAILS_PRODUCT_ID = "productId";
|
||||||
public static final String PURCHASE_DETAILS_ORDER_ID = "orderId";
|
public static final String PURCHASE_DETAILS_ORDER_ID = "orderId";
|
||||||
public static final String PURCHASE_DETAILS_AUTO_RENEWING = "autoRenewing";
|
public static final String PURCHASE_DETAILS_AUTO_RENEWING = "autoRenewing";
|
||||||
|
@ -88,18 +85,18 @@ public class InAppPurchaseHelper {
|
||||||
public static final String PURCHASE_DETAILS_PURCHASE_STATE = "purchaseState";
|
public static final String PURCHASE_DETAILS_PURCHASE_STATE = "purchaseState";
|
||||||
public static final String PURCHASE_DETAILS_PAYLOAD = "developerPayload";
|
public static final String PURCHASE_DETAILS_PAYLOAD = "developerPayload";
|
||||||
public static final String PURCHASE_DETAILS_PURCHASE_TOKEN = "purchaseToken";
|
public static final String PURCHASE_DETAILS_PURCHASE_TOKEN = "purchaseToken";
|
||||||
|
|
||||||
public static final String CLIENT_ERROR_SUBSCRIPTION_PURCHASE_NOT_AVAILABLE = "SUBSCRIPTION_PURCHASE_NOT_AVAILABLE";
|
public static final String CLIENT_ERROR_SUBSCRIPTION_PURCHASE_NOT_AVAILABLE = "SUBSCRIPTION_PURCHASE_NOT_AVAILABLE";
|
||||||
public static final String CLIENT_ERROR_BIND_TO_BILLING_SERVICE_FAILED = "BIND_TO_BILLING_SERVICE_FAILED";
|
public static final String CLIENT_ERROR_BIND_TO_BILLING_SERVICE_FAILED = "BIND_TO_BILLING_SERVICE_FAILED";
|
||||||
public static final String CLIENT_ERROR_BILLING_SERVICE_UNAVAILABLE = "BILLING_SERVICE_UNAVAILABLE";
|
public static final String CLIENT_ERROR_BILLING_SERVICE_UNAVAILABLE = "BILLING_SERVICE_UNAVAILABLE";
|
||||||
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private InAppPurchaseListener mListener;
|
private InAppPurchaseListener mListener;
|
||||||
private IInAppBillingService mService;
|
private IInAppBillingService mService;
|
||||||
private ServiceConnection mServiceConn;
|
private ServiceConnection mServiceConn;
|
||||||
private Handler mHandler = new Handler();
|
private Handler mHandler = new Handler();
|
||||||
private String mGmailAccount;
|
private String mGmailAccount;
|
||||||
|
|
||||||
private String responseCodeToErrorMessage(int responseCode) {
|
private String responseCodeToErrorMessage(int responseCode) {
|
||||||
switch (responseCode) {
|
switch (responseCode) {
|
||||||
case RESULT_USER_CANCELED:
|
case RESULT_USER_CANCELED:
|
||||||
|
@ -121,7 +118,7 @@ public class InAppPurchaseHelper {
|
||||||
}
|
}
|
||||||
return "UNKNOWN_RESPONSE_CODE";
|
return "UNKNOWN_RESPONSE_CODE";
|
||||||
}
|
}
|
||||||
|
|
||||||
public InAppPurchaseHelper(Activity context, InAppPurchaseListener listener) {
|
public InAppPurchaseHelper(Activity context, InAppPurchaseListener listener) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mListener = listener;
|
mListener = listener;
|
||||||
|
@ -169,13 +166,13 @@ public class InAppPurchaseHelper {
|
||||||
mListener.onError(CLIENT_ERROR_BILLING_SERVICE_UNAVAILABLE);
|
mListener.onError(CLIENT_ERROR_BILLING_SERVICE_UNAVAILABLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ArrayList<Purchasable> getAvailableItemsForPurchase() {
|
private ArrayList<Purchasable> getAvailableItemsForPurchase() {
|
||||||
ArrayList<Purchasable> products = new ArrayList<Purchasable>();
|
ArrayList<Purchasable> products = new ArrayList<Purchasable>();
|
||||||
ArrayList<String> skuList = LinphonePreferences.instance().getInAppPurchasables();
|
ArrayList<String> skuList = LinphonePreferences.instance().getInAppPurchasables();
|
||||||
Bundle querySkus = new Bundle();
|
Bundle querySkus = new Bundle();
|
||||||
querySkus.putStringArrayList(SKU_DETAILS_ITEM_LIST, skuList);
|
querySkus.putStringArrayList(SKU_DETAILS_ITEM_LIST, skuList);
|
||||||
|
|
||||||
Bundle skuDetails = null;
|
Bundle skuDetails = null;
|
||||||
try {
|
try {
|
||||||
skuDetails = mService.getSkuDetails(API_VERSION, mContext.getPackageName(), ITEM_TYPE_SUBS, querySkus);
|
skuDetails = mService.getSkuDetails(API_VERSION, mContext.getPackageName(), ITEM_TYPE_SUBS, querySkus);
|
||||||
|
@ -194,7 +191,7 @@ public class InAppPurchaseHelper {
|
||||||
String price = object.getString(SKU_DETAILS_PRICE);
|
String price = object.getString(SKU_DETAILS_PRICE);
|
||||||
String title = object.getString(SKU_DETAILS_TITLE);
|
String title = object.getString(SKU_DETAILS_TITLE);
|
||||||
String desc = object.getString(SKU_DETAILS_DESC);
|
String desc = object.getString(SKU_DETAILS_DESC);
|
||||||
|
|
||||||
Purchasable purchasable = new Purchasable(id).setTitle(title).setDescription(desc).setPrice(price);
|
Purchasable purchasable = new Purchasable(id).setTitle(title).setDescription(desc).setPrice(price);
|
||||||
Log.w("Purchasable item " + purchasable.getDescription());
|
Log.w("Purchasable item " + purchasable.getDescription());
|
||||||
products.add(purchasable);
|
products.add(purchasable);
|
||||||
|
@ -207,10 +204,10 @@ public class InAppPurchaseHelper {
|
||||||
mListener.onError(responseCodeToErrorMessage(response));
|
mListener.onError(responseCodeToErrorMessage(response));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return products;
|
return products;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getAvailableItemsForPurchaseAsync() {
|
public void getAvailableItemsForPurchaseAsync() {
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -225,11 +222,11 @@ public class InAppPurchaseHelper {
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getPurchasedItemsAsync() {
|
public void getPurchasedItemsAsync() {
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
final ArrayList<Purchasable> items = new ArrayList<Purchasable>();
|
final ArrayList<Purchasable> items = new ArrayList<Purchasable>();
|
||||||
String continuationToken = null;
|
String continuationToken = null;
|
||||||
do {
|
do {
|
||||||
|
@ -239,19 +236,19 @@ public class InAppPurchaseHelper {
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Log.e(e);
|
Log.e(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (purchasedItems != null) {
|
if (purchasedItems != null) {
|
||||||
int response = purchasedItems.getInt(RESPONSE_CODE);
|
int response = purchasedItems.getInt(RESPONSE_CODE);
|
||||||
if (response == RESPONSE_RESULT_OK) {
|
if (response == RESPONSE_RESULT_OK) {
|
||||||
ArrayList<String> purchaseDataList = purchasedItems.getStringArrayList(RESPONSE_INAPP_PURCHASE_DATA_LIST);
|
ArrayList<String> purchaseDataList = purchasedItems.getStringArrayList(RESPONSE_INAPP_PURCHASE_DATA_LIST);
|
||||||
ArrayList<String> signatureList = purchasedItems.getStringArrayList(RESPONSE_INAPP_SIGNATURE_LIST);
|
ArrayList<String> signatureList = purchasedItems.getStringArrayList(RESPONSE_INAPP_SIGNATURE_LIST);
|
||||||
continuationToken = purchasedItems.getString(RESPONSE_INAPP_CONTINUATION_TOKEN);
|
continuationToken = purchasedItems.getString(RESPONSE_INAPP_CONTINUATION_TOKEN);
|
||||||
|
|
||||||
for (int i = 0; i < purchaseDataList.size(); ++i) {
|
for (int i = 0; i < purchaseDataList.size(); ++i) {
|
||||||
String purchaseData = purchaseDataList.get(i);
|
String purchaseData = purchaseDataList.get(i);
|
||||||
String signature = signatureList.get(i);
|
String signature = signatureList.get(i);
|
||||||
Log.d("[In-app purchase] " + purchaseData);
|
Log.d("[In-app purchase] " + purchaseData);
|
||||||
|
|
||||||
Purchasable item = verifySignature(purchaseData, signature);
|
Purchasable item = verifySignature(purchaseData, signature);
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
items.add(item);
|
items.add(item);
|
||||||
|
@ -263,7 +260,7 @@ public class InAppPurchaseHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (continuationToken != null);
|
} while (continuationToken != null);
|
||||||
|
|
||||||
if (mHandler != null && mListener != null) {
|
if (mHandler != null && mListener != null) {
|
||||||
mHandler.post(new Runnable() {
|
mHandler.post(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -274,7 +271,7 @@ public class InAppPurchaseHelper {
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void parseAndVerifyPurchaseItemResultAsync(int requestCode, int resultCode, Intent data) {
|
public void parseAndVerifyPurchaseItemResultAsync(int requestCode, int resultCode, Intent data) {
|
||||||
if (requestCode == ACTIVITY_RESULT_CODE_PURCHASE_ITEM) {
|
if (requestCode == ACTIVITY_RESULT_CODE_PURCHASE_ITEM) {
|
||||||
int responseCode = data.getIntExtra(RESPONSE_CODE, 0);
|
int responseCode = data.getIntExtra(RESPONSE_CODE, 0);
|
||||||
|
@ -286,7 +283,7 @@ public class InAppPurchaseHelper {
|
||||||
Purchasable item = LinphonePreferences.instance().getInAppPurchasedItem();
|
Purchasable item = LinphonePreferences.instance().getInAppPurchasedItem();
|
||||||
item.setPayloadAndSignature(payload, signature);
|
item.setPayloadAndSignature(payload, signature);
|
||||||
LinphonePreferences.instance().setInAppPurchasedItem(item);
|
LinphonePreferences.instance().setInAppPurchasedItem(item);
|
||||||
|
|
||||||
XmlRpcHelper xmlRpcHelper = new XmlRpcHelper();
|
XmlRpcHelper xmlRpcHelper = new XmlRpcHelper();
|
||||||
xmlRpcHelper.verifySignatureAsync(new XmlRpcListenerBase() {
|
xmlRpcHelper.verifySignatureAsync(new XmlRpcListenerBase() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -297,7 +294,7 @@ public class InAppPurchaseHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void purchaseItem(String productId, String sipIdentity) {
|
private void purchaseItem(String productId, String sipIdentity) {
|
||||||
Bundle buyIntentBundle = null;
|
Bundle buyIntentBundle = null;
|
||||||
try {
|
try {
|
||||||
|
@ -305,7 +302,7 @@ public class InAppPurchaseHelper {
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Log.e(e);
|
Log.e(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buyIntentBundle != null) {
|
if (buyIntentBundle != null) {
|
||||||
PendingIntent pendingIntent = buyIntentBundle.getParcelable(RESPONSE_BUY_INTENT);
|
PendingIntent pendingIntent = buyIntentBundle.getParcelable(RESPONSE_BUY_INTENT);
|
||||||
if (pendingIntent != null) {
|
if (pendingIntent != null) {
|
||||||
|
@ -317,7 +314,7 @@ public class InAppPurchaseHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void purchaseItemAsync(final String productId, final String sipIdentity) {
|
public void purchaseItemAsync(final String productId, final String sipIdentity) {
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -325,29 +322,29 @@ public class InAppPurchaseHelper {
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
mContext.unbindService(mServiceConn);
|
mContext.unbindService(mServiceConn);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getGmailAccount() {
|
public String getGmailAccount() {
|
||||||
Account[] accounts = AccountManager.get(mContext).getAccountsByType("com.google");
|
Account[] accounts = AccountManager.get(mContext).getAccountsByType("com.google");
|
||||||
|
|
||||||
for (Account account: accounts) {
|
for (Account account: accounts) {
|
||||||
if (isEmailCorrect(account.name)) {
|
if (isEmailCorrect(account.name)) {
|
||||||
String possibleEmail = account.name;
|
String possibleEmail = account.name;
|
||||||
return possibleEmail;
|
return possibleEmail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isEmailCorrect(String email) {
|
private boolean isEmailCorrect(String email) {
|
||||||
Pattern emailPattern = Patterns.EMAIL_ADDRESS;
|
Pattern emailPattern = Patterns.EMAIL_ADDRESS;
|
||||||
return emailPattern.matcher(email).matches();
|
return emailPattern.matcher(email).matches();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Purchasable verifySignature(String payload, String signature) {
|
private Purchasable verifySignature(String payload, String signature) {
|
||||||
// TODO FIXME rework to be async
|
// TODO FIXME rework to be async
|
||||||
/*XmlRpcHelper helper = new XmlRpcHelper();
|
/*XmlRpcHelper helper = new XmlRpcHelper();
|
||||||
|
@ -355,7 +352,7 @@ public class InAppPurchaseHelper {
|
||||||
try {
|
try {
|
||||||
JSONObject json = new JSONObject(payload);
|
JSONObject json = new JSONObject(payload);
|
||||||
String productId = json.getString(PURCHASE_DETAILS_PRODUCT_ID);
|
String productId = json.getString(PURCHASE_DETAILS_PRODUCT_ID);
|
||||||
Purchasable item = new Purchasable(productId);
|
Purchasable item = new Purchasable(productId);
|
||||||
item.setPayloadAndSignature(payload, signature);
|
item.setPayloadAndSignature(payload, signature);
|
||||||
return item;
|
return item;
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
|
@ -364,7 +361,7 @@ public class InAppPurchaseHelper {
|
||||||
}*/
|
}*/
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface VerifiedSignatureListener {
|
interface VerifiedSignatureListener {
|
||||||
void onParsedAndVerifiedSignatureQueryFinished(Purchasable item);
|
void onParsedAndVerifiedSignatureQueryFinished(Purchasable item);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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,27 +20,24 @@ 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
|
||||||
*/
|
*/
|
||||||
void onServiceAvailableForQueries();
|
void onServiceAvailableForQueries();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback called when the query for items available for purchase is done
|
* Callback called when the query for items available for purchase is done
|
||||||
* @param items the list of items that can be purchased (also contains the ones already bought)
|
* @param items the list of items that can be purchased (also contains the ones already bought)
|
||||||
*/
|
*/
|
||||||
void onAvailableItemsForPurchaseQueryFinished(ArrayList<Purchasable> items);
|
void onAvailableItemsForPurchaseQueryFinished(ArrayList<Purchasable> items);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback called when the query for items bought by the user is done
|
* Callback called when the query for items bought by the user is done
|
||||||
* @param items the list of items already purchased by the user
|
* @param items the list of items already purchased by the user
|
||||||
*/
|
*/
|
||||||
void onPurchasedItemsQueryFinished(ArrayList<Purchasable> items);
|
void onPurchasedItemsQueryFinished(ArrayList<Purchasable> items);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback called when the purchase has been validated by our external server
|
* Callback called when the purchase has been validated by our external server
|
||||||
* @param success true if ok, false otherwise
|
* @param success true if ok, false otherwise
|
||||||
|
@ -52,13 +49,13 @@ public interface InAppPurchaseListener {
|
||||||
* @param success true if the recover has been successful, false otherwise
|
* @param success true if the recover has been successful, false otherwise
|
||||||
*/
|
*/
|
||||||
void onRecoverAccountSuccessful(boolean success);
|
void onRecoverAccountSuccessful(boolean success);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback called when the account has been activated (or not)
|
* Callback called when the account has been activated (or not)
|
||||||
* @param success true if the activation has been successful, false otherwise
|
* @param success true if the activation has been successful, false otherwise
|
||||||
*/
|
*/
|
||||||
void onActivateAccountSuccessful(boolean success);
|
void onActivateAccountSuccessful(boolean success);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback called when an error occurred.
|
* Callback called when an error occurred.
|
||||||
* @param error the error that occurred
|
* @param error the error that occurred
|
||||||
|
|
|
@ -1,47 +1,66 @@
|
||||||
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 {
|
||||||
@Override
|
@Override
|
||||||
public void onServiceAvailableForQueries() {
|
public void onServiceAvailableForQueries() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAvailableItemsForPurchaseQueryFinished(ArrayList<Purchasable> items) {
|
public void onAvailableItemsForPurchaseQueryFinished(ArrayList<Purchasable> items) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPurchasedItemsQueryFinished(ArrayList<Purchasable> items) {
|
public void onPurchasedItemsQueryFinished(ArrayList<Purchasable> items) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPurchasedItemConfirmationQueryFinished(boolean success) {
|
public void onPurchasedItemConfirmationQueryFinished(boolean success) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRecoverAccountSuccessful(boolean success) {
|
public void onRecoverAccountSuccessful(boolean success) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActivateAccountSuccessful(boolean success) {
|
public void onActivateAccountSuccessful(boolean success) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(String error) {
|
public void onError(String error) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,15 +24,12 @@ 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;
|
||||||
private String purchasePayload, purchasePayloadSignature;
|
private String purchasePayload, purchasePayloadSignature;
|
||||||
private String userData;
|
private String userData;
|
||||||
|
|
||||||
public Purchasable(String id) {
|
public Purchasable(String id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
@ -71,7 +68,7 @@ public class Purchasable {
|
||||||
public long getExpire() {
|
public long getExpire() {
|
||||||
return expire;
|
return expire;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getExpireDate() {
|
public String getExpireDate() {
|
||||||
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.getDefault());
|
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.getDefault());
|
||||||
Date date = new Date(expire);
|
Date date = new Date(expire);
|
||||||
|
@ -82,26 +79,26 @@ public class Purchasable {
|
||||||
this.expire = expire;
|
this.expire = expire;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Purchasable setPayloadAndSignature(String payload, String signature) {
|
public Purchasable setPayloadAndSignature(String payload, String signature) {
|
||||||
this.purchasePayload = payload;
|
this.purchasePayload = payload;
|
||||||
this.purchasePayloadSignature = signature;
|
this.purchasePayloadSignature = signature;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPayload() {
|
public String getPayload() {
|
||||||
return this.purchasePayload;
|
return this.purchasePayload;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPayloadSignature() {
|
public String getPayloadSignature() {
|
||||||
return this.purchasePayloadSignature;
|
return this.purchasePayloadSignature;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Purchasable setUserData(String data) {
|
public Purchasable setUserData(String data) {
|
||||||
this.userData = data;
|
this.userData = data;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserData() {
|
public String getUserData() {
|
||||||
return this.userData;
|
return this.userData;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package org.linphone.sync;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
AuthenticationService.java
|
AuthenticationService.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
|
||||||
|
|
|
@ -2,7 +2,7 @@ package org.linphone.sync;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Authenticator.java
|
Authenticator.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
|
||||||
|
|
|
@ -2,7 +2,7 @@ package org.linphone.sync;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
SyncAdapter.java
|
SyncAdapter.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
|
||||||
|
|
|
@ -2,7 +2,7 @@ package org.linphone.sync;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
SyncService.java
|
SyncService.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
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
|
package org.linphone.tutorials;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
AndroidTutorialNotifier.java
|
AndroidTutorialNotifier.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.tutorials;
|
|
||||||
|
|
||||||
import org.linphone.core.tutorials.TutorialNotifier;
|
import org.linphone.core.tutorials.TutorialNotifier;
|
||||||
|
|
||||||
|
@ -26,21 +27,19 @@ import android.widget.TextView;
|
||||||
/**
|
/**
|
||||||
* Write notifications to a TextView widget.
|
* Write notifications to a TextView widget.
|
||||||
* This is an helper class, not a test activity.
|
* This is an helper class, not a test activity.
|
||||||
*
|
|
||||||
* @author Guillaume Beraudo
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class AndroidTutorialNotifier extends TutorialNotifier {
|
class AndroidTutorialNotifier extends TutorialNotifier {
|
||||||
|
|
||||||
private Handler mHandler;
|
private Handler mHandler;
|
||||||
private TextView outputTextView;
|
private TextView outputTextView;
|
||||||
|
|
||||||
public AndroidTutorialNotifier(Handler mHandler, final TextView outputTextView) {
|
public AndroidTutorialNotifier(Handler mHandler, final TextView outputTextView) {
|
||||||
this.mHandler = mHandler;
|
this.mHandler = mHandler;
|
||||||
this.outputTextView = outputTextView;
|
this.outputTextView = outputTextView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void notify(final String s) {
|
public void notify(final String s) {
|
||||||
mHandler.post(new Runnable() {
|
mHandler.post(new Runnable() {
|
||||||
|
|
|
@ -1,5 +1,24 @@
|
||||||
package org.linphone.tutorials;
|
package org.linphone.tutorials;
|
||||||
|
|
||||||
|
/*
|
||||||
|
TutorialCardDavSync.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.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.util.Timer;
|
import java.util.Timer;
|
||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
|
package org.linphone.tutorials;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
TutorialChatRoomActivity.java
|
TutorialChatRoomActivity.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.tutorials;
|
|
||||||
|
|
||||||
import org.linphone.R;
|
import org.linphone.R;
|
||||||
import org.linphone.core.LinphoneCoreException;
|
import org.linphone.core.LinphoneCoreException;
|
||||||
|
@ -34,8 +35,6 @@ import android.widget.TextView;
|
||||||
/**
|
/**
|
||||||
* Activity for displaying and starting the chatroom example on Android phone.
|
* Activity for displaying and starting the chatroom example on Android phone.
|
||||||
*
|
*
|
||||||
* @author Guillaume Beraudo
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class TutorialChatRoomActivity extends Activity {
|
public class TutorialChatRoomActivity extends Activity {
|
||||||
|
|
||||||
|
@ -56,12 +55,12 @@ public class TutorialChatRoomActivity extends Activity {
|
||||||
final TextView outputText = (TextView) findViewById(R.id.OutputText);
|
final TextView outputText = (TextView) findViewById(R.id.OutputText);
|
||||||
final TutorialNotifier notifier = new AndroidTutorialNotifier(mHandler, outputText);
|
final TutorialNotifier notifier = new AndroidTutorialNotifier(mHandler, outputText);
|
||||||
|
|
||||||
|
|
||||||
// Create HelloWorld object
|
// Create HelloWorld object
|
||||||
tutorial = new TutorialChatRoom(notifier);
|
tutorial = new TutorialChatRoom(notifier);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Assign call action to call button
|
// Assign call action to call button
|
||||||
buttonCall = (Button) findViewById(R.id.CallButton);
|
buttonCall = (Button) findViewById(R.id.CallButton);
|
||||||
buttonCall.setOnClickListener(new View.OnClickListener() {
|
buttonCall.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@ -80,8 +79,8 @@ public class TutorialChatRoomActivity extends Activity {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private class TutorialLaunchingThread extends Thread {
|
private class TutorialLaunchingThread extends Thread {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package org.linphone.tutorials;
|
package org.linphone.tutorials;
|
||||||
/*
|
/*
|
||||||
TutorialLauncherActivity.java
|
TutorialLauncherActivity.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
|
||||||
|
@ -25,32 +25,29 @@ import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Sylvain Berfini
|
|
||||||
*/
|
|
||||||
public class TutorialLauncherActivity extends Activity {
|
public class TutorialLauncherActivity extends Activity {
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.tutorials);
|
setContentView(R.layout.tutorials);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startHelloWorldTutorial(View v) {
|
public void startHelloWorldTutorial(View v) {
|
||||||
startActivity(new Intent().setClass(TutorialLauncherActivity.this, TutorialHelloWorldActivity.class));
|
startActivity(new Intent().setClass(TutorialLauncherActivity.this, TutorialHelloWorldActivity.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startRegistrationTutorial(View v) {
|
public void startRegistrationTutorial(View v) {
|
||||||
startActivity(new Intent().setClass(TutorialLauncherActivity.this, TutorialRegistrationActivity.class));
|
startActivity(new Intent().setClass(TutorialLauncherActivity.this, TutorialRegistrationActivity.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startChatRoomTutorial(View v) {
|
public void startChatRoomTutorial(View v) {
|
||||||
startActivity(new Intent().setClass(TutorialLauncherActivity.this, TutorialChatRoomActivity.class));
|
startActivity(new Intent().setClass(TutorialLauncherActivity.this, TutorialChatRoomActivity.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startBuddyStatusTutorial(View v) {
|
public void startBuddyStatusTutorial(View v) {
|
||||||
startActivity(new Intent().setClass(TutorialLauncherActivity.this, TutorialBuddyStatusActivity.class));
|
startActivity(new Intent().setClass(TutorialLauncherActivity.this, TutorialBuddyStatusActivity.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startCardDavSyncTutorial(View v) {
|
public void startCardDavSyncTutorial(View v) {
|
||||||
startActivity(new Intent().setClass(TutorialLauncherActivity.this, TutorialCardDavSync.class));
|
startActivity(new Intent().setClass(TutorialLauncherActivity.this, TutorialCardDavSync.class));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
|
package org.linphone.tutorials;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
TutorialRegistrationActivity.java
|
TutorialRegistrationActivity.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.tutorials;
|
|
||||||
|
|
||||||
import org.linphone.R;
|
import org.linphone.R;
|
||||||
import org.linphone.core.LinphoneCoreException;
|
import org.linphone.core.LinphoneCoreException;
|
||||||
|
@ -32,8 +33,6 @@ import android.widget.TextView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Activity for displaying and starting the registration example on Android phone.
|
* Activity for displaying and starting the registration example on Android phone.
|
||||||
*
|
|
||||||
* @author Guillaume Beraudo
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class TutorialRegistrationActivity extends TutorialHelloWorldActivity {
|
public class TutorialRegistrationActivity extends TutorialHelloWorldActivity {
|
||||||
|
@ -62,12 +61,12 @@ public class TutorialRegistrationActivity extends TutorialHelloWorldActivity {
|
||||||
outputText = (TextView) findViewById(R.id.OutputText);
|
outputText = (TextView) findViewById(R.id.OutputText);
|
||||||
final TutorialNotifier notifier = new AndroidTutorialNotifier(mHandler, outputText);
|
final TutorialNotifier notifier = new AndroidTutorialNotifier(mHandler, outputText);
|
||||||
|
|
||||||
|
|
||||||
// Create Tutorial object
|
// Create Tutorial object
|
||||||
tutorial = new TutorialRegistration(notifier);
|
tutorial = new TutorialRegistration(notifier);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Assign call action to call button
|
// Assign call action to call button
|
||||||
buttonCall = (Button) findViewById(R.id.CallButton);
|
buttonCall = (Button) findViewById(R.id.CallButton);
|
||||||
buttonCall.setText("Register");
|
buttonCall.setText("Register");
|
||||||
|
@ -87,8 +86,8 @@ public class TutorialRegistrationActivity extends TutorialHelloWorldActivity {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private class TutorialLaunchingThread extends Thread {
|
private class TutorialLaunchingThread extends Thread {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
|
package org.linphone.ui;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
AddressAwareWidget.java
|
AddressAwareWidget.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,14 +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.
|
||||||
*/
|
*/
|
||||||
package org.linphone.ui;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Guillaume Beraudo
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public interface AddressAware {
|
public interface AddressAware {
|
||||||
|
|
||||||
void setAddressWidget(AddressText address);
|
void setAddressWidget(AddressText address);
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
|
package org.linphone.ui;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
AddressView.java
|
AddressView.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.ui;
|
|
||||||
|
|
||||||
import org.linphone.DialerFragment;
|
import org.linphone.DialerFragment;
|
||||||
import org.linphone.LinphoneManager.AddressType;
|
import org.linphone.LinphoneManager.AddressType;
|
||||||
|
@ -29,17 +30,13 @@ import android.util.AttributeSet;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Guillaume Beraudo
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class AddressText extends EditText implements AddressType {
|
public class AddressText extends EditText implements AddressType {
|
||||||
|
|
||||||
private String displayedName;
|
private String displayedName;
|
||||||
private Uri pictureUri;
|
private Uri pictureUri;
|
||||||
private Paint mTestPaint;
|
private Paint mTestPaint;
|
||||||
private DialerFragment dialer;
|
private DialerFragment dialer;
|
||||||
|
|
||||||
public void setPictureUri(Uri uri) {
|
public void setPictureUri(Uri uri) {
|
||||||
pictureUri = uri;
|
pictureUri = uri;
|
||||||
}
|
}
|
||||||
|
@ -71,7 +68,7 @@ public class AddressText extends EditText implements AddressType {
|
||||||
public void setDisplayedName(String displayedName) {
|
public void setDisplayedName(String displayedName) {
|
||||||
this.displayedName = displayedName;
|
this.displayedName = displayedName;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getHintText() {
|
private String getHintText() {
|
||||||
String resizedText = getContext().getString(R.string.address_bar_hint);
|
String resizedText = getContext().getString(R.string.address_bar_hint);
|
||||||
if (getHint() != null) {
|
if (getHint() != null) {
|
||||||
|
@ -87,7 +84,7 @@ public class AddressText extends EditText implements AddressType {
|
||||||
pictureUri = null;
|
pictureUri = null;
|
||||||
|
|
||||||
refitText(getWidth(), getHeight());
|
refitText(getWidth(), getHeight());
|
||||||
|
|
||||||
if (dialer != null) {
|
if (dialer != null) {
|
||||||
dialer.enableDisableAddContact();
|
dialer.enableDisableAddContact();
|
||||||
}
|
}
|
||||||
|
@ -101,7 +98,7 @@ public class AddressText extends EditText implements AddressType {
|
||||||
refitText(getWidth(), getHeight());
|
refitText(getWidth(), getHeight());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private float getOptimizedTextSize(String text, int textWidth, int textHeight) {
|
private float getOptimizedTextSize(String text, int textWidth, int textHeight) {
|
||||||
int targetWidth = textWidth - getPaddingLeft() - getPaddingRight();
|
int targetWidth = textWidth - getPaddingLeft() - getPaddingRight();
|
||||||
int targetHeight = textHeight - getPaddingTop() - getPaddingBottom();
|
int targetHeight = textHeight - getPaddingTop() - getPaddingBottom();
|
||||||
|
@ -121,7 +118,7 @@ public class AddressText extends EditText implements AddressType {
|
||||||
lo = size;
|
lo = size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return lo;
|
return lo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +126,7 @@ public class AddressText extends EditText implements AddressType {
|
||||||
if (textWidth <= 0) {
|
if (textWidth <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
float size = getOptimizedTextSize(getHintText(), textWidth, textHeight);
|
float size = getOptimizedTextSize(getHintText(), textWidth, textHeight);
|
||||||
float entrySize = getOptimizedTextSize(getText().toString(), textWidth, textHeight);
|
float entrySize = getOptimizedTextSize(getText().toString(), textWidth, textHeight);
|
||||||
if (entrySize < size)
|
if (entrySize < size)
|
||||||
|
@ -141,7 +138,7 @@ public class AddressText extends EditText implements AddressType {
|
||||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||||
int parentWidth = MeasureSpec.getSize(widthMeasureSpec);
|
int parentWidth = MeasureSpec.getSize(widthMeasureSpec);
|
||||||
int height = getMeasuredHeight();
|
int height = getMeasuredHeight();
|
||||||
|
|
||||||
refitText(parentWidth, height);
|
refitText(parentWidth, height);
|
||||||
setMeasuredDimension(parentWidth, height);
|
setMeasuredDimension(parentWidth, height);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
|
package org.linphone.ui;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
CallButton.java
|
CallButton.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.ui;
|
|
||||||
|
|
||||||
import org.linphone.LinphoneManager;
|
import org.linphone.LinphoneManager;
|
||||||
import org.linphone.LinphonePreferences;
|
import org.linphone.LinphonePreferences;
|
||||||
|
@ -33,9 +34,6 @@ import android.view.View.OnClickListener;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Guillaume Beraudo
|
|
||||||
*/
|
|
||||||
public class CallButton extends ImageView implements OnClickListener, AddressAware {
|
public class CallButton extends ImageView implements OnClickListener, AddressAware {
|
||||||
|
|
||||||
private AddressText mAddress;
|
private AddressText mAddress;
|
||||||
|
@ -52,7 +50,7 @@ public class CallButton extends ImageView implements OnClickListener, AddressAwa
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
try {
|
try {
|
||||||
if (!LinphoneManager.getInstance().acceptCallIfIncomingPending()) {
|
if (!LinphoneManager.getInstance().acceptCallIfIncomingPending()) {
|
||||||
if (mAddress.getText().length() > 0) {
|
if (mAddress.getText().length() > 0) {
|
||||||
LinphoneManager.getInstance().newOutgoingCall(mAddress);
|
LinphoneManager.getInstance().newOutgoingCall(mAddress);
|
||||||
} else {
|
} else {
|
||||||
if (LinphonePreferences.instance().isBisFeatureEnabled()) {
|
if (LinphonePreferences.instance().isBisFeatureEnabled()) {
|
||||||
|
@ -67,7 +65,7 @@ public class CallButton extends ImageView implements OnClickListener, AddressAwa
|
||||||
if (log == null) {
|
if (log == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LinphoneProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig();
|
LinphoneProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig();
|
||||||
if (lpc != null && log.getTo().getDomain().equals(lpc.getDomain())) {
|
if (lpc != null && log.getTo().getDomain().equals(lpc.getDomain())) {
|
||||||
mAddress.setText(log.getTo().getUserName());
|
mAddress.setText(log.getTo().getUserName());
|
||||||
|
@ -84,7 +82,7 @@ public class CallButton extends ImageView implements OnClickListener, AddressAwa
|
||||||
onWrongDestinationAddress();
|
onWrongDestinationAddress();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onWrongDestinationAddress() {
|
protected void onWrongDestinationAddress() {
|
||||||
Toast.makeText(getContext()
|
Toast.makeText(getContext()
|
||||||
,String.format(getResources().getString(R.string.warning_wrong_destination_address),mAddress.getText().toString())
|
,String.format(getResources().getString(R.string.warning_wrong_destination_address),mAddress.getText().toString())
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
|
package org.linphone.ui;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Digit.java
|
Digit.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.ui;
|
|
||||||
|
|
||||||
import org.linphone.CallActivity;
|
import org.linphone.CallActivity;
|
||||||
import org.linphone.LinphoneManager;
|
import org.linphone.LinphoneManager;
|
||||||
|
@ -52,7 +53,7 @@ public class Digit extends Button implements AddressAware {
|
||||||
protected void onTextChanged(CharSequence text, int start, int before,
|
protected void onTextChanged(CharSequence text, int start, int before,
|
||||||
int after) {
|
int after) {
|
||||||
super.onTextChanged(text, start, before, after);
|
super.onTextChanged(text, start, before, after);
|
||||||
|
|
||||||
if (text == null || text.length() < 1) {
|
if (text == null || text.length() < 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -60,21 +61,21 @@ public class Digit extends Button implements AddressAware {
|
||||||
DialKeyListener lListener = new DialKeyListener();
|
DialKeyListener lListener = new DialKeyListener();
|
||||||
setOnClickListener(lListener);
|
setOnClickListener(lListener);
|
||||||
setOnTouchListener(lListener);
|
setOnTouchListener(lListener);
|
||||||
|
|
||||||
if ("0+".equals(text)) {
|
if ("0+".equals(text)) {
|
||||||
setOnLongClickListener(lListener);
|
setOnLongClickListener(lListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("1".equals(text)) {
|
if ("1".equals(text)) {
|
||||||
setOnLongClickListener(lListener);
|
setOnLongClickListener(lListener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Digit(Context context, AttributeSet attrs, int style) {
|
public Digit(Context context, AttributeSet attrs, int style) {
|
||||||
super(context, attrs, style);
|
super(context, attrs, style);
|
||||||
setLongClickable(true);
|
setLongClickable(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Digit(Context context, AttributeSet attrs) {
|
public Digit(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
setLongClickable(true);
|
setLongClickable(true);
|
||||||
|
@ -112,7 +113,7 @@ public class Digit extends Button implements AddressAware {
|
||||||
lc.sendDtmf(mKeyCode);
|
lc.sendDtmf(mKeyCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mAddress != null) {
|
if (mAddress != null) {
|
||||||
int lBegin = mAddress.getSelectionStart();
|
int lBegin = mAddress.getSelectionStart();
|
||||||
if (lBegin == -1) {
|
if (lBegin == -1) {
|
||||||
|
@ -169,7 +170,7 @@ public class Digit extends Button implements AddressAware {
|
||||||
if (CallActivity.isInstanciated()) {
|
if (CallActivity.isInstanciated()) {
|
||||||
CallActivity.instance().resetControlsHidingCallBack();
|
CallActivity.instance().resetControlsHidingCallBack();
|
||||||
}
|
}
|
||||||
|
|
||||||
LinphoneCore lc = LinphoneManager.getLc();
|
LinphoneCore lc = LinphoneManager.getLc();
|
||||||
if (event.getAction() == MotionEvent.ACTION_DOWN && !mIsDtmfStarted) {
|
if (event.getAction() == MotionEvent.ACTION_DOWN && !mIsDtmfStarted) {
|
||||||
LinphoneManager.getInstance().playDtmf(getContext().getContentResolver(), mKeyCode);
|
LinphoneManager.getInstance().playDtmf(getContext().getContentResolver(), mKeyCode);
|
||||||
|
@ -182,7 +183,7 @@ public class Digit extends Button implements AddressAware {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onLongClick(View v) {
|
public boolean onLongClick(View v) {
|
||||||
int id = v.getId();
|
int id = v.getId();
|
||||||
LinphoneCore lc = LinphoneManager.getLc();
|
LinphoneCore lc = LinphoneManager.getLc();
|
||||||
|
@ -192,7 +193,7 @@ public class Digit extends Button implements AddressAware {
|
||||||
// Called if "0+" dtmf
|
// Called if "0+" dtmf
|
||||||
lc.stopDtmf();
|
lc.stopDtmf();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(id == R.id.Digit1 && lc.getCalls().length == 0){
|
if(id == R.id.Digit1 && lc.getCalls().length == 0){
|
||||||
String voiceMail = LinphonePreferences.instance().getVoiceMailUri();
|
String voiceMail = LinphonePreferences.instance().getVoiceMailUri();
|
||||||
mAddress.getEditableText().clear();
|
mAddress.getEditableText().clear();
|
||||||
|
@ -202,8 +203,8 @@ public class Digit extends Button implements AddressAware {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (mAddress == null) return true;
|
if (mAddress == null) return true;
|
||||||
|
|
||||||
int lBegin = mAddress.getSelectionStart();
|
int lBegin = mAddress.getSelectionStart();
|
||||||
|
|
|
@ -2,7 +2,7 @@ package org.linphone.ui;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
LedPreference.java
|
LedPreference.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
|
||||||
|
@ -26,13 +26,10 @@ import android.preference.Preference;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Sylvain Berfini
|
|
||||||
*/
|
|
||||||
public class LedPreference extends Preference
|
public class LedPreference extends Preference
|
||||||
{
|
{
|
||||||
private int ledDrawable;
|
private int ledDrawable;
|
||||||
|
|
||||||
public LedPreference(Context context) {
|
public LedPreference(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
ledDrawable = R.drawable.led_disconnected;
|
ledDrawable = R.drawable.led_disconnected;
|
||||||
|
|
|
@ -1,5 +1,24 @@
|
||||||
package org.linphone.ui;
|
package org.linphone.ui;
|
||||||
|
|
||||||
|
/*
|
||||||
|
LinphoneOverlay.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.LinphoneActivity;
|
import org.linphone.LinphoneActivity;
|
||||||
import org.linphone.LinphoneManager;
|
import org.linphone.LinphoneManager;
|
||||||
import org.linphone.LinphoneService;
|
import org.linphone.LinphoneService;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package org.linphone.ui;
|
package org.linphone.ui;
|
||||||
/*
|
/*
|
||||||
LinphoneScrollView.java
|
LinphoneScrollView.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
|
||||||
|
@ -21,9 +21,6 @@ import android.content.Context;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.widget.ScrollView;
|
import android.widget.ScrollView;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Sylvain Berfini
|
|
||||||
*/
|
|
||||||
public class LinphoneScrollView extends ScrollView {
|
public class LinphoneScrollView extends ScrollView {
|
||||||
private ScrollViewListener scrollViewListener = null;
|
private ScrollViewListener scrollViewListener = null;
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ import android.view.View;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
LinphoneSliders.java
|
LinphoneSliders.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
|
||||||
|
@ -28,9 +28,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 LinphoneSliders extends View implements OnGestureListener {
|
public class LinphoneSliders extends View implements OnGestureListener {
|
||||||
private Drawable leftSliderImg, rightSliderImg;
|
private Drawable leftSliderImg, rightSliderImg;
|
||||||
private int leftSliderX, rightSliderX;
|
private int leftSliderX, rightSliderX;
|
||||||
|
@ -39,36 +36,36 @@ public class LinphoneSliders extends View implements OnGestureListener {
|
||||||
private LinphoneSliderTriggered mTriggerListener;
|
private LinphoneSliderTriggered mTriggerListener;
|
||||||
private boolean slidingLeftHandle, slidingRightHandle;
|
private boolean slidingLeftHandle, slidingRightHandle;
|
||||||
private static final double mCoeff = 0.5;
|
private static final double mCoeff = 0.5;
|
||||||
|
|
||||||
public LinphoneSliders(Context context, AttributeSet attrs) {
|
public LinphoneSliders(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
mGestures = new GestureDetector(getContext(), this);
|
mGestures = new GestureDetector(getContext(), this);
|
||||||
//leftSliderImg = getResources().getDrawable(R.drawable.slider_left);
|
//leftSliderImg = getResources().getDrawable(R.drawable.slider_left);
|
||||||
//rightSliderImg = getResources().getDrawable(R.drawable.slider_right);
|
//rightSliderImg = getResources().getDrawable(R.drawable.slider_right);
|
||||||
|
|
||||||
slidersHeight = leftSliderImg.getIntrinsicHeight();
|
slidersHeight = leftSliderImg.getIntrinsicHeight();
|
||||||
slidersWidth = leftSliderImg.getIntrinsicWidth();
|
slidersWidth = leftSliderImg.getIntrinsicWidth();
|
||||||
|
|
||||||
leftSliderX = 0;
|
leftSliderX = 0;
|
||||||
rightSliderX = 0;
|
rightSliderX = 0;
|
||||||
slidingLeftHandle = slidingRightHandle = false;
|
slidingLeftHandle = slidingRightHandle = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDraw(Canvas canvas) {
|
protected void onDraw(Canvas canvas) {
|
||||||
rightSliderImg.setBounds(getWidth() - slidersWidth - rightSliderX, getHeight() - slidersHeight, getWidth(), getHeight());
|
rightSliderImg.setBounds(getWidth() - slidersWidth - rightSliderX, getHeight() - slidersHeight, getWidth(), getHeight());
|
||||||
rightSliderImg.draw(canvas);
|
rightSliderImg.draw(canvas);
|
||||||
|
|
||||||
leftSliderImg.setBounds(0, getHeight() - slidersHeight, slidersWidth + leftSliderX, getHeight());
|
leftSliderImg.setBounds(0, getHeight() - slidersHeight, slidersWidth + leftSliderX, getHeight());
|
||||||
leftSliderImg.draw(canvas);
|
leftSliderImg.draw(canvas);
|
||||||
|
|
||||||
if (slidingLeftHandle && Math.abs(leftSliderX) >= mCoeff * getWidth()) {
|
if (slidingLeftHandle && Math.abs(leftSliderX) >= mCoeff * getWidth()) {
|
||||||
mTriggerListener.onLeftHandleTriggered();
|
mTriggerListener.onLeftHandleTriggered();
|
||||||
} else if (slidingRightHandle && rightSliderX >= mCoeff * getWidth()) {
|
} else if (slidingRightHandle && rightSliderX >= mCoeff * getWidth()) {
|
||||||
mTriggerListener.onRightHandleTriggered();
|
mTriggerListener.onRightHandleTriggered();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouchEvent(MotionEvent event) {
|
public boolean onTouchEvent(MotionEvent event) {
|
||||||
if (event.getAction() == MotionEvent.ACTION_UP) {
|
if (event.getAction() == MotionEvent.ACTION_UP) {
|
||||||
|
@ -77,8 +74,8 @@ public class LinphoneSliders extends View implements OnGestureListener {
|
||||||
slidingLeftHandle = slidingRightHandle = false;
|
slidingLeftHandle = slidingRightHandle = false;
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
return mGestures.onTouchEvent(event);
|
return mGestures.onTouchEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -94,7 +91,7 @@ public class LinphoneSliders extends View implements OnGestureListener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLongPress(MotionEvent e) {
|
public void onLongPress(MotionEvent e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -103,7 +100,7 @@ public class LinphoneSliders extends View implements OnGestureListener {
|
||||||
if (e1.getY() < getHeight() - slidersHeight) {
|
if (e1.getY() < getHeight() - slidersHeight) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e1.getX() < getWidth() / 2) {
|
if (e1.getX() < getWidth() / 2) {
|
||||||
leftSliderX -= distanceX;
|
leftSliderX -= distanceX;
|
||||||
slidingLeftHandle = true;
|
slidingLeftHandle = true;
|
||||||
|
@ -112,20 +109,20 @@ public class LinphoneSliders extends View implements OnGestureListener {
|
||||||
slidingRightHandle = true;
|
slidingRightHandle = true;
|
||||||
}
|
}
|
||||||
invalidate();
|
invalidate();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onShowPress(MotionEvent e) {
|
public void onShowPress(MotionEvent e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onSingleTapUp(MotionEvent e) {
|
public boolean onSingleTapUp(MotionEvent e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOnTriggerListener(LinphoneSliderTriggered listener) {
|
public void setOnTriggerListener(LinphoneSliderTriggered listener) {
|
||||||
mTriggerListener = listener;
|
mTriggerListener = listener;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
|
package org.linphone.ui;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
NumpadView.java
|
NumpadView.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.ui;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
@ -31,10 +32,6 @@ import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Guillaume Beraudo
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class Numpad extends LinearLayout implements AddressAware {
|
public class Numpad extends LinearLayout implements AddressAware {
|
||||||
|
|
||||||
private boolean mPlayDtmf;
|
private boolean mPlayDtmf;
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
package org.linphone.ui;
|
package org.linphone.ui;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
PreferencesListFragment.java
|
PreferencesListFragment.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 java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
@ -45,13 +47,13 @@ import android.widget.RelativeLayout;
|
||||||
@SuppressLint("ValidFragment")
|
@SuppressLint("ValidFragment")
|
||||||
public class PreferencesListFragment extends ListFragment {
|
public class PreferencesListFragment extends ListFragment {
|
||||||
private PreferenceManager mPreferenceManager;
|
private PreferenceManager mPreferenceManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The starting request code given out to preference framework.
|
* The starting request code given out to preference framework.
|
||||||
*/
|
*/
|
||||||
private static final int FIRST_REQUEST_CODE = 100;
|
private static final int FIRST_REQUEST_CODE = 100;
|
||||||
private static final int MSG_BIND_PREFERENCES = 0;
|
private static final int MSG_BIND_PREFERENCES = 0;
|
||||||
|
|
||||||
private Handler mHandler = new Handler() {
|
private Handler mHandler = new Handler() {
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(Message msg) {
|
public void handleMessage(Message msg) {
|
||||||
|
@ -64,33 +66,33 @@ public class PreferencesListFragment extends ListFragment {
|
||||||
};
|
};
|
||||||
private ListView preferencesList;
|
private ListView preferencesList;
|
||||||
private int xmlResID;
|
private int xmlResID;
|
||||||
|
|
||||||
public PreferencesListFragment(int xmlId) {
|
public PreferencesListFragment(int xmlId) {
|
||||||
this.xmlResID = xmlId;
|
this.xmlResID = xmlId;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Must be provided
|
// Must be provided
|
||||||
public PreferencesListFragment() {
|
public PreferencesListFragment() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle b) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle b) {
|
||||||
// Hack to correctly display preferences
|
// Hack to correctly display preferences
|
||||||
View view = inflater.inflate(R.layout.settings, null);
|
View view = inflater.inflate(R.layout.settings, null);
|
||||||
|
|
||||||
ViewParent p = preferencesList.getParent();
|
ViewParent p = preferencesList.getParent();
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
((ViewGroup)p).removeView(preferencesList);
|
((ViewGroup)p).removeView(preferencesList);
|
||||||
}
|
}
|
||||||
|
|
||||||
RelativeLayout layout = (RelativeLayout) view.findViewById(R.id.topLayout);
|
RelativeLayout layout = (RelativeLayout) view.findViewById(R.id.topLayout);
|
||||||
layout.addView(preferencesList);
|
layout.addView(preferencesList);
|
||||||
|
|
||||||
postBindPreferences();
|
postBindPreferences();
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroyView(){
|
public void onDestroyView(){
|
||||||
super.onDestroyView();
|
super.onDestroyView();
|
||||||
|
@ -103,11 +105,11 @@ public class PreferencesListFragment extends ListFragment {
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle bundle) {
|
public void onCreate(Bundle bundle) {
|
||||||
super.onCreate(bundle);
|
super.onCreate(bundle);
|
||||||
|
|
||||||
if (bundle != null) {
|
if (bundle != null) {
|
||||||
xmlResID = bundle.getInt("xml");
|
xmlResID = bundle.getInt("xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
mPreferenceManager = onCreatePreferenceManager();
|
mPreferenceManager = onCreatePreferenceManager();
|
||||||
preferencesList = (ListView) LayoutInflater.from(getActivity()).inflate(R.layout.preference_list_content, null);
|
preferencesList = (ListView) LayoutInflater.from(getActivity()).inflate(R.layout.preference_list_content, null);
|
||||||
preferencesList.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
|
preferencesList.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
|
||||||
|
@ -168,17 +170,17 @@ public class PreferencesListFragment extends ListFragment {
|
||||||
if (mHandler.hasMessages(MSG_BIND_PREFERENCES)) return;
|
if (mHandler.hasMessages(MSG_BIND_PREFERENCES)) return;
|
||||||
mHandler.obtainMessage(MSG_BIND_PREFERENCES).sendToTarget();
|
mHandler.obtainMessage(MSG_BIND_PREFERENCES).sendToTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void bindPreferences() {
|
private void bindPreferences() {
|
||||||
final PreferenceScreen preferenceScreen = getPreferenceScreen();
|
final PreferenceScreen preferenceScreen = getPreferenceScreen();
|
||||||
if (preferenceScreen != null && preferencesList != null) {
|
if (preferenceScreen != null && preferencesList != null) {
|
||||||
preferenceScreen.bind(preferencesList);
|
preferenceScreen.bind(preferencesList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the {@link PreferenceManager}.
|
* Creates the {@link PreferenceManager}.
|
||||||
*
|
*
|
||||||
* @return The {@link PreferenceManager} used by this activity.
|
* @return The {@link PreferenceManager} used by this activity.
|
||||||
*/
|
*/
|
||||||
private PreferenceManager onCreatePreferenceManager() {
|
private PreferenceManager onCreatePreferenceManager() {
|
||||||
|
@ -192,7 +194,7 @@ public class PreferencesListFragment extends ListFragment {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the {@link PreferenceManager} used by this activity.
|
* Returns the {@link PreferenceManager} used by this activity.
|
||||||
* @return The {@link PreferenceManager}.
|
* @return The {@link PreferenceManager}.
|
||||||
|
@ -203,7 +205,7 @@ public class PreferencesListFragment extends ListFragment {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the root of the preference hierarchy that this activity is showing.
|
* Sets the root of the preference hierarchy that this activity is showing.
|
||||||
*
|
*
|
||||||
* @param preferenceScreen The root {@link PreferenceScreen} of the preference hierarchy.
|
* @param preferenceScreen The root {@link PreferenceScreen} of the preference hierarchy.
|
||||||
*/
|
*/
|
||||||
public void setPreferenceScreen(PreferenceScreen preferenceScreen) {
|
public void setPreferenceScreen(PreferenceScreen preferenceScreen) {
|
||||||
|
@ -218,10 +220,10 @@ public class PreferencesListFragment extends ListFragment {
|
||||||
Log.e("[PreferencesListFragment] setPreferenceScreen " + e);
|
Log.e("[PreferencesListFragment] setPreferenceScreen " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the root of the preference hierarchy that this activity is showing.
|
* Gets the root of the preference hierarchy that this activity is showing.
|
||||||
*
|
*
|
||||||
* @return The {@link PreferenceScreen} that is the root of the preference
|
* @return The {@link PreferenceScreen} that is the root of the preference
|
||||||
* hierarchy.
|
* hierarchy.
|
||||||
*/
|
*/
|
||||||
|
@ -233,17 +235,17 @@ public class PreferencesListFragment extends ListFragment {
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
Log.e("[PreferencesListFragment] getPreferenceScreen " + e);
|
Log.e("[PreferencesListFragment] getPreferenceScreen " + e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inflates the given XML resource and adds the preference hierarchy to the current
|
* Inflates the given XML resource and adds the preference hierarchy to the current
|
||||||
* preference hierarchy.
|
* preference hierarchy.
|
||||||
*
|
*
|
||||||
* @param preferencesResId The XML resource ID to inflate.
|
* @param preferencesResId The XML resource ID to inflate.
|
||||||
*/
|
*/
|
||||||
public void addPreferencesFromResource(int preferencesResId) {
|
public void addPreferencesFromResource(int preferencesResId) {
|
||||||
try {
|
try {
|
||||||
Method m = PreferenceManager.class.getDeclaredMethod("inflateFromResource", Context.class, int.class, PreferenceScreen.class);
|
Method m = PreferenceManager.class.getDeclaredMethod("inflateFromResource", Context.class, int.class, PreferenceScreen.class);
|
||||||
m.setAccessible(true);
|
m.setAccessible(true);
|
||||||
|
@ -253,10 +255,10 @@ public class PreferencesListFragment extends ListFragment {
|
||||||
Log.e("[PreferencesListFragment] addPreferencesFromResource " + e);
|
Log.e("[PreferencesListFragment] addPreferencesFromResource " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds a {@link Preference} based on its key.
|
* Finds a {@link Preference} based on its key.
|
||||||
*
|
*
|
||||||
* @param key The key of the preference to retrieve.
|
* @param key The key of the preference to retrieve.
|
||||||
* @return The {@link Preference} with the key, or null.
|
* @return The {@link Preference} with the key, or null.
|
||||||
* @see PreferenceGroup#findPreference(CharSequence)
|
* @see PreferenceGroup#findPreference(CharSequence)
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
package org.linphone.ui;
|
package org.linphone.ui;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ScrollViewListener.java
|
ScrollViewListener.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
|
||||||
|
@ -18,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.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Sylvain Berfini
|
|
||||||
*/
|
|
||||||
public interface ScrollViewListener {
|
public interface ScrollViewListener {
|
||||||
void OnScrollToTop(int previousHeight);
|
void OnScrollToTop(int previousHeight);
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue