fix Switch with R.id.object problem
This commit is contained in:
parent
c7dd9a30ce
commit
064ffd23e5
3 changed files with 80 additions and 100 deletions
|
@ -17,14 +17,6 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
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.LinphoneCoreFactory;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -34,6 +26,13 @@ import android.view.ViewGroup;
|
|||
import android.widget.Button;
|
||||
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.LinphoneAccountCreator.LinphoneAccountCreatorListener;
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
|
@ -45,7 +44,7 @@ public class CreateAccountActivationFragment extends Fragment implements OnClick
|
|||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.assistant_account_creation_email_activation, container, false);
|
||||
|
||||
accountCreator = LinphoneCoreFactory.instance().createAccountCreator(LinphoneManager.getLc()
|
||||
|
@ -69,12 +68,10 @@ public class CreateAccountActivationFragment extends Fragment implements OnClick
|
|||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.assistant_check: {
|
||||
checkAccount.setEnabled(false);
|
||||
accountCreator.isAccountActivated();
|
||||
break;
|
||||
}
|
||||
int id = v.getId();
|
||||
if(id == R.id.assistant_check) {
|
||||
checkAccount.setEnabled(false);
|
||||
accountCreator.isAccountActivated();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -225,13 +225,13 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
assisstantTitle.setText(getResources().getString(R.string.link_account));
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
accountCreator.setLanguage(Locale.getDefault().toLanguageTag());
|
||||
accountCreator.setLanguage(Locale.getDefault().toLanguageTag());
|
||||
}
|
||||
|
||||
addUsernameHandler(usernameEdit, null);
|
||||
|
||||
createAccount.setEnabled(true);
|
||||
createAccount.setOnClickListener(this);
|
||||
createAccount.setEnabled(true);
|
||||
createAccount.setOnClickListener(this);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
@ -296,59 +296,51 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.select_country: {
|
||||
AssistantActivity.instance().displayCountryChooser();
|
||||
break;
|
||||
int id = v.getId();
|
||||
if(id == R.id.select_country){
|
||||
AssistantActivity.instance().displayCountryChooser();
|
||||
}
|
||||
else if (id == R.id.assistant_skip){
|
||||
if (getArguments().getBoolean("LinkFromPref")) {
|
||||
startActivity(new Intent().setClass(AssistantActivity.instance(), LinphoneActivity.class));
|
||||
AssistantActivity.instance().finish();
|
||||
} else {
|
||||
AssistantActivity.instance().success();
|
||||
}
|
||||
|
||||
case R.id.assistant_skip: {
|
||||
if (getArguments().getBoolean("LinkFromPref")) {
|
||||
startActivity(new Intent().setClass(AssistantActivity.instance(), LinphoneActivity.class));
|
||||
AssistantActivity.instance().finish();
|
||||
} else {
|
||||
AssistantActivity.instance().success();
|
||||
}
|
||||
break;
|
||||
}
|
||||
else if(id == R.id.info_phone_number){
|
||||
if (linkAccount) {
|
||||
new AlertDialog.Builder(getActivity())
|
||||
.setTitle(getString(R.string.phone_number_info_title))
|
||||
.setMessage(getString(R.string.phone_number_link_info_content) + "\n"
|
||||
+ getString(R.string.phone_number_link_info_content_already_account))
|
||||
.show();
|
||||
} else {
|
||||
new AlertDialog.Builder(getActivity())
|
||||
.setTitle(getString(R.string.phone_number_info_title))
|
||||
.setMessage(getString(R.string.phone_number_info_content))
|
||||
.show();
|
||||
}
|
||||
|
||||
case R.id.info_phone_number: {
|
||||
if (linkAccount) {
|
||||
new AlertDialog.Builder(getActivity())
|
||||
.setTitle(getString(R.string.phone_number_info_title))
|
||||
.setMessage(getString(R.string.phone_number_link_info_content) + "\n"
|
||||
+ getString(R.string.phone_number_link_info_content_already_account))
|
||||
.show();
|
||||
}
|
||||
else if(id == R.id.assistant_create){
|
||||
createAccount.setEnabled(false);
|
||||
if (linkAccount) {
|
||||
addAlias();
|
||||
} else {
|
||||
if (!getResources().getBoolean(R.bool.isTablet) || getUsername().length() > 0) {
|
||||
accountCreator.isAccountUsed();
|
||||
} else {
|
||||
new AlertDialog.Builder(getActivity())
|
||||
.setTitle(getString(R.string.phone_number_info_title))
|
||||
.setMessage(getString(R.string.phone_number_info_content))
|
||||
.show();
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(Status.UsernameTooShort)
|
||||
, AssistantActivity.instance());
|
||||
createAccount.setEnabled(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case R.id.assistant_create: {
|
||||
createAccount.setEnabled(false);
|
||||
if (linkAccount) {
|
||||
addAlias();
|
||||
} else {
|
||||
if (!getResources().getBoolean(R.bool.isTablet) || getUsername().length() > 0) {
|
||||
accountCreator.isAccountUsed();
|
||||
} else {
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(Status.UsernameTooShort)
|
||||
, AssistantActivity.instance());
|
||||
createAccount.setEnabled(true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isEmailCorrect(String email) {
|
||||
Pattern emailPattern = Patterns.EMAIL_ADDRESS;
|
||||
return emailPattern.matcher(email).matches();
|
||||
Pattern emailPattern = Patterns.EMAIL_ADDRESS;
|
||||
return emailPattern.matcher(email).matches();
|
||||
}
|
||||
|
||||
private boolean isPasswordCorrect(String password) {
|
||||
|
|
|
@ -17,19 +17,6 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
import java.util.Locale;
|
||||
|
||||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.LinphonePreferences;
|
||||
import org.linphone.LinphoneUtils;
|
||||
import org.linphone.R;
|
||||
import org.linphone.compatibility.Compatibility;
|
||||
import org.linphone.core.DialPlan;
|
||||
import org.linphone.core.LinphoneAccountCreator;
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
import org.linphone.core.LinphoneProxyConfig;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Fragment;
|
||||
import android.content.Context;
|
||||
|
@ -42,7 +29,6 @@ import android.text.method.LinkMovementMethod;
|
|||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewDebug;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
|
@ -52,6 +38,18 @@ import android.widget.ImageView;
|
|||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.LinphonePreferences;
|
||||
import org.linphone.LinphoneUtils;
|
||||
import org.linphone.R;
|
||||
import org.linphone.compatibility.Compatibility;
|
||||
import org.linphone.core.DialPlan;
|
||||
import org.linphone.core.LinphoneAccountCreator;
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
import org.linphone.core.LinphoneProxyConfig;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
|
@ -69,7 +67,7 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
|
|||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.assistant_linphone_login, container, false);
|
||||
|
||||
accountCreator = LinphoneCoreFactory.instance().createAccountCreator(LinphoneManager.getLc(), LinphonePreferences.instance().getXmlrpcUrl());
|
||||
|
@ -231,31 +229,24 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
int id = v.getId();
|
||||
|
||||
switch(id) {
|
||||
case R.id.assistant_apply: {
|
||||
apply.setEnabled(false);
|
||||
if (recoverAccount) {
|
||||
recoverAccount();
|
||||
} else {
|
||||
linphoneLogIn();
|
||||
}
|
||||
break;
|
||||
if(id == R.id.assistant_apply){
|
||||
apply.setEnabled(false);
|
||||
if (recoverAccount) {
|
||||
recoverAccount();
|
||||
} else {
|
||||
linphoneLogIn();
|
||||
}
|
||||
case R.id.info_phone_number: {
|
||||
new AlertDialog.Builder(getActivity())
|
||||
.setTitle(getString(R.string.phone_number_info_title))
|
||||
.setMessage(getString(R.string.phone_number_link_info_content))
|
||||
.show();
|
||||
break;
|
||||
}
|
||||
case R.id.select_country: {
|
||||
AssistantActivity.instance().displayCountryChooser();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
else if(id == R.id.info_phone_number){
|
||||
new AlertDialog.Builder(getActivity())
|
||||
.setTitle(getString(R.string.phone_number_info_title))
|
||||
.setMessage(getString(R.string.phone_number_link_info_content))
|
||||
.show();
|
||||
}
|
||||
else if(id == R.id.select_country){
|
||||
AssistantActivity.instance().displayCountryChooser();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void recoverAccount() {
|
||||
|
|
Loading…
Reference in a new issue