diff --git a/app/src/main/java/org/ntlab/radishforandroidstudio/CactusCleanArchitecture/Controller/InputUserController.java b/app/src/main/java/org/ntlab/radishforandroidstudio/CactusCleanArchitecture/Controller/InputUserController.java new file mode 100644 index 0000000..147aeca --- /dev/null +++ b/app/src/main/java/org/ntlab/radishforandroidstudio/CactusCleanArchitecture/Controller/InputUserController.java @@ -0,0 +1,43 @@ +package org.ntlab.radishforandroidstudio.CactusCleanArchitecture.Controller; + +import android.support.v4.app.FragmentActivity; +import android.support.v4.app.FragmentManager; +import android.view.View; +import android.widget.EditText; +import android.widget.Toast; + +import org.ntlab.radishforandroidstudio.CactusCleanArchitecture.UseCases.UserLoginBoundary; +import org.ntlab.radishforandroidstudio.CactusCleanArchitecture.UseCases.UserLoginUseCases; +import org.ntlab.radishforandroidstudio.R; + +/** + * 入力したデータをString型に変換し、入力判定を行うクラス + * + * @author n-konishi + */ + +public class InputUserController implements View.OnClickListener { + private FragmentActivity fragmentActivity; + private FragmentManager manager; + + public InputUserController(FragmentActivity fragmentActivity, FragmentManager manager) { + this.fragmentActivity = fragmentActivity; + this.manager = manager; + } + + @Override + public void onClick(View view) { + EditText userName = fragmentActivity.findViewById(R.id.inputUserName); + EditText passWord = fragmentActivity.findViewById(R.id.checkPassword); + + //動作 + UserLoginPresenter userLoginPresenter = new UserLoginPresenter(); + UserLoginUseCases userLoginUseCases = new UserLoginUseCases(userLoginPresenter); + userLoginUseCases.inputData(userName.getText().toString(), passWord.getText().toString()); + + //通信 + UserLoginResponseController userLoginResponseController = new UserLoginResponseController(fragmentActivity, manager); + userLoginPresenter.setFollowingController(userLoginResponseController); + userLoginUseCases.proc(); + } +}