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

[1주차 과제] 안드로이드 UI 구현 기초 #2

Merged
merged 40 commits into from
Apr 10, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
bb7b203
feat: 로그인, 회원가입 화면 추가
leeeha Apr 4, 2023
243e12d
design: 로그인 화면 레이아웃 구현
leeeha Apr 4, 2023
1ace457
feat: 회원가입 화면으로부터 결과 값을 받아오는 코드 작성
leeeha Apr 5, 2023
9bf070e
design: 회원가입 화면 레이아웃 구현
leeeha Apr 5, 2023
01ff61a
fix: match_parent에서 0dp(match_constraint)로 변경
leeeha Apr 5, 2023
11592f3
fix: 비밀번호의 에디트텍스트 인풋 타입 변경
leeeha Apr 5, 2023
a145fef
feat(회원가입 화면): id, pw 길이가 제한 조건에 맞지 않으면 경고 문구 표시
leeeha Apr 5, 2023
46d36a4
chore: 코틀린 버전 업그레이드
leeeha Apr 5, 2023
e88b4dc
chore: 코틀린 버전 1.8.0으로 변경
leeeha Apr 5, 2023
cfcf7f4
feat(회원가입 화면): 입력값을 로그인 화면으로 전달하는 코드 작성
leeeha Apr 5, 2023
cdf9613
fix(회원가입 화면): 4개의 입력 값이 모두 유효한 경우에만 로그인 화면으로 넘어가도록
leeeha Apr 5, 2023
9e44a32
feat(로그인 화면): 회원가입 된 유저의 id, pw와 일치하는 경우에만 로그인 성공하도록 구현
leeeha Apr 5, 2023
979a4d5
refactor(로그인 화면): 유저 정보를 확인하고 홈 화면으로 넘어가는 코드 분리
leeeha Apr 5, 2023
1a5e172
fix(로그인 화면): 로그인 화면에서 종료되지 않고 메인 액티비티로 넘어가도록 변경
leeeha Apr 5, 2023
a0710fb
design(메인 화면): 유저 정보 표시를 위한 레이아웃 구현
leeeha Apr 5, 2023
f06ec6d
feat(메인 화면): 로그인 결과에 따라 유저의 이름과 특기 표시
leeeha Apr 5, 2023
ba2c705
feat(회원가입 화면): 4개의 항목 중에 하나라도 유효하지 않은 경우 토스트 메시지 띄우기
leeeha Apr 5, 2023
e1bcb30
rename(로그인 화면): 변수와 함수명 변경
leeeha Apr 5, 2023
a5ee124
remove(메인 화면): 사용하지 않는 태그 삭제
leeeha Apr 5, 2023
4f8efbb
refactor(회원가입 화면): 회원가입 버튼을 눌렀을 때의 처리를 함수 여러 개로 분리
leeeha Apr 5, 2023
57514ce
feat: EditText 입력 한줄로 제한, 엔터 누르면 다음 항목으로 이동하도록
leeeha Apr 6, 2023
496d47a
feat: 화면 클릭하면 키보드 숨기기
leeeha Apr 6, 2023
dbc2d2a
feat: 액티비티 windowSoftInputMode 변경 (키보드에 따라 레이아웃 크기 조정되도록)
leeeha Apr 6, 2023
730b7a3
feat: 로그인 된 유저가 있으면 메인 화면으로 바로 진입하도록 (SharedPreferences 활용)
leeeha Apr 6, 2023
d762f09
feat: 메인 화면에서 로그인 화면에 진입하지 않도록 액티비티 스택 비우기
leeeha Apr 6, 2023
2a163b7
refactor: saveUserInfoToPrefs() 함수 호출 위치 변경 (회원가입 완료되자마자)
leeeha Apr 6, 2023
b6b15f2
Merge branch 'develop' of https://github.com/GO-SOPT-ANDROID/haeun-le…
leeeha Apr 6, 2023
4a1ba16
refactor: companion object 선언 위치 변경
leeeha Apr 7, 2023
51e1720
remove: 사용하지 않는 Serializable 삭제
leeeha Apr 7, 2023
d3a2497
refactor: 패키지 구조 변경
leeeha Apr 7, 2023
ad0afdc
refactor: 코틀린 코드 상의 문자열, 상수 하드코딩 없애기
leeeha Apr 7, 2023
e6c7aed
refactor: PreferenceUtil 클래스에서만 사용되는 상수 선언 위치 변경
leeeha Apr 7, 2023
a70d4be
feat: 화면 방향 세로로 고정
leeeha Apr 10, 2023
bc03292
refactor(로그인 액티비티): onCreate 내에서 함수 분리
leeeha Apr 10, 2023
cb131a5
refactor(로그인 액티비티): 함수 분리, 확장 함수로 스낵바와 토스트 메시지 띄우기
leeeha Apr 10, 2023
90234ff
refactor: strings.xml 파일에 문자열 등록하여 사용
leeeha Apr 10, 2023
7f12330
refactor: 텍스트뷰에 새 문자열을 append 하는 식으로 변경
leeeha Apr 10, 2023
f6c409b
fix: android:windowSoftInputMode="adjustResize" 속성 삭제
leeeha Apr 10, 2023
7df174c
refactor(회원가입 화면): 함수 분리, strings.xml 파일에 있는 문자열 사용, 배열 대신 데이터 클래스 사용
leeeha Apr 10, 2023
8af2af0
refactor: xml 하드코딩 텍스트 추출, EditText inputType 지정
leeeha Apr 10, 2023
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
50 changes: 50 additions & 0 deletions app/src/main/java/org/android/go/sopt/SignUpActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ package org.android.go.sopt

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.text.Editable
import android.text.TextWatcher
import android.view.View
import org.android.go.sopt.databinding.ActivitySignUpBinding

