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

[Fix] 주변 상점 UI 웹, ios와 동기화 #411

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions core/src/main/res/drawable/left_event_arrow.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="17dp"
android:height="16dp"
android:viewportWidth="17"
android:viewportHeight="16">
<group>
<clip-path
android:pathData="M0.5,0h16v16h-16z"/>
<path
android:pathData="M7.7,8L10.3,10.6C10.422,10.722 10.483,10.878 10.483,11.066C10.483,11.255 10.422,11.411 10.3,11.533C10.177,11.655 10.022,11.717 9.833,11.717C9.644,11.717 9.488,11.655 9.366,11.533L6.3,8.467C6.233,8.4 6.186,8.328 6.158,8.25C6.13,8.172 6.116,8.089 6.116,8C6.116,7.911 6.13,7.828 6.158,7.75C6.186,7.672 6.233,7.6 6.3,7.533L9.366,4.467C9.488,4.344 9.644,4.283 9.833,4.283C10.022,4.283 10.177,4.344 10.3,4.467C10.422,4.589 10.483,4.744 10.483,4.933C10.483,5.122 10.422,5.278 10.3,5.4L7.7,8Z"
android:fillColor="#FAFAFA"/>
</group>
</vector>
13 changes: 13 additions & 0 deletions core/src/main/res/drawable/right_event_arrow.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="17dp"
android:height="16dp"
android:viewportWidth="17"
android:viewportHeight="16">
<group>
<clip-path
android:pathData="M16.5,16l-16,-0l-0,-16l16,-0z"/>
<path
android:pathData="M9.3,8L6.7,5.4C6.578,5.278 6.517,5.122 6.517,4.933C6.517,4.745 6.578,4.589 6.7,4.467C6.823,4.345 6.978,4.283 7.167,4.283C7.356,4.283 7.512,4.345 7.634,4.467L10.7,7.533C10.767,7.6 10.814,7.672 10.842,7.75C10.87,7.828 10.884,7.911 10.884,8C10.884,8.089 10.87,8.172 10.842,8.25C10.814,8.328 10.767,8.4 10.7,8.467L7.634,11.533C7.512,11.656 7.356,11.717 7.167,11.717C6.978,11.717 6.823,11.656 6.7,11.533C6.578,11.411 6.517,11.256 6.517,11.067C6.517,10.878 6.578,10.722 6.7,10.6L9.3,8Z"
android:fillColor="#FAFAFA"/>
</group>
</vector>
6 changes: 6 additions & 0 deletions core/src/main/res/drawable/rounded_corners_black.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/black" />
<corners android:radius="5dp" />
</shape>
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class StoreActivity : KoinNavigationDrawerTimeActivity() {
}

private val viewPagerHandler = Handler(Looper.getMainLooper())
private val viewPagerDelayTime = 10000L
private val viewPagerDelayTime = 4000L

private val storeAdapter = StoreRecyclerAdapter().apply {
setOnItemClickListener {
Expand All @@ -94,6 +94,11 @@ class StoreActivity : KoinNavigationDrawerTimeActivity() {
)
storeDetailContract.launch(Pair(it.shopId, getStoreCategoryName(viewModel.category.value)))
}

setOnArrowClickListener {
binding.eventViewPager.setCurrentItem(it, true)
startAutoScroll()
}
}

private val storeCategoriesAdapter = StoreCategoriesRecyclerAdapter().apply {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package `in`.koreatech.koin.ui.store.adapter

import android.util.Log
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.DiffUtil
Expand All @@ -17,17 +18,20 @@ class StoreEventPagerAdapter(): ListAdapter<StoreEvent,StoreEventPagerAdapter.St
){

var onItemClickListener: OnItemClickListener? = null
var onArrowClickListener : OnArrowClickListener? = null

inner class StoreEventCardViewHolder(
val binding: StoreEventCardBinding
): RecyclerView.ViewHolder(binding.root){
val container = binding.storeEventContainer
val eventStoreImage = binding.eventImageView
val eventStoreName = binding.evnetStoreNameTv
val eventStoreName = binding.eventStoreNameTv
val eventLeftArrow = binding.leftEventArrow
val eventRightArrow = binding.rightEventArrow
val eventPagerCounterText = binding.eventPageCounterTextView
fun bind(storeEvent: StoreEvent) {
binding.root.setOnClickListener {
onItemClickListener?.onItemClick(storeEvent)

}
}
}
Expand All @@ -47,9 +51,20 @@ class StoreEventPagerAdapter(): ListAdapter<StoreEvent,StoreEventPagerAdapter.St
bind(event)

eventStoreName.text = event.shopName
eventPagerCounterText.text = "${position + 1}/$itemCount"

eventLeftArrow.setOnClickListener {
val prevPosition = if (position > 0) position - 1 else itemCount - 1
onArrowClickListener?.onArrowClick(prevPosition)
}

eventRightArrow.setOnClickListener {
val nextPosition = (position + 1) % itemCount
onArrowClickListener?.onArrowClick(nextPosition)
}

if(event.thumbnailImages?.isEmpty() == true){
eventStoreImage.setImageResource(R.drawable.event_default)
eventStoreImage.setImageResource(R.drawable.default_event_image)
}
else{
Glide.with(eventStoreImage)
Expand All @@ -69,10 +84,24 @@ class StoreEventPagerAdapter(): ListAdapter<StoreEvent,StoreEventPagerAdapter.St
}
}

