fix Switch with R.id.object problem

This commit is contained in:
Brieuc Viel 2016-11-23 11:12:26 +01:00
parent c7dd9a30ce
commit 064ffd23e5
3 changed files with 80 additions and 100 deletions

View file

@ -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
*/
@ -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: {
int id = v.getId();
if(id == R.id.assistant_check) {
checkAccount.setEnabled(false);
accountCreator.isAccountActivated();
break;
}
}
}

View file

@ -296,23 +296,19 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.select_country: {
int id = v.getId();
if(id == R.id.select_country){
AssistantActivity.instance().displayCountryChooser();
break;
}
case R.id.assistant_skip: {
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();
}
break;
}
case R.id.info_phone_number: {
else if(id == R.id.info_phone_number){
if (linkAccount) {
new AlertDialog.Builder(getActivity())
.setTitle(getString(R.string.phone_number_info_title))
@ -325,10 +321,8 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
.setMessage(getString(R.string.phone_number_info_content))
.show();
}
break;
}
case R.id.assistant_create: {
else if(id == R.id.assistant_create){
createAccount.setEnabled(false);
if (linkAccount) {
addAlias();
@ -341,8 +335,6 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
createAccount.setEnabled(true);
}
}
break;
}
}
}

View file

@ -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
*/
@ -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: {
if(id == R.id.assistant_apply){
apply.setEnabled(false);
if (recoverAccount) {
recoverAccount();
} else {
linphoneLogIn();
}
break;
}
case R.id.info_phone_number: {
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();
break;
}
case R.id.select_country: {
else if(id == R.id.select_country){
AssistantActivity.instance().displayCountryChooser();
break;
}
default:
break;
}
}
private void recoverAccount() {