diff --git a/android/app/src/main/java/com/ddangddangddang/android/feature/detail/AuctionDetailActivity.kt b/android/app/src/main/java/com/ddangddangddang/android/feature/detail/AuctionDetailActivity.kt index 9ee7b2c40..033f47314 100644 --- a/android/app/src/main/java/com/ddangddangddang/android/feature/detail/AuctionDetailActivity.kt +++ b/android/app/src/main/java/com/ddangddangddang/android/feature/detail/AuctionDetailActivity.kt @@ -3,7 +3,6 @@ package com.ddangddangddang.android.feature.detail import android.content.Context import android.content.Intent import android.os.Bundle -import android.view.View import androidx.activity.viewModels import androidx.viewpager2.widget.ViewPager2 import com.ddangddangddang.android.R @@ -33,33 +32,9 @@ class AuctionDetailActivity : binding.viewModel = viewModel setupDetailView() setupViewModel() - setDynamicHeight(binding.vpDetailInfo, this) if (savedInstanceState == null) viewModel.loadAuctionDetail(auctionId) } - // 액션바 높이를 반환하는 함수 - private fun getActionBarHeight(context: Context): Int { - val styledAttributes = - context.theme.obtainStyledAttributes(intArrayOf(android.R.attr.actionBarSize)) - val actionBarHeight = styledAttributes.getDimension(0, 0f).toInt() - styledAttributes.recycle() - return actionBarHeight - } - - // 스크린 높이에서 액션바 높이를 뺀 높이를 계산하는 함수 - private fun getRemainingHeight(context: Context): Int { - val screenHeight = context.resources.displayMetrics.heightPixels - val actionBarHeight = getActionBarHeight(context) - return screenHeight - actionBarHeight * 2 - } - - // 뷰의 높이를 동적으로 설정하는 함수 - private fun setDynamicHeight(view: View, context: Context) { - val params = view.layoutParams - params.height = getRemainingHeight(context) - view.layoutParams = params - } - private fun setupDetailView() { binding.vpDetailInfo.adapter = DetailFragmentAdapter(supportFragmentManager, lifecycle) TabLayoutMediator(binding.tbDetailInfo, binding.vpDetailInfo) { tab, position -> diff --git a/android/app/src/main/java/com/ddangddangddang/android/feature/detail/AuctionDetailBottomButtonStatus.kt b/android/app/src/main/java/com/ddangddangddang/android/feature/detail/AuctionDetailBottomButtonStatus.kt index 4922cb72f..3eeafb305 100644 --- a/android/app/src/main/java/com/ddangddangddang/android/feature/detail/AuctionDetailBottomButtonStatus.kt +++ b/android/app/src/main/java/com/ddangddangddang/android/feature/detail/AuctionDetailBottomButtonStatus.kt @@ -17,6 +17,8 @@ enum class AuctionDetailBottomButtonStatus( EnterAuctionChatRoom(R.string.detail_auction_chat_room_entrance, true), MyAuction(R.string.detail_auction_my_auction, false), + + AlreadyLastBidder(R.string.detail_auction_already_last_bidder, false), ; companion object { @@ -26,10 +28,18 @@ enum class AuctionDetailBottomButtonStatus( val isOwner = auctionDetailModel.isOwner val auctionStatus = auctionDetailModel.auctionDetailStatusModel val chatStatus = auctionDetailModel.chatAuctionDetailModel + val isLastBidder = auctionDetailModel.isLastBidder return when { canEnterMessageRoom(chatStatus) -> EnterAuctionChatRoom - canBidAuction(auctionStatus, isOwner) -> BidAuction + canBidAuction(auctionStatus, isOwner) -> { + if (isLastBidder) { + AlreadyLastBidder + } else { + BidAuction + } + } + isOwner -> MyAuction else -> FinishAuction } diff --git a/android/app/src/main/java/com/ddangddangddang/android/feature/detail/AuctionDetailFormatter.kt b/android/app/src/main/java/com/ddangddangddang/android/feature/detail/AuctionDetailFormatter.kt index 4a29086cc..cb9eff13c 100644 --- a/android/app/src/main/java/com/ddangddangddang/android/feature/detail/AuctionDetailFormatter.kt +++ b/android/app/src/main/java/com/ddangddangddang/android/feature/detail/AuctionDetailFormatter.kt @@ -70,9 +70,8 @@ object AuctionDetailFormatter { val minutes = (differenceInMills / (60 * 1000L)) % 60 return buildString { - if (days > 0L) append("${days}일") - if (hours > 0L) append(" ${hours}시간") - if (minutes > 0L) append(" ${minutes}분") + if (days > 0L) append("${days}일 ") + append(" ${String.format("%02d:%02d", hours, minutes)}") }.trim() } diff --git a/android/app/src/main/java/com/ddangddangddang/android/feature/detail/AuctionDetailViewModel.kt b/android/app/src/main/java/com/ddangddangddang/android/feature/detail/AuctionDetailViewModel.kt index dba80674e..c656beed9 100644 --- a/android/app/src/main/java/com/ddangddangddang/android/feature/detail/AuctionDetailViewModel.kt +++ b/android/app/src/main/java/com/ddangddangddang/android/feature/detail/AuctionDetailViewModel.kt @@ -80,8 +80,9 @@ class AuctionDetailViewModel @Inject constructor( when (it) { AuctionDetailBottomButtonStatus.BidAuction -> popupAuctionBidEvent() AuctionDetailBottomButtonStatus.EnterAuctionChatRoom -> enterChatRoomEvent() - AuctionDetailBottomButtonStatus.FinishAuction -> {} + AuctionDetailBottomButtonStatus.AlreadyLastBidder -> {} AuctionDetailBottomButtonStatus.MyAuction -> {} + AuctionDetailBottomButtonStatus.FinishAuction -> {} } } } diff --git a/android/app/src/main/java/com/ddangddangddang/android/model/AuctionDetailModel.kt b/android/app/src/main/java/com/ddangddangddang/android/model/AuctionDetailModel.kt index b81b95378..bc7ba7876 100644 --- a/android/app/src/main/java/com/ddangddangddang/android/model/AuctionDetailModel.kt +++ b/android/app/src/main/java/com/ddangddangddang/android/model/AuctionDetailModel.kt @@ -20,4 +20,5 @@ data class AuctionDetailModel( val sellerModel: SellerModel, val chatAuctionDetailModel: ChatAuctionDetailModel, val isOwner: Boolean, + val isLastBidder: Boolean, ) diff --git a/android/app/src/main/java/com/ddangddangddang/android/model/mapper/AuctionDetailModelMapper.kt b/android/app/src/main/java/com/ddangddangddang/android/model/mapper/AuctionDetailModelMapper.kt index 86867f38d..d84fc8075 100644 --- a/android/app/src/main/java/com/ddangddangddang/android/model/mapper/AuctionDetailModelMapper.kt +++ b/android/app/src/main/java/com/ddangddangddang/android/model/mapper/AuctionDetailModelMapper.kt @@ -34,6 +34,7 @@ object AuctionDetailModelMapper : Mapper + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +