diff --git a/src/android/org/linphone/BandwidthManager.java b/src/android/org/linphone/BandwidthManager.java index 95be52c00..adf72e950 100644 --- a/src/android/org/linphone/BandwidthManager.java +++ b/src/android/org/linphone/BandwidthManager.java @@ -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(); diff --git a/src/android/org/linphone/LinphoneManager.java b/src/android/org/linphone/LinphoneManager.java index acc843bbd..8eed9e79e 100644 --- a/src/android/org/linphone/LinphoneManager.java +++ b/src/android/org/linphone/LinphoneManager.java @@ -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; diff --git a/src/android/org/linphone/LinphonePreferences.java b/src/android/org/linphone/LinphonePreferences.java index fe59e44b5..c42679e09 100644 --- a/src/android/org/linphone/LinphonePreferences.java +++ b/src/android/org/linphone/LinphonePreferences.java @@ -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; diff --git a/src/android/org/linphone/LinphoneService.java b/src/android/org/linphone/LinphoneService.java index fc5bf8f5f..f88e732e5 100644 --- a/src/android/org/linphone/LinphoneService.java +++ b/src/android/org/linphone/LinphoneService.java @@ -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 activities = new ArrayList(); + private ArrayList activities = new ArrayList<>(); private boolean mActive = false; private int mRunningActivities = 0; diff --git a/src/android/org/linphone/LinphoneUtils.java b/src/android/org/linphone/LinphoneUtils.java index fa576a7e4..cf21cad46 100644 --- a/src/android/org/linphone/LinphoneUtils.java +++ b/src/android/org/linphone/LinphoneUtils.java @@ -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 getCalls(Core lc) { // return a modifiable list - return new ArrayList(Arrays.asList(lc.getCalls())); + return new ArrayList<>(Arrays.asList(lc.getCalls())); } public static final List getCallsInState(Core lc, Collection states) { - List foundCalls = new ArrayList(); + List foundCalls = new ArrayList<>(); for (Call call : getCalls(lc)) { if (states.contains(call.getState())) { foundCalls.add(call); diff --git a/src/android/org/linphone/activities/LinphoneActivity.java b/src/android/org/linphone/activities/LinphoneActivity.java index 49a61353f..837ee25be 100644 --- a/src/android/org/linphone/activities/LinphoneActivity.java +++ b/src/android/org/linphone/activities/LinphoneActivity.java @@ -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() { diff --git a/src/android/org/linphone/assistant/AssistantActivity.java b/src/android/org/linphone/assistant/AssistantActivity.java index 3ed24da84..c95d8a9c2 100644 --- a/src/android/org/linphone/assistant/AssistantActivity.java +++ b/src/android/org/linphone/assistant/AssistantActivity.java @@ -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(); diff --git a/src/android/org/linphone/assistant/CodecDownloaderFragment.java b/src/android/org/linphone/assistant/CodecDownloaderFragment.java index d3c07a0d5..7fb595619 100644 --- a/src/android/org/linphone/assistant/CodecDownloaderFragment.java +++ b/src/android/org/linphone/assistant/CodecDownloaderFragment.java @@ -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() { diff --git a/src/android/org/linphone/assistant/CountryListFragment.java b/src/android/org/linphone/assistant/CountryListFragment.java index e4bcf4a52..b1c813370 100644 --- a/src/android/org/linphone/assistant/CountryListFragment.java +++ b/src/android/org/linphone/assistant/CountryListFragment.java @@ -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); diff --git a/src/android/org/linphone/assistant/CreateAccountActivationFragment.java b/src/android/org/linphone/assistant/CreateAccountActivationFragment.java index 081ea93d6..5fbcac97a 100644 --- a/src/android/org/linphone/assistant/CreateAccountActivationFragment.java +++ b/src/android/org/linphone/assistant/CreateAccountActivationFragment.java @@ -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; } diff --git a/src/android/org/linphone/assistant/CreateAccountCodeActivationFragment.java b/src/android/org/linphone/assistant/CreateAccountCodeActivationFragment.java index dec3380c4..ae806beca 100644 --- a/src/android/org/linphone/assistant/CreateAccountCodeActivationFragment.java +++ b/src/android/org/linphone/assistant/CreateAccountCodeActivationFragment.java @@ -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 diff --git a/src/android/org/linphone/assistant/CreateAccountFragment.java b/src/android/org/linphone/assistant/CreateAccountFragment.java index 4f4ad8254..b571a7143 100644 --- a/src/android/org/linphone/assistant/CreateAccountFragment.java +++ b/src/android/org/linphone/assistant/CreateAccountFragment.java @@ -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); diff --git a/src/android/org/linphone/assistant/EchoCancellerCalibrationFragment.java b/src/android/org/linphone/assistant/EchoCancellerCalibrationFragment.java index 357479f7d..5fcabf45e 100644 --- a/src/android/org/linphone/assistant/EchoCancellerCalibrationFragment.java +++ b/src/android/org/linphone/assistant/EchoCancellerCalibrationFragment.java @@ -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; diff --git a/src/android/org/linphone/assistant/LinphoneLoginFragment.java b/src/android/org/linphone/assistant/LinphoneLoginFragment.java index 0b0222993..d16eddb97 100644 --- a/src/android/org/linphone/assistant/LinphoneLoginFragment.java +++ b/src/android/org/linphone/assistant/LinphoneLoginFragment.java @@ -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()); diff --git a/src/android/org/linphone/assistant/LoginFragment.java b/src/android/org/linphone/assistant/LoginFragment.java index 5fc5abb93..70621c1b5 100644 --- a/src/android/org/linphone/assistant/LoginFragment.java +++ b/src/android/org/linphone/assistant/LoginFragment.java @@ -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); diff --git a/src/android/org/linphone/assistant/RemoteProvisioningActivity.java b/src/android/org/linphone/assistant/RemoteProvisioningActivity.java index f7c717065..795172734 100644 --- a/src/android/org/linphone/assistant/RemoteProvisioningActivity.java +++ b/src/android/org/linphone/assistant/RemoteProvisioningActivity.java @@ -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 diff --git a/src/android/org/linphone/assistant/RemoteProvisioningFragment.java b/src/android/org/linphone/assistant/RemoteProvisioningFragment.java index f05aeb7e2..9b9a1172f 100644 --- a/src/android/org/linphone/assistant/RemoteProvisioningFragment.java +++ b/src/android/org/linphone/assistant/RemoteProvisioningFragment.java @@ -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); diff --git a/src/android/org/linphone/assistant/RemoteProvisioningLoginActivity.java b/src/android/org/linphone/assistant/RemoteProvisioningLoginActivity.java index 0f5bb6d13..7556b994e 100644 --- a/src/android/org/linphone/assistant/RemoteProvisioningLoginActivity.java +++ b/src/android/org/linphone/assistant/RemoteProvisioningLoginActivity.java @@ -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; } diff --git a/src/android/org/linphone/assistant/WelcomeFragment.java b/src/android/org/linphone/assistant/WelcomeFragment.java index 2dc7ca5cc..070aac22c 100644 --- a/src/android/org/linphone/assistant/WelcomeFragment.java +++ b/src/android/org/linphone/assistant/WelcomeFragment.java @@ -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 { diff --git a/src/android/org/linphone/call/CallActivity.java b/src/android/org/linphone/call/CallActivity.java index fb8f2d218..dc3ca40e0 100644 --- a/src/android/org/linphone/call/CallActivity.java +++ b/src/android/org/linphone/call/CallActivity.java @@ -174,8 +174,8 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList cameraNumber = AndroidCameraConfiguration.retrieveCameras().length; - mEncoderTexts = new HashMap(); - mDecoderTexts = new HashMap(); + 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); diff --git a/src/android/org/linphone/call/CallAudioFragment.java b/src/android/org/linphone/call/CallAudioFragment.java index 8f521a0f4..9112d0ae7 100644 --- a/src/android/org/linphone/call/CallAudioFragment.java +++ b/src/android/org/linphone/call/CallAudioFragment.java @@ -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(); - } } diff --git a/src/android/org/linphone/call/CallHistoryAdapter.java b/src/android/org/linphone/call/CallHistoryAdapter.java index c0cf045d0..7c6bcb06f 100644 --- a/src/android/org/linphone/call/CallHistoryAdapter.java +++ b/src/android/org/linphone/call/CallHistoryAdapter.java @@ -48,9 +48,6 @@ import java.util.Calendar; import java.util.List; public class CallHistoryAdapter extends SelectableAdapter { - - //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 permissionsList = new ArrayList(); diff --git a/src/android/org/linphone/call/CallManager.java b/src/android/org/linphone/call/CallManager.java index 2a6c37902..b1eefbd4c 100644 --- a/src/android/org/linphone/call/CallManager.java +++ b/src/android/org/linphone/call/CallManager.java @@ -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. diff --git a/src/android/org/linphone/call/CallOutgoingActivity.java b/src/android/org/linphone/call/CallOutgoingActivity.java index e1ec9096d..798da14a5 100644 --- a/src/android/org/linphone/call/CallOutgoingActivity.java +++ b/src/android/org/linphone/call/CallOutgoingActivity.java @@ -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()); diff --git a/src/android/org/linphone/call/CallVideoFragment.java b/src/android/org/linphone/call/CallVideoFragment.java index d8ba53de4..6e77652ab 100644 --- a/src/android/org/linphone/call/CallVideoFragment.java +++ b/src/android/org/linphone/call/CallVideoFragment.java @@ -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); diff --git a/src/android/org/linphone/chat/ChatBubbleViewHolder.java b/src/android/org/linphone/chat/ChatBubbleViewHolder.java index c23cb7cf7..8ff2e27bb 100644 --- a/src/android/org/linphone/chat/ChatBubbleViewHolder.java +++ b/src/android/org/linphone/chat/ChatBubbleViewHolder.java @@ -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()); } } diff --git a/src/android/org/linphone/chat/ChatCreationFragment.java b/src/android/org/linphone/chat/ChatCreationFragment.java index e97d5f47b..90751c593 100644 --- a/src/android/org/linphone/chat/ChatCreationFragment.java +++ b/src/android/org/linphone/chat/ChatCreationFragment.java @@ -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(); diff --git a/src/android/org/linphone/chat/ChatEventsAdapter.java b/src/android/org/linphone/chat/ChatEventsAdapter.java index f0840fdb1..a9ef0ec66 100644 --- a/src/android/org/linphone/chat/ChatEventsAdapter.java +++ b/src/android/org/linphone/chat/ChatEventsAdapter.java @@ -73,7 +73,6 @@ import java.util.List; import static android.content.Intent.FLAG_GRANT_READ_URI_PERMISSION; - public class ChatEventsAdapter extends SelectableAdapter { private static int MARGIN_BETWEEN_MESSAGES = 10; @@ -606,7 +605,7 @@ public class ChatEventsAdapter extends SelectableAdapter { public AsyncBitmap(Resources res, Bitmap bitmap, BitmapWorkerTask bitmapWorkerTask) { super(res, bitmap); - bitmapWorkerTaskReference = new WeakReference(bitmapWorkerTask); + bitmapWorkerTaskReference = new WeakReference<>(bitmapWorkerTask); } public BitmapWorkerTask getBitmapWorkerTask() { diff --git a/src/android/org/linphone/chat/ChatListFragment.java b/src/android/org/linphone/chat/ChatListFragment.java index 988b74b7c..2f3a0277f 100644 --- a/src/android/org/linphone/chat/ChatListFragment.java +++ b/src/android/org/linphone/chat/ChatListFragment.java @@ -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 diff --git a/src/android/org/linphone/chat/ChatRoomViewHolder.java b/src/android/org/linphone/chat/ChatRoomViewHolder.java new file mode 100644 index 000000000..ab3d5c78f --- /dev/null +++ b/src/android/org/linphone/chat/ChatRoomViewHolder.java @@ -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); + } +} \ No newline at end of file diff --git a/src/android/org/linphone/chat/ChatRoomsAdapter.java b/src/android/org/linphone/chat/ChatRoomsAdapter.java index 674a8c99e..0489c79cc 100644 --- a/src/android/org/linphone/chat/ChatRoomsAdapter.java +++ b/src/android/org/linphone/chat/ChatRoomsAdapter.java @@ -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 { - - 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 { private Context mContext; public List 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 { - 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 mItems; private View.OnClickListener mDeleteListener; private boolean mHideAdminFeatures; private ChatRoom mChatRoom; - private ImageView mAavatar; public GroupInfoAdapter(List items, boolean hideAdminFeatures, boolean isCreation) { mItems = items; @@ -84,11 +79,11 @@ public class GroupInfoAdapter extends RecyclerView.Adapter 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 mContacts; private String[] mSections; private ArrayList mSectionsList; - private Map mMap = new LinkedHashMap(); + private Map mMap = new LinkedHashMap<>(); private ViewHolder.ClickListener mClickListener; private Context mContext; private boolean mIsSearchMode; @@ -169,7 +167,7 @@ public class ContactsListAdapter extends SelectableAdapter contactsList) { mContacts = contactsList; - mMap = new LinkedHashMap(); + 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(mMap.keySet()); + mSectionsList = new ArrayList<>(mMap.keySet()); mSections = new String[mSectionsList.size()]; mSectionsList.toArray(mSections); diff --git a/src/android/org/linphone/contacts/ContactsListFragment.java b/src/android/org/linphone/contacts/ContactsListFragment.java index d0ad0d9e4..9563140b7 100644 --- a/src/android/org/linphone/contacts/ContactsListFragment.java +++ b/src/android/org/linphone/contacts/ContactsListFragment.java @@ -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); diff --git a/src/android/org/linphone/contacts/ContactsManager.java b/src/android/org/linphone/contacts/ContactsManager.java index c86ad3e05..8e82f8879 100644 --- a/src/android/org/linphone/contacts/ContactsManager.java +++ b/src/android/org/linphone/contacts/ContactsManager.java @@ -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(); - contactsUpdatedListeners = new ArrayList(); - contacts = new ArrayList(); - sipContacts = new ArrayList(); + 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 contacts = new ArrayList(); - List sipContacts = new ArrayList(); + List contacts = new ArrayList<>(); + List sipContacts = new ArrayList<>(); Date contactsTime = new Date(); androidContactsCache.clear(); @@ -521,7 +520,7 @@ public class ContactsManager extends ContentObserver implements FriendListListen public void deleteMultipleContactsAtOnce(List ids) { String select = ContactsContract.Data.CONTACT_ID + " = ?"; - ArrayList ops = new ArrayList(); + ArrayList ops = new ArrayList<>(); for (String id : ids) { String[] args = new String[] { id }; diff --git a/src/android/org/linphone/contacts/LinphoneContact.java b/src/android/org/linphone/contacts/LinphoneContact.java index 54b9671bf..9c175c05c 100644 --- a/src/android/org/linphone/contacts/LinphoneContact.java +++ b/src/android/org/linphone/contacts/LinphoneContact.java @@ -57,12 +57,12 @@ public class LinphoneContact implements Serializable, Comparable(); + addresses = new ArrayList<>(); androidId = null; thumbnailUri = null; photoUri = null; - changesToCommit = new ArrayList(); - changesToCommit2 = new ArrayList(); + changesToCommit = new ArrayList<>(); + changesToCommit2 = new ArrayList<>(); hasSipAddress = false; } @@ -70,8 +70,6 @@ public class LinphoneContact implements Serializable, Comparable(); - changesToCommit2 = new ArrayList(); + changesToCommit = new ArrayList<>(); + changesToCommit2 = new ArrayList<>(); } } @@ -509,7 +507,7 @@ public class LinphoneContact implements Serializable, Comparable(); + addresses = new ArrayList<>(); if (isAndroidContact()) { getContactNames(); getNativeContactOrganization(); @@ -741,7 +739,7 @@ public class LinphoneContact implements Serializable, Comparable batch = new ArrayList(); + ArrayList batch = new ArrayList<>(); batch.add(ContentProviderOperation.newInsert(ContactsContract.RawContacts.CONTENT_URI) .withValue(ContactsContract.RawContacts.ACCOUNT_TYPE, ContactsManager.getInstance().getString(R.string.sync_account_type)) diff --git a/src/android/org/linphone/firebase/FirebaseIdService.java b/src/android/org/linphone/firebase/FirebaseIdService.java index 37f23983a..9841e9dd4 100644 --- a/src/android/org/linphone/firebase/FirebaseIdService.java +++ b/src/android/org/linphone/firebase/FirebaseIdService.java @@ -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() { diff --git a/src/android/org/linphone/fragments/AboutFragment.java b/src/android/org/linphone/fragments/AboutFragment.java index 3973391b1..cfba86a9d 100644 --- a/src/android/org/linphone/fragments/AboutFragment.java +++ b/src/android/org/linphone/fragments/AboutFragment.java @@ -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); diff --git a/src/android/org/linphone/fragments/AccountPreferencesFragment.java b/src/android/org/linphone/fragments/AccountPreferencesFragment.java index 245a46841..5ea83d363 100644 --- a/src/android/org/linphone/fragments/AccountPreferencesFragment.java +++ b/src/android/org/linphone/fragments/AccountPreferencesFragment.java @@ -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()); - } - } } diff --git a/src/android/org/linphone/fragments/DialerFragment.java b/src/android/org/linphone/fragments/DialerFragment.java index 30e3a50e5..eb3eea965 100644 --- a/src/android/org/linphone/fragments/DialerFragment.java +++ b/src/android/org/linphone/fragments/DialerFragment.java @@ -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; diff --git a/src/android/org/linphone/fragments/HistoryDetailFragment.java b/src/android/org/linphone/fragments/HistoryDetailFragment.java index a1a62063a..8fb2a2fe2 100644 --- a/src/android/org/linphone/fragments/HistoryDetailFragment.java +++ b/src/android/org/linphone/fragments/HistoryDetailFragment.java @@ -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()); diff --git a/src/android/org/linphone/fragments/HistoryListFragment.java b/src/android/org/linphone/fragments/HistoryListFragment.java index a7fc88156..b90b83cab 100644 --- a/src/android/org/linphone/fragments/HistoryListFragment.java +++ b/src/android/org/linphone/fragments/HistoryListFragment.java @@ -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 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; } diff --git a/src/android/org/linphone/fragments/StatusFragment.java b/src/android/org/linphone/fragments/StatusFragment.java index 60c3818b3..120cefc76 100644 --- a/src/android/org/linphone/fragments/StatusFragment.java +++ b/src/android/org/linphone/fragments/StatusFragment.java @@ -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() { diff --git a/src/android/org/linphone/purchase/InAppPurchaseActivity.java b/src/android/org/linphone/purchase/InAppPurchaseActivity.java index 5061c3de8..4ed4fc595 100644 --- a/src/android/org/linphone/purchase/InAppPurchaseActivity.java +++ b/src/android/org/linphone/purchase/InAppPurchaseActivity.java @@ -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 items) { //purchasableItemsLayout.removeAllViews(); inProgress.setVisibility(View.GONE); - purchasedItems = new ArrayList(); + purchasedItems = new ArrayList<>(); for (Purchasable item : items) { purchasedItems.add(item); } diff --git a/src/android/org/linphone/purchase/InAppPurchaseFragment.java b/src/android/org/linphone/purchase/InAppPurchaseFragment.java index 9dd40ce54..0b2ad7389 100644 --- a/src/android/org/linphone/purchase/InAppPurchaseFragment.java +++ b/src/android/org/linphone/purchase/InAppPurchaseFragment.java @@ -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() { diff --git a/src/android/org/linphone/purchase/InAppPurchaseHelper.java b/src/android/org/linphone/purchase/InAppPurchaseHelper.java index 1d7285ca7..c3e19b0da 100644 --- a/src/android/org/linphone/purchase/InAppPurchaseHelper.java +++ b/src/android/org/linphone/purchase/InAppPurchaseHelper.java @@ -168,7 +168,7 @@ public class InAppPurchaseHelper { } private ArrayList getAvailableItemsForPurchase() { - ArrayList products = new ArrayList(); + ArrayList products = new ArrayList<>(); ArrayList 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 items = new ArrayList(); - 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 purchaseDataList = purchasedItems.getStringArrayList(RESPONSE_INAPP_PURCHASE_DATA_LIST); - ArrayList 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); diff --git a/src/android/org/linphone/purchase/InAppPurchaseListFragment.java b/src/android/org/linphone/purchase/InAppPurchaseListFragment.java index c4de79cbb..84feaa5ad 100644 --- a/src/android/org/linphone/purchase/InAppPurchaseListFragment.java +++ b/src/android/org/linphone/purchase/InAppPurchaseListFragment.java @@ -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()); diff --git a/src/android/org/linphone/receivers/DozeReceiver.java b/src/android/org/linphone/receivers/DozeReceiver.java index 60b525a73..343ef6b90 100644 --- a/src/android/org/linphone/receivers/DozeReceiver.java +++ b/src/android/org/linphone/receivers/DozeReceiver.java @@ -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; diff --git a/src/android/org/linphone/receivers/KeepAliveReceiver.java b/src/android/org/linphone/receivers/KeepAliveReceiver.java index 12b8b9cf8..4b6ef03a7 100644 --- a/src/android/org/linphone/receivers/KeepAliveReceiver.java +++ b/src/android/org/linphone/receivers/KeepAliveReceiver.java @@ -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; diff --git a/src/android/org/linphone/ui/AddressAware.java b/src/android/org/linphone/ui/AddressAware.java index b5515d8c7..002e2c89c 100644 --- a/src/android/org/linphone/ui/AddressAware.java +++ b/src/android/org/linphone/ui/AddressAware.java @@ -20,7 +20,5 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ public interface AddressAware { - void setAddressWidget(AddressText address); - } diff --git a/src/android/org/linphone/ui/AddressText.java b/src/android/org/linphone/ui/AddressText.java index 17fa1cf1f..3dc549a38 100644 --- a/src/android/org/linphone/ui/AddressText.java +++ b/src/android/org/linphone/ui/AddressText.java @@ -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()); diff --git a/src/android/org/linphone/ui/CallButton.java b/src/android/org/linphone/ui/CallButton.java index ef2071500..40c8e506f 100644 --- a/src/android/org/linphone/ui/CallButton.java +++ b/src/android/org/linphone/ui/CallButton.java @@ -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; diff --git a/src/android/org/linphone/ui/Digit.java b/src/android/org/linphone/ui/Digit.java index 4eb3fa583..711b0407f 100644 --- a/src/android/org/linphone/ui/Digit.java +++ b/src/android/org/linphone/ui/Digit.java @@ -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; diff --git a/src/android/org/linphone/ui/LinphoneScrollView.java b/src/android/org/linphone/ui/LinphoneScrollView.java deleted file mode 100644 index 0ff59fe9a..000000000 --- a/src/android/org/linphone/ui/LinphoneScrollView.java +++ /dev/null @@ -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()); - } - } -} diff --git a/src/android/org/linphone/ui/LinphoneSliders.java b/src/android/org/linphone/ui/LinphoneSliders.java deleted file mode 100644 index 656fde902..000000000 --- a/src/android/org/linphone/ui/LinphoneSliders.java +++ /dev/null @@ -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(); - } -} - diff --git a/src/android/org/linphone/ui/ListSelectionAdapter.java b/src/android/org/linphone/ui/ListSelectionAdapter.java index c7d0c384e..7034b50ed 100644 --- a/src/android/org/linphone/ui/ListSelectionAdapter.java +++ b/src/android/org/linphone/ui/ListSelectionAdapter.java @@ -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); diff --git a/src/android/org/linphone/ui/ListSelectionHelper.java b/src/android/org/linphone/ui/ListSelectionHelper.java index 15e800a8c..c199d7a7d 100644 --- a/src/android/org/linphone/ui/ListSelectionHelper.java +++ b/src/android/org/linphone/ui/ListSelectionHelper.java @@ -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); } diff --git a/src/android/org/linphone/ui/Numpad.java b/src/android/org/linphone/ui/Numpad.java index 0af6032a4..aa67bfdd0 100644 --- a/src/android/org/linphone/ui/Numpad.java +++ b/src/android/org/linphone/ui/Numpad.java @@ -71,7 +71,7 @@ public class Numpad extends LinearLayout implements AddressAware { private final Collection retrieveChildren(ViewGroup viewGroup, Class clazz) { - final Collection views = new ArrayList(); + final Collection views = new ArrayList<>(); for (int i = 0; i < viewGroup.getChildCount(); i++) { View v = viewGroup.getChildAt(i); diff --git a/src/android/org/linphone/ui/PreferencesListFragment.java b/src/android/org/linphone/ui/PreferencesListFragment.java index 6719b48e9..79e8acdea 100644 --- a/src/android/org/linphone/ui/PreferencesListFragment.java +++ b/src/android/org/linphone/ui/PreferencesListFragment.java @@ -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(); diff --git a/src/android/org/linphone/ui/ScrollViewListener.java b/src/android/org/linphone/ui/ScrollViewListener.java deleted file mode 100644 index e4f278cf0..000000000 --- a/src/android/org/linphone/ui/ScrollViewListener.java +++ /dev/null @@ -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); -} diff --git a/src/android/org/linphone/ui/SelectableAdapter.java b/src/android/org/linphone/ui/SelectableAdapter.java index d94e18b8d..8d20f70aa 100644 --- a/src/android/org/linphone/ui/SelectableAdapter.java +++ b/src/android/org/linphone/ui/SelectableAdapter.java @@ -26,8 +26,6 @@ import java.util.ArrayList; import java.util.List; public abstract class SelectableAdapter extends RecyclerView.Adapter { - @SuppressWarnings("unused") - private static final String TAG = SelectableAdapter.class.getSimpleName(); private SparseBooleanArray mSelectedItems; private boolean mIsEditionEnabled=false; private SelectableHelper mListHelper; diff --git a/src/android/org/linphone/ui/SelectableHelper.java b/src/android/org/linphone/ui/SelectableHelper.java index ef853b99e..8774b318a 100644 --- a/src/android/org/linphone/ui/SelectableHelper.java +++ b/src/android/org/linphone/ui/SelectableHelper.java @@ -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); diff --git a/src/android/org/linphone/ui/SlidingDrawer.java b/src/android/org/linphone/ui/SlidingDrawer.java index 054f47341..022d2b9e1 100644 --- a/src/android/org/linphone/ui/SlidingDrawer.java +++ b/src/android/org/linphone/ui/SlidingDrawer.java @@ -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) { diff --git a/src/android/org/linphone/xmlrpc/XmlRpcHelper.java b/src/android/org/linphone/xmlrpc/XmlRpcHelper.java index ba8a89d1c..98fa222f9 100644 --- a/src/android/org/linphone/xmlrpc/XmlRpcHelper.java +++ b/src/android/org/linphone/xmlrpc/XmlRpcHelper.java @@ -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 { diff --git a/src/android/org/linphone/xmlrpc/XmlRpcListener.java b/src/android/org/linphone/xmlrpc/XmlRpcListener.java index 47fe718d2..b2b991d3b 100644 --- a/src/android/org/linphone/xmlrpc/XmlRpcListener.java +++ b/src/android/org/linphone/xmlrpc/XmlRpcListener.java @@ -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); }