Skip to content

Commit

Permalink
[ADD/#11] TabLayout 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
Marchbreeze committed Jan 3, 2024
1 parent dca38fc commit f627f90
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import androidx.core.content.ContextCompat
import androidx.fragment.app.activityViewModels
import com.going.presentation.R
import com.going.presentation.databinding.FragmentOurTodoBinding
import com.going.presentation.mock.MockAdapter
import com.going.ui.base.BaseFragment
import dagger.hilt.android.AndroidEntryPoint

Expand All @@ -28,6 +27,7 @@ class OurTodoFragment() : BaseFragment<FragmentOurTodoBinding>(R.layout.fragment
initAdapter()
setDateTextColor()
setProgressBarStatus()
setTabLayout()
}

private fun initAdapter() {
Expand All @@ -54,9 +54,24 @@ class OurTodoFragment() : BaseFragment<FragmentOurTodoBinding>(R.layout.fragment
binding.progressBarOurTodo.progress = 40
}

private fun setTabLayout() {
binding.tabOurTodo.apply {
for (tabName in listOf(TAB_UNCOMPLETE, TAB_COMPLETE)) {
val tab = this.newTab()
tab.text = tabName
this.addTab(tab)
}
}
}

override fun onDestroyView() {
super.onDestroyView()
_adapter = null
}

companion object {
const val TAB_UNCOMPLETE = "미완료 todo"
const val TAB_COMPLETE = "완료 todo"
}

}
4 changes: 2 additions & 2 deletions presentation/src/main/res/layout/fragment_our_todo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@
app:layout_constraintStart_toEndOf="@id/tv_our_trip_friend_title"
app:layout_constraintTop_toTopOf="@id/tv_our_trip_friend_title"
app:layout_constraintBottom_toBottomOf="@id/tv_our_trip_friend_title"
android:src="@drawable/ic_enter"
android:src="@drawable/ic_enter"/>

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_our_trip_friend"
Expand Down Expand Up @@ -291,7 +291,7 @@
<com.google.android.material.tabs.TabLayout
android:id="@+id/tab_our_todo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="50dp"
android:layout_marginHorizontal="16dp"
app:tabIndicatorFullWidth="true"
app:tabRippleColor="@android:color/transparent"
Expand Down

0 comments on commit f627f90

Please sign in to comment.