| |
---|
| | import android.view.ViewGroup; |
---|
| | import android.widget.Button; |
---|
| | import android.widget.EditText; |
---|
| | import android.widget.Toast; |
---|
| | |
---|
| | import net.arnx.jsonic.JSON; |
---|
| | import net.arnx.jsonic.TypeReference; |
---|
| | |
---|
| | import org.ntlab.radishforandroidstudio.R; |
---|
| |
---|
| | //Toast.makeText(getActivity(), "hoge!", Toast.LENGTH_SHORT).show(); |
---|
| | |
---|
| | FragmentManager manager = getFragmentManager(); |
---|
| | FragmentTransaction transaction = manager.beginTransaction(); |
---|
| | |
---|
| | transaction.addToBackStack(null); |
---|
| | //transaction.replace(R.id.fragment_place, new LoginFragment()); |
---|
| | transaction.replace(R.id.framelayout_place, new LoginFragment()); |
---|
| | |
---|
| | transaction.commit(); |
---|
| | } |
---|
| | }); |
---|
| | |
---|
| | //サインアップ |
---|
| | Button signUpButton = (Button) getActivity().findViewById(R.id.signUp2); |
---|
| | signUpButton.setOnClickListener(new View.OnClickListener(){ |
---|
| | signUpButton.setOnClickListener(new View.OnClickListener() { |
---|
| | @Override |
---|
| | public void onClick(View view) { |
---|
| | EditText inputPassword = (EditText)getActivity().findViewById(R.id.inputPassword2); |
---|
| | EditText checkPassWord = (EditText)getActivity().findViewById(R.id.checkPassword); |
---|
| | EditText inputUserName = (EditText)getActivity().findViewById(R.id.inputUserName); |
---|
| | EditText inputUserID = (EditText)getActivity().findViewById(R.id.inputUserID); |
---|
| | EditText inputPassword = (EditText) getActivity().findViewById(R.id.inputPassword2); |
---|
| | EditText checkPassWord = (EditText) getActivity().findViewById(R.id.checkPassword); |
---|
| | EditText inputUserName = (EditText) getActivity().findViewById(R.id.inputUserName); |
---|
| | EditText inputUserID = (EditText) getActivity().findViewById(R.id.inputUserID); |
---|
| | |
---|
| | |
---|
| | if(inputUserID.getText().toString().contains(" ") || inputUserID.getText().toString().contains(" ")){ |
---|
| | if (inputUserID.getText().toString().contains(" ") || inputUserID.getText().toString().contains(" ")) { |
---|
| | Toast.makeText(getActivity(), "空白の含むIDは登録できません", Toast.LENGTH_SHORT).show(); |
---|
| | }else if (inputPassword.getText().toString().isEmpty()) { |
---|
| | } else if (inputPassword.getText().toString().isEmpty()) { |
---|
| | Toast.makeText(getActivity(), "パスワードを入力してください", Toast.LENGTH_SHORT).show(); |
---|
| | } else if (checkPassWord.getText().toString().isEmpty()) { |
---|
| | Toast.makeText(getActivity(), "確認用パスワードを入力してください", Toast.LENGTH_SHORT).show(); |
---|
| | } else if (!inputPassword.getText().toString().equals(checkPassWord.getText().toString() )) { |
---|
| | } else if (!inputPassword.getText().toString().equals(checkPassWord.getText().toString())) { |
---|
| | Toast.makeText(getActivity(), "パスワードが一致しません", Toast.LENGTH_SHORT).show(); |
---|
| | }else{ |
---|
| | } else { |
---|
| | |
---|
| | connection = new SignUpFragmentConnection(); |
---|
| | connection.setCallBack(new CallBack() { |
---|
| | @Override |
---|
| | public void onResponse(String response) { |
---|
| | //通信した時の処理を書くのだよ |
---|
| | URIAddressedAccount ac = JSON.decode(response, URIAddressedAccount.class); |
---|
| | URIAddressedAccount ac2 = JSON.decode(response, new TypeReference<URIAddressedAccount>(){}); |
---|
| | System.out.println("JSON.decode(response, URIAddressedAccount.class);\n"+ac.getUri()); |
---|
| | System.out.println("JSON.decode(response, new TypeReference<URIAddressedAccount>(){});\n"+ac2.getUri()); |
---|
| | URIAddressedAccount ac2 = JSON.decode(response, new TypeReference<URIAddressedAccount>() { |
---|
| | }); |
---|
| | System.out.println("JSON.decode(response, URIAddressedAccount.class);\n" + ac.getUri()); |
---|
| | System.out.println("JSON.decode(response, new TypeReference<URIAddressedAccount>(){});\n" + ac2.getUri()); |
---|
| | System.out.println(response); |
---|
| | Toast.makeText(getActivity(),response, Toast.LENGTH_SHORT).show(); |
---|
| | Toast.makeText(getActivity(), response, Toast.LENGTH_SHORT).show(); |
---|
| | } |
---|
| | }); |
---|
| | |
---|
| | connection.addFormParam("userID", inputUserID.getText().toString()); |
---|
| |
---|
| | |