public class JoinActivity extends AppCompatActivity {
/* 키보드 내리기 */
InputMethodManager imm;
/* 다이얼로그 */
private AlertDialog dialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = DataBindingUtil.setContentView(this, R.layout.activity_join);
/* 툴바 이름 세팅 */
setSupportActionBar(binding.toolbar);
getSupportActionBar().setTitle("");
/* 키보드 내리기 */
imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
binding.linear.setOnClickListener(v -> hideKeyboard());
/* cancel 버튼 누르면 화면 종료 */
binding.cancelBtn.setOnClickListener(v -> finish());
/* 다음 버튼 */
binding.nextBtn.setOnClickListener(v -> {
if(binding.memberId.getText().toString().trim().equals("")) {
//Toast.makeText(getApplicationContext(), R.string.IdInPutMsg, Toast.LENGTH_SHORT).show();
AlertDialog.Builder builder = new AlertDialog.Builder(JoinActivity.this);
dialog = builder.setMessage(getText(R.string.IdInPutMsg))
.setPositiveButton("확인", null)
.create();
dialog.show();
return;
}
if(!validate) {
//Toast.makeText(getApplicationContext(), R.string.IdCheckMsg, Toast.LENGTH_SHORT).show();
AlertDialog.Builder builder = new AlertDialog.Builder(JoinActivity.this);
dialog = builder.setMessage(getText(R.string.IdCheckMsg))
.setPositiveButton("확인", null)
.create();
dialog.show();
return;
}
if(binding.password.getText().toString().trim().equals("") || binding.passwordCheck.getText().toString().trim().equals("") ||
binding.memberName.getText().toString().trim().equals("") || binding.email.getText().toString().trim().equals("") ||
binding.phone.getText().toString().trim().equals("") || binding.address.getText().toString().trim().equals("")) {
//Toast.makeText(getApplicationContext(), R.string.NoEmptyMsg, Toast.LENGTH_SHORT).show();
AlertDialog.Builder builder = new AlertDialog.Builder(JoinActivity.this);
dialog = builder.setMessage(getText(R.string.NoEmptyMsg))
.setPositiveButton("확인", null)
.create();
dialog.show();
return;
}
if(! binding.password.getText().toString().trim().equals(binding.passwordCheck.getText().toString().trim())) {
//Toast.makeText(getApplicationContext(), R.string.NoMatchPw, Toast.LENGTH_SHORT).show();
AlertDialog.Builder builder = new AlertDialog.Builder(JoinActivity.this);
dialog = builder.setMessage(getText(R.string.NoMatchPw))
.setPositiveButton("확인", null)
.create();
dialog.show();
return;
}
if(! binding.agreeCheckBox.isChecked()) {
//Toast.makeText(getApplicationContext(), R.string.AgreeMsg, Toast.LENGTH_SHORT).show();
AlertDialog.Builder builder = new AlertDialog.Builder(JoinActivity.this);
dialog = builder.setMessage(getText(R.string.AgreeMsg))
.setPositiveButton("확인", null)
.create();
dialog.show();
return;
}
});
// 미구현 메시지
binding.viewAllTerms.setOnClickListener(v->Toast.makeText(getApplicationContext(), R.string.NoFunctionMsg, Toast.LENGTH_SHORT).show());
} // onCreate 끝
/* 키보드 내리기 */
private void hideKeyboard()
{
imm.hideSoftInputFromWindow(binding.memberId.getWindowToken(), 0);
imm.hideSoftInputFromWindow(binding.password.getWindowToken(), 0);
imm.hideSoftInputFromWindow(binding.passwordCheck.getWindowToken(), 0);
imm.hideSoftInputFromWindow(binding.memberName.getWindowToken(), 0);
imm.hideSoftInputFromWindow(binding.email.getWindowToken(), 0);
imm.hideSoftInputFromWindow(binding.address.getWindowToken(), 0);
imm.hideSoftInputFromWindow(binding.phone.getWindowToken(), 0);
}
@Override
protected void onStop() {
super.onStop();
if(dialog != null){
dialog.dismiss();
dialog = null;
}
}
}
'# 02 > Android' 카테고리의 다른 글
[Android] EditText (0) | 2019.09.25 |
---|---|
[Android] 버튼 비활성화/활성화 (0) | 2019.09.23 |
[Android] 스피너 (0) | 2019.09.19 |
[Android] intent put, get (0) | 2019.09.19 |
[Android] android:scaleType (0) | 2019.09.16 |