Removed warnings

This commit is contained in:
Sylvain Berfini 2016-10-13 13:54:59 +02:00
parent e7d1dbe51e
commit 2d4a2497dc
12 changed files with 53 additions and 127 deletions

View file

@ -25,9 +25,6 @@ import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.linphone.core.LinphoneFriend;
import org.linphone.core.PresenceActivityType;
import android.app.Dialog;
import android.app.Fragment;
import android.graphics.Bitmap;
@ -428,7 +425,7 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
public TextView separatorText;
public ImageView contactPicture;
public TextView organization;
public ImageView friendStatus;
//public ImageView friendStatus;
public ViewHolder(View view) {
delete = (CheckBox) view.findViewById(R.id.delete);
@ -438,7 +435,7 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
separatorText = (TextView) view.findViewById(R.id.separator_text);
contactPicture = (ImageView) view.findViewById(R.id.contact_picture);
organization = (TextView) view.findViewById(R.id.contactOrganization);
friendStatus = (ImageView) view.findViewById(R.id.friendStatus);
//friendStatus = (ImageView) view.findViewById(R.id.friendStatus);
}
}
@ -567,7 +564,7 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
holder.delete.setVisibility(View.GONE);
}
LinphoneFriend[] friends = LinphoneManager.getLc().getFriendList();
/*LinphoneFriend[] friends = LinphoneManager.getLc().getFriendList();
if (!ContactsManager.getInstance().isContactPresenceDisabled() && friends != null) {
holder.friendStatus.setVisibility(View.VISIBLE);
PresenceActivityType presenceActivity = friends[0].getPresenceModel().getActivity().getType();
@ -582,7 +579,7 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
} else {
holder.friendStatus.setImageResource(R.drawable.call_quality_indicator_0);
}
}
}*/
return view;
}

View file

