From 5fb236059909baa8cd5c580f268cafc270b487f5 Mon Sep 17 00:00:00 2001 From: Daeun Date: Sat, 24 Dec 2022 01:13:46 +0900 Subject: [PATCH 01/15] =?UTF-8?q?[add]=20SignUpActivity=20color=20res=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/res/layout/activity_sign_up.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/layout/activity_sign_up.xml b/app/src/main/res/layout/activity_sign_up.xml index 7b57cc7..a8c95ff 100644 --- a/app/src/main/res/layout/activity_sign_up.xml +++ b/app/src/main/res/layout/activity_sign_up.xml @@ -55,7 +55,7 @@ android:layout_height="wrap_content" android:layout_marginEnd="40dp" android:text="이메일 형식이 올바르지 않습니다." - android:textColor="#ff0000" + android:textColor="@color/red" android:visibility="invisible" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toBottomOf="@+id/editText_email" /> @@ -86,7 +86,7 @@ android:layout_height="wrap_content" android:layout_marginEnd="40dp" android:text="비밀번호 형식이 올바르지 않습니다." - android:textColor="#ff0000" + android:textColor="@color/red" android:visibility="invisible" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toBottomOf="@+id/editText_pw" /> From 3d5c3367a6802d4d155b421cdc3f436717e99935 Mon Sep 17 00:00:00 2001 From: Daeun Date: Sat, 24 Dec 2022 01:34:53 +0900 Subject: [PATCH 02/15] =?UTF-8?q?[add]=20string=20resource=20=EC=B6=94?= =?UTF-8?q?=EC=B6=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/sopt/sample/SignInActivity.kt | 2 + .../java/org/sopt/sample/SignUpActivity.kt | 2 + .../org/sopt/sample/login/LoginViewModel.kt | 4 +- .../org/sopt/sample/signup/SignupViewModel.kt | 3 +- app/src/main/res/layout/activity_sign_in.xml | 14 +++---- app/src/main/res/layout/activity_sign_up.xml | 20 +++++----- app/src/main/res/layout/fragment_gallery.xml | 2 +- app/src/main/res/layout/fragment_search.xml | 1 - .../main/res/layout/layout_github_repo.xml | 4 +- app/src/main/res/layout/layout_header.xml | 2 +- app/src/main/res/menu/item_menu.xml | 6 +-- app/src/main/res/values/strings.xml | 38 +++++++++++++++++++ 12 files changed, 69 insertions(+), 29 deletions(-) diff --git a/app/src/main/java/org/sopt/sample/SignInActivity.kt b/app/src/main/java/org/sopt/sample/SignInActivity.kt index e59aea1..7caba5e 100644 --- a/app/src/main/java/org/sopt/sample/SignInActivity.kt +++ b/app/src/main/java/org/sopt/sample/SignInActivity.kt @@ -2,6 +2,7 @@ package org.sopt.sample import android.content.Intent import android.os.Bundle +import android.widget.Toast import androidx.activity.viewModels import org.sopt.sample.base.BindingActivity import org.sopt.sample.databinding.ActivitySignInBinding @@ -22,6 +23,7 @@ class SignInActivity: BindingActivity(R.layout.activity_s } viewModel.loginResult.observe(this) { + Toast.makeText(this, getString(R.string.sign_in_success_toast_msg), Toast.LENGTH_LONG).show() startActivity(Intent(this, MainActivity::class.java)) } binding.registerBtn.setOnClickListener(){ diff --git a/app/src/main/java/org/sopt/sample/SignUpActivity.kt b/app/src/main/java/org/sopt/sample/SignUpActivity.kt index 877ecdd..051de8c 100644 --- a/app/src/main/java/org/sopt/sample/SignUpActivity.kt +++ b/app/src/main/java/org/sopt/sample/SignUpActivity.kt @@ -5,6 +5,7 @@ import android.os.Bundle import android.text.Editable import android.text.TextWatcher import android.view.View +import android.widget.Toast import androidx.activity.viewModels import androidx.core.content.ContextCompat import org.sopt.sample.base.BindingActivity @@ -100,6 +101,7 @@ class SignUpActivity : BindingActivity(R.layout.activity_ viewModel.signupResult.observe(this) { startActivity(Intent(this,SignInActivity::class.java)) + Toast.makeText(this,getString(R.string.sign_up_success_toast_msg), Toast.LENGTH_LONG).show() } } } \ No newline at end of file diff --git a/app/src/main/java/org/sopt/sample/login/LoginViewModel.kt b/app/src/main/java/org/sopt/sample/login/LoginViewModel.kt index 5346aa0..23f1ae7 100644 --- a/app/src/main/java/org/sopt/sample/login/LoginViewModel.kt +++ b/app/src/main/java/org/sopt/sample/login/LoginViewModel.kt @@ -1,6 +1,7 @@ package org.sopt.sample.login import android.util.Log +import android.widget.Toast import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel @@ -9,7 +10,7 @@ import retrofit2.Call import retrofit2.Callback import retrofit2.Response -class LoginViewModel: ViewModel() { +class LoginViewModel : ViewModel() { private val _loginResult: MutableLiveData = MutableLiveData() val loginResult: LiveData get() = _loginResult @@ -22,7 +23,6 @@ class LoginViewModel: ViewModel() { call: Call, response: Response ) { - Log.d("로그인 성공", "${response.body()}") _loginResult.value = response.body() } diff --git a/app/src/main/java/org/sopt/sample/signup/SignupViewModel.kt b/app/src/main/java/org/sopt/sample/signup/SignupViewModel.kt index a996d15..d5a9cbc 100644 --- a/app/src/main/java/org/sopt/sample/signup/SignupViewModel.kt +++ b/app/src/main/java/org/sopt/sample/signup/SignupViewModel.kt @@ -33,11 +33,10 @@ class SignupViewModel: ViewModel() { response: Response ) { _signupResult.value = response.body() - Log.d("회원가입 성공", "${response.body()}") } override fun onFailure(call: Call, t: Throwable) { - TODO("Not yet implemented") + } }) diff --git a/app/src/main/res/layout/activity_sign_in.xml b/app/src/main/res/layout/activity_sign_in.xml index 770e6c6..4047ccb 100644 --- a/app/src/main/res/layout/activity_sign_in.xml +++ b/app/src/main/res/layout/activity_sign_in.xml @@ -22,7 +22,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="60dp" - android:text="Welcome to SOPT" + android:text="@string/sign_in_title" android:textSize="20sp" android:textStyle="bold" app:layout_constraintEnd_toEndOf="parent" @@ -35,7 +35,7 @@ android:layout_height="wrap_content" android:layout_marginStart="40dp" android:layout_marginTop="32dp" - android:text="ID" + android:text="@string/sign_id_label" android:textStyle="bold" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/txt_title" /> @@ -46,7 +46,7 @@ android:layout_height="wrap_content" android:layout_marginHorizontal="40dp" android:layout_marginTop="20dp" - android:hint="아이디를 입력하세요" + android:hint="@string/sign_id_hint" app:layout_constraintTop_toBottomOf="@+id/txt_id_title" tools:layout_editor_absoluteX="40dp" /> @@ -56,7 +56,7 @@ android:layout_height="wrap_content" android:layout_marginStart="40dp" android:layout_marginTop="32dp" - android:text="비밀번호" + android:text="@string/sign_pw_label" android:textStyle="bold" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/editText_id" /> @@ -67,7 +67,7 @@ android:layout_height="wrap_content" android:layout_marginHorizontal="40dp" android:layout_marginTop="20dp" - android:hint="비밀번호를 입력하세요" + android:hint="@string/sign_pw_hint" android:inputType="textPassword" app:layout_constraintTop_toBottomOf="@+id/txt_password_title" /> @@ -77,7 +77,7 @@ android:layout_height="wrap_content" android:layout_marginHorizontal="40dp" android:layout_marginTop="30dp" - android:text="LOGIN" + android:text="@string/sign_in" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/editText_pw" /> @@ -87,7 +87,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginHorizontal="40dp" - android:text="SIGNUP" + android:text="@string/sign_up" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/loginBtn" /> diff --git a/app/src/main/res/layout/activity_sign_up.xml b/app/src/main/res/layout/activity_sign_up.xml index a8c95ff..dda9d05 100644 --- a/app/src/main/res/layout/activity_sign_up.xml +++ b/app/src/main/res/layout/activity_sign_up.xml @@ -21,7 +21,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="60dp" - android:text="SIGNUP" + android:text="@string/sign_up_title" android:textSize="20sp" android:textStyle="bold" app:layout_constraintEnd_toEndOf="parent" @@ -34,7 +34,7 @@ android:layout_height="wrap_content" android:layout_marginStart="40dp" android:layout_marginTop="32dp" - android:text="이메일" + android:text="@string/sign_up_email_label" android:textStyle="bold" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/txt_title" /> @@ -45,7 +45,7 @@ android:layout_height="wrap_content" android:layout_marginHorizontal="40dp" android:layout_marginTop="20dp" - android:hint="이메일을 입력하세요" + android:hint="@string/sign_up_email_hint" app:layout_constraintTop_toBottomOf="@+id/txt_email_title" tools:layout_editor_absoluteX="40dp" /> @@ -54,7 +54,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginEnd="40dp" - android:text="이메일 형식이 올바르지 않습니다." + android:text="@string/sign_up_email_error" android:textColor="@color/red" android:visibility="invisible" app:layout_constraintEnd_toEndOf="parent" @@ -66,7 +66,7 @@ android:layout_height="wrap_content" android:layout_marginStart="40dp" android:layout_marginTop="32dp" - android:text="비밀번호" + android:text="@string/sign_up_pw_label" android:textStyle="bold" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/editText_email" /> @@ -77,7 +77,7 @@ android:layout_height="wrap_content" android:layout_marginHorizontal="40dp" android:layout_marginTop="20dp" - android:hint="비밀번호를 입력하세요" + android:hint="@string/sign_up_pw_hint" app:layout_constraintTop_toBottomOf="@+id/txt_password_title" /> @@ -109,7 +109,7 @@ android:layout_height="wrap_content" android:layout_marginHorizontal="40dp" android:layout_marginTop="20dp" - android:hint="이름을 입력하세요" + android:hint="@string/sign_up_name_hint" app:layout_constraintTop_toBottomOf="@+id/txt_name_title" />