From 47a8863c878e8b33f123ae3eadcb092e4a70b206 Mon Sep 17 00:00:00 2001 From: pump9918 Date: Mon, 24 Jun 2024 19:48:29 +0900 Subject: [PATCH] =?UTF-8?q?#176=20[ui]=20=EB=B7=B0=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A0=80=20->=20=EB=A6=AC=EC=82=AC=EC=9D=B4=ED=81=B4=EB=9F=AC?= =?UTF-8?q?=EB=B7=B0=20=EB=B3=80=ED=99=98=20=EB=B0=8F=20=ED=95=A8=EC=88=98?= =?UTF-8?q?=EB=AA=85=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/AndroidManifest.xml | 2 +- ...dListActivity.kt => AddRoutineActivity.kt} | 55 +++++------- ...istViewModel.kt => AddRoutineViewModel.kt} | 8 +- ...ardPagerAdapter.kt => MakerCardAdapter.kt} | 20 ++--- ...gAdapter.kt => MakerCardHashtagAdapter.kt} | 13 ++- .../list/RoutineThemeListAdapter.kt | 30 ++++--- .../ui/happyroutine/HappyMyRoutineFragment.kt | 4 +- .../detail/HappyDetailCardPagerAdapter.kt | 6 +- .../happyroutine/list/HappyAddListActivity.kt | 12 +-- ...oration.kt => HorizontalItemDecoration.kt} | 11 ++- .../softie/util/VerticalItemDecoration.kt | 11 ++- .../softie/util/binding/BindingAdapter.kt | 17 ++++ ...list.xml => activity_add_routine_list.xml} | 57 +++++++------ .../res/layout/item_add_list_maker_card.xml | 85 ------------------- ...add_list.xml => item_add_routine_list.xml} | 28 +++--- .../item_add_routine_list_maker_card.xml | 80 +++++++++++++++++ ...> item_add_routine_list_maker_hashtag.xml} | 4 +- .../res/layout/item_happy_add_detail_card.xml | 14 +-- app/src/main/res/values/dimens.xml | 4 + app/src/main/res/values/strings.xml | 4 +- 20 files changed, 232 insertions(+), 233 deletions(-) rename app/src/main/java/com/sopetit/softie/ui/addroutine/list/{AddListActivity.kt => AddRoutineActivity.kt} (56%) rename app/src/main/java/com/sopetit/softie/ui/addroutine/list/{AddListViewModel.kt => AddRoutineViewModel.kt} (90%) rename app/src/main/java/com/sopetit/softie/ui/addroutine/list/{MakerCardPagerAdapter.kt => MakerCardAdapter.kt} (60%) rename app/src/main/java/com/sopetit/softie/ui/addroutine/list/{MakerCardPagerHashtagAdapter.kt => MakerCardHashtagAdapter.kt} (64%) rename app/src/main/java/com/sopetit/softie/util/{HorizontalChipItemDecoration.kt => HorizontalItemDecoration.kt} (78%) rename app/src/main/res/layout/{activity_add_list.xml => activity_add_routine_list.xml} (73%) delete mode 100644 app/src/main/res/layout/item_add_list_maker_card.xml rename app/src/main/res/layout/{item_add_list.xml => item_add_routine_list.xml} (64%) create mode 100644 app/src/main/res/layout/item_add_routine_list_maker_card.xml rename app/src/main/res/layout/{item_add_list_maker_hashtag_chip.xml => item_add_routine_list_maker_hashtag.xml} (88%) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 9aaf8be9..41b78b7f 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -47,7 +47,7 @@ diff --git a/app/src/main/java/com/sopetit/softie/ui/addroutine/list/AddListActivity.kt b/app/src/main/java/com/sopetit/softie/ui/addroutine/list/AddRoutineActivity.kt similarity index 56% rename from app/src/main/java/com/sopetit/softie/ui/addroutine/list/AddListActivity.kt rename to app/src/main/java/com/sopetit/softie/ui/addroutine/list/AddRoutineActivity.kt index 7588c2ad..3c8b0543 100644 --- a/app/src/main/java/com/sopetit/softie/ui/addroutine/list/AddListActivity.kt +++ b/app/src/main/java/com/sopetit/softie/ui/addroutine/list/AddRoutineActivity.kt @@ -3,9 +3,9 @@ package com.sopetit.softie.ui.addroutine.list import android.os.Bundle import androidx.activity.viewModels import androidx.recyclerview.widget.RecyclerView -import androidx.viewpager2.widget.ViewPager2 import com.sopetit.softie.R -import com.sopetit.softie.databinding.ActivityAddListBinding +import com.sopetit.softie.databinding.ActivityAddRoutineListBinding +import com.sopetit.softie.util.HorizontalItemDecoration import com.sopetit.softie.util.VerticalItemDecoration import com.sopetit.softie.util.binding.BindingActivity import com.sopetit.softie.util.setSingleOnClickListener @@ -13,37 +13,34 @@ import com.sopetit.softie.util.setStatusBarColorFromResource import dagger.hilt.android.AndroidEntryPoint @AndroidEntryPoint -class AddListActivity : BindingActivity(R.layout.activity_add_list) { - private lateinit var viewPager: ViewPager2 - private val makerCardPagerAdapter = MakerCardPagerAdapter() - private val viewModel by viewModels() +class AddRoutineActivity : + BindingActivity(R.layout.activity_add_routine_list) { + private val makerCardPagerAdapter = MakerCardAdapter() + private val viewModel by viewModels() private var routineThemeListAdapter: RoutineThemeListAdapter? = null - private lateinit var itemDeco: RecyclerView.ItemDecoration override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) binding.viewModel = viewModel - viewPager = binding.vpAddListMakerCard setStatusBarColorFromResource(R.color.background) startMakerHelpModal() setBackEnter() setInitBinding() - setHappyDetailCardPagerAdapter() - setCurrentCard() + setAddRoutineListCardPagerAdapter() setRoutineThemeListAdapter() setItemDeco() setupObservers() } private fun startMakerHelpModal() { - binding.ivAddListMakerHelp.setSingleOnClickListener { + binding.ivAddRoutineListMakerHelp.setSingleOnClickListener { MakerHelpDialogFragment().show(supportFragmentManager, "MakerHelpDialog") } } private fun setBackEnter() { - binding.ivAddListBackArrow.setSingleOnClickListener { + binding.ivAddRoutineListBackArrow.setSingleOnClickListener { finish() } } @@ -53,28 +50,12 @@ class AddListActivity : BindingActivity(R.layout.activit viewModel.getRoutineTheme() } - private fun setHappyDetailCardPagerAdapter() { + private fun setAddRoutineListCardPagerAdapter() { with(binding) { - vpAddListMakerCard.adapter = makerCardPagerAdapter + rvAddRoutineListMakerCard.adapter = makerCardPagerAdapter } } - private fun setCurrentCard() { - viewPager.registerOnPageChangeCallback(object : ViewPager2.OnPageChangeCallback() { - override fun onPageSelected(position: Int) { - super.onPageSelected(position) - val currentMakerId = getCurrentSelectedMakerId() - viewModel.setMakerId(currentMakerId) - } - }) - } - - private fun getCurrentSelectedMakerId(): Int { - val currentItem = binding.vpAddListMakerCard.currentItem - val itemId = makerCardPagerAdapter.getItemId(currentItem) - return itemId.toInt() - } - private fun setRoutineThemeListAdapter() { with(binding) { routineThemeListAdapter = RoutineThemeListAdapter() @@ -83,8 +64,18 @@ class AddListActivity : BindingActivity(R.layout.activit } private fun setItemDeco() { - itemDeco = VerticalItemDecoration(applicationContext) - binding.rvAddList.addItemDecoration(itemDeco) + val horizontalDecoration = HorizontalItemDecoration( + context = this, + firstItemMargin = R.dimen.maker_recycler_view_first_margin, + itemMargin = R.dimen.maker_recycler_view_margin + ) + val verticalDecoration = VerticalItemDecoration( + context = this, + firstItemMargin = R.dimen.add_routine_recycler_view_first_margin, + itemMargin = R.dimen.add_routine_recycler_view_margin + ) + binding.rvAddRoutineListMakerCard.addItemDecoration(horizontalDecoration) + binding.rvAddList.addItemDecoration(verticalDecoration) } private fun setupObservers() { diff --git a/app/src/main/java/com/sopetit/softie/ui/addroutine/list/AddListViewModel.kt b/app/src/main/java/com/sopetit/softie/ui/addroutine/list/AddRoutineViewModel.kt similarity index 90% rename from app/src/main/java/com/sopetit/softie/ui/addroutine/list/AddListViewModel.kt rename to app/src/main/java/com/sopetit/softie/ui/addroutine/list/AddRoutineViewModel.kt index 5a196e01..29617e44 100644 --- a/app/src/main/java/com/sopetit/softie/ui/addroutine/list/AddListViewModel.kt +++ b/app/src/main/java/com/sopetit/softie/ui/addroutine/list/AddRoutineViewModel.kt @@ -14,7 +14,7 @@ import timber.log.Timber import javax.inject.Inject @HiltViewModel -class AddListViewModel @Inject constructor( +class AddRoutineViewModel @Inject constructor( private val getMakerCardUseCase: GetMakerCardUseCase, private val getRoutineThemeListUseCase: GetRoutineThemeListUseCase ) : ViewModel() { @@ -24,12 +24,6 @@ class AddListViewModel @Inject constructor( private val _addRoutineThemeListResponse = MutableLiveData() val addRoutineThemeListResponse: LiveData get() = _addRoutineThemeListResponse - private val _myMakerId: MutableLiveData = MutableLiveData() - - fun setMakerId(makerId: Int) { - _myMakerId.value = makerId - } - fun getMakerCard() { viewModelScope.launch { getMakerCardUseCase() diff --git a/app/src/main/java/com/sopetit/softie/ui/addroutine/list/MakerCardPagerAdapter.kt b/app/src/main/java/com/sopetit/softie/ui/addroutine/list/MakerCardAdapter.kt similarity index 60% rename from app/src/main/java/com/sopetit/softie/ui/addroutine/list/MakerCardPagerAdapter.kt rename to app/src/main/java/com/sopetit/softie/ui/addroutine/list/MakerCardAdapter.kt index 57977b5e..1d5368c4 100644 --- a/app/src/main/java/com/sopetit/softie/ui/addroutine/list/MakerCardPagerAdapter.kt +++ b/app/src/main/java/com/sopetit/softie/ui/addroutine/list/MakerCardAdapter.kt @@ -5,32 +5,32 @@ import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView import coil.load import com.sopetit.softie.R -import com.sopetit.softie.databinding.ItemAddListMakerCardBinding +import com.sopetit.softie.databinding.ItemAddRoutineListMakerCardBinding import com.sopetit.softie.domain.entity.MakerCard -class MakerCardPagerAdapter : RecyclerView.Adapter() { +class MakerCardAdapter : RecyclerView.Adapter() { private var dataList = listOf() - class MakerPagerViewHolder(private val binding: ItemAddListMakerCardBinding) : + class MakerPagerViewHolder(private val binding: ItemAddRoutineListMakerCardBinding) : RecyclerView.ViewHolder(binding.root) { - private val hashtagAdapter = MakerCardPagerHashtagAdapter(emptyList()) + private val hashtagAdapter = MakerCardHashtagAdapter(emptyList()) init { - binding.rvAddListMakerHashtagChip.adapter = hashtagAdapter + binding.rvAddRoutineListMakerHashtag.adapter = hashtagAdapter } fun onBind(data: MakerCard) { with(binding) { - ivAddListMakerCardImage.load(data.artistImageUrl) { + ivAddRoutineListMakerCardImage.load(data.artistImageUrl) { placeholder(R.drawable.ic_happy_card_base) error(R.drawable.ic_happy_card_base) } - tvAddListMakerCardDetailSubtitle.text = data.subTitle - tvAddListMakerCardDetailTitle.text = data.title + tvAddRoutineListMakerCardDetailSubtitle.text = data.subTitle + tvAddRoutineListMakerCardDetailTitle.text = data.title - (binding.rvAddListMakerHashtagChip.adapter as MakerCardPagerHashtagAdapter)?.submitList( + (binding.rvAddRoutineListMakerHashtag.adapter as MakerCardHashtagAdapter)?.submitList( data.hashtag ) } @@ -38,7 +38,7 @@ class MakerCardPagerAdapter : RecyclerView.Adapter) : - RecyclerView.Adapter() { +class MakerCardHashtagAdapter(private var hashtags: List) : + RecyclerView.Adapter() { - class HashtagViewHolder(private val binding: ItemAddListMakerHashtagChipBinding) : + class HashtagViewHolder(private val binding: ItemAddRoutineListMakerHashtagBinding) : RecyclerView.ViewHolder(binding.root) { fun onBind(hashtag: MakerCard.Hashtag) { with(binding) { - tvAddListItemContent.text = hashtag.content + tvAddRoutineListMakerHashtagContent.text = hashtag.content } } } override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): HashtagViewHolder { - val binding = ItemAddListMakerHashtagChipBinding.inflate( + val binding = ItemAddRoutineListMakerHashtagBinding.inflate( LayoutInflater.from(parent.context), parent, false @@ -36,6 +36,5 @@ class MakerCardPagerHashtagAdapter(private var hashtags: List fun submitList(newHashtags: List) { hashtags = newHashtags - notifyDataSetChanged() } } diff --git a/app/src/main/java/com/sopetit/softie/ui/addroutine/list/RoutineThemeListAdapter.kt b/app/src/main/java/com/sopetit/softie/ui/addroutine/list/RoutineThemeListAdapter.kt index 5e786d5d..a062eee7 100644 --- a/app/src/main/java/com/sopetit/softie/ui/addroutine/list/RoutineThemeListAdapter.kt +++ b/app/src/main/java/com/sopetit/softie/ui/addroutine/list/RoutineThemeListAdapter.kt @@ -6,7 +6,7 @@ import androidx.recyclerview.widget.ListAdapter import androidx.recyclerview.widget.RecyclerView import coil.load import com.sopetit.softie.R -import com.sopetit.softie.databinding.ItemAddListBinding +import com.sopetit.softie.databinding.ItemAddRoutineListBinding import com.sopetit.softie.domain.entity.RoutineTheme import com.sopetit.softie.util.ItemDiffCallback @@ -18,23 +18,25 @@ class RoutineThemeListAdapter : ) ) { - inner class RoutineThemeListViewHolder(private val binding: ItemAddListBinding) : + inner class RoutineThemeListViewHolder(private val binding: ItemAddRoutineListBinding) : RecyclerView.ViewHolder(binding.root) { fun onBind(data: RoutineTheme.Themes) { with(binding) { - when (data.themeId) { - 1 -> ivAddListItemIcon.load(R.drawable.ic_theme1_pink) - 2 -> ivAddListItemIcon.load(R.drawable.ic_theme2_red) - 3 -> ivAddListItemIcon.load(R.drawable.ic_theme3_orange) - 4 -> ivAddListItemIcon.load(R.drawable.ic_theme4_yellow) - 5 -> ivAddListItemIcon.load(R.drawable.ic_theme5_green) - 6 -> ivAddListItemIcon.load(R.drawable.ic_theme6_sky) - 7 -> ivAddListItemIcon.load(R.drawable.ic_theme7_blue) - else -> ivAddListItemIcon.load(R.drawable.ic_bear_base) + val iconItem = when (data.themeId) { + 1 -> R.drawable.ic_theme1_pink + 2 -> R.drawable.ic_theme2_red + 3 -> R.drawable.ic_theme3_orange + 4 -> R.drawable.ic_theme4_yellow + 5 -> R.drawable.ic_theme5_green + 6 -> R.drawable.ic_theme6_sky + 7 -> R.drawable.ic_theme7_blue + else -> R.drawable.ic_bear_base } - tvAddListItemContent.text = data.modifier - tvAddListItemTitle.text = data.name + + ivAddRoutineListItemIcon.load(iconItem) + tvAddRoutineListItemModifier.text = data.modifier + tvAddRoutineListItemName.text = data.name } } } @@ -43,7 +45,7 @@ class RoutineThemeListAdapter : parent: ViewGroup, viewType: Int ): RoutineThemeListViewHolder { - val binding = ItemAddListBinding.inflate( + val binding = ItemAddRoutineListBinding.inflate( LayoutInflater.from(parent.context), parent, false diff --git a/app/src/main/java/com/sopetit/softie/ui/happyroutine/HappyMyRoutineFragment.kt b/app/src/main/java/com/sopetit/softie/ui/happyroutine/HappyMyRoutineFragment.kt index 2e2c4fe8..d29af561 100644 --- a/app/src/main/java/com/sopetit/softie/ui/happyroutine/HappyMyRoutineFragment.kt +++ b/app/src/main/java/com/sopetit/softie/ui/happyroutine/HappyMyRoutineFragment.kt @@ -9,7 +9,7 @@ import androidx.fragment.app.viewModels import coil.load import com.sopetit.softie.R import com.sopetit.softie.databinding.FragmentHappyMyRoutineBinding -import com.sopetit.softie.ui.addroutine.list.AddListActivity +import com.sopetit.softie.ui.addroutine.list.AddRoutineActivity import com.sopetit.softie.ui.happyroutine.complete.HappyRoutineCompleteActivity import com.sopetit.softie.ui.happyroutine.delete.HappyDeleteFragment import com.sopetit.softie.util.CustomSnackbar @@ -71,7 +71,7 @@ class HappyMyRoutineFragment : private fun startHappyAddListActivity() { binding.ivHappyRoutineEmptyCard.setOnClickListener { - val intent = Intent(requireContext(), AddListActivity::class.java) + val intent = Intent(requireContext(), AddRoutineActivity::class.java) resultLauncher.launch(intent) } } diff --git a/app/src/main/java/com/sopetit/softie/ui/happyroutine/detail/HappyDetailCardPagerAdapter.kt b/app/src/main/java/com/sopetit/softie/ui/happyroutine/detail/HappyDetailCardPagerAdapter.kt index 71b105ea..1abafd90 100644 --- a/app/src/main/java/com/sopetit/softie/ui/happyroutine/detail/HappyDetailCardPagerAdapter.kt +++ b/app/src/main/java/com/sopetit/softie/ui/happyroutine/detail/HappyDetailCardPagerAdapter.kt @@ -39,11 +39,11 @@ class HappyDetailCardPagerAdapter() : data.timeTaken tvHappyRoutineAddCardDetailPlaceBack.text = data.place - clHappyRoutineAddCard.setOnClickListener { - setCardFlip(clHappyRoutineAddCard, clHappyRoutineAddCardBack) + clHappyRoutineAddCardBack.setOnClickListener { + setCardFlip(clHappyRoutineAddCardBack, clHappyRoutineAddCardBack) } clHappyRoutineAddCardBack.setOnClickListener { - setCardFlip(clHappyRoutineAddCardBack, clHappyRoutineAddCard) + setCardFlip(clHappyRoutineAddCardBack, clHappyRoutineAddCardBack) } } } diff --git a/app/src/main/java/com/sopetit/softie/ui/happyroutine/list/HappyAddListActivity.kt b/app/src/main/java/com/sopetit/softie/ui/happyroutine/list/HappyAddListActivity.kt index c31f7ec8..8a65e1f1 100644 --- a/app/src/main/java/com/sopetit/softie/ui/happyroutine/list/HappyAddListActivity.kt +++ b/app/src/main/java/com/sopetit/softie/ui/happyroutine/list/HappyAddListActivity.kt @@ -8,7 +8,7 @@ import androidx.recyclerview.widget.RecyclerView import com.sopetit.softie.R import com.sopetit.softie.databinding.ActivityHappyAddListBinding import com.sopetit.softie.ui.happyroutine.detail.HappyDetailActivity -import com.sopetit.softie.util.HorizontalChipItemDecoration +import com.sopetit.softie.util.HorizontalItemDecoration import com.sopetit.softie.util.VerticalItemDecoration import com.sopetit.softie.util.binding.BindingActivity import com.sopetit.softie.util.setSingleOnClickListener @@ -20,8 +20,6 @@ class HappyAddListActivity : BindingActivity(R.layout.activity_happy_add_list) { private val viewModel by viewModels() - private lateinit var itemDeco: RecyclerView.ItemDecoration - private lateinit var chipDeco: RecyclerView.ItemDecoration private var happyAddListChipContentAdapter: HappyAddListChipContentAdapter? = null private var happyAddListContentAdapter: HappyAddListContentAdapter? = null @@ -44,7 +42,6 @@ class HappyAddListActivity : setChipAdapters() setBackEnter() - setItemDeco() setHappyAddListAdapter() } @@ -59,13 +56,6 @@ class HappyAddListActivity : } } - private fun setItemDeco() { - itemDeco = VerticalItemDecoration(applicationContext) - binding.rvHappyAddList.addItemDecoration(itemDeco) - chipDeco = HorizontalChipItemDecoration(applicationContext) - binding.rvHappyAddListChip.addItemDecoration(chipDeco) - } - private fun setHappyAddListAdapter() { with(binding) { rvHappyAddListChip.adapter = happyAddListChipContentAdapter diff --git a/app/src/main/java/com/sopetit/softie/util/HorizontalChipItemDecoration.kt b/app/src/main/java/com/sopetit/softie/util/HorizontalItemDecoration.kt similarity index 78% rename from app/src/main/java/com/sopetit/softie/util/HorizontalChipItemDecoration.kt rename to app/src/main/java/com/sopetit/softie/util/HorizontalItemDecoration.kt index b4ab2b97..7d577afb 100644 --- a/app/src/main/java/com/sopetit/softie/util/HorizontalChipItemDecoration.kt +++ b/app/src/main/java/com/sopetit/softie/util/HorizontalItemDecoration.kt @@ -4,9 +4,12 @@ import android.content.Context import android.graphics.Rect import android.view.View import androidx.recyclerview.widget.RecyclerView -import com.sopetit.softie.R -class HorizontalChipItemDecoration(val context: Context) : RecyclerView.ItemDecoration() { +class HorizontalItemDecoration( + val context: Context, + val firstItemMargin: Int, + val itemMargin: Int +) : RecyclerView.ItemDecoration() { override fun getItemOffsets( outRect: Rect, @@ -18,10 +21,10 @@ class HorizontalChipItemDecoration(val context: Context) : RecyclerView.ItemDeco val position = parent.getChildAdapterPosition(view) if (position == 0) { - outRect.left = context.resources.getDimensionPixelSize(R.dimen.chip_first_margin) + outRect.left = context.resources.getDimensionPixelSize(firstItemMargin) } else { outRect.left = 0 } - outRect.right = context.resources.getDimensionPixelSize(R.dimen.chip_margin) + outRect.right = context.resources.getDimensionPixelSize(itemMargin) } } diff --git a/app/src/main/java/com/sopetit/softie/util/VerticalItemDecoration.kt b/app/src/main/java/com/sopetit/softie/util/VerticalItemDecoration.kt index 0458554f..7c2ff2cf 100644 --- a/app/src/main/java/com/sopetit/softie/util/VerticalItemDecoration.kt +++ b/app/src/main/java/com/sopetit/softie/util/VerticalItemDecoration.kt @@ -4,9 +4,12 @@ import android.content.Context import android.graphics.Rect import android.view.View import androidx.recyclerview.widget.RecyclerView -import com.sopetit.softie.R -class VerticalItemDecoration(val context: Context) : RecyclerView.ItemDecoration() { +class VerticalItemDecoration( + val context: Context, + val firstItemMargin: Int, + val itemMargin: Int +) : RecyclerView.ItemDecoration() { override fun getItemOffsets( outRect: Rect, @@ -18,10 +21,10 @@ class VerticalItemDecoration(val context: Context) : RecyclerView.ItemDecoration val position = parent.getChildAdapterPosition(view) if (position == 0) { - outRect.top = context.resources.getDimensionPixelSize(R.dimen.happy_list_first_margin) + outRect.top = context.resources.getDimensionPixelSize(firstItemMargin) } else { outRect.top = 0 } - outRect.bottom = context.resources.getDimensionPixelSize(R.dimen.happy_list_margin) + outRect.bottom = context.resources.getDimensionPixelSize(itemMargin) } } diff --git a/app/src/main/java/com/sopetit/softie/util/binding/BindingAdapter.kt b/app/src/main/java/com/sopetit/softie/util/binding/BindingAdapter.kt index 249d90f0..4aad2add 100644 --- a/app/src/main/java/com/sopetit/softie/util/binding/BindingAdapter.kt +++ b/app/src/main/java/com/sopetit/softie/util/binding/BindingAdapter.kt @@ -3,7 +3,10 @@ package com.sopetit.softie.util.binding import android.widget.ImageView import androidx.databinding.BindingAdapter import coil.decode.SvgDecoder +import coil.imageLoader import coil.load +import coil.request.ImageRequest +import coil.transform.CircleCropTransformation import com.bumptech.glide.Glide import com.sopetit.softie.R @@ -43,4 +46,18 @@ object BindingAdapter { } } } + + @JvmStatic + @BindingAdapter("setCircleImage") + fun ImageView.setCircleImage(imgUrl: String?) { + this.let { + val request = ImageRequest.Builder(context) + .data(imgUrl) + .target(this) + .transformations(CircleCropTransformation()) + .fallback(R.drawable.ic_happy_card_base) + .build() + context.imageLoader.enqueue(request) + } + } } diff --git a/app/src/main/res/layout/activity_add_list.xml b/app/src/main/res/layout/activity_add_routine_list.xml similarity index 73% rename from app/src/main/res/layout/activity_add_list.xml rename to app/src/main/res/layout/activity_add_routine_list.xml index cba61102..bf504445 100644 --- a/app/src/main/res/layout/activity_add_list.xml +++ b/app/src/main/res/layout/activity_add_routine_list.xml @@ -7,18 +7,18 @@ + type="com.sopetit.softie.ui.addroutine.list.AddRoutineViewModel" /> + app:layout_constraintBottom_toBottomOf="@id/iv_add_routine_list_back_arrow" + app:layout_constraintStart_toEndOf="@id/iv_add_routine_list_back_arrow" + app:layout_constraintTop_toTopOf="@id/iv_add_routine_list_back_arrow" /> + app:layout_constraintTop_toBottomOf="@id/tv_add_routine_list_title"> + app:layout_constraintBottom_toBottomOf="@id/tv_add_routine_list_maker_recommend" + app:layout_constraintStart_toEndOf="@id/tv_add_routine_list_maker_recommend" + app:layout_constraintTop_toTopOf="@id/tv_add_routine_list_maker_recommend" /> + app:layout_constraintTop_toTopOf="@id/iv_add_routine_list_maker_chip" /> - + app:layout_constraintTop_toBottomOf="@id/tv_add_routine_list_maker_recommend" + tools:listitem="@layout/item_add_routine_list_maker_card" /> + app:layout_constraintTop_toBottomOf="@id/rv_add_routine_list_maker_card" /> + app:layout_constraintTop_toBottomOf="@id/tv_add_routine_list_theme_title" + tools:listitem="@layout/item_add_routine_list" /> diff --git a/app/src/main/res/layout/item_add_list_maker_card.xml b/app/src/main/res/layout/item_add_list_maker_card.xml deleted file mode 100644 index 8a930a30..00000000 --- a/app/src/main/res/layout/item_add_list_maker_card.xml +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/layout/item_add_list.xml b/app/src/main/res/layout/item_add_routine_list.xml similarity index 64% rename from app/src/main/res/layout/item_add_list.xml rename to app/src/main/res/layout/item_add_routine_list.xml index 13af9b41..6e696308 100644 --- a/app/src/main/res/layout/item_add_list.xml +++ b/app/src/main/res/layout/item_add_routine_list.xml @@ -7,52 +7,52 @@ + app:layout_constraintBottom_toBottomOf="@id/cl_add_routine_list_component" + app:layout_constraintStart_toStartOf="@id/cl_add_routine_list_component" + app:layout_constraintTop_toTopOf="@id/cl_add_routine_list_component" /> + app:layout_constraintStart_toEndOf="@id/iv_add_routine_list_item_icon" + app:layout_constraintTop_toBottomOf="@id/tv_add_routine_list_item_modifier" /> + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/item_add_list_maker_hashtag_chip.xml b/app/src/main/res/layout/item_add_routine_list_maker_hashtag.xml similarity index 88% rename from app/src/main/res/layout/item_add_list_maker_hashtag_chip.xml rename to app/src/main/res/layout/item_add_routine_list_maker_hashtag.xml index 2a295d60..30c884a9 100644 --- a/app/src/main/res/layout/item_add_list_maker_hashtag_chip.xml +++ b/app/src/main/res/layout/item_add_routine_list_maker_hashtag.xml @@ -7,14 +7,14 @@ + app:layout_constraintBottom_toBottomOf="@id/cl_add_routine_list_maker_card" + app:layout_constraintEnd_toEndOf="@id/cl_add_routine_list_maker_card" /> @@ -70,10 +70,10 @@ android:layout_height="0dp" android:background="@drawable/shape_gray0_fill_gray200_stroke_20_rect" android:visibility="invisible" - app:layout_constraintBottom_toBottomOf="@id/cl_happy_routine_add_card" - app:layout_constraintEnd_toEndOf="@id/cl_happy_routine_add_card" - app:layout_constraintStart_toStartOf="@id/cl_happy_routine_add_card" - app:layout_constraintTop_toTopOf="@id/cl_happy_routine_add_card"> + app:layout_constraintBottom_toBottomOf="@id/cl_add_routine_list_maker_card" + app:layout_constraintEnd_toEndOf="@id/cl_add_routine_list_maker_card" + app:layout_constraintStart_toStartOf="@id/cl_add_routine_list_maker_card" + app:layout_constraintTop_toTopOf="@id/cl_add_routine_list_maker_card"> 4dp 112dp 20dp + 20dp + 8dp + 8dp + 4dp diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8119c68f..fe0d2ef2 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -42,8 +42,8 @@ 루틴 추가 이런 루틴은 어때요? 전체 루틴 테마 - 사람들과 어울리는 - 관계 쌓기 + 사람들과 어울리는 + 관계 쌓기