| |
---|
| | import android.view.View; |
---|
| | 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; |
---|
| | import org.ntlab.radishforandroidstudio.cactusClient.connections.LoginFragmentConnection; |
---|
| | import org.ntlab.radishforandroidstudio.cactusClient.models.URIAddressedAccount; |
---|
| | import org.ntlab.radishforandroidstudio.framework.network.CallBack; |
---|
| | |
---|
| | |
---|
| | public class LoginFragment extends Fragment { |
---|
| | private LoginFragmentConnection connection; |
---|
| |
---|
| | public View onCreateView(LayoutInflater inflater, ViewGroup container, |
---|
| | Bundle savedInstanceState) { |
---|
| | // Inflate the layout for this fragment |
---|
| | return inflater.inflate(R.layout.login_fragment, container, false); |
---|
| | |
---|
| | } |
---|
| | |
---|
| | @Override |
---|
| | public void onStart() { |
---|
| |
---|
| | |
---|
| | transaction.commit(); |
---|
| | // **********************************************************************/ |
---|
| | |
---|
| | // |
---|
| | // if (userName.getText().toString().isEmpty()) { |
---|
| | // Toast.makeText(getActivity(), "ユーザー名が未記入です", Toast.LENGTH_SHORT).show(); |
---|
| | // } else if(passWord.getText().toString().isEmpty()){ |
---|
| | // Toast.makeText(getActivity(), "パスワードが未記入です", Toast.LENGTH_SHORT).show(); |
---|
| | // } else { |
---|
| | // |
---|
| | // connection = new LoginFragmentConnection(); |
---|
| | // connection.setCallBack(new CallBack() { |
---|
| | // @Override |
---|
| | // public void onResponse(String response) { |
---|
| | // //通信した時の処理を書くのだよ |
---|
| | // URIAddressedEntity lac = JSON.decode(response, URIAddressedEntity.class); |
---|
| | // System.out.println("///////////////////////////////////////////////"); |
---|
| | // System.out.println(response); |
---|
| | // |
---|
| | // if(response.contains("\"login\":true,")){ |
---|
| | // Toast.makeText(getActivity(),"ログインに成功しました。", Toast.LENGTH_SHORT).show(); |
---|
| | // FragmentManager manager = getFragmentManager(); |
---|
| | // FragmentTransaction transaction = manager.beginTransaction(); |
---|
| | // transaction.replace(R.id.fragment_place, new InstancesFragment()); |
---|
| | // transaction.commit(); |
---|
| | // }else { |
---|
| | // Toast.makeText(getActivity(),"ログインに失敗しました。", Toast.LENGTH_SHORT).show(); |
---|
| | // } |
---|
| | // |
---|
| | // } |
---|
| | // }); |
---|
| | // connection.addFormParam("userID", userName.getText().toString()); |
---|
| | // connection.addFormParam("userPass", passWord.getText().toString()); |
---|
| | // connection.doPut(); |
---|
| | // } |
---|
| | /* |
---|
| | if (userName.getText().toString().isEmpty()) { |
---|
| | Toast.makeText(getActivity(), "ユーザー名が未記入です", Toast.LENGTH_SHORT).show(); |
---|
| | return; |
---|
| | } else if(passWord.getText().toString().isEmpty()){ |
---|
| | Toast.makeText(getActivity(), "パスワードが未記入です", Toast.LENGTH_SHORT).show(); |
---|
| | return; |
---|
| | } |
---|
| | |
---|
| | connection = new LoginFragmentConnection(); |
---|
| | connection.setCallBack(new CallBack() { |
---|
| | @Override |
---|
| | public void onResponse(String response) { |
---|
| | //通信した時の処理を書くのだよ |
---|
| | URIAddressedAccount lac = JSON.decode(response, new TypeReference<URIAddressedAccount>(){}); |
---|
| | System.out.println("///////////////////////////////////////////////"); |
---|
| | System.out.println(response); |
---|
| | |
---|
| | if(response.contains("\"login\":true,")){ |
---|
| | Toast.makeText(getActivity(),"ログインに成功しました。", Toast.LENGTH_SHORT).show(); |
---|
| | FragmentManager manager = getFragmentManager(); |
---|
| | FragmentTransaction transaction = manager.beginTransaction(); |
---|
| | transaction.replace(R.id.fragment_place, new InstancesFragment()); |
---|
| | transaction.commit(); |
---|
| | }else { |
---|
| | Toast.makeText(getActivity(),"ログインに失敗しました。", Toast.LENGTH_SHORT).show(); |
---|
| | } |
---|
| | |
---|
| | } |
---|
| | }); |
---|
| | connection.addFormParam("userID", userName.getText().toString()); |
---|
| | connection.addFormParam("userPass", passWord.getText().toString()); |
---|
| | connection.doPut(); |
---|
| | */ |
---|
| | |
---|
| | } |
---|
| | }); |
---|
| | |
---|
| | |
---|
| | |
No description provided.
松本彩樹のブランチ
4b5b013
intomaster
from松本彩樹のブランチ
on 20 Jul 2018