inline fun setOnArrowClickListener(crossinline onItemClick: (position: Int) -> Unit){
onArrowClickListener = object :OnArrowClickListener{
override fun onArrowClick(position: Int) {
onItemClick(position)
}
}
}



interface OnItemClickListener {
fun onItemClick(storeEvent: StoreEvent)
}

interface OnArrowClickListener{
fun onArrowClick(position: Int)
}

companion object {
private val diffCallback = object : DiffUtil.ItemCallback<StoreEvent>() {
override fun areItemsTheSame(oldItem: StoreEvent, newItem: StoreEvent): Boolean {
Expand Down
167 changes: 58 additions & 109 deletions koin/src/main/res/layout/store_activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,20 +90,61 @@
android:orientation="vertical"
app:layout_constraintGuide_percent="0.953" />

<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:letterSpacing="-0.04"
android:lineSpacingExtra="7sp"
android:text="카테고리"
android:textColor="@color/black"
android:textSize="15sp"
app:fontName="Custom5"
app:layout_constraintStart_toStartOf="@+id/guideline_category_start"
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/search_constraint_layout"
android:layout_width="match_parent"
android:layout_height="44dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:background="@color/white"
app:layout_constraintTop_toTopOf="parent"
app:layout_goneMarginTop="24dp" />
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toTopOf="@+id/categories_recyclerview">


<ImageView
android:id="@+id/imageView2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.2"
android:background="@color/blue1" />

<EditText
android:id="@+id/search_editText"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="start|center"
android:background="@null"
android:hint="상점명을 입력하세요"
android:imeOptions="actionDone"
android:includeFontPadding="false"
android:lineSpacingExtra="6sp"
android:maxLines="1"
android:padding="13dp"
android:singleLine="true"
android:textColor="@color/gray9"
android:textSize="13sp"
app:fontName="Custom6"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/search_image_view"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

app:fontName 속성은 #330 에서 제거됬어요!

core 모듈 안 text_appearance.xml 에 텍스트 스타일이 정의되어 있으니 피그마에서 사용되는 타이포그래피 기준으로 맞춰서 사용하시면 됩니다!

  android:textAppearance="@style/TextAppearance.Koin.Medium.16"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨겠네요! 감사합니다!


<ImageView
android:id="@+id/search_image_view"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="12dp"
android:background="@drawable/ic_search"
app:layout_constraintBottom_toBottomOf="@+id/imageView2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/imageView2" />

</androidx.constraintlayout.widget.ConstraintLayout>

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/categories_recyclerview"
Expand All @@ -115,7 +156,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textView2"
app:layout_constraintTop_toBottomOf="@id/search_constraint_layout"
app:spanCount="5"
tools:listitem="@layout/store_category_item" />

Expand Down Expand Up @@ -154,114 +195,22 @@
android:id="@+id/event_view_pager"
android:layout_width="match_parent"
android:layout_height="72dp"
android:layout_marginTop="4dp"
android:layout_marginTop="12dp"
android:clipToPadding="false"
app:layout_constraintTop_toBottomOf="@id/category_constraint_layout"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toTopOf="@id/search_constraint_layout"
app:layout_constraintBottom_toTopOf="@id/store_filter_constraint_layout"
tools:listitem="@layout/store_event_card"
/>

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/search_constraint_layout"
android:layout_width="match_parent"
android:layout_height="44dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:background="@color/white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/event_view_pager">


<ImageView
android:id="@+id/imageView2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.2"
android:background="@color/blue1" />

<EditText
android:id="@+id/search_editText"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="start|center"
android:background="@null"
android:hint="상점 검색"
android:imeOptions="actionDone"
android:includeFontPadding="false"
android:lineSpacingExtra="6sp"
android:maxLines="1"
android:padding="13dp"
android:singleLine="true"
android:textColor="@color/gray9"
android:textSize="13sp"
app:fontName="Custom6"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/search_image_view"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />

<ImageView
android:id="@+id/search_image_view"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="12dp"
android:background="@drawable/ic_search"
app:layout_constraintBottom_toBottomOf="@+id/imageView2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/imageView2" />

</androidx.constraintlayout.widget.ConstraintLayout>

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/not_found_constraint_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/white"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/search_constraint_layout">

<ImageView
android:id="@+id/no_search_image_view"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="@drawable/ic_no_search"
app:layout_constraintBottom_toTopOf="@+id/no_search_text_view"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed" />

<TextView
android:id="@+id/no_search_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="검색 결과가 없습니다."
android:textColor="@color/blue8"
android:textSize="13sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/no_search_image_view" />

</androidx.constraintlayout.widget.ConstraintLayout>

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/store_filter_constraint_layout"
android:layout_width="match_parent"
android:layout_height="32dp"
android:layout_marginTop="12dp"
android:layout_marginHorizontal="2dp"
app:layout_constraintTop_toBottomOf="@id/search_constraint_layout"
app:layout_constraintTop_toBottomOf="@id/event_view_pager"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
>
Expand Down
Loading
Loading