Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mod dto name #9

Open
wants to merge 3 commits into
base: develop/view
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/src/main/java/org/sopt/sample/SignInActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -22,6 +23,7 @@ class SignInActivity: BindingActivity<ActivitySignInBinding>(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(){
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/org/sopt/sample/SignUpActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -100,6 +101,7 @@ class SignUpActivity : BindingActivity<ActivitySignUpBinding>(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()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/org/sopt/sample/login/LoginViewModel.kt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -9,7 +10,7 @@ import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response

class LoginViewModel: ViewModel() {
class LoginViewModel : ViewModel() {
private val _loginResult: MutableLiveData<ResponseLoginDTO> = MutableLiveData()
val loginResult: LiveData<ResponseLoginDTO>
get() = _loginResult
Expand All @@ -22,7 +23,6 @@ class LoginViewModel: ViewModel() {
call: Call<ResponseLoginDTO>,
response: Response<ResponseLoginDTO>
) {
Log.d("로그인 성공", "${response.body()}")
_loginResult.value = response.body()
}

Expand Down
10 changes: 7 additions & 3 deletions app/src/main/java/org/sopt/sample/remote/ResponseUserDTO.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package org.sopt.sample.remote

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
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<Data>,
val support: Support,

Expand All @@ -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,
)

Expand Down
3 changes: 1 addition & 2 deletions app/src/main/java/org/sopt/sample/signup/SignupViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,10 @@ class SignupViewModel: ViewModel() {
response: Response<ResponseSignupDTO>
) {
_signupResult.value = response.body()
Log.d("회원가입 성공", "${response.body()}")
}

override fun onFailure(call: Call<ResponseSignupDTO>, t: Throwable) {
TODO("Not yet implemented")

}
})

Expand Down
14 changes: 7 additions & 7 deletions app/src/main/res/layout/activity_sign_in.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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" />
Expand All @@ -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" />

Expand All @@ -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" />
Expand All @@ -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" />

Expand All @@ -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" />
Expand All @@ -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" />
Expand Down
24 changes: 12 additions & 12 deletions app/src/main/res/layout/activity_sign_up.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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" />
Expand All @@ -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" />

Expand All @@ -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" />
Expand All @@ -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" />
Expand All @@ -77,16 +77,16 @@
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" />

<TextView
android:id="@+id/tv_pwerror"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="40dp"
android:text="비밀번호 형식이 올바르지 않습니다."
android:textColor="#ff0000"
android:text="@string/sign_up_pw_error"
android:textColor="@color/red"
android:visibility="invisible"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/editText_pw" />
Expand All @@ -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" />
Expand All @@ -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" />

<Button
Expand All @@ -119,7 +119,7 @@
android:layout_marginHorizontal="40dp"
android:layout_marginTop="30dp"
android:enabled="false"
android:text="회원가입 완료"
android:text="@string/sign_up_finish"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/editText_name" />
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/fragment_gallery.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="100dp"
android:text="이미지 업로드!"
android:text="@string/gallery_image_upload"
app:layout_constraintEnd_toEndOf="@+id/iv_sample"
app:layout_constraintStart_toStartOf="@+id/iv_sample"
app:layout_constraintTop_toBottomOf="@+id/iv_sample" />
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/layout/fragment_search.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="여기는 search fragment 입니다!"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/layout_github_repo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
app:layout_constraintBottom_toTopOf="@+id/txt_github_author"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/img_github"
tools:text="Repo Name" />
tools:text="@string/github_repo" />

<TextView
android:id="@+id/txt_github_author"
Expand All @@ -32,7 +32,7 @@
app:layout_constraintBottom_toBottomOf="@+id/img_github"
app:layout_constraintEnd_toEndOf="@+id/txt_github_name"
app:layout_constraintTop_toBottomOf="@+id/txt_github_name"
tools:text="Dani Lee" />
tools:text="@string/github_user" />


</androidx.constraintlayout.widget.ConstraintLayout>
2 changes: 1 addition & 1 deletion app/src/main/res/layout/layout_header.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="10dp"
android:text="다니의 레포지터리"
android:text="@string/header_name"
android:textSize="15sp"
app:layout_constraintTop_toTopOf="parent"
tools:layout_editor_absoluteX="10dp" />
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/menu/item_menu.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/nav_home"
android:title=""
android:title="@string/menu_home"
android:icon="@drawable/ic_home_white" />
<item android:id="@+id/nav_gallery"
android:title="갤러리"
android:title="@string/menu_gallery"
android:icon="@drawable/ic_gallery_white" />
<item android:id="@+id/nav_search"
android:title="검색"
android:title="@string/menu_search"
android:icon="@drawable/ic_search_white" />
</menu>
38 changes: 38 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
<resources>
<string name="app_name">INSOPTAndroidPractice</string>

<!--menu-->
<string name="menu_home">홈</string>
<string name="menu_gallery">갤러리</string>
<string name="menu_search">검색</string>

<!--Sign-->
<string name="sign_in_title">Welcome to SOPT</string>
<string name="sign_id_label">ID</string>
<string name="sign_id_hint">아이디를 입력하세요</string>
<string name="sign_pw_label">비밀번호</string>
<string name="sign_pw_hint">비밀번호를 입력하세요</string>
<string name="sign_in">LOGIN</string>
<string name="sign_up">SIGNUP</string>
<string name="sign_up_title">SIGNUP</string>
<string name="sign_up_email_label">이메일</string>
<string name="sign_up_email_hint">이메일을 입력하세요</string>
<string name="sign_up_email_error">이메일 형식이 올바르지 않습니다.</string>
<string name="sign_up_pw_label">비밀번호</string>
<string name="sign_up_pw_hint">비밀번호를 입력하세요</string>
<string name="sign_up_pw_error">비밀번호 형식이 올바르지 않습니다.</string>
<string name="sign_up_name_label">이름</string>
<string name="sign_up_name_hint">이름을 입력하세요</string>
<string name="sign_up_finish" >Sign Up</string>
<string name="sign_in_success_toast_msg">로그인을 성공했습니다</string>
<string name="sign_up_success_toast_msg">회원가입에 성공했습니다.</string>

<!--gallery-->
<string name="gallery_image_upload">이미지 업로드!</string>

<!--github-->
<string name="github_repo">Repo Name</string>
<string name="github_user">Dani Lee</string>

<!--header-->
<string name="header_name">다니의 레포지터리</string>


</resources>