-
Notifications
You must be signed in to change notification settings - Fork 1
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
[init] Jetpack Navigation 세팅 #10
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DummyActivity는 일단 그대로 두는 걸로 합시당 서버통신 할 때 서버통신 관련 더미 파일이 필요할 것 같아서요 ~ 마지막 날 뷰 연결 작업 하면서 지우는 걸로 합시다 ~
고생하셨습니다 ~
app/build.gradle.kts
Outdated
// Jetpack Navigation | ||
implementation(libs.androidx.navigation.fragment) | ||
implementation(libs.androidx.navigation.ui) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
androidx 번들에 넣어서 미리 추가해두었어요! 제거해주셔도 됩니다 ~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아하아하!! 이해했어요!!! 요건 제거하겠습니다~!
app/src/main/AndroidManifest.xml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
패키지 구조 잘 짜셨는데요??
근데 조금 더 확장성을 고려해보시면 좋을 것 같아요! 지금은 구현하는 뷰가 4개지만, 크림 내부의 모든 화면을 구현한다고 생각하면 지금 main 화면 내에 바텀 네비가 있어서 home, style, shop, saved, my의 5개의 프래그먼트로 전환이 가능하고, home 프래그먼트 내부에서도 탭 레이아웃이 있어서 추천, 랭킹, 발매정도 등으로 전환이 가능한 구조잖아요! 그래서 저라면 main 내에 home 패키지를 하나 더 만들고 그 내부에 recommend와 release 패키지를 위치 시킬 것 같아요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오호 그렇네요!! 그럼 home 패키지 하나 더 추가하겠습니다!! 감사해요😊
import androidx.appcompat.app.AppCompatActivity | ||
import org.sopt.kream.databinding.ActivityMainBinding | ||
|
||
class MainActivity : AppCompatActivity() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Util에 Binding Activity와 BindingFragment 등을 만들어두었으니 적용해주시면 좋을 것 같습니다 ~~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
사용 방법은 제 과제 레포 보시면 좋을 것 같아요 ~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
와우,,,, 이거 진짜 신세계네요,, 진짜 최고다,,,,⭐
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
요기 패키지 productdetail로 수정 부탁드려용 (패키지 이름은 전부 소문자로!!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아하 감사합니다!!
@Composable | ||
fun releaseScreen() { | ||
Text(text = "Release") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
와 이 뷰는 컴포즈로 짠다고 해서 이렇게 넣어준 건가요? 센스 미쳤따
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
바텀 네비게이션은 다른 PR에서 구현하실 예정이신가용? 이 피알에서 같이 해도 좋을 것 같은데!
바텀 네비게이션은 메인에 구현을 해두고 fcv에 띄워주는 fragment에 따라 visibility를 조절해주면 됩니다 ~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
따로 해야 하는줄 알고 안했는데..!! 여기다가 바로 할게용😊 바텀 네비게이션 어떻게 해야하나 고민했는데 visibility로 조절하면 되는군요!!! 감사합니다ㅎㅎㅎ
android:label="fragment_recommend" | ||
tools:layout="@layout/fragment_recommend"> | ||
<action | ||
android:id="@+id/action_recommendFragment_to_productDetailFragment" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
android:id="@+id/action_recommendFragment_to_productDetailFragment" | |
android:id="@+id/action_recommend_fragment_to_product_detail_fragment" |
이런 식으로 네이밍 형태를 유지해주시는 게 좋을 것 같아요 ~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오호 수정하겠습니다~!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tablayout으로 이동되는 부분은 연결을 안 해도 될 것 같은데! 사실 저도 jetpackNavi를 사용해본 적이 거의 없어서 확실하지 않네요 ㅜㅜ 하면서 수정해보면 좋을 것 같아요 ㅜ
그리고 액션이 생각보다 많아서 고민해보니까 main에서 바텀 네비를 비지빌리티를 통해 조절하는 것처럼 상단 검색 + 탭도 비지빌리티를 통해 조절하는 것도 좋아 보입니다 여러 뷰에 공통되는 부분이기도 하고 실제 앱을 보니까 하단 바텀 네비가 바뀌더라도 위에 검색 + 탭이 있는 형식은 유지가 되더라고요~ 공통 컴포넌트 구현하실 때 이 부분 생각해보시고 구현하시면 더 효율적이게 뷰를 짤 수 있을 것 같아요 ~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저도 action이 너무 많아서 고민했었는데ㅜㅜ 연결 없이 해보고 성공하면 수정하도록 하겠습니다!! 공통 컴포넌트도 visibility 사용하는건 생각 못했었는데!! 좋은 방법인 것 같아요 조언 감사합니다❤️❤️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SAA 설정 처음이라 쉽지 않으셨을텐데 정말 잘 하셨네요!
네이밍만 조금 수정 부탁드릴게요 ㅜㅜ
val navHostFragment = supportFragmentManager.findFragmentById(R.id.fcv_main) as NavHostFragment | ||
navController = navHostFragment.findNavController() | ||
|
||
navController.addOnDestinationChangedListener { _, destination, _ -> | ||
if (destination.id == R.id.recommend_fragment || destination.id == R.id.release_fragment) { | ||
binding.bnvMain.visibility = View.VISIBLE | ||
} else if (destination.id == R.id.search_fragment || destination.id == R.id.product_detail_fragment) { | ||
binding.bnvMain.visibility = View.GONE | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onCreate 내부에는 함수만 들어가는 것이 좋습니다 적절하게 함수화 해보시면 좋을 것 같아요 ~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아하 전부 다 함수로 빼야하는군요!! 수정하겠습니다!!
import org.sopt.kream.util.base.BindingActivity | ||
|
||
class MainActivity : BindingActivity<ActivityMainBinding>({ ActivityMainBinding.inflate(it) }) { | ||
private lateinit var navController: NavController |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
전역으로 설정할 필요가 없을 것 같아요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
흠 그러네요..😅 감사합니다!!
navController = navHostFragment.findNavController() | ||
|
||
navController.addOnDestinationChangedListener { _, destination, _ -> | ||
if (destination.id == R.id.recommend_fragment || destination.id == R.id.release_fragment) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
list를 만들고 in을 사용해 검사를 해봐도 좋을 것 같네요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이거 안그래도 더 좋은 방법이 없을까 고민했었는데...!! 감사합니다❤️❤️
navController.addOnDestinationChangedListener { _, destination, _ -> | ||
if (destination.id == R.id.recommend_fragment || destination.id == R.id.release_fragment) { | ||
binding.bnvMain.visibility = View.VISIBLE | ||
} else if (destination.id == R.id.search_fragment || destination.id == R.id.product_detail_fragment) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
그냥 else 해주셔도 됩니당
binding.btnToProductDetail.setOnClickListener { | ||
findNavController().navigate(R.id.release_fragment) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
여기도 다 함수화 해주세요
android:id="@+id/bnv_main" | ||
android:layout_width="0dp" | ||
android:layout_height="55dp" | ||
android:background="@drawable/shape_gray06_border_1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bnv의 전체에 테두리가 있는 게 아니라 상단에만 구분선이 있는 형태니까 background보다는 view를 사용하는 것이 적절할 것 같습니다 ~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵~!! view로 수정하겠습니다!!
app:itemPaddingTop="9dp" | ||
app:itemTextAppearanceActive="@style/TextAppearance.Kream.Body8.SemiBold" | ||
app:itemTextAppearanceInactive="@style/TextAppearance.Kream.Body8.SemiBold" | ||
app:itemTextColor="@drawable/selector_bnv_label" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
color 관련 selector는 res내부에 color 패키지 만들어서 거기에 넣어주세요
그리고 selector 네이밍은 selector_어느뷰에서 사용되는지_어떤 selector인지를 따릅니당
여기서는 selector_main_bnv_item_text_color 정도가 되겠네요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
우왕 감사합니다!!!!
|
||
<com.google.android.material.bottomnavigation.BottomNavigationView | ||
android:id="@+id/bnv_main" | ||
android:layout_width="0dp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0dp 사용 좋네요 ~
…ty-architecture # Conflicts: # app/src/main/java/org/sopt/kream/presentation/ui/dummy/DummyActivity.kt # app/src/main/java/org/sopt/kream/presentation/ui/dummy/View1Screen.kt # app/src/main/java/org/sopt/kream/theme/Type.kt # app/src/main/res/values/strings.xml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
머지하세용 ~
Related issue 🛠
Work Description ✏️
Screenshot 📸
Uncompleted Tasks 😅
To Reviewers 📢