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

[2주차/필수/XML] Android UI 구현 심화 #7

Merged
merged 16 commits into from
Apr 29, 2024
Merged

Conversation

SYAAINN
Copy link
Collaborator

@SYAAINN SYAAINN commented Apr 19, 2024

Related issue 🛠

Work Description ✏️

  • 바텀 네비게이션 구현
  • HomeFragment 개인프로필&친구프로필 리스트 작성
  • 1주차 Main 화면 MyPageFragment 으로 이동

Screenshot 📸

2._XML_.mp4

Uncompleted Tasks 😅

  • Home 화면 MyProfile 에 회원가입 정보 전달
  • 화면 UI 디자인 미흡

To Reviewers 📢

피를 토하며 열심히 해보았습니다.. 굉장히 험난했지만 1주차 과제때에 비해 코드가 굉장히 나아지지 않았나 스스로 생각하며 위안을 얻어 봅니다..!

@SYAAINN SYAAINN requested a review from a team April 19, 2024 06:56
@SYAAINN SYAAINN self-assigned this Apr 19, 2024
@SYAAINN SYAAINN changed the title [2주차/XML] Android UI 구현 심화 [2주차/필수/XML] Android UI 구현 심화 Apr 19, 2024
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'

// ViewModel 의존성 설정
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2"

Choose a reason for hiding this comment

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

뷰모델 접수 시작 ㄷㄷ 멋있다

Copy link

@2hyunjinn 2hyunjinn left a comment

Choose a reason for hiding this comment

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

코드 깔끔하고 넘 좋은디?! 고생 많았다 라따뚜이 코딩,,

binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)

val userId = intent.getStringExtra("ID")

Choose a reason for hiding this comment

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

이 부분도 viewmodel 써서 구현해보는 건 어떤가요?!

Copy link
Member

Choose a reason for hiding this comment

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

슬슬 data class와 직렬화에 대해 공부해볼까요?

Copy link
Member

@junseo511 junseo511 left a comment

Choose a reason for hiding this comment

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

고생 많으셨습니다~~!!!! 코드가 손댈곳이 많이 줄었는데요?!

binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)

val userId = intent.getStringExtra("ID")
Copy link
Member

Choose a reason for hiding this comment

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

슬슬 data class와 직렬화에 대해 공부해볼까요?

Comment on lines +24 to +29
val currentFragment = supportFragmentManager.findFragmentById(binding.fcvMain.id)
if (currentFragment == null) {
supportFragmentManager.beginTransaction()
.add(binding.fcvMain.id, HomeFragment())
.commit()
}
Copy link
Member

Choose a reason for hiding this comment

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

함수 분리해주시면 좋을거같아요!

Comment on lines +55 to +58
putString("ID", userId)
putString("PW", userPw)
putString("Name", userName)
putString("Place", userPlace)
Copy link
Member

Choose a reason for hiding this comment

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

뷰모델을 넣었으니 그곳에서 관리해보는건 어떤가요

Comment on lines +70 to +74
private fun replaceFragment(fragment: Fragment) {
supportFragmentManager.beginTransaction()
.replace(binding.fcvMain.id, fragment)
.commit()
}
Copy link
Member

Choose a reason for hiding this comment

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

뭐야 위에랑 코드 중복되잖아요 ㅋㅋㅋㅋㅋㅋ

Comment on lines +53 to +56
intent.putExtra("ID", userId)
intent.putExtra("PW", userPw)
intent.putExtra("Name", userName)
intent.putExtra("Place", userPlace)
Copy link
Member

@junseo511 junseo511 Apr 21, 2024

Choose a reason for hiding this comment

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

묶어주시면 편안할듯 아린님 코드에 파트장님이 리뷰 남기셨네용

Comment on lines +13 to +16
val ID_MIN_LENGTH = 6
val ID_MAX_LENGTH = 10
val PW_MIN_LENGTH = 8
val PW_MAX_LENGTH = 12
Copy link
Member

Choose a reason for hiding this comment

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

const val은 어떠신가요

Comment on lines +40 to +43
override fun onDestroyView() {
super.onDestroyView()
_binding = null
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
override fun onDestroyView() {
super.onDestroyView()
_binding = null
}
override fun onDestroyView() {
_binding = null
super.onDestroyView()
}

이쪽이 안정성이 더 좋습니다!! 이유는 뭘까요?!

Copy link
Member

Choose a reason for hiding this comment

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

뭐야 민재 어댑터 왤케 잘썼어

Copy link
Member

Choose a reason for hiding this comment

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

아! 데이터 클래스가 이미 있네요 직렬화로 넘기는 방법을 배워볼까요?!

Comment on lines +38 to +41
binding.tvMyPageShowId.text = userId
binding.tvMyPageShowPw.text = userPw
binding.tvMyPageShowName.text = userName
binding.tvMyPageShowPlace.text = userPlace
Copy link
Member

Choose a reason for hiding this comment

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

with(binding)

<item
android:id="@+id/menu_home"
android:icon="@drawable/ic_home_white_24"
android:title="홈" />
Copy link
Member

Choose a reason for hiding this comment

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

여기두 string 써주시면 굿굿~~~

Comment on lines +64 to +67
companion object {
const val TYPE_MY_PROFILE = 0
const val TYPE_FRIEND_PROFILE = 1
}
Copy link
Member

Choose a reason for hiding this comment

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

이렇게 상수화 하다니 한 수 배웁니다

}

override fun getItemCount(): Int {
return friendList.size + 1
Copy link
Member

Choose a reason for hiding this comment

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

여기 +1 해서 어디에 나타나나욤?

}

override fun getItemViewType(position: Int): Int {
return if (position == 0) TYPE_MY_PROFILE else TYPE_FRIEND_PROFILE
Copy link
Member

Choose a reason for hiding this comment

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

이렇게 구분하는 함수를 만들 수도 있겠네여

Comment on lines +37 to +42
is MyProfileViewHolder -> {
holder.onBind(myProfile)
}

is FriendViewHolder -> {
holder.onBind(friendList[position - 1])
Copy link
Member

Choose a reason for hiding this comment

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

너무 깔끔해요!!!!

Copy link

@yeonjeen yeonjeen left a comment

Choose a reason for hiding this comment

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

너무 수고하셨습니다~ 엄청 많이 고민하고 공부하신게 느껴졌어용! 많이 배우고 갑니당


binding.btnSignInSignUp.setOnClickListener {
val intent = Intent(this, SignUpActivity::class.java)
startActivity(intent)

Choose a reason for hiding this comment

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

클릭리스너도 함수화 해주는 건 어떨까요?


private fun showToast(message: String) {
Toast.makeText(this, message, Toast.LENGTH_SHORT).show()
}

Choose a reason for hiding this comment

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

토스트 부분도 함수로 만들어주는 거 좋은 것 같아용!!

navigateToSignInActivity()
}
}
}

Choose a reason for hiding this comment

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

안드를 이제 시작했는데 when 이리 잘 쓰다니... 이 부분은 말 그대로 검증하는 부분이니까 뷰모델로 빼도 괜찮을 것 같아용!! 비즈니스 로직만 한 번 분리해보셔요~

name = "Charles Barkley",
place = "USA, Philadelphia",
selfDescription = "CHUCK CHUCK"
)

Choose a reason for hiding this comment

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

코리조 없는 거 서운이슈...

app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"

Choose a reason for hiding this comment

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

width가 match이니까 start랑 end 값은 주지 않아도 괜찮아요! 우리의 소중한 리소스를 절약해봐요 ㅎㅎ

@SYAAINN SYAAINN merged commit 074747a into develope-xml Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants