diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 8e1e0e2..1842728 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -23,19 +23,16 @@
tools:ignore="LockedOrientationActivity">
-
-
-
@@ -46,5 +43,4 @@
android:screenOrientation="portrait"
tools:ignore="LockedOrientationActivity" />
-
diff --git a/app/src/main/java/org/sopt/tabling/data/ApiFactory.kt b/app/src/main/java/org/sopt/tabling/data/ApiFactory.kt
index 848c135..d740d25 100644
--- a/app/src/main/java/org/sopt/tabling/data/ApiFactory.kt
+++ b/app/src/main/java/org/sopt/tabling/data/ApiFactory.kt
@@ -6,6 +6,7 @@ import okhttp3.MediaType.Companion.toMediaType
import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import org.sopt.tabling.BuildConfig
+import org.sopt.tabling.data.service.PopularStoreService
import retrofit2.Retrofit
object ApiFactory {
@@ -27,5 +28,5 @@ object ApiFactory {
}
object ServicePool {
- // TODO
+ val popularStoreService = ApiFactory.create()
}
diff --git a/app/src/main/java/org/sopt/tabling/data/service/PopularStoreService.kt b/app/src/main/java/org/sopt/tabling/data/service/PopularStoreService.kt
new file mode 100644
index 0000000..56dee26
--- /dev/null
+++ b/app/src/main/java/org/sopt/tabling/data/service/PopularStoreService.kt
@@ -0,0 +1,9 @@
+package org.sopt.tabling.data.service
+
+import org.sopt.tabling.data.model.response.ResponsePopularStoreDto
+import retrofit2.http.GET
+
+interface PopularStoreService {
+ @GET("/shops")
+ suspend fun getPopularStore(): ResponsePopularStoreDto
+}
diff --git a/app/src/main/java/org/sopt/tabling/presentation/store/PopularStoreActivity.kt b/app/src/main/java/org/sopt/tabling/presentation/store/PopularStoreActivity.kt
index 1f8ca10..6833c85 100644
--- a/app/src/main/java/org/sopt/tabling/presentation/store/PopularStoreActivity.kt
+++ b/app/src/main/java/org/sopt/tabling/presentation/store/PopularStoreActivity.kt
@@ -2,7 +2,6 @@ package org.sopt.tabling.presentation.store
import android.os.Bundle
import androidx.activity.viewModels
-import androidx.lifecycle.Observer
import org.sopt.tabling.R
import org.sopt.tabling.databinding.ActivityPopularStoreBinding
import org.sopt.tabling.util.binding.BindingActivity
@@ -16,7 +15,7 @@ class PopularStoreActivity :
super.onCreate(savedInstanceState)
binding.storeViewModel = storeViewModel
- storeViewModel.setDummyList()
+ storeViewModel.getPopularStoreList()
initAdapter()
setPopularStoreList()
}
@@ -27,11 +26,8 @@ class PopularStoreActivity :
}
private fun setPopularStoreList() {
- storeViewModel.popularStoreList.observe(
- this,
- Observer { storeList ->
- popularStoreAdapter.setStoreList(storeList)
- }
- )
+ storeViewModel.popularStoreList.observe(this) { storeList ->
+ popularStoreAdapter.setStoreList(storeList)
+ }
}
}
diff --git a/app/src/main/java/org/sopt/tabling/presentation/store/StoreViewModel.kt b/app/src/main/java/org/sopt/tabling/presentation/store/StoreViewModel.kt
index 9a95a48..2226550 100644
--- a/app/src/main/java/org/sopt/tabling/presentation/store/StoreViewModel.kt
+++ b/app/src/main/java/org/sopt/tabling/presentation/store/StoreViewModel.kt
@@ -2,81 +2,24 @@ package org.sopt.tabling.presentation.store
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
+import androidx.lifecycle.viewModelScope
+import kotlinx.coroutines.launch
+import org.sopt.tabling.data.ServicePool
import org.sopt.tabling.data.model.response.ResponsePopularStoreDto
+import timber.log.Timber
class StoreViewModel : ViewModel() {
private val _popularStoreList = MutableLiveData>()
val popularStoreList = _popularStoreList
- fun setDummyList() {
- _popularStoreList.value = listOf(
- ResponsePopularStoreDto.StoreData(
- 1,
- "파이브가이즈 여의도",
- 3.0,
- 64,
- "양식",
- "여의도동",
- 4753,
- 14,
- "https://github-production-user-asset-6210df.s3.amazonaws.com/67463603/284251896-4d2f58ad-11c6-466a-828a-bd4290e064e9.png"
- ),
- ResponsePopularStoreDto.StoreData(
- 2,
- "파이브가이즈 여의도",
- 3.0,
- 64,
- "양식",
- "여의도동",
- 4753,
- 14,
- "https://github-production-user-asset-6210df.s3.amazonaws.com/67463603/284251896-4d2f58ad-11c6-466a-828a-bd4290e064e9.png"
- ),
- ResponsePopularStoreDto.StoreData(
- 3,
- "청화옥 방이점",
- 2.0,
- 300,
- "양식",
- "방이동",
- 1083,
- 0,
- "https://github-production-user-asset-6210df.s3.amazonaws.com/67463603/284251896-4d2f58ad-11c6-466a-828a-bd4290e064e9.png"
- ),
- ResponsePopularStoreDto.StoreData(
- 4,
- "청화옥 사당직영점",
- 5.0,
- 300,
- "양식",
- "사당동",
- 852,
- 0,
- "https://github-production-user-asset-6210df.s3.amazonaws.com/67463603/284251896-4d2f58ad-11c6-466a-828a-bd4290e064e9.png"
- ),
-
- ResponsePopularStoreDto.StoreData(
- 5,
- "청화옥 양재점",
- 4.0,
- 300,
- "양식",
- "양재동",
- 773,
- 1,
- "https://github-production-user-asset-6210df.s3.amazonaws.com/67463603/284251896-4d2f58ad-11c6-466a-828a-bd4290e064e9.png"
- ),
- ResponsePopularStoreDto.StoreData(
- 6,
- "아라네 부대찌개 여의도점",
- 3.0,
- 300,
- "양식",
- "여의도동",
- 631,
- 0,
- "https://github-production-user-asset-6210df.s3.amazonaws.com/67463603/284251896-4d2f58ad-11c6-466a-828a-bd4290e064e9.png"
- ),
- )
+ fun getPopularStoreList() {
+ viewModelScope.launch {
+ val response = runCatching { ServicePool.popularStoreService.getPopularStore() }
+ response.onSuccess { data ->
+ _popularStoreList.value = data.storeData.sortedBy { it.shopId }
+ }.onFailure {
+ Timber.tag("API").d("error")
+ }
+ }
}
}
diff --git a/app/src/main/res/drawable/shape_gray_200_6.xml b/app/src/main/res/drawable/shape_gray_200_6.xml
new file mode 100644
index 0000000..438ca7e
--- /dev/null
+++ b/app/src/main/res/drawable/shape_gray_200_6.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_popular_store.xml b/app/src/main/res/layout/activity_popular_store.xml
index e368126..7c994f3 100644
--- a/app/src/main/res/layout/activity_popular_store.xml
+++ b/app/src/main/res/layout/activity_popular_store.xml
@@ -59,7 +59,7 @@
@@ -130,6 +130,7 @@
android:layout_marginTop="16dp"
android:text="@string/popular_store_avg_personnel"
android:textAppearance="@style/TextAppearance.Caption1.SemiBold"
+ android:textColor="@color/gray_400"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/view_popular_store_horizontal_1dp" />
@@ -139,6 +140,7 @@
android:layout_height="wrap_content"
android:text="@string/popular_store_standard"
android:textAppearance="@style/TextAppearance.Caption1.Regular"
+ android:textColor="@color/gray_400"
app:layout_constraintBottom_toBottomOf="@id/tv_popular_store_avg_people_number"
app:layout_constraintStart_toEndOf="@id/tv_popular_store_avg_people_number"
app:layout_constraintTop_toTopOf="@id/tv_popular_store_avg_people_number" />
@@ -162,6 +164,7 @@
android:layout_marginStart="2dp"
android:text="@string/popular_store_BEST"
android:textAppearance="@style/TextAppearance.Body1.SemiBold"
+ android:textColor="@color/gray_800"
app:layout_constraintBottom_toBottomOf="@id/tv_popular_store_area"
app:layout_constraintStart_toEndOf="@id/tv_popular_store_area"
app:layout_constraintTop_toTopOf="@id/tv_popular_store_area" />
@@ -169,13 +172,13 @@
diff --git a/app/src/main/res/layout/item_popular_store.xml b/app/src/main/res/layout/item_popular_store.xml
index c159f21..991645a 100644
--- a/app/src/main/res/layout/item_popular_store.xml
+++ b/app/src/main/res/layout/item_popular_store.xml
@@ -16,21 +16,28 @@
+ tools:text="10" />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ android:layout_marginStart="@dimen/spacing12"
+ app:layout_constraintBottom_toBottomOf="@+id/iv_popular_store"
+ app:layout_constraintStart_toEndOf="@+id/iv_popular_store"
+ app:layout_constraintTop_toTopOf="@+id/iv_popular_store">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml
index 542b275..b33c59b 100644
--- a/app/src/main/res/values/themes.xml
+++ b/app/src/main/res/values/themes.xml
@@ -129,7 +129,15 @@