-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
23 changed files
with
910 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
domain/src/main/kotlin/co/orange/domain/entity/response/AddressInfoModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package co.orange.domain.entity.response | ||
|
||
data class AddressInfoModel( | ||
val recipient: String, | ||
val zipCode: String, | ||
val address: String, | ||
val phone: String | ||
) |
17 changes: 17 additions & 0 deletions
17
domain/src/main/kotlin/co/orange/domain/entity/response/BuyDetailModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package co.orange.domain.entity.response | ||
|
||
import co.orange.domain.enums.OrderStatus | ||
|
||
data class BuyDetailModel( | ||
val orderId: String, | ||
val orderStatus: OrderStatus, | ||
val productName: String, | ||
val imgUrl: String, | ||
val originPrice: Int, | ||
val sellerNickname: String, | ||
val addressInfo: List<AddressInfoModel>, | ||
val paymentInfo: List<PaymentInfoModel>, | ||
val discountPrice: Int, | ||
val charge: Int, | ||
val totalPrice: Int, | ||
) |
11 changes: 11 additions & 0 deletions
11
domain/src/main/kotlin/co/orange/domain/entity/response/BuyInfoModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package co.orange.domain.entity.response | ||
|
||
data class BuyInfoModel( | ||
val productName: String, | ||
val imgUrl: String, | ||
val originPrice: Int, | ||
val addressInfo: List<AddressInfoModel>, | ||
val discountPrice: Int, | ||
val charge: Int, | ||
val totalPrice: Int, | ||
) |
6 changes: 6 additions & 0 deletions
6
domain/src/main/kotlin/co/orange/domain/entity/response/PaymentInfoModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package co.orange.domain.entity.response | ||
|
||
data class PaymentInfoModel( | ||
val method: String, | ||
val completedAt: String | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package co.orange.domain.enums | ||
|
||
enum class OrderStatus { | ||
ORDER_PLACED, SHIPPING, COMPLETED, CANCELLED | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
presentation/src/main/java/co/orange/presentation/buy/finished/BuyFinishedActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
package co.orange.presentation.buy.finished | ||
|
||
import android.content.Context | ||
import android.content.Intent | ||
import android.os.Bundle | ||
import androidx.activity.viewModels | ||
import co.orange.domain.entity.response.BuyDetailModel | ||
import co.orange.presentation.main.MainActivity | ||
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.ActivityBuyFinishedBinding | ||
|
||
@AndroidEntryPoint | ||
class BuyFinishedActivity : | ||
BaseActivity<ActivityBuyFinishedBinding>(R.layout.activity_buy_finished) { | ||
private val viewModel by viewModels<BuyFinishedViewModel>() | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
|
||
initReturnBtnListener() | ||
initDetailBtnListener() | ||
getIntentInfo() | ||
setIntentUi(viewModel.mockBuyInfo) | ||
} | ||
|
||
private fun initReturnBtnListener() { | ||
binding.btnHome.setOnSingleClickListener { navigateToHome() } | ||
binding.btnKeepShopping.setOnSingleClickListener { navigateToHome() } | ||
} | ||
|
||
private fun navigateToHome() { | ||
Intent(this, MainActivity::class.java).apply { | ||
addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP) | ||
addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP) | ||
startActivity(this) | ||
} | ||
} | ||
|
||
private fun initDetailBtnListener() { | ||
// TODO | ||
binding.btnShowDetail.setOnSingleClickListener { } | ||
} | ||
|
||
private fun getIntentInfo() { | ||
viewModel.productId = intent.getLongExtra(EXTRA_PRODUCT_ID, -1) | ||
} | ||
|
||
private fun setIntentUi(item: BuyDetailModel) { | ||
with(binding) { | ||
tvFinishedTransaction.text = | ||
getString(R.string.transaction_id, item.orderId).breakLines() | ||
ivFinishedItem.load(item.imgUrl) | ||
tvFinishedItemName.text = item.productName | ||
tvFinishedItemPrice.text = item.originPrice.setNumberForm() | ||
tvFinishedDeliveryName.text = item.addressInfo[0].recipient | ||
tvFinishedDeliveryAddress.text = getString( | ||
R.string.address_format, | ||
item.addressInfo[0].zipCode, | ||
item.addressInfo[0].address | ||
).breakLines() | ||
tvFinishedDeliveryPhone.text = item.addressInfo[0].phone | ||
tvFinishedTransactionMethod.text = item.paymentInfo[0].method | ||
tvFinishedTransactionDate.text = item.paymentInfo[0].completedAt | ||
tvFinishedPayMoney.text = item.originPrice.setNumberForm() | ||
tvFinishedPayDiscount.text = getString(R.string.add_minus, item.discountPrice.setNumberForm()) | ||
tvFinishedPayCharge.text = getString(R.string.add_plus, item.charge.setNumberForm()) | ||
tvFinishedPayTotal.text = item.totalPrice.setNumberForm() | ||
} | ||
} | ||
|
||
|
||
companion object { | ||
private const val EXTRA_PRODUCT_ID = "EXTRA_PRODUCT_ID" | ||
|
||
@JvmStatic | ||
fun createIntent( | ||
context: Context, | ||
productId: Long | ||
): Intent = Intent(context, BuyFinishedActivity::class.java).apply { | ||
putExtra(EXTRA_PRODUCT_ID, productId) | ||
} | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
presentation/src/main/java/co/orange/presentation/buy/finished/BuyFinishedViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package co.orange.presentation.buy.finished | ||
|
||
import androidx.lifecycle.ViewModel | ||
import co.orange.domain.entity.response.AddressInfoModel | ||
import co.orange.domain.entity.response.BuyDetailModel | ||
import co.orange.domain.entity.response.PaymentInfoModel | ||
import co.orange.domain.enums.OrderStatus | ||
import dagger.hilt.android.lifecycle.HiltViewModel | ||
import javax.inject.Inject | ||
|
||
@HiltViewModel | ||
class BuyFinishedViewModel | ||
@Inject | ||
constructor( | ||
// private val feedRepository: FeedRepository, | ||
) : ViewModel() { | ||
|
||
var productId: Long = -1 | ||
|
||
val mockBuyInfo = BuyDetailModel( | ||
"123e4567-e89b-12d3-a456-426614174000", | ||
OrderStatus.ORDER_PLACED, | ||
"상품이름은 한줄로만 보여줄거에야야야야야야", | ||
"https://github.com/Marchbreeze/Marchbreeze/assets/97405341/cd2c0454-92b4-41e7-ae2f-319f83e2426f", | ||
24000, | ||
"등둔", | ||
listOf( | ||
AddressInfoModel( | ||
"김상호", | ||
"04567", | ||
"서울특벌시 성동구 성수이로 137 107동 903호", | ||
"010-3259-0327" | ||
) | ||
), | ||
listOf( | ||
PaymentInfoModel( | ||
"NAVERPAY", | ||
"2024.06.06" | ||
) | ||
), | ||
3000, | ||
350, | ||
21350 | ||
) | ||
} |
Oops, something went wrong.