@ -57,23 +57,18 @@ import org.linphone.xmlrpc.XmlRpcListenerBase;
import android.Manifest;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.Dialog;
import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.app.Application;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.provider.Settings;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
@ -1179,10 +1174,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
checkAndRequestPermission(Manifest.permission.GET_ACCOUNTS, PERMISSIONS_REQUEST_CONTACTS);
}
private boolean willContactsPermissionBeAsked() {
return LinphonePreferences.instance().firstTimeAskingForPermission(Manifest.permission.READ_CONTACTS, false) || ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.READ_CONTACTS);
}
public void checkAndRequestWriteContactsPermission() {
checkAndRequestPermission(Manifest.permission.WRITE_CONTACTS, 0);
}
@ -1205,7 +1196,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
int readExternalStorage = getPackageManager().checkPermission(Manifest.permission.READ_EXTERNAL_STORAGE, getPackageName());
Log.i("[Permission] Read external storage permission is " + (readExternalStorage == PackageManager.PERMISSION_GRANTED ? "granted" : "denied"));
int camera = getPackageManager().checkPermission(Manifest.permission.CAMERA, getPackageName());
int accounts = getPackageManager().checkPermission(Manifest.permission.GET_ACCOUNTS, getPackageName());
Log.i("[Permission] Camera permission is " + (camera == PackageManager.PERMISSION_GRANTED ? "granted" : "denied"));
if (readExternalStorage != PackageManager.PERMISSION_GRANTED) {

View file

@ -26,7 +26,6 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import org.linphone.core.LinphoneAccountCreator;
import org.linphone.core.LinphoneAddress;
import org.linphone.core.LinphoneAddress.TransportType;
import org.linphone.core.LinphoneAuthInfo;

View file

@ -42,10 +42,7 @@ import java.util.Locale;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import android.app.AlertDialog;
import android.widget.*;
import org.linphone.assistant.AssistantActivity;
import org.linphone.assistant.CountryListFragment;
import org.linphone.core.LinphoneAccountCreator;
import org.linphone.core.LinphoneAddress;
import org.linphone.core.LinphoneCall;
@ -59,6 +56,7 @@ import org.linphone.mediastream.Log;
import org.linphone.mediastream.video.capture.hwconf.Hacks;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
@ -78,6 +76,10 @@ import android.util.TypedValue;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
/**
* Helpers.

View file

@ -33,7 +33,6 @@ import org.linphone.core.LinphoneEvent;
import org.linphone.core.LinphoneProxyConfig;
import org.linphone.core.PayloadType;
import org.linphone.mediastream.Log;
import org.w3c.dom.Text;
import android.app.Activity;
import android.app.Dialog;

View file

@ -1,28 +1,21 @@
package org.linphone.assistant;
import org.linphone.R;
import android.app.Fragment;
import android.content.Context;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.*;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.linphone.R;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListView;
public class CountryListFragment extends Fragment implements AdapterView.OnItemClickListener, View.OnClickListener {
private LayoutInflater mInflater;
private ListView list;
private EditText search;
private ImageView clearSearchField;
@ -31,7 +24,6 @@ public class CountryListFragment extends Fragment implements AdapterView.OnItemC
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
mInflater = inflater;
View view = inflater.inflate(R.layout.assistant_country_list, container, false);
adapter = AssistantActivity.instance().getCountryListAdapter();

View file

@ -18,6 +18,14 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import org.linphone.LinphoneManager;
import org.linphone.LinphonePreferences;
import org.linphone.R;
import org.linphone.core.LinphoneAccountCreator;
import org.linphone.core.LinphoneAccountCreator.LinphoneAccountCreatorListener;
import org.linphone.core.LinphoneAccountCreator.Status;
import org.linphone.core.LinphoneCoreFactory;
import android.app.Fragment;
import android.os.Bundle;
import android.text.Editable;
@ -31,17 +39,8 @@ import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import org.linphone.LinphoneManager;
import org.linphone.LinphonePreferences;
import org.linphone.R;
import org.linphone.core.LinphoneAccountCreator;
import org.linphone.core.LinphoneCoreFactory;
import static org.linphone.core.LinphoneAccountCreator.*;
public class CreateAccountCodeActivationFragment extends Fragment implements LinphoneAccountCreatorListener {
private String username, phone, dialcode, ha1;
private String username, phone, dialcode;
private TextView title;
private EditText code;
private boolean recoverAccount = false, linkAccount = false;

View file

@ -22,20 +22,21 @@ import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.linphone.LinphoneActivity;
import org.linphone.LinphoneManager;
import org.linphone.LinphonePreferences;
import org.linphone.LinphoneUtils;
import org.linphone.R;
import org.linphone.core.LinphoneAccountCreator;
import org.linphone.core.LinphoneAccountCreator.LinphoneAccountCreatorListener;
import org.linphone.core.LinphoneAccountCreator.Status;
import org.linphone.core.LinphoneCoreFactory;
import org.linphone.core.LinphoneProxyConfig;
import org.linphone.mediastream.Log;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.app.AlertDialog;
import android.app.Fragment;
import android.content.Context;
import android.os.Bundle;
import android.telephony.TelephonyManager;
import android.text.Editable;
@ -53,8 +54,6 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import static org.linphone.core.LinphoneAccountCreator.*;
/**
* @author Sylvain Berfini
*/
@ -62,7 +61,7 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
, OnClickListener, LinphoneAccountCreatorListener {
private EditText phoneNumberEdit, usernameEdit, passwordEdit, passwordConfirmEdit
, emailEdit, dialCode;
private TextView phoneNumberError, usernameError, passwordError, passwordConfirmError
private TextView phoneNumberError, passwordError, passwordConfirmError
, emailError, assisstantTitle, sipUri, skip;
private ImageView phoneNumberInfo;
@ -99,7 +98,6 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
useUsername = (CheckBox) view.findViewById(R.id.use_username);
useEmail = (CheckBox) view.findViewById(R.id.use_email);
usernameError = (TextView) view.findViewById(R.id.username_error);
usernameEdit = (EditText) view.findViewById(R.id.username);
phoneNumberError = (TextView) view.findViewById(R.id.phone_number_error);
@ -125,10 +123,11 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
//Phone number
if (getResources().getBoolean(R.bool.use_phone_number_validation)) {
getActivity().getApplicationContext();
//Automatically get the country code from the phone
TelephonyManager tm =
(TelephonyManager) getActivity().getApplicationContext().getSystemService(
getActivity().getApplicationContext().TELEPHONY_SERVICE);
Context.TELEPHONY_SERVICE);
String countryIso = tm.getNetworkCountryIso();
LinphoneProxyConfig proxyConfig = LinphoneManager.getLc().createProxyConfig();
countryCode = proxyConfig.lookupCCCFromIso(countryIso.toUpperCase());

View file

@ -17,7 +17,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import android.app.AlertDialog;
import java.util.Locale;
import org.linphone.LinphoneManager;
import org.linphone.LinphonePreferences;
import org.linphone.LinphoneUtils;
@ -27,7 +28,9 @@ import org.linphone.core.LinphoneAccountCreator;
import org.linphone.core.LinphoneCoreFactory;
import org.linphone.core.LinphoneProxyConfig;
import android.app.AlertDialog;
import android.app.Fragment;
import android.content.Context;
import android.os.Bundle;
import android.telephony.TelephonyManager;
import android.text.Editable;
@ -45,20 +48,17 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.util.Locale;
/**
* @author Sylvain Berfini
*/
public class LinphoneLoginFragment extends Fragment implements CompoundButton.OnCheckedChangeListener, OnClickListener, TextWatcher, LinphoneAccountCreator.LinphoneAccountCreatorListener {
private EditText login, password, phoneNumberEdit, dialCode, displayName;
private EditText login, password, phoneNumberEdit, dialCode;
private Button apply, selectCountry;
private CheckBox useUsername, usePassword;
private CheckBox useUsername;
private LinearLayout phoneNumberLayout, usernameLayout, passwordLayout;
private TextView forgotPassword, messagePhoneNumber, phoneNumberError;
private Boolean recoverAccount;
private LinphoneAccountCreator accountCreator;
private AssistantActivity.Country country;
private int countryCode;
private ImageView phoneNumberInfo;
@ -89,7 +89,6 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
usernameLayout = (LinearLayout) view.findViewById(R.id.username_layout);
passwordLayout = (LinearLayout) view.findViewById(R.id.password_layout);
password = (EditText) view.findViewById(R.id.assistant_password);
displayName = (EditText) view.findViewById(R.id.assistant_display_name);
messagePhoneNumber = (TextView) view.findViewById(R.id.message_phone_number);
forgotPassword = (TextView) view.findViewById(R.id.forgot_password);
@ -101,8 +100,9 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
//Phone number
if(getResources().getBoolean(R.bool.use_phone_number_validation)){
getActivity().getApplicationContext();
//Automatically get the country code from the phone
TelephonyManager tm = (TelephonyManager) getActivity().getApplicationContext().getSystemService(getActivity().getApplicationContext().TELEPHONY_SERVICE);
TelephonyManager tm = (TelephonyManager) getActivity().getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE);
String countryIso = tm.getNetworkCountryIso();
LinphoneProxyConfig proxyConfig = LinphoneManager.getLc().createProxyConfig();
countryCode = proxyConfig.lookupCCCFromIso(countryIso.toUpperCase());
@ -156,18 +156,7 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
return view;
}
private String getPhoneNumber(){
LinphoneProxyConfig proxyConfig = LinphoneManager.getLc().createProxyConfig();
String countryCode = dialCode.getText().toString();
if(countryCode != null && countryCode.startsWith("+")) {
countryCode = countryCode.substring(1);
}
proxyConfig.setDialPrefix(countryCode);
return proxyConfig.normalizePhoneNumber(phoneNumberEdit.getText().toString());
}
public void linphoneLogIn() {
if (login.getText() == null || login.length() == 0 || password.getText() == null || password.length() == 0) {
LinphoneUtils.displayErrorAlert(getString(R.string.first_launch_no_login_password), getContext());

View file

@ -18,13 +18,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.R;
import org.linphone.core.LinphoneAddress.TransportType;
import android.app.Fragment;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import org.linphone.core.LinphoneAddress.TransportType;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
@ -37,7 +36,7 @@ import android.widget.Toast;
* @author Sylvain Berfini
*/
public class LoginFragment extends Fragment implements OnClickListener, TextWatcher {
private EditText login, password, displayName, domain;
private EditText login, password, domain;
private RadioGroup transports;
private Button apply;
@ -50,7 +49,6 @@ public class LoginFragment extends Fragment implements OnClickListener, TextWatc
login.addTextChangedListener(this);
password = (EditText) view.findViewById(R.id.assistant_password);
password.addTextChangedListener(this);
displayName = (EditText) view.findViewById(R.id.assistant_display_name);
domain = (EditText) view.findViewById(R.id.assistant_domain);
domain.addTextChangedListener(this);
transports = (RadioGroup) view.findViewById(R.id.assistant_transports);

View file

@ -18,12 +18,17 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import java.util.Locale;
import org.linphone.LinphoneManager;
import org.linphone.LinphonePreferences;
import org.linphone.R;
import org.linphone.core.LinphoneProxyConfig;
import android.app.Fragment;
import android.os.Bundle;
import android.os.Handler;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Patterns;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -32,17 +37,6 @@ import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import org.linphone.LinphoneManager;
import org.linphone.LinphonePreferences;
import org.linphone.R;
import org.linphone.mediastream.Log;
import org.linphone.core.LinphoneProxyConfig;
import org.linphone.xmlrpc.XmlRpcHelper;
import org.linphone.xmlrpc.XmlRpcListenerBase;
import java.util.Locale;
import java.util.regex.Pattern;
public class InAppPurchaseFragment extends Fragment implements View.OnClickListener {
private LinearLayout usernameLayout;
@ -50,7 +44,6 @@ public class InAppPurchaseFragment extends Fragment implements View.OnClickListe
private TextView errorMessage;
private boolean usernameOk = false, emailOk = false;
private Handler mHandler = new Handler();
private String defaultUsername, defaultEmail;
private Button buyItemButton, recoverAccountButton;
@ -60,7 +53,6 @@ public class InAppPurchaseFragment extends Fragment implements View.OnClickListe
super.onCreate(savedInstanceState);
LayoutInflater mInflater = inflater;
View view = inflater.inflate(R.layout.in_app_store, container, false);
String id = getArguments().getString("item_id");
@ -123,37 +115,6 @@ public class InAppPurchaseFragment extends Fragment implements View.OnClickListe
});
}
private void addEmailHandler(final EditText field, final TextView errorMessage) {
field.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) {
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
public void onTextChanged(CharSequence s, int start, int count, int after) {
emailOk = false;
String email = s.toString();
if (isEmailCorrect(email)) {
emailOk = true;
errorMessage.setText("");
} else {
errorMessage.setText(R.string.wizard_email_incorrect);
}
if (buyItemButton != null) buyItemButton.setEnabled(emailOk && usernameOk);
if (recoverAccountButton != null) recoverAccountButton.setEnabled(emailOk && usernameOk);
}
});
}
private boolean isEmailCorrect(String email) {
Pattern emailPattern = Patterns.EMAIL_ADDRESS;
return emailPattern.matcher(email).matches();
}
private boolean isUsernameCorrect(String username) {
LinphoneProxyConfig lpc = LinphoneManager.getLc().createProxyConfig();
return lpc.isPhoneNumber(username);

View file

@ -19,18 +19,19 @@ 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.widget.AdapterView;
import java.util.List;
import org.linphone.R;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.TextView;
import org.linphone.R;
import org.linphone.mediastream.Log;
import java.util.List;
public class InAppPurchaseListFragment extends Fragment implements AdapterView.OnItemClickListener{
private ListView inappList;