diff --git a/app/build.gradle.kts b/app/build.gradle.kts index a5620828..5104192e 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -137,6 +137,9 @@ dependencies { // Coroutine implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.3") + + // Tool Tip + implementation("com.github.skydoves:balloon:1.6.5") } fun getApiKey(propertyKey: String): String { diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 5b1fa6f3..41b78b7f 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -46,6 +46,11 @@ + + +) { + data class Hashtag( + val hashtagId: Int, + val content: String, + ) +} diff --git a/app/src/main/java/com/sopetit/softie/domain/entity/RoutineTheme.kt b/app/src/main/java/com/sopetit/softie/domain/entity/RoutineTheme.kt new file mode 100644 index 00000000..214f8906 --- /dev/null +++ b/app/src/main/java/com/sopetit/softie/domain/entity/RoutineTheme.kt @@ -0,0 +1,12 @@ +package com.sopetit.softie.domain.entity + +data class RoutineTheme( + val themes: List +) { + data class Themes( + val themeId: Int, + val modifier: String, + val name: String, + val description: String, + ) +} diff --git a/app/src/main/java/com/sopetit/softie/domain/repository/AddRoutineRepository.kt b/app/src/main/java/com/sopetit/softie/domain/repository/AddRoutineRepository.kt new file mode 100644 index 00000000..39bda9f9 --- /dev/null +++ b/app/src/main/java/com/sopetit/softie/domain/repository/AddRoutineRepository.kt @@ -0,0 +1,9 @@ +package com.sopetit.softie.domain.repository + +import com.sopetit.softie.domain.entity.MakerCard +import com.sopetit.softie.domain.entity.RoutineTheme + +interface AddRoutineRepository { + suspend fun getMakerCard(): Result> + suspend fun getRoutineTheme(): Result +} diff --git a/app/src/main/java/com/sopetit/softie/domain/repository/MockAddRoutineRepository.kt b/app/src/main/java/com/sopetit/softie/domain/repository/MockAddRoutineRepository.kt new file mode 100644 index 00000000..f7d7246a --- /dev/null +++ b/app/src/main/java/com/sopetit/softie/domain/repository/MockAddRoutineRepository.kt @@ -0,0 +1,96 @@ +package com.sopetit.softie.domain.repository + +import com.sopetit.softie.domain.entity.MakerCard +import com.sopetit.softie.domain.entity.RoutineTheme +import javax.inject.Inject + +class MockAddRoutineRepository @Inject constructor() : AddRoutineRepository { + override suspend fun getMakerCard(): Result> { + return Result.success( + listOf( + MakerCard( + artistId = 1, + artistImageUrl = "https://img.etoday.co.kr/pto_db/2024/04/600/20240426132100_2017673_647_863.jpeg", + subTitle = "하이브의 주인은 누구?", + title = "뉴진스가 돌아왔다", + hashtag = listOf( + MakerCard.Hashtag(hashtagId = 1, content = "#민희진"), + MakerCard.Hashtag(hashtagId = 2, content = "#방시혁"), + MakerCard.Hashtag(hashtagId = 2, content = "#하이브") + ) + ), + MakerCard( + artistId = 2, + artistImageUrl = "https://cdn.hankyung.com/photo/202211/BF.23427209.1.jpg", + subTitle = "더이상 웹툰작가로는 못산다", + title = "침착맨의 시크릿", + hashtag = listOf( + MakerCard.Hashtag(hashtagId = 3, content = "#침착침착"), + MakerCard.Hashtag(hashtagId = 4, content = "#이말년") + ) + ), + MakerCard( + artistId = 3, + artistImageUrl = "https://res.heraldm.com/content/image/2024/05/06/20240506050023_0.jpg", + subTitle = "선재업고 얼마나 뛸 수 있어?", + title = "변우석의 성공담", + hashtag = listOf( + MakerCard.Hashtag(hashtagId = 5, content = "#류선재"), + MakerCard.Hashtag(hashtagId = 6, content = "#드라마") + ) + ) + ) + ) + } + + override suspend fun getRoutineTheme(): Result { + return Result.success( + RoutineTheme( + themes = listOf( + RoutineTheme.Themes( + themeId = 1, + modifier = "사람들과 어울리는", + name = "관계 쌓기", + description = "설명" + ), + RoutineTheme.Themes( + themeId = 2, + modifier = "나를 돌보는", + name = "마음 챙김", + description = "설명2" + ), + RoutineTheme.Themes( + themeId = 3, + modifier = "경제적으로 살아가는", + name = "통통한 통장", + description = "설명2" + ), + RoutineTheme.Themes( + themeId = 4, + modifier = "하루를 상쾌하게", + name = "산뜻한 일상", + description = "설명2" + ), + RoutineTheme.Themes( + themeId = 5, + modifier = "더 나은 나를 위해", + name = "한 걸음 성장", + description = "설명2" + ), + RoutineTheme.Themes( + themeId = 6, + modifier = "튼튼하게 건강하게", + name = "건강한 몸", + description = "설명2" + ), + RoutineTheme.Themes( + themeId = 7, + modifier = "튼튼하게 건강하게", + name = "나와 친해지기", + description = "설명2" + ) + ) + ) + ) + } +} diff --git a/app/src/main/java/com/sopetit/softie/domain/usecase/addroutine/GetMakerCardUseCase.kt b/app/src/main/java/com/sopetit/softie/domain/usecase/addroutine/GetMakerCardUseCase.kt new file mode 100644 index 00000000..66966ee1 --- /dev/null +++ b/app/src/main/java/com/sopetit/softie/domain/usecase/addroutine/GetMakerCardUseCase.kt @@ -0,0 +1,13 @@ +package com.sopetit.softie.domain.usecase.addroutine + +import com.sopetit.softie.domain.entity.MakerCard +import com.sopetit.softie.domain.repository.AddRoutineRepository +import javax.inject.Inject + +class GetMakerCardUseCase @Inject constructor( + private val addRoutineRepository: AddRoutineRepository +) { + suspend operator fun invoke(): Result> { + return addRoutineRepository.getMakerCard() + } +} diff --git a/app/src/main/java/com/sopetit/softie/domain/usecase/addroutine/GetRoutineThemeListUseCase.kt b/app/src/main/java/com/sopetit/softie/domain/usecase/addroutine/GetRoutineThemeListUseCase.kt new file mode 100644 index 00000000..1eeaa44f --- /dev/null +++ b/app/src/main/java/com/sopetit/softie/domain/usecase/addroutine/GetRoutineThemeListUseCase.kt @@ -0,0 +1,18 @@ +package com.sopetit.softie.domain.usecase.addroutine + +import com.sopetit.softie.domain.entity.RoutineTheme +import com.sopetit.softie.domain.repository.AddRoutineRepository +import javax.inject.Inject + +class GetRoutineThemeListUseCase @Inject constructor( + private val addRoutineRepository: AddRoutineRepository +) { + suspend operator fun invoke(): Result { + return try { + val result = addRoutineRepository.getRoutineTheme() + result + } catch (e: Exception) { + Result.failure(e) + } + } +} diff --git a/app/src/main/java/com/sopetit/softie/ui/addroutine/list/AddRoutineActivity.kt b/app/src/main/java/com/sopetit/softie/ui/addroutine/list/AddRoutineActivity.kt new file mode 100644 index 00000000..596e0e8d --- /dev/null +++ b/app/src/main/java/com/sopetit/softie/ui/addroutine/list/AddRoutineActivity.kt @@ -0,0 +1,130 @@ +package com.sopetit.softie.ui.addroutine.list + +import android.os.Bundle +import android.view.View +import android.widget.ImageView +import androidx.activity.viewModels +import com.skydoves.balloon.createBalloon +import com.skydoves.balloon.overlay.BalloonOverlayAnimation +import com.skydoves.balloon.overlay.BalloonOverlayCircle +import com.sopetit.softie.R +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 +import com.sopetit.softie.util.setStatusBarColorFromResource +import dagger.hilt.android.AndroidEntryPoint + +@AndroidEntryPoint +class AddRoutineActivity : BindingActivity(R.layout.activity_add_routine_list) { + private val makerCardPagerAdapter = MakerCardAdapter() + private val viewModel by viewModels() + private var routineThemeListAdapter: RoutineThemeListAdapter? = null + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + binding.viewModel = viewModel + setStatusBarColorFromResource(R.color.background) + + startMakerTooltipModal() + setBackEnter() + setInitBinding() + setAddRoutineListCardPagerAdapter() + setRoutineThemeListAdapter() + setItemDeco() + setupUI() + setupObservers() + } + + private fun startMakerTooltipModal() { + binding.ivAddRoutineListMakerHelp.setSingleOnClickListener { view -> + showTooltip(view) + } + } + + private fun showTooltip(anchor: View) { + val balloon = + createBalloon(this) { + setLayout(R.layout.tooltip_maker_help) + setBackgroundDrawableResource(R.drawable.shape_gray0_fill_10_rect) + setIsVisibleArrow(false) + setDismissWhenClicked(false) + setIsVisibleOverlay(true) + setOverlayShape(BalloonOverlayCircle(radius = 0f)) + setOverlayColorResource(R.color.gray950) + setBalloonOverlayAnimation(BalloonOverlayAnimation.FADE) + setDismissWhenOverlayClicked(false) + setLifecycleOwner(lifecycleOwner) + } + + balloon.setOnBalloonInitializedListener { view -> + view.findViewById(R.id.iv_maker_help_tooltip_exit)?.setOnClickListener { + balloon.dismiss() + } + } + + balloon.showAlignBottom(anchor) + } + + private fun setBackEnter() { + binding.ivAddRoutineListBackArrow.setSingleOnClickListener { + finish() + } + } + + private fun setInitBinding() { + viewModel.getMakerCard() + viewModel.getRoutineTheme() + } + + private fun setAddRoutineListCardPagerAdapter() { + with(binding) { + rvAddRoutineListMakerCard.adapter = makerCardPagerAdapter + } + } + + private fun setRoutineThemeListAdapter() { + with(binding) { + routineThemeListAdapter = RoutineThemeListAdapter() + rvAddList.adapter = routineThemeListAdapter + } + } + + private fun setItemDeco() { + 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 setupUI() { + binding.ivAddRoutineListMakerHelp.setOnClickListener { + showTooltip(it) + } + } + + private fun setupObservers() { + viewModel.addRoutineThemeListResponse.observe(this) { routineTheme -> + routineTheme?.let { + routineThemeListAdapter?.submitList(routineTheme.themes) + } + } + + viewModel.addMakerCardResponse.observe(this) { makerCards -> + makerCards?.let { + makerCardPagerAdapter.submitList(makerCards) + } + } + } +} diff --git a/app/src/main/java/com/sopetit/softie/ui/addroutine/list/AddRoutineViewModel.kt b/app/src/main/java/com/sopetit/softie/ui/addroutine/list/AddRoutineViewModel.kt new file mode 100644 index 00000000..29617e44 --- /dev/null +++ b/app/src/main/java/com/sopetit/softie/ui/addroutine/list/AddRoutineViewModel.kt @@ -0,0 +1,50 @@ +package com.sopetit.softie.ui.addroutine.list + +import androidx.lifecycle.LiveData +import androidx.lifecycle.MutableLiveData +import androidx.lifecycle.ViewModel +import androidx.lifecycle.viewModelScope +import com.sopetit.softie.domain.entity.MakerCard +import com.sopetit.softie.domain.entity.RoutineTheme +import com.sopetit.softie.domain.usecase.addroutine.GetMakerCardUseCase +import com.sopetit.softie.domain.usecase.addroutine.GetRoutineThemeListUseCase +import dagger.hilt.android.lifecycle.HiltViewModel +import kotlinx.coroutines.launch +import timber.log.Timber +import javax.inject.Inject + +@HiltViewModel +class AddRoutineViewModel @Inject constructor( + private val getMakerCardUseCase: GetMakerCardUseCase, + private val getRoutineThemeListUseCase: GetRoutineThemeListUseCase +) : ViewModel() { + private val _addMakerCardResponse = MutableLiveData>() + val addMakerCardResponse: LiveData> get() = _addMakerCardResponse + + private val _addRoutineThemeListResponse = MutableLiveData() + val addRoutineThemeListResponse: LiveData get() = _addRoutineThemeListResponse + + fun getMakerCard() { + viewModelScope.launch { + getMakerCardUseCase() + .onSuccess { response -> + _addMakerCardResponse.value = response + } + .onFailure { throwable -> + Timber.e("$throwable") + } + } + } + + fun getRoutineTheme() { + viewModelScope.launch { + val result = getRoutineThemeListUseCase() + + result.onSuccess { response -> + _addRoutineThemeListResponse.value = response + }.onFailure { throwable -> + Timber.e("$throwable") + } + } + } +} diff --git a/app/src/main/java/com/sopetit/softie/ui/addroutine/list/MakerCardAdapter.kt b/app/src/main/java/com/sopetit/softie/ui/addroutine/list/MakerCardAdapter.kt new file mode 100644 index 00000000..1d5368c4 --- /dev/null +++ b/app/src/main/java/com/sopetit/softie/ui/addroutine/list/MakerCardAdapter.kt @@ -0,0 +1,59 @@ +package com.sopetit.softie.ui.addroutine.list + +import android.view.LayoutInflater +import android.view.ViewGroup +import androidx.recyclerview.widget.RecyclerView +import coil.load +import com.sopetit.softie.R +import com.sopetit.softie.databinding.ItemAddRoutineListMakerCardBinding +import com.sopetit.softie.domain.entity.MakerCard + +class MakerCardAdapter : RecyclerView.Adapter() { + + private var dataList = listOf() + + class MakerPagerViewHolder(private val binding: ItemAddRoutineListMakerCardBinding) : + RecyclerView.ViewHolder(binding.root) { + + private val hashtagAdapter = MakerCardHashtagAdapter(emptyList()) + + init { + binding.rvAddRoutineListMakerHashtag.adapter = hashtagAdapter + } + + fun onBind(data: MakerCard) { + with(binding) { + ivAddRoutineListMakerCardImage.load(data.artistImageUrl) { + placeholder(R.drawable.ic_happy_card_base) + error(R.drawable.ic_happy_card_base) + } + tvAddRoutineListMakerCardDetailSubtitle.text = data.subTitle + tvAddRoutineListMakerCardDetailTitle.text = data.title + + (binding.rvAddRoutineListMakerHashtag.adapter as MakerCardHashtagAdapter)?.submitList( + data.hashtag + ) + } + } + } + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MakerPagerViewHolder { + val binding = ItemAddRoutineListMakerCardBinding.inflate( + LayoutInflater.from(parent.context), + parent, + false + ) + return MakerPagerViewHolder(binding) + } + + override fun onBindViewHolder(holder: MakerPagerViewHolder, position: Int) { + holder.onBind(dataList[position]) + } + + override fun getItemCount(): Int = dataList.size + + fun submitList(newDataList: List) { + dataList = newDataList + notifyDataSetChanged() + } +} diff --git a/app/src/main/java/com/sopetit/softie/ui/addroutine/list/MakerCardHashtagAdapter.kt b/app/src/main/java/com/sopetit/softie/ui/addroutine/list/MakerCardHashtagAdapter.kt new file mode 100644 index 00000000..113142b4 --- /dev/null +++ b/app/src/main/java/com/sopetit/softie/ui/addroutine/list/MakerCardHashtagAdapter.kt @@ -0,0 +1,40 @@ +package com.sopetit.softie.ui.addroutine.list + +import android.view.LayoutInflater +import android.view.ViewGroup +import androidx.recyclerview.widget.RecyclerView +import com.sopetit.softie.databinding.ItemAddRoutineListMakerHashtagBinding +import com.sopetit.softie.domain.entity.MakerCard + +class MakerCardHashtagAdapter(private var hashtags: List) : + RecyclerView.Adapter() { + + class HashtagViewHolder(private val binding: ItemAddRoutineListMakerHashtagBinding) : + RecyclerView.ViewHolder(binding.root) { + + fun onBind(hashtag: MakerCard.Hashtag) { + with(binding) { + tvAddRoutineListMakerHashtagContent.text = hashtag.content + } + } + } + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): HashtagViewHolder { + val binding = ItemAddRoutineListMakerHashtagBinding.inflate( + LayoutInflater.from(parent.context), + parent, + false + ) + return HashtagViewHolder(binding) + } + + override fun onBindViewHolder(holder: HashtagViewHolder, position: Int) { + holder.onBind(hashtags[position]) + } + + override fun getItemCount(): Int = hashtags.size + + fun submitList(newHashtags: List) { + hashtags = newHashtags + } +} 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 new file mode 100644 index 00000000..a062eee7 --- /dev/null +++ b/app/src/main/java/com/sopetit/softie/ui/addroutine/list/RoutineThemeListAdapter.kt @@ -0,0 +1,59 @@ +package com.sopetit.softie.ui.addroutine.list + +import android.view.LayoutInflater +import android.view.ViewGroup +import androidx.recyclerview.widget.ListAdapter +import androidx.recyclerview.widget.RecyclerView +import coil.load +import com.sopetit.softie.R +import com.sopetit.softie.databinding.ItemAddRoutineListBinding +import com.sopetit.softie.domain.entity.RoutineTheme +import com.sopetit.softie.util.ItemDiffCallback + +class RoutineThemeListAdapter : + ListAdapter( + ItemDiffCallback( + onItemsTheSame = { oldItem, newItem -> oldItem == newItem }, + onContentsTheSame = { oldItem, newItem -> oldItem == newItem } + ) + ) { + + inner class RoutineThemeListViewHolder(private val binding: ItemAddRoutineListBinding) : + RecyclerView.ViewHolder(binding.root) { + + fun onBind(data: RoutineTheme.Themes) { + with(binding) { + 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 + } + + ivAddRoutineListItemIcon.load(iconItem) + tvAddRoutineListItemModifier.text = data.modifier + tvAddRoutineListItemName.text = data.name + } + } + } + + override fun onCreateViewHolder( + parent: ViewGroup, + viewType: Int + ): RoutineThemeListViewHolder { + val binding = ItemAddRoutineListBinding.inflate( + LayoutInflater.from(parent.context), + parent, + false + ) + return RoutineThemeListViewHolder(binding) + } + + override fun onBindViewHolder(holder: RoutineThemeListViewHolder, position: Int) { + holder.onBind(currentList[position]) + } +} 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 2b7f7e64..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,9 +9,9 @@ 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.AddRoutineActivity import com.sopetit.softie.ui.happyroutine.complete.HappyRoutineCompleteActivity import com.sopetit.softie.ui.happyroutine.delete.HappyDeleteFragment -import com.sopetit.softie.ui.happyroutine.list.HappyAddListActivity import com.sopetit.softie.util.CustomSnackbar import com.sopetit.softie.util.OriginalBottomSheet import com.sopetit.softie.util.binding.BindingBottomSheet @@ -71,7 +71,7 @@ class HappyMyRoutineFragment : private fun startHappyAddListActivity() { binding.ivHappyRoutineEmptyCard.setOnClickListener { - val intent = Intent(requireContext(), HappyAddListActivity::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/drawable/ic_exit.xml b/app/src/main/res/drawable/ic_exit.xml new file mode 100644 index 00000000..5bcfef8b --- /dev/null +++ b/app/src/main/res/drawable/ic_exit.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_maker_chip.xml b/app/src/main/res/drawable/ic_maker_chip.xml new file mode 100644 index 00000000..75a198b5 --- /dev/null +++ b/app/src/main/res/drawable/ic_maker_chip.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_maker_help.xml b/app/src/main/res/drawable/ic_maker_help.xml new file mode 100644 index 00000000..fb3a9a66 --- /dev/null +++ b/app/src/main/res/drawable/ic_maker_help.xml @@ -0,0 +1,12 @@ + + + + diff --git a/app/src/main/res/drawable/ic_theme1_pink.xml b/app/src/main/res/drawable/ic_theme1_pink.xml new file mode 100644 index 00000000..4ddb642d --- /dev/null +++ b/app/src/main/res/drawable/ic_theme1_pink.xml @@ -0,0 +1,13 @@ + + + + diff --git a/app/src/main/res/drawable/ic_theme2_red.xml b/app/src/main/res/drawable/ic_theme2_red.xml new file mode 100644 index 00000000..5fac478c --- /dev/null +++ b/app/src/main/res/drawable/ic_theme2_red.xml @@ -0,0 +1,13 @@ + + + + diff --git a/app/src/main/res/drawable/ic_theme3_orange.xml b/app/src/main/res/drawable/ic_theme3_orange.xml new file mode 100644 index 00000000..8c76dc2a --- /dev/null +++ b/app/src/main/res/drawable/ic_theme3_orange.xml @@ -0,0 +1,12 @@ + + + diff --git a/app/src/main/res/drawable/ic_theme4_yellow.xml b/app/src/main/res/drawable/ic_theme4_yellow.xml new file mode 100644 index 00000000..a9f43ba2 --- /dev/null +++ b/app/src/main/res/drawable/ic_theme4_yellow.xml @@ -0,0 +1,13 @@ + + + + diff --git a/app/src/main/res/drawable/ic_theme5_green.xml b/app/src/main/res/drawable/ic_theme5_green.xml new file mode 100644 index 00000000..85951c1e --- /dev/null +++ b/app/src/main/res/drawable/ic_theme5_green.xml @@ -0,0 +1,13 @@ + + + + diff --git a/app/src/main/res/drawable/ic_theme6_sky.xml b/app/src/main/res/drawable/ic_theme6_sky.xml new file mode 100644 index 00000000..2156037c --- /dev/null +++ b/app/src/main/res/drawable/ic_theme6_sky.xml @@ -0,0 +1,13 @@ + + + + diff --git a/app/src/main/res/drawable/ic_theme7_blue.xml b/app/src/main/res/drawable/ic_theme7_blue.xml new file mode 100644 index 00000000..1184205f --- /dev/null +++ b/app/src/main/res/drawable/ic_theme7_blue.xml @@ -0,0 +1,13 @@ + + + + diff --git a/app/src/main/res/drawable/ic_theme8_maker.xml b/app/src/main/res/drawable/ic_theme8_maker.xml new file mode 100644 index 00000000..9721c6e9 --- /dev/null +++ b/app/src/main/res/drawable/ic_theme8_maker.xml @@ -0,0 +1,23 @@ + + + + + + + + + + diff --git a/app/src/main/res/drawable/img_add_list_maker_profile.png b/app/src/main/res/drawable/img_add_list_maker_profile.png new file mode 100644 index 00000000..e8ac7e3b Binary files /dev/null and b/app/src/main/res/drawable/img_add_list_maker_profile.png differ diff --git a/app/src/main/res/drawable/shape_gray0_fill_10_rect.xml b/app/src/main/res/drawable/shape_gray0_fill_10_rect.xml new file mode 100644 index 00000000..305e8825 --- /dev/null +++ b/app/src/main/res/drawable/shape_gray0_fill_10_rect.xml @@ -0,0 +1,7 @@ + + + + + + diff --git a/app/src/main/res/drawable/shape_gray0_fill_gray200_stroke_10_rect.xml b/app/src/main/res/drawable/shape_gray0_fill_gray200_stroke_10_rect.xml new file mode 100644 index 00000000..32cf211b --- /dev/null +++ b/app/src/main/res/drawable/shape_gray0_fill_gray200_stroke_10_rect.xml @@ -0,0 +1,11 @@ + + + + + + + + diff --git a/app/src/main/res/drawable/shape_gray200_fill_4_rect.xml b/app/src/main/res/drawable/shape_gray200_fill_4_rect.xml new file mode 100644 index 00000000..d691015d --- /dev/null +++ b/app/src/main/res/drawable/shape_gray200_fill_4_rect.xml @@ -0,0 +1,8 @@ + + + + + + + diff --git a/app/src/main/res/layout/activity_add_routine_list.xml b/app/src/main/res/layout/activity_add_routine_list.xml new file mode 100644 index 00000000..8ecfbdef --- /dev/null +++ b/app/src/main/res/layout/activity_add_routine_list.xml @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/item_add_routine_list.xml b/app/src/main/res/layout/item_add_routine_list.xml new file mode 100644 index 00000000..6e696308 --- /dev/null +++ b/app/src/main/res/layout/item_add_routine_list.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/item_add_routine_list_maker_card.xml b/app/src/main/res/layout/item_add_routine_list_maker_card.xml new file mode 100644 index 00000000..be830621 --- /dev/null +++ b/app/src/main/res/layout/item_add_routine_list_maker_card.xml @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/item_add_routine_list_maker_hashtag.xml b/app/src/main/res/layout/item_add_routine_list_maker_hashtag.xml new file mode 100644 index 00000000..30c884a9 --- /dev/null +++ b/app/src/main/res/layout/item_add_routine_list_maker_hashtag.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/item_happy_add_detail_card.xml b/app/src/main/res/layout/item_happy_add_detail_card.xml index 23a88d59..34bca0e6 100644 --- a/app/src/main/res/layout/item_happy_add_detail_card.xml +++ b/app/src/main/res/layout/item_happy_add_detail_card.xml @@ -13,7 +13,7 @@ android:paddingHorizontal="40dp"> + 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"> + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 795d141e..0f8d5d27 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -3,6 +3,13 @@ 30dp 20dp 6dp - 12dp - 8dp + 8dp + 4dp + 112dp + 20dp + 20dp + 8dp + 8dp + 4dp + 10dp diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d1155462..fe0d2ef2 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -37,6 +37,15 @@ 어? 집 앞에 이건 뭐지? 한 번 열어볼까? + + + 루틴 추가 + 이런 루틴은 어때요? + 전체 루틴 테마 + 사람들과 어울리는 + 관계 쌓기 + + 행복 루틴 행복 루틴은 행복한 나를 매일\n조금씩 만들어 가는 특별한 루틴이야 @@ -180,6 +189,10 @@ Binding not initialized to reference the view. https://play.google.com/store/apps/details?id=com.sopetit.softie + + 루틴메이커 테마란? + 전문가들이 만드는 루틴을 직접 실천해 볼 수 있는 테마에요. + 소프티엔 총 2가지 루틴이 있어요! 솜뭉치를 얻으면? diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index 45dd3a3b..a1270bff 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -52,4 +52,10 @@ @color/selector_happy_type_text_color + +