Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT] Home Sdui sectionSubItem 추가 작업 #202

Merged
merged 6 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.lgtm.android.common_ui.viewholder

import com.lgtm.android.common_ui.databinding.ItemSduiSubItemBinding
import com.lgtm.android.common_ui.util.setOnThrottleClickListener
import com.lgtm.domain.server_drive_ui.SduiContent
import com.lgtm.domain.server_drive_ui.SduiTheme
import com.lgtm.domain.server_drive_ui.SectionSubItemVO

class SduiSubItemViewHolder(
private val binding: ItemSduiSubItemBinding
) : SduiBaseHolder(binding) {
override fun bind(theme: SduiTheme, viewContent: SduiContent) {
binding.data = viewContent as SectionSubItemVO
binding.theme = theme
binding.btnMissionRecommend.setOnThrottleClickListener {
// todo appUrl을 활용한 화면 전환 처리
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.lgtm.android.common_ui.R
import com.lgtm.android.common_ui.databinding.ItemSduiCloserBinding
import com.lgtm.android.common_ui.databinding.ItemSduiEmptyBinding
import com.lgtm.android.common_ui.databinding.ItemSduiItemBinding
import com.lgtm.android.common_ui.databinding.ItemSduiSubItemBinding
import com.lgtm.android.common_ui.databinding.ItemSduiTitleBinding
import com.lgtm.android.common_ui.databinding.ItemSduiUnknownBinding
import com.lgtm.domain.server_drive_ui.SduiViewType
Expand All @@ -24,6 +25,7 @@ fun getSduiViewHolder(parent: ViewGroup, viewType: SduiViewType): SduiBaseHolder
SduiViewType.ITEM -> SduiItemViewHolder(binding as ItemSduiItemBinding)
SduiViewType.CLOSER -> SduiCloserViewHolder(binding as ItemSduiCloserBinding)
SduiViewType.EMPTY -> SduiEmptyViewHolder(binding as ItemSduiEmptyBinding)
SduiViewType.SUBITEM -> SduiSubItemViewHolder(binding as ItemSduiSubItemBinding)
SduiViewType.UNKNOWN -> SduiUnknownViewHolder(binding as ItemSduiUnknownBinding)
}
}
Expand All @@ -34,6 +36,7 @@ private fun getLayoutByViewType(viewType: SduiViewType): Int {
SduiViewType.ITEM -> R.layout.item_sdui_item
SduiViewType.CLOSER -> R.layout.item_sdui_closer
SduiViewType.EMPTY -> R.layout.item_sdui_empty
SduiViewType.SUBITEM -> R.layout.item_sdui_sub_item
SduiViewType.UNKNOWN -> R.layout.item_sdui_unknown
}
}
47 changes: 47 additions & 0 deletions common-ui/src/main/res/layout/item_sdui_sub_item.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">

<data>

<variable
name="data"
type="com.lgtm.domain.server_drive_ui.SectionSubItemVO" />

<variable
name="theme"
type="com.lgtm.domain.server_drive_ui.SduiTheme" />

</data>

<androidx.constraintlayout.widget.ConstraintLayout
setItemLayerBackground="@{theme}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:background="@drawable/rectangle_white_stroke_1_gray_2_side">

<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btn_mission_recommend"
style="?android:attr/borderlessButtonStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="20dp"
android:layout_marginTop="12dp"
android:background="@drawable/rectangle_gray_1_stroke_gray_3_radius_10"
android:drawableEnd="@drawable/ic_next"
android:drawableTint="@color/gray_4"
android:gravity="center_vertical"
android:paddingVertical="15dp"
android:paddingStart="12dp"
android:paddingEnd="10dp"
android:stateListAnimator="@null"
android:textAppearance="@style/Body2"
android:text="@{data.text}"
tools:text="리뷰어님, 이런 미션 만들어주세요!"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>

</androidx.constraintlayout.widget.ConstraintLayout>

</layout>
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import retrofit2.http.Query

interface MissionService {

@GET("v1/home")
@GET("v2/home")
suspend fun getHomeMission(): Response<BaseDTO<SduiDTO>>

@POST("v2/mission")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ enum class SduiViewType(
EMPTY("empty", SectionEmptyVO::class.java),
CLOSER("sectionCloser", SectionCloserVO::class.java),
ITEM("sectionItem", SectionItemVO::class.java),
SUBITEM("sectionSubItem", SectionSubItemVO::class.java),
UNKNOWN("sectionUnknown", SectionUnknownVO::class.java);

companion object {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.lgtm.domain.server_drive_ui

data class SectionSubItemVO(
val text: String,
val appUrl: String?
) : SduiContent
Loading