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/adapter/RepoViewHolder.kt b/app/src/main/java/org/sopt/sample/adapter/RepoViewHolder.kt index 6ee5dfa..f8d5a2b 100644 --- a/app/src/main/java/org/sopt/sample/adapter/RepoViewHolder.kt +++ b/app/src/main/java/org/sopt/sample/adapter/RepoViewHolder.kt @@ -10,7 +10,7 @@ class RepoViewHolder( ): RecyclerView.ViewHolder(binding.root){ fun onBind(data: ResponseUserDTO.Data){ binding.imgGithub.load(data.avatar) - binding.txtGithubName.setText(data.first_name) + binding.txtGithubName.setText(data.firstName) binding.txtGithubAuthor.setText(data.email) } 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/remote/ResponseUserDTO.kt b/app/src/main/java/org/sopt/sample/remote/ResponseUserDTO.kt index 43a835e..08f4f46 100644 --- a/app/src/main/java/org/sopt/sample/remote/ResponseUserDTO.kt +++ b/app/src/main/java/org/sopt/sample/remote/ResponseUserDTO.kt @@ -1,5 +1,6 @@ package org.sopt.sample.remote +import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @Serializable @@ -7,7 +8,8 @@ data class ResponseUserDTO( val page: Int, val per_page: Int, val total: Int, - val total_pages: Int, + @SerialName("total_pages") + val totalPages: Int, val data: List, val support: Support, @@ -16,8 +18,10 @@ data class ResponseUserDTO( data class Data( val id: Int, val email: String, - val first_name: String, - val last_name: String, + @SerialName("first_name") + val firstName: String, + @SerialName("last_name") + val lastName: String, val avatar: String, ) 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 7b57cc7..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,8 +54,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginEnd="40dp" - android:text="이메일 형식이 올바르지 않습니다." - android:textColor="#ff0000" + android:text="@string/sign_up_email_error" + android:textColor="@color/red" android:visibility="invisible" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toBottomOf="@+id/editText_email" /> @@ -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" /> @@ -97,7 +97,7 @@ android:layout_height="wrap_content" android:layout_marginStart="40dp" android:layout_marginTop="32dp" - android:text="이름" + android:text="@string/sign_up_name_label" android:textStyle="bold" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/editText_pw" /> @@ -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" />