class SignUpActivity : AppCompatActivity() {
Expand All @@ -11,5 +14,52 @@ class SignUpActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
binding = ActivitySignUpBinding.inflate(layoutInflater)
setContentView(binding.root)

binding.etId.addTextChangedListener(object: TextWatcher {
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
}

override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addTextChangedListener를 활용해 길이제한조건을 사용자에게 명시해주는 점 좋았습니다 😘

if(!checkValidityOfId(s.toString())){
binding.tvIdLimitError.visibility = View.VISIBLE
}else{
binding.tvIdLimitError.visibility = View.INVISIBLE
}
}

override fun afterTextChanged(s: Editable?) {
}
})

binding.etPw.addTextChangedListener(object: TextWatcher {
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
}

override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
if(!checkValidityOfPw(s.toString())){
binding.tvPwLimitError.visibility = View.VISIBLE
}else{
binding.tvPwLimitError.visibility = View.INVISIBLE
}
}

override fun afterTextChanged(s: Editable?) {
}
})

binding.btnSignUp.setOnClickListener {
val id = binding.etId.text.toString()
val pw = binding.etPw.text.toString()
val name = binding.etName.text.toString()
val hobby = binding.etHobby.text.toString()
}
}

private fun checkValidityOfId(id: String): Boolean {
return id.length in 6..10
}

private fun checkValidityOfPw(pw: String): Boolean {
return pw.length in 8..12
}
}
26 changes: 26 additions & 0 deletions app/src/main/res/layout/activity_sign_up.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,26 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_title" />

<TextView
android:id="@+id/tv_id_limit_error"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:text="* 6~10글자 이내만 허용"
android:visibility="invisible"
android:textColor="@color/red"
app:layout_constraintBottom_toBottomOf="@id/tv_id"
app:layout_constraintStart_toEndOf="@id/tv_id"
app:layout_constraintTop_toTopOf="@id/tv_id" />

<EditText
android:id="@+id/et_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:hint="아이디를 입력하세요."
android:minHeight="48dp"
android:maxLength="10"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_id" />
Expand All @@ -58,10 +71,23 @@
android:hint="비밀번호를 입력하세요."
android:inputType="textPassword"
android:minHeight="48dp"
android:maxLength="12"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_pw" />

<TextView
android:id="@+id/tv_pw_limit_error"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:text="* 8~12글자 이내만 허용"
android:visibility="invisible"
android:textColor="@color/red"
app:layout_constraintBottom_toBottomOf="@id/tv_pw"
app:layout_constraintStart_toEndOf="@id/tv_pw"
app:layout_constraintTop_toTopOf="@id/tv_pw" />

<TextView
android:id="@+id/tv_name"
android:layout_width="wrap_content"
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="red">#F44336</color>
Comment on lines 8 to +10
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

color까지 지정하시다니 👍👍
3주차 세미나 때 팟짱님이 알려주시겠지만 네이밍을 하실 때 Material Design을 참고하셔도 좋을 것 같아요 😉

</resources>