Skip to content

Commit

Permalink
Merge pull request #311 from BCSDLab/feature/account_number
Browse files Browse the repository at this point in the history
[Feature] 가게 계좌번호 복사 기능
  • Loading branch information
hsgo2430 authored Jul 6, 2024
2 parents fc399fe + d0e745b commit 87e928f
Show file tree
Hide file tree
Showing 9 changed files with 158 additions and 5 deletions.
31 changes: 31 additions & 0 deletions core/src/main/res/drawable/fi_info.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="16dp"
android:height="16dp"
android:viewportWidth="16"
android:viewportHeight="16">
<group>
<clip-path
android:pathData="M0,0h16v16h-16z"/>
<path
android:strokeWidth="1"
android:pathData="M8,14.667C11.682,14.667 14.666,11.682 14.666,8C14.666,4.318 11.682,1.334 8,1.334C4.318,1.334 1.333,4.318 1.333,8C1.333,11.682 4.318,14.667 8,14.667Z"
android:strokeLineJoin="round"
android:fillColor="#00000000"
android:strokeColor="#CACACA"
android:strokeLineCap="round"/>
<path
android:strokeWidth="1"
android:pathData="M8,10.667V8"
android:strokeLineJoin="round"
android:fillColor="#00000000"
android:strokeColor="#CACACA"
android:strokeLineCap="round"/>
<path
android:strokeWidth="1"
android:pathData="M8,5.333H8.007"
android:strokeLineJoin="round"
android:fillColor="#00000000"
android:strokeColor="#CACACA"
android:strokeLineCap="round"/>
</group>
</vector>
9 changes: 9 additions & 0 deletions core/src/main/res/drawable/ic_copy.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M16,20H8C7.204,20 6.441,19.684 5.879,19.121C5.316,18.559 5,17.796 5,17V7C5,6.735 4.895,6.48 4.707,6.293C4.52,6.105 4.265,6 4,6C3.735,6 3.48,6.105 3.293,6.293C3.105,6.48 3,6.735 3,7V17C3,18.326 3.527,19.598 4.464,20.535C5.402,21.473 6.674,22 8,22H16C16.265,22 16.52,21.895 16.707,21.707C16.895,21.52 17,21.265 17,21C17,20.735 16.895,20.48 16.707,20.293C16.52,20.105 16.265,20 16,20ZM10,13C10,13.265 10.105,13.52 10.293,13.707C10.48,13.895 10.735,14 11,14H16C16.265,14 16.52,13.895 16.707,13.707C16.895,13.52 17,13.265 17,13C17,12.735 16.895,12.48 16.707,12.293C16.52,12.105 16.265,12 16,12H11C10.735,12 10.48,12.105 10.293,12.293C10.105,12.48 10,12.735 10,13ZM21,8.94C20.99,8.848 20.969,8.758 20.94,8.67V8.58C20.892,8.477 20.828,8.383 20.75,8.3L14.75,2.3C14.667,2.222 14.573,2.158 14.47,2.11C14.44,2.106 14.41,2.106 14.38,2.11C14.278,2.052 14.166,2.014 14.05,2H10C9.204,2 8.441,2.316 7.879,2.879C7.316,3.441 7,4.204 7,5V15C7,15.796 7.316,16.559 7.879,17.121C8.441,17.684 9.204,18 10,18H18C18.796,18 19.559,17.684 20.121,17.121C20.684,16.559 21,15.796 21,15V9C21,9 21,9 21,8.94ZM15,5.41L17.59,8H16C15.735,8 15.48,7.895 15.293,7.707C15.105,7.52 15,7.265 15,7V5.41ZM19,15C19,15.265 18.895,15.52 18.707,15.707C18.52,15.895 18.265,16 18,16H10C9.735,16 9.48,15.895 9.293,15.707C9.105,15.52 9,15.265 9,15V5C9,4.735 9.105,4.48 9.293,4.293C9.48,4.105 9.735,4 10,4H13V7C13.003,7.341 13.064,7.679 13.18,8H11C10.735,8 10.48,8.105 10.293,8.293C10.105,8.48 10,8.735 10,9C10,9.265 10.105,9.52 10.293,9.707C10.48,9.895 10.735,10 11,10H19V15Z"
android:fillColor="#858585"/>
</vector>
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ fun StoreItemWithMenusResponse.toStoreWithMenu(): StoreWithMenu = StoreWithMenu(
deliveryPrice = deliveryPrice ?: 0,
isCardOk = isCardOk ?: false,
isBankOk = isBankOk ?: false,
updateAt = updateAt,
isEvent = isEvent ?: false,
open = open?.filter { it.dayOfWeek == localDayOfWeekName }?.map {
Store.OpenData(
dayOfWeek = it.dayOfWeek ?: "",
Expand All @@ -81,7 +83,9 @@ fun StoreItemWithMenusResponse.toStoreWithMenu(): StoreWithMenu = StoreWithMenu(
}.orEmpty().getOrElse(0) { Store.OpenData(localDayOfWeekName, false, "00:00", "00,00") },
imageUrls = imageUrls ?: emptyList(),
shopCategories = shopCategories?.map { it.toCategory() }.orEmpty(),
menuCategories = menuCategories?.map { it.toCategory() }.orEmpty()
menuCategories = menuCategories?.map { it.toCategory() }.orEmpty(),
bank = bank ?: null,
accountNumber = accountNumber ?: null
)

fun StoreItemWithMenusResponse.CategoriesResponseDTO.toCategory() = StoreWithMenu.Category(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@ data class StoreItemWithMenusResponse(
@SerializedName("pay_bank") val isBankOk: Boolean?,
@SerializedName("open") val open: List<StoreItemResponse.OpenResponseDTO>?,
@SerializedName("image_urls") val imageUrls: ArrayList<String>?,
@SerializedName("updated_at") val updateAt: String,
@SerializedName("is_event") val isEvent: Boolean?,
@SerializedName("shop_categories") val shopCategories: List<CategoriesResponseDTO>?,
@SerializedName("menu_categories") val menuCategories: List<CategoriesResponseDTO>?,
@SerializedName("bank") val bank: String,
@SerializedName("account_number") val accountNumber: String
) {
data class CategoriesResponseDTO(
@SerializedName("id")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ data class Store(
val isEvent: Boolean,
val isOpen: Boolean,
val open: OpenData,
val categoryIds: List<StoreCategory?>,
val categoryIds: List<StoreCategory?>
) {
data class OpenData(
val dayOfWeek: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ data class StoreWithMenu(
val isBankOk: Boolean,
val open: Store.OpenData,
val imageUrls: List<String>?,
val updateAt: String,
val isEvent: Boolean?,
val shopCategories: List<Category>?,
val menuCategories: List<Category>?,
val bank: String?,
val accountNumber: String?
) {
data class Category(
val id: Int,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package `in`.koreatech.koin.ui.store.activity

import android.Manifest
import android.content.ClipData
import android.content.ClipboardManager
import android.os.Bundle
import android.util.Log
import android.widget.TextView
import androidx.activity.result.contract.ActivityResultContracts
import androidx.activity.viewModels
Expand Down Expand Up @@ -123,6 +126,18 @@ class StoreDetailActivity : KoinNavigationDrawerActivity() {
override fun onTabReselected(p0: TabLayout.Tab?) {}
})

binding.storeDetailAccountCopyButton.setOnClickListener {

val clipboardManager = getSystemService(CLIPBOARD_SERVICE) as ClipboardManager
val clipData = ClipData.newPlainText(
getString(R.string.account_number),
binding.storeDetailAccountTextview.text
)
clipboardManager.setPrimaryClip(clipData)

ToastUtil.getInstance().makeShort(getString(R.string.store_account_copy))
}

initViewModel()
val storeId = intent.extras?.getInt(StoreDetailActivityContract.STORE_ID)
if (storeId == null) {
Expand Down Expand Up @@ -198,12 +213,23 @@ class StoreDetailActivity : KoinNavigationDrawerActivity() {
storeDetailEtcTextview.text = it.description
}

if(it.bank == null){
storeDetailAccountTextview.isVisible = false
storeDetailConstAccountTextview.isVisible = false
storeDetailAccountCopyButton.isVisible = false
}
else{
storeDetailAccountTextview.text = it.bank + " " + it.accountNumber
}

setEtcInfo(storeDetailIsCardTextview, it.isCardOk)
//카드결제
setEtcInfo(storeDetailIsCardTextview, it.isCardOk)
//계좌이체
setEtcInfo(storeDetailIsBankTextview, it.isBankOk)

updateInfoTv.text = getString(R.string.store_update_at, it.updateAt.replace("-", "."))

binding.storeDetailImageview.apply {
adapter = StoreDetailImageViewpagerAdapter(it.imageUrls)

Expand Down
77 changes: 74 additions & 3 deletions koin/src/main/res/layout/store_activity_detail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,53 @@
app:barrierDirection="bottom"
app:constraint_referenced_ids="store_detail_const_deliver_textview, store_detail_deliver_textview" />

<TextView
android:id="@+id/store_detail_const_account_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:includeFontPadding="false"
android:text="@string/account_number"
android:textColor="@color/gray9"
android:textSize="15sp"
app:fontName="Custom6"
app:layout_constraintStart_toStartOf="@+id/guideline_start"
app:layout_constraintTop_toBottomOf="@+id/barrier_deliver" />

<TextView
android:id="@+id/store_detail_account_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:includeFontPadding="false"
android:lineSpacingExtra="5sp"
android:textColor="@color/black"
android:textSize="15sp"
app:fontName="Custom6"
app:layout_constraintBaseline_toBaselineOf="@id/store_detail_const_account_textview"
app:layout_constraintEnd_toStartOf="@+id/guideline_end"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintStart_toEndOf="@+id/store_detail_const_account_textview"
tools:text="국민 00000-11-22222" />

<ImageView
android:id="@+id/store_detail_account_copy_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_copy"
android:layout_marginStart="10dp"
app:layout_constraintTop_toTopOf="@id/store_detail_account_textview"
app:layout_constraintBottom_toBottomOf="@id/store_detail_account_textview"
app:layout_constraintStart_toEndOf="@id/store_detail_account_textview"
/>

<androidx.constraintlayout.widget.Barrier
android:id="@+id/barrier_account"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:barrierDirection="bottom"
app:constraint_referenced_ids="store_detail_const_account_textview, store_detail_account_copy_button" />

<TextView
android:id="@+id/store_detail_const_etc_textview"
android:layout_width="wrap_content"
Expand All @@ -260,7 +307,7 @@
android:textSize="15sp"
app:fontName="Custom6"
app:layout_constraintStart_toStartOf="@+id/guideline_start"
app:layout_constraintTop_toBottomOf="@+id/barrier_deliver" />
app:layout_constraintTop_toBottomOf="@+id/barrier_account" />


<TextView
Expand Down Expand Up @@ -336,14 +383,38 @@
app:layout_constraintStart_toEndOf="@+id/store_detail_is_card_textview"
app:layout_constraintTop_toBottomOf="@+id/barrier_etc" />

<ImageView
android:id="@+id/update_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/fi_info"
android:layout_marginTop="45dp"
app:layout_constraintStart_toStartOf="@+id/guideline_start"
app:layout_constraintTop_toBottomOf="@+id/store_detail_is_delivery_textview"
/>

<TextView
android:id="@+id/update_info_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2024.03.09 업데이트"
android:textSize="12dp"
android:textColor="@color/gray15"
android:gravity="center"
android:layout_marginStart="4dp"
app:layout_constraintStart_toEndOf="@+id/update_info"
app:layout_constraintTop_toTopOf="@+id/update_info"
app:layout_constraintBottom_toBottomOf="@+id/update_info"
/>

<FrameLayout
android:id="@+id/border_frameLayout"
android:layout_width="match_parent"
android:layout_height="12dp"
android:layout_marginTop="32dp"
android:layout_marginTop="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/store_detail_is_bank_textview"
app:layout_constraintTop_toBottomOf="@+id/update_info"
app:layout_goneMarginTop="72dp">

<ImageView
Expand Down
4 changes: 4 additions & 0 deletions koin/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,9 @@
<string name="store_at_here">%1$s에서</string>
<string name="store_neun">%1$s는 준비 중 입니다.</string>
<string name="store_eun">%1$s은 준비 중 입니다.</string>
<string name="store_update_at">%1$s 업데이트</string>
<string name="store_account_copy">계좌번호 복사 완료!</string>


<!-- version update -->
<string name="version_update_message_required">필수 업데이트가 있습니다.\n업데이트 하시겠습니까?</string>
Expand Down Expand Up @@ -434,6 +437,7 @@
<string name="operating_time">운영시간</string>
<string name="address">주소정보</string>
<string name="delivery_fee">배달금액</string>
<string name="account_number">계좌번호</string>
<string name="other_info">기타정보</string>
<string name="delivery_available">#배달가능</string>
<string name="card_available">#카드가능</string>
Expand Down

0 comments on commit 87e928f

Please sign in to comment.