diff --git a/app/src/main/java/com/hous/hous_aos/ui/rules/HomeRulesCategoryAdapter.kt b/app/src/main/java/com/hous/hous_aos/ui/rules/HomeRulesCategoryAdapter.kt index 0d40198e..bbd5d91b 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/rules/HomeRulesCategoryAdapter.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/rules/HomeRulesCategoryAdapter.kt @@ -6,7 +6,7 @@ import androidx.annotation.DrawableRes import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.ListAdapter import androidx.recyclerview.widget.RecyclerView -import com.hous.data.entity.Category +import com.hous.domain.model.CategoryInfo import com.hous.hous_aos.R import com.hous.hous_aos.databinding.ItemRulesRuleBinding @@ -16,7 +16,7 @@ class HomeRulesCategoryAdapter( private val onPlusClick: () -> Unit, private val onChangeIsSelected: (Int) -> Unit ) : - ListAdapter( + ListAdapter( CategoryOfRuleDiffUtilCallback ) { private val iconTypeHashMap: HashMap = hashMapOf( @@ -79,7 +79,7 @@ class HomeRulesCategoryAdapter( private val binding: ItemRulesRuleBinding ) : RecyclerView.ViewHolder(binding.root) { - fun onBind(data: com.hous.data.entity.Category) { + fun onBind(data: CategoryInfo) { binding.data = data binding.iconType = iconTypeHashMap[data.categoryIcon] /** 앱잼 내에서는 비활성화*/ @@ -100,7 +100,7 @@ class HomeRulesCategoryAdapter( private val binding: ItemRulesRuleBinding ) : RecyclerView.ViewHolder(binding.root) { - fun onBind(data: com.hous.data.entity.Category) { + fun onBind(data: CategoryInfo) { binding.data = data binding.iconType = CategoryIconType.NONE /** 앱잼 내에서는 비활성화*/ @@ -112,17 +112,17 @@ class HomeRulesCategoryAdapter( companion object { private val CategoryOfRuleDiffUtilCallback = - object : DiffUtil.ItemCallback() { + object : DiffUtil.ItemCallback() { override fun areItemsTheSame( - oldItem: com.hous.data.entity.Category, - newItem: com.hous.data.entity.Category + oldItem: CategoryInfo, + newItem: CategoryInfo ): Boolean { return oldItem.id == newItem.id } override fun areContentsTheSame( - oldItem: com.hous.data.entity.Category, - newItem: com.hous.data.entity.Category + oldItem: CategoryInfo, + newItem: CategoryInfo ): Boolean { return oldItem == newItem } diff --git a/app/src/main/java/com/hous/hous_aos/ui/rules/RulesFragment.kt b/app/src/main/java/com/hous/hous_aos/ui/rules/RulesFragment.kt index 6d489934..60ca43df 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/rules/RulesFragment.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/rules/RulesFragment.kt @@ -10,6 +10,7 @@ import androidx.fragment.app.Fragment import androidx.fragment.app.activityViewModels import androidx.fragment.app.commit import androidx.fragment.app.replace +import com.hous.hous_aos.BuildConfig import com.hous.hous_aos.R import com.hous.hous_aos.databinding.FragmentRulesBinding import com.hous.hous_aos.ui.rules.my_to_do.MyToDoFragment @@ -37,7 +38,6 @@ class RulesFragment : Fragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - initTransaction() initAdapter() observeCategory() diff --git a/app/src/main/java/com/hous/hous_aos/ui/rules/RulesViewModel.kt b/app/src/main/java/com/hous/hous_aos/ui/rules/RulesViewModel.kt index a81fedd2..0f716d4d 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/rules/RulesViewModel.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/rules/RulesViewModel.kt @@ -1,18 +1,19 @@ package com.hous.hous_aos.ui.rules -import android.util.Log import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.hous.data.entity.Category -import com.hous.data.entity.Homie -import com.hous.data.entity.Rule -import com.hous.data.model.response.TempManagerRequest import com.hous.data.repository.RulesTodayRepository +import com.hous.domain.model.CategoryInfo +import com.hous.domain.model.HomieInfo +import com.hous.domain.model.RuleInfo +import com.hous.domain.model.TempManagerInfo +import com.hous.domain.model.rules.RulesTodayInfo import dagger.hilt.android.lifecycle.HiltViewModel -import javax.inject.Inject import kotlinx.coroutines.launch +import timber.log.Timber +import javax.inject.Inject @HiltViewModel class RulesViewModel @Inject constructor( @@ -25,26 +26,26 @@ class RulesViewModel @Inject constructor( val isSelectedCategorySmile: LiveData get() = _isSelectedCategorySmile private var _categoryOfRuleList = - MutableLiveData>() + MutableLiveData>() val categoryOfRuleList get() = _categoryOfRuleList private var _todayTodoList = - MutableLiveData>() + MutableLiveData>() val todayTodoList get() = _todayTodoList private var _myTodoList = - MutableLiveData>() + MutableLiveData>() val myTodoList get() = _myTodoList private var _keyRulesTableList = - MutableLiveData>() + MutableLiveData>() val keyRulesTableList get() = _keyRulesTableList private var _generalRulesTableList = - MutableLiveData>() + MutableLiveData>() val generalRulesTableList get() = _generalRulesTableList - private var _tmpManagerList = MutableLiveData>() + private var _tmpManagerList = MutableLiveData>() val tmpManagerList get() = _tmpManagerList private var _tmpTodayToDoPosition = MutableLiveData(0) @@ -61,25 +62,18 @@ class RulesViewModel @Inject constructor( init { viewModelScope.launch { - rulesTodayRepository.getTodayTodayInfoList("") - .onSuccess { - _todayTodoList.value = it.data!!.todayTodoRules - _categoryOfRuleList.value = it.data!!.homeRuleCategories - _categoryOfRuleList.value = (_categoryOfRuleList.value!!).plus( - Category( - id = "62d6b94e0e9be86f165d48db", - categoryName = "없음", - categoryIcon = "CLEAN" - ) + val rulesTodayInfo: RulesTodayInfo? = rulesTodayRepository.getTodayTodayInfoList("") + rulesTodayInfo?.let { + Timber.d("RulesViewModel init") + _todayTodoList.value = it.todayTodoRules + _categoryOfRuleList.value = it.homeRuleCategories.plus( + CategoryInfo( + id = "62d6b94e0e9be86f165d48db", + categoryName = "없음", + categoryIcon = "CLEAN" ) - Log.d( - TAG, - "통신 시작 -- ${_todayTodoList?.value}" - ) - } - .onFailure { - Log.d(TAG, "RulesViewModel - init - getRulesTodayList fail : ${it.message}") - } + ) + } } } @@ -92,24 +86,13 @@ class RulesViewModel @Inject constructor( _tmpManagerList.value?.forEach { if (it.isChecked) clickedTmpManagerList.add(it.id!!) } - val tmp = TempManagerRequest(clickedTmpManagerList) - Log.d( - TAG, - "Put -- tmp.tmpRuleMembers: ${tmp.tmpRuleMembers} tmp.size : ${tmp.tmpRuleMembers.size}" - ) + viewModelScope.launch { rulesTodayRepository.putTempManagerInfoList( "", _todayTodoList.value!![tmpTodayToDoPosition.value!!].id, - tmp - ) - .onSuccess { - fetchToTodayToDoList() - } - .onFailure { - Log.d(TAG, " result fail : $tmp") - Log.d(TAG, " result fail : ${it.message}") - } + clickedTmpManagerList + )?.let { fetchToTodayToDoList() } } } @@ -124,54 +107,32 @@ class RulesViewModel @Inject constructor( /** get * 임시 담당자 다이얼로그 조회 */ fun fetchToTmpManagerList(position: Int) { - Log.d( - TAG, - "RulesViewModel - fetchToTmpManagerList() _todayTodoList.value!![position].id: ${_todayTodoList.value!![position].id}" - ) viewModelScope.launch { - rulesTodayRepository.getTempManagerInfoList("", _todayTodoList.value!![position].id) - .onSuccess { - _tmpManagerList.value = it.data!!.homies - _tmpTodayToDoPosition.postValue(position) - } - .onFailure { - Log.d(TAG, "RulesViewModel - fetchToTmpManagerList() - ${it.message}") - } + val tempManagerInfo: TempManagerInfo? = + rulesTodayRepository.getTempManagerInfoList("", _todayTodoList.value!![position].id) + tempManagerInfo?.let { + _tmpManagerList.value = it.homies + _tmpTodayToDoPosition.value = position + } + } } - fun fetchToTodayToDoList() { + fun fetchToTodayToDoList() = viewModelScope.launch { - rulesTodayRepository.getTodayTodayInfoList("") - .onSuccess { - _todayTodoList.value = it.data!!.todayTodoRules -// Log.d( -// TAG, -// "다시서버통신 -- Size: ${_todayTodoList?.value!![0].todayMembersWithTypeColor.size}" -// ) - } - .onFailure { - Log.d( - TAG, - "RulesViewModel - init - getRulesTodayList fail : ${it.message}" - ) - } + rulesTodayRepository.getTodayTodayInfoList("")?.let { + _todayTodoList.value = it.todayTodoRules + } } - } + /** get * My -To - DO 서버통신*/ fun fetchToMyTodayToDoList() { viewModelScope.launch { - rulesTodayRepository.getMyTodoInfoList("") - .onSuccess { - _myTodoList.value = it.data!! - Log.d(TAG, "RulesViewModel - fetchToMyTodayToDoList() called") - Log.d("MYTODO", "Success ") - } - .onFailure { - Log.d(TAG, "fail : ${it.message}") - } + rulesTodayRepository.getMyTodoInfoList("")?.let { + _myTodoList.value = it + } } } @@ -187,17 +148,8 @@ class RulesViewModel @Inject constructor( rulesTodayRepository.putMyToDoCheckLust( "", id, - com.hous.data.model.request.MyToDoCheckRequest(checked) + checked ) - .onSuccess { - Log.d(TAG, "Success - id: $id, checked: $checked ") - } - .onFailure { - Log.d( - TAG, - "fail - $id, checked: $checked - :${it.message}" - ) - } } } @@ -208,33 +160,17 @@ class RulesViewModel @Inject constructor( val categoryId = categoryOfRuleList.value!![position].id _categoryName.value = categoryOfRuleList.value!![position].categoryName _categoryId.value = categoryOfRuleList.value!![position].id - Log.d("RulesViewModel", "categoryId: $categoryId") viewModelScope.launch { - rulesTodayRepository.getRuleTableInfoList("", categoryId) - .onSuccess { - Log.d("RulesViewModel", "Success - RulesTableList() ${it.message}") - val data = it.data - Log.d("RulesViewModel", "Success- data: $data") - val tmpGeneralRulesTableList = data!!.rules - val tmpKeyRulesTableList = data.keyRules - val totalRulesDataSize = - tmpGeneralRulesTableList.size + tmpKeyRulesTableList.size - - _ruleTableSize.value = totalRulesDataSize - _generalRulesTableList.value = tmpGeneralRulesTableList - _keyRulesTableList.value = tmpKeyRulesTableList - Log.d( - "RulesViewModel", - "Success -keyRulesTableList: ${generalRulesTableList.value}" - ) - Log.d( - "RulesViewModel", - "Success -tmpGeneralRulesTableList: ${keyRulesTableList.value}" - ) - } - .onFailure { - Log.d("RulesViewModel", "Fail - RulesTableList() ${it.message}") - } + rulesTodayRepository.getRuleTableInfoList("", categoryId)?.let { + val tmpGeneralRulesTableList = it.rules + val tmpKeyRulesTableList = it.keyRules + val totalRulesDataSize = + tmpGeneralRulesTableList.size + tmpKeyRulesTableList.size + + _ruleTableSize.value = totalRulesDataSize + _generalRulesTableList.value = tmpGeneralRulesTableList + _keyRulesTableList.value = tmpKeyRulesTableList + } } } @@ -269,7 +205,4 @@ class RulesViewModel @Inject constructor( _categoryOfRuleList.value = tmpCategoryOfRuleList.toList() } - companion object { - private const val TAG = "RulesViewModel" - } } diff --git a/app/src/main/java/com/hous/hous_aos/ui/rules/my_to_do/MyToDoAdapter.kt b/app/src/main/java/com/hous/hous_aos/ui/rules/my_to_do/MyToDoAdapter.kt index 4b0ad9be..17e7c127 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/rules/my_to_do/MyToDoAdapter.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/rules/my_to_do/MyToDoAdapter.kt @@ -5,11 +5,11 @@ import android.view.ViewGroup import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.ListAdapter import androidx.recyclerview.widget.RecyclerView -import com.hous.data.entity.Rule +import com.hous.domain.model.RuleInfo import com.hous.hous_aos.databinding.ItemRulesMyToDoBinding class MyToDoAdapter(private val onClickIcon: (Int) -> Unit) : - ListAdapter( + ListAdapter( MyTodoDiffUtilCallback ) { private val iconTypeHashMap: HashMap = hashMapOf( @@ -28,7 +28,7 @@ class MyToDoAdapter(private val onClickIcon: (Int) -> Unit) : private val iconTypeHashMap: HashMap, private val onClickIcon: (Int) -> Unit ) : RecyclerView.ViewHolder(binding.root) { - fun onBind(data: Rule) { + fun onBind(data: RuleInfo) { binding.data = data binding.iconType = iconTypeHashMap[data.categoryIcon] binding.clMyToDo.setOnClickListener { @@ -55,18 +55,18 @@ class MyToDoAdapter(private val onClickIcon: (Int) -> Unit) : companion object { private val MyTodoDiffUtilCallback = - object : DiffUtil.ItemCallback() { + object : DiffUtil.ItemCallback() { override fun areItemsTheSame( - oldItem: Rule, - newItem: Rule + oldItem: RuleInfo, + newItem: RuleInfo ): Boolean { return oldItem.id == newItem.id } override fun areContentsTheSame( - oldItem: Rule, - newItem: Rule + oldItem: RuleInfo, + newItem: RuleInfo ): Boolean { return oldItem == newItem } diff --git a/app/src/main/java/com/hous/hous_aos/ui/rules/rules_table/GeneralRulesAdapter.kt b/app/src/main/java/com/hous/hous_aos/ui/rules/rules_table/GeneralRulesAdapter.kt index 74714ca9..8bdfbbb7 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/rules/rules_table/GeneralRulesAdapter.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/rules/rules_table/GeneralRulesAdapter.kt @@ -1,17 +1,17 @@ package com.hous.hous_aos.ui.rules.rules_table -import android.util.Log import android.view.LayoutInflater import android.view.ViewGroup import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.ListAdapter import androidx.recyclerview.widget.RecyclerView -import com.hous.data.entity.Rule +import com.hous.domain.model.RuleInfo import com.hous.hous_aos.databinding.ItemRulesTableGeneralBinding import com.hous.hous_aos.ui.rules.IconColor +import timber.log.Timber class GeneralRulesAdapter : - ListAdapter(generalRulesDiffUtil) { + ListAdapter(generalRulesDiffUtil) { private val iconColorHashMap: HashMap = hashMapOf( "RED" to IconColor.RED, @@ -30,8 +30,8 @@ class GeneralRulesAdapter : override fun onBindViewHolder(holder: GeneralRulesViewHolder, position: Int) { val currentItem = currentList[position] - Log.d("크기", "$currentList") - Log.d("크기", "${currentList.size}") + Timber.d("크기", "$currentList") + Timber.d("크기", "${currentList.size}") holder.onBind(currentItem) } @@ -40,11 +40,10 @@ class GeneralRulesAdapter : private val iconColorHashMap: HashMap ) : RecyclerView.ViewHolder(binding.root) { - fun onBind(data: Rule) { + fun onBind(data: RuleInfo) { binding.data = data val memberCnt = if (data.membersCnt >= 4) 3 else data.membersCnt - Log.d( - "GeneralAdapter", + Timber.d( "memberCnt:$memberCnt , data.iconList.size 값 : ${data.typeColors.size} ,data.iconList: ${data.typeColors} 이 들어왔습니다." ) when (memberCnt) { @@ -73,17 +72,17 @@ class GeneralRulesAdapter : } companion object { - private val generalRulesDiffUtil = object : DiffUtil.ItemCallback() { + private val generalRulesDiffUtil = object : DiffUtil.ItemCallback() { override fun areItemsTheSame( - oldItem: Rule, - newItem: Rule + oldItem: RuleInfo, + newItem: RuleInfo ): Boolean { return oldItem.id == newItem.id } override fun areContentsTheSame( - oldItem: Rule, - newItem: Rule + oldItem: RuleInfo, + newItem: RuleInfo ): Boolean { return oldItem == newItem } diff --git a/app/src/main/java/com/hous/hous_aos/ui/rules/rules_table/KeyRulesAdapter.kt b/app/src/main/java/com/hous/hous_aos/ui/rules/rules_table/KeyRulesAdapter.kt index a8a80a6b..5a0b3954 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/rules/rules_table/KeyRulesAdapter.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/rules/rules_table/KeyRulesAdapter.kt @@ -5,11 +5,11 @@ import android.view.ViewGroup import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.ListAdapter import androidx.recyclerview.widget.RecyclerView -import com.hous.data.entity.Rule +import com.hous.domain.model.RuleInfo import com.hous.hous_aos.databinding.ItemRulesTableKeysBinding class KeyRulesAdapter : - ListAdapter(rulesTableDiffUtil) { + ListAdapter(rulesTableDiffUtil) { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): KeyRulesViewHolder { val binding = @@ -24,18 +24,18 @@ class KeyRulesAdapter : class KeyRulesViewHolder(private val binding: ItemRulesTableKeysBinding) : RecyclerView.ViewHolder(binding.root) { - fun onBind(data: Rule) { + fun onBind(data: RuleInfo) { binding.data = data } } companion object { - private val rulesTableDiffUtil = object : DiffUtil.ItemCallback() { - override fun areItemsTheSame(oldItem: Rule, newItem: Rule): Boolean { + private val rulesTableDiffUtil = object : DiffUtil.ItemCallback() { + override fun areItemsTheSame(oldItem: RuleInfo, newItem: RuleInfo): Boolean { return oldItem.id == newItem.id } - override fun areContentsTheSame(oldItem: Rule, newItem: Rule): Boolean { + override fun areContentsTheSame(oldItem: RuleInfo, newItem: RuleInfo): Boolean { return oldItem == newItem } } diff --git a/app/src/main/java/com/hous/hous_aos/ui/rules/rules_table/RulesTableFragment.kt b/app/src/main/java/com/hous/hous_aos/ui/rules/rules_table/RulesTableFragment.kt index 11fff3b6..d129a49d 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/rules/rules_table/RulesTableFragment.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/rules/rules_table/RulesTableFragment.kt @@ -5,7 +5,6 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import androidx.compose.runtime.snapshots.Snapshot.Companion.observe import androidx.databinding.DataBindingUtil import androidx.fragment.app.Fragment import androidx.fragment.app.activityViewModels @@ -27,7 +26,7 @@ class RulesTableFragment : Fragment() { inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? - ): View? { + ): View { _binding = DataBindingUtil.inflate(inflater, R.layout.fragment_rules_table, container, false) binding.viewModel = viewModel diff --git a/app/src/main/java/com/hous/hous_aos/ui/rules/today_to_do/TodayToDoFragment.kt b/app/src/main/java/com/hous/hous_aos/ui/rules/today_to_do/TodayToDoFragment.kt index 18385389..1bc6cfa9 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/rules/today_to_do/TodayToDoFragment.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/rules/today_to_do/TodayToDoFragment.kt @@ -13,7 +13,6 @@ import com.hous.hous_aos.R import com.hous.hous_aos.databinding.FragmentTodayToDoBinding import com.hous.hous_aos.ui.rules.RulesViewModel import com.hous.hous_aos.ui.rules.ToDoViewType -import com.hous.hous_aos.ui.rules.adapter.TodayTodoAdapter import com.hous.hous_aos.ui.rules.my_to_do.MyToDoFragment import com.hous.hous_aos.ui.rules.today_to_do.tem_dialog.TempManagerDialogFragment import dagger.hilt.android.AndroidEntryPoint diff --git a/app/src/main/java/com/hous/hous_aos/ui/rules/today_to_do/TodayTodoAdapter.kt b/app/src/main/java/com/hous/hous_aos/ui/rules/today_to_do/TodayTodoAdapter.kt index e3d46fd6..45813100 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/rules/today_to_do/TodayTodoAdapter.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/rules/today_to_do/TodayTodoAdapter.kt @@ -1,23 +1,23 @@ -package com.hous.hous_aos.ui.rules.adapter +package com.hous.hous_aos.ui.rules.today_to_do -import android.util.Log import android.view.LayoutInflater import android.view.ViewGroup import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.ListAdapter import androidx.recyclerview.widget.RecyclerView -import com.hous.data.entity.Rule +import com.hous.domain.model.HomieInfo +import com.hous.domain.model.RuleInfo import com.hous.hous_aos.databinding.ItemRulesTodayToDoItemMultiBinding import com.hous.hous_aos.databinding.ItemRulesTodayToDoItemNoneBinding import com.hous.hous_aos.databinding.ItemRulesTodayToDoItemOneBinding import com.hous.hous_aos.ui.rules.IconColor -import com.hous.hous_aos.ui.rules.today_to_do.ItemToDoViewType +import timber.log.Timber class TodayTodoAdapter( private val onClickIcon: () -> Unit, private val fetchToTmpManagerList: (Int) -> Unit ) : - ListAdapter( + ListAdapter( TodayTodoDiffUtilCallback ) { @@ -81,8 +81,8 @@ class TodayTodoAdapter( private val onClickIcon: () -> Unit, private val binding: ItemRulesTodayToDoItemNoneBinding ) : RecyclerView.ViewHolder(binding.root) { - fun onBind(data: com.hous.data.entity.Rule) { - Log.d(TAG, "NONE : , data: $data") + fun onBind(data: RuleInfo) { + Timber.d("NONE : , data: $data") binding.data = data binding.ivManagerEmpty.setOnClickListener { fetchToTmpManagerList(absoluteAdapterPosition) @@ -96,8 +96,8 @@ class TodayTodoAdapter( private val onClickIcon: () -> Unit, private val binding: ItemRulesTodayToDoItemOneBinding ) : RecyclerView.ViewHolder(binding.root) { - fun onBind(data: com.hous.data.entity.Rule) { - Log.d(TAG, "One : , data: $data") + fun onBind(data: RuleInfo) { + Timber.d("One : , data: $data") binding.data = data binding.tvManager.text = changeListToString(requireNotNull(data.todayMembersWithTypeColor)) @@ -109,7 +109,7 @@ class TodayTodoAdapter( } } - private fun changeListToString(managerDataList: List): String { + private fun changeListToString(managerDataList: List): String { val textList = managerDataList.map { it.userName } return textList[0] } @@ -132,8 +132,8 @@ class TodayTodoAdapter( private val onClickIcon: () -> Unit, private val binding: ItemRulesTodayToDoItemMultiBinding ) : RecyclerView.ViewHolder(binding.root) { - fun onBind(data: com.hous.data.entity.Rule) { - Log.d(TAG, "MULTI : , data: $data") + fun onBind(data: RuleInfo) { + Timber.d("MULTI : , data: $data") binding.data = data binding.tvManager.text = changeListToString(requireNotNull(data.todayMembersWithTypeColor)) @@ -167,7 +167,7 @@ class TodayTodoAdapter( } } - private fun changeListToString(managerDataList: List): String { + private fun changeListToString(managerDataList: List): String { val textList = managerDataList.map { it.userName } val sizeOfTextList = textList.size return if (sizeOfTextList in 2..3) { @@ -202,24 +202,23 @@ class TodayTodoAdapter( companion object { private val TodayTodoDiffUtilCallback = - object : DiffUtil.ItemCallback() { + object : DiffUtil.ItemCallback() { override fun areItemsTheSame( - oldItem: Rule, - newItem: Rule + oldItem: RuleInfo, + newItem: RuleInfo ): Boolean { return oldItem.id == newItem.id } override fun areContentsTheSame( - oldItem: Rule, - newItem: Rule + oldItem: RuleInfo, + newItem: RuleInfo ): Boolean { return oldItem == newItem } } - const val TAG = "로그" - private const val MANAGER_NUMBER_ZERO = 0 + private const val MANAGER_NUMBER_ONE = 1 private const val MANAGER_NUMBER_TWO = 2 private const val BLUE = "BLUE" diff --git a/app/src/main/java/com/hous/hous_aos/ui/rules/today_to_do/tem_dialog/TempMangerAdapter.kt b/app/src/main/java/com/hous/hous_aos/ui/rules/today_to_do/tem_dialog/TempMangerAdapter.kt index 32afb355..7aa8ce45 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/rules/today_to_do/tem_dialog/TempMangerAdapter.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/rules/today_to_do/tem_dialog/TempMangerAdapter.kt @@ -5,12 +5,12 @@ import android.view.ViewGroup import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.ListAdapter import androidx.recyclerview.widget.RecyclerView -import com.hous.data.entity.Homie +import com.hous.domain.model.HomieInfo import com.hous.hous_aos.databinding.ItemRulesTmpManagersBinding import com.hous.hous_aos.ui.rules.HomieIconType class TempMangerAdapter(private val setSelectedTmpManager: (Int) -> Unit) : - ListAdapter(tempManagerDiffUtil) { + ListAdapter(tempManagerDiffUtil) { private val homieIconHashMap: HashMap = hashMapOf( "RED" to HomieIconType.RED, "BLUE" to HomieIconType.BLUE, @@ -37,7 +37,7 @@ class TempMangerAdapter(private val setSelectedTmpManager: (Int) -> Unit) : private val setSelectedTmpManager: (Int) -> Unit ) : RecyclerView.ViewHolder(binding.root) { - fun onBind(data: Homie) { + fun onBind(data: HomieInfo) { binding.data = data binding.homieIconType = homieIconHashMap[data.typeColor] binding.ivManagerIcon.setOnClickListener { @@ -48,17 +48,17 @@ class TempMangerAdapter(private val setSelectedTmpManager: (Int) -> Unit) : } companion object { - private val tempManagerDiffUtil = object : DiffUtil.ItemCallback() { + private val tempManagerDiffUtil = object : DiffUtil.ItemCallback() { override fun areItemsTheSame( - oldItem: Homie, - newItem: Homie + oldItem: HomieInfo, + newItem: HomieInfo ): Boolean { return oldItem.id == newItem.id } override fun areContentsTheSame( - oldItem: Homie, - newItem: Homie + oldItem: HomieInfo, + newItem: HomieInfo ): Boolean { return oldItem == newItem } diff --git a/app/src/main/res/layout/fragment_rules_table.xml b/app/src/main/res/layout/fragment_rules_table.xml index 70e4b7a9..7c023bd7 100644 --- a/app/src/main/res/layout/fragment_rules_table.xml +++ b/app/src/main/res/layout/fragment_rules_table.xml @@ -37,6 +37,7 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" tools:itemCount="3" + android:clipToPadding="true" tools:listitem="@layout/item_rules_table_general" /> + type="com.hous.domain.model.RuleInfo" /> + type="com.hous.domain.model.CategoryInfo" /> + type="com.hous.domain.model.RuleInfo" /> + type="com.hous.domain.model.RuleInfo" /> + type="com.hous.domain.model.HomieInfo" /> + type="com.hous.domain.model.RuleInfo" /> + type="com.hous.domain.model.RuleInfo" /> + type="com.hous.domain.model.RuleInfo" />