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;
|
||||
|
||||
/*
|
||||
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
|
||||
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.os.Bundle;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class LinphoneMiniActivity extends Activity {
|
||||
private LinphoneMiniManager mManager;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
|
||||
mManager = new LinphoneMiniManager(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
mManager.destroy();
|
||||
|
||||
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package org.linphone.mini;
|
||||
|
||||
/*
|
||||
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
|
||||
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.pm.PackageManager.NameNotFoundException;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class LinphoneMiniManager implements LinphoneCoreListener {
|
||||
private static LinphoneMiniManager mInstance;
|
||||
private Context mContext;
|
||||
private LinphoneCore mLinphoneCore;
|
||||
private Timer mTimer;
|
||||
|
||||
|
||||
public LinphoneMiniManager(Context c) {
|
||||
mContext = c;
|
||||
LinphoneCoreFactory.instance().setDebugMode(true, "Linphone Mini");
|
||||
|
||||
|
||||
try {
|
||||
String basePath = mContext.getFilesDir().getAbsolutePath();
|
||||
copyAssetsFromPackage(basePath);
|
||||
mLinphoneCore = LinphoneCoreFactory.instance().createLinphoneCore(this, basePath + "/.linphonerc", basePath + "/linphonerc", null, mContext);
|
||||
initLinphoneCoreValues(basePath);
|
||||
|
||||
|
||||
setUserAgent();
|
||||
setFrontCamAsDefault();
|
||||
startIterate();
|
||||
|
@ -79,11 +77,11 @@ public class LinphoneMiniManager implements LinphoneCoreListener {
|
|||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static LinphoneMiniManager getInstance() {
|
||||
return mInstance;
|
||||
}
|
||||
|
||||
|
||||
public void destroy() {
|
||||
try {
|
||||
mTimer.cancel();
|
||||
|
@ -96,7 +94,7 @@ public class LinphoneMiniManager implements LinphoneCoreListener {
|
|||
mInstance = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void startIterate() {
|
||||
TimerTask lTask = new TimerTask() {
|
||||
@Override
|
||||
|
@ -104,12 +102,12 @@ public class LinphoneMiniManager implements LinphoneCoreListener {
|
|||
mLinphoneCore.iterate();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/*use schedule instead of scheduleAtFixedRate to avoid iterate from being call in burst after cpu wake up*/
|
||||
mTimer = new Timer("LinphoneMini scheduler");
|
||||
mTimer.schedule(lTask, 0, 20);
|
||||
mTimer.schedule(lTask, 0, 20);
|
||||
}
|
||||
|
||||
|
||||
private void setUserAgent() {
|
||||
try {
|
||||
String versionName = mContext.getPackageManager().getPackageInfo(mContext.getPackageName(), 0).versionName;
|
||||
|
@ -120,7 +118,7 @@ public class LinphoneMiniManager implements LinphoneCoreListener {
|
|||
} catch (NameNotFoundException e) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void setFrontCamAsDefault() {
|
||||
int camId = 0;
|
||||
AndroidCamera[] cameras = AndroidCameraConfiguration.retrieveCameras();
|
||||
|
@ -130,7 +128,7 @@ public class LinphoneMiniManager implements LinphoneCoreListener {
|
|||
}
|
||||
mLinphoneCore.setVideoDevice(camId);
|
||||
}
|
||||
|
||||
|
||||
private void copyAssetsFromPackage(String basePath) throws IOException {
|
||||
LinphoneMiniUtils.copyIfNotExist(mContext, R.raw.oldphone_mono, basePath + "/oldphone_mono.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.rootca, basePath + "/rootca.pem");
|
||||
}
|
||||
|
||||
|
||||
private void initLinphoneCoreValues(String basePath) {
|
||||
mLinphoneCore.setContext(mContext);
|
||||
mLinphoneCore.setRing(null);
|
||||
mLinphoneCore.setRootCA(basePath + "/rootca.pem");
|
||||
mLinphoneCore.setPlayFile(basePath + "/toy_mono.wav");
|
||||
mLinphoneCore.setChatDatabasePath(basePath + "/linphone-history.db");
|
||||
|
||||
|
||||
int availableCores = Runtime.getRuntime().availableProcessors();
|
||||
mLinphoneCore.setCpuCount(availableCores);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void authInfoRequested(LinphoneCore lc, String realm, String username) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -171,13 +169,13 @@ public class LinphoneMiniManager implements LinphoneCoreListener {
|
|||
@Override
|
||||
public void callStatsUpdated(LinphoneCore lc, LinphoneCall call,
|
||||
LinphoneCallStats stats) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void callEncryptionChanged(LinphoneCore lc, LinphoneCall call,
|
||||
boolean encrypted, String authenticationToken) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -189,18 +187,18 @@ public class LinphoneMiniManager implements LinphoneCoreListener {
|
|||
@Override
|
||||
public void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf,
|
||||
String url) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void textReceived(LinphoneCore lc, LinphoneChatRoom cr,
|
||||
LinphoneAddress from, String message) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -216,37 +214,37 @@ public class LinphoneMiniManager implements LinphoneCoreListener {
|
|||
|
||||
@Override
|
||||
public void dtmfReceived(LinphoneCore lc, LinphoneCall call, int dtmf) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ecCalibrationStatus(LinphoneCore lc, EcCalibratorStatus status,
|
||||
int delay_ms, Object data) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyReceived(LinphoneCore lc, LinphoneCall call,
|
||||
LinphoneAddress from, byte[] event) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transferState(LinphoneCore lc, LinphoneCall call,
|
||||
State new_call_state) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void infoReceived(LinphoneCore lc, LinphoneCall call,
|
||||
LinphoneInfoMessage info) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void subscriptionStateChanged(LinphoneCore lc, LinphoneEvent ev,
|
||||
SubscriptionState state) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -258,7 +256,7 @@ public class LinphoneMiniManager implements LinphoneCoreListener {
|
|||
@Override
|
||||
public void publishStateChanged(LinphoneCore lc, LinphoneEvent ev,
|
||||
PublishState state) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -269,22 +267,22 @@ public class LinphoneMiniManager implements LinphoneCoreListener {
|
|||
|
||||
@Override
|
||||
public void show(LinphoneCore lc) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayStatus(LinphoneCore lc, String message) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayMessage(LinphoneCore lc, String message) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayWarning(LinphoneCore lc, String message) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package org.linphone.mini;
|
||||
|
||||
/*
|
||||
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
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -25,19 +26,16 @@ import java.io.InputStream;
|
|||
|
||||
import android.content.Context;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class LinphoneMiniUtils {
|
||||
public static void copyIfNotExist(Context context, int ressourceId, String target) throws IOException {
|
||||
File lFileToCopy = new File(target);
|
||||
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 {
|
||||
FileOutputStream lOutputStream = context.openFileOutput (target, 0);
|
||||
FileOutputStream lOutputStream = context.openFileOutput (target, 0);
|
||||
InputStream lInputStream = context.getResources().openRawResource(ressourceId);
|
||||
int readByte;
|
||||
byte[] buff = new byte[8048];
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.linphone;
|
||||
/*
|
||||
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
|
||||
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.TextView;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class AboutFragment extends Fragment implements OnClickListener {
|
||||
View sendLogButton = null;
|
||||
View resetLogButton = null;
|
||||
|
@ -74,12 +71,12 @@ public class AboutFragment extends Fragment implements OnClickListener {
|
|||
resetLogButton = view.findViewById(R.id.reset_log);
|
||||
resetLogButton.setOnClickListener(this);
|
||||
resetLogButton.setVisibility(LinphonePreferences.instance().isDebugEnabled() ? View.VISIBLE : View.GONE);
|
||||
|
||||
|
||||
mListener = new LinphoneCoreListenerBase() {
|
||||
@Override
|
||||
public void uploadProgressIndication(LinphoneCore lc, int offset, int total) {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void uploadStateChanged(LinphoneCore lc, LogCollectionUploadState state, String info) {
|
||||
if (state == LogCollectionUploadState.LogCollectionUploadStateInProgress) {
|
||||
|
@ -96,13 +93,13 @@ public class AboutFragment extends Fragment implements OnClickListener {
|
|||
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
private void displayUploadLogsInProgress() {
|
||||
if (uploadInProgress) {
|
||||
return;
|
||||
}
|
||||
uploadInProgress = true;
|
||||
|
||||
|
||||
progress = ProgressDialog.show(LinphoneActivity.instance(), null, null);
|
||||
Drawable d = new ColorDrawable(ContextCompat.getColor(getActivity(), R.color.colorE));
|
||||
d.setAlpha(200);
|
||||
|
@ -134,7 +131,7 @@ public class AboutFragment extends Fragment implements OnClickListener {
|
|||
if (lc != null) {
|
||||
lc.removeListener(mListener);
|
||||
}
|
||||
|
||||
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
|
@ -144,11 +141,11 @@ public class AboutFragment extends Fragment implements OnClickListener {
|
|||
if (lc != null) {
|
||||
lc.addListener(mListener);
|
||||
}
|
||||
|
||||
|
||||
if (LinphoneActivity.isInstanciated()) {
|
||||
LinphoneActivity.instance().selectMenu(FragmentsAvailable.ABOUT);
|
||||
}
|
||||
|
||||
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
|
@ -169,7 +166,7 @@ public class AboutFragment extends Fragment implements OnClickListener {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package org.linphone;
|
||||
|
||||
/*
|
||||
RemoteProvisioningActivity.java
|
||||
Copyright (C) 2014 Belledonne Communications, Grenoble, France
|
||||
AccountEnableReceiver.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
|
||||
|
@ -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.
|
||||
*/
|
||||
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
* @author Graham Barnett
|
||||
*/
|
||||
public class AccountEnableReceiver extends BroadcastReceiver {
|
||||
private static final String TAG = "AccountEnableReceiver";
|
||||
private static final String FIELD_ID = "id";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.linphone;
|
||||
/*
|
||||
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
|
||||
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.EditText;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class AccountPreferencesFragment extends PreferencesListFragment implements LinphoneAccountCreator.LinphoneAccountCreatorListener {
|
||||
private int n;
|
||||
private boolean isNewAccount=false;
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.linphone;
|
||||
|
||||
/*
|
||||
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
|
||||
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
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
package org.linphone;
|
||||
|
||||
import org.linphone.core.LinphoneCallParams;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
|
@ -28,7 +29,7 @@ public class BandwidthManager {
|
|||
public static final int LOW_BANDWIDTH = 2;
|
||||
|
||||
private static BandwidthManager instance;
|
||||
|
||||
|
||||
private int currentProfile = HIGH_RESOLUTION;
|
||||
public int getCurrentProfile() {return currentProfile;}
|
||||
|
||||
|
@ -41,7 +42,7 @@ public class BandwidthManager {
|
|||
private BandwidthManager() {
|
||||
// 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 initially get those values
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.linphone;
|
||||
/*
|
||||
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
|
||||
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
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.linphone.mediastream.Log;
|
||||
|
@ -34,9 +35,6 @@ import android.content.IntentFilter;
|
|||
import android.media.AudioManager;
|
||||
import android.os.Build;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||
public class BluetoothManager extends BroadcastReceiver {
|
||||
public int PLANTRONICS_BUTTON_PRESS = 1;
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.linphone;
|
||||
|
||||
/*
|
||||
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
|
||||
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
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
package org.linphone;
|
||||
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
import org.linphone.core.LpConfig;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package org.linphone;
|
||||
|
||||
/*
|
||||
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
|
||||
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
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
|
@ -84,9 +86,6 @@ import java.util.List;
|
|||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class CallActivity extends LinphoneGenericActivity implements OnClickListener, ActivityCompat.OnRequestPermissionsResultCallback {
|
||||
private final static int SECONDS_BEFORE_HIDING_CONTROLS = 4000;
|
||||
private final static int SECONDS_BEFORE_DENYING_CALL_UPDATE = 30000;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package org.linphone;
|
||||
|
||||
/*
|
||||
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
|
||||
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.ViewGroup;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class CallAudioFragment extends Fragment {
|
||||
private CallActivity incallActvityInstance;
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.linphone;
|
||||
|
||||
/*
|
||||
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
|
||||
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
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
package org.linphone;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.pm.ActivityInfo;
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.linphone;
|
||||
|
||||
/*
|
||||
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
|
||||
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
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
package org.linphone;
|
||||
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
import org.linphone.core.LinphoneCall;
|
||||
|
@ -28,30 +29,27 @@ import org.linphone.mediastream.Log;
|
|||
|
||||
/**
|
||||
* Handle call updating, reinvites.
|
||||
*
|
||||
* @author Guillaume Beraudo
|
||||
*
|
||||
*/
|
||||
public class CallManager {
|
||||
|
||||
private static CallManager instance;
|
||||
|
||||
|
||||
private CallManager() {}
|
||||
public static final synchronized CallManager getInstance() {
|
||||
if (instance == null) instance = new CallManager();
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
||||
private BandwidthManager bm() {
|
||||
return BandwidthManager.getInstance();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void inviteAddress(LinphoneAddress lAddress, boolean videoEnabled, boolean lowBandwidth) throws LinphoneCoreException {
|
||||
LinphoneCore lc = LinphoneManager.getLc();
|
||||
|
||||
|
||||
LinphoneCallParams params = lc.createCallParams(null);
|
||||
bm().updateWithProfileSettings(lc, params);
|
||||
|
||||
|
@ -60,7 +58,7 @@ public class CallManager {
|
|||
} else {
|
||||
params.setVideoEnabled(false);
|
||||
}
|
||||
|
||||
|
||||
if (lowBandwidth) {
|
||||
params.enableLowBandwidth(true);
|
||||
Log.d("Low bandwidth enabled in call params");
|
||||
|
@ -71,7 +69,7 @@ public class CallManager {
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Add video to a currently running voice only call.
|
||||
* No re-invite is sent if the current call is already video
|
||||
|
@ -88,7 +86,7 @@ public class CallManager {
|
|||
LinphoneCallParams params = lc.createCallParams(lCall);
|
||||
|
||||
if (params.getVideoEnabled()) return false;
|
||||
|
||||
|
||||
|
||||
// Check if video possible regarding bandwidth limitations
|
||||
bm().updateWithProfileSettings(lc, params);
|
||||
|
@ -104,7 +102,7 @@ public class CallManager {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Re-invite with parameters updated from profile.
|
||||
*/
|
||||
|
@ -136,5 +134,5 @@ public class CallManager {
|
|||
bm().updateWithProfileSettings(lc, params);
|
||||
lc.updateCall(lCall, null);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.linphone;
|
||||
|
||||
/*
|
||||
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
|
||||
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
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
package org.linphone;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package org.linphone;
|
||||
|
||||
/*
|
||||
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
|
||||
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
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import org.linphone.compatibility.Compatibility;
|
||||
import org.linphone.compatibility.CompatibilityScaleGestureDetector;
|
||||
import org.linphone.compatibility.CompatibilityScaleGestureListener;
|
||||
|
@ -39,9 +41,6 @@ import android.view.View.OnTouchListener;
|
|||
import android.view.ViewGroup;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class CallVideoFragment extends Fragment implements OnGestureListener, OnDoubleTapListener, CompatibilityScaleGestureListener {
|
||||
private SurfaceView mVideoView;
|
||||
private SurfaceView mCaptureView;
|
||||
|
@ -52,24 +51,24 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
|
|||
private CompatibilityScaleGestureDetector mScaleDetector;
|
||||
private CallActivity inCallActivity;
|
||||
private int previewX, previewY;
|
||||
|
||||
|
||||
@SuppressWarnings("deprecation") // Warning useless because value is ignored and automatically set by new APIs.
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View view;
|
||||
if (LinphoneManager.getLc().hasCrappyOpenGL()) {
|
||||
view = inflater.inflate(R.layout.video_no_opengl, container, false);
|
||||
} else {
|
||||
view = inflater.inflate(R.layout.video, container, false);
|
||||
}
|
||||
|
||||
|
||||
mVideoView = (SurfaceView) view.findViewById(R.id.videoSurface);
|
||||
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.
|
||||
|
||||
fixZOrder(mVideoView, mCaptureView);
|
||||
|
||||
|
||||
androidVideoWindowImpl = new AndroidVideoWindowImpl(mVideoView, mCaptureView, new AndroidVideoWindowImpl.VideoWindowListener() {
|
||||
public void onVideoRenderingSurfaceReady(AndroidVideoWindowImpl vw, SurfaceView surface) {
|
||||
mVideoView = surface;
|
||||
|
@ -77,7 +76,7 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
|
|||
}
|
||||
|
||||
public void onVideoRenderingSurfaceDestroyed(AndroidVideoWindowImpl vw) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void onVideoPreviewSurfaceReady(AndroidVideoWindowImpl vw, SurfaceView surface) {
|
||||
|
@ -86,16 +85,16 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
|
|||
}
|
||||
|
||||
public void onVideoPreviewSurfaceDestroyed(AndroidVideoWindowImpl vw) {
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
mVideoView.setOnTouchListener(new OnTouchListener() {
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
if (mScaleDetector != null) {
|
||||
mScaleDetector.onTouchEvent(event);
|
||||
}
|
||||
|
||||
|
||||
mGestureDetector.onTouchEvent(event);
|
||||
if (inCallActivity != null) {
|
||||
inCallActivity.displayVideoCallControlsIfHidden();
|
||||
|
@ -103,7 +102,7 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
|
|||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
mCaptureView.setOnTouchListener(new OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View view, MotionEvent motionEvent) {
|
||||
|
@ -130,7 +129,7 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
|
|||
});
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
|
@ -145,14 +144,14 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
|
|||
preview.setZOrderOnTop(true);
|
||||
preview.setZOrderMediaOverlay(true); // Needed to be able to display control layout over
|
||||
}
|
||||
|
||||
|
||||
public void switchCamera() {
|
||||
try {
|
||||
int videoDeviceId = LinphoneManager.getLc().getVideoDevice();
|
||||
videoDeviceId = (videoDeviceId + 1) % AndroidCameraConfiguration.retrieveCameras().length;
|
||||
LinphoneManager.getLc().setVideoDevice(videoDeviceId);
|
||||
CallManager.getInstance().updateCall();
|
||||
|
||||
|
||||
// previous call will cause graph reconstruction -> regive preview
|
||||
// window
|
||||
if (mCaptureView != null) {
|
||||
|
@ -162,11 +161,11 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
|
|||
Log.e("Cannot swtich camera : no camera");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
|
||||
if (LinphonePreferences.instance().isOverlayEnabled()) {
|
||||
LinphoneService.instance().destroyOverlay();
|
||||
}
|
||||
|
@ -175,13 +174,13 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
|
|||
LinphoneManager.getLc().setVideoWindow(androidVideoWindowImpl);
|
||||
}
|
||||
}
|
||||
|
||||
mGestureDetector = new GestureDetector(inCallActivity, this);
|
||||
|
||||
mGestureDetector = new GestureDetector(inCallActivity, this);
|
||||
mScaleDetector = Compatibility.getScaleGestureDetector(inCallActivity, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
public void onPause() {
|
||||
if (androidVideoWindowImpl != null) {
|
||||
synchronized (androidVideoWindowImpl) {
|
||||
/*
|
||||
|
@ -194,10 +193,10 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
|
|||
if (LinphonePreferences.instance().isOverlayEnabled()) {
|
||||
LinphoneService.instance().createOverlay();
|
||||
}
|
||||
|
||||
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
|
||||
public boolean onScale(CompatibilityScaleGestureDetector detector) {
|
||||
mZoomFactor *= detector.getScaleFactor();
|
||||
// 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) {
|
||||
mZoomCenterY -= 0.01;
|
||||
}
|
||||
|
||||
|
||||
if (mZoomCenterX > 1)
|
||||
mZoomCenterX = 1;
|
||||
if (mZoomCenterX < 0)
|
||||
|
@ -239,12 +238,12 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
|
|||
mZoomCenterY = 1;
|
||||
if (mZoomCenterY < 0)
|
||||
mZoomCenterY = 0;
|
||||
|
||||
|
||||
LinphoneManager.getLc().getCurrentCall().zoomVideo(mZoomFactor, mZoomCenterX, mZoomCenterY);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -256,17 +255,17 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
|
|||
float portraitZoomFactor = ((float) mVideoView.getHeight()) / (float) ((3 * mVideoView.getWidth()) / 4);
|
||||
// Zoom to make the video fill the screen horizontally
|
||||
float landscapeZoomFactor = ((float) mVideoView.getWidth()) / (float) ((3 * mVideoView.getHeight()) / 4);
|
||||
|
||||
|
||||
mZoomFactor = Math.max(portraitZoomFactor, landscapeZoomFactor);
|
||||
}
|
||||
else {
|
||||
resetZoom();
|
||||
}
|
||||
|
||||
|
||||
LinphoneManager.getLc().getCurrentCall().zoomVideo(mZoomFactor, mZoomCenterX, mZoomCenterY);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -274,17 +273,17 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
|
|||
mZoomFactor = 1.f;
|
||||
mZoomCenterX = mZoomCenterY = 0.5f;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
inCallActivity = null;
|
||||
|
||||
|
||||
mCaptureView = null;
|
||||
if (mVideoView != null) {
|
||||
mVideoView.setOnTouchListener(null);
|
||||
mVideoView = null;
|
||||
}
|
||||
if (androidVideoWindowImpl != null) {
|
||||
if (androidVideoWindowImpl != null) {
|
||||
// Prevent linphone from crashing if correspondent hang up while you are rotating
|
||||
androidVideoWindowImpl.release();
|
||||
androidVideoWindowImpl = null;
|
||||
|
@ -297,10 +296,10 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
|
|||
mScaleDetector.destroy();
|
||||
mScaleDetector = null;
|
||||
}
|
||||
|
||||
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onDown(MotionEvent e) {
|
||||
return true; // Needed to make the GestureDetector working
|
||||
|
@ -324,12 +323,12 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
|
|||
|
||||
@Override
|
||||
public void onLongPress(MotionEvent e) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShowPress(MotionEvent e) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package org.linphone;
|
||||
|
||||
/*
|
||||
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
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package org.linphone;
|
||||
|
||||
/*
|
||||
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
|
||||
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
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.app.Fragment;
|
||||
import android.graphics.Typeface;
|
||||
|
@ -54,9 +56,6 @@ import java.util.List;
|
|||
|
||||
import static org.linphone.FragmentsAvailable.CHAT_LIST;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class ChatListFragment extends Fragment implements OnClickListener, OnItemClickListener, ContactsUpdatedListener, ChatUpdatedListener {
|
||||
private LayoutInflater mInflater;
|
||||
private List<String> mConversations;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package org.linphone;
|
||||
|
||||
/*
|
||||
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
|
||||
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
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import org.linphone.core.LinphoneProxyConfig;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
|
@ -32,9 +34,6 @@ import android.widget.ImageView;
|
|||
import android.widget.TableLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class ContactDetailsFragment extends Fragment implements OnClickListener {
|
||||
private LinphoneContact contact;
|
||||
private ImageView editContact, deleteContact, back;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package org.linphone;
|
||||
|
||||
/*
|
||||
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
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.linphone;
|
||||
|
||||
/*
|
||||
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
|
||||
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.
|
||||
*/
|
||||
|
||||
package org.linphone;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.app.Fragment;
|
||||
|
@ -51,9 +52,6 @@ import java.util.Map;
|
|||
|
||||
import static org.linphone.FragmentsAvailable.CONTACTS_LIST;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class ContactsListFragment extends Fragment implements OnClickListener, OnItemClickListener, ContactsUpdatedListener {
|
||||
private LayoutInflater mInflater;
|
||||
private ListView contactsList;
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.linphone;
|
||||
|
||||
/*
|
||||
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
|
||||
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.
|
||||
*/
|
||||
|
||||
package org.linphone;
|
||||
|
||||
import android.accounts.Account;
|
||||
import android.accounts.AccountManager;
|
||||
import android.content.ContentProviderOperation;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package org.linphone;
|
||||
|
||||
/*
|
||||
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
|
||||
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
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
|
@ -36,9 +38,6 @@ import org.linphone.ui.AddressText;
|
|||
import org.linphone.ui.CallButton;
|
||||
import org.linphone.ui.EraseButton;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class DialerFragment extends Fragment {
|
||||
private static DialerFragment instance;
|
||||
private static boolean isCallTransferOngoing = false;
|
||||
|
|
|
@ -1,5 +1,24 @@
|
|||
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.LinphoneCoreFactory;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package org.linphone;
|
||||
|
||||
/*
|
||||
AboutFragment.java
|
||||
Copyright (C) 2012 Belledonne Communications, Grenoble, France
|
||||
EmptyFragment.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
|
||||
|
@ -24,9 +25,6 @@ import android.view.LayoutInflater;
|
|||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class EmptyFragment extends Fragment {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package org.linphone;
|
||||
|
||||
/*
|
||||
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
|
||||
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
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
|
||||
public enum FragmentsAvailable {
|
||||
UNKNOW,
|
||||
DIALER,
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package org.linphone;
|
||||
|
||||
/*
|
||||
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
|
||||
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
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
|
@ -32,9 +34,6 @@ import org.linphone.core.LinphoneCoreException;
|
|||
import org.linphone.core.LinphoneCoreFactory;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class HistoryDetailFragment extends Fragment implements OnClickListener {
|
||||
private ImageView dialBack, chat, addToContacts, goToContact, back;
|
||||
private View view;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package org.linphone;
|
||||
|
||||
/*
|
||||
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
|
||||
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
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
@ -52,9 +54,6 @@ import android.widget.TextView;
|
|||
|
||||
import static org.linphone.FragmentsAvailable.HISTORY_LIST;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class HistoryListFragment extends Fragment implements OnClickListener, OnItemClickListener, ContactsUpdatedListener {
|
||||
private ListView historyList;
|
||||
private LayoutInflater mInflater;
|
||||
|
|
|
@ -1,5 +1,24 @@
|
|||
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.Context;
|
||||
import android.content.Intent;
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.linphone;
|
||||
|
||||
/*
|
||||
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
|
||||
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
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
package org.linphone;
|
||||
|
||||
import org.linphone.compatibility.Compatibility;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.linphone;
|
|||
|
||||
/*
|
||||
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
|
||||
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;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class LinphoneActivity extends LinphoneGenericActivity implements OnClickListener, ContactPicked, ActivityCompat.OnRequestPermissionsResultCallback {
|
||||
public static final String PREF_FIRST_LAUNCH = "pref_first_launch";
|
||||
private static final int SETTINGS_ACTIVITY = 123;
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.linphone;
|
||||
|
||||
/*
|
||||
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
|
||||
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
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
package org.linphone;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
@ -44,9 +45,6 @@ import android.provider.ContactsContract;
|
|||
import android.provider.ContactsContract.CommonDataKinds;
|
||||
|
||||
public class LinphoneContact implements Serializable, Comparable<LinphoneContact> {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 9015568163905205244L;
|
||||
|
||||
private transient LinphoneFriend friend;
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.linphone;
|
||||
|
||||
/*
|
||||
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
|
||||
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
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
package org.linphone;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class LinphoneException extends Exception {
|
||||
|
|
|
@ -1,5 +1,24 @@
|
|||
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.os.Bundle;
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.linphone;
|
||||
|
||||
/*
|
||||
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
|
||||
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
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
package org.linphone;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
|
@ -33,11 +34,7 @@ import org.linphone.tutorials.TutorialLauncherActivity;
|
|||
import static android.content.Intent.ACTION_MAIN;
|
||||
|
||||
/**
|
||||
*
|
||||
* Launch Linphone main activity when Service is ready.
|
||||
*
|
||||
* @author Guillaume Beraudo
|
||||
*
|
||||
*/
|
||||
public class LinphoneLauncherActivity extends Activity {
|
||||
|
||||
|
|
|
@ -18,6 +18,25 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
*/
|
||||
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.TargetApi;
|
||||
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.
|
||||
*
|
||||
* @author Guillaume Beraudo
|
||||
*
|
||||
*/
|
||||
public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessage.LinphoneChatMessageListener, SensorEventListener, LinphoneAccountCreator.LinphoneAccountCreatorListener {
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.linphone;
|
||||
|
||||
/*
|
||||
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
|
||||
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.
|
||||
*/
|
||||
|
||||
package org.linphone;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class LinphoneNumberOrAddress implements Serializable, Comparable<LinphoneNumberOrAddress> {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -2301689469730072896L;
|
||||
|
||||
|
||||
private boolean isSIPAddress;
|
||||
private String value, oldValueForUpdatePurpose;
|
||||
|
||||
|
||||
public LinphoneNumberOrAddress(String v, boolean isSIP) {
|
||||
value = v;
|
||||
isSIPAddress = isSIP;
|
||||
oldValueForUpdatePurpose = null;
|
||||
}
|
||||
|
||||
|
||||
public LinphoneNumberOrAddress(String v, boolean isSip, String old) {
|
||||
this(v, isSip);
|
||||
oldValueForUpdatePurpose = old;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int compareTo(LinphoneNumberOrAddress noa) {
|
||||
if (noa.isSIPAddress() == isSIPAddress()) {
|
||||
|
@ -53,7 +50,7 @@ public class LinphoneNumberOrAddress implements Serializable, Comparable<Linphon
|
|||
public boolean isSIPAddress() {
|
||||
return isSIPAddress;
|
||||
}
|
||||
|
||||
|
||||
public String getOldValue() {
|
||||
return oldValueForUpdatePurpose;
|
||||
}
|
||||
|
@ -61,11 +58,11 @@ public class LinphoneNumberOrAddress implements Serializable, Comparable<Linphon
|
|||
public void setOldValue(String v) {
|
||||
oldValueForUpdatePurpose = v;
|
||||
}
|
||||
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
public void setValue(String v) {
|
||||
value = v;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.linphone;
|
|||
|
||||
/*
|
||||
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
|
||||
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.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class LinphonePreferences {
|
||||
private static final int LINPHONE_CORE_RANDOM_PORT = -1;
|
||||
private static LinphonePreferences instance;
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.linphone;
|
||||
|
||||
/*
|
||||
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
|
||||
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
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
package org.linphone;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
@ -63,7 +64,6 @@ import android.provider.MediaStore;
|
|||
import android.view.WindowManager;
|
||||
|
||||
/**
|
||||
*
|
||||
* Linphone service, reacting to Incoming calls, ...<br />
|
||||
*
|
||||
* Roles include:<ul>
|
||||
|
@ -71,10 +71,6 @@ import android.view.WindowManager;
|
|||
* <li>Starting C libLinphone through LinphoneManager</li>
|
||||
* <li>Reacting to LinphoneManager state changes</li>
|
||||
* <li>Delegating GUI state change actions to GUI listener</li>
|
||||
*
|
||||
*
|
||||
* @author Guillaume Beraudo
|
||||
*
|
||||
*/
|
||||
public final class LinphoneService extends Service {
|
||||
/* Listener needs to be implemented in the Service as it calls
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.linphone;
|
||||
|
||||
/*
|
||||
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
|
||||
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
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
package org.linphone;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
|
@ -93,8 +94,6 @@ import static android.view.View.VISIBLE;
|
|||
|
||||
/**
|
||||
* Helpers.
|
||||
* @author Guillaume Beraudo
|
||||
*
|
||||
*/
|
||||
public final class LinphoneUtils {
|
||||
private static Context context = null;
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.linphone;
|
||||
|
||||
/*
|
||||
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
|
||||
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
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
package org.linphone;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.ConnectivityManager;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Intercept network state changes and update linphone core through LinphoneManager.
|
||||
*
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,23 @@
|
|||
package org.linphone;
|
||||
|
||||
/*
|
||||
OutgoingCallReceiver.java
|
||||
Copyright (C) 2017 Belledonne Communications, Grenoble, France
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.linphone;
|
||||
|
||||
/*
|
||||
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
|
||||
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
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
package org.linphone;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
|
@ -25,9 +26,6 @@ import android.telephony.TelephonyManager;
|
|||
|
||||
/**
|
||||
* Pause current SIP calls when GSM phone rings or is active.
|
||||
*
|
||||
* @author Guillaume Beraudo
|
||||
*
|
||||
*/
|
||||
public class PhoneStateChangedReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.linphone;
|
|||
|
||||
/*
|
||||
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
|
||||
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.preference.PreferenceManager;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class PreferencesMigrator {
|
||||
private LinphonePreferences mNewPrefs;
|
||||
private SharedPreferences mOldPrefs;
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.linphone;
|
|||
|
||||
/*
|
||||
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
|
||||
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.provider.Settings;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class SettingsFragment extends PreferencesListFragment {
|
||||
private LinphonePreferences mPrefs;
|
||||
private Handler mHandler = new Handler();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.linphone;
|
||||
/*
|
||||
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
|
||||
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.TextView;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class StatusFragment extends Fragment {
|
||||
private Handler refreshHandler = new Handler();
|
||||
private TextView statusText, voicemailCount;
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.linphone;
|
||||
|
||||
/*
|
||||
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
|
||||
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
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
package org.linphone;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
|
||||
public class UIThreadDispatcher {
|
||||
private static Handler mHandler = new Handler(Looper.getMainLooper());
|
||||
|
||||
|
||||
public static void dispatch(Runnable r) {
|
||||
mHandler.post(r);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.linphone.assistant;
|
||||
/*
|
||||
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
|
||||
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.Toast;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class AssistantActivity extends Activity implements OnClickListener, ActivityCompat.OnRequestPermissionsResultCallback, LinphoneAccountCreator.LinphoneAccountCreatorListener {
|
||||
private static AssistantActivity instance;
|
||||
private ImageView back, cancel;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.linphone.assistant;
|
||||
/*
|
||||
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
|
||||
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
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
|
||||
public enum AssistantFragmentsEnum {
|
||||
WELCOME,
|
||||
CREATE_ACCOUNT,
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.linphone.assistant;
|
|||
|
||||
/*
|
||||
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
|
||||
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.TextView;
|
||||
|
||||
/**
|
||||
* @author Erwan CROZE
|
||||
*/
|
||||
public class CodecDownloaderFragment extends Fragment {
|
||||
private Handler mHandler = new Handler();
|
||||
private TextView question;
|
||||
|
|
|
@ -1,5 +1,24 @@
|
|||
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.core.DialPlan;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.linphone.assistant;
|
||||
/*
|
||||
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
|
||||
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.LinphoneAccountCreatorListener;
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
|
||||
public class CreateAccountActivationFragment extends Fragment implements OnClickListener, LinphoneAccountCreatorListener {
|
||||
private String username, password;
|
||||
private Button checkAccount;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.linphone.assistant;
|
||||
/*
|
||||
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
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.linphone.assistant;
|
||||
/*
|
||||
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
|
||||
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.TextView;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class CreateAccountFragment extends Fragment implements CompoundButton.OnCheckedChangeListener
|
||||
, OnClickListener, LinphoneAccountCreatorListener {
|
||||
private EditText phoneNumberEdit, usernameEdit, passwordEdit, passwordConfirmEdit
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.linphone.assistant;
|
|||
|
||||
/*
|
||||
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
|
||||
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.ViewGroup;
|
||||
|
||||
/**
|
||||
* @author Ghislain MARY
|
||||
*/
|
||||
public class EchoCancellerCalibrationFragment extends Fragment implements LinphoneXmlRpcRequestListener {
|
||||
private Handler mHandler = new Handler();
|
||||
private boolean mSendEcCalibrationResult = false;
|
||||
|
@ -56,7 +53,7 @@ public class EchoCancellerCalibrationFragment extends Fragment implements Linpho
|
|||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.assistant_ec_calibration, container, false);
|
||||
|
||||
|
||||
mListener = new LinphoneCoreListenerBase(){
|
||||
@Override
|
||||
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();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
xmlRpcSession = new LinphoneXmlRpcSessionImpl(LinphoneManager.getLcIfManagerNotDestroyedOrNull(), LinphonePreferences.instance().getXmlrpcUrl());
|
||||
xmlRpcRequest = new LinphoneXmlRpcRequestImpl("add_ec_calibration_result", LinphoneXmlRpcRequest.ArgType.None);
|
||||
xmlRpcRequest.setListener(this);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.linphone.assistant;
|
||||
/*
|
||||
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
|
||||
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.TextView;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class LinphoneLoginFragment extends Fragment implements CompoundButton.OnCheckedChangeListener, OnClickListener, TextWatcher, LinphoneAccountCreator.LinphoneAccountCreatorListener {
|
||||
private EditText login, password, phoneNumberEdit, dialCode;
|
||||
private Button apply, selectCountry;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.linphone.assistant;
|
||||
/*
|
||||
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
|
||||
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.RadioGroup;
|
||||
import android.widget.Toast;
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
|
||||
public class LoginFragment extends Fragment implements OnClickListener, TextWatcher {
|
||||
private EditText login, userid, password, domain;
|
||||
private RadioGroup transports;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.linphone.assistant;
|
||||
/*
|
||||
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
|
||||
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.Toast;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class RemoteProvisioningActivity extends Activity {
|
||||
private Handler mHandler = new Handler();
|
||||
private String configUriParam = null;
|
||||
private ProgressBar spinner;
|
||||
private LinphoneCoreListenerBase mListener;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.remote_provisioning);
|
||||
spinner = (ProgressBar) findViewById(R.id.spinner);
|
||||
|
||||
|
||||
mListener = new LinphoneCoreListenerBase(){
|
||||
@Override
|
||||
public void configuringStatus(LinphoneCore lc, final RemoteProvisioningState state, String message) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.linphone.assistant;
|
||||
/*
|
||||
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
|
||||
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{
|
||||
private EditText remoteProvisioningUrl;
|
||||
private Button apply;
|
||||
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.assistant_remote_provisioning, container, false);
|
||||
|
||||
|
||||
remoteProvisioningUrl = (EditText) view.findViewById(R.id.assistant_remote_provisioning_url);
|
||||
remoteProvisioningUrl.addTextChangedListener(this);
|
||||
apply = (Button) view.findViewById(R.id.assistant_apply);
|
||||
apply.setEnabled(false);
|
||||
apply.setOnClickListener(this);
|
||||
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int id = v.getId();
|
||||
|
||||
|
||||
if (id == R.id.assistant_apply) {
|
||||
String url = remoteProvisioningUrl.getText().toString();
|
||||
AssistantActivity.instance().displayRemoteProvisioningInProgressDialog();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.linphone.assistant;
|
||||
/*
|
||||
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
|
||||
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.Toast;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class RemoteProvisioningLoginActivity extends Activity implements OnClickListener {
|
||||
private EditText login, password, domain;
|
||||
private Button connect;
|
||||
|
@ -46,7 +43,7 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick
|
|||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.assistant_remote_provisioning_login);
|
||||
|
||||
|
||||
login = (EditText) findViewById(R.id.assistant_username);
|
||||
password = (EditText) findViewById(R.id.assistant_password);
|
||||
domain = (EditText) findViewById(R.id.assistant_domain);
|
||||
|
@ -71,7 +68,7 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
private void cancelWizard(boolean bypassCheck) {
|
||||
if (bypassCheck || getResources().getBoolean(R.bool.allow_cancel_remote_provisioning_login_activity)) {
|
||||
LinphonePreferences.instance().disableProvisioningLoginView();
|
||||
|
@ -79,7 +76,7 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick
|
|||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private boolean storeAccount(String username, String password, String domain) {
|
||||
XmlRpcHelper xmlRpcHelper = new XmlRpcHelper();
|
||||
xmlRpcHelper.getRemoteProvisioningFilenameAsync(new XmlRpcListenerBase() {
|
||||
|
@ -102,10 +99,10 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick
|
|||
Log.e(e);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
LinphoneAuthInfo authInfo = LinphoneCoreFactory.instance().createAuthInfo(username, null, password, null, null, domain);
|
||||
lc.addAuthInfo(authInfo);
|
||||
|
||||
|
||||
if (LinphonePreferences.instance().getAccountCount() == 1)
|
||||
lc.setDefaultProxyConfig(prxCfg);
|
||||
*/
|
||||
|
@ -133,7 +130,7 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
int id = v.getId();
|
||||
|
||||
|
||||
if (id == R.id.cancel) {
|
||||
cancelWizard(false);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.linphone.assistant;
|
||||
/*
|
||||
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
|
||||
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.widget.Button;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class WelcomeFragment extends Fragment implements OnClickListener {
|
||||
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
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
|
||||
@TargetApi(11)
|
||||
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
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
|
||||
@TargetApi(19)
|
||||
public class ApiNineteenPlus {
|
||||
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
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
|
||||
@TargetApi(16)
|
||||
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
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
|
||||
@TargetApi(21)
|
||||
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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @author Erwan Croze
|
||||
*/
|
||||
@TargetApi(26)
|
||||
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
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
|
||||
@TargetApi(23)
|
||||
public class ApiTwentyThreePlus {
|
||||
public static void setTextAppearance(TextView textview, int style) {
|
||||
|
|
|
@ -32,9 +32,7 @@ import android.text.Spanned;
|
|||
import android.view.ViewTreeObserver;
|
||||
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
|
||||
import android.widget.TextView;
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
|
||||
public class Compatibility {
|
||||
public static void CreateChannel(Context context) {
|
||||
if (Version.sdkAboveOrEqual(Version.API26_O_80)) {
|
||||
|
|
|
@ -1,5 +1,24 @@
|
|||
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.content.Context;
|
||||
import android.view.MotionEvent;
|
||||
|
@ -9,32 +28,32 @@ import android.view.ScaleGestureDetector;
|
|||
public class CompatibilityScaleGestureDetector extends ScaleGestureDetector.SimpleOnScaleGestureListener {
|
||||
private ScaleGestureDetector detector;
|
||||
private CompatibilityScaleGestureListener listener;
|
||||
|
||||
|
||||
public CompatibilityScaleGestureDetector(Context context) {
|
||||
detector = new ScaleGestureDetector(context, this);
|
||||
}
|
||||
|
||||
|
||||
public void setOnScaleListener(CompatibilityScaleGestureListener newListener) {
|
||||
listener = newListener;
|
||||
}
|
||||
|
||||
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
return detector.onTouchEvent(event);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onScale(ScaleGestureDetector detector) {
|
||||
if (listener == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return listener.onScale(this);
|
||||
}
|
||||
|
||||
|
||||
public float getScaleFactor() {
|
||||
return detector.getScaleFactor();
|
||||
}
|
||||
|
||||
|
||||
public void destroy() {
|
||||
listener = null;
|
||||
detector = null;
|
||||
|
|
|
@ -1,5 +1,23 @@
|
|||
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 boolean onScale(CompatibilityScaleGestureDetector detector);
|
||||
|
|
|
@ -25,9 +25,7 @@ import com.google.firebase.iid.FirebaseInstanceIdService;
|
|||
import org.linphone.LinphonePreferences;
|
||||
import org.linphone.UIThreadDispatcher;
|
||||
|
||||
/**
|
||||
* @author Erwan Croze
|
||||
*/
|
||||
|
||||
public class FirebaseIdService extends FirebaseInstanceIdService {
|
||||
@Override
|
||||
public void onTokenRefresh() {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
package org.linphone.firebase;
|
||||
|
||||
/*
|
||||
FirebaseMessaging.java
|
||||
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.
|
||||
*/
|
||||
|
||||
package org.linphone.firebase;
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
import com.google.firebase.messaging.FirebaseMessagingService;
|
||||
|
@ -29,9 +29,7 @@ import org.linphone.LinphoneService;
|
|||
import org.linphone.UIThreadDispatcher;
|
||||
import static android.content.Intent.ACTION_MAIN;
|
||||
|
||||
/**
|
||||
* @author Erwan Croze
|
||||
*/
|
||||
|
||||
public class FirebaseMessaging extends FirebaseMessagingService {
|
||||
public FirebaseMessaging() {
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.linphone.gcm;
|
||||
/*
|
||||
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
|
||||
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;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
|
||||
public class GCMReceiver extends GCMBroadcastReceiver {
|
||||
@Override
|
||||
protected String getGCMIntentServiceClassName(Context context) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.linphone.gcm;
|
||||
/*
|
||||
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
|
||||
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;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
// Warning ! Do not rename the service !
|
||||
public class GCMService extends GCMBaseIntentService {
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.linphone.purchase;
|
||||
/*
|
||||
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
|
||||
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.Toast;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class InAppPurchaseActivity extends Activity implements InAppPurchaseListener, OnClickListener {
|
||||
private static InAppPurchaseActivity instance;
|
||||
private InAppPurchaseHelper inAppPurchaseHelper;
|
||||
|
@ -128,12 +125,12 @@ public class InAppPurchaseActivity extends Activity implements InAppPurchaseList
|
|||
public static InAppPurchaseActivity instance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onServiceAvailableForQueries() {
|
||||
//email.setText(inAppPurchaseHelper.getGmailAccount());
|
||||
//email.setEnabled(false);
|
||||
|
||||
|
||||
//inAppPurchaseHelper.getPurchasedItemsAsync();
|
||||
inAppPurchaseHelper.getAvailableItemsForPurchaseAsync();
|
||||
}
|
||||
|
@ -189,7 +186,7 @@ public class InAppPurchaseActivity extends Activity implements InAppPurchaseList
|
|||
onBackPressed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
inAppPurchaseHelper.parseAndVerifyPurchaseItemResultAsync(requestCode, resultCode, data);
|
||||
|
@ -206,7 +203,7 @@ public class InAppPurchaseActivity extends Activity implements InAppPurchaseList
|
|||
@Override
|
||||
public void run() {
|
||||
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;
|
||||
/*
|
||||
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
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -50,7 +50,7 @@ public class InAppPurchaseFragment extends Fragment implements View.OnClickListe
|
|||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
View view = inflater.inflate(R.layout.in_app_store, container, false);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.linphone.purchase;
|
||||
/*
|
||||
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
|
||||
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;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class InAppPurchaseHelper {
|
||||
public static final int API_VERSION = 3;
|
||||
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_LIST = "DETAILS_LIST";
|
||||
public static final String SKU_DETAILS_PRODUCT_ID = "productId";
|
||||
public static final String SKU_DETAILS_PRICE = "price";
|
||||
public static final String SKU_DETAILS_TITLE = "title";
|
||||
public static final String SKU_DETAILS_DESC = "description";
|
||||
|
||||
|
||||
public static final String ITEM_TYPE_INAPP = "inapp";
|
||||
public static final String ITEM_TYPE_SUBS = "subs";
|
||||
|
||||
|
||||
public static final int RESPONSE_RESULT_OK = 0;
|
||||
public static final int RESULT_USER_CANCELED = 1;
|
||||
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_ITEM_ALREADY_OWNED = 7;
|
||||
public static final int RESULT_ITEM_NOT_OWNED = 8;
|
||||
|
||||
|
||||
public static final String RESPONSE_CODE = "RESPONSE_CODE";
|
||||
public static final String RESPONSE_BUY_INTENT = "BUY_INTENT";
|
||||
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_SIGNATURE_LIST = "INAPP_DATA_SIGNATURE_LIST";
|
||||
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_ORDER_ID = "orderId";
|
||||
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_PAYLOAD = "developerPayload";
|
||||
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_BIND_TO_BILLING_SERVICE_FAILED = "BIND_TO_BILLING_SERVICE_FAILED";
|
||||
public static final String CLIENT_ERROR_BILLING_SERVICE_UNAVAILABLE = "BILLING_SERVICE_UNAVAILABLE";
|
||||
|
||||
|
||||
private Context mContext;
|
||||
private InAppPurchaseListener mListener;
|
||||
private IInAppBillingService mService;
|
||||
private ServiceConnection mServiceConn;
|
||||
private Handler mHandler = new Handler();
|
||||
private String mGmailAccount;
|
||||
|
||||
|
||||
private String responseCodeToErrorMessage(int responseCode) {
|
||||
switch (responseCode) {
|
||||
case RESULT_USER_CANCELED:
|
||||
|
@ -121,7 +118,7 @@ public class InAppPurchaseHelper {
|
|||
}
|
||||
return "UNKNOWN_RESPONSE_CODE";
|
||||
}
|
||||
|
||||
|
||||
public InAppPurchaseHelper(Activity context, InAppPurchaseListener listener) {
|
||||
mContext = context;
|
||||
mListener = listener;
|
||||
|
@ -169,13 +166,13 @@ public class InAppPurchaseHelper {
|
|||
mListener.onError(CLIENT_ERROR_BILLING_SERVICE_UNAVAILABLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private ArrayList<Purchasable> getAvailableItemsForPurchase() {
|
||||
ArrayList<Purchasable> products = new ArrayList<Purchasable>();
|
||||
ArrayList<String> skuList = LinphonePreferences.instance().getInAppPurchasables();
|
||||
Bundle querySkus = new Bundle();
|
||||
querySkus.putStringArrayList(SKU_DETAILS_ITEM_LIST, skuList);
|
||||
|
||||
|
||||
Bundle skuDetails = null;
|
||||
try {
|
||||
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 title = object.getString(SKU_DETAILS_TITLE);
|
||||
String desc = object.getString(SKU_DETAILS_DESC);
|
||||
|
||||
|
||||
Purchasable purchasable = new Purchasable(id).setTitle(title).setDescription(desc).setPrice(price);
|
||||
Log.w("Purchasable item " + purchasable.getDescription());
|
||||
products.add(purchasable);
|
||||
|
@ -207,10 +204,10 @@ public class InAppPurchaseHelper {
|
|||
mListener.onError(responseCodeToErrorMessage(response));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return products;
|
||||
}
|
||||
|
||||
|
||||
public void getAvailableItemsForPurchaseAsync() {
|
||||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
|
@ -225,11 +222,11 @@ public class InAppPurchaseHelper {
|
|||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
|
||||
public void getPurchasedItemsAsync() {
|
||||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
|
||||
|
||||
final ArrayList<Purchasable> items = new ArrayList<Purchasable>();
|
||||
String continuationToken = null;
|
||||
do {
|
||||
|
@ -239,19 +236,19 @@ public class InAppPurchaseHelper {
|
|||
} catch (RemoteException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
|
||||
|
||||
if (purchasedItems != null) {
|
||||
int response = purchasedItems.getInt(RESPONSE_CODE);
|
||||
if (response == RESPONSE_RESULT_OK) {
|
||||
ArrayList<String> purchaseDataList = purchasedItems.getStringArrayList(RESPONSE_INAPP_PURCHASE_DATA_LIST);
|
||||
ArrayList<String> signatureList = purchasedItems.getStringArrayList(RESPONSE_INAPP_SIGNATURE_LIST);
|
||||
continuationToken = purchasedItems.getString(RESPONSE_INAPP_CONTINUATION_TOKEN);
|
||||
|
||||
|
||||
for (int i = 0; i < purchaseDataList.size(); ++i) {
|
||||
String purchaseData = purchaseDataList.get(i);
|
||||
String signature = signatureList.get(i);
|
||||
Log.d("[In-app purchase] " + purchaseData);
|
||||
|
||||
|
||||
Purchasable item = verifySignature(purchaseData, signature);
|
||||
if (item != null) {
|
||||
items.add(item);
|
||||
|
@ -263,7 +260,7 @@ public class InAppPurchaseHelper {
|
|||
}
|
||||
}
|
||||
} while (continuationToken != null);
|
||||
|
||||
|
||||
if (mHandler != null && mListener != null) {
|
||||
mHandler.post(new Runnable() {
|
||||
public void run() {
|
||||
|
@ -274,7 +271,7 @@ public class InAppPurchaseHelper {
|
|||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
|
||||
public void parseAndVerifyPurchaseItemResultAsync(int requestCode, int resultCode, Intent data) {
|
||||
if (requestCode == ACTIVITY_RESULT_CODE_PURCHASE_ITEM) {
|
||||
int responseCode = data.getIntExtra(RESPONSE_CODE, 0);
|
||||
|
@ -286,7 +283,7 @@ public class InAppPurchaseHelper {
|
|||
Purchasable item = LinphonePreferences.instance().getInAppPurchasedItem();
|
||||
item.setPayloadAndSignature(payload, signature);
|
||||
LinphonePreferences.instance().setInAppPurchasedItem(item);
|
||||
|
||||
|
||||
XmlRpcHelper xmlRpcHelper = new XmlRpcHelper();
|
||||
xmlRpcHelper.verifySignatureAsync(new XmlRpcListenerBase() {
|
||||
@Override
|
||||
|
@ -297,7 +294,7 @@ public class InAppPurchaseHelper {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void purchaseItem(String productId, String sipIdentity) {
|
||||
Bundle buyIntentBundle = null;
|
||||
try {
|
||||
|
@ -305,7 +302,7 @@ public class InAppPurchaseHelper {
|
|||
} catch (RemoteException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
|
||||
|
||||
if (buyIntentBundle != null) {
|
||||
PendingIntent pendingIntent = buyIntentBundle.getParcelable(RESPONSE_BUY_INTENT);
|
||||
if (pendingIntent != null) {
|
||||
|
@ -317,7 +314,7 @@ public class InAppPurchaseHelper {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void purchaseItemAsync(final String productId, final String sipIdentity) {
|
||||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
|
@ -325,29 +322,29 @@ public class InAppPurchaseHelper {
|
|||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
|
||||
public void destroy() {
|
||||
mContext.unbindService(mServiceConn);
|
||||
}
|
||||
|
||||
|
||||
public String getGmailAccount() {
|
||||
Account[] accounts = AccountManager.get(mContext).getAccountsByType("com.google");
|
||||
|
||||
|
||||
for (Account account: accounts) {
|
||||
if (isEmailCorrect(account.name)) {
|
||||
String possibleEmail = account.name;
|
||||
return possibleEmail;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private boolean isEmailCorrect(String email) {
|
||||
Pattern emailPattern = Patterns.EMAIL_ADDRESS;
|
||||
return emailPattern.matcher(email).matches();
|
||||
}
|
||||
|
||||
|
||||
private Purchasable verifySignature(String payload, String signature) {
|
||||
// TODO FIXME rework to be async
|
||||
/*XmlRpcHelper helper = new XmlRpcHelper();
|
||||
|
@ -355,7 +352,7 @@ public class InAppPurchaseHelper {
|
|||
try {
|
||||
JSONObject json = new JSONObject(payload);
|
||||
String productId = json.getString(PURCHASE_DETAILS_PRODUCT_ID);
|
||||
Purchasable item = new Purchasable(productId);
|
||||
Purchasable item = new Purchasable(productId);
|
||||
item.setPayloadAndSignature(payload, signature);
|
||||
return item;
|
||||
} catch (JSONException e) {
|
||||
|
@ -364,7 +361,7 @@ public class InAppPurchaseHelper {
|
|||
}*/
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
interface VerifiedSignatureListener {
|
||||
void onParsedAndVerifiedSignatureQueryFinished(Purchasable item);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.linphone.purchase;
|
|||
|
||||
/*
|
||||
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
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.linphone.purchase;
|
||||
/*
|
||||
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
|
||||
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;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public interface InAppPurchaseListener {
|
||||
/**
|
||||
* Callback called when the in-app purchase listener is connected and available for queries
|
||||
*/
|
||||
void onServiceAvailableForQueries();
|
||||
|
||||
|
||||
/**
|
||||
* 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)
|
||||
*/
|
||||
void onAvailableItemsForPurchaseQueryFinished(ArrayList<Purchasable> items);
|
||||
|
||||
|
||||
/**
|
||||
* Callback called when the query for items bought by the user is done
|
||||
* @param items the list of items already purchased by the user
|
||||
*/
|
||||
void onPurchasedItemsQueryFinished(ArrayList<Purchasable> items);
|
||||
|
||||
|
||||
/**
|
||||
* Callback called when the purchase has been validated by our external server
|
||||
* @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
|
||||
*/
|
||||
void onRecoverAccountSuccessful(boolean success);
|
||||
|
||||
|
||||
/**
|
||||
* Callback called when the account has been activated (or not)
|
||||
* @param success true if the activation has been successful, false otherwise
|
||||
*/
|
||||
void onActivateAccountSuccessful(boolean success);
|
||||
|
||||
|
||||
/**
|
||||
* Callback called when an error occurred.
|
||||
* @param error the error that occurred
|
||||
|
|
|
@ -1,47 +1,66 @@
|
|||
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;
|
||||
|
||||
public class InAppPurchaseListenerBase implements InAppPurchaseListener {
|
||||
@Override
|
||||
public void onServiceAvailableForQueries() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAvailableItemsForPurchaseQueryFinished(ArrayList<Purchasable> items) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPurchasedItemsQueryFinished(ArrayList<Purchasable> items) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPurchasedItemConfirmationQueryFinished(boolean success) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRecoverAccountSuccessful(boolean success) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivateAccountSuccessful(boolean success) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import java.util.Locale;
|
|||
|
||||
/*
|
||||
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
|
||||
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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class Purchasable {
|
||||
private String id, title, description, price;
|
||||
private long expire;
|
||||
private String purchasePayload, purchasePayloadSignature;
|
||||
private String purchasePayload, purchasePayloadSignature;
|
||||
private String userData;
|
||||
|
||||
|
||||
public Purchasable(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
@ -71,7 +68,7 @@ public class Purchasable {
|
|||
public long getExpire() {
|
||||
return expire;
|
||||
}
|
||||
|
||||
|
||||
public String getExpireDate() {
|
||||
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.getDefault());
|
||||
Date date = new Date(expire);
|
||||
|
@ -82,26 +79,26 @@ public class Purchasable {
|
|||
this.expire = expire;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public Purchasable setPayloadAndSignature(String payload, String signature) {
|
||||
this.purchasePayload = payload;
|
||||
this.purchasePayloadSignature = signature;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public String getPayload() {
|
||||
return this.purchasePayload;
|
||||
}
|
||||
|
||||
|
||||
public String getPayloadSignature() {
|
||||
return this.purchasePayloadSignature;
|
||||
}
|
||||
|
||||
|
||||
public Purchasable setUserData(String data) {
|
||||
this.userData = data;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public String getUserData() {
|
||||
return this.userData;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.linphone.sync;
|
|||
|
||||
/*
|
||||
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
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.linphone.sync;
|
|||
|
||||
/*
|
||||
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
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.linphone.sync;
|
|||
|
||||
/*
|
||||
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
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.linphone.sync;
|
|||
|
||||
/*
|
||||
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
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.linphone.tutorials;
|
||||
|
||||
/*
|
||||
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
|
||||
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
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
package org.linphone.tutorials;
|
||||
|
||||
import org.linphone.core.tutorials.TutorialNotifier;
|
||||
|
||||
|
@ -26,21 +27,19 @@ import android.widget.TextView;
|
|||
/**
|
||||
* Write notifications to a TextView widget.
|
||||
* This is an helper class, not a test activity.
|
||||
*
|
||||
* @author Guillaume Beraudo
|
||||
*
|
||||
*/
|
||||
class AndroidTutorialNotifier extends TutorialNotifier {
|
||||
|
||||
private Handler mHandler;
|
||||
private TextView outputTextView;
|
||||
|
||||
|
||||
public AndroidTutorialNotifier(Handler mHandler, final TextView outputTextView) {
|
||||
this.mHandler = mHandler;
|
||||
this.outputTextView = outputTextView;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void notify(final String s) {
|
||||
mHandler.post(new Runnable() {
|
||||
|
|
|
@ -1,5 +1,24 @@
|
|||
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.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.linphone.tutorials;
|
||||
|
||||
/*
|
||||
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
|
||||
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
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
package org.linphone.tutorials;
|
||||
|
||||
import org.linphone.R;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
|
@ -34,8 +35,6 @@ import android.widget.TextView;
|
|||
/**
|
||||
* Activity for displaying and starting the chatroom example on Android phone.
|
||||
*
|
||||
* @author Guillaume Beraudo
|
||||
*
|
||||
*/
|
||||
public class TutorialChatRoomActivity extends Activity {
|
||||
|
||||
|
@ -56,12 +55,12 @@ public class TutorialChatRoomActivity extends Activity {
|
|||
final TextView outputText = (TextView) findViewById(R.id.OutputText);
|
||||
final TutorialNotifier notifier = new AndroidTutorialNotifier(mHandler, outputText);
|
||||
|
||||
|
||||
|
||||
// Create HelloWorld object
|
||||
tutorial = new TutorialChatRoom(notifier);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Assign call action to call button
|
||||
buttonCall = (Button) findViewById(R.id.CallButton);
|
||||
buttonCall.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -80,8 +79,8 @@ public class TutorialChatRoomActivity extends Activity {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private class TutorialLaunchingThread extends Thread {
|
||||
@Override
|
||||
public void run() {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.linphone.tutorials;
|
||||
/*
|
||||
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
|
||||
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.view.View;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class TutorialLauncherActivity extends Activity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.tutorials);
|
||||
}
|
||||
|
||||
|
||||
public void startHelloWorldTutorial(View v) {
|
||||
startActivity(new Intent().setClass(TutorialLauncherActivity.this, TutorialHelloWorldActivity.class));
|
||||
}
|
||||
|
||||
|
||||
public void startRegistrationTutorial(View v) {
|
||||
startActivity(new Intent().setClass(TutorialLauncherActivity.this, TutorialRegistrationActivity.class));
|
||||
}
|
||||
|
||||
|
||||
public void startChatRoomTutorial(View v) {
|
||||
startActivity(new Intent().setClass(TutorialLauncherActivity.this, TutorialChatRoomActivity.class));
|
||||
}
|
||||
|
||||
|
||||
public void startBuddyStatusTutorial(View v) {
|
||||
startActivity(new Intent().setClass(TutorialLauncherActivity.this, TutorialBuddyStatusActivity.class));
|
||||
}
|
||||
|
||||
|
||||
public void startCardDavSyncTutorial(View v) {
|
||||
startActivity(new Intent().setClass(TutorialLauncherActivity.this, TutorialCardDavSync.class));
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.linphone.tutorials;
|
||||
|
||||
/*
|
||||
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
|
||||
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
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
package org.linphone.tutorials;
|
||||
|
||||
import org.linphone.R;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
|
@ -32,8 +33,6 @@ import android.widget.TextView;
|
|||
|
||||
/**
|
||||
* Activity for displaying and starting the registration example on Android phone.
|
||||
*
|
||||
* @author Guillaume Beraudo
|
||||
*
|
||||
*/
|
||||
public class TutorialRegistrationActivity extends TutorialHelloWorldActivity {
|
||||
|
@ -62,12 +61,12 @@ public class TutorialRegistrationActivity extends TutorialHelloWorldActivity {
|
|||
outputText = (TextView) findViewById(R.id.OutputText);
|
||||
final TutorialNotifier notifier = new AndroidTutorialNotifier(mHandler, outputText);
|
||||
|
||||
|
||||
|
||||
// Create Tutorial object
|
||||
tutorial = new TutorialRegistration(notifier);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Assign call action to call button
|
||||
buttonCall = (Button) findViewById(R.id.CallButton);
|
||||
buttonCall.setText("Register");
|
||||
|
@ -87,8 +86,8 @@ public class TutorialRegistrationActivity extends TutorialHelloWorldActivity {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private class TutorialLaunchingThread extends Thread {
|
||||
@Override
|
||||
public void run() {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.linphone.ui;
|
||||
|
||||
/*
|
||||
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
|
||||
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
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
package org.linphone.ui;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author Guillaume Beraudo
|
||||
*
|
||||
*/
|
||||
public interface AddressAware {
|
||||
|
||||
void setAddressWidget(AddressText address);
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.linphone.ui;
|
||||
|
||||
/*
|
||||
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
|
||||
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
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
package org.linphone.ui;
|
||||
|
||||
import org.linphone.DialerFragment;
|
||||
import org.linphone.LinphoneManager.AddressType;
|
||||
|
@ -29,17 +30,13 @@ import android.util.AttributeSet;
|
|||
import android.util.TypedValue;
|
||||
import android.widget.EditText;
|
||||
|
||||
/**
|
||||
* @author Guillaume Beraudo
|
||||
*
|
||||
*/
|
||||
public class AddressText extends EditText implements AddressType {
|
||||
|
||||
private String displayedName;
|
||||
private Uri pictureUri;
|
||||
private Paint mTestPaint;
|
||||
private DialerFragment dialer;
|
||||
|
||||
|
||||
public void setPictureUri(Uri uri) {
|
||||
pictureUri = uri;
|
||||
}
|
||||
|
@ -71,7 +68,7 @@ public class AddressText extends EditText implements AddressType {
|
|||
public void setDisplayedName(String displayedName) {
|
||||
this.displayedName = displayedName;
|
||||
}
|
||||
|
||||
|
||||
private String getHintText() {
|
||||
String resizedText = getContext().getString(R.string.address_bar_hint);
|
||||
if (getHint() != null) {
|
||||
|
@ -87,7 +84,7 @@ public class AddressText extends EditText implements AddressType {
|
|||
pictureUri = null;
|
||||
|
||||
refitText(getWidth(), getHeight());
|
||||
|
||||
|
||||
if (dialer != null) {
|
||||
dialer.enableDisableAddContact();
|
||||
}
|
||||
|
@ -101,7 +98,7 @@ public class AddressText extends EditText implements AddressType {
|
|||
refitText(getWidth(), getHeight());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private float getOptimizedTextSize(String text, int textWidth, int textHeight) {
|
||||
int targetWidth = textWidth - getPaddingLeft() - getPaddingRight();
|
||||
int targetHeight = textHeight - getPaddingTop() - getPaddingBottom();
|
||||
|
@ -121,7 +118,7 @@ public class AddressText extends EditText implements AddressType {
|
|||
lo = size;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return lo;
|
||||
}
|
||||
|
||||
|
@ -129,7 +126,7 @@ public class AddressText extends EditText implements AddressType {
|
|||
if (textWidth <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
float size = getOptimizedTextSize(getHintText(), textWidth, textHeight);
|
||||
float entrySize = getOptimizedTextSize(getText().toString(), textWidth, textHeight);
|
||||
if (entrySize < size)
|
||||
|
@ -141,7 +138,7 @@ public class AddressText extends EditText implements AddressType {
|
|||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
int parentWidth = MeasureSpec.getSize(widthMeasureSpec);
|
||||
int height = getMeasuredHeight();
|
||||
|
||||
|
||||
refitText(parentWidth, height);
|
||||
setMeasuredDimension(parentWidth, height);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.linphone.ui;
|
||||
|
||||
/*
|
||||
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
|
||||
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
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
package org.linphone.ui;
|
||||
|
||||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.LinphonePreferences;
|
||||
|
@ -33,9 +34,6 @@ import android.view.View.OnClickListener;
|
|||
import android.widget.ImageView;
|
||||
import android.widget.Toast;
|
||||
|
||||
/**
|
||||
* @author Guillaume Beraudo
|
||||
*/
|
||||
public class CallButton extends ImageView implements OnClickListener, AddressAware {
|
||||
|
||||
private AddressText mAddress;
|
||||
|
@ -52,7 +50,7 @@ public class CallButton extends ImageView implements OnClickListener, AddressAwa
|
|||
public void onClick(View v) {
|
||||
try {
|
||||
if (!LinphoneManager.getInstance().acceptCallIfIncomingPending()) {
|
||||
if (mAddress.getText().length() > 0) {
|
||||
if (mAddress.getText().length() > 0) {
|
||||
LinphoneManager.getInstance().newOutgoingCall(mAddress);
|
||||
} else {
|
||||
if (LinphonePreferences.instance().isBisFeatureEnabled()) {
|
||||
|
@ -67,7 +65,7 @@ public class CallButton extends ImageView implements OnClickListener, AddressAwa
|
|||
if (log == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LinphoneProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig();
|
||||
if (lpc != null && log.getTo().getDomain().equals(lpc.getDomain())) {
|
||||
mAddress.setText(log.getTo().getUserName());
|
||||
|
@ -84,7 +82,7 @@ public class CallButton extends ImageView implements OnClickListener, AddressAwa
|
|||
onWrongDestinationAddress();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void onWrongDestinationAddress() {
|
||||
Toast.makeText(getContext()
|
||||
,String.format(getResources().getString(R.string.warning_wrong_destination_address),mAddress.getText().toString())
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.linphone.ui;
|
||||
|
||||
/*
|
||||
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
|
||||
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
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
package org.linphone.ui;
|
||||
|
||||
import org.linphone.CallActivity;
|
||||
import org.linphone.LinphoneManager;
|
||||
|
@ -52,7 +53,7 @@ public class Digit extends Button implements AddressAware {
|
|||
protected void onTextChanged(CharSequence text, int start, int before,
|
||||
int after) {
|
||||
super.onTextChanged(text, start, before, after);
|
||||
|
||||
|
||||
if (text == null || text.length() < 1) {
|
||||
return;
|
||||
}
|
||||
|
@ -60,21 +61,21 @@ public class Digit extends Button implements AddressAware {
|
|||
DialKeyListener lListener = new DialKeyListener();
|
||||
setOnClickListener(lListener);
|
||||
setOnTouchListener(lListener);
|
||||
|
||||
|
||||
if ("0+".equals(text)) {
|
||||
setOnLongClickListener(lListener);
|
||||
}
|
||||
|
||||
|
||||
if ("1".equals(text)) {
|
||||
setOnLongClickListener(lListener);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Digit(Context context, AttributeSet attrs, int style) {
|
||||
super(context, attrs, style);
|
||||
setLongClickable(true);
|
||||
}
|
||||
|
||||
|
||||
public Digit(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
setLongClickable(true);
|
||||
|
@ -112,7 +113,7 @@ public class Digit extends Button implements AddressAware {
|
|||
lc.sendDtmf(mKeyCode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (mAddress != null) {
|
||||
int lBegin = mAddress.getSelectionStart();
|
||||
if (lBegin == -1) {
|
||||
|
@ -169,7 +170,7 @@ public class Digit extends Button implements AddressAware {
|
|||
if (CallActivity.isInstanciated()) {
|
||||
CallActivity.instance().resetControlsHidingCallBack();
|
||||
}
|
||||
|
||||
|
||||
LinphoneCore lc = LinphoneManager.getLc();
|
||||
if (event.getAction() == MotionEvent.ACTION_DOWN && !mIsDtmfStarted) {
|
||||
LinphoneManager.getInstance().playDtmf(getContext().getContentResolver(), mKeyCode);
|
||||
|
@ -182,7 +183,7 @@ public class Digit extends Button implements AddressAware {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public boolean onLongClick(View v) {
|
||||
int id = v.getId();
|
||||
LinphoneCore lc = LinphoneManager.getLc();
|
||||
|
@ -192,7 +193,7 @@ public class Digit extends Button implements AddressAware {
|
|||
// Called if "0+" dtmf
|
||||
lc.stopDtmf();
|
||||
}
|
||||
|
||||
|
||||
if(id == R.id.Digit1 && lc.getCalls().length == 0){
|
||||
String voiceMail = LinphonePreferences.instance().getVoiceMailUri();
|
||||
mAddress.getEditableText().clear();
|
||||
|
@ -202,8 +203,8 @@ public class Digit extends Button implements AddressAware {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (mAddress == null) return true;
|
||||
|
||||
int lBegin = mAddress.getSelectionStart();
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.linphone.ui;
|
|||
|
||||
/*
|
||||
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
|
||||
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.widget.ImageView;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class LedPreference extends Preference
|
||||
{
|
||||
private int ledDrawable;
|
||||
|
||||
|
||||
public LedPreference(Context context) {
|
||||
super(context);
|
||||
ledDrawable = R.drawable.led_disconnected;
|
||||
|
|
|
@ -1,5 +1,24 @@
|
|||
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.LinphoneManager;
|
||||
import org.linphone.LinphoneService;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.linphone.ui;
|
||||
/*
|
||||
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
|
||||
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.widget.ScrollView;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class LinphoneScrollView extends ScrollView {
|
||||
private ScrollViewListener scrollViewListener = null;
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ import android.view.View;
|
|||
|
||||
/*
|
||||
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
|
||||
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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class LinphoneSliders extends View implements OnGestureListener {
|
||||
private Drawable leftSliderImg, rightSliderImg;
|
||||
private int leftSliderX, rightSliderX;
|
||||
|
@ -39,36 +36,36 @@ public class LinphoneSliders extends View implements OnGestureListener {
|
|||
private LinphoneSliderTriggered mTriggerListener;
|
||||
private boolean slidingLeftHandle, slidingRightHandle;
|
||||
private static final double mCoeff = 0.5;
|
||||
|
||||
|
||||
public LinphoneSliders(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
mGestures = new GestureDetector(getContext(), this);
|
||||
//leftSliderImg = getResources().getDrawable(R.drawable.slider_left);
|
||||
//rightSliderImg = getResources().getDrawable(R.drawable.slider_right);
|
||||
|
||||
|
||||
slidersHeight = leftSliderImg.getIntrinsicHeight();
|
||||
slidersWidth = leftSliderImg.getIntrinsicWidth();
|
||||
|
||||
|
||||
leftSliderX = 0;
|
||||
rightSliderX = 0;
|
||||
slidingLeftHandle = slidingRightHandle = false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
rightSliderImg.setBounds(getWidth() - slidersWidth - rightSliderX, getHeight() - slidersHeight, getWidth(), getHeight());
|
||||
rightSliderImg.draw(canvas);
|
||||
|
||||
|
||||
leftSliderImg.setBounds(0, getHeight() - slidersHeight, slidersWidth + leftSliderX, getHeight());
|
||||
leftSliderImg.draw(canvas);
|
||||
|
||||
|
||||
if (slidingLeftHandle && Math.abs(leftSliderX) >= mCoeff * getWidth()) {
|
||||
mTriggerListener.onLeftHandleTriggered();
|
||||
} else if (slidingRightHandle && rightSliderX >= mCoeff * getWidth()) {
|
||||
mTriggerListener.onRightHandleTriggered();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
if (event.getAction() == MotionEvent.ACTION_UP) {
|
||||
|
@ -77,8 +74,8 @@ public class LinphoneSliders extends View implements OnGestureListener {
|
|||
slidingLeftHandle = slidingRightHandle = false;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
return mGestures.onTouchEvent(event);
|
||||
|
||||
return mGestures.onTouchEvent(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -94,7 +91,7 @@ public class LinphoneSliders extends View implements OnGestureListener {
|
|||
|
||||
@Override
|
||||
public void onLongPress(MotionEvent e) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -103,7 +100,7 @@ public class LinphoneSliders extends View implements OnGestureListener {
|
|||
if (e1.getY() < getHeight() - slidersHeight) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (e1.getX() < getWidth() / 2) {
|
||||
leftSliderX -= distanceX;
|
||||
slidingLeftHandle = true;
|
||||
|
@ -112,20 +109,20 @@ public class LinphoneSliders extends View implements OnGestureListener {
|
|||
slidingRightHandle = true;
|
||||
}
|
||||
invalidate();
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShowPress(MotionEvent e) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onSingleTapUp(MotionEvent e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public void setOnTriggerListener(LinphoneSliderTriggered listener) {
|
||||
mTriggerListener = listener;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.linphone.ui;
|
||||
|
||||
/*
|
||||
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
|
||||
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
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
package org.linphone.ui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
@ -31,10 +32,6 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
/**
|
||||
* @author Guillaume Beraudo
|
||||
*
|
||||
*/
|
||||
public class Numpad extends LinearLayout implements AddressAware {
|
||||
|
||||
private boolean mPlayDtmf;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package org.linphone.ui;
|
||||
|
||||
/*
|
||||
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
|
||||
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
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
|
@ -45,13 +47,13 @@ import android.widget.RelativeLayout;
|
|||
@SuppressLint("ValidFragment")
|
||||
public class PreferencesListFragment extends ListFragment {
|
||||
private PreferenceManager mPreferenceManager;
|
||||
|
||||
|
||||
/**
|
||||
* The starting request code given out to preference framework.
|
||||
*/
|
||||
private static final int FIRST_REQUEST_CODE = 100;
|
||||
private static final int MSG_BIND_PREFERENCES = 0;
|
||||
|
||||
|
||||
private Handler mHandler = new Handler() {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
|
@ -64,33 +66,33 @@ public class PreferencesListFragment extends ListFragment {
|
|||
};
|
||||
private ListView preferencesList;
|
||||
private int xmlResID;
|
||||
|
||||
|
||||
public PreferencesListFragment(int xmlId) {
|
||||
this.xmlResID = xmlId;
|
||||
}
|
||||
|
||||
|
||||
// Must be provided
|
||||
public PreferencesListFragment() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle b) {
|
||||
// Hack to correctly display preferences
|
||||
View view = inflater.inflate(R.layout.settings, null);
|
||||
|
||||
|
||||
ViewParent p = preferencesList.getParent();
|
||||
if (p != null) {
|
||||
((ViewGroup)p).removeView(preferencesList);
|
||||
}
|
||||
|
||||
|
||||
RelativeLayout layout = (RelativeLayout) view.findViewById(R.id.topLayout);
|
||||
layout.addView(preferencesList);
|
||||
|
||||
|
||||
postBindPreferences();
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDestroyView(){
|
||||
super.onDestroyView();
|
||||
|
@ -103,11 +105,11 @@ public class PreferencesListFragment extends ListFragment {
|
|||
@Override
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
|
||||
|
||||
if (bundle != null) {
|
||||
xmlResID = bundle.getInt("xml");
|
||||
}
|
||||
|
||||
|
||||
mPreferenceManager = onCreatePreferenceManager();
|
||||
preferencesList = (ListView) LayoutInflater.from(getActivity()).inflate(R.layout.preference_list_content, null);
|
||||
preferencesList.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
|
||||
|
@ -168,17 +170,17 @@ public class PreferencesListFragment extends ListFragment {
|
|||
if (mHandler.hasMessages(MSG_BIND_PREFERENCES)) return;
|
||||
mHandler.obtainMessage(MSG_BIND_PREFERENCES).sendToTarget();
|
||||
}
|
||||
|
||||
|
||||
private void bindPreferences() {
|
||||
final PreferenceScreen preferenceScreen = getPreferenceScreen();
|
||||
if (preferenceScreen != null && preferencesList != null) {
|
||||
preferenceScreen.bind(preferencesList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates the {@link PreferenceManager}.
|
||||
*
|
||||
*
|
||||
* @return The {@link PreferenceManager} used by this activity.
|
||||
*/
|
||||
private PreferenceManager onCreatePreferenceManager() {
|
||||
|
@ -192,7 +194,7 @@ public class PreferencesListFragment extends ListFragment {
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the {@link PreferenceManager} used by this activity.
|
||||
* @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.
|
||||
*
|
||||
*
|
||||
* @param preferenceScreen The root {@link PreferenceScreen} of the preference hierarchy.
|
||||
*/
|
||||
public void setPreferenceScreen(PreferenceScreen preferenceScreen) {
|
||||
|
@ -218,10 +220,10 @@ public class PreferencesListFragment extends ListFragment {
|
|||
Log.e("[PreferencesListFragment] setPreferenceScreen " + e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the root of the preference hierarchy that this activity is showing.
|
||||
*
|
||||
*
|
||||
* @return The {@link PreferenceScreen} that is the root of the preference
|
||||
* hierarchy.
|
||||
*/
|
||||
|
@ -233,17 +235,17 @@ public class PreferencesListFragment extends ListFragment {
|
|||
} catch(Exception e) {
|
||||
Log.e("[PreferencesListFragment] getPreferenceScreen " + e);
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Inflates the given XML resource and adds the preference hierarchy to the current
|
||||
* preference hierarchy.
|
||||
*
|
||||
*
|
||||
* @param preferencesResId The XML resource ID to inflate.
|
||||
*/
|
||||
public void addPreferencesFromResource(int preferencesResId) {
|
||||
public void addPreferencesFromResource(int preferencesResId) {
|
||||
try {
|
||||
Method m = PreferenceManager.class.getDeclaredMethod("inflateFromResource", Context.class, int.class, PreferenceScreen.class);
|
||||
m.setAccessible(true);
|
||||
|
@ -253,10 +255,10 @@ public class PreferencesListFragment extends ListFragment {
|
|||
Log.e("[PreferencesListFragment] addPreferencesFromResource " + e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Finds a {@link Preference} based on its key.
|
||||
*
|
||||
*
|
||||
* @param key The key of the preference to retrieve.
|
||||
* @return The {@link Preference} with the key, or null.
|
||||
* @see PreferenceGroup#findPreference(CharSequence)
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package org.linphone.ui;
|
||||
|
||||
/*
|
||||
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
|
||||
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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public interface ScrollViewListener {
|
||||
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