Skip to content

Commit

Permalink
Merge pull request #107 from Team-Sopetit/feature/#104-fix-bottomshee…
Browse files Browse the repository at this point in the history
…t-issue

#104 [fix] 바텀시트 이슈 해결
  • Loading branch information
emjayMJkim authored Jan 18, 2024
2 parents 6012071 + dba2394 commit 643853e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import androidx.viewpager2.widget.MarginPageTransformer
import androidx.viewpager2.widget.ViewPager2
import com.sopetit.softie.R
import com.sopetit.softie.databinding.ActivityDailyRoutineAddBinding
import com.sopetit.softie.domain.entity.Routine
import com.sopetit.softie.domain.entity.Theme
import com.sopetit.softie.ui.main.MainActivity
import com.sopetit.softie.util.OriginalBottomSheet
Expand All @@ -37,7 +38,6 @@ class DailyRoutineAddActivity :

dailyRoutineAddViewModel.getThemeList()
dailyRoutineAddViewModel.setThemeId(6)
initSetDailyRoutineAdd()
setupAdapter()
setViewPager()
setupList()
Expand Down Expand Up @@ -85,6 +85,8 @@ class DailyRoutineAddActivity :
dailyRoutineAddCardPagerAdapter.submitList(
dailyRoutineAddViewModel.dailyRoutineCardThemeList.value?.routine
)

initSetDailyRoutineAdd()
}
}

Expand Down Expand Up @@ -170,6 +172,13 @@ class DailyRoutineAddActivity :
})
}

private fun getCurrentSelectedRoutine(): Routine {
val currentItem = binding.vpDailyRoutineAddCard.currentItem
val itemId = dailyRoutineAddCardPagerAdapter.getItemId(currentItem)
val itemContent = dailyRoutineAddCardPagerAdapter.content
return Routine(itemId.toInt(), itemContent)
}

private fun getCurrentSelectedRoutineId(): Int {
val currentItem = binding.vpDailyRoutineAddCard.currentItem
val itemId = dailyRoutineAddCardPagerAdapter.getItemId(currentItem)
Expand All @@ -181,9 +190,9 @@ class DailyRoutineAddActivity :
BindingBottomSheet.Builder().build(
isDrawable = false,
imageDrawable = 0,
imageUri = "https://www.urbanbrush.net/web/wp-content/uploads/edd/2022/12/urbanbrush-20221214144619159434.jpg",
imageUri = dailyRoutineAddThemeAdapter.clickedThemeIcon,
title = getString(R.string.daily_routine_add_question),
content = getString(R.string.daily_routine_content),
content = getCurrentSelectedRoutine().content,
isContentVisible = true,
contentColor = R.color.gray400,
backBtnContent = getString(R.string.daily_routine_add_no),
Expand All @@ -193,6 +202,7 @@ class DailyRoutineAddActivity :
doBtnAction = {
tossMsg()
dailyRoutineAddViewModel.postAddDailyRoutine()
dailyRoutineAddViewModel.getDailyRoutine()
}
).show(supportFragmentManager, OriginalBottomSheet.BOTTOM_SHEET_TAG)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class DailyRoutineAddCardPagerAdapter :
)
) {
lateinit var background: String
lateinit var content: String
fun updateBackground(backgroundImg: String) {
background = backgroundImg
}
Expand All @@ -38,6 +39,7 @@ class DailyRoutineAddCardPagerAdapter :
override fun getItemId(position: Int): Long {
val itemCount = currentList.size
return if (position in 0 until itemCount) {
content = currentList[position].content
currentList[position].routineId.toLong()
} else {
RecyclerView.NO_ID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class DailyRoutineAddThemeAdapter :
private var onItemClickListener: OnItemClickListener? = null
private var selectedPosition = 0
var clickedThemeId: Int = 1
lateinit var clickedThemeIcon: String

interface OnItemClickListener {
fun onItemClick(item: Theme, position: Int)
Expand Down Expand Up @@ -55,6 +56,7 @@ class DailyRoutineAddThemeAdapter :
selectedPosition = absoluteAdapterPosition
}
clickedThemeId = data.themeId
clickedThemeIcon = data.iconImageUrl
}
}
}
Expand Down

0 comments on commit 643853e

Please sign in to comment.