More cleanup
This commit is contained in:
parent
f020b2e2c4
commit
6e9058ca99
69 changed files with 494 additions and 1016 deletions
|
@ -31,7 +31,6 @@ public class BandwidthManager {
|
|||
private static BandwidthManager instance;
|
||||
|
||||
private int currentProfile = HIGH_RESOLUTION;
|
||||
public int getCurrentProfile() {return currentProfile;}
|
||||
|
||||
public static final synchronized BandwidthManager getInstance() {
|
||||
if (instance == null) instance = new BandwidthManager();
|
||||
|
|
|
@ -20,7 +20,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
*/
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.app.ProgressDialog;
|
||||
|
|
|
@ -30,14 +30,12 @@ import org.linphone.core.AuthInfo;
|
|||
import org.linphone.core.Core;
|
||||
import org.linphone.core.LimeState;
|
||||
import org.linphone.core.MediaEncryption;
|
||||
import org.linphone.core.LogCollectionState;
|
||||
import org.linphone.core.Transports;
|
||||
import org.linphone.core.CoreException;
|
||||
import org.linphone.core.Factory;
|
||||
import org.linphone.core.NatPolicy;
|
||||
import org.linphone.core.ProxyConfig;
|
||||
import org.linphone.core.Config;
|
||||
//import org.linphone.core.TunnelConfig;
|
||||
import org.linphone.core.Tunnel;
|
||||
import org.linphone.core.TunnelConfig;
|
||||
import org.linphone.core.VideoActivationPolicy;
|
||||
|
|
|
@ -23,7 +23,6 @@ import java.lang.reflect.InvocationTargetException;
|
|||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.linphone.activities.LinphoneActivity;
|
||||
import org.linphone.compatibility.Compatibility;
|
||||
|
@ -34,12 +33,8 @@ import org.linphone.core.Call;
|
|||
import org.linphone.core.Call.State;
|
||||
import org.linphone.core.Core;
|
||||
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.Factory;
|
||||
import org.linphone.core.LogCollectionState;
|
||||
import org.linphone.core.CoreListenerStub;
|
||||
import org.linphone.core.ProxyConfig;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
@ -69,7 +64,6 @@ import android.os.IBinder;
|
|||
import android.os.SystemClock;
|
||||
import android.provider.ContactsContract;
|
||||
import android.provider.MediaStore;
|
||||
import android.util.ArrayMap;
|
||||
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.
|
||||
*/
|
||||
class ActivityMonitor implements Application.ActivityLifecycleCallbacks {
|
||||
private ArrayList<Activity> activities = new ArrayList<Activity>();
|
||||
private ArrayList<Activity> activities = new ArrayList<>();
|
||||
private boolean mActive = false;
|
||||
private int mRunningActivities = 0;
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
|
@ -34,7 +33,6 @@ import android.os.Build;
|
|||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import android.provider.MediaStore;
|
||||
import android.provider.OpenableColumns;
|
||||
import android.telephony.TelephonyManager;
|
||||
|
@ -42,7 +40,6 @@ import android.text.Spanned;
|
|||
import android.text.TextUtils;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.webkit.MimeTypeMap;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
@ -66,9 +63,6 @@ import org.linphone.mediastream.Log;
|
|||
import org.linphone.mediastream.video.capture.hwconf.Hacks;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
|
@ -324,11 +318,11 @@ public final class LinphoneUtils {
|
|||
|
||||
public static final List<Call> getCalls(Core lc) {
|
||||
// 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) {
|
||||
List<Call> foundCalls = new ArrayList<Call>();
|
||||
List<Call> foundCalls = new ArrayList<>();
|
||||
for (Call call : getCalls(lc)) {
|
||||
if (states.contains(call.getState())) {
|
||||
foundCalls.add(call);
|
||||
|
|
|
@ -114,9 +114,6 @@ import org.linphone.ui.AddressText;
|
|||
import org.linphone.xmlrpc.XmlRpcHelper;
|
||||
import org.linphone.xmlrpc.XmlRpcListenerBase;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
|
@ -125,9 +122,7 @@ import java.util.Collection;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
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 CALL_ACTIVITY = 19;
|
||||
private static final int PERMISSIONS_REQUEST_OVERLAY = 206;
|
||||
|
@ -313,19 +308,19 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
|||
}
|
||||
|
||||
private void initButtons() {
|
||||
mTabBar = (LinearLayout) findViewById(R.id.footer);
|
||||
mTopBar = (RelativeLayout) findViewById(R.id.top_bar);
|
||||
mTabBar = findViewById(R.id.footer);
|
||||
mTopBar = findViewById(R.id.top_bar);
|
||||
|
||||
cancel = (ImageView) findViewById(R.id.cancel);
|
||||
cancel = findViewById(R.id.cancel);
|
||||
cancel.setOnClickListener(this);
|
||||
|
||||
history = (RelativeLayout) findViewById(R.id.history);
|
||||
history = findViewById(R.id.history);
|
||||
history.setOnClickListener(this);
|
||||
contacts = (RelativeLayout) findViewById(R.id.contacts);
|
||||
contacts = findViewById(R.id.contacts);
|
||||
contacts.setOnClickListener(this);
|
||||
dialer = (RelativeLayout) findViewById(R.id.dialer);
|
||||
dialer = findViewById(R.id.dialer);
|
||||
dialer.setOnClickListener(this);
|
||||
chat = (RelativeLayout) findViewById(R.id.chat);
|
||||
chat = findViewById(R.id.chat);
|
||||
chat.setOnClickListener(this);
|
||||
|
||||
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);
|
||||
chat_selected = findViewById(R.id.chat_select);
|
||||
|
||||
missedCalls = (TextView) findViewById(R.id.missed_calls);
|
||||
missedChats = (TextView) findViewById(R.id.missed_chats);
|
||||
missedCalls = findViewById(R.id.missed_calls);
|
||||
missedChats = findViewById(R.id.missed_chats);
|
||||
}
|
||||
|
||||
public boolean isTablet() {
|
||||
|
|
|
@ -246,9 +246,9 @@ private static AssistantActivity instance;
|
|||
}
|
||||
|
||||
private void initUI() {
|
||||
back = (ImageView) findViewById(R.id.back);
|
||||
back = findViewById(R.id.back);
|
||||
back.setOnClickListener(this);
|
||||
cancel = (ImageView) findViewById(R.id.assistant_cancel);
|
||||
cancel = findViewById(R.id.assistant_cancel);
|
||||
cancel.setOnClickListener(this);
|
||||
}
|
||||
|
||||
|
@ -369,7 +369,6 @@ private static AssistantActivity instance;
|
|||
public void configureProxyConfig(AccountCreator accountCreator) {
|
||||
Core lc = LinphoneManager.getLc();
|
||||
ProxyConfig proxyConfig = lc.createProxyConfig();
|
||||
Address addr;
|
||||
AuthInfo authInfo;
|
||||
|
||||
String identity = proxyConfig.getIdentityAddress().asStringUriOnly();
|
||||
|
@ -378,7 +377,7 @@ private static AssistantActivity instance;
|
|||
return;
|
||||
}
|
||||
identity = identity.replace("?", accountCreator.getUsername());
|
||||
addr = Factory.instance().createAddress(identity);
|
||||
Address addr = Factory.instance().createAddress(identity);
|
||||
addr.setDisplayName(accountCreator.getUsername());
|
||||
address = addr;
|
||||
proxyConfig.edit();
|
||||
|
|
|
@ -21,7 +21,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.R;
|
||||
import org.linphone.core.CoreException;
|
||||
import org.linphone.core.tools.OpenH264DownloadHelperListener;
|
||||
import org.linphone.core.PayloadType;
|
||||
import org.linphone.core.tools.OpenH264DownloadHelper;
|
||||
|
@ -53,14 +52,14 @@ public class CodecDownloaderFragment extends Fragment {
|
|||
Bundle savedInstanceState) {
|
||||
final View view = inflater.inflate(R.layout.assistant_codec_downloader, container, false);
|
||||
|
||||
question = (TextView) view.findViewById(R.id.question);
|
||||
downloading = (TextView) view.findViewById(R.id.downloading);
|
||||
downloaded = (TextView) view.findViewById(R.id.downloaded);
|
||||
yes = (Button) view.findViewById(R.id.answerYes);
|
||||
no = (Button) view.findViewById(R.id.answerNo);
|
||||
ok = (Button) view.findViewById(R.id.answerOk);
|
||||
bar = (ProgressBar) view.findViewById(R.id.progressBar);
|
||||
downloadingInfo = (TextView) view.findViewById(R.id.downloadingInfo);
|
||||
question = view.findViewById(R.id.question);
|
||||
downloading = view.findViewById(R.id.downloading);
|
||||
downloaded = view.findViewById(R.id.downloaded);
|
||||
yes = view.findViewById(R.id.answerYes);
|
||||
no = view.findViewById(R.id.answerNo);
|
||||
ok = view.findViewById(R.id.answerOk);
|
||||
bar = view.findViewById(R.id.progressBar);
|
||||
downloadingInfo = view.findViewById(R.id.downloadingInfo);
|
||||
|
||||
final OpenH264DownloadHelper codecDownloader = LinphoneManager.getInstance().getOpenH264DownloadHelper();
|
||||
final OpenH264DownloadHelperListener codecListener = new OpenH264DownloadHelperListener() {
|
||||
|
|
|
@ -34,7 +34,6 @@ import android.widget.EditText;
|
|||
import android.widget.ImageView;
|
||||
import android.widget.ListView;
|
||||
|
||||
|
||||
public class CountryListFragment extends Fragment implements AdapterView.OnItemClickListener, View.OnClickListener {
|
||||
private ListView list;
|
||||
private EditText search;
|
||||
|
@ -49,11 +48,11 @@ public class CountryListFragment extends Fragment implements AdapterView.OnItemC
|
|||
adapter = AssistantActivity.instance().getCountryListAdapter();
|
||||
adapter.setInflater(inflater);
|
||||
|
||||
search = (EditText)view.findViewById(R.id.search_country);
|
||||
clearSearchField = (ImageView) view.findViewById(R.id.clearSearchField);
|
||||
search = view.findViewById(R.id.search_country);
|
||||
clearSearchField = view.findViewById(R.id.clearSearchField);
|
||||
clearSearchField.setOnClickListener(this);
|
||||
|
||||
list = (ListView)view.findViewById(R.id.countryList);
|
||||
list = view.findViewById(R.id.countryList);
|
||||
list.setAdapter(adapter);
|
||||
list.setOnItemClickListener(this);
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ import org.linphone.LinphonePreferences;
|
|||
import org.linphone.R;
|
||||
import org.linphone.core.AccountCreator;
|
||||
import org.linphone.core.AccountCreatorListener;
|
||||
import org.linphone.core.Factory;
|
||||
|
||||
public class CreateAccountActivationFragment extends Fragment implements OnClickListener, AccountCreatorListener {
|
||||
private String username, password;
|
||||
|
@ -54,10 +53,10 @@ public class CreateAccountActivationFragment extends Fragment implements OnClick
|
|||
accountCreator.setUsername(username);
|
||||
accountCreator.setPassword(password);
|
||||
|
||||
email = (TextView) view.findViewById(R.id.send_email);
|
||||
email = view.findViewById(R.id.send_email);
|
||||
email.setText(getArguments().getString("Email"));
|
||||
|
||||
checkAccount = (Button) view.findViewById(R.id.assistant_check);
|
||||
checkAccount = view.findViewById(R.id.assistant_check);
|
||||
checkAccount.setOnClickListener(this);
|
||||
return view;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.linphone.LinphonePreferences;
|
|||
import org.linphone.R;
|
||||
import org.linphone.core.AccountCreator;
|
||||
import org.linphone.core.AccountCreatorListener;
|
||||
import org.linphone.core.Factory;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.os.Bundle;
|
||||
|
@ -67,21 +66,21 @@ public class CreateAccountCodeActivationFragment extends Fragment implements Acc
|
|||
accountCreator.setUsername(username);
|
||||
accountCreator.setPhoneNumber(phone, dialcode);
|
||||
|
||||
back = (ImageView) view.findViewById(R.id.back);
|
||||
back = view.findViewById(R.id.back);
|
||||
if (back != null)
|
||||
back.setVisibility(Button.INVISIBLE);
|
||||
|
||||
title = (TextView) view.findViewById(R.id.title_account_activation);
|
||||
title = view.findViewById(R.id.title_account_activation);
|
||||
if (linkAccount) {
|
||||
title.setText(getString(R.string.assistant_link_account));
|
||||
} else if (recoverAccount) {
|
||||
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());
|
||||
|
||||
code = (EditText) view.findViewById(R.id.assistant_code);
|
||||
code = view.findViewById(R.id.assistant_code);
|
||||
code.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
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.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.util.Locale;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.linphone.activities.LinphoneActivity;
|
||||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.LinphonePreferences;
|
||||
import org.linphone.LinphoneUtils;
|
||||
|
@ -38,7 +37,6 @@ import android.accounts.AccountManager;
|
|||
import android.app.AlertDialog;
|
||||
import android.app.Fragment;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.telephony.TelephonyManager;
|
||||
|
@ -85,41 +83,41 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
accountCreator = LinphoneManager.getLc().createAccountCreator(LinphonePreferences.instance().getXmlrpcUrl());
|
||||
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);
|
||||
usernameLayout = (LinearLayout) view.findViewById(R.id.username_layout);
|
||||
emailLayout = (LinearLayout) view.findViewById(R.id.email_layout);
|
||||
passwordLayout = (LinearLayout) view.findViewById(R.id.password_layout);
|
||||
passwordConfirmLayout = (LinearLayout) view.findViewById(R.id.password_confirm_layout);
|
||||
phoneNumberLayout = view.findViewById(R.id.phone_number_layout);
|
||||
usernameLayout = view.findViewById(R.id.username_layout);
|
||||
emailLayout = view.findViewById(R.id.email_layout);
|
||||
passwordLayout = view.findViewById(R.id.password_layout);
|
||||
passwordConfirmLayout = view.findViewById(R.id.password_confirm_layout);
|
||||
|
||||
useUsername = (CheckBox) view.findViewById(R.id.use_username);
|
||||
useEmail = (CheckBox) view.findViewById(R.id.use_email);
|
||||
useUsername = view.findViewById(R.id.use_username);
|
||||
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);
|
||||
phoneNumberEdit = (EditText) view.findViewById(R.id.phone_number);
|
||||
sipUri = (TextView) view.findViewById(R.id.sip_uri);
|
||||
phoneNumberError = view.findViewById(R.id.phone_number_error);
|
||||
phoneNumberEdit = view.findViewById(R.id.phone_number);
|
||||
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);
|
||||
dialCode = (EditText) view.findViewById(R.id.dial_code);
|
||||
assisstantTitle = (TextView) view.findViewById(R.id.assistant_title);
|
||||
selectCountry = view.findViewById(R.id.select_country);
|
||||
dialCode = view.findViewById(R.id.dial_code);
|
||||
assisstantTitle = view.findViewById(R.id.assistant_title);
|
||||
|
||||
passwordError = (TextView) view.findViewById(R.id.password_error);
|
||||
passwordEdit = (EditText) view.findViewById(R.id.password);
|
||||
passwordError = view.findViewById(R.id.password_error);
|
||||
passwordEdit = view.findViewById(R.id.password);
|
||||
|
||||
passwordConfirmError = (TextView) view.findViewById(R.id.confirm_password_error);
|
||||
passwordConfirmEdit = (EditText) view.findViewById(R.id.confirm_password);
|
||||
passwordConfirmError = view.findViewById(R.id.confirm_password_error);
|
||||
passwordConfirmEdit = view.findViewById(R.id.confirm_password);
|
||||
|
||||
emailError = (TextView) view.findViewById(R.id.email_error);
|
||||
emailEdit = (EditText) view.findViewById(R.id.email);
|
||||
emailError = view.findViewById(R.id.email_error);
|
||||
emailEdit = view.findViewById(R.id.email);
|
||||
|
||||
skip = (TextView) view.findViewById(R.id.assistant_skip);
|
||||
skip = view.findViewById(R.id.assistant_skip);
|
||||
|
||||
//Phone number
|
||||
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(
|
||||
Context.TELEPHONY_SERVICE);
|
||||
String countryIso = tm.getNetworkCountryIso();
|
||||
ProxyConfig proxyConfig = LinphoneManager.getLc().createProxyConfig();
|
||||
countryCode = org.linphone.core.Utils.getCccFromIso(countryIso.toUpperCase());
|
||||
|
||||
phoneNumberLayout.setVisibility(View.VISIBLE);
|
||||
|
|
|
@ -29,9 +29,7 @@ import org.linphone.core.CoreListenerStub;
|
|||
import org.linphone.core.XmlRpcArgType;
|
||||
import org.linphone.core.XmlRpcRequest;
|
||||
import org.linphone.core.XmlRpcRequestListener;
|
||||
//import org.linphone.core.XmlRpcRequestImpl;
|
||||
import org.linphone.core.XmlRpcSession;
|
||||
//import org.linphone.core.XmlRpcSessionImpl;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
import android.app.Fragment;
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.linphone.compatibility.Compatibility;
|
|||
import org.linphone.core.AccountCreatorListener;
|
||||
import org.linphone.core.DialPlan;
|
||||
import org.linphone.core.AccountCreator;
|
||||
import org.linphone.core.Factory;
|
||||
import org.linphone.core.ProxyConfig;
|
||||
|
||||
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";
|
||||
|
||||
login = (EditText) view.findViewById(R.id.assistant_username);
|
||||
login = view.findViewById(R.id.assistant_username);
|
||||
login.addTextChangedListener(this);
|
||||
|
||||
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);
|
||||
phoneNumberLayout = (LinearLayout) view.findViewById(R.id.phone_number_layout);
|
||||
phoneNumberError = (TextView) view.findViewById(R.id.phone_number_error_2);
|
||||
phoneNumberEdit = view.findViewById(R.id.phone_number);
|
||||
phoneNumberLayout = view.findViewById(R.id.phone_number_layout);
|
||||
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);
|
||||
usernameLayout = (LinearLayout) view.findViewById(R.id.username_layout);
|
||||
passwordLayout = (LinearLayout) view.findViewById(R.id.password_layout);
|
||||
password = (EditText) view.findViewById(R.id.assistant_password);
|
||||
messagePhoneNumber = (TextView) view.findViewById(R.id.message_phone_number);
|
||||
useUsername = view.findViewById(R.id.use_username);
|
||||
usernameLayout = view.findViewById(R.id.username_layout);
|
||||
passwordLayout = view.findViewById(R.id.password_layout);
|
||||
password = view.findViewById(R.id.assistant_password);
|
||||
messagePhoneNumber = view.findViewById(R.id.message_phone_number);
|
||||
|
||||
forgotPassword = (TextView) view.findViewById(R.id.forgot_password);
|
||||
selectCountry = (Button) view.findViewById(R.id.select_country);
|
||||
forgotPassword = view.findViewById(R.id.forgot_password);
|
||||
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.setOnClickListener(this);
|
||||
|
||||
|
@ -111,7 +110,6 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
|
|||
(TelephonyManager) getActivity().getApplicationContext().getSystemService(
|
||||
Context.TELEPHONY_SERVICE);
|
||||
String countryIso = tm.getNetworkCountryIso();
|
||||
ProxyConfig proxyConfig = LinphoneManager.getLc().createProxyConfig();
|
||||
countryCode = org.linphone.core.Utils.getCccFromIso(countryIso.toUpperCase());
|
||||
|
||||
|
||||
|
|
|
@ -43,18 +43,18 @@ public class LoginFragment extends Fragment implements OnClickListener, TextWatc
|
|||
Bundle savedInstanceState) {
|
||||
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);
|
||||
displayName = (EditText) view.findViewById(R.id.assistant_display_name);
|
||||
displayName = view.findViewById(R.id.assistant_display_name);
|
||||
displayName.addTextChangedListener(this);
|
||||
userid = (EditText) view.findViewById(R.id.assistant_userid);
|
||||
userid = view.findViewById(R.id.assistant_userid);
|
||||
userid.addTextChangedListener(this);
|
||||
password = (EditText) view.findViewById(R.id.assistant_password);
|
||||
password = view.findViewById(R.id.assistant_password);
|
||||
password.addTextChangedListener(this);
|
||||
domain = (EditText) view.findViewById(R.id.assistant_domain);
|
||||
domain = view.findViewById(R.id.assistant_domain);
|
||||
domain.addTextChangedListener(this);
|
||||
transports = (RadioGroup) view.findViewById(R.id.assistant_transports);
|
||||
apply = (Button) view.findViewById(R.id.assistant_apply);
|
||||
transports = view.findViewById(R.id.assistant_transports);
|
||||
apply = view.findViewById(R.id.assistant_apply);
|
||||
apply.setEnabled(false);
|
||||
apply.setOnClickListener(this);
|
||||
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
|
||||
|
@ -53,7 +52,7 @@ public class RemoteProvisioningActivity extends Activity {
|
|||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.remote_provisioning);
|
||||
spinner = (ProgressBar) findViewById(R.id.spinner);
|
||||
spinner = findViewById(R.id.spinner);
|
||||
|
||||
mListener = new CoreListenerStub(){
|
||||
@Override
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
||||
|
||||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.LinphonePreferences;
|
||||
import org.linphone.R;
|
||||
|
@ -43,9 +42,9 @@ public class RemoteProvisioningFragment extends Fragment implements OnClickListe
|
|||
Bundle savedInstanceState) {
|
||||
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);
|
||||
apply = (Button) view.findViewById(R.id.assistant_apply);
|
||||
apply = view.findViewById(R.id.assistant_apply);
|
||||
apply.setEnabled(false);
|
||||
apply.setOnClickListener(this);
|
||||
|
||||
|
|
|
@ -45,11 +45,11 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick
|
|||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.assistant_remote_provisioning_login);
|
||||
|
||||
login = (EditText) findViewById(R.id.assistant_username);
|
||||
password = (EditText) findViewById(R.id.assistant_password);
|
||||
domain = (EditText) findViewById(R.id.assistant_domain);
|
||||
login = findViewById(R.id.assistant_username);
|
||||
password = findViewById(R.id.assistant_password);
|
||||
domain = findViewById(R.id.assistant_domain);
|
||||
|
||||
connect = (Button) findViewById(R.id.assistant_connect);
|
||||
connect = findViewById(R.id.assistant_connect);
|
||||
connect.setOnClickListener(this);
|
||||
|
||||
String defaultDomain = getIntent().getStringExtra("Domain");
|
||||
|
@ -91,22 +91,6 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick
|
|||
LinphonePreferences.instance().firstLaunchSuccessful();
|
||||
setResult(Activity.RESULT_OK);
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import org.linphone.R;
|
||||
|
||||
import android.app.Fragment;
|
||||
|
@ -35,24 +36,24 @@ public class WelcomeFragment extends Fragment implements OnClickListener {
|
|||
Bundle savedInstanceState) {
|
||||
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);
|
||||
|
||||
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)) {
|
||||
logLinphoneAccount.setVisibility(View.GONE);
|
||||
} else {
|
||||
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)) {
|
||||
logGenericAccount.setVisibility(View.GONE);
|
||||
} else {
|
||||
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)) {
|
||||
remoteProvisioning.setVisibility(View.GONE);
|
||||
} else {
|
||||
|
|
|
@ -174,8 +174,8 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
|
||||
cameraNumber = AndroidCameraConfiguration.retrieveCameras().length;
|
||||
|
||||
mEncoderTexts = new HashMap<String, String>();
|
||||
mDecoderTexts = new HashMap<String, String>();
|
||||
mEncoderTexts = new HashMap<>();
|
||||
mDecoderTexts = new HashMap<>();
|
||||
|
||||
mListener = new CoreListenerStub() {
|
||||
@Override
|
||||
|
@ -236,14 +236,6 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
showAcceptCallUpdateDialog();
|
||||
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();
|
||||
|
@ -353,88 +345,88 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
|
||||
private void initUI() {
|
||||
inflater = LayoutInflater.from(this);
|
||||
container = (ViewGroup) findViewById(R.id.topLayout);
|
||||
callsList = (LinearLayout) findViewById(R.id.calls_list);
|
||||
conferenceList = (LinearLayout) findViewById(R.id.conference_list);
|
||||
container = findViewById(R.id.topLayout);
|
||||
callsList = findViewById(R.id.calls_list);
|
||||
conferenceList = findViewById(R.id.conference_list);
|
||||
|
||||
//TopBar
|
||||
video = (ImageView) findViewById(R.id.video);
|
||||
video = findViewById(R.id.video);
|
||||
video.setOnClickListener(this);
|
||||
enabledVideoButton(false);
|
||||
|
||||
videoProgress = (ProgressBar) findViewById(R.id.video_in_progress);
|
||||
videoProgress = findViewById(R.id.video_in_progress);
|
||||
videoProgress.setVisibility(View.GONE);
|
||||
|
||||
micro = (ImageView) findViewById(R.id.micro);
|
||||
micro = findViewById(R.id.micro);
|
||||
micro.setOnClickListener(this);
|
||||
|
||||
speaker = (ImageView) findViewById(R.id.speaker);
|
||||
speaker = findViewById(R.id.speaker);
|
||||
speaker.setOnClickListener(this);
|
||||
|
||||
options = (ImageView) findViewById(R.id.options);
|
||||
options = findViewById(R.id.options);
|
||||
options.setOnClickListener(this);
|
||||
options.setEnabled(false);
|
||||
|
||||
//BottonBar
|
||||
hangUp = (ImageView) findViewById(R.id.hang_up);
|
||||
hangUp = findViewById(R.id.hang_up);
|
||||
hangUp.setOnClickListener(this);
|
||||
|
||||
dialer = (ImageView) findViewById(R.id.dialer);
|
||||
dialer = findViewById(R.id.dialer);
|
||||
dialer.setOnClickListener(this);
|
||||
|
||||
numpad = (Numpad) findViewById(R.id.numpad);
|
||||
numpad = findViewById(R.id.numpad);
|
||||
numpad.getBackground().setAlpha(240);
|
||||
|
||||
chat = (ImageView) findViewById(R.id.chat);
|
||||
chat = findViewById(R.id.chat);
|
||||
chat.setOnClickListener(this);
|
||||
missedChats = (TextView) findViewById(R.id.missed_chats);
|
||||
missedChats = findViewById(R.id.missed_chats);
|
||||
|
||||
//Others
|
||||
|
||||
//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);
|
||||
enabledPauseButton(false);
|
||||
|
||||
mActiveCallHeader = (RelativeLayout) findViewById(R.id.active_call);
|
||||
mNoCurrentCall = (LinearLayout) findViewById(R.id.no_current_call);
|
||||
mCallPaused = (LinearLayout) findViewById(R.id.remote_pause);
|
||||
mActiveCallHeader = findViewById(R.id.active_call);
|
||||
mNoCurrentCall = findViewById(R.id.no_current_call);
|
||||
mCallPaused = findViewById(R.id.remote_pause);
|
||||
|
||||
contactPicture = (ImageView) findViewById(R.id.contact_picture);
|
||||
avatar_layout = (RelativeLayout) findViewById(R.id.avatar_layout);
|
||||
contactPicture = findViewById(R.id.contact_picture);
|
||||
avatar_layout = findViewById(R.id.avatar_layout);
|
||||
|
||||
//Options
|
||||
addCall = (ImageView) findViewById(R.id.add_call);
|
||||
addCall = findViewById(R.id.add_call);
|
||||
addCall.setOnClickListener(this);
|
||||
addCall.setEnabled(false);
|
||||
|
||||
transfer = (ImageView) findViewById(R.id.transfer);
|
||||
transfer = findViewById(R.id.transfer);
|
||||
transfer.setOnClickListener(this);
|
||||
transfer.setEnabled(false);
|
||||
|
||||
conference = (ImageView) findViewById(R.id.conference);
|
||||
conference = findViewById(R.id.conference);
|
||||
conference.setEnabled(false);
|
||||
conference.setOnClickListener(this);
|
||||
|
||||
try {
|
||||
audioRoute = (ImageView) findViewById(R.id.audio_route);
|
||||
audioRoute = findViewById(R.id.audio_route);
|
||||
audioRoute.setOnClickListener(this);
|
||||
routeSpeaker = (ImageView) findViewById(R.id.route_speaker);
|
||||
routeSpeaker = findViewById(R.id.route_speaker);
|
||||
routeSpeaker.setOnClickListener(this);
|
||||
routeEarpiece = (ImageView) findViewById(R.id.route_earpiece);
|
||||
routeEarpiece = findViewById(R.id.route_earpiece);
|
||||
routeEarpiece.setOnClickListener(this);
|
||||
routeBluetooth = (ImageView) findViewById(R.id.route_bluetooth);
|
||||
routeBluetooth = findViewById(R.id.route_bluetooth);
|
||||
routeBluetooth.setOnClickListener(this);
|
||||
} catch (NullPointerException npe) {
|
||||
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);
|
||||
|
||||
mControlsLayout = (LinearLayout) findViewById(R.id.menu);
|
||||
mControlsLayout = findViewById(R.id.menu);
|
||||
|
||||
if (!isTransferAllowed) {
|
||||
addCall.setBackgroundResource(R.drawable.options_add_call);
|
||||
|
@ -505,10 +497,10 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
}
|
||||
|
||||
public void createInCallStats() {
|
||||
sideMenu = (DrawerLayout) findViewById(R.id.side_menu);
|
||||
menu = (ImageView) findViewById(R.id.call_quality);
|
||||
sideMenu = findViewById(R.id.side_menu);
|
||||
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() {
|
||||
@Override
|
||||
|
@ -796,7 +788,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
LayoutInflater inflater = getLayoutInflater();
|
||||
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);
|
||||
|
||||
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().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));
|
||||
Button delete = (Button) dialog.findViewById(R.id.delete_button);
|
||||
Button delete = dialog.findViewById(R.id.delete_button);
|
||||
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);
|
||||
isVideoAsk = true;
|
||||
|
||||
|
@ -1331,7 +1323,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
//CALL INFORMATION
|
||||
private void displayCurrentCall(Call call){
|
||||
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);
|
||||
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.setId(index+1);
|
||||
|
||||
TextView contactName = (TextView) callView.findViewById(R.id.contact_name);
|
||||
ImageView contactImage = (ImageView) callView.findViewById(R.id.contact_picture);
|
||||
TextView contactName = callView.findViewById(R.id.contact_name);
|
||||
ImageView contactImage = callView.findViewById(R.id.contact_picture);
|
||||
|
||||
Address lAddress = call.getRemoteAddress();
|
||||
setContactInformation(contactName, contactImage, lAddress);
|
||||
|
@ -1377,7 +1369,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
|
||||
private boolean displayCallStatusIconAndReturnCallPaused(LinearLayout callView, Call call) {
|
||||
boolean isCallPaused, isInConference;
|
||||
ImageView onCallStateChanged = (ImageView) callView.findViewById(R.id.call_pause);
|
||||
ImageView onCallStateChanged = callView.findViewById(R.id.call_pause);
|
||||
onCallStateChanged.setTag(call);
|
||||
onCallStateChanged.setOnClickListener(this);
|
||||
|
||||
|
@ -1404,9 +1396,9 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
|
||||
Chronometer timer;
|
||||
if(v == null){
|
||||
timer = (Chronometer) findViewById(R.id.current_call_timer);
|
||||
timer = findViewById(R.id.current_call_timer);
|
||||
} else {
|
||||
timer = (Chronometer) v.findViewById(R.id.call_timer);
|
||||
timer = v.findViewById(R.id.call_timer);
|
||||
}
|
||||
|
||||
if (timer == null) {
|
||||
|
@ -1510,7 +1502,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
|
||||
public void pauseOrResumeConference() {
|
||||
Core lc = LinphoneManager.getLc();
|
||||
conferenceStatus = (ImageView) findViewById(R.id.conference_pause);
|
||||
conferenceStatus = findViewById(R.id.conference_pause);
|
||||
if(conferenceStatus != null) {
|
||||
if (lc.isInConference()) {
|
||||
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){
|
||||
LinearLayout confView = (LinearLayout) inflater.inflate(R.layout.conf_call_control_row, container, false);
|
||||
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());
|
||||
if (lContact == null) {
|
||||
|
@ -1537,7 +1529,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
|
||||
registerCallDurationTimer(confView, call);
|
||||
|
||||
ImageView quitConference = (ImageView) confView.findViewById(R.id.quitConference);
|
||||
ImageView quitConference = confView.findViewById(R.id.quitConference);
|
||||
quitConference.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
@ -1551,7 +1543,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
private void displayConferenceHeader(){
|
||||
conferenceList.setVisibility(View.VISIBLE);
|
||||
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);
|
||||
conferenceList.addView(headerConference);
|
||||
|
||||
|
@ -1690,32 +1682,32 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
|
||||
if (call == null) return;
|
||||
|
||||
final TextView titleAudio = (TextView) view.findViewById(R.id.call_stats_audio);
|
||||
final TextView titleVideo = (TextView) view.findViewById(R.id.call_stats_video);
|
||||
final TextView codecAudio = (TextView) view.findViewById(R.id.codec_audio);
|
||||
final TextView codecVideo = (TextView) view.findViewById(R.id.codec_video);
|
||||
final TextView encoderAudio = (TextView) view.findViewById(R.id.encoder_audio);
|
||||
final TextView decoderAudio = (TextView) view.findViewById(R.id.decoder_audio);
|
||||
final TextView encoderVideo = (TextView) view.findViewById(R.id.encoder_video);
|
||||
final TextView decoderVideo = (TextView) view.findViewById(R.id.decoder_video);
|
||||
final TextView dlAudio = (TextView) view.findViewById(R.id.downloadBandwith_audio);
|
||||
final TextView ulAudio = (TextView) view.findViewById(R.id.uploadBandwith_audio);
|
||||
final TextView dlVideo = (TextView) view.findViewById(R.id.downloadBandwith_video);
|
||||
final TextView ulVideo = (TextView) view.findViewById(R.id.uploadBandwith_video);
|
||||
final TextView edlVideo = (TextView) view.findViewById(R.id.estimatedDownloadBandwidth_video);
|
||||
final TextView iceAudio = (TextView) view.findViewById(R.id.ice_audio);
|
||||
final TextView iceVideo = (TextView) view.findViewById(R.id.ice_video);
|
||||
final TextView videoResolutionSent = (TextView) view.findViewById(R.id.video_resolution_sent);
|
||||
final TextView videoResolutionReceived = (TextView) view.findViewById(R.id.video_resolution_received);
|
||||
final TextView videoFpsSent = (TextView) view.findViewById(R.id.video_fps_sent);
|
||||
final TextView videoFpsReceived = (TextView) view.findViewById(R.id.video_fps_received);
|
||||
final TextView senderLossRateAudio = (TextView) view.findViewById(R.id.senderLossRateAudio);
|
||||
final TextView receiverLossRateAudio = (TextView) view.findViewById(R.id.receiverLossRateAudio);
|
||||
final TextView senderLossRateVideo = (TextView) view.findViewById(R.id.senderLossRateVideo);
|
||||
final TextView receiverLossRateVideo = (TextView) view.findViewById(R.id.receiverLossRateVideo);
|
||||
final TextView ipAudio = (TextView) view.findViewById(R.id.ip_audio);
|
||||
final TextView ipVideo = (TextView) view.findViewById(R.id.ip_video);
|
||||
final TextView jitterBufferAudio = (TextView) view.findViewById(R.id.jitterBufferAudio);
|
||||
final TextView titleAudio = view.findViewById(R.id.call_stats_audio);
|
||||
final TextView titleVideo = view.findViewById(R.id.call_stats_video);
|
||||
final TextView codecAudio = view.findViewById(R.id.codec_audio);
|
||||
final TextView codecVideo = view.findViewById(R.id.codec_video);
|
||||
final TextView encoderAudio = view.findViewById(R.id.encoder_audio);
|
||||
final TextView decoderAudio = view.findViewById(R.id.decoder_audio);
|
||||
final TextView encoderVideo = view.findViewById(R.id.encoder_video);
|
||||
final TextView decoderVideo = view.findViewById(R.id.decoder_video);
|
||||
final TextView dlAudio = view.findViewById(R.id.downloadBandwith_audio);
|
||||
final TextView ulAudio = view.findViewById(R.id.uploadBandwith_audio);
|
||||
final TextView dlVideo = view.findViewById(R.id.downloadBandwith_video);
|
||||
final TextView ulVideo = view.findViewById(R.id.uploadBandwith_video);
|
||||
final TextView edlVideo = view.findViewById(R.id.estimatedDownloadBandwidth_video);
|
||||
final TextView iceAudio = view.findViewById(R.id.ice_audio);
|
||||
final TextView iceVideo = view.findViewById(R.id.ice_video);
|
||||
final TextView videoResolutionSent = view.findViewById(R.id.video_resolution_sent);
|
||||
final TextView videoResolutionReceived = view.findViewById(R.id.video_resolution_received);
|
||||
final TextView videoFpsSent = view.findViewById(R.id.video_fps_sent);
|
||||
final TextView videoFpsReceived = view.findViewById(R.id.video_fps_received);
|
||||
final TextView senderLossRateAudio = view.findViewById(R.id.senderLossRateAudio);
|
||||
final TextView receiverLossRateAudio = view.findViewById(R.id.receiverLossRateAudio);
|
||||
final TextView senderLossRateVideo = view.findViewById(R.id.senderLossRateVideo);
|
||||
final TextView receiverLossRateVideo = view.findViewById(R.id.receiverLossRateVideo);
|
||||
final TextView ipAudio = view.findViewById(R.id.ip_audio);
|
||||
final TextView ipVideo = view.findViewById(R.id.ip_video);
|
||||
final TextView jitterBufferAudio = view.findViewById(R.id.jitterBufferAudio);
|
||||
final View videoLayout = view.findViewById(R.id.callStatsVideo);
|
||||
final View audioLayout = view.findViewById(R.id.callStatsAudio);
|
||||
|
||||
|
|
|
@ -21,12 +21,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
import android.app.Fragment;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.View.OnTouchListener;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import org.linphone.call.CallActivity;
|
||||
import org.linphone.R;
|
||||
|
||||
public class CallAudioFragment extends Fragment {
|
||||
|
@ -53,48 +50,4 @@ public class CallAudioFragment extends Fragment {
|
|||
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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,9 +48,6 @@ import java.util.Calendar;
|
|||
import java.util.List;
|
||||
|
||||
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,
|
||||
View.OnLongClickListener{
|
||||
public TextView contact;
|
||||
|
@ -61,34 +58,34 @@ public class CallHistoryAdapter extends SelectableAdapter<CallHistoryAdapter.Vie
|
|||
public RelativeLayout CallContact;
|
||||
public LinearLayout separator;
|
||||
public TextView separatorText;
|
||||
private CallHistoryAdapter.ViewHolder.ClickListener listener;
|
||||
private CallHistoryAdapter.ViewHolder.ClickListener mListener;
|
||||
|
||||
public ViewHolder(View view, CallHistoryAdapter.ViewHolder.ClickListener listener) {
|
||||
super(view);
|
||||
contact = (TextView) view.findViewById(R.id.sip_uri);
|
||||
detail = (ImageView) view.findViewById(R.id.detail);
|
||||
select = (CheckBox) view.findViewById(R.id.delete);
|
||||
callDirection = (ImageView) view.findViewById(R.id.icon);
|
||||
contactPicture = (ImageView) view.findViewById(R.id.contact_picture);
|
||||
CallContact = (RelativeLayout) view.findViewById(R.id.history_click);
|
||||
separator = (LinearLayout) view.findViewById(R.id.separator);
|
||||
separatorText = (TextView) view.findViewById(R.id.separator_text);
|
||||
this.listener = listener;
|
||||
contact = view.findViewById(R.id.sip_uri);
|
||||
detail = view.findViewById(R.id.detail);
|
||||
select = view.findViewById(R.id.delete);
|
||||
callDirection = view.findViewById(R.id.icon);
|
||||
contactPicture = view.findViewById(R.id.contact_picture);
|
||||
CallContact = view.findViewById(R.id.history_click);
|
||||
separator = view.findViewById(R.id.separator);
|
||||
separatorText = view.findViewById(R.id.separator_text);
|
||||
mListener = listener;
|
||||
view.setOnClickListener(this);
|
||||
view.setOnLongClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (listener != null) {
|
||||
listener.onItemClicked(getAdapterPosition());
|
||||
if (mListener != null) {
|
||||
mListener.onItemClicked(getAdapterPosition());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onLongClick(View view) {
|
||||
if (listener != null) {
|
||||
return listener.onItemLongClicked(getAdapterPosition());
|
||||
if (mListener != null) {
|
||||
return mListener.onItemLongClicked(getAdapterPosition());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -49,12 +49,11 @@ import org.linphone.core.CallParams;
|
|||
import org.linphone.core.Core;
|
||||
import org.linphone.core.CoreListenerStub;
|
||||
import org.linphone.mediastream.Log;
|
||||
import org.linphone.ui.LinphoneSliders.LinphoneSliderTriggered;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CallIncomingActivity extends LinphoneGenericActivity implements LinphoneSliderTriggered {
|
||||
public class CallIncomingActivity extends LinphoneGenericActivity {
|
||||
private static CallIncomingActivity instance;
|
||||
|
||||
private TextView name, number;
|
||||
|
@ -86,9 +85,9 @@ public class CallIncomingActivity extends LinphoneGenericActivity implements Lin
|
|||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
setContentView(R.layout.call_incoming);
|
||||
|
||||
name = (TextView) findViewById(R.id.contact_name);
|
||||
number = (TextView) findViewById(R.id.contact_number);
|
||||
contactPicture = (ImageView) findViewById(R.id.contact_picture);
|
||||
name = findViewById(R.id.contact_name);
|
||||
number = findViewById(R.id.contact_number);
|
||||
contactPicture = findViewById(R.id.contact_picture);
|
||||
|
||||
// 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;
|
||||
|
@ -96,18 +95,18 @@ public class CallIncomingActivity extends LinphoneGenericActivity implements Lin
|
|||
|
||||
final int screenWidth = getResources().getDisplayMetrics().widthPixels;
|
||||
|
||||
acceptUnlock = (LinearLayout) findViewById(R.id.acceptUnlock);
|
||||
declineUnlock = (LinearLayout) findViewById(R.id.declineUnlock);
|
||||
acceptUnlock = findViewById(R.id.acceptUnlock);
|
||||
declineUnlock = findViewById(R.id.declineUnlock);
|
||||
|
||||
accept = (ImageView) findViewById(R.id.accept);
|
||||
accept = findViewById(R.id.accept);
|
||||
lookupCurrentCall();
|
||||
if (LinphonePreferences.instance() != null && mCall != null && mCall.getRemoteParams() != null &&
|
||||
LinphonePreferences.instance().shouldAutomaticallyAcceptVideoRequests() &&
|
||||
mCall.getRemoteParams().videoEnabled()) {
|
||||
accept.setImageResource(R.drawable.call_video_start);
|
||||
}
|
||||
decline = (ImageView) findViewById(R.id.decline);
|
||||
arrow = (ImageView) findViewById(R.id.arrow_hangup);
|
||||
decline = findViewById(R.id.decline);
|
||||
arrow = findViewById(R.id.arrow_hangup);
|
||||
accept.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -118,7 +117,6 @@ public class CallIncomingActivity extends LinphoneGenericActivity implements Lin
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
accept.setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
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() {
|
||||
ArrayList<String> permissionsList = new ArrayList<String>();
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.linphone.core.Core;
|
|||
import org.linphone.core.CoreException;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
|
||||
/**
|
||||
* Handle call updating, reinvites.
|
||||
*/
|
||||
|
@ -97,23 +96,6 @@ public class CallManager {
|
|||
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).
|
||||
* Update current call, without reinvite.
|
||||
|
|
|
@ -82,23 +82,23 @@ public class CallOutgoingActivity extends LinphoneGenericActivity implements OnC
|
|||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
setContentView(R.layout.call_outgoing);
|
||||
|
||||
name = (TextView) findViewById(R.id.contact_name);
|
||||
number = (TextView) findViewById(R.id.contact_number);
|
||||
contactPicture = (ImageView) findViewById(R.id.contact_picture);
|
||||
name = findViewById(R.id.contact_name);
|
||||
number = findViewById(R.id.contact_number);
|
||||
contactPicture = findViewById(R.id.contact_picture);
|
||||
|
||||
isMicMuted = false;
|
||||
isSpeakerEnabled = false;
|
||||
|
||||
micro = (ImageView) findViewById(R.id.micro);
|
||||
micro = findViewById(R.id.micro);
|
||||
micro.setOnClickListener(this);
|
||||
speaker = (ImageView) findViewById(R.id.speaker);
|
||||
speaker = findViewById(R.id.speaker);
|
||||
speaker.setOnClickListener(this);
|
||||
|
||||
// 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;
|
||||
getWindow().addFlags(flags);
|
||||
|
||||
hangUp = (ImageView) findViewById(R.id.outgoing_hang_up);
|
||||
hangUp = findViewById(R.id.outgoing_hang_up);
|
||||
hangUp.setOnClickListener(this);
|
||||
|
||||
mListener = new CoreListenerStub(){
|
||||
|
@ -255,7 +255,7 @@ public class CallOutgoingActivity extends LinphoneGenericActivity implements OnC
|
|||
LayoutInflater inflater = getLayoutInflater();
|
||||
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);
|
||||
|
||||
final Toast toast = new Toast(getApplicationContext());
|
||||
|
|
|
@ -34,7 +34,6 @@ import org.linphone.mediastream.Log;
|
|||
import org.linphone.mediastream.video.AndroidVideoWindowImpl;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.GestureDetector;
|
||||
|
@ -71,8 +70,8 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
|
|||
view = inflater.inflate(R.layout.video, container, false);
|
||||
}
|
||||
|
||||
mVideoView = (SurfaceView) view.findViewById(R.id.videoSurface);
|
||||
mCaptureView = (SurfaceView) view.findViewById(R.id.videoCaptureSurface);
|
||||
mVideoView = view.findViewById(R.id.videoSurface);
|
||||
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.
|
||||
|
||||
fixZOrder(mVideoView, mCaptureView);
|
||||
|
|
|
@ -64,7 +64,7 @@ public class ChatBubbleViewHolder extends RecyclerView.ViewHolder implements Vie
|
|||
public Button openFileButton;
|
||||
|
||||
public CheckBox delete;
|
||||
private ClickListener listener;
|
||||
private ClickListener mListener;
|
||||
|
||||
public ChatBubbleViewHolder(Context context, View view, ClickListener listener) {
|
||||
super(view);
|
||||
|
@ -99,7 +99,7 @@ public class ChatBubbleViewHolder extends RecyclerView.ViewHolder implements Vie
|
|||
|
||||
delete = view.findViewById(R.id.delete_message);
|
||||
|
||||
listener = listener;
|
||||
mListener = listener;
|
||||
|
||||
view.setOnClickListener(this);
|
||||
}
|
||||
|
@ -136,8 +136,8 @@ public class ChatBubbleViewHolder extends RecyclerView.ViewHolder implements Vie
|
|||
}
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (listener != null) {
|
||||
listener.onItemClicked(getAdapterPosition());
|
||||
if (mListener != null) {
|
||||
mListener.onItemClicked(getAdapterPosition());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
||||
|
||||
|
||||
mContactsList.setAdapter(mSearchAdapter);
|
||||
|
||||
//Divider between items + binds layout manager to our RecyclerView
|
||||
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mContactsList.getContext(),
|
||||
layoutManager.getOrientation());
|
||||
dividerItemDecoration.setDrawable(getActivity().getApplicationContext().getResources().getDrawable(R.drawable.divider));
|
||||
|
@ -159,8 +155,6 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
|
|||
|
||||
mContactsList.setLayoutManager(layoutManager);
|
||||
|
||||
|
||||
|
||||
if (savedInstanceState != null && savedInstanceState.getStringArrayList("mContactsSelected") != null) {
|
||||
mContactsSelectedLayout.removeAllViews();
|
||||
// We need to get all contacts not only sip
|
||||
|
@ -361,8 +355,6 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
|
|||
super.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
|
||||
//Removed all selection mode related code, as it is now located into SelectableHelper.
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
int id = view.getId();
|
||||
|
|
|
@ -73,7 +73,6 @@ import java.util.List;
|
|||
|
||||
import static android.content.Intent.FLAG_GRANT_READ_URI_PERMISSION;
|
||||
|
||||
|
||||
public class ChatEventsAdapter extends SelectableAdapter<ChatBubbleViewHolder> {
|
||||
|
||||
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) {
|
||||
super(res, bitmap);
|
||||
bitmapWorkerTaskReference = new WeakReference<BitmapWorkerTask>(bitmapWorkerTask);
|
||||
bitmapWorkerTaskReference = new WeakReference<>(bitmapWorkerTask);
|
||||
}
|
||||
|
||||
public BitmapWorkerTask getBitmapWorkerTask() {
|
||||
|
|
|
@ -52,7 +52,7 @@ import java.util.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 ImageView mNewDiscussionButton, mBackToCallButton;
|
||||
|
@ -212,7 +212,6 @@ public class ChatListFragment extends Fragment implements ContactsUpdatedListene
|
|||
ContactsManager.removeContactsListener(this);
|
||||
mChatRoomsAdapter.clear();
|
||||
super.onPause();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
151
src/android/org/linphone/chat/ChatRoomViewHolder.java
Normal file
151
src/android/org/linphone/chat/ChatRoomViewHolder.java
Normal 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);
|
||||
}
|
||||
}
|
|
@ -20,25 +20,12 @@ 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.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
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;
|
||||
import org.linphone.ui.SelectableAdapter;
|
||||
import org.linphone.ui.SelectableHelper;
|
||||
|
||||
|
@ -48,117 +35,9 @@ import java.util.Collections;
|
|||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
public class ChatRoomsAdapter extends SelectableAdapter<ChatRoomsAdapter.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);
|
||||
}
|
||||
}
|
||||
|
||||
public class ChatRoomsAdapter extends SelectableAdapter<ChatRoomViewHolder> {
|
||||
private Context mContext;
|
||||
public List<ChatRoom> mRooms;
|
||||
private static Bitmap mDefaultBitmap;
|
||||
private static Bitmap mDefaultGroupBitmap;
|
||||
private int mItemResource;
|
||||
private ChatRoomViewHolder.ClickListener mClickListener;
|
||||
|
||||
|
@ -168,8 +47,6 @@ public class ChatRoomsAdapter extends SelectableAdapter<ChatRoomsAdapter.ChatRoo
|
|||
mRooms = rooms;
|
||||
mContext = context;
|
||||
mItemResource = itemResource;
|
||||
mDefaultBitmap = ContactsManager.getInstance().getDefaultAvatarBitmap();
|
||||
mDefaultGroupBitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.chat_group_avatar);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,7 +24,6 @@ import android.support.v7.widget.RecyclerView;
|
|||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
@ -34,7 +33,6 @@ import org.linphone.R;
|
|||
import org.linphone.activities.LinphoneActivity;
|
||||
import org.linphone.contacts.ContactAddress;
|
||||
import org.linphone.contacts.LinphoneContact;
|
||||
import org.linphone.contacts.SearchContactsListAdapter;
|
||||
import org.linphone.core.ChatRoom;
|
||||
import org.linphone.core.Participant;
|
||||
|
||||
|
@ -43,14 +41,13 @@ import java.util.List;
|
|||
|
||||
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 ImageView avatar;
|
||||
public ImageView delete;
|
||||
public LinearLayout isAdmin;
|
||||
public LinearLayout isNotAdmin;
|
||||
|
||||
|
||||
public ViewHolder(View view) {
|
||||
super(view);
|
||||
name = view.findViewById(R.id.name);
|
||||
|
@ -59,14 +56,12 @@ public class GroupInfoAdapter extends RecyclerView.Adapter<GroupInfoAdapter.View
|
|||
isAdmin = view.findViewById(R.id.isAdminLayout);
|
||||
isNotAdmin = view.findViewById(R.id.isNotAdminLayout);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private List<ContactAddress> mItems;
|
||||
private View.OnClickListener mDeleteListener;
|
||||
private boolean mHideAdminFeatures;
|
||||
private ChatRoom mChatRoom;
|
||||
private ImageView mAavatar;
|
||||
|
||||
public GroupInfoAdapter(List<ContactAddress> items, boolean hideAdminFeatures, boolean isCreation) {
|
||||
mItems = items;
|
||||
|
@ -84,11 +79,11 @@ public class GroupInfoAdapter extends RecyclerView.Adapter<GroupInfoAdapter.View
|
|||
public void onBindViewHolder(@NonNull final ViewHolder holder, int position) {
|
||||
final ContactAddress ca = (ContactAddress)getItem(position);
|
||||
LinphoneContact c = ca.getContact();
|
||||
mAavatar = holder.avatar;
|
||||
ImageView avatar = holder.avatar;
|
||||
holder.name.setText((c.getFullName() != null) ? c.getFullName() :
|
||||
(ca.getDisplayName() != null) ? ca.getDisplayName() : ca.getUsername());
|
||||
if (c.hasPhoto()) {
|
||||
LinphoneUtils.setThumbnailPictureFromUri(LinphoneActivity.instance(), mAavatar, c.getThumbnailUri());
|
||||
LinphoneUtils.setThumbnailPictureFromUri(LinphoneActivity.instance(), avatar, c.getThumbnailUri());
|
||||
}
|
||||
|
||||
holder.delete.setOnClickListener(new View.OnClickListener() {
|
||||
|
|
|
@ -413,6 +413,22 @@ public class GroupInfoFragment extends Fragment implements ChatRoomListener {
|
|||
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
|
||||
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
|
||||
public void onIsComposingReceived(ChatRoom cr, Address remoteAddr, boolean isComposing) {
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
package org.linphone.chat;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.media.Image;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.text.Spanned;
|
||||
|
|
|
@ -119,7 +119,6 @@ public class ContactEditorFragment extends Fragment {
|
|||
sipAddressesSection.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
|
||||
deleteContact = (ImageView) view.findViewById(R.id.delete_contact);
|
||||
|
||||
cancel = (ImageView) view.findViewById(R.id.cancel);
|
||||
|
|
|
@ -44,9 +44,7 @@ import java.util.Locale;
|
|||
import java.util.Map;
|
||||
|
||||
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 ImageView linphoneFriend;
|
||||
public TextView name;
|
||||
|
@ -60,14 +58,14 @@ public class ContactsListAdapter extends SelectableAdapter<ContactsListAdapter.V
|
|||
private ViewHolder(View view, ClickListener listener) {
|
||||
super(view);
|
||||
|
||||
delete = (CheckBox) view.findViewById(R.id.delete);
|
||||
linphoneFriend = (ImageView) view.findViewById(R.id.friendLinphone);
|
||||
name = (TextView) view.findViewById(R.id.name);
|
||||
separator = (LinearLayout) view.findViewById(R.id.separator);
|
||||
separatorText = (TextView) view.findViewById(R.id.separator_text);
|
||||
contactPicture = (ImageView) view.findViewById(R.id.contact_picture);
|
||||
organization = (TextView) view.findViewById(R.id.contactOrganization);
|
||||
//friendStatus = (ImageView) view.findViewById(R.id.friendStatus);
|
||||
delete = view.findViewById(R.id.delete);
|
||||
linphoneFriend = view.findViewById(R.id.friendLinphone);
|
||||
name = view.findViewById(R.id.name);
|
||||
separator = view.findViewById(R.id.separator);
|
||||
separatorText = view.findViewById(R.id.separator_text);
|
||||
contactPicture = view.findViewById(R.id.contact_picture);
|
||||
organization = view.findViewById(R.id.contactOrganization);
|
||||
//friendStatus = view.findViewById(R.id.friendStatus);
|
||||
mListener = listener;
|
||||
view.setOnClickListener(this);
|
||||
view.setOnLongClickListener(this);
|
||||
|
@ -96,7 +94,7 @@ public class ContactsListAdapter extends SelectableAdapter<ContactsListAdapter.V
|
|||
private List<LinphoneContact> mContacts;
|
||||
private String[] mSections;
|
||||
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 Context mContext;
|
||||
private boolean mIsSearchMode;
|
||||
|
@ -169,7 +167,7 @@ public class ContactsListAdapter extends SelectableAdapter<ContactsListAdapter.V
|
|||
public void updateDataSet(List<LinphoneContact> contactsList) {
|
||||
mContacts = contactsList;
|
||||
|
||||
mMap = new LinkedHashMap<String, Integer>();
|
||||
mMap = new LinkedHashMap<>();
|
||||
String prevLetter = null;
|
||||
for (int i = 0; i < mContacts.size(); i++) {
|
||||
LinphoneContact contact = mContacts.get(i);
|
||||
|
@ -183,7 +181,7 @@ public class ContactsListAdapter extends SelectableAdapter<ContactsListAdapter.V
|
|||
mMap.put(firstLetter, i);
|
||||
}
|
||||
}
|
||||
mSectionsList = new ArrayList<String>(mMap.keySet());
|
||||
mSectionsList = new ArrayList<>(mMap.keySet());
|
||||
mSections = new String[mSectionsList.size()];
|
||||
mSectionsList.toArray(mSections);
|
||||
|
||||
|
|
|
@ -78,17 +78,17 @@ public class ContactsListFragment extends Fragment implements OnItemClickListene
|
|||
onlyDisplayChatAddress = getArguments().getBoolean("ChatAddressOnly");
|
||||
}
|
||||
|
||||
noSipContact = (TextView) view.findViewById(R.id.noSipContact);
|
||||
noContact = (TextView) view.findViewById(R.id.noContact);
|
||||
noSipContact = view.findViewById(R.id.noSipContact);
|
||||
noContact = view.findViewById(R.id.noContact);
|
||||
contactsList = view.findViewById(R.id.contactsList);
|
||||
|
||||
allContacts = (ImageView) view.findViewById(R.id.all_contacts);
|
||||
linphoneContacts = (ImageView) view.findViewById(R.id.linphone_contacts);
|
||||
allContacts = view.findViewById(R.id.all_contacts);
|
||||
linphoneContacts = view.findViewById(R.id.linphone_contacts);
|
||||
allContactsSelected = view.findViewById(R.id.all_contacts_select);
|
||||
linphoneContactsSelected = view.findViewById(R.id.linphone_contacts_select);
|
||||
edit = (ImageView) view.findViewById(R.id.edit);
|
||||
contactsFetchInProgress = (ProgressBar) view.findViewById(R.id.contactsFetchInProgress);
|
||||
newContact = (ImageView) view.findViewById(R.id.newContact);
|
||||
edit = view.findViewById(R.id.edit);
|
||||
contactsFetchInProgress = view.findViewById(R.id.contactsFetchInProgress);
|
||||
newContact = view.findViewById(R.id.newContact);
|
||||
|
||||
allContacts.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -131,7 +131,7 @@ public class ContactsListFragment extends Fragment implements OnItemClickListene
|
|||
contactsFetchInProgress.setVisibility(View.VISIBLE);
|
||||
|
||||
|
||||
clearSearchField = (ImageView) view.findViewById(R.id.clearSearchField);
|
||||
clearSearchField = view.findViewById(R.id.clearSearchField);
|
||||
clearSearchField.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
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() {
|
||||
@Override
|
||||
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);
|
||||
contactsList.setLayoutManager(layoutManager);
|
||||
|
||||
//Divider between items
|
||||
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(contactsList.getContext(),
|
||||
layoutManager.getOrientation());
|
||||
dividerItemDecoration.setDrawable(getActivity().getResources().getDrawable(R.drawable.divider));
|
||||
|
@ -202,7 +201,6 @@ public class ContactsListFragment extends Fragment implements OnItemClickListene
|
|||
isEditionEnabled=true;
|
||||
}
|
||||
|
||||
|
||||
mContactAdapter = new ContactsListAdapter(mContext, listContact, this, mSelectionHelper);
|
||||
|
||||
// contactsList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
|
||||
|
|
|
@ -42,7 +42,6 @@ import org.linphone.LinphoneService;
|
|||
import org.linphone.R;
|
||||
import org.linphone.core.Address;
|
||||
import org.linphone.core.Core;
|
||||
import org.linphone.core.Factory;
|
||||
import org.linphone.core.Friend;
|
||||
import org.linphone.core.FriendList;
|
||||
import org.linphone.core.FriendListListener;
|
||||
|
@ -84,10 +83,10 @@ public class ContactsManager extends ContentObserver implements FriendListListen
|
|||
super(handler);
|
||||
this.handler = handler;
|
||||
defaultAvatar = BitmapFactory.decodeResource(LinphoneService.instance().getResources(), R.drawable.avatar);
|
||||
androidContactsCache = new HashMap<String, LinphoneContact>();
|
||||
contactsUpdatedListeners = new ArrayList<ContactsUpdatedListener>();
|
||||
contacts = new ArrayList<LinphoneContact>();
|
||||
sipContacts = new ArrayList<LinphoneContact>();
|
||||
androidContactsCache = new HashMap<>();
|
||||
contactsUpdatedListeners = new ArrayList<>();
|
||||
contacts = new ArrayList<>();
|
||||
sipContacts = new ArrayList<>();
|
||||
if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null) {
|
||||
magicSearch = LinphoneManager.getLcIfManagerNotDestroyedOrNull().createMagicSearch();
|
||||
}
|
||||
|
@ -313,8 +312,8 @@ public class ContactsManager extends ContentObserver implements FriendListListen
|
|||
}
|
||||
|
||||
private synchronized void fetchContactsSync() {
|
||||
List<LinphoneContact> contacts = new ArrayList<LinphoneContact>();
|
||||
List<LinphoneContact> sipContacts = new ArrayList<LinphoneContact>();
|
||||
List<LinphoneContact> contacts = new ArrayList<>();
|
||||
List<LinphoneContact> sipContacts = new ArrayList<>();
|
||||
Date contactsTime = new Date();
|
||||
androidContactsCache.clear();
|
||||
|
||||
|
@ -521,7 +520,7 @@ public class ContactsManager extends ContentObserver implements FriendListListen
|
|||
|
||||
public void deleteMultipleContactsAtOnce(List<String> ids) {
|
||||
String select = ContactsContract.Data.CONTACT_ID + " = ?";
|
||||
ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>();
|
||||
ArrayList<ContentProviderOperation> ops = new ArrayList<>();
|
||||
|
||||
for (String id : ids) {
|
||||
String[] args = new String[] { id };
|
||||
|
|
|
@ -57,12 +57,12 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
|||
private boolean hasSipAddress;
|
||||
|
||||
public LinphoneContact() {
|
||||
addresses = new ArrayList<LinphoneNumberOrAddress>();
|
||||
addresses = new ArrayList<>();
|
||||
androidId = null;
|
||||
thumbnailUri = null;
|
||||
photoUri = null;
|
||||
changesToCommit = new ArrayList<ContentProviderOperation>();
|
||||
changesToCommit2 = new ArrayList<ContentProviderOperation>();
|
||||
changesToCommit = new ArrayList<>();
|
||||
changesToCommit2 = new ArrayList<>();
|
||||
hasSipAddress = false;
|
||||
}
|
||||
|
||||
|
@ -70,8 +70,6 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
|||
public int compareTo(LinphoneContact contact) {
|
||||
String fullName = getFullName() != null ? 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);
|
||||
}
|
||||
|
||||
|
@ -474,8 +472,8 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
|||
} catch (Exception e) {
|
||||
Log.e(e);
|
||||
} finally {
|
||||
changesToCommit = new ArrayList<ContentProviderOperation>();
|
||||
changesToCommit2 = new ArrayList<ContentProviderOperation>();
|
||||
changesToCommit = new ArrayList<>();
|
||||
changesToCommit2 = new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -509,7 +507,7 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
|||
}
|
||||
|
||||
public void refresh() {
|
||||
addresses = new ArrayList<LinphoneNumberOrAddress>();
|
||||
addresses = new ArrayList<>();
|
||||
if (isAndroidContact()) {
|
||||
getContactNames();
|
||||
getNativeContactOrganization();
|
||||
|
@ -741,7 +739,7 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
|||
}
|
||||
|
||||
private void createLinphoneContactTag() {
|
||||
ArrayList<ContentProviderOperation> batch = new ArrayList<ContentProviderOperation>();
|
||||
ArrayList<ContentProviderOperation> batch = new ArrayList<>();
|
||||
|
||||
batch.add(ContentProviderOperation.newInsert(ContactsContract.RawContacts.CONTENT_URI)
|
||||
.withValue(ContactsContract.RawContacts.ACCOUNT_TYPE, ContactsManager.getInstance().getString(R.string.sync_account_type))
|
||||
|
|
|
@ -25,7 +25,6 @@ import com.google.firebase.iid.FirebaseInstanceIdService;
|
|||
import org.linphone.LinphonePreferences;
|
||||
import org.linphone.LinphoneUtils;
|
||||
|
||||
|
||||
public class FirebaseIdService extends FirebaseInstanceIdService {
|
||||
@Override
|
||||
public void onTokenRefresh() {
|
||||
|
|
|
@ -57,8 +57,8 @@ public class AboutFragment extends Fragment implements OnClickListener {
|
|||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.about, container, false);
|
||||
|
||||
TextView aboutVersion = (TextView) view.findViewById(R.id.about_android_version);
|
||||
TextView aboutLiblinphoneVersion = (TextView) view.findViewById(R.id.about_liblinphone_version);
|
||||
TextView aboutVersion = view.findViewById(R.id.about_android_version);
|
||||
TextView aboutLiblinphoneVersion = view.findViewById(R.id.about_liblinphone_version);
|
||||
aboutLiblinphoneVersion.setText(String.format(getString(R.string.about_liblinphone_version), LinphoneManager.getLc().getVersion()));
|
||||
try {
|
||||
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");
|
||||
}
|
||||
|
||||
cancel = (ImageView) view.findViewById(R.id.cancel);
|
||||
cancel = view.findViewById(R.id.cancel);
|
||||
cancel.setOnClickListener(this);
|
||||
|
||||
sendLogButton = view.findViewById(R.id.send_log);
|
||||
|
|
|
@ -36,12 +36,8 @@ import org.linphone.core.ProxyConfig;
|
|||
import org.linphone.mediastream.Log;
|
||||
import org.linphone.ui.PreferencesListFragment;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.preference.CheckBoxPreference;
|
||||
import android.preference.EditTextPreference;
|
||||
|
@ -51,11 +47,7 @@ import android.preference.Preference.OnPreferenceChangeListener;
|
|||
import android.preference.Preference.OnPreferenceClickListener;
|
||||
import android.preference.PreferenceCategory;
|
||||
import android.preference.PreferenceScreen;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.EditText;
|
||||
|
||||
public class AccountPreferencesFragment extends PreferencesListFragment implements AccountCreatorListener {
|
||||
private int n;
|
||||
|
@ -484,71 +476,12 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen
|
|||
return true;
|
||||
}
|
||||
});
|
||||
if(!isNewAccount){
|
||||
if (!isNewAccount){
|
||||
mainAccount.setEnabled(!mainAccount.isChecked());
|
||||
}
|
||||
|
||||
//final AccountCreatorListener fragment = this;
|
||||
|
||||
final Preference changePassword = manage.getPreference(2);
|
||||
/*if (mPrefs.getAccountDomain(n).compareTo(getString(R.string.default_domain)) == 0) {
|
||||
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);
|
||||
//}
|
||||
changePassword.setEnabled(false);
|
||||
|
||||
final Preference delete = manage.getPreference(3);
|
||||
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
|
||||
public void onIsAccountExist(AccountCreator accountCreator, AccountCreator.Status status, String resp) {
|
||||
}
|
||||
|
@ -665,17 +611,4 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen
|
|||
@Override
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,13 +59,13 @@ public class DialerFragment extends Fragment {
|
|||
Bundle savedInstanceState) {
|
||||
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);
|
||||
|
||||
EraseButton erase = (EraseButton) view.findViewById(R.id.erase);
|
||||
EraseButton erase = view.findViewById(R.id.erase);
|
||||
erase.setAddressWidget(mAddress);
|
||||
|
||||
mCall = (CallButton) view.findViewById(R.id.call);
|
||||
mCall = view.findViewById(R.id.call);
|
||||
mCall.setAddressWidget(mAddress);
|
||||
if (LinphoneActivity.isInstanciated() && LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null && LinphoneManager.getLcIfManagerNotDestroyedOrNull().getCallsNb() > 0) {
|
||||
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) {
|
||||
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));
|
||||
|
||||
addContactListener = new OnClickListener() {
|
||||
|
@ -125,9 +125,6 @@ public class DialerFragment extends Fragment {
|
|||
if (displayName != null) {
|
||||
mAddress.setDisplayedName(displayName);
|
||||
}
|
||||
if (photo != null) {
|
||||
mAddress.setPictureUri(Uri.parse(photo));
|
||||
}
|
||||
}
|
||||
|
||||
instance = this;
|
||||
|
|
|
@ -71,36 +71,36 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
|
|||
mWaitLayout = view.findViewById(R.id.waitScreen);
|
||||
mWaitLayout.setVisibility(View.GONE);
|
||||
|
||||
dialBack = (ImageView) view.findViewById(R.id.call);
|
||||
dialBack = view.findViewById(R.id.call);
|
||||
dialBack.setOnClickListener(this);
|
||||
|
||||
back = (ImageView) view.findViewById(R.id.back);
|
||||
back = view.findViewById(R.id.back);
|
||||
if(getResources().getBoolean(R.bool.isTablet)){
|
||||
back.setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
back.setOnClickListener(this);
|
||||
}
|
||||
|
||||
chat = (ImageView) view.findViewById(R.id.chat);
|
||||
chat = view.findViewById(R.id.chat);
|
||||
chat.setOnClickListener(this);
|
||||
if (getResources().getBoolean(R.bool.disable_chat))
|
||||
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);
|
||||
|
||||
goToContact = (ImageView) view.findViewById(R.id.goto_contact);
|
||||
goToContact = view.findViewById(R.id.goto_contact);
|
||||
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);
|
||||
contactAddress = (TextView) view.findViewById(R.id.contact_address);
|
||||
contactName = view.findViewById(R.id.contact_name);
|
||||
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);
|
||||
date = (TextView) view.findViewById(R.id.date);
|
||||
time = view.findViewById(R.id.time);
|
||||
date = view.findViewById(R.id.date);
|
||||
|
||||
displayHistory(status, callTime, callDate);
|
||||
|
||||
|
@ -142,8 +142,7 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
|
|||
Long longDate = Long.parseLong(callDate);
|
||||
date.setText(LinphoneUtils.timestampToHumanDate(getActivity(),longDate,getString(R.string.history_detail_date_format)));
|
||||
|
||||
Address lAddress = null;
|
||||
lAddress = Factory.instance().createAddress(sipUri);
|
||||
Address lAddress = Factory.instance().createAddress(sipUri);
|
||||
|
||||
if (lAddress != null) {
|
||||
contactAddress.setText(lAddress.asStringUriOnly());
|
||||
|
|
|
@ -32,7 +32,6 @@ import android.view.ViewGroup;
|
|||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemClickListener;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.linphone.LinphoneManager;
|
||||
|
@ -55,7 +54,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
|||
private TextView noCallHistory, noMissedCallHistory;
|
||||
private ImageView missedCalls, allCalls, edit;
|
||||
private View allCallsSelected, missedCallsSelected;
|
||||
private boolean mOnlyDisplayMissedCalls, mIsEditMode;
|
||||
private boolean mOnlyDisplayMissedCalls;
|
||||
private List<CallLog> mLogs;
|
||||
private CallHistoryAdapter mHistoryAdapter;
|
||||
private LinearLayoutManager mLayoutManager;
|
||||
|
@ -69,10 +68,10 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
|||
mContext = getActivity().getApplicationContext();
|
||||
mSelectionHelper = new SelectableHelper(view, this);
|
||||
|
||||
noCallHistory = (TextView) view.findViewById(R.id.no_call_history);
|
||||
noMissedCallHistory = (TextView) view.findViewById(R.id.no_missed_call_history);
|
||||
noCallHistory = view.findViewById(R.id.no_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);
|
||||
historyList.setLayoutManager(mLayoutManager);
|
||||
|
@ -82,12 +81,12 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
|||
dividerItemDecoration.setDrawable(mContext.getResources().getDrawable(R.drawable.divider));
|
||||
historyList.addItemDecoration(dividerItemDecoration);
|
||||
|
||||
allCalls = (ImageView) view.findViewById(R.id.all_calls);
|
||||
allCalls = view.findViewById(R.id.all_calls);
|
||||
allCalls.setOnClickListener(this);
|
||||
|
||||
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);
|
||||
|
||||
missedCallsSelected = view.findViewById(R.id.missed_calls_select);
|
||||
|
@ -95,7 +94,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
|||
allCalls.setEnabled(false);
|
||||
mOnlyDisplayMissedCalls = false;
|
||||
|
||||
edit = (ImageView) view.findViewById(R.id.edit);
|
||||
edit = view.findViewById(R.id.edit);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
|
|
@ -68,13 +68,13 @@ public class StatusFragment extends Fragment {
|
|||
Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.status, container, false);
|
||||
|
||||
statusText = (TextView) view.findViewById(R.id.status_text);
|
||||
statusLed = (ImageView) view.findViewById(R.id.status_led);
|
||||
callQuality = (ImageView) view.findViewById(R.id.call_quality);
|
||||
encryption = (ImageView) view.findViewById(R.id.encryption);
|
||||
menu = (ImageView) view.findViewById(R.id.side_menu_button);
|
||||
voicemail = (ImageView) view.findViewById(R.id.voicemail);
|
||||
voicemailCount = (TextView) view.findViewById(R.id.voicemail_count);
|
||||
statusText = view.findViewById(R.id.status_text);
|
||||
statusLed = view.findViewById(R.id.status_led);
|
||||
callQuality = view.findViewById(R.id.call_quality);
|
||||
encryption = view.findViewById(R.id.encryption);
|
||||
menu = view.findViewById(R.id.side_menu_button);
|
||||
voicemail = view.findViewById(R.id.voicemail);
|
||||
voicemailCount = view.findViewById(R.id.voicemail_count);
|
||||
|
||||
// We create it once to not delay the first display
|
||||
populateSliderContent();
|
||||
|
@ -427,13 +427,13 @@ public class StatusFragment extends Fragment {
|
|||
//Screen is locked
|
||||
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)
|
||||
+ getString(R.string.zrtp_dialog2).replace("%s", zrtpToListen);
|
||||
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);
|
||||
Button cancel = (Button) ZRTPdialog.findViewById(R.id.cancel);
|
||||
Button cancel = ZRTPdialog.findViewById(R.id.cancel);
|
||||
cancel.setText(R.string.deny);
|
||||
|
||||
delete.setOnClickListener(new OnClickListener() {
|
||||
|
|
|
@ -56,13 +56,13 @@ public class InAppPurchaseActivity extends Activity implements InAppPurchaseList
|
|||
inAppPurchaseHelper = new InAppPurchaseHelper(this, this);
|
||||
setContentView(R.layout.in_app);
|
||||
|
||||
inProgress = (ProgressBar) findViewById(R.id.purchaseItemsFetchInProgress);
|
||||
inProgress = findViewById(R.id.purchaseItemsFetchInProgress);
|
||||
inProgress.setVisibility(View.VISIBLE);
|
||||
|
||||
back = (ImageView) findViewById(R.id.back);
|
||||
back = findViewById(R.id.back);
|
||||
back.setOnClickListener(this);
|
||||
back.setVisibility(View.INVISIBLE);
|
||||
cancel = (ImageView) findViewById(R.id.cancel);
|
||||
cancel = findViewById(R.id.cancel);
|
||||
cancel.setOnClickListener(this);
|
||||
|
||||
instance = this;
|
||||
|
@ -139,7 +139,7 @@ public class InAppPurchaseActivity extends Activity implements InAppPurchaseList
|
|||
public void onAvailableItemsForPurchaseQueryFinished(ArrayList<Purchasable> items) {
|
||||
//purchasableItemsLayout.removeAllViews();
|
||||
inProgress.setVisibility(View.GONE);
|
||||
purchasedItems = new ArrayList<Purchasable>();
|
||||
purchasedItems = new ArrayList<>();
|
||||
for (Purchasable item : items) {
|
||||
purchasedItems.add(item);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ import android.widget.EditText;
|
|||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
||||
public class InAppPurchaseFragment extends Fragment implements View.OnClickListener {
|
||||
private LinearLayout usernameLayout;
|
||||
private EditText username, email;
|
||||
|
@ -45,7 +44,7 @@ public class InAppPurchaseFragment extends Fragment implements View.OnClickListe
|
|||
|
||||
private boolean usernameOk = false, emailOk = false;
|
||||
private String defaultUsername, defaultEmail;
|
||||
private Button buyItemButton, recoverAccountButton;
|
||||
private Button buyItemButton;
|
||||
|
||||
@Override
|
||||
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");
|
||||
Purchasable item = InAppPurchaseActivity.instance().getPurchasedItem(id);
|
||||
buyItemButton = (Button) view.findViewById(R.id.inapp_button);
|
||||
buyItemButton = view.findViewById(R.id.inapp_button);
|
||||
|
||||
displayBuySubscriptionButton(item);
|
||||
|
||||
defaultEmail = InAppPurchaseActivity.instance().getGmailAccount();
|
||||
defaultUsername = LinphonePreferences.instance().getAccountUsername(LinphonePreferences.instance().getDefaultAccountIndex());
|
||||
|
||||
usernameLayout = (LinearLayout) view.findViewById(R.id.username_layout);
|
||||
username = (EditText) view.findViewById(R.id.username);
|
||||
usernameLayout = view.findViewById(R.id.username_layout);
|
||||
username = view.findViewById(R.id.username);
|
||||
if(!getResources().getBoolean(R.bool.hide_username_in_inapp)){
|
||||
usernameLayout.setVisibility(View.VISIBLE);
|
||||
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){
|
||||
email.setText(defaultEmail);
|
||||
emailOk = true;
|
||||
}
|
||||
|
||||
buyItemButton.setEnabled(emailOk && usernameOk);
|
||||
errorMessage = (TextView) view.findViewById(R.id.username_error);
|
||||
errorMessage = view.findViewById(R.id.username_error);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
@ -110,7 +109,6 @@ public class InAppPurchaseFragment extends Fragment implements View.OnClickListe
|
|||
errorMessage.setText(R.string.wizard_username_incorrect);
|
||||
}
|
||||
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
|
||||
public void onClick(View v) {
|
||||
Purchasable item = (Purchasable) v.getTag();
|
||||
if (v.equals(recoverAccountButton)) {
|
||||
//TODO
|
||||
} else {
|
||||
InAppPurchaseActivity.instance().buyInapp(getUsername(), item);
|
||||
}
|
||||
InAppPurchaseActivity.instance().buyInapp(getUsername(), item);
|
||||
}
|
||||
|
||||
private String getUsername() {
|
||||
|
|
|
@ -168,7 +168,7 @@ public class InAppPurchaseHelper {
|
|||
}
|
||||
|
||||
private ArrayList<Purchasable> getAvailableItemsForPurchase() {
|
||||
ArrayList<Purchasable> products = new ArrayList<Purchasable>();
|
||||
ArrayList<Purchasable> products = new ArrayList<>();
|
||||
ArrayList<String> skuList = LinphonePreferences.instance().getInAppPurchasables();
|
||||
Bundle querySkus = new Bundle();
|
||||
querySkus.putStringArrayList(SKU_DETAILS_ITEM_LIST, skuList);
|
||||
|
@ -223,55 +223,6 @@ public class InAppPurchaseHelper {
|
|||
}).start();
|
||||
}
|
||||
|
||||
public void getPurchasedItemsAsync() {
|
||||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
|
||||
final ArrayList<Purchasable> items = new ArrayList<Purchasable>();
|
||||
String continuationToken = null;
|
||||
do {
|
||||
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) {
|
||||
if (requestCode == ACTIVITY_RESULT_CODE_PURCHASE_ITEM) {
|
||||
int responseCode = data.getIntExtra(RESPONSE_CODE, 0);
|
||||
|
|
|
@ -45,7 +45,7 @@ public class InAppPurchaseListFragment extends Fragment implements AdapterView.O
|
|||
View view = inflater.inflate(R.layout.in_app_list, container, false);
|
||||
|
||||
mPurchasableItems = InAppPurchaseActivity.instance().getPurchasedItems();
|
||||
inappList = (ListView) view.findViewById(R.id.inapp_list);
|
||||
inappList = view.findViewById(R.id.inapp_list);
|
||||
|
||||
if(mPurchasableItems != null){
|
||||
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) {
|
||||
View view = null;
|
||||
View view;
|
||||
if (convertView != null) {
|
||||
view = convertView;
|
||||
} else {
|
||||
|
@ -79,9 +79,9 @@ public class InAppPurchaseListFragment extends Fragment implements AdapterView.O
|
|||
|
||||
final Purchasable item = mPurchasableItems.get(position);
|
||||
|
||||
TextView itemTitle = (TextView) view.findViewById(R.id.purchase_title);
|
||||
TextView itemDesc = (TextView) view.findViewById(R.id.purchase_description);
|
||||
TextView itemPrice = (TextView) view.findViewById(R.id.purchase_price);
|
||||
TextView itemTitle = view.findViewById(R.id.purchase_title);
|
||||
TextView itemDesc = view.findViewById(R.id.purchase_description);
|
||||
TextView itemPrice = view.findViewById(R.id.purchase_price);
|
||||
|
||||
itemTitle.setText(item.getTitle());
|
||||
itemDesc.setText(item.getDescription());
|
||||
|
|
|
@ -25,8 +25,6 @@ import org.linphone.LinphoneService;
|
|||
import org.linphone.LinphoneUtils;
|
||||
import org.linphone.R;
|
||||
import org.linphone.core.Core;
|
||||
import org.linphone.core.Factory;
|
||||
import org.linphone.core.LogCollectionState;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
import android.content.Context;
|
||||
|
|
|
@ -26,8 +26,6 @@ import org.linphone.LinphoneUtils;
|
|||
import org.linphone.R;
|
||||
import org.linphone.compatibility.Compatibility;
|
||||
import org.linphone.core.Core;
|
||||
import org.linphone.core.Factory;
|
||||
import org.linphone.core.LogCollectionState;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
import android.app.AlarmManager;
|
||||
|
|
|
@ -20,7 +20,5 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
*/
|
||||
|
||||
public interface AddressAware {
|
||||
|
||||
void setAddressWidget(AddressText address);
|
||||
|
||||
}
|
||||
|
|
|
@ -33,18 +33,9 @@ import android.widget.EditText;
|
|||
public class AddressText extends EditText implements AddressType {
|
||||
|
||||
private String displayedName;
|
||||
private Uri pictureUri;
|
||||
private Paint mTestPaint;
|
||||
private DialerFragment dialer;
|
||||
|
||||
public void setPictureUri(Uri uri) {
|
||||
pictureUri = uri;
|
||||
}
|
||||
|
||||
public Uri getPictureUri() {
|
||||
return pictureUri;
|
||||
}
|
||||
|
||||
public AddressText(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
|
||||
|
@ -60,11 +51,6 @@ public class AddressText extends EditText implements AddressType {
|
|||
return displayedName;
|
||||
}
|
||||
|
||||
public void setContactAddress(String uri, String displayedName) {
|
||||
setText(uri);
|
||||
this.displayedName = displayedName;
|
||||
}
|
||||
|
||||
public void setDisplayedName(String displayedName) {
|
||||
this.displayedName = displayedName;
|
||||
}
|
||||
|
@ -81,7 +67,6 @@ public class AddressText extends EditText implements AddressType {
|
|||
protected void onTextChanged(CharSequence text, int start, int before,
|
||||
int after) {
|
||||
clearDisplayedName();
|
||||
pictureUri = null;
|
||||
|
||||
refitText(getWidth(), getHeight());
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.linphone.LinphoneManager;
|
|||
import org.linphone.LinphonePreferences;
|
||||
import org.linphone.R;
|
||||
import org.linphone.core.Call;
|
||||
import org.linphone.core.Call.Dir;
|
||||
import org.linphone.core.CallLog;
|
||||
import org.linphone.core.CoreException;
|
||||
import org.linphone.core.ProxyConfig;
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
||||
import org.linphone.LinphoneUtils;
|
||||
import org.linphone.call.CallActivity;
|
||||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.LinphonePreferences;
|
||||
import org.linphone.LinphoneService;
|
||||
import org.linphone.R;
|
||||
import org.linphone.core.Core;
|
||||
import org.linphone.core.Factory;
|
||||
import org.linphone.core.LogCollectionState;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
@ -22,8 +22,6 @@ package org.linphone.ui;
|
|||
import android.widget.BaseAdapter;
|
||||
import android.widget.CompoundButton;
|
||||
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -54,10 +52,6 @@ public abstract class ListSelectionAdapter extends BaseAdapter {
|
|||
return mIsEditionEnabled;
|
||||
}
|
||||
|
||||
public CompoundButton.OnCheckedChangeListener getDeleteListener() {
|
||||
return mDeleteCheckboxListener;
|
||||
}
|
||||
|
||||
public void selectAll() {
|
||||
for (Integer i = 0; i < getCount(); i++) {
|
||||
mSelectedItems.add(i);
|
||||
|
|
|
@ -37,10 +37,6 @@ public class ListSelectionHelper {
|
|||
private Context mContext;
|
||||
private int mDialogDeleteMessageResourceId;
|
||||
|
||||
public void setDialogMessage(int id) {
|
||||
mDialogDeleteMessageResourceId = id;
|
||||
}
|
||||
|
||||
public interface DeleteListener {
|
||||
void onDeleteSelection(Object[] objectsToDelete);
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ public class Numpad extends LinearLayout implements AddressAware {
|
|||
|
||||
|
||||
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++) {
|
||||
View v = viewGroup.getChildAt(i);
|
||||
|
|
|
@ -86,7 +86,7 @@ public class PreferencesListFragment extends ListFragment {
|
|||
((ViewGroup)p).removeView(preferencesList);
|
||||
}
|
||||
|
||||
RelativeLayout layout = (RelativeLayout) view.findViewById(R.id.topLayout);
|
||||
RelativeLayout layout = view.findViewById(R.id.topLayout);
|
||||
layout.addView(preferencesList);
|
||||
|
||||
postBindPreferences();
|
||||
|
|
|
@ -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);
|
||||
}
|
|
@ -26,8 +26,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
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 boolean mIsEditionEnabled=false;
|
||||
private SelectableHelper mListHelper;
|
||||
|
|
|
@ -50,8 +50,6 @@ public class SelectableHelper {
|
|||
mContext = view.getContext();
|
||||
mDeleteListener = listener;
|
||||
|
||||
//Define XML layout items used for selection mode
|
||||
|
||||
mEditTopBar = view.findViewById(R.id.edit_list);
|
||||
mTopBar = view.findViewById(R.id.top_bar);
|
||||
|
||||
|
@ -65,7 +63,6 @@ public class SelectableHelper {
|
|||
|
||||
mEditButton = view.findViewById(R.id.edit);
|
||||
|
||||
//Set visibility behaviour on click on edit button + enter Edition Mode
|
||||
mEditButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -96,7 +93,6 @@ public class SelectableHelper {
|
|||
mDeleteSelectionButton = view.findViewById(R.id.delete);
|
||||
mDeleteSelectionButton.setEnabled(false);
|
||||
|
||||
//Display confirmation for deletion
|
||||
mDeleteSelectionButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -132,14 +128,12 @@ public class SelectableHelper {
|
|||
}
|
||||
|
||||
public void updateSelectionButtons(boolean isSelectionEmpty, boolean isSelectionFull) {
|
||||
//Delete button availability
|
||||
if (isSelectionEmpty) {
|
||||
mDeleteSelectionButton.setEnabled(false);
|
||||
} else {
|
||||
mDeleteSelectionButton.setEnabled(true);
|
||||
}
|
||||
|
||||
//(De)select button visibility
|
||||
if (isSelectionFull) {
|
||||
mSelectAllButton.setVisibility(View.GONE);
|
||||
mDeselectAllButton.setVisibility(View.VISIBLE);
|
||||
|
|
|
@ -318,8 +318,6 @@ public class SlidingDrawer extends ViewGroup {
|
|||
}
|
||||
}
|
||||
|
||||
public static final String LOG_TAG = "Sliding";
|
||||
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
||||
if (mTracking) {
|
||||
|
|
|
@ -24,10 +24,8 @@ import org.linphone.LinphonePreferences;
|
|||
import org.linphone.core.XmlRpcArgType;
|
||||
import org.linphone.core.XmlRpcRequest;
|
||||
import org.linphone.core.XmlRpcRequestListener;
|
||||
//import org.linphone.core.XmlRpcRequestImpl;
|
||||
import org.linphone.core.XmlRpcSession;
|
||||
import org.linphone.core.XmlRpcStatus;
|
||||
//import org.linphone.core.XmlRpcSessionImpl;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
public class XmlRpcHelper {
|
||||
|
|
|
@ -20,19 +20,19 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
*/
|
||||
|
||||
public interface XmlRpcListener {
|
||||
public void onError(String error);
|
||||
public void onAccountCreated(String result);
|
||||
public void onAccountExpireFetched(String result);
|
||||
public void onAccountExpireUpdated(String result);
|
||||
public void onAccountActivated(String result);
|
||||
public void onAccountActivatedFetched(boolean isActivated);
|
||||
public void onTrialAccountFetched(boolean isTrial);
|
||||
public void onAccountFetched(boolean isExisting);
|
||||
public void onAccountEmailChanged(String result);
|
||||
public void onAccountPasswordChanged(String result);
|
||||
public void onRecoverPasswordLinkSent(String result);
|
||||
public void onActivateAccountLinkSent(String result);
|
||||
public void onSignatureVerified(boolean success);
|
||||
public void onUsernameSent(String result);
|
||||
public void onRemoteProvisioningFilenameSent(String result);
|
||||
void onError(String error);
|
||||
void onAccountCreated(String result);
|
||||
void onAccountExpireFetched(String result);
|
||||
void onAccountExpireUpdated(String result);
|
||||
void onAccountActivated(String result);
|
||||
void onAccountActivatedFetched(boolean isActivated);
|
||||
void onTrialAccountFetched(boolean isTrial);
|
||||
void onAccountFetched(boolean isExisting);
|
||||
void onAccountEmailChanged(String result);
|
||||
void onAccountPasswordChanged(String result);
|
||||
void onRecoverPasswordLinkSent(String result);
|
||||
void onActivateAccountLinkSent(String result);
|
||||
void onSignatureVerified(boolean success);
|
||||
void onUsernameSent(String result);
|
||||
void onRemoteProvisioningFilenameSent(String result);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue