-
Notifications
You must be signed in to change notification settings - Fork 5
5.7. ๋ชฉํ
Seulgi Kim edited this page Jan 15, 2021
·
2 revisions
(1) RecyclerView
๋ฅผ ํตํด ๋ชฉํ ๋ฐ์ดํฐ Display
(2) DailyFragment๋ก๋ถํฐ Intent Action์ ์ ๋ฌ๋ฐ์ ์์ ์ธ์ง ์ฒ์์์ฑ์ธ์ง ์ฒ๋ฆฌ
- fragment_goal.xml
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_goal"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginVertical="32dp"
android:paddingHorizontal="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_goal_num_alert"
tools:listitem="@layout/item_keyword_goal"
tools:itemCount="4"/>
- DailyFragment.kt
private fun startGoalDetailActivityWithAction(action: String, goal: Goal) {
val intent: Intent = Intent(requireActivity(), GoalDetailActivity::class.java).apply {
this.action = action
putExtra("keyword", goal.keyword)
putExtra("goal", goal.goal)
}
startActivity(intent)
}
- DailyGoalActivity.kt
private fun getIntentData() {
intentAction = intent.action
intentKeyword = intent.getStringExtra("keyword")
intentGoal = intent.getStringExtra("goal")
}
private fun initViewByAction() {
when (intentAction) {
"ADD" -> stateAdd()
"MODIFY" -> stateModify()
}
}
/* ๋ชฉํ ์ค์ */
private fun stateAdd() {
...
}
/* ๋ชฉํ ์์ */
private fun stateModify() {
...
}