More cleanup

This commit is contained in:
Sylvain Berfini 2018-09-03 15:13:56 +02:00
parent f020b2e2c4
commit 6e9058ca99
69 changed files with 494 additions and 1016 deletions

View file

@ -31,7 +31,6 @@ public class BandwidthManager {
private static BandwidthManager instance; private static BandwidthManager instance;
private int currentProfile = HIGH_RESOLUTION; private int currentProfile = HIGH_RESOLUTION;
public int getCurrentProfile() {return currentProfile;}
public static final synchronized BandwidthManager getInstance() { public static final synchronized BandwidthManager getInstance() {
if (instance == null) instance = new BandwidthManager(); if (instance == null) instance = new BandwidthManager();

View file

@ -20,7 +20,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.app.ProgressDialog; import android.app.ProgressDialog;

View file

@ -30,14 +30,12 @@ import org.linphone.core.AuthInfo;
import org.linphone.core.Core; import org.linphone.core.Core;
import org.linphone.core.LimeState; import org.linphone.core.LimeState;
import org.linphone.core.MediaEncryption; import org.linphone.core.MediaEncryption;
import org.linphone.core.LogCollectionState;
import org.linphone.core.Transports; import org.linphone.core.Transports;
import org.linphone.core.CoreException; import org.linphone.core.CoreException;
import org.linphone.core.Factory; import org.linphone.core.Factory;
import org.linphone.core.NatPolicy; import org.linphone.core.NatPolicy;
import org.linphone.core.ProxyConfig; import org.linphone.core.ProxyConfig;
import org.linphone.core.Config; import org.linphone.core.Config;
//import org.linphone.core.TunnelConfig;
import org.linphone.core.Tunnel; import org.linphone.core.Tunnel;
import org.linphone.core.TunnelConfig; import org.linphone.core.TunnelConfig;
import org.linphone.core.VideoActivationPolicy; import org.linphone.core.VideoActivationPolicy;

View file

@ -23,7 +23,6 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map;
import org.linphone.activities.LinphoneActivity; import org.linphone.activities.LinphoneActivity;
import org.linphone.compatibility.Compatibility; import org.linphone.compatibility.Compatibility;
@ -34,12 +33,8 @@ import org.linphone.core.Call;
import org.linphone.core.Call.State; import org.linphone.core.Call.State;
import org.linphone.core.Core; import org.linphone.core.Core;
import org.linphone.core.GlobalState; import org.linphone.core.GlobalState;
import org.linphone.core.LogLevel;
import org.linphone.core.LoggingService;
import org.linphone.core.LoggingServiceListener;
import org.linphone.core.RegistrationState; import org.linphone.core.RegistrationState;
import org.linphone.core.Factory; import org.linphone.core.Factory;
import org.linphone.core.LogCollectionState;
import org.linphone.core.CoreListenerStub; import org.linphone.core.CoreListenerStub;
import org.linphone.core.ProxyConfig; import org.linphone.core.ProxyConfig;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
@ -69,7 +64,6 @@ import android.os.IBinder;
import android.os.SystemClock; import android.os.SystemClock;
import android.provider.ContactsContract; import android.provider.ContactsContract;
import android.provider.MediaStore; import android.provider.MediaStore;
import android.util.ArrayMap;
import android.view.WindowManager; import android.view.WindowManager;
/** /**
@ -157,7 +151,7 @@ public final class LinphoneService extends Service {
After two days of hard work I ended with the following class, that does the job more or less reliabily. After two days of hard work I ended with the following class, that does the job more or less reliabily.
*/ */
class ActivityMonitor implements Application.ActivityLifecycleCallbacks { class ActivityMonitor implements Application.ActivityLifecycleCallbacks {
private ArrayList<Activity> activities = new ArrayList<Activity>(); private ArrayList<Activity> activities = new ArrayList<>();
private boolean mActive = false; private boolean mActive = false;
private int mRunningActivities = 0; private int mRunningActivities = 0;

View file

@ -21,7 +21,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.content.ContentResolver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.database.Cursor; import android.database.Cursor;
@ -34,7 +33,6 @@ import android.os.Build;
import android.os.Environment; import android.os.Environment;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.os.ParcelFileDescriptor;
import android.provider.MediaStore; import android.provider.MediaStore;
import android.provider.OpenableColumns; import android.provider.OpenableColumns;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
@ -42,7 +40,6 @@ import android.text.Spanned;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.View; import android.view.View;
import android.webkit.MimeTypeMap;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
@ -66,9 +63,6 @@ import org.linphone.mediastream.Log;
import org.linphone.mediastream.video.capture.hwconf.Hacks; import org.linphone.mediastream.video.capture.hwconf.Hacks;
import java.io.File; import java.io.File;
import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
@ -324,11 +318,11 @@ public final class LinphoneUtils {
public static final List<Call> getCalls(Core lc) { public static final List<Call> getCalls(Core lc) {
// return a modifiable list // return a modifiable list
return new ArrayList<Call>(Arrays.asList(lc.getCalls())); return new ArrayList<>(Arrays.asList(lc.getCalls()));
} }
public static final List<Call> getCallsInState(Core lc, Collection<State> states) { public static final List<Call> getCallsInState(Core lc, Collection<State> states) {
List<Call> foundCalls = new ArrayList<Call>(); List<Call> foundCalls = new ArrayList<>();
for (Call call : getCalls(lc)) { for (Call call : getCalls(lc)) {
if (states.contains(call.getState())) { if (states.contains(call.getState())) {
foundCalls.add(call); foundCalls.add(call);

View file

@ -114,9 +114,6 @@ import org.linphone.ui.AddressText;
import org.linphone.xmlrpc.XmlRpcHelper; import org.linphone.xmlrpc.XmlRpcHelper;
import org.linphone.xmlrpc.XmlRpcListenerBase; import org.linphone.xmlrpc.XmlRpcListenerBase;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
@ -125,9 +122,7 @@ import java.util.Collection;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
public class LinphoneActivity extends LinphoneGenericActivity implements OnClickListener, ContactPicked, ActivityCompat.OnRequestPermissionsResultCallback { public class LinphoneActivity extends LinphoneGenericActivity implements OnClickListener, ContactPicked, ActivityCompat.OnRequestPermissionsResultCallback {
public static final String PREF_FIRST_LAUNCH = "pref_first_launch";
private static final int SETTINGS_ACTIVITY = 123; private static final int SETTINGS_ACTIVITY = 123;
private static final int CALL_ACTIVITY = 19; private static final int CALL_ACTIVITY = 19;
private static final int PERMISSIONS_REQUEST_OVERLAY = 206; private static final int PERMISSIONS_REQUEST_OVERLAY = 206;
@ -313,19 +308,19 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
} }
private void initButtons() { private void initButtons() {
mTabBar = (LinearLayout) findViewById(R.id.footer); mTabBar = findViewById(R.id.footer);
mTopBar = (RelativeLayout) findViewById(R.id.top_bar); mTopBar = findViewById(R.id.top_bar);
cancel = (ImageView) findViewById(R.id.cancel); cancel = findViewById(R.id.cancel);
cancel.setOnClickListener(this); cancel.setOnClickListener(this);
history = (RelativeLayout) findViewById(R.id.history); history = findViewById(R.id.history);
history.setOnClickListener(this); history.setOnClickListener(this);
contacts = (RelativeLayout) findViewById(R.id.contacts); contacts = findViewById(R.id.contacts);
contacts.setOnClickListener(this); contacts.setOnClickListener(this);
dialer = (RelativeLayout) findViewById(R.id.dialer); dialer = findViewById(R.id.dialer);
dialer.setOnClickListener(this); dialer.setOnClickListener(this);
chat = (RelativeLayout) findViewById(R.id.chat); chat = findViewById(R.id.chat);
chat.setOnClickListener(this); chat.setOnClickListener(this);
history_selected = findViewById(R.id.history_select); history_selected = findViewById(R.id.history_select);
@ -333,8 +328,8 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
dialer_selected = findViewById(R.id.dialer_select); dialer_selected = findViewById(R.id.dialer_select);
chat_selected = findViewById(R.id.chat_select); chat_selected = findViewById(R.id.chat_select);
missedCalls = (TextView) findViewById(R.id.missed_calls); missedCalls = findViewById(R.id.missed_calls);
missedChats = (TextView) findViewById(R.id.missed_chats); missedChats = findViewById(R.id.missed_chats);
} }
public boolean isTablet() { public boolean isTablet() {

View file

@ -246,9 +246,9 @@ private static AssistantActivity instance;
} }
private void initUI() { private void initUI() {
back = (ImageView) findViewById(R.id.back); back = findViewById(R.id.back);
back.setOnClickListener(this); back.setOnClickListener(this);
cancel = (ImageView) findViewById(R.id.assistant_cancel); cancel = findViewById(R.id.assistant_cancel);
cancel.setOnClickListener(this); cancel.setOnClickListener(this);
} }
@ -369,7 +369,6 @@ private static AssistantActivity instance;
public void configureProxyConfig(AccountCreator accountCreator) { public void configureProxyConfig(AccountCreator accountCreator) {
Core lc = LinphoneManager.getLc(); Core lc = LinphoneManager.getLc();
ProxyConfig proxyConfig = lc.createProxyConfig(); ProxyConfig proxyConfig = lc.createProxyConfig();
Address addr;
AuthInfo authInfo; AuthInfo authInfo;
String identity = proxyConfig.getIdentityAddress().asStringUriOnly(); String identity = proxyConfig.getIdentityAddress().asStringUriOnly();
@ -378,7 +377,7 @@ private static AssistantActivity instance;
return; return;
} }
identity = identity.replace("?", accountCreator.getUsername()); identity = identity.replace("?", accountCreator.getUsername());
addr = Factory.instance().createAddress(identity); Address addr = Factory.instance().createAddress(identity);
addr.setDisplayName(accountCreator.getUsername()); addr.setDisplayName(accountCreator.getUsername());
address = addr; address = addr;
proxyConfig.edit(); proxyConfig.edit();

View file

@ -21,7 +21,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import org.linphone.LinphoneManager; import org.linphone.LinphoneManager;
import org.linphone.R; import org.linphone.R;
import org.linphone.core.CoreException;
import org.linphone.core.tools.OpenH264DownloadHelperListener; import org.linphone.core.tools.OpenH264DownloadHelperListener;
import org.linphone.core.PayloadType; import org.linphone.core.PayloadType;
import org.linphone.core.tools.OpenH264DownloadHelper; import org.linphone.core.tools.OpenH264DownloadHelper;
@ -53,14 +52,14 @@ public class CodecDownloaderFragment extends Fragment {
Bundle savedInstanceState) { Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.assistant_codec_downloader, container, false); final View view = inflater.inflate(R.layout.assistant_codec_downloader, container, false);
question = (TextView) view.findViewById(R.id.question); question = view.findViewById(R.id.question);
downloading = (TextView) view.findViewById(R.id.downloading); downloading = view.findViewById(R.id.downloading);
downloaded = (TextView) view.findViewById(R.id.downloaded); downloaded = view.findViewById(R.id.downloaded);
yes = (Button) view.findViewById(R.id.answerYes); yes = view.findViewById(R.id.answerYes);
no = (Button) view.findViewById(R.id.answerNo); no = view.findViewById(R.id.answerNo);
ok = (Button) view.findViewById(R.id.answerOk); ok = view.findViewById(R.id.answerOk);
bar = (ProgressBar) view.findViewById(R.id.progressBar); bar = view.findViewById(R.id.progressBar);
downloadingInfo = (TextView) view.findViewById(R.id.downloadingInfo); downloadingInfo = view.findViewById(R.id.downloadingInfo);
final OpenH264DownloadHelper codecDownloader = LinphoneManager.getInstance().getOpenH264DownloadHelper(); final OpenH264DownloadHelper codecDownloader = LinphoneManager.getInstance().getOpenH264DownloadHelper();
final OpenH264DownloadHelperListener codecListener = new OpenH264DownloadHelperListener() { final OpenH264DownloadHelperListener codecListener = new OpenH264DownloadHelperListener() {

View file

@ -34,7 +34,6 @@ import android.widget.EditText;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.ListView; import android.widget.ListView;
public class CountryListFragment extends Fragment implements AdapterView.OnItemClickListener, View.OnClickListener { public class CountryListFragment extends Fragment implements AdapterView.OnItemClickListener, View.OnClickListener {
private ListView list; private ListView list;
private EditText search; private EditText search;
@ -49,11 +48,11 @@ public class CountryListFragment extends Fragment implements AdapterView.OnItemC
adapter = AssistantActivity.instance().getCountryListAdapter(); adapter = AssistantActivity.instance().getCountryListAdapter();
adapter.setInflater(inflater); adapter.setInflater(inflater);
search = (EditText)view.findViewById(R.id.search_country); search = view.findViewById(R.id.search_country);
clearSearchField = (ImageView) view.findViewById(R.id.clearSearchField); clearSearchField = view.findViewById(R.id.clearSearchField);
clearSearchField.setOnClickListener(this); clearSearchField.setOnClickListener(this);
list = (ListView)view.findViewById(R.id.countryList); list = view.findViewById(R.id.countryList);
list.setAdapter(adapter); list.setAdapter(adapter);
list.setOnItemClickListener(this); list.setOnItemClickListener(this);

View file

@ -32,7 +32,6 @@ import org.linphone.LinphonePreferences;
import org.linphone.R; import org.linphone.R;
import org.linphone.core.AccountCreator; import org.linphone.core.AccountCreator;
import org.linphone.core.AccountCreatorListener; import org.linphone.core.AccountCreatorListener;
import org.linphone.core.Factory;
public class CreateAccountActivationFragment extends Fragment implements OnClickListener, AccountCreatorListener { public class CreateAccountActivationFragment extends Fragment implements OnClickListener, AccountCreatorListener {
private String username, password; private String username, password;
@ -54,10 +53,10 @@ public class CreateAccountActivationFragment extends Fragment implements OnClick
accountCreator.setUsername(username); accountCreator.setUsername(username);
accountCreator.setPassword(password); accountCreator.setPassword(password);
email = (TextView) view.findViewById(R.id.send_email); email = view.findViewById(R.id.send_email);
email.setText(getArguments().getString("Email")); email.setText(getArguments().getString("Email"));
checkAccount = (Button) view.findViewById(R.id.assistant_check); checkAccount = view.findViewById(R.id.assistant_check);
checkAccount.setOnClickListener(this); checkAccount.setOnClickListener(this);
return view; return view;
} }

View file

@ -23,7 +23,6 @@ import org.linphone.LinphonePreferences;
import org.linphone.R; import org.linphone.R;
import org.linphone.core.AccountCreator; import org.linphone.core.AccountCreator;
import org.linphone.core.AccountCreatorListener; import org.linphone.core.AccountCreatorListener;
import org.linphone.core.Factory;
import android.app.Fragment; import android.app.Fragment;
import android.os.Bundle; import android.os.Bundle;
@ -67,21 +66,21 @@ public class CreateAccountCodeActivationFragment extends Fragment implements Acc
accountCreator.setUsername(username); accountCreator.setUsername(username);
accountCreator.setPhoneNumber(phone, dialcode); accountCreator.setPhoneNumber(phone, dialcode);
back = (ImageView) view.findViewById(R.id.back); back = view.findViewById(R.id.back);
if (back != null) if (back != null)
back.setVisibility(Button.INVISIBLE); back.setVisibility(Button.INVISIBLE);
title = (TextView) view.findViewById(R.id.title_account_activation); title = view.findViewById(R.id.title_account_activation);
if (linkAccount) { if (linkAccount) {
title.setText(getString(R.string.assistant_link_account)); title.setText(getString(R.string.assistant_link_account));
} else if (recoverAccount) { } else if (recoverAccount) {
title.setText(getString(R.string.assistant_linphone_account)); title.setText(getString(R.string.assistant_linphone_account));
} }
phonenumber = (TextView) view.findViewById(R.id.send_phone_number); phonenumber = view.findViewById(R.id.send_phone_number);
phonenumber.setText(accountCreator.getPhoneNumber()); phonenumber.setText(accountCreator.getPhoneNumber());
code = (EditText) view.findViewById(R.id.assistant_code); code = view.findViewById(R.id.assistant_code);
code.addTextChangedListener(new TextWatcher() { code.addTextChangedListener(new TextWatcher() {
@Override @Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {} public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
@ -99,7 +98,7 @@ public class CreateAccountCodeActivationFragment extends Fragment implements Acc
} }
}); });
checkAccount = (Button) view.findViewById(R.id.assistant_check); checkAccount = view.findViewById(R.id.assistant_check);
checkAccount.setEnabled(false); checkAccount.setEnabled(false);
checkAccount.setOnClickListener(new OnClickListener() { checkAccount.setOnClickListener(new OnClickListener() {
@Override @Override

View file

@ -22,7 +22,6 @@ import java.util.Locale;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import org.linphone.activities.LinphoneActivity;
import org.linphone.LinphoneManager; import org.linphone.LinphoneManager;
import org.linphone.LinphonePreferences; import org.linphone.LinphonePreferences;
import org.linphone.LinphoneUtils; import org.linphone.LinphoneUtils;
@ -38,7 +37,6 @@ import android.accounts.AccountManager;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Fragment; import android.app.Fragment;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
@ -85,41 +83,41 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
accountCreator = LinphoneManager.getLc().createAccountCreator(LinphonePreferences.instance().getXmlrpcUrl()); accountCreator = LinphoneManager.getLc().createAccountCreator(LinphonePreferences.instance().getXmlrpcUrl());
accountCreator.setListener(this); accountCreator.setListener(this);
instruction = (TextView) view.findViewById(R.id.message_create_account); instruction = view.findViewById(R.id.message_create_account);
createAccount = (Button) view.findViewById(R.id.assistant_create); createAccount = view.findViewById(R.id.assistant_create);
phoneNumberLayout = (LinearLayout) view.findViewById(R.id.phone_number_layout); phoneNumberLayout = view.findViewById(R.id.phone_number_layout);
usernameLayout = (LinearLayout) view.findViewById(R.id.username_layout); usernameLayout = view.findViewById(R.id.username_layout);
emailLayout = (LinearLayout) view.findViewById(R.id.email_layout); emailLayout = view.findViewById(R.id.email_layout);
passwordLayout = (LinearLayout) view.findViewById(R.id.password_layout); passwordLayout = view.findViewById(R.id.password_layout);
passwordConfirmLayout = (LinearLayout) view.findViewById(R.id.password_confirm_layout); passwordConfirmLayout = view.findViewById(R.id.password_confirm_layout);
useUsername = (CheckBox) view.findViewById(R.id.use_username); useUsername = view.findViewById(R.id.use_username);
useEmail = (CheckBox) view.findViewById(R.id.use_email); useEmail = view.findViewById(R.id.use_email);
usernameEdit = (EditText) view.findViewById(R.id.username); usernameEdit = view.findViewById(R.id.username);
phoneNumberError = (TextView) view.findViewById(R.id.phone_number_error); phoneNumberError = view.findViewById(R.id.phone_number_error);
phoneNumberEdit = (EditText) view.findViewById(R.id.phone_number); phoneNumberEdit = view.findViewById(R.id.phone_number);
sipUri = (TextView) view.findViewById(R.id.sip_uri); sipUri = view.findViewById(R.id.sip_uri);
phoneNumberInfo = (ImageView) view.findViewById(R.id.info_phone_number); phoneNumberInfo = view.findViewById(R.id.info_phone_number);
selectCountry = (Button) view.findViewById(R.id.select_country); selectCountry = view.findViewById(R.id.select_country);
dialCode = (EditText) view.findViewById(R.id.dial_code); dialCode = view.findViewById(R.id.dial_code);
assisstantTitle = (TextView) view.findViewById(R.id.assistant_title); assisstantTitle = view.findViewById(R.id.assistant_title);
passwordError = (TextView) view.findViewById(R.id.password_error); passwordError = view.findViewById(R.id.password_error);
passwordEdit = (EditText) view.findViewById(R.id.password); passwordEdit = view.findViewById(R.id.password);
passwordConfirmError = (TextView) view.findViewById(R.id.confirm_password_error); passwordConfirmError = view.findViewById(R.id.confirm_password_error);
passwordConfirmEdit = (EditText) view.findViewById(R.id.confirm_password); passwordConfirmEdit = view.findViewById(R.id.confirm_password);
emailError = (TextView) view.findViewById(R.id.email_error); emailError = view.findViewById(R.id.email_error);
emailEdit = (EditText) view.findViewById(R.id.email); emailEdit = view.findViewById(R.id.email);
skip = (TextView) view.findViewById(R.id.assistant_skip); skip = view.findViewById(R.id.assistant_skip);
//Phone number //Phone number
if (getResources().getBoolean(R.bool.use_phone_number_validation)) { if (getResources().getBoolean(R.bool.use_phone_number_validation)) {
@ -129,7 +127,6 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
(TelephonyManager) getActivity().getApplicationContext().getSystemService( (TelephonyManager) getActivity().getApplicationContext().getSystemService(
Context.TELEPHONY_SERVICE); Context.TELEPHONY_SERVICE);
String countryIso = tm.getNetworkCountryIso(); String countryIso = tm.getNetworkCountryIso();
ProxyConfig proxyConfig = LinphoneManager.getLc().createProxyConfig();
countryCode = org.linphone.core.Utils.getCccFromIso(countryIso.toUpperCase()); countryCode = org.linphone.core.Utils.getCccFromIso(countryIso.toUpperCase());
phoneNumberLayout.setVisibility(View.VISIBLE); phoneNumberLayout.setVisibility(View.VISIBLE);

View file

@ -29,9 +29,7 @@ import org.linphone.core.CoreListenerStub;
import org.linphone.core.XmlRpcArgType; import org.linphone.core.XmlRpcArgType;
import org.linphone.core.XmlRpcRequest; import org.linphone.core.XmlRpcRequest;
import org.linphone.core.XmlRpcRequestListener; import org.linphone.core.XmlRpcRequestListener;
//import org.linphone.core.XmlRpcRequestImpl;
import org.linphone.core.XmlRpcSession; import org.linphone.core.XmlRpcSession;
//import org.linphone.core.XmlRpcSessionImpl;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
import android.app.Fragment; import android.app.Fragment;

View file

@ -27,7 +27,6 @@ import org.linphone.compatibility.Compatibility;
import org.linphone.core.AccountCreatorListener; import org.linphone.core.AccountCreatorListener;
import org.linphone.core.DialPlan; import org.linphone.core.DialPlan;
import org.linphone.core.AccountCreator; import org.linphone.core.AccountCreator;
import org.linphone.core.Factory;
import org.linphone.core.ProxyConfig; import org.linphone.core.ProxyConfig;
import android.app.AlertDialog; import android.app.AlertDialog;
@ -73,29 +72,29 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
String url = "http://linphone.org/free-sip-service.html&action=recover"; String url = "http://linphone.org/free-sip-service.html&action=recover";
login = (EditText) view.findViewById(R.id.assistant_username); login = view.findViewById(R.id.assistant_username);
login.addTextChangedListener(this); login.addTextChangedListener(this);
recoverAccount = true; recoverAccount = true;
dialCode = (EditText) view.findViewById(R.id.dial_code); dialCode = view.findViewById(R.id.dial_code);
phoneNumberEdit = (EditText) view.findViewById(R.id.phone_number); phoneNumberEdit = view.findViewById(R.id.phone_number);
phoneNumberLayout = (LinearLayout) view.findViewById(R.id.phone_number_layout); phoneNumberLayout = view.findViewById(R.id.phone_number_layout);
phoneNumberError = (TextView) view.findViewById(R.id.phone_number_error_2); phoneNumberError = view.findViewById(R.id.phone_number_error_2);
phoneNumberInfo = (ImageView) view.findViewById(R.id.info_phone_number); phoneNumberInfo = view.findViewById(R.id.info_phone_number);
useUsername = (CheckBox) view.findViewById(R.id.use_username); useUsername = view.findViewById(R.id.use_username);
usernameLayout = (LinearLayout) view.findViewById(R.id.username_layout); usernameLayout = view.findViewById(R.id.username_layout);
passwordLayout = (LinearLayout) view.findViewById(R.id.password_layout); passwordLayout = view.findViewById(R.id.password_layout);
password = (EditText) view.findViewById(R.id.assistant_password); password = view.findViewById(R.id.assistant_password);
messagePhoneNumber = (TextView) view.findViewById(R.id.message_phone_number); messagePhoneNumber = view.findViewById(R.id.message_phone_number);
forgotPassword = (TextView) view.findViewById(R.id.forgot_password); forgotPassword = view.findViewById(R.id.forgot_password);
selectCountry = (Button) view.findViewById(R.id.select_country); selectCountry = view.findViewById(R.id.select_country);
apply = (Button) view.findViewById(R.id.assistant_apply); apply = view.findViewById(R.id.assistant_apply);
apply.setEnabled(true); apply.setEnabled(true);
apply.setOnClickListener(this); apply.setOnClickListener(this);
@ -111,7 +110,6 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
(TelephonyManager) getActivity().getApplicationContext().getSystemService( (TelephonyManager) getActivity().getApplicationContext().getSystemService(
Context.TELEPHONY_SERVICE); Context.TELEPHONY_SERVICE);
String countryIso = tm.getNetworkCountryIso(); String countryIso = tm.getNetworkCountryIso();
ProxyConfig proxyConfig = LinphoneManager.getLc().createProxyConfig();
countryCode = org.linphone.core.Utils.getCccFromIso(countryIso.toUpperCase()); countryCode = org.linphone.core.Utils.getCccFromIso(countryIso.toUpperCase());

View file

@ -43,18 +43,18 @@ public class LoginFragment extends Fragment implements OnClickListener, TextWatc
Bundle savedInstanceState) { Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.assistant_login, container, false); View view = inflater.inflate(R.layout.assistant_login, container, false);
login = (EditText) view.findViewById(R.id.assistant_username); login = view.findViewById(R.id.assistant_username);
login.addTextChangedListener(this); login.addTextChangedListener(this);
displayName = (EditText) view.findViewById(R.id.assistant_display_name); displayName = view.findViewById(R.id.assistant_display_name);
displayName.addTextChangedListener(this); displayName.addTextChangedListener(this);
userid = (EditText) view.findViewById(R.id.assistant_userid); userid = view.findViewById(R.id.assistant_userid);
userid.addTextChangedListener(this); userid.addTextChangedListener(this);
password = (EditText) view.findViewById(R.id.assistant_password); password = view.findViewById(R.id.assistant_password);
password.addTextChangedListener(this); password.addTextChangedListener(this);
domain = (EditText) view.findViewById(R.id.assistant_domain); domain = view.findViewById(R.id.assistant_domain);
domain.addTextChangedListener(this); domain.addTextChangedListener(this);
transports = (RadioGroup) view.findViewById(R.id.assistant_transports); transports = view.findViewById(R.id.assistant_transports);
apply = (Button) view.findViewById(R.id.assistant_apply); apply = view.findViewById(R.id.assistant_apply);
apply.setEnabled(false); apply.setEnabled(false);
apply.setOnClickListener(this); apply.setOnClickListener(this);

View file

@ -18,7 +18,6 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URLDecoder; import java.net.URLDecoder;
@ -53,7 +52,7 @@ public class RemoteProvisioningActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.remote_provisioning); setContentView(R.layout.remote_provisioning);
spinner = (ProgressBar) findViewById(R.id.spinner); spinner = findViewById(R.id.spinner);
mListener = new CoreListenerStub(){ mListener = new CoreListenerStub(){
@Override @Override

View file

@ -18,7 +18,6 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
import org.linphone.LinphoneManager; import org.linphone.LinphoneManager;
import org.linphone.LinphonePreferences; import org.linphone.LinphonePreferences;
import org.linphone.R; import org.linphone.R;
@ -43,9 +42,9 @@ public class RemoteProvisioningFragment extends Fragment implements OnClickListe
Bundle savedInstanceState) { Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.assistant_remote_provisioning, container, false); View view = inflater.inflate(R.layout.assistant_remote_provisioning, container, false);
remoteProvisioningUrl = (EditText) view.findViewById(R.id.assistant_remote_provisioning_url); remoteProvisioningUrl = view.findViewById(R.id.assistant_remote_provisioning_url);
remoteProvisioningUrl.addTextChangedListener(this); remoteProvisioningUrl.addTextChangedListener(this);
apply = (Button) view.findViewById(R.id.assistant_apply); apply = view.findViewById(R.id.assistant_apply);
apply.setEnabled(false); apply.setEnabled(false);
apply.setOnClickListener(this); apply.setOnClickListener(this);

View file

@ -45,11 +45,11 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.assistant_remote_provisioning_login); setContentView(R.layout.assistant_remote_provisioning_login);
login = (EditText) findViewById(R.id.assistant_username); login = findViewById(R.id.assistant_username);
password = (EditText) findViewById(R.id.assistant_password); password = findViewById(R.id.assistant_password);
domain = (EditText) findViewById(R.id.assistant_domain); domain = findViewById(R.id.assistant_domain);
connect = (Button) findViewById(R.id.assistant_connect); connect = findViewById(R.id.assistant_connect);
connect.setOnClickListener(this); connect.setOnClickListener(this);
String defaultDomain = getIntent().getStringExtra("Domain"); String defaultDomain = getIntent().getStringExtra("Domain");
@ -91,22 +91,6 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick
LinphonePreferences.instance().firstLaunchSuccessful(); LinphonePreferences.instance().firstLaunchSuccessful();
setResult(Activity.RESULT_OK); setResult(Activity.RESULT_OK);
finish(); finish();
/*String identity = "sip:" + username + "@" + domain;
ProxyConfig prxCfg = lc.createProxyConfig();
try {
prxCfg.setIdentityAddress(identity);
lc.addProxyConfig(prxCfg);
} catch (CoreException e) {
Log.e(e);
return false;
}
AuthInfo authInfo = Factory.instance().createAuthInfo(username, null, password, null, null, domain);
lc.addAuthInfo(authInfo);
if (LinphonePreferences.instance().getAccountCount() == 1)
lc.setDefaultProxyConfig(prxCfg);
*/
return true; return true;
} }

View file

@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
import org.linphone.R; import org.linphone.R;
import android.app.Fragment; import android.app.Fragment;
@ -35,24 +36,24 @@ public class WelcomeFragment extends Fragment implements OnClickListener {
Bundle savedInstanceState) { Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.assistant_welcome, container, false); View view = inflater.inflate(R.layout.assistant_welcome, container, false);
createAccount = (Button) view.findViewById(R.id.create_account); createAccount = view.findViewById(R.id.create_account);
createAccount.setOnClickListener(this); createAccount.setOnClickListener(this);
logLinphoneAccount = (Button) view.findViewById(R.id.login_linphone); logLinphoneAccount = view.findViewById(R.id.login_linphone);
if (getResources().getBoolean(R.bool.hide_linphone_accounts_in_assistant)) { if (getResources().getBoolean(R.bool.hide_linphone_accounts_in_assistant)) {
logLinphoneAccount.setVisibility(View.GONE); logLinphoneAccount.setVisibility(View.GONE);
} else { } else {
logLinphoneAccount.setOnClickListener(this); logLinphoneAccount.setOnClickListener(this);
} }
logGenericAccount = (Button) view.findViewById(R.id.login_generic); logGenericAccount = view.findViewById(R.id.login_generic);
if (getResources().getBoolean(R.bool.hide_generic_accounts_in_assistant)) { if (getResources().getBoolean(R.bool.hide_generic_accounts_in_assistant)) {
logGenericAccount.setVisibility(View.GONE); logGenericAccount.setVisibility(View.GONE);
} else { } else {
logGenericAccount.setOnClickListener(this); logGenericAccount.setOnClickListener(this);
} }
remoteProvisioning = (Button) view.findViewById(R.id.remote_provisioning); remoteProvisioning = view.findViewById(R.id.remote_provisioning);
if (getResources().getBoolean(R.bool.hide_remote_provisioning_in_assistant)) { if (getResources().getBoolean(R.bool.hide_remote_provisioning_in_assistant)) {
remoteProvisioning.setVisibility(View.GONE); remoteProvisioning.setVisibility(View.GONE);
} else { } else {

View file

@ -174,8 +174,8 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
cameraNumber = AndroidCameraConfiguration.retrieveCameras().length; cameraNumber = AndroidCameraConfiguration.retrieveCameras().length;
mEncoderTexts = new HashMap<String, String>(); mEncoderTexts = new HashMap<>();
mDecoderTexts = new HashMap<String, String>(); mDecoderTexts = new HashMap<>();
mListener = new CoreListenerStub() { mListener = new CoreListenerStub() {
@Override @Override
@ -236,14 +236,6 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
showAcceptCallUpdateDialog(); showAcceptCallUpdateDialog();
createTimerForDialog(SECONDS_BEFORE_DENYING_CALL_UPDATE); createTimerForDialog(SECONDS_BEFORE_DENYING_CALL_UPDATE);
} }
// else if (remoteVideo && !LinphoneManager.getLc().(getConference() != null) && autoAcceptCameraPolicy) {
// mHandler.post(new Runnable() {
// @Override
// public void run() {
// acceptCallUpdate(true);
// }
// });
// }
} }
refreshIncallUi(); refreshIncallUi();
@ -353,88 +345,88 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
private void initUI() { private void initUI() {
inflater = LayoutInflater.from(this); inflater = LayoutInflater.from(this);
container = (ViewGroup) findViewById(R.id.topLayout); container = findViewById(R.id.topLayout);
callsList = (LinearLayout) findViewById(R.id.calls_list); callsList = findViewById(R.id.calls_list);
conferenceList = (LinearLayout) findViewById(R.id.conference_list); conferenceList = findViewById(R.id.conference_list);
//TopBar //TopBar
video = (ImageView) findViewById(R.id.video); video = findViewById(R.id.video);
video.setOnClickListener(this); video.setOnClickListener(this);
enabledVideoButton(false); enabledVideoButton(false);
videoProgress = (ProgressBar) findViewById(R.id.video_in_progress); videoProgress = findViewById(R.id.video_in_progress);
videoProgress.setVisibility(View.GONE); videoProgress.setVisibility(View.GONE);
micro = (ImageView) findViewById(R.id.micro); micro = findViewById(R.id.micro);
micro.setOnClickListener(this); micro.setOnClickListener(this);
speaker = (ImageView) findViewById(R.id.speaker); speaker = findViewById(R.id.speaker);
speaker.setOnClickListener(this); speaker.setOnClickListener(this);
options = (ImageView) findViewById(R.id.options); options = findViewById(R.id.options);
options.setOnClickListener(this); options.setOnClickListener(this);
options.setEnabled(false); options.setEnabled(false);
//BottonBar //BottonBar
hangUp = (ImageView) findViewById(R.id.hang_up); hangUp = findViewById(R.id.hang_up);
hangUp.setOnClickListener(this); hangUp.setOnClickListener(this);
dialer = (ImageView) findViewById(R.id.dialer); dialer = findViewById(R.id.dialer);
dialer.setOnClickListener(this); dialer.setOnClickListener(this);
numpad = (Numpad) findViewById(R.id.numpad); numpad = findViewById(R.id.numpad);
numpad.getBackground().setAlpha(240); numpad.getBackground().setAlpha(240);
chat = (ImageView) findViewById(R.id.chat); chat = findViewById(R.id.chat);
chat.setOnClickListener(this); chat.setOnClickListener(this);
missedChats = (TextView) findViewById(R.id.missed_chats); missedChats = findViewById(R.id.missed_chats);
//Others //Others
//Active Call //Active Call
callInfo = (LinearLayout) findViewById(R.id.active_call_info); callInfo = findViewById(R.id.active_call_info);
pause = (ImageView) findViewById(R.id.pause); pause = findViewById(R.id.pause);
pause.setOnClickListener(this); pause.setOnClickListener(this);
enabledPauseButton(false); enabledPauseButton(false);
mActiveCallHeader = (RelativeLayout) findViewById(R.id.active_call); mActiveCallHeader = findViewById(R.id.active_call);
mNoCurrentCall = (LinearLayout) findViewById(R.id.no_current_call); mNoCurrentCall = findViewById(R.id.no_current_call);
mCallPaused = (LinearLayout) findViewById(R.id.remote_pause); mCallPaused = findViewById(R.id.remote_pause);
contactPicture = (ImageView) findViewById(R.id.contact_picture); contactPicture = findViewById(R.id.contact_picture);
avatar_layout = (RelativeLayout) findViewById(R.id.avatar_layout); avatar_layout = findViewById(R.id.avatar_layout);
//Options //Options
addCall = (ImageView) findViewById(R.id.add_call); addCall = findViewById(R.id.add_call);
addCall.setOnClickListener(this); addCall.setOnClickListener(this);
addCall.setEnabled(false); addCall.setEnabled(false);
transfer = (ImageView) findViewById(R.id.transfer); transfer = findViewById(R.id.transfer);
transfer.setOnClickListener(this); transfer.setOnClickListener(this);
transfer.setEnabled(false); transfer.setEnabled(false);
conference = (ImageView) findViewById(R.id.conference); conference = findViewById(R.id.conference);
conference.setEnabled(false); conference.setEnabled(false);
conference.setOnClickListener(this); conference.setOnClickListener(this);
try { try {
audioRoute = (ImageView) findViewById(R.id.audio_route); audioRoute = findViewById(R.id.audio_route);
audioRoute.setOnClickListener(this); audioRoute.setOnClickListener(this);
routeSpeaker = (ImageView) findViewById(R.id.route_speaker); routeSpeaker = findViewById(R.id.route_speaker);
routeSpeaker.setOnClickListener(this); routeSpeaker.setOnClickListener(this);
routeEarpiece = (ImageView) findViewById(R.id.route_earpiece); routeEarpiece = findViewById(R.id.route_earpiece);
routeEarpiece.setOnClickListener(this); routeEarpiece.setOnClickListener(this);
routeBluetooth = (ImageView) findViewById(R.id.route_bluetooth); routeBluetooth = findViewById(R.id.route_bluetooth);
routeBluetooth.setOnClickListener(this); routeBluetooth.setOnClickListener(this);
} catch (NullPointerException npe) { } catch (NullPointerException npe) {
Log.e("Bluetooth: Audio routes menu disabled on tablets for now (1)"); Log.e("Bluetooth: Audio routes menu disabled on tablets for now (1)");
} }
switchCamera = (ImageView) findViewById(R.id.switchCamera); switchCamera = findViewById(R.id.switchCamera);
switchCamera.setOnClickListener(this); switchCamera.setOnClickListener(this);
mControlsLayout = (LinearLayout) findViewById(R.id.menu); mControlsLayout = findViewById(R.id.menu);
if (!isTransferAllowed) { if (!isTransferAllowed) {
addCall.setBackgroundResource(R.drawable.options_add_call); addCall.setBackgroundResource(R.drawable.options_add_call);
@ -505,10 +497,10 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
} }
public void createInCallStats() { public void createInCallStats() {
sideMenu = (DrawerLayout) findViewById(R.id.side_menu); sideMenu = findViewById(R.id.side_menu);
menu = (ImageView) findViewById(R.id.call_quality); menu = findViewById(R.id.call_quality);
sideMenuContent = (RelativeLayout) findViewById(R.id.side_menu_content); sideMenuContent = findViewById(R.id.side_menu_content);
menu.setOnClickListener(new OnClickListener() { menu.setOnClickListener(new OnClickListener() {
@Override @Override
@ -796,7 +788,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
LayoutInflater inflater = getLayoutInflater(); LayoutInflater inflater = getLayoutInflater();
View layout = inflater.inflate(R.layout.toast, (ViewGroup) findViewById(R.id.toastRoot)); View layout = inflater.inflate(R.layout.toast, (ViewGroup) findViewById(R.id.toastRoot));
TextView toastText = (TextView) layout.findViewById(R.id.toastMessage); TextView toastText = layout.findViewById(R.id.toastMessage);
toastText.setText(message); toastText.setText(message);
final Toast toast = new Toast(getApplicationContext()); final Toast toast = new Toast(getApplicationContext());
@ -1158,11 +1150,11 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
dialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT,WindowManager.LayoutParams.MATCH_PARENT); dialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT,WindowManager.LayoutParams.MATCH_PARENT);
dialog.getWindow().setBackgroundDrawable(d); dialog.getWindow().setBackgroundDrawable(d);
TextView customText = (TextView) dialog.findViewById(R.id.customText); TextView customText = dialog.findViewById(R.id.customText);
customText.setText(getResources().getString(R.string.add_video_dialog)); customText.setText(getResources().getString(R.string.add_video_dialog));
Button delete = (Button) dialog.findViewById(R.id.delete_button); Button delete = dialog.findViewById(R.id.delete_button);
delete.setText(R.string.accept); delete.setText(R.string.accept);
Button cancel = (Button) dialog.findViewById(R.id.cancel); Button cancel = dialog.findViewById(R.id.cancel);
cancel.setText(R.string.decline); cancel.setText(R.string.decline);
isVideoAsk = true; isVideoAsk = true;
@ -1331,7 +1323,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
//CALL INFORMATION //CALL INFORMATION
private void displayCurrentCall(Call call){ private void displayCurrentCall(Call call){
Address lAddress = call.getRemoteAddress(); Address lAddress = call.getRemoteAddress();
TextView contactName = (TextView) findViewById(R.id.current_contact_name); TextView contactName = findViewById(R.id.current_contact_name);
setContactInformation(contactName, contactPicture, lAddress); setContactInformation(contactName, contactPicture, lAddress);
registerCallDurationTimer(null, call); registerCallDurationTimer(null, call);
} }
@ -1353,8 +1345,8 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
callView = (LinearLayout) inflater.inflate(R.layout.call_inactive_row, container, false); callView = (LinearLayout) inflater.inflate(R.layout.call_inactive_row, container, false);
callView.setId(index+1); callView.setId(index+1);
TextView contactName = (TextView) callView.findViewById(R.id.contact_name); TextView contactName = callView.findViewById(R.id.contact_name);
ImageView contactImage = (ImageView) callView.findViewById(R.id.contact_picture); ImageView contactImage = callView.findViewById(R.id.contact_picture);
Address lAddress = call.getRemoteAddress(); Address lAddress = call.getRemoteAddress();
setContactInformation(contactName, contactImage, lAddress); setContactInformation(contactName, contactImage, lAddress);
@ -1377,7 +1369,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
private boolean displayCallStatusIconAndReturnCallPaused(LinearLayout callView, Call call) { private boolean displayCallStatusIconAndReturnCallPaused(LinearLayout callView, Call call) {
boolean isCallPaused, isInConference; boolean isCallPaused, isInConference;
ImageView onCallStateChanged = (ImageView) callView.findViewById(R.id.call_pause); ImageView onCallStateChanged = callView.findViewById(R.id.call_pause);
onCallStateChanged.setTag(call); onCallStateChanged.setTag(call);
onCallStateChanged.setOnClickListener(this); onCallStateChanged.setOnClickListener(this);
@ -1404,9 +1396,9 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
Chronometer timer; Chronometer timer;
if(v == null){ if(v == null){
timer = (Chronometer) findViewById(R.id.current_call_timer); timer = findViewById(R.id.current_call_timer);
} else { } else {
timer = (Chronometer) v.findViewById(R.id.call_timer); timer = v.findViewById(R.id.call_timer);
} }
if (timer == null) { if (timer == null) {
@ -1510,7 +1502,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
public void pauseOrResumeConference() { public void pauseOrResumeConference() {
Core lc = LinphoneManager.getLc(); Core lc = LinphoneManager.getLc();
conferenceStatus = (ImageView) findViewById(R.id.conference_pause); conferenceStatus = findViewById(R.id.conference_pause);
if(conferenceStatus != null) { if(conferenceStatus != null) {
if (lc.isInConference()) { if (lc.isInConference()) {
conferenceStatus.setImageResource(R.drawable.pause_big_over_selected); conferenceStatus.setImageResource(R.drawable.pause_big_over_selected);
@ -1526,7 +1518,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
private void displayConferenceParticipant(int index, final Call call){ private void displayConferenceParticipant(int index, final Call call){
LinearLayout confView = (LinearLayout) inflater.inflate(R.layout.conf_call_control_row, container, false); LinearLayout confView = (LinearLayout) inflater.inflate(R.layout.conf_call_control_row, container, false);
conferenceList.setId(index + 1); conferenceList.setId(index + 1);
TextView contact = (TextView) confView.findViewById(R.id.contactNameOrNumber); TextView contact = confView.findViewById(R.id.contactNameOrNumber);
LinphoneContact lContact = ContactsManager.getInstance().findContactFromAddress(call.getRemoteAddress()); LinphoneContact lContact = ContactsManager.getInstance().findContactFromAddress(call.getRemoteAddress());
if (lContact == null) { if (lContact == null) {
@ -1537,7 +1529,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
registerCallDurationTimer(confView, call); registerCallDurationTimer(confView, call);
ImageView quitConference = (ImageView) confView.findViewById(R.id.quitConference); ImageView quitConference = confView.findViewById(R.id.quitConference);
quitConference.setOnClickListener(new OnClickListener() { quitConference.setOnClickListener(new OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
@ -1551,7 +1543,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
private void displayConferenceHeader(){ private void displayConferenceHeader(){
conferenceList.setVisibility(View.VISIBLE); conferenceList.setVisibility(View.VISIBLE);
RelativeLayout headerConference = (RelativeLayout) inflater.inflate(R.layout.conference_header, container, false); RelativeLayout headerConference = (RelativeLayout) inflater.inflate(R.layout.conference_header, container, false);
conferenceStatus = (ImageView) headerConference.findViewById(R.id.conference_pause); conferenceStatus = headerConference.findViewById(R.id.conference_pause);
conferenceStatus.setOnClickListener(this); conferenceStatus.setOnClickListener(this);
conferenceList.addView(headerConference); conferenceList.addView(headerConference);
@ -1690,32 +1682,32 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
if (call == null) return; if (call == null) return;
final TextView titleAudio = (TextView) view.findViewById(R.id.call_stats_audio); final TextView titleAudio = view.findViewById(R.id.call_stats_audio);
final TextView titleVideo = (TextView) view.findViewById(R.id.call_stats_video); final TextView titleVideo = view.findViewById(R.id.call_stats_video);
final TextView codecAudio = (TextView) view.findViewById(R.id.codec_audio); final TextView codecAudio = view.findViewById(R.id.codec_audio);
final TextView codecVideo = (TextView) view.findViewById(R.id.codec_video); final TextView codecVideo = view.findViewById(R.id.codec_video);
final TextView encoderAudio = (TextView) view.findViewById(R.id.encoder_audio); final TextView encoderAudio = view.findViewById(R.id.encoder_audio);
final TextView decoderAudio = (TextView) view.findViewById(R.id.decoder_audio); final TextView decoderAudio = view.findViewById(R.id.decoder_audio);
final TextView encoderVideo = (TextView) view.findViewById(R.id.encoder_video); final TextView encoderVideo = view.findViewById(R.id.encoder_video);
final TextView decoderVideo = (TextView) view.findViewById(R.id.decoder_video); final TextView decoderVideo = view.findViewById(R.id.decoder_video);
final TextView dlAudio = (TextView) view.findViewById(R.id.downloadBandwith_audio); final TextView dlAudio = view.findViewById(R.id.downloadBandwith_audio);
final TextView ulAudio = (TextView) view.findViewById(R.id.uploadBandwith_audio); final TextView ulAudio = view.findViewById(R.id.uploadBandwith_audio);
final TextView dlVideo = (TextView) view.findViewById(R.id.downloadBandwith_video); final TextView dlVideo = view.findViewById(R.id.downloadBandwith_video);
final TextView ulVideo = (TextView) view.findViewById(R.id.uploadBandwith_video); final TextView ulVideo = view.findViewById(R.id.uploadBandwith_video);
final TextView edlVideo = (TextView) view.findViewById(R.id.estimatedDownloadBandwidth_video); final TextView edlVideo = view.findViewById(R.id.estimatedDownloadBandwidth_video);
final TextView iceAudio = (TextView) view.findViewById(R.id.ice_audio); final TextView iceAudio = view.findViewById(R.id.ice_audio);
final TextView iceVideo = (TextView) view.findViewById(R.id.ice_video); final TextView iceVideo = view.findViewById(R.id.ice_video);
final TextView videoResolutionSent = (TextView) view.findViewById(R.id.video_resolution_sent); final TextView videoResolutionSent = view.findViewById(R.id.video_resolution_sent);
final TextView videoResolutionReceived = (TextView) view.findViewById(R.id.video_resolution_received); final TextView videoResolutionReceived = view.findViewById(R.id.video_resolution_received);
final TextView videoFpsSent = (TextView) view.findViewById(R.id.video_fps_sent); final TextView videoFpsSent = view.findViewById(R.id.video_fps_sent);
final TextView videoFpsReceived = (TextView) view.findViewById(R.id.video_fps_received); final TextView videoFpsReceived = view.findViewById(R.id.video_fps_received);
final TextView senderLossRateAudio = (TextView) view.findViewById(R.id.senderLossRateAudio); final TextView senderLossRateAudio = view.findViewById(R.id.senderLossRateAudio);
final TextView receiverLossRateAudio = (TextView) view.findViewById(R.id.receiverLossRateAudio); final TextView receiverLossRateAudio = view.findViewById(R.id.receiverLossRateAudio);
final TextView senderLossRateVideo = (TextView) view.findViewById(R.id.senderLossRateVideo); final TextView senderLossRateVideo = view.findViewById(R.id.senderLossRateVideo);
final TextView receiverLossRateVideo = (TextView) view.findViewById(R.id.receiverLossRateVideo); final TextView receiverLossRateVideo = view.findViewById(R.id.receiverLossRateVideo);
final TextView ipAudio = (TextView) view.findViewById(R.id.ip_audio); final TextView ipAudio = view.findViewById(R.id.ip_audio);
final TextView ipVideo = (TextView) view.findViewById(R.id.ip_video); final TextView ipVideo = view.findViewById(R.id.ip_video);
final TextView jitterBufferAudio = (TextView) view.findViewById(R.id.jitterBufferAudio); final TextView jitterBufferAudio = view.findViewById(R.id.jitterBufferAudio);
final View videoLayout = view.findViewById(R.id.callStatsVideo); final View videoLayout = view.findViewById(R.id.callStatsVideo);
final View audioLayout = view.findViewById(R.id.callStatsAudio); final View audioLayout = view.findViewById(R.id.callStatsAudio);

View file

@ -21,12 +21,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import android.app.Fragment; import android.app.Fragment;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.View.OnTouchListener;
import android.view.ViewGroup; import android.view.ViewGroup;
import org.linphone.call.CallActivity;
import org.linphone.R; import org.linphone.R;
public class CallAudioFragment extends Fragment { public class CallAudioFragment extends Fragment {
@ -53,48 +50,4 @@ public class CallAudioFragment extends Fragment {
incallActvityInstance.removeCallbacks(); incallActvityInstance.removeCallbacks();
} }
} }
class SwipeGestureDetector implements OnTouchListener {
static final int MIN_DISTANCE = 100;
private float downX, upX;
private boolean lock;
private SwipeListener listener;
public SwipeGestureDetector(SwipeListener swipeListener) {
super();
listener = swipeListener;
}
@Override
public boolean onTouch(View v, MotionEvent event) {
switch(event.getAction()){
case MotionEvent.ACTION_DOWN:
lock = false;
downX = event.getX();
return true;
case MotionEvent.ACTION_MOVE:
if (lock) {
return false;
}
upX = event.getX();
float deltaX = downX - upX;
if (Math.abs(deltaX) > MIN_DISTANCE) {
lock = true;
if (deltaX < 0) { listener.onLeftToRightSwipe(); return true; }
if (deltaX > 0) { listener.onRightToLeftSwipe(); return true; }
}
break;
}
return false;
}
}
interface SwipeListener {
void onRightToLeftSwipe();
void onLeftToRightSwipe();
}
} }

View file

@ -48,9 +48,6 @@ import java.util.Calendar;
import java.util.List; import java.util.List;
public class CallHistoryAdapter extends SelectableAdapter<CallHistoryAdapter.ViewHolder> { public class CallHistoryAdapter extends SelectableAdapter<CallHistoryAdapter.ViewHolder> {
//This ViewHolder links fields from the xml to variables that will display values provided by the adapter
public static class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, public static class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener,
View.OnLongClickListener{ View.OnLongClickListener{
public TextView contact; public TextView contact;
@ -61,34 +58,34 @@ public class CallHistoryAdapter extends SelectableAdapter<CallHistoryAdapter.Vie
public RelativeLayout CallContact; public RelativeLayout CallContact;
public LinearLayout separator; public LinearLayout separator;
public TextView separatorText; public TextView separatorText;
private CallHistoryAdapter.ViewHolder.ClickListener listener; private CallHistoryAdapter.ViewHolder.ClickListener mListener;
public ViewHolder(View view, CallHistoryAdapter.ViewHolder.ClickListener listener) { public ViewHolder(View view, CallHistoryAdapter.ViewHolder.ClickListener listener) {
super(view); super(view);
contact = (TextView) view.findViewById(R.id.sip_uri); contact = view.findViewById(R.id.sip_uri);
detail = (ImageView) view.findViewById(R.id.detail); detail = view.findViewById(R.id.detail);
select = (CheckBox) view.findViewById(R.id.delete); select = view.findViewById(R.id.delete);
callDirection = (ImageView) view.findViewById(R.id.icon); callDirection = view.findViewById(R.id.icon);
contactPicture = (ImageView) view.findViewById(R.id.contact_picture); contactPicture = view.findViewById(R.id.contact_picture);
CallContact = (RelativeLayout) view.findViewById(R.id.history_click); CallContact = view.findViewById(R.id.history_click);
separator = (LinearLayout) view.findViewById(R.id.separator); separator = view.findViewById(R.id.separator);
separatorText = (TextView) view.findViewById(R.id.separator_text); separatorText = view.findViewById(R.id.separator_text);
this.listener = listener; mListener = listener;
view.setOnClickListener(this); view.setOnClickListener(this);
view.setOnLongClickListener(this); view.setOnLongClickListener(this);
} }
@Override @Override
public void onClick(View view) { public void onClick(View view) {
if (listener != null) { if (mListener != null) {
listener.onItemClicked(getAdapterPosition()); mListener.onItemClicked(getAdapterPosition());
} }
} }
@Override @Override
public boolean onLongClick(View view) { public boolean onLongClick(View view) {
if (listener != null) { if (mListener != null) {
return listener.onItemLongClicked(getAdapterPosition()); return mListener.onItemLongClicked(getAdapterPosition());
} }
return false; return false;
} }

View file

@ -49,12 +49,11 @@ import org.linphone.core.CallParams;
import org.linphone.core.Core; import org.linphone.core.Core;
import org.linphone.core.CoreListenerStub; import org.linphone.core.CoreListenerStub;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
import org.linphone.ui.LinphoneSliders.LinphoneSliderTriggered;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public class CallIncomingActivity extends LinphoneGenericActivity implements LinphoneSliderTriggered { public class CallIncomingActivity extends LinphoneGenericActivity {
private static CallIncomingActivity instance; private static CallIncomingActivity instance;
private TextView name, number; private TextView name, number;
@ -86,9 +85,9 @@ public class CallIncomingActivity extends LinphoneGenericActivity implements Lin
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setContentView(R.layout.call_incoming); setContentView(R.layout.call_incoming);
name = (TextView) findViewById(R.id.contact_name); name = findViewById(R.id.contact_name);
number = (TextView) findViewById(R.id.contact_number); number = findViewById(R.id.contact_number);
contactPicture = (ImageView) findViewById(R.id.contact_picture); contactPicture = findViewById(R.id.contact_picture);
// set this flag so this activity will stay in front of the keyguard // set this flag so this activity will stay in front of the keyguard
int flags = WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON; int flags = WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON;
@ -96,18 +95,18 @@ public class CallIncomingActivity extends LinphoneGenericActivity implements Lin
final int screenWidth = getResources().getDisplayMetrics().widthPixels; final int screenWidth = getResources().getDisplayMetrics().widthPixels;
acceptUnlock = (LinearLayout) findViewById(R.id.acceptUnlock); acceptUnlock = findViewById(R.id.acceptUnlock);
declineUnlock = (LinearLayout) findViewById(R.id.declineUnlock); declineUnlock = findViewById(R.id.declineUnlock);
accept = (ImageView) findViewById(R.id.accept); accept = findViewById(R.id.accept);
lookupCurrentCall(); lookupCurrentCall();
if (LinphonePreferences.instance() != null && mCall != null && mCall.getRemoteParams() != null && if (LinphonePreferences.instance() != null && mCall != null && mCall.getRemoteParams() != null &&
LinphonePreferences.instance().shouldAutomaticallyAcceptVideoRequests() && LinphonePreferences.instance().shouldAutomaticallyAcceptVideoRequests() &&
mCall.getRemoteParams().videoEnabled()) { mCall.getRemoteParams().videoEnabled()) {
accept.setImageResource(R.drawable.call_video_start); accept.setImageResource(R.drawable.call_video_start);
} }
decline = (ImageView) findViewById(R.id.decline); decline = findViewById(R.id.decline);
arrow = (ImageView) findViewById(R.id.arrow_hangup); arrow = findViewById(R.id.arrow_hangup);
accept.setOnClickListener(new View.OnClickListener() { accept.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -118,7 +117,6 @@ public class CallIncomingActivity extends LinphoneGenericActivity implements Lin
} }
}); });
accept.setOnTouchListener(new View.OnTouchListener() { accept.setOnTouchListener(new View.OnTouchListener() {
@Override @Override
public boolean onTouch(View view, MotionEvent motionEvent) { public boolean onTouch(View view, MotionEvent motionEvent) {
@ -322,16 +320,6 @@ public class CallIncomingActivity extends LinphoneGenericActivity implements Lin
} }
} }
@Override
public void onLeftHandleTriggered() {
}
@Override
public void onRightHandleTriggered() {
}
private void checkAndRequestCallPermissions() { private void checkAndRequestCallPermissions() {
ArrayList<String> permissionsList = new ArrayList<String>(); ArrayList<String> permissionsList = new ArrayList<String>();

View file

@ -28,7 +28,6 @@ import org.linphone.core.Core;
import org.linphone.core.CoreException; import org.linphone.core.CoreException;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
/** /**
* Handle call updating, reinvites. * Handle call updating, reinvites.
*/ */
@ -97,23 +96,6 @@ public class CallManager {
return true; return true;
} }
/**
* Re-invite with parameters updated from profile.
*/
public void reinvite() {
Core lc = LinphoneManager.getLc();
Call lCall = lc.getCurrentCall();
if (lCall == null) {
Log.e("Trying to reinvite while not in call: doing nothing");
return;
}
CallParams params = lc.createCallParams(lCall);
bm().updateWithProfileSettings(lc, params);
lc.updateCall(lCall, params);
}
/** /**
* Change the preferred video size used by linphone core. (impact landscape/portrait buffer). * Change the preferred video size used by linphone core. (impact landscape/portrait buffer).
* Update current call, without reinvite. * Update current call, without reinvite.

View file

@ -82,23 +82,23 @@ public class CallOutgoingActivity extends LinphoneGenericActivity implements OnC
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setContentView(R.layout.call_outgoing); setContentView(R.layout.call_outgoing);
name = (TextView) findViewById(R.id.contact_name); name = findViewById(R.id.contact_name);
number = (TextView) findViewById(R.id.contact_number); number = findViewById(R.id.contact_number);
contactPicture = (ImageView) findViewById(R.id.contact_picture); contactPicture = findViewById(R.id.contact_picture);
isMicMuted = false; isMicMuted = false;
isSpeakerEnabled = false; isSpeakerEnabled = false;
micro = (ImageView) findViewById(R.id.micro); micro = findViewById(R.id.micro);
micro.setOnClickListener(this); micro.setOnClickListener(this);
speaker = (ImageView) findViewById(R.id.speaker); speaker = findViewById(R.id.speaker);
speaker.setOnClickListener(this); speaker.setOnClickListener(this);
// set this flag so this activity will stay in front of the keyguard // set this flag so this activity will stay in front of the keyguard
int flags = WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON; int flags = WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON;
getWindow().addFlags(flags); getWindow().addFlags(flags);
hangUp = (ImageView) findViewById(R.id.outgoing_hang_up); hangUp = findViewById(R.id.outgoing_hang_up);
hangUp.setOnClickListener(this); hangUp.setOnClickListener(this);
mListener = new CoreListenerStub(){ mListener = new CoreListenerStub(){
@ -255,7 +255,7 @@ public class CallOutgoingActivity extends LinphoneGenericActivity implements OnC
LayoutInflater inflater = getLayoutInflater(); LayoutInflater inflater = getLayoutInflater();
View layout = inflater.inflate(R.layout.toast, (ViewGroup) findViewById(R.id.toastRoot)); View layout = inflater.inflate(R.layout.toast, (ViewGroup) findViewById(R.id.toastRoot));
TextView toastText = (TextView) layout.findViewById(R.id.toastMessage); TextView toastText = layout.findViewById(R.id.toastMessage);
toastText.setText(message); toastText.setText(message);
final Toast toast = new Toast(getApplicationContext()); final Toast toast = new Toast(getApplicationContext());

View file

@ -34,7 +34,6 @@ import org.linphone.mediastream.Log;
import org.linphone.mediastream.video.AndroidVideoWindowImpl; import org.linphone.mediastream.video.AndroidVideoWindowImpl;
import android.app.Fragment; import android.app.Fragment;
import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.view.GestureDetector; import android.view.GestureDetector;
@ -71,8 +70,8 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
view = inflater.inflate(R.layout.video, container, false); view = inflater.inflate(R.layout.video, container, false);
} }
mVideoView = (SurfaceView) view.findViewById(R.id.videoSurface); mVideoView = view.findViewById(R.id.videoSurface);
mCaptureView = (SurfaceView) view.findViewById(R.id.videoCaptureSurface); mCaptureView = view.findViewById(R.id.videoCaptureSurface);
mCaptureView.getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); // Warning useless because value is ignored and automatically set by new APIs. mCaptureView.getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); // Warning useless because value is ignored and automatically set by new APIs.
fixZOrder(mVideoView, mCaptureView); fixZOrder(mVideoView, mCaptureView);

View file

@ -64,7 +64,7 @@ public class ChatBubbleViewHolder extends RecyclerView.ViewHolder implements Vie
public Button openFileButton; public Button openFileButton;
public CheckBox delete; public CheckBox delete;
private ClickListener listener; private ClickListener mListener;
public ChatBubbleViewHolder(Context context, View view, ClickListener listener) { public ChatBubbleViewHolder(Context context, View view, ClickListener listener) {
super(view); super(view);
@ -99,7 +99,7 @@ public class ChatBubbleViewHolder extends RecyclerView.ViewHolder implements Vie
delete = view.findViewById(R.id.delete_message); delete = view.findViewById(R.id.delete_message);
listener = listener; mListener = listener;
view.setOnClickListener(this); view.setOnClickListener(this);
} }
@ -136,8 +136,8 @@ public class ChatBubbleViewHolder extends RecyclerView.ViewHolder implements Vie
} }
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (listener != null) { if (mListener != null) {
listener.onItemClicked(getAdapterPosition()); mListener.onItemClicked(getAdapterPosition());
} }
} }

View file

@ -144,14 +144,10 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
} }
}); });
//Declares the layout manager, allowing customization of RecyclerView displaying
LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity().getApplicationContext()); LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity().getApplicationContext());
mContactsList.setAdapter(mSearchAdapter); mContactsList.setAdapter(mSearchAdapter);
//Divider between items + binds layout manager to our RecyclerView
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mContactsList.getContext(), DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mContactsList.getContext(),
layoutManager.getOrientation()); layoutManager.getOrientation());
dividerItemDecoration.setDrawable(getActivity().getApplicationContext().getResources().getDrawable(R.drawable.divider)); dividerItemDecoration.setDrawable(getActivity().getApplicationContext().getResources().getDrawable(R.drawable.divider));
@ -159,8 +155,6 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
mContactsList.setLayoutManager(layoutManager); mContactsList.setLayoutManager(layoutManager);
if (savedInstanceState != null && savedInstanceState.getStringArrayList("mContactsSelected") != null) { if (savedInstanceState != null && savedInstanceState.getStringArrayList("mContactsSelected") != null) {
mContactsSelectedLayout.removeAllViews(); mContactsSelectedLayout.removeAllViews();
// We need to get all contacts not only sip // We need to get all contacts not only sip
@ -361,8 +355,6 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
} }
//Removed all selection mode related code, as it is now located into SelectableHelper.
@Override @Override
public void onClick(View view) { public void onClick(View view) {
int id = view.getId(); int id = view.getId();

View file

@ -73,7 +73,6 @@ import java.util.List;
import static android.content.Intent.FLAG_GRANT_READ_URI_PERMISSION; import static android.content.Intent.FLAG_GRANT_READ_URI_PERMISSION;
public class ChatEventsAdapter extends SelectableAdapter<ChatBubbleViewHolder> { public class ChatEventsAdapter extends SelectableAdapter<ChatBubbleViewHolder> {
private static int MARGIN_BETWEEN_MESSAGES = 10; private static int MARGIN_BETWEEN_MESSAGES = 10;
@ -606,7 +605,7 @@ public class ChatEventsAdapter extends SelectableAdapter<ChatBubbleViewHolder> {
public AsyncBitmap(Resources res, Bitmap bitmap, BitmapWorkerTask bitmapWorkerTask) { public AsyncBitmap(Resources res, Bitmap bitmap, BitmapWorkerTask bitmapWorkerTask) {
super(res, bitmap); super(res, bitmap);
bitmapWorkerTaskReference = new WeakReference<BitmapWorkerTask>(bitmapWorkerTask); bitmapWorkerTaskReference = new WeakReference<>(bitmapWorkerTask);
} }
public BitmapWorkerTask getBitmapWorkerTask() { public BitmapWorkerTask getBitmapWorkerTask() {

View file

@ -52,7 +52,7 @@ import java.util.List;
import static org.linphone.fragments.FragmentsAvailable.CHAT_LIST; import static org.linphone.fragments.FragmentsAvailable.CHAT_LIST;
public class ChatListFragment extends Fragment implements ContactsUpdatedListener, ChatRoomsAdapter.ChatRoomViewHolder.ClickListener, SelectableHelper.DeleteListener { public class ChatListFragment extends Fragment implements ContactsUpdatedListener, ChatRoomViewHolder.ClickListener, SelectableHelper.DeleteListener {
private RecyclerView mChatRoomsList; private RecyclerView mChatRoomsList;
private ImageView mNewDiscussionButton, mBackToCallButton; private ImageView mNewDiscussionButton, mBackToCallButton;
@ -212,7 +212,6 @@ public class ChatListFragment extends Fragment implements ContactsUpdatedListene
ContactsManager.removeContactsListener(this); ContactsManager.removeContactsListener(this);
mChatRoomsAdapter.clear(); mChatRoomsAdapter.clear();
super.onPause(); super.onPause();
} }
@Override @Override

View file

@ -0,0 +1,151 @@
/*
ChatRoomViewHolder.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.
*/
package org.linphone.chat;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.TextView;
import org.linphone.LinphoneManager;
import org.linphone.LinphoneUtils;
import org.linphone.R;
import org.linphone.activities.LinphoneActivity;
import org.linphone.contacts.ContactsManager;
import org.linphone.contacts.LinphoneContact;
import org.linphone.core.Address;
import org.linphone.core.ChatRoom;
import org.linphone.core.ChatRoomCapabilities;
public class ChatRoomViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener {
private Bitmap mDefaultBitmap;
private Bitmap mDefaultGroupBitmap;
public TextView lastMessageSenderView;
public TextView lastMessageView;
public TextView date;
public TextView displayName;
public TextView unreadMessages;
public CheckBox delete;
public ImageView contactPicture;
public Context mContext;
public ChatRoom mRoom;
private ClickListener mListener;
public ChatRoomViewHolder(Context context,View itemView, ClickListener listener) {
super(itemView);
mDefaultBitmap = ContactsManager.getInstance().getDefaultAvatarBitmap();
mDefaultGroupBitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.chat_group_avatar);
mContext = context;
lastMessageSenderView = itemView.findViewById(R.id.lastMessageSender);
lastMessageView = itemView.findViewById(R.id.lastMessage);
date = itemView.findViewById(R.id.date);
displayName = itemView.findViewById(R.id.sipUri);
unreadMessages = itemView.findViewById(R.id.unreadMessages);
delete = itemView.findViewById(R.id.delete_chatroom);
contactPicture = itemView.findViewById(R.id.contact_picture);
mListener = listener;
itemView.setOnClickListener(this);
itemView.setOnLongClickListener(this);
}
public void bindChatRoom(ChatRoom room) {
mRoom = room;
lastMessageSenderView.setText(getSender(mRoom));
lastMessageView.setText(mRoom.getLastMessageInHistory() != null ? mRoom.getLastMessageInHistory().getTextContent(): "");
date.setText(mRoom.getLastMessageInHistory() != null ? LinphoneUtils.timestampToHumanDate(mContext, mRoom.getLastUpdateTime(), R.string.messages_list_date_format) : "");
displayName.setText(getContact(mRoom));
unreadMessages.setText(String.valueOf(LinphoneManager.getInstance().getUnreadCountForChatRoom(mRoom)));
getAvatar(mRoom);
}
public void onClick(View v) {
if (mListener != null) {
mListener.onItemClicked(getAdapterPosition());
}
}
public boolean onLongClick(View v) {
if (mListener != null) {
return mListener.onItemLongClicked(getAdapterPosition());
}
return false;
}
public String getSender(ChatRoom mRoom){
if (mRoom.getLastMessageInHistory() != null) {
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(mRoom.getLastMessageInHistory().getFromAddress());
if (contact != null) {
return (contact.getFullName() + mContext.getString(R.string.separator));
}
return (LinphoneUtils.getAddressDisplayName(mRoom.getLastMessageInHistory().getFromAddress()) + mContext.getString(R.string.separator));
}
return null;
}
public String getContact(ChatRoom mRoom) {
Address contactAddress = mRoom.getPeerAddress();
if (mRoom.hasCapability(ChatRoomCapabilities.OneToOne.toInt()) && mRoom.getParticipants().length > 0) {
contactAddress = mRoom.getParticipants()[0].getAddress();
}
if (mRoom.hasCapability(ChatRoomCapabilities.OneToOne.toInt())) {
LinphoneContact contact;
if (mRoom.getParticipants().length > 0) {
contact = ContactsManager.getInstance().findContactFromAddress(mRoom.getParticipants()[0].getAddress());
if (contact != null) {
return (contact.getFullName());
}
return (LinphoneUtils.getAddressDisplayName(mRoom.getParticipants()[0].getAddress()));
} else {
contact = ContactsManager.getInstance().findContactFromAddress(contactAddress);
if (contact != null) {
return (contact.getFullName());
}
return (LinphoneUtils.getAddressDisplayName(contactAddress));
}
}
return (mRoom.getSubject());
}
public void getAvatar(ChatRoom mRoom) {
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(mRoom.getPeerAddress());
if (contact != null) {
LinphoneUtils.setThumbnailPictureFromUri(LinphoneActivity.instance(), contactPicture, ContactsManager.getInstance().findContactFromAddress(mRoom.getPeerAddress()).getThumbnailUri());
} else {
if (mRoom.hasCapability(ChatRoomCapabilities.OneToOne.toInt()))
contactPicture.setImageBitmap(mDefaultBitmap);
else
contactPicture.setImageBitmap(mDefaultGroupBitmap);
}
}
public interface ClickListener {
void onItemClicked(int position);
boolean onItemLongClicked(int position);
}
}

View file

@ -20,25 +20,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
package org.linphone.chat; package org.linphone.chat;
import android.content.Context; import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.TextView;
import org.linphone.LinphoneManager; import org.linphone.LinphoneManager;
import org.linphone.LinphoneUtils;
import org.linphone.R;
import org.linphone.activities.LinphoneActivity;
import org.linphone.contacts.ContactsManager;
import org.linphone.contacts.LinphoneContact;
import org.linphone.core.Address;
import org.linphone.core.ChatRoom; import org.linphone.core.ChatRoom;
import org.linphone.core.ChatRoomCapabilities;
import org.linphone.ui.SelectableAdapter; import org.linphone.ui.SelectableAdapter;
import org.linphone.ui.SelectableHelper; import org.linphone.ui.SelectableHelper;
@ -48,117 +35,9 @@ import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
public class ChatRoomsAdapter extends SelectableAdapter<ChatRoomsAdapter.ChatRoomViewHolder> { public class ChatRoomsAdapter extends SelectableAdapter<ChatRoomViewHolder> {
public static class ChatRoomViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener{
public TextView lastMessageSenderView;
public TextView lastMessageView;
public TextView date;
public TextView displayName;
public TextView unreadMessages;
public CheckBox delete;
public ImageView contactPicture;
public Context mContext;
public ChatRoom mRoom;
private ClickListener mListener;
public ChatRoomViewHolder(Context context,View itemView, ClickListener listener) {
super(itemView);
mContext = context;
lastMessageSenderView = itemView.findViewById(R.id.lastMessageSender);
lastMessageView = itemView.findViewById(R.id.lastMessage);
date = itemView.findViewById(R.id.date);
displayName = itemView.findViewById(R.id.sipUri);
unreadMessages = itemView.findViewById(R.id.unreadMessages);
delete = itemView.findViewById(R.id.delete_chatroom);
contactPicture = itemView.findViewById(R.id.contact_picture);
mListener = listener;
itemView.setOnClickListener(this);
itemView.setOnLongClickListener(this);
}
public void bindChatRoom(ChatRoom room) {
mRoom = room;
lastMessageSenderView.setText(getSender(mRoom));
lastMessageView.setText(mRoom.getLastMessageInHistory() != null ? mRoom.getLastMessageInHistory().getTextContent(): "");
date.setText(mRoom.getLastMessageInHistory() != null ? LinphoneUtils.timestampToHumanDate(mContext, mRoom.getLastUpdateTime(), R.string.messages_list_date_format) : "");
displayName.setText(getContact(mRoom));
unreadMessages.setText(String.valueOf(LinphoneManager.getInstance().getUnreadCountForChatRoom(mRoom)));
getAvatar(mRoom);
}
public void onClick(View v) {
if (mListener != null) {
mListener.onItemClicked(getAdapterPosition());
}
}
public boolean onLongClick(View v) {
if (mListener != null) {
return mListener.onItemLongClicked(getAdapterPosition());
}
return false;
}
public String getSender(ChatRoom mRoom){
if (mRoom.getLastMessageInHistory() != null) {
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(mRoom.getLastMessageInHistory().getFromAddress());
if (contact != null) {
return (contact.getFullName() + mContext.getString(R.string.separator));
}
return (LinphoneUtils.getAddressDisplayName(mRoom.getLastMessageInHistory().getFromAddress()) + mContext.getString(R.string.separator));
}
return null;
}
public String getContact(ChatRoom mRoom) {
Address contactAddress = mRoom.getPeerAddress();
if (mRoom.hasCapability(ChatRoomCapabilities.OneToOne.toInt()) && mRoom.getParticipants().length > 0) {
contactAddress = mRoom.getParticipants()[0].getAddress();
}
if (mRoom.hasCapability(ChatRoomCapabilities.OneToOne.toInt())) {
LinphoneContact contact;
if (mRoom.getParticipants().length > 0) {
contact = ContactsManager.getInstance().findContactFromAddress(mRoom.getParticipants()[0].getAddress());
if (contact != null) {
return (contact.getFullName());
}
return (LinphoneUtils.getAddressDisplayName(mRoom.getParticipants()[0].getAddress()));
} else {
contact = ContactsManager.getInstance().findContactFromAddress(contactAddress);
if (contact != null) {
return (contact.getFullName());
}
return (LinphoneUtils.getAddressDisplayName(contactAddress));
}
}
return (mRoom.getSubject());
}
public void getAvatar(ChatRoom mRoom) {
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(mRoom.getPeerAddress());
if (contact != null) {
LinphoneUtils.setThumbnailPictureFromUri(LinphoneActivity.instance(), contactPicture, ContactsManager.getInstance().findContactFromAddress(mRoom.getPeerAddress()).getThumbnailUri());
} else {
if (mRoom.hasCapability(ChatRoomCapabilities.OneToOne.toInt()))
contactPicture.setImageBitmap(mDefaultBitmap);
else
contactPicture.setImageBitmap(mDefaultGroupBitmap);
}
}
public interface ClickListener {
void onItemClicked(int position);
boolean onItemLongClicked(int position);
}
}
private Context mContext; private Context mContext;
public List<ChatRoom> mRooms; public List<ChatRoom> mRooms;
private static Bitmap mDefaultBitmap;
private static Bitmap mDefaultGroupBitmap;
private int mItemResource; private int mItemResource;
private ChatRoomViewHolder.ClickListener mClickListener; private ChatRoomViewHolder.ClickListener mClickListener;
@ -168,8 +47,6 @@ public class ChatRoomsAdapter extends SelectableAdapter<ChatRoomsAdapter.ChatRoo
mRooms = rooms; mRooms = rooms;
mContext = context; mContext = context;
mItemResource = itemResource; mItemResource = itemResource;
mDefaultBitmap = ContactsManager.getInstance().getDefaultAvatarBitmap();
mDefaultGroupBitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.chat_group_avatar);
} }
@Override @Override

View file

@ -24,7 +24,6 @@ import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
@ -34,7 +33,6 @@ import org.linphone.R;
import org.linphone.activities.LinphoneActivity; import org.linphone.activities.LinphoneActivity;
import org.linphone.contacts.ContactAddress; import org.linphone.contacts.ContactAddress;
import org.linphone.contacts.LinphoneContact; import org.linphone.contacts.LinphoneContact;
import org.linphone.contacts.SearchContactsListAdapter;
import org.linphone.core.ChatRoom; import org.linphone.core.ChatRoom;
import org.linphone.core.Participant; import org.linphone.core.Participant;
@ -43,14 +41,13 @@ import java.util.List;
public class GroupInfoAdapter extends RecyclerView.Adapter<GroupInfoAdapter.ViewHolder> { public class GroupInfoAdapter extends RecyclerView.Adapter<GroupInfoAdapter.ViewHolder> {
public static class ViewHolder extends RecyclerView.ViewHolder{ public static class ViewHolder extends RecyclerView.ViewHolder {
public TextView name; public TextView name;
public ImageView avatar; public ImageView avatar;
public ImageView delete; public ImageView delete;
public LinearLayout isAdmin; public LinearLayout isAdmin;
public LinearLayout isNotAdmin; public LinearLayout isNotAdmin;
public ViewHolder(View view) { public ViewHolder(View view) {
super(view); super(view);
name = view.findViewById(R.id.name); name = view.findViewById(R.id.name);
@ -59,14 +56,12 @@ public class GroupInfoAdapter extends RecyclerView.Adapter<GroupInfoAdapter.View
isAdmin = view.findViewById(R.id.isAdminLayout); isAdmin = view.findViewById(R.id.isAdminLayout);
isNotAdmin = view.findViewById(R.id.isNotAdminLayout); isNotAdmin = view.findViewById(R.id.isNotAdminLayout);
} }
} }
private List<ContactAddress> mItems; private List<ContactAddress> mItems;
private View.OnClickListener mDeleteListener; private View.OnClickListener mDeleteListener;
private boolean mHideAdminFeatures; private boolean mHideAdminFeatures;
private ChatRoom mChatRoom; private ChatRoom mChatRoom;
private ImageView mAavatar;
public GroupInfoAdapter(List<ContactAddress> items, boolean hideAdminFeatures, boolean isCreation) { public GroupInfoAdapter(List<ContactAddress> items, boolean hideAdminFeatures, boolean isCreation) {
mItems = items; mItems = items;
@ -84,11 +79,11 @@ public class GroupInfoAdapter extends RecyclerView.Adapter<GroupInfoAdapter.View
public void onBindViewHolder(@NonNull final ViewHolder holder, int position) { public void onBindViewHolder(@NonNull final ViewHolder holder, int position) {
final ContactAddress ca = (ContactAddress)getItem(position); final ContactAddress ca = (ContactAddress)getItem(position);
LinphoneContact c = ca.getContact(); LinphoneContact c = ca.getContact();
mAavatar = holder.avatar; ImageView avatar = holder.avatar;
holder.name.setText((c.getFullName() != null) ? c.getFullName() : holder.name.setText((c.getFullName() != null) ? c.getFullName() :
(ca.getDisplayName() != null) ? ca.getDisplayName() : ca.getUsername()); (ca.getDisplayName() != null) ? ca.getDisplayName() : ca.getUsername());
if (c.hasPhoto()) { if (c.hasPhoto()) {
LinphoneUtils.setThumbnailPictureFromUri(LinphoneActivity.instance(), mAavatar, c.getThumbnailUri()); LinphoneUtils.setThumbnailPictureFromUri(LinphoneActivity.instance(), avatar, c.getThumbnailUri());
} }
holder.delete.setOnClickListener(new View.OnClickListener() { holder.delete.setOnClickListener(new View.OnClickListener() {

View file

@ -413,6 +413,22 @@ public class GroupInfoFragment extends Fragment implements ChatRoomListener {
mAdminStateChangedDialog.show(); mAdminStateChangedDialog.show();
} }
@Override
public void onParticipantAdminStatusChanged(ChatRoom cr, EventLog event_log) {
if (mChatRoom.getMe().isAdmin() != mIsEditionEnabled) {
// Either we weren't admin and we are now or the other way around
mIsEditionEnabled = mChatRoom.getMe().isAdmin();
displayMeAdminStatusUpdated();
refreshAdminRights();
}
refreshParticipantsList();
}
@Override
public void onSubjectChanged(ChatRoom cr, EventLog event_log) {
mSubjectField.setText(event_log.getSubject());
}
@Override @Override
public void onConferenceJoined(ChatRoom cr, EventLog event_log) { public void onConferenceJoined(ChatRoom cr, EventLog event_log) {
} }
@ -441,22 +457,6 @@ public class GroupInfoFragment extends Fragment implements ChatRoomListener {
} }
@Override
public void onParticipantAdminStatusChanged(ChatRoom cr, EventLog event_log) {
if (mChatRoom.getMe().isAdmin() != mIsEditionEnabled) {
// Either we weren't admin and we are now or the other way around
mIsEditionEnabled = mChatRoom.getMe().isAdmin();
displayMeAdminStatusUpdated();
refreshAdminRights();
}
refreshParticipantsList();
}
@Override
public void onSubjectChanged(ChatRoom cr, EventLog event_log) {
mSubjectField.setText(event_log.getSubject());
}
@Override @Override
public void onIsComposingReceived(ChatRoom cr, Address remoteAddr, boolean isComposing) { public void onIsComposingReceived(ChatRoom cr, Address remoteAddr, boolean isComposing) {

View file

@ -20,7 +20,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
package org.linphone.chat; package org.linphone.chat;
import android.app.Fragment; import android.app.Fragment;
import android.media.Image;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.text.Spanned; import android.text.Spanned;

View file

@ -119,7 +119,6 @@ public class ContactEditorFragment extends Fragment {
sipAddressesSection.setVisibility(View.GONE); sipAddressesSection.setVisibility(View.GONE);
} }
deleteContact = (ImageView) view.findViewById(R.id.delete_contact); deleteContact = (ImageView) view.findViewById(R.id.delete_contact);
cancel = (ImageView) view.findViewById(R.id.cancel); cancel = (ImageView) view.findViewById(R.id.cancel);

View file

@ -44,9 +44,7 @@ import java.util.Locale;
import java.util.Map; import java.util.Map;
public class ContactsListAdapter extends SelectableAdapter<ContactsListAdapter.ViewHolder> implements SectionIndexer { public class ContactsListAdapter extends SelectableAdapter<ContactsListAdapter.ViewHolder> implements SectionIndexer {
public static class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener {
public static class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener{
public CheckBox delete; public CheckBox delete;
public ImageView linphoneFriend; public ImageView linphoneFriend;
public TextView name; public TextView name;
@ -60,14 +58,14 @@ public class ContactsListAdapter extends SelectableAdapter<ContactsListAdapter.V
private ViewHolder(View view, ClickListener listener) { private ViewHolder(View view, ClickListener listener) {
super(view); super(view);
delete = (CheckBox) view.findViewById(R.id.delete); delete = view.findViewById(R.id.delete);
linphoneFriend = (ImageView) view.findViewById(R.id.friendLinphone); linphoneFriend = view.findViewById(R.id.friendLinphone);
name = (TextView) view.findViewById(R.id.name); name = view.findViewById(R.id.name);
separator = (LinearLayout) view.findViewById(R.id.separator); separator = view.findViewById(R.id.separator);
separatorText = (TextView) view.findViewById(R.id.separator_text); separatorText = view.findViewById(R.id.separator_text);
contactPicture = (ImageView) view.findViewById(R.id.contact_picture); contactPicture = view.findViewById(R.id.contact_picture);
organization = (TextView) view.findViewById(R.id.contactOrganization); organization = view.findViewById(R.id.contactOrganization);
//friendStatus = (ImageView) view.findViewById(R.id.friendStatus); //friendStatus = view.findViewById(R.id.friendStatus);
mListener = listener; mListener = listener;
view.setOnClickListener(this); view.setOnClickListener(this);
view.setOnLongClickListener(this); view.setOnLongClickListener(this);
@ -96,7 +94,7 @@ public class ContactsListAdapter extends SelectableAdapter<ContactsListAdapter.V
private List<LinphoneContact> mContacts; private List<LinphoneContact> mContacts;
private String[] mSections; private String[] mSections;
private ArrayList<String> mSectionsList; private ArrayList<String> mSectionsList;
private Map<String, Integer> mMap = new LinkedHashMap<String, Integer>(); private Map<String, Integer> mMap = new LinkedHashMap<>();
private ViewHolder.ClickListener mClickListener; private ViewHolder.ClickListener mClickListener;
private Context mContext; private Context mContext;
private boolean mIsSearchMode; private boolean mIsSearchMode;
@ -169,7 +167,7 @@ public class ContactsListAdapter extends SelectableAdapter<ContactsListAdapter.V
public void updateDataSet(List<LinphoneContact> contactsList) { public void updateDataSet(List<LinphoneContact> contactsList) {
mContacts = contactsList; mContacts = contactsList;
mMap = new LinkedHashMap<String, Integer>(); mMap = new LinkedHashMap<>();
String prevLetter = null; String prevLetter = null;
for (int i = 0; i < mContacts.size(); i++) { for (int i = 0; i < mContacts.size(); i++) {
LinphoneContact contact = mContacts.get(i); LinphoneContact contact = mContacts.get(i);
@ -183,7 +181,7 @@ public class ContactsListAdapter extends SelectableAdapter<ContactsListAdapter.V
mMap.put(firstLetter, i); mMap.put(firstLetter, i);
} }
} }
mSectionsList = new ArrayList<String>(mMap.keySet()); mSectionsList = new ArrayList<>(mMap.keySet());
mSections = new String[mSectionsList.size()]; mSections = new String[mSectionsList.size()];
mSectionsList.toArray(mSections); mSectionsList.toArray(mSections);

View file

@ -78,17 +78,17 @@ public class ContactsListFragment extends Fragment implements OnItemClickListene
onlyDisplayChatAddress = getArguments().getBoolean("ChatAddressOnly"); onlyDisplayChatAddress = getArguments().getBoolean("ChatAddressOnly");
} }
noSipContact = (TextView) view.findViewById(R.id.noSipContact); noSipContact = view.findViewById(R.id.noSipContact);
noContact = (TextView) view.findViewById(R.id.noContact); noContact = view.findViewById(R.id.noContact);
contactsList = view.findViewById(R.id.contactsList); contactsList = view.findViewById(R.id.contactsList);
allContacts = (ImageView) view.findViewById(R.id.all_contacts); allContacts = view.findViewById(R.id.all_contacts);
linphoneContacts = (ImageView) view.findViewById(R.id.linphone_contacts); linphoneContacts = view.findViewById(R.id.linphone_contacts);
allContactsSelected = view.findViewById(R.id.all_contacts_select); allContactsSelected = view.findViewById(R.id.all_contacts_select);
linphoneContactsSelected = view.findViewById(R.id.linphone_contacts_select); linphoneContactsSelected = view.findViewById(R.id.linphone_contacts_select);
edit = (ImageView) view.findViewById(R.id.edit); edit = view.findViewById(R.id.edit);
contactsFetchInProgress = (ProgressBar) view.findViewById(R.id.contactsFetchInProgress); contactsFetchInProgress = view.findViewById(R.id.contactsFetchInProgress);
newContact = (ImageView) view.findViewById(R.id.newContact); newContact = view.findViewById(R.id.newContact);
allContacts.setOnClickListener(new View.OnClickListener() { allContacts.setOnClickListener(new View.OnClickListener() {
@Override @Override
@ -131,7 +131,7 @@ public class ContactsListFragment extends Fragment implements OnItemClickListene
contactsFetchInProgress.setVisibility(View.VISIBLE); contactsFetchInProgress.setVisibility(View.VISIBLE);
clearSearchField = (ImageView) view.findViewById(R.id.clearSearchField); clearSearchField = view.findViewById(R.id.clearSearchField);
clearSearchField.setOnClickListener(new View.OnClickListener() { clearSearchField.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -139,7 +139,7 @@ public class ContactsListFragment extends Fragment implements OnItemClickListene
} }
}); });
searchField = (EditText) view.findViewById(R.id.searchField); searchField = view.findViewById(R.id.searchField);
searchField.addTextChangedListener(new TextWatcher() { searchField.addTextChangedListener(new TextWatcher() {
@Override @Override
public void onTextChanged(CharSequence s, int start, int before, int count) { public void onTextChanged(CharSequence s, int start, int before, int count) {
@ -161,7 +161,6 @@ public class ContactsListFragment extends Fragment implements OnItemClickListene
layoutManager = new LinearLayoutManager(mContext); layoutManager = new LinearLayoutManager(mContext);
contactsList.setLayoutManager(layoutManager); contactsList.setLayoutManager(layoutManager);
//Divider between items
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(contactsList.getContext(), DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(contactsList.getContext(),
layoutManager.getOrientation()); layoutManager.getOrientation());
dividerItemDecoration.setDrawable(getActivity().getResources().getDrawable(R.drawable.divider)); dividerItemDecoration.setDrawable(getActivity().getResources().getDrawable(R.drawable.divider));
@ -202,7 +201,6 @@ public class ContactsListFragment extends Fragment implements OnItemClickListene
isEditionEnabled=true; isEditionEnabled=true;
} }
mContactAdapter = new ContactsListAdapter(mContext, listContact, this, mSelectionHelper); mContactAdapter = new ContactsListAdapter(mContext, listContact, this, mSelectionHelper);
// contactsList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE); // contactsList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);

View file

@ -42,7 +42,6 @@ import org.linphone.LinphoneService;
import org.linphone.R; import org.linphone.R;
import org.linphone.core.Address; import org.linphone.core.Address;
import org.linphone.core.Core; import org.linphone.core.Core;
import org.linphone.core.Factory;
import org.linphone.core.Friend; import org.linphone.core.Friend;
import org.linphone.core.FriendList; import org.linphone.core.FriendList;
import org.linphone.core.FriendListListener; import org.linphone.core.FriendListListener;
@ -84,10 +83,10 @@ public class ContactsManager extends ContentObserver implements FriendListListen
super(handler); super(handler);
this.handler = handler; this.handler = handler;
defaultAvatar = BitmapFactory.decodeResource(LinphoneService.instance().getResources(), R.drawable.avatar); defaultAvatar = BitmapFactory.decodeResource(LinphoneService.instance().getResources(), R.drawable.avatar);
androidContactsCache = new HashMap<String, LinphoneContact>(); androidContactsCache = new HashMap<>();
contactsUpdatedListeners = new ArrayList<ContactsUpdatedListener>(); contactsUpdatedListeners = new ArrayList<>();
contacts = new ArrayList<LinphoneContact>(); contacts = new ArrayList<>();
sipContacts = new ArrayList<LinphoneContact>(); sipContacts = new ArrayList<>();
if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null) { if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null) {
magicSearch = LinphoneManager.getLcIfManagerNotDestroyedOrNull().createMagicSearch(); magicSearch = LinphoneManager.getLcIfManagerNotDestroyedOrNull().createMagicSearch();
} }
@ -313,8 +312,8 @@ public class ContactsManager extends ContentObserver implements FriendListListen
} }
private synchronized void fetchContactsSync() { private synchronized void fetchContactsSync() {
List<LinphoneContact> contacts = new ArrayList<LinphoneContact>(); List<LinphoneContact> contacts = new ArrayList<>();
List<LinphoneContact> sipContacts = new ArrayList<LinphoneContact>(); List<LinphoneContact> sipContacts = new ArrayList<>();
Date contactsTime = new Date(); Date contactsTime = new Date();
androidContactsCache.clear(); androidContactsCache.clear();
@ -521,7 +520,7 @@ public class ContactsManager extends ContentObserver implements FriendListListen
public void deleteMultipleContactsAtOnce(List<String> ids) { public void deleteMultipleContactsAtOnce(List<String> ids) {
String select = ContactsContract.Data.CONTACT_ID + " = ?"; String select = ContactsContract.Data.CONTACT_ID + " = ?";
ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>(); ArrayList<ContentProviderOperation> ops = new ArrayList<>();
for (String id : ids) { for (String id : ids) {
String[] args = new String[] { id }; String[] args = new String[] { id };

View file

@ -57,12 +57,12 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
private boolean hasSipAddress; private boolean hasSipAddress;
public LinphoneContact() { public LinphoneContact() {
addresses = new ArrayList<LinphoneNumberOrAddress>(); addresses = new ArrayList<>();
androidId = null; androidId = null;
thumbnailUri = null; thumbnailUri = null;
photoUri = null; photoUri = null;
changesToCommit = new ArrayList<ContentProviderOperation>(); changesToCommit = new ArrayList<>();
changesToCommit2 = new ArrayList<ContentProviderOperation>(); changesToCommit2 = new ArrayList<>();
hasSipAddress = false; hasSipAddress = false;
} }
@ -70,8 +70,6 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
public int compareTo(LinphoneContact contact) { public int compareTo(LinphoneContact contact) {
String fullName = getFullName() != null ? getFullName().toUpperCase(Locale.getDefault()) : ""; String fullName = getFullName() != null ? getFullName().toUpperCase(Locale.getDefault()) : "";
String contactFullName = contact.getFullName() != null ? contact.getFullName().toUpperCase(Locale.getDefault()) : ""; String contactFullName = contact.getFullName() != null ? contact.getFullName().toUpperCase(Locale.getDefault()) : "";
/*String firstLetter = fullName == null || fullName.isEmpty() ? "" : fullName.substring(0, 1).toUpperCase(Locale.getDefault());
String contactfirstLetter = contactFullName == null || contactFullName.isEmpty() ? "" : contactFullName.substring(0, 1).toUpperCase(Locale.getDefault());*/
return fullName.compareTo(contactFullName); return fullName.compareTo(contactFullName);
} }
@ -474,8 +472,8 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
} catch (Exception e) { } catch (Exception e) {
Log.e(e); Log.e(e);
} finally { } finally {
changesToCommit = new ArrayList<ContentProviderOperation>(); changesToCommit = new ArrayList<>();
changesToCommit2 = new ArrayList<ContentProviderOperation>(); changesToCommit2 = new ArrayList<>();
} }
} }
@ -509,7 +507,7 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
} }
public void refresh() { public void refresh() {
addresses = new ArrayList<LinphoneNumberOrAddress>(); addresses = new ArrayList<>();
if (isAndroidContact()) { if (isAndroidContact()) {
getContactNames(); getContactNames();
getNativeContactOrganization(); getNativeContactOrganization();
@ -741,7 +739,7 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
} }
private void createLinphoneContactTag() { private void createLinphoneContactTag() {
ArrayList<ContentProviderOperation> batch = new ArrayList<ContentProviderOperation>(); ArrayList<ContentProviderOperation> batch = new ArrayList<>();
batch.add(ContentProviderOperation.newInsert(ContactsContract.RawContacts.CONTENT_URI) batch.add(ContentProviderOperation.newInsert(ContactsContract.RawContacts.CONTENT_URI)
.withValue(ContactsContract.RawContacts.ACCOUNT_TYPE, ContactsManager.getInstance().getString(R.string.sync_account_type)) .withValue(ContactsContract.RawContacts.ACCOUNT_TYPE, ContactsManager.getInstance().getString(R.string.sync_account_type))

View file

@ -25,7 +25,6 @@ import com.google.firebase.iid.FirebaseInstanceIdService;
import org.linphone.LinphonePreferences; import org.linphone.LinphonePreferences;
import org.linphone.LinphoneUtils; import org.linphone.LinphoneUtils;
public class FirebaseIdService extends FirebaseInstanceIdService { public class FirebaseIdService extends FirebaseInstanceIdService {
@Override @Override
public void onTokenRefresh() { public void onTokenRefresh() {

View file

@ -57,8 +57,8 @@ public class AboutFragment extends Fragment implements OnClickListener {
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.about, container, false); View view = inflater.inflate(R.layout.about, container, false);
TextView aboutVersion = (TextView) view.findViewById(R.id.about_android_version); TextView aboutVersion = view.findViewById(R.id.about_android_version);
TextView aboutLiblinphoneVersion = (TextView) view.findViewById(R.id.about_liblinphone_version); TextView aboutLiblinphoneVersion = view.findViewById(R.id.about_liblinphone_version);
aboutLiblinphoneVersion.setText(String.format(getString(R.string.about_liblinphone_version), LinphoneManager.getLc().getVersion())); aboutLiblinphoneVersion.setText(String.format(getString(R.string.about_liblinphone_version), LinphoneManager.getLc().getVersion()));
try { try {
aboutVersion.setText(String.format(getString(R.string.about_version), getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0).versionName)); aboutVersion.setText(String.format(getString(R.string.about_version), getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0).versionName));
@ -66,7 +66,7 @@ public class AboutFragment extends Fragment implements OnClickListener {
Log.e(e, "cannot get version name"); Log.e(e, "cannot get version name");
} }
cancel = (ImageView) view.findViewById(R.id.cancel); cancel = view.findViewById(R.id.cancel);
cancel.setOnClickListener(this); cancel.setOnClickListener(this);
sendLogButton = view.findViewById(R.id.send_log); sendLogButton = view.findViewById(R.id.send_log);

View file

@ -36,12 +36,8 @@ import org.linphone.core.ProxyConfig;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
import org.linphone.ui.PreferencesListFragment; import org.linphone.ui.PreferencesListFragment;
import android.app.AlertDialog;
import android.app.ProgressDialog; import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.preference.CheckBoxPreference; import android.preference.CheckBoxPreference;
import android.preference.EditTextPreference; import android.preference.EditTextPreference;
@ -51,11 +47,7 @@ import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.Preference.OnPreferenceClickListener; import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceCategory; import android.preference.PreferenceCategory;
import android.preference.PreferenceScreen; import android.preference.PreferenceScreen;
import android.support.v4.content.ContextCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.EditText;
public class AccountPreferencesFragment extends PreferencesListFragment implements AccountCreatorListener { public class AccountPreferencesFragment extends PreferencesListFragment implements AccountCreatorListener {
private int n; private int n;
@ -484,71 +476,12 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen
return true; return true;
} }
}); });
if(!isNewAccount){ if (!isNewAccount){
mainAccount.setEnabled(!mainAccount.isChecked()); mainAccount.setEnabled(!mainAccount.isChecked());
} }
//final AccountCreatorListener fragment = this;
final Preference changePassword = manage.getPreference(2); final Preference changePassword = manage.getPreference(2);
/*if (mPrefs.getAccountDomain(n).compareTo(getString(R.string.default_domain)) == 0) { changePassword.setEnabled(false);
changePassword.setEnabled(!isNewAccount);
changePassword.setOnPreferenceClickListener(new OnPreferenceClickListener() {
public boolean onPreferenceClick(Preference preference) {
final AlertDialog.Builder alert = new AlertDialog.Builder(LinphoneActivity.instance());
LayoutInflater inflater = LinphoneActivity.instance().getLayoutInflater();
View layout = inflater.inflate(R.layout.new_password, null);
final EditText pass1 = (EditText) layout.findViewById(R.id.password1);
final EditText pass2 = (EditText) layout.findViewById(R.id.password2);
alert.setNeutralButton(R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
alert.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
AccountCreator.PasswordStatus status = accountCreator.setPassword(pass1.getText().toString());
if (status.equals(AccountCreator.PasswordStatus.Ok)) {
if (pass1.getText().toString().compareTo(pass2.getText().toString()) == 0) {
accountCreator.setUsername(mPrefs.getAccountUsername(n));
accountCreator.setDomain(mPrefs.getAccountDomain(n));
accountCreator.setHa1(mPrefs.getAccountHa1(n));
accountCreator.setListener(fragment);
accountCreator.setPassword(pass1.getText().toString());
AccountCreator.Status req_status = accountCreator.updateAccount();
if (!req_status.equals(AccountCreator.Status.RequestOk)) {
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(req_status)
, LinphoneActivity.instance());
} else {
progress = ProgressDialog.show(LinphoneActivity.instance(), null, null);
Drawable d = new ColorDrawable(ContextCompat.getColor(LinphoneActivity.instance(), R.color.colorE));
d.setAlpha(200);
progress.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
progress.getWindow().setBackgroundDrawable(d);
progress.setContentView(R.layout.progress_dialog);
progress.show();
}
} else {
LinphoneUtils.displayErrorAlert(getString(R.string.wizard_passwords_unmatched)
, LinphoneActivity.instance());
}
return;
}
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForPasswordStatus(status), LinphoneActivity.instance());
}
});*/ // TODO FIXME
/*alert.setView(layout);
alert.show();
return true;
}
});
} else {*/
changePassword.setEnabled(false);
//}
final Preference delete = manage.getPreference(3); final Preference delete = manage.getPreference(3);
delete.setEnabled(!isNewAccount); delete.setEnabled(!isNewAccount);
@ -623,6 +556,19 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen
} }
} }
@Override
public void onUpdateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
if (progress != null) progress.dismiss();
if (status.equals(AccountCreator.Status.RequestOk)) {
mPrefs.setAccountPassword(n, accountCreator.getPassword());
PreferenceCategory account = (PreferenceCategory) getPreferenceScreen().findPreference(getString(R.string.pref_sipaccount_key));
((EditTextPreference) account.getPreference(2)).setText(mPrefs.getAccountPassword(n));
LinphoneUtils.displayErrorAlert(getString(R.string.pref_password_changed), LinphoneActivity.instance());
} else {
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status), LinphoneActivity.instance());
}
}
@Override @Override
public void onIsAccountExist(AccountCreator accountCreator, AccountCreator.Status status, String resp) { public void onIsAccountExist(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
@ -665,17 +611,4 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen
@Override @Override
public void onIsAliasUsed(AccountCreator accountCreator, AccountCreator.Status status, String resp) { public void onIsAliasUsed(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
} }
@Override
public void onUpdateAccount(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
if (progress != null) progress.dismiss();
if (status.equals(AccountCreator.Status.RequestOk)) {
mPrefs.setAccountPassword(n, accountCreator.getPassword());
PreferenceCategory account = (PreferenceCategory) getPreferenceScreen().findPreference(getString(R.string.pref_sipaccount_key));
((EditTextPreference) account.getPreference(2)).setText(mPrefs.getAccountPassword(n));
LinphoneUtils.displayErrorAlert(getString(R.string.pref_password_changed), LinphoneActivity.instance());
} else {
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status), LinphoneActivity.instance());
}
}
} }

View file

@ -59,13 +59,13 @@ public class DialerFragment extends Fragment {
Bundle savedInstanceState) { Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.dialer, container, false); View view = inflater.inflate(R.layout.dialer, container, false);
mAddress = (AddressText) view.findViewById(R.id.address); mAddress = view.findViewById(R.id.address);
mAddress.setDialerFragment(this); mAddress.setDialerFragment(this);
EraseButton erase = (EraseButton) view.findViewById(R.id.erase); EraseButton erase = view.findViewById(R.id.erase);
erase.setAddressWidget(mAddress); erase.setAddressWidget(mAddress);
mCall = (CallButton) view.findViewById(R.id.call); mCall = view.findViewById(R.id.call);
mCall.setAddressWidget(mAddress); mCall.setAddressWidget(mAddress);
if (LinphoneActivity.isInstanciated() && LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null && LinphoneManager.getLcIfManagerNotDestroyedOrNull().getCallsNb() > 0) { if (LinphoneActivity.isInstanciated() && LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null && LinphoneManager.getLcIfManagerNotDestroyedOrNull().getCallsNb() > 0) {
if (isCallTransferOngoing) { if (isCallTransferOngoing) {
@ -81,12 +81,12 @@ public class DialerFragment extends Fragment {
} }
} }
numpad = (AddressAware) view.findViewById(R.id.numpad); numpad = view.findViewById(R.id.numpad);
if (numpad != null) { if (numpad != null) {
numpad.setAddressWidget(mAddress); numpad.setAddressWidget(mAddress);
} }
mAddContact = (ImageView) view.findViewById(R.id.add_contact); mAddContact = view.findViewById(R.id.add_contact);
mAddContact.setEnabled(!(LinphoneActivity.isInstanciated() && LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null && LinphoneManager.getLc().getCallsNb() > 0)); mAddContact.setEnabled(!(LinphoneActivity.isInstanciated() && LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null && LinphoneManager.getLc().getCallsNb() > 0));
addContactListener = new OnClickListener() { addContactListener = new OnClickListener() {
@ -125,9 +125,6 @@ public class DialerFragment extends Fragment {
if (displayName != null) { if (displayName != null) {
mAddress.setDisplayedName(displayName); mAddress.setDisplayedName(displayName);
} }
if (photo != null) {
mAddress.setPictureUri(Uri.parse(photo));
}
} }
instance = this; instance = this;

View file

@ -71,36 +71,36 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
mWaitLayout = view.findViewById(R.id.waitScreen); mWaitLayout = view.findViewById(R.id.waitScreen);
mWaitLayout.setVisibility(View.GONE); mWaitLayout.setVisibility(View.GONE);
dialBack = (ImageView) view.findViewById(R.id.call); dialBack = view.findViewById(R.id.call);
dialBack.setOnClickListener(this); dialBack.setOnClickListener(this);
back = (ImageView) view.findViewById(R.id.back); back = view.findViewById(R.id.back);
if(getResources().getBoolean(R.bool.isTablet)){ if(getResources().getBoolean(R.bool.isTablet)){
back.setVisibility(View.INVISIBLE); back.setVisibility(View.INVISIBLE);
} else { } else {
back.setOnClickListener(this); back.setOnClickListener(this);
} }
chat = (ImageView) view.findViewById(R.id.chat); chat = view.findViewById(R.id.chat);
chat.setOnClickListener(this); chat.setOnClickListener(this);
if (getResources().getBoolean(R.bool.disable_chat)) if (getResources().getBoolean(R.bool.disable_chat))
view.findViewById(R.id.chat).setVisibility(View.GONE); view.findViewById(R.id.chat).setVisibility(View.GONE);
addToContacts = (ImageView) view.findViewById(R.id.add_contact); addToContacts = view.findViewById(R.id.add_contact);
addToContacts.setOnClickListener(this); addToContacts.setOnClickListener(this);
goToContact = (ImageView) view.findViewById(R.id.goto_contact); goToContact = view.findViewById(R.id.goto_contact);
goToContact.setOnClickListener(this); goToContact.setOnClickListener(this);
contactPicture = (ImageView) view.findViewById(R.id.contact_picture); contactPicture = view.findViewById(R.id.contact_picture);
contactName = (TextView) view.findViewById(R.id.contact_name); contactName = view.findViewById(R.id.contact_name);
contactAddress = (TextView) view.findViewById(R.id.contact_address); contactAddress = view.findViewById(R.id.contact_address);
callDirection = (ImageView) view.findViewById(R.id.direction); callDirection = view.findViewById(R.id.direction);
time = (TextView) view.findViewById(R.id.time); time = view.findViewById(R.id.time);
date = (TextView) view.findViewById(R.id.date); date = view.findViewById(R.id.date);
displayHistory(status, callTime, callDate); displayHistory(status, callTime, callDate);
@ -142,8 +142,7 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
Long longDate = Long.parseLong(callDate); Long longDate = Long.parseLong(callDate);
date.setText(LinphoneUtils.timestampToHumanDate(getActivity(),longDate,getString(R.string.history_detail_date_format))); date.setText(LinphoneUtils.timestampToHumanDate(getActivity(),longDate,getString(R.string.history_detail_date_format)));
Address lAddress = null; Address lAddress = Factory.instance().createAddress(sipUri);
lAddress = Factory.instance().createAddress(sipUri);
if (lAddress != null) { if (lAddress != null) {
contactAddress.setText(lAddress.asStringUriOnly()); contactAddress.setText(lAddress.asStringUriOnly());

View file

@ -32,7 +32,6 @@ import android.view.ViewGroup;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener; import android.widget.AdapterView.OnItemClickListener;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import org.linphone.LinphoneManager; import org.linphone.LinphoneManager;
@ -55,7 +54,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
private TextView noCallHistory, noMissedCallHistory; private TextView noCallHistory, noMissedCallHistory;
private ImageView missedCalls, allCalls, edit; private ImageView missedCalls, allCalls, edit;
private View allCallsSelected, missedCallsSelected; private View allCallsSelected, missedCallsSelected;
private boolean mOnlyDisplayMissedCalls, mIsEditMode; private boolean mOnlyDisplayMissedCalls;
private List<CallLog> mLogs; private List<CallLog> mLogs;
private CallHistoryAdapter mHistoryAdapter; private CallHistoryAdapter mHistoryAdapter;
private LinearLayoutManager mLayoutManager; private LinearLayoutManager mLayoutManager;
@ -69,10 +68,10 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
mContext = getActivity().getApplicationContext(); mContext = getActivity().getApplicationContext();
mSelectionHelper = new SelectableHelper(view, this); mSelectionHelper = new SelectableHelper(view, this);
noCallHistory = (TextView) view.findViewById(R.id.no_call_history); noCallHistory = view.findViewById(R.id.no_call_history);
noMissedCallHistory = (TextView) view.findViewById(R.id.no_missed_call_history); noMissedCallHistory = view.findViewById(R.id.no_missed_call_history);
historyList = (RecyclerView) view.findViewById(R.id.history_list); historyList = view.findViewById(R.id.history_list);
mLayoutManager = new LinearLayoutManager(mContext); mLayoutManager = new LinearLayoutManager(mContext);
historyList.setLayoutManager(mLayoutManager); historyList.setLayoutManager(mLayoutManager);
@ -82,12 +81,12 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
dividerItemDecoration.setDrawable(mContext.getResources().getDrawable(R.drawable.divider)); dividerItemDecoration.setDrawable(mContext.getResources().getDrawable(R.drawable.divider));
historyList.addItemDecoration(dividerItemDecoration); historyList.addItemDecoration(dividerItemDecoration);
allCalls = (ImageView) view.findViewById(R.id.all_calls); allCalls = view.findViewById(R.id.all_calls);
allCalls.setOnClickListener(this); allCalls.setOnClickListener(this);
allCallsSelected = view.findViewById(R.id.all_calls_select); allCallsSelected = view.findViewById(R.id.all_calls_select);
missedCalls = (ImageView) view.findViewById(R.id.missed_calls); missedCalls = view.findViewById(R.id.missed_calls);
missedCalls.setOnClickListener(this); missedCalls.setOnClickListener(this);
missedCallsSelected = view.findViewById(R.id.missed_calls_select); missedCallsSelected = view.findViewById(R.id.missed_calls_select);
@ -95,7 +94,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
allCalls.setEnabled(false); allCalls.setEnabled(false);
mOnlyDisplayMissedCalls = false; mOnlyDisplayMissedCalls = false;
edit = (ImageView) view.findViewById(R.id.edit); edit = view.findViewById(R.id.edit);
return view; return view;
} }

View file

@ -68,13 +68,13 @@ public class StatusFragment extends Fragment {
Bundle savedInstanceState) { Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.status, container, false); View view = inflater.inflate(R.layout.status, container, false);
statusText = (TextView) view.findViewById(R.id.status_text); statusText = view.findViewById(R.id.status_text);
statusLed = (ImageView) view.findViewById(R.id.status_led); statusLed = view.findViewById(R.id.status_led);
callQuality = (ImageView) view.findViewById(R.id.call_quality); callQuality = view.findViewById(R.id.call_quality);
encryption = (ImageView) view.findViewById(R.id.encryption); encryption = view.findViewById(R.id.encryption);
menu = (ImageView) view.findViewById(R.id.side_menu_button); menu = view.findViewById(R.id.side_menu_button);
voicemail = (ImageView) view.findViewById(R.id.voicemail); voicemail = view.findViewById(R.id.voicemail);
voicemailCount = (TextView) view.findViewById(R.id.voicemail_count); voicemailCount = view.findViewById(R.id.voicemail_count);
// We create it once to not delay the first display // We create it once to not delay the first display
populateSliderContent(); populateSliderContent();
@ -427,13 +427,13 @@ public class StatusFragment extends Fragment {
//Screen is locked //Screen is locked
LinphoneService.instance().displaySasNotification(call.getAuthenticationToken()); LinphoneService.instance().displaySasNotification(call.getAuthenticationToken());
} }
TextView customText = (TextView) ZRTPdialog.findViewById(R.id.customText); TextView customText = ZRTPdialog.findViewById(R.id.customText);
String newText = getString(R.string.zrtp_dialog1).replace("%s", zrtpToRead) String newText = getString(R.string.zrtp_dialog1).replace("%s", zrtpToRead)
+ getString(R.string.zrtp_dialog2).replace("%s", zrtpToListen); + getString(R.string.zrtp_dialog2).replace("%s", zrtpToListen);
customText.setText(newText); customText.setText(newText);
Button delete = (Button) ZRTPdialog.findViewById(R.id.delete_button); Button delete = ZRTPdialog.findViewById(R.id.delete_button);
delete.setText(R.string.accept); delete.setText(R.string.accept);
Button cancel = (Button) ZRTPdialog.findViewById(R.id.cancel); Button cancel = ZRTPdialog.findViewById(R.id.cancel);
cancel.setText(R.string.deny); cancel.setText(R.string.deny);
delete.setOnClickListener(new OnClickListener() { delete.setOnClickListener(new OnClickListener() {

View file

@ -56,13 +56,13 @@ public class InAppPurchaseActivity extends Activity implements InAppPurchaseList
inAppPurchaseHelper = new InAppPurchaseHelper(this, this); inAppPurchaseHelper = new InAppPurchaseHelper(this, this);
setContentView(R.layout.in_app); setContentView(R.layout.in_app);
inProgress = (ProgressBar) findViewById(R.id.purchaseItemsFetchInProgress); inProgress = findViewById(R.id.purchaseItemsFetchInProgress);
inProgress.setVisibility(View.VISIBLE); inProgress.setVisibility(View.VISIBLE);
back = (ImageView) findViewById(R.id.back); back = findViewById(R.id.back);
back.setOnClickListener(this); back.setOnClickListener(this);
back.setVisibility(View.INVISIBLE); back.setVisibility(View.INVISIBLE);
cancel = (ImageView) findViewById(R.id.cancel); cancel = findViewById(R.id.cancel);
cancel.setOnClickListener(this); cancel.setOnClickListener(this);
instance = this; instance = this;
@ -139,7 +139,7 @@ public class InAppPurchaseActivity extends Activity implements InAppPurchaseList
public void onAvailableItemsForPurchaseQueryFinished(ArrayList<Purchasable> items) { public void onAvailableItemsForPurchaseQueryFinished(ArrayList<Purchasable> items) {
//purchasableItemsLayout.removeAllViews(); //purchasableItemsLayout.removeAllViews();
inProgress.setVisibility(View.GONE); inProgress.setVisibility(View.GONE);
purchasedItems = new ArrayList<Purchasable>(); purchasedItems = new ArrayList<>();
for (Purchasable item : items) { for (Purchasable item : items) {
purchasedItems.add(item); purchasedItems.add(item);
} }

View file

@ -37,7 +37,6 @@ import android.widget.EditText;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
public class InAppPurchaseFragment extends Fragment implements View.OnClickListener { public class InAppPurchaseFragment extends Fragment implements View.OnClickListener {
private LinearLayout usernameLayout; private LinearLayout usernameLayout;
private EditText username, email; private EditText username, email;
@ -45,7 +44,7 @@ public class InAppPurchaseFragment extends Fragment implements View.OnClickListe
private boolean usernameOk = false, emailOk = false; private boolean usernameOk = false, emailOk = false;
private String defaultUsername, defaultEmail; private String defaultUsername, defaultEmail;
private Button buyItemButton, recoverAccountButton; private Button buyItemButton;
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
@ -57,15 +56,15 @@ public class InAppPurchaseFragment extends Fragment implements View.OnClickListe
String id = getArguments().getString("item_id"); String id = getArguments().getString("item_id");
Purchasable item = InAppPurchaseActivity.instance().getPurchasedItem(id); Purchasable item = InAppPurchaseActivity.instance().getPurchasedItem(id);
buyItemButton = (Button) view.findViewById(R.id.inapp_button); buyItemButton = view.findViewById(R.id.inapp_button);
displayBuySubscriptionButton(item); displayBuySubscriptionButton(item);
defaultEmail = InAppPurchaseActivity.instance().getGmailAccount(); defaultEmail = InAppPurchaseActivity.instance().getGmailAccount();
defaultUsername = LinphonePreferences.instance().getAccountUsername(LinphonePreferences.instance().getDefaultAccountIndex()); defaultUsername = LinphonePreferences.instance().getAccountUsername(LinphonePreferences.instance().getDefaultAccountIndex());
usernameLayout = (LinearLayout) view.findViewById(R.id.username_layout); usernameLayout = view.findViewById(R.id.username_layout);
username = (EditText) view.findViewById(R.id.username); username = view.findViewById(R.id.username);
if(!getResources().getBoolean(R.bool.hide_username_in_inapp)){ if(!getResources().getBoolean(R.bool.hide_username_in_inapp)){
usernameLayout.setVisibility(View.VISIBLE); usernameLayout.setVisibility(View.VISIBLE);
username.setText(LinphonePreferences.instance().getAccountUsername(LinphonePreferences.instance().getDefaultAccountIndex())); username.setText(LinphonePreferences.instance().getAccountUsername(LinphonePreferences.instance().getDefaultAccountIndex()));
@ -78,14 +77,14 @@ public class InAppPurchaseFragment extends Fragment implements View.OnClickListe
} }
} }
email = (EditText) view.findViewById(R.id.email); email = view.findViewById(R.id.email);
if(defaultEmail != null){ if(defaultEmail != null){
email.setText(defaultEmail); email.setText(defaultEmail);
emailOk = true; emailOk = true;
} }
buyItemButton.setEnabled(emailOk && usernameOk); buyItemButton.setEnabled(emailOk && usernameOk);
errorMessage = (TextView) view.findViewById(R.id.username_error); errorMessage = view.findViewById(R.id.username_error);
return view; return view;
} }
@ -110,7 +109,6 @@ public class InAppPurchaseFragment extends Fragment implements View.OnClickListe
errorMessage.setText(R.string.wizard_username_incorrect); errorMessage.setText(R.string.wizard_username_incorrect);
} }
if (buyItemButton != null) buyItemButton.setEnabled(usernameOk); if (buyItemButton != null) buyItemButton.setEnabled(usernameOk);
if (recoverAccountButton != null) recoverAccountButton.setEnabled(usernameOk);
} }
}); });
} }
@ -130,11 +128,7 @@ public class InAppPurchaseFragment extends Fragment implements View.OnClickListe
@Override @Override
public void onClick(View v) { public void onClick(View v) {
Purchasable item = (Purchasable) v.getTag(); Purchasable item = (Purchasable) v.getTag();
if (v.equals(recoverAccountButton)) { InAppPurchaseActivity.instance().buyInapp(getUsername(), item);
//TODO
} else {
InAppPurchaseActivity.instance().buyInapp(getUsername(), item);
}
} }
private String getUsername() { private String getUsername() {

View file

@ -168,7 +168,7 @@ public class InAppPurchaseHelper {
} }
private ArrayList<Purchasable> getAvailableItemsForPurchase() { private ArrayList<Purchasable> getAvailableItemsForPurchase() {
ArrayList<Purchasable> products = new ArrayList<Purchasable>(); ArrayList<Purchasable> products = new ArrayList<>();
ArrayList<String> skuList = LinphonePreferences.instance().getInAppPurchasables(); ArrayList<String> skuList = LinphonePreferences.instance().getInAppPurchasables();
Bundle querySkus = new Bundle(); Bundle querySkus = new Bundle();
querySkus.putStringArrayList(SKU_DETAILS_ITEM_LIST, skuList); querySkus.putStringArrayList(SKU_DETAILS_ITEM_LIST, skuList);
@ -223,55 +223,6 @@ public class InAppPurchaseHelper {
}).start(); }).start();
} }
public void getPurchasedItemsAsync() {
new Thread(new Runnable() {
public void run() {
final ArrayList<Purchasable> items = new ArrayList<Purchasable>();
String continuationToken = null;
do {
Bundle purchasedItems = null;
try {
purchasedItems = mService.getPurchases(API_VERSION, mContext.getPackageName(), ITEM_TYPE_SUBS, continuationToken);
} 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);
}
}
} else {
Log.e("[In-app purchase] Error: responde code is not ok: " + responseCodeToErrorMessage(response));
mListener.onError(responseCodeToErrorMessage(response));
}
}
} while (continuationToken != null);
if (mHandler != null && mListener != null) {
mHandler.post(new Runnable() {
public void run() {
mListener.onPurchasedItemsQueryFinished(items);
}
});
}
}
}).start();
}
public void parseAndVerifyPurchaseItemResultAsync(int requestCode, int resultCode, Intent data) { public void parseAndVerifyPurchaseItemResultAsync(int requestCode, int resultCode, Intent data) {
if (requestCode == ACTIVITY_RESULT_CODE_PURCHASE_ITEM) { if (requestCode == ACTIVITY_RESULT_CODE_PURCHASE_ITEM) {
int responseCode = data.getIntExtra(RESPONSE_CODE, 0); int responseCode = data.getIntExtra(RESPONSE_CODE, 0);

View file

@ -45,7 +45,7 @@ public class InAppPurchaseListFragment extends Fragment implements AdapterView.O
View view = inflater.inflate(R.layout.in_app_list, container, false); View view = inflater.inflate(R.layout.in_app_list, container, false);
mPurchasableItems = InAppPurchaseActivity.instance().getPurchasedItems(); mPurchasableItems = InAppPurchaseActivity.instance().getPurchasedItems();
inappList = (ListView) view.findViewById(R.id.inapp_list); inappList = view.findViewById(R.id.inapp_list);
if(mPurchasableItems != null){ if(mPurchasableItems != null){
inappList.setAdapter(new InAppListAdapter()); inappList.setAdapter(new InAppListAdapter());
@ -70,7 +70,7 @@ public class InAppPurchaseListFragment extends Fragment implements AdapterView.O
} }
public View getView(final int position, View convertView, ViewGroup parent) { public View getView(final int position, View convertView, ViewGroup parent) {
View view = null; View view;
if (convertView != null) { if (convertView != null) {
view = convertView; view = convertView;
} else { } else {
@ -79,9 +79,9 @@ public class InAppPurchaseListFragment extends Fragment implements AdapterView.O
final Purchasable item = mPurchasableItems.get(position); final Purchasable item = mPurchasableItems.get(position);
TextView itemTitle = (TextView) view.findViewById(R.id.purchase_title); TextView itemTitle = view.findViewById(R.id.purchase_title);
TextView itemDesc = (TextView) view.findViewById(R.id.purchase_description); TextView itemDesc = view.findViewById(R.id.purchase_description);
TextView itemPrice = (TextView) view.findViewById(R.id.purchase_price); TextView itemPrice = view.findViewById(R.id.purchase_price);
itemTitle.setText(item.getTitle()); itemTitle.setText(item.getTitle());
itemDesc.setText(item.getDescription()); itemDesc.setText(item.getDescription());

View file

@ -25,8 +25,6 @@ import org.linphone.LinphoneService;
import org.linphone.LinphoneUtils; import org.linphone.LinphoneUtils;
import org.linphone.R; import org.linphone.R;
import org.linphone.core.Core; import org.linphone.core.Core;
import org.linphone.core.Factory;
import org.linphone.core.LogCollectionState;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
import android.content.Context; import android.content.Context;

View file

@ -26,8 +26,6 @@ import org.linphone.LinphoneUtils;
import org.linphone.R; import org.linphone.R;
import org.linphone.compatibility.Compatibility; import org.linphone.compatibility.Compatibility;
import org.linphone.core.Core; import org.linphone.core.Core;
import org.linphone.core.Factory;
import org.linphone.core.LogCollectionState;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
import android.app.AlarmManager; import android.app.AlarmManager;

View file

@ -20,7 +20,5 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
public interface AddressAware { public interface AddressAware {
void setAddressWidget(AddressText address); void setAddressWidget(AddressText address);
} }

View file

@ -33,18 +33,9 @@ import android.widget.EditText;
public class AddressText extends EditText implements AddressType { public class AddressText extends EditText implements AddressType {
private String displayedName; private String displayedName;
private Uri pictureUri;
private Paint mTestPaint; private Paint mTestPaint;
private DialerFragment dialer; private DialerFragment dialer;
public void setPictureUri(Uri uri) {
pictureUri = uri;
}
public Uri getPictureUri() {
return pictureUri;
}
public AddressText(Context context, AttributeSet attrs) { public AddressText(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
@ -60,11 +51,6 @@ public class AddressText extends EditText implements AddressType {
return displayedName; return displayedName;
} }
public void setContactAddress(String uri, String displayedName) {
setText(uri);
this.displayedName = displayedName;
}
public void setDisplayedName(String displayedName) { public void setDisplayedName(String displayedName) {
this.displayedName = displayedName; this.displayedName = displayedName;
} }
@ -81,7 +67,6 @@ public class AddressText extends EditText implements AddressType {
protected void onTextChanged(CharSequence text, int start, int before, protected void onTextChanged(CharSequence text, int start, int before,
int after) { int after) {
clearDisplayedName(); clearDisplayedName();
pictureUri = null;
refitText(getWidth(), getHeight()); refitText(getWidth(), getHeight());

View file

@ -23,7 +23,6 @@ import org.linphone.LinphoneManager;
import org.linphone.LinphonePreferences; import org.linphone.LinphonePreferences;
import org.linphone.R; import org.linphone.R;
import org.linphone.core.Call; import org.linphone.core.Call;
import org.linphone.core.Call.Dir;
import org.linphone.core.CallLog; import org.linphone.core.CallLog;
import org.linphone.core.CoreException; import org.linphone.core.CoreException;
import org.linphone.core.ProxyConfig; import org.linphone.core.ProxyConfig;

View file

@ -19,15 +19,12 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
import org.linphone.LinphoneUtils;
import org.linphone.call.CallActivity; import org.linphone.call.CallActivity;
import org.linphone.LinphoneManager; import org.linphone.LinphoneManager;
import org.linphone.LinphonePreferences; import org.linphone.LinphonePreferences;
import org.linphone.LinphoneService; import org.linphone.LinphoneService;
import org.linphone.R; import org.linphone.R;
import org.linphone.core.Core; import org.linphone.core.Core;
import org.linphone.core.Factory;
import org.linphone.core.LogCollectionState;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
import android.app.AlertDialog; import android.app.AlertDialog;

View file

@ -1,53 +0,0 @@
package org.linphone.ui;
/*
LinphoneScrollView.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.Context;
import android.util.AttributeSet;
import android.widget.ScrollView;
public class LinphoneScrollView extends ScrollView {
private ScrollViewListener scrollViewListener = null;
public LinphoneScrollView(Context context) {
super(context);
}
public LinphoneScrollView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
public LinphoneScrollView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public void setScrollViewListener(ScrollViewListener scrollViewListener) {
this.scrollViewListener = scrollViewListener;
}
@Override
protected void onScrollChanged(int x, int y, int oldx, int oldy) {
super.onScrollChanged(x, y, oldx, oldy);
if (y >= getMeasuredHeight() && scrollViewListener != null) {
//scrollViewListener.OnScrollToBottom();
}
else if (y == 0 && scrollViewListener != null) {
scrollViewListener.OnScrollToTop(getMeasuredHeight());
}
}
}

View file

@ -1,135 +0,0 @@
package org.linphone.ui;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.GestureDetector;
import android.view.GestureDetector.OnGestureListener;
import android.view.MotionEvent;
import android.view.View;
/*
LinphoneSliders.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 class LinphoneSliders extends View implements OnGestureListener {
private Drawable leftSliderImg, rightSliderImg;
private int leftSliderX, rightSliderX;
private int slidersHeight, slidersWidth;
private GestureDetector mGestures;
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) {
leftSliderX = 0;
rightSliderX = 0;
slidingLeftHandle = slidingRightHandle = false;
invalidate();
}
return mGestures.onTouchEvent(event);
}
@Override
public boolean onDown(MotionEvent e) {
return true;
}
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
float velocityY) {
return false;
}
@Override
public void onLongPress(MotionEvent e) {
}
@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX,
float distanceY) {
if (e1.getY() < getHeight() - slidersHeight) {
return false;
}
if (e1.getX() < getWidth() / 2) {
leftSliderX -= distanceX;
slidingLeftHandle = true;
} else {
rightSliderX += distanceX;
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;
}
public interface LinphoneSliderTriggered {
public void onLeftHandleTriggered();
public void onRightHandleTriggered();
}
}

View file

@ -22,8 +22,6 @@ package org.linphone.ui;
import android.widget.BaseAdapter; import android.widget.BaseAdapter;
import android.widget.CompoundButton; import android.widget.CompoundButton;
import org.linphone.mediastream.Log;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -54,10 +52,6 @@ public abstract class ListSelectionAdapter extends BaseAdapter {
return mIsEditionEnabled; return mIsEditionEnabled;
} }
public CompoundButton.OnCheckedChangeListener getDeleteListener() {
return mDeleteCheckboxListener;
}
public void selectAll() { public void selectAll() {
for (Integer i = 0; i < getCount(); i++) { for (Integer i = 0; i < getCount(); i++) {
mSelectedItems.add(i); mSelectedItems.add(i);

View file

@ -37,10 +37,6 @@ public class ListSelectionHelper {
private Context mContext; private Context mContext;
private int mDialogDeleteMessageResourceId; private int mDialogDeleteMessageResourceId;
public void setDialogMessage(int id) {
mDialogDeleteMessageResourceId = id;
}
public interface DeleteListener { public interface DeleteListener {
void onDeleteSelection(Object[] objectsToDelete); void onDeleteSelection(Object[] objectsToDelete);
} }

View file

@ -71,7 +71,7 @@ public class Numpad extends LinearLayout implements AddressAware {
private final <T> Collection<T> retrieveChildren(ViewGroup viewGroup, Class<T> clazz) { private final <T> Collection<T> retrieveChildren(ViewGroup viewGroup, Class<T> clazz) {
final Collection<T> views = new ArrayList<T>(); final Collection<T> views = new ArrayList<>();
for (int i = 0; i < viewGroup.getChildCount(); i++) { for (int i = 0; i < viewGroup.getChildCount(); i++) {
View v = viewGroup.getChildAt(i); View v = viewGroup.getChildAt(i);

View file

@ -86,7 +86,7 @@ public class PreferencesListFragment extends ListFragment {
((ViewGroup)p).removeView(preferencesList); ((ViewGroup)p).removeView(preferencesList);
} }
RelativeLayout layout = (RelativeLayout) view.findViewById(R.id.topLayout); RelativeLayout layout = view.findViewById(R.id.topLayout);
layout.addView(preferencesList); layout.addView(preferencesList);
postBindPreferences(); postBindPreferences();

View file

@ -1,24 +0,0 @@
package org.linphone.ui;
/*
ScrollViewListener.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 ScrollViewListener {
void OnScrollToTop(int previousHeight);
}

View file

@ -26,8 +26,6 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public abstract class SelectableAdapter<VH extends RecyclerView.ViewHolder> extends RecyclerView.Adapter<VH> { public abstract class SelectableAdapter<VH extends RecyclerView.ViewHolder> extends RecyclerView.Adapter<VH> {
@SuppressWarnings("unused")
private static final String TAG = SelectableAdapter.class.getSimpleName();
private SparseBooleanArray mSelectedItems; private SparseBooleanArray mSelectedItems;
private boolean mIsEditionEnabled=false; private boolean mIsEditionEnabled=false;
private SelectableHelper mListHelper; private SelectableHelper mListHelper;

View file

@ -50,8 +50,6 @@ public class SelectableHelper {
mContext = view.getContext(); mContext = view.getContext();
mDeleteListener = listener; mDeleteListener = listener;
//Define XML layout items used for selection mode
mEditTopBar = view.findViewById(R.id.edit_list); mEditTopBar = view.findViewById(R.id.edit_list);
mTopBar = view.findViewById(R.id.top_bar); mTopBar = view.findViewById(R.id.top_bar);
@ -65,7 +63,6 @@ public class SelectableHelper {
mEditButton = view.findViewById(R.id.edit); mEditButton = view.findViewById(R.id.edit);
//Set visibility behaviour on click on edit button + enter Edition Mode
mEditButton.setOnClickListener(new View.OnClickListener() { mEditButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -96,7 +93,6 @@ public class SelectableHelper {
mDeleteSelectionButton = view.findViewById(R.id.delete); mDeleteSelectionButton = view.findViewById(R.id.delete);
mDeleteSelectionButton.setEnabled(false); mDeleteSelectionButton.setEnabled(false);
//Display confirmation for deletion
mDeleteSelectionButton.setOnClickListener(new View.OnClickListener() { mDeleteSelectionButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -132,14 +128,12 @@ public class SelectableHelper {
} }
public void updateSelectionButtons(boolean isSelectionEmpty, boolean isSelectionFull) { public void updateSelectionButtons(boolean isSelectionEmpty, boolean isSelectionFull) {
//Delete button availability
if (isSelectionEmpty) { if (isSelectionEmpty) {
mDeleteSelectionButton.setEnabled(false); mDeleteSelectionButton.setEnabled(false);
} else { } else {
mDeleteSelectionButton.setEnabled(true); mDeleteSelectionButton.setEnabled(true);
} }
//(De)select button visibility
if (isSelectionFull) { if (isSelectionFull) {
mSelectAllButton.setVisibility(View.GONE); mSelectAllButton.setVisibility(View.GONE);
mDeselectAllButton.setVisibility(View.VISIBLE); mDeselectAllButton.setVisibility(View.VISIBLE);

View file

@ -318,8 +318,6 @@ public class SlidingDrawer extends ViewGroup {
} }
} }
public static final String LOG_TAG = "Sliding";
@Override @Override
protected void onLayout(boolean changed, int l, int t, int r, int b) { protected void onLayout(boolean changed, int l, int t, int r, int b) {
if (mTracking) { if (mTracking) {

View file

@ -24,10 +24,8 @@ import org.linphone.LinphonePreferences;
import org.linphone.core.XmlRpcArgType; import org.linphone.core.XmlRpcArgType;
import org.linphone.core.XmlRpcRequest; import org.linphone.core.XmlRpcRequest;
import org.linphone.core.XmlRpcRequestListener; import org.linphone.core.XmlRpcRequestListener;
//import org.linphone.core.XmlRpcRequestImpl;
import org.linphone.core.XmlRpcSession; import org.linphone.core.XmlRpcSession;
import org.linphone.core.XmlRpcStatus; import org.linphone.core.XmlRpcStatus;
//import org.linphone.core.XmlRpcSessionImpl;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
public class XmlRpcHelper { public class XmlRpcHelper {

View file

@ -20,19 +20,19 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
public interface XmlRpcListener { public interface XmlRpcListener {
public void onError(String error); void onError(String error);
public void onAccountCreated(String result); void onAccountCreated(String result);
public void onAccountExpireFetched(String result); void onAccountExpireFetched(String result);
public void onAccountExpireUpdated(String result); void onAccountExpireUpdated(String result);
public void onAccountActivated(String result); void onAccountActivated(String result);
public void onAccountActivatedFetched(boolean isActivated); void onAccountActivatedFetched(boolean isActivated);
public void onTrialAccountFetched(boolean isTrial); void onTrialAccountFetched(boolean isTrial);
public void onAccountFetched(boolean isExisting); void onAccountFetched(boolean isExisting);
public void onAccountEmailChanged(String result); void onAccountEmailChanged(String result);
public void onAccountPasswordChanged(String result); void onAccountPasswordChanged(String result);
public void onRecoverPasswordLinkSent(String result); void onRecoverPasswordLinkSent(String result);
public void onActivateAccountLinkSent(String result); void onActivateAccountLinkSent(String result);
public void onSignatureVerified(boolean success); void onSignatureVerified(boolean success);
public void onUsernameSent(String result); void onUsernameSent(String result);
public void onRemoteProvisioningFilenameSent(String result); void onRemoteProvisioningFilenameSent(String result);
} }