Skip to content

Commit

Permalink
[MERGE] #31 -> develop
Browse files Browse the repository at this point in the history
[UI/#31] 판매 상세뷰 / UI 구현
  • Loading branch information
Marchbreeze authored Jun 29, 2024
2 parents 84252bc + fbaa2ee commit dd82450
Show file tree
Hide file tree
Showing 13 changed files with 645 additions and 6 deletions.
5 changes: 5 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@
android:exported="false"
android:screenOrientation="portrait" />

<activity
android:name="co.orange.presentation.sell.info.SellInfoActivity"
android:exported="false"
android:screenOrientation="portrait" />

</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package co.orange.domain.entity.response

import co.orange.domain.enums.ItemStatus
import co.orange.domain.enums.OrderStatus

data class SellDetailModel(
val itemId: String,
val itemStatus: ItemStatus,
val productName: String,
val imgUrl: String,
val originPrice: Int,
val salePrice: Int,
val orderId: String,
val orderStatus: OrderStatus,
val buyerNickname: String,
val addressInfo: List<AddressInfoModel>,
val paymentInfo: List<PaymentInfoModel>,
)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package co.orange.domain.entity.response

data class SellItemModel(
data class SellProductModel(
val productId: Long,
val productName: String,
val originPrice: Int,
Expand Down
8 changes: 8 additions & 0 deletions domain/src/main/kotlin/co/orange/domain/enums/ItemStatus.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package co.orange.domain.enums

enum class ItemStatus {
ON_SALE,
IN_TRANSACTION,
CLOSED,
EXPIRED,
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.activity.viewModels
import co.orange.domain.entity.response.SellItemModel
import co.orange.domain.entity.response.SellProductModel
import co.orange.presentation.sell.push.SellPushActivity
import coil.load
import dagger.hilt.android.AndroidEntryPoint
Expand Down Expand Up @@ -59,7 +59,7 @@ class SellConfirmActivity :
viewModel.productId = intent.getLongExtra(EXTRA_PRODUCT_ID, -1)
}

private fun setIntentUi(item: SellItemModel) {
private fun setIntentUi(item: SellProductModel) {
with(binding) {
tvSellInfoName.text = item.productName
tvSellInfoOriginPrice.text = item.originPrice.setNumberForm()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package co.orange.presentation.sell.confirm

import androidx.lifecycle.ViewModel
import co.orange.domain.entity.response.SellItemModel
import co.orange.domain.entity.response.SellProductModel
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject

Expand All @@ -14,7 +14,7 @@ class SellConfirmViewModel
var productId: Long = -1

var mockSellInfo =
SellItemModel(
SellProductModel(
1102303002,
"딴지 키링 세트",
9000,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import android.os.Bundle
import androidx.activity.viewModels
import co.orange.domain.entity.response.SellInfoModel
import co.orange.presentation.main.MainActivity
import co.orange.presentation.sell.info.SellInfoActivity
import coil.load
import dagger.hilt.android.AndroidEntryPoint
import kr.genti.core.base.BaseActivity
Expand Down Expand Up @@ -41,7 +42,9 @@ class SellFinishedActivity :

private fun initDetailBtnListener() {
binding.btnProductDetail.setOnSingleClickListener {
// TODO
SellInfoActivity.createIntent(this, viewModel.itemId).apply {
startActivity(this)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
package co.orange.presentation.sell.info

import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.activity.viewModels
import co.orange.domain.entity.response.SellDetailModel
import coil.load
import dagger.hilt.android.AndroidEntryPoint
import kr.genti.core.base.BaseActivity
import kr.genti.core.extension.breakLines
import kr.genti.core.extension.setNumberForm
import kr.genti.core.extension.setOnSingleClickListener
import kr.genti.presentation.R
import kr.genti.presentation.databinding.ActivitySellInfoBinding

@AndroidEntryPoint
class SellInfoActivity :
BaseActivity<ActivitySellInfoBinding>(R.layout.activity_sell_info) {
private val viewModel by viewModels<SellInfoViewModel>()

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

initExitBtnListener()
initFixPurchaseBtnListener()
getIntentInfo()
setIntentUi(viewModel.mockSellInfo)
}

private fun initExitBtnListener() {
binding.btnExit.setOnSingleClickListener { finish() }
}

private fun initFixPurchaseBtnListener() {
// TODO
binding.btnFixSell.setOnSingleClickListener { }
}

private fun getIntentInfo() {
viewModel.productId = intent.getLongExtra(EXTRA_PRODUCT_ID, -1)
}

private fun setIntentUi(item: SellDetailModel) {
with(binding) {
tvInfoTransaction.text = getString(R.string.transaction_id, item.orderId).breakLines()
ivInfoProduct.load(item.imgUrl)
tvInfoProductName.text = item.productName
tvInfoProductPrice.text = item.originPrice.setNumberForm()
tvInfoBuyerNickname.text = item.buyerNickname
tvInfoDeliveryName.text = item.addressInfo[0].recipient
tvInfoDeliveryAddress.text =
getString(
R.string.address_format,
item.addressInfo[0].zipCode,
item.addressInfo[0].address,
).breakLines()
tvInfoDeliveryPhone.text = item.addressInfo[0].phone
tvInfoTransactionMethod.text = item.paymentInfo[0].method
tvInfoTransactionDate.text = item.paymentInfo[0].completedAt
tvInfoPayKakao.text = item.originPrice.setNumberForm()
tvInfoPayReal.text = item.salePrice.setNumberForm()
tvInfoPayTotal.text = item.salePrice.setNumberForm()
}
}

companion object {
private const val EXTRA_PRODUCT_ID = "EXTRA_PRODUCT_ID"

@JvmStatic
fun createIntent(
context: Context,
productId: Long,
): Intent =
Intent(context, SellInfoActivity::class.java).apply {
putExtra(EXTRA_PRODUCT_ID, productId)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package co.orange.presentation.sell.info

import androidx.lifecycle.ViewModel
import co.orange.domain.entity.response.AddressInfoModel
import co.orange.domain.entity.response.PaymentInfoModel
import co.orange.domain.entity.response.SellDetailModel
import co.orange.domain.enums.ItemStatus
import co.orange.domain.enums.OrderStatus
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject

@HiltViewModel
class SellInfoViewModel
@Inject
constructor(
// private val feedRepository: FeedRepository,
) : ViewModel() {
var productId: Long = -1

val mockSellInfo =
SellDetailModel(
"1",
ItemStatus.ON_SALE,
"상품이름은 한줄로만 보여줄거에야야야야야야",
"https://github.com/Marchbreeze/Marchbreeze/assets/97405341/cd2c0454-92b4-41e7-ae2f-319f83e2426f",
24000,
21000,
"123e4567-e89b-12d3-a456-426614174000",
OrderStatus.ORDER_PLACED,
"등둔",
listOf(
AddressInfoModel(
"김상호",
"04567",
"서울특벌시 성동구 성수이로 137 107동 903호",
"010-3259-0327",
),
),
listOf(
PaymentInfoModel(
"NAVERPAY",
"2024.06.06",
),
),
)
}
9 changes: 9 additions & 0 deletions presentation/src/main/res/drawable/ic_tooltip_bottom.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="21dp"
android:height="14dp"
android:viewportWidth="21"
android:viewportHeight="14">
<path
android:pathData="M8,12.229C12.168,5.858 4.07,2.412 0,2.067L21,0C15.791,7.235 4,18.344 8,12.229Z"
android:fillColor="#FF6C6C"/>
</vector>
6 changes: 6 additions & 0 deletions presentation/src/main/res/drawable/shape_red_fill_5_rect.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">
<solid android:color="@color/seg_red" />
<corners
android:radius="5dp" />
</shape>
Loading

0 comments on commit dd82450

Please sign in to comment.