From 55fe89a2f2e2f642a3e7a045c7836d0176273a1a Mon Sep 17 00:00:00 2001 From: Mendel <67176829+rhthrhrl0@users.noreply.github.com> Date: Wed, 18 Oct 2023 15:53:08 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20#708=20=ED=94=84=EB=A1=9C=ED=95=84?= =?UTF-8?q?=20=EC=A0=95=EB=B3=B4=20=EB=B7=B0=20=ED=85=8D=EC=8A=A4=ED=8A=B8?= =?UTF-8?q?=20=EB=8C=80=EC=9D=91=20=EB=B0=8F=20=ED=83=AD=20=EB=A0=88?= =?UTF-8?q?=EC=9D=B4=EC=95=84=EC=9B=83=20=EB=B0=B1=EA=B7=B8=EB=9D=BC?= =?UTF-8?q?=EC=9A=B4=EB=93=9C=20=EC=86=8D=EC=84=B1=20=EC=88=98=EC=A0=95=20?= =?UTF-8?q?(#711)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor: 프로필 정보 뷰 텍스트 크기 대응 * refactor: 입찰 내역 날짜 뷰 수정 추가 * refactor: 탭 레이아웃 백그라운듯 색상 지정 속성 변경 * refactor: 어댑터 분리 * refactor: view_profile.xml 마진 수정 --- .../detail/bidHistory/BidHistoryAdapter.kt | 8 +-- .../detail/bidHistory/BidHistoryFragment.kt | 9 ++- .../feature/messageRoom/MessageAdapter.kt | 11 +-- .../messageRoom/MessageRoomActivity.kt | 14 +++- .../android/model/SellerModel.kt | 6 +- .../layout-land/activity_auction_detail.xml | 2 +- .../res/layout/activity_auction_detail.xml | 2 +- .../main/res/layout/fragment_auction_info.xml | 67 ++----------------- .../src/main/res/layout/fragment_my_page.xml | 13 ++-- .../src/main/res/layout/item_bid_history.xml | 3 +- .../app/src/main/res/layout/view_profile.xml | 9 +-- android/app/src/main/res/values/strings.xml | 2 +- 12 files changed, 54 insertions(+), 92 deletions(-) diff --git a/android/app/src/main/java/com/ddangddangddang/android/feature/detail/bidHistory/BidHistoryAdapter.kt b/android/app/src/main/java/com/ddangddangddang/android/feature/detail/bidHistory/BidHistoryAdapter.kt index 096d4e855..9f584a0f3 100644 --- a/android/app/src/main/java/com/ddangddangddang/android/feature/detail/bidHistory/BidHistoryAdapter.kt +++ b/android/app/src/main/java/com/ddangddangddang/android/feature/detail/bidHistory/BidHistoryAdapter.kt @@ -3,15 +3,11 @@ package com.ddangddangddang.android.feature.detail.bidHistory import android.view.ViewGroup import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.ListAdapter -import com.ddangddangddang.android.di.DefaultDateTimeFormatter import com.ddangddangddang.android.model.BidHistoryModel -import dagger.hilt.android.scopes.ActivityRetainedScoped import java.time.format.DateTimeFormatter -import javax.inject.Inject -@ActivityRetainedScoped -class BidHistoryAdapter @Inject constructor( - @DefaultDateTimeFormatter private val dateTimeFormatter: DateTimeFormatter, +class BidHistoryAdapter( + private val dateTimeFormatter: DateTimeFormatter, ) : ListAdapter(BidHistoryDiffUtil) { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BidHistoryViewHolder { return BidHistoryViewHolder.create(parent, dateTimeFormatter) diff --git a/android/app/src/main/java/com/ddangddangddang/android/feature/detail/bidHistory/BidHistoryFragment.kt b/android/app/src/main/java/com/ddangddangddang/android/feature/detail/bidHistory/BidHistoryFragment.kt index 7ea1fe63d..f94ac7345 100644 --- a/android/app/src/main/java/com/ddangddangddang/android/feature/detail/bidHistory/BidHistoryFragment.kt +++ b/android/app/src/main/java/com/ddangddangddang/android/feature/detail/bidHistory/BidHistoryFragment.kt @@ -8,10 +8,12 @@ import androidx.fragment.app.viewModels import androidx.recyclerview.widget.DividerItemDecoration import com.ddangddangddang.android.R import com.ddangddangddang.android.databinding.FragmentBidHistoryBinding +import com.ddangddangddang.android.di.DefaultDateTimeFormatter import com.ddangddangddang.android.feature.common.notifyFailureMessage import com.ddangddangddang.android.feature.detail.AuctionDetailViewModel import com.ddangddangddang.android.util.binding.BindingFragment import dagger.hilt.android.AndroidEntryPoint +import java.time.format.DateTimeFormatter import javax.inject.Inject @AndroidEntryPoint @@ -21,7 +23,12 @@ class BidHistoryFragment : private val viewModel: BidHistoryViewModel by viewModels() @Inject - lateinit var bidHistoryAdapter: BidHistoryAdapter + @DefaultDateTimeFormatter + lateinit var dateTimeFormatter: DateTimeFormatter + + private val bidHistoryAdapter: BidHistoryAdapter by lazy { + BidHistoryAdapter(dateTimeFormatter) + } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) diff --git a/android/app/src/main/java/com/ddangddangddang/android/feature/messageRoom/MessageAdapter.kt b/android/app/src/main/java/com/ddangddangddang/android/feature/messageRoom/MessageAdapter.kt index 4975dfd7d..3449f4681 100644 --- a/android/app/src/main/java/com/ddangddangddang/android/feature/messageRoom/MessageAdapter.kt +++ b/android/app/src/main/java/com/ddangddangddang/android/feature/messageRoom/MessageAdapter.kt @@ -3,16 +3,11 @@ package com.ddangddangddang.android.feature.messageRoom import android.view.ViewGroup import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.ListAdapter -import com.ddangddangddang.android.di.DateFormatter -import com.ddangddangddang.android.di.TimeFormatter -import dagger.hilt.android.scopes.ActivityRetainedScoped import java.time.format.DateTimeFormatter -import javax.inject.Inject -@ActivityRetainedScoped -class MessageAdapter @Inject constructor( - @DateFormatter private val dateFormatter: DateTimeFormatter, - @TimeFormatter private val timeFormatter: DateTimeFormatter, +class MessageAdapter( + private val dateFormatter: DateTimeFormatter, + private val timeFormatter: DateTimeFormatter, ) : ListAdapter(MessageDiffUtil) { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MessageViewHolder { return MessageViewHolder.of( diff --git a/android/app/src/main/java/com/ddangddangddang/android/feature/messageRoom/MessageRoomActivity.kt b/android/app/src/main/java/com/ddangddangddang/android/feature/messageRoom/MessageRoomActivity.kt index d421c28ed..5be8dbb3c 100644 --- a/android/app/src/main/java/com/ddangddangddang/android/feature/messageRoom/MessageRoomActivity.kt +++ b/android/app/src/main/java/com/ddangddangddang/android/feature/messageRoom/MessageRoomActivity.kt @@ -8,6 +8,8 @@ import androidx.recyclerview.widget.ConcatAdapter import androidx.recyclerview.widget.LinearLayoutManager import com.ddangddangddang.android.R import com.ddangddangddang.android.databinding.ActivityMessageRoomBinding +import com.ddangddangddang.android.di.DateFormatter +import com.ddangddangddang.android.di.TimeFormatter import com.ddangddangddang.android.feature.detail.AuctionDetailActivity import com.ddangddangddang.android.feature.messageRoom.review.UserReviewDialog import com.ddangddangddang.android.feature.report.ReportActivity @@ -21,6 +23,7 @@ import com.ddangddangddang.android.reciever.MessageReceiver import com.ddangddangddang.android.util.binding.BindingActivity import com.ddangddangddang.android.util.view.showSnackbar import dagger.hilt.android.AndroidEntryPoint +import java.time.format.DateTimeFormatter import javax.inject.Inject @AndroidEntryPoint @@ -31,7 +34,16 @@ class MessageRoomActivity : private val roomCreatedNotifyAdapter by lazy { RoomCreatedNotifyAdapter() } @Inject - lateinit var messageAdapter: MessageAdapter + @DateFormatter + lateinit var dateFormatter: DateTimeFormatter + + @Inject + @TimeFormatter + lateinit var timeFormatter: DateTimeFormatter + + private val messageAdapter: MessageAdapter by lazy { + MessageAdapter(dateFormatter, timeFormatter) + } private val adapter by lazy { ConcatAdapter(roomCreatedNotifyAdapter, messageAdapter) } diff --git a/android/app/src/main/java/com/ddangddangddang/android/model/SellerModel.kt b/android/app/src/main/java/com/ddangddangddang/android/model/SellerModel.kt index 27ec59546..323a897e7 100644 --- a/android/app/src/main/java/com/ddangddangddang/android/model/SellerModel.kt +++ b/android/app/src/main/java/com/ddangddangddang/android/model/SellerModel.kt @@ -5,4 +5,8 @@ data class SellerModel( val profileUrl: String, val nickname: String, val reliability: Float?, -) +) { + fun toProfileModel(): ProfileModel { + return ProfileModel(nickname, profileUrl, reliability) + } +} diff --git a/android/app/src/main/res/layout-land/activity_auction_detail.xml b/android/app/src/main/res/layout-land/activity_auction_detail.xml index eb889d4da..5c7293a5d 100644 --- a/android/app/src/main/res/layout-land/activity_auction_detail.xml +++ b/android/app/src/main/res/layout-land/activity_auction_detail.xml @@ -275,10 +275,10 @@ android:id="@+id/tb_detail_info" android:layout_width="match_parent" android:layout_height="48dp" - android:background="@color/grey_50" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/tv_auctioneer_count" + app:tabBackground="@color/grey_50" app:tabGravity="fill" app:tabIndicatorFullWidth="true" app:tabMaxWidth="0dp" diff --git a/android/app/src/main/res/layout/activity_auction_detail.xml b/android/app/src/main/res/layout/activity_auction_detail.xml index 2650d35e9..2117e0a63 100644 --- a/android/app/src/main/res/layout/activity_auction_detail.xml +++ b/android/app/src/main/res/layout/activity_auction_detail.xml @@ -282,7 +282,7 @@ android:id="@+id/tb_detail_info" android:layout_width="match_parent" android:layout_height="48dp" - android:background="@color/grey_50" + app:tabBackground="@color/grey_50" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/tv_auctioneer_count" diff --git a/android/app/src/main/res/layout/fragment_auction_info.xml b/android/app/src/main/res/layout/fragment_auction_info.xml index 64b1d757b..aef524cb2 100644 --- a/android/app/src/main/res/layout/fragment_auction_info.xml +++ b/android/app/src/main/res/layout/fragment_auction_info.xml @@ -82,72 +82,17 @@ app:layout_constraintTop_toBottomOf="@id/tv_direct_exchange_regions" tools:itemCount="3" /> - - - - - - + app:layout_constraintStart_toStartOf="@id/gl_begin" + app:layout_constraintTop_toBottomOf="@id/rv_direct_exchange_regions" + app:profile="@{activityViewModel.auctionDetailModel.sellerModel.toProfileModel()}" /> - - - - - diff --git a/android/app/src/main/res/layout/fragment_my_page.xml b/android/app/src/main/res/layout/fragment_my_page.xml index ea9cd99cb..867a7ecc5 100644 --- a/android/app/src/main/res/layout/fragment_my_page.xml +++ b/android/app/src/main/res/layout/fragment_my_page.xml @@ -24,11 +24,11 @@ app:layout_constraintTop_toTopOf="parent"> + android:text="@string/mypage" /> @@ -119,8 +120,8 @@ layout="@layout/view_my_page_feature_category" android:layout_width="match_parent" android:layout_height="wrap_content" - android:visibility="gone" android:onClick="@{() -> viewModel.navigateToAnnouncement()}" + android:visibility="gone" app:layout_constraintTop_toBottomOf="@id/tv_notification_settings_button" bind:categoryName="@{@string/mypage_announcement_button}" /> @@ -155,12 +156,12 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="16dp" + android:onClick="@{() -> viewModel.askWithdrawal()}" android:text="@string/mypage_delete_account_button" android:textColor="@color/grey_500" android:textSize="14sp" app:layout_constraintEnd_toEndOf="@id/gl_end" - app:layout_constraintTop_toBottomOf="@id/tv_logout_button" - android:onClick="@{() -> viewModel.askWithdrawal()}" /> + app:layout_constraintTop_toBottomOf="@id/tv_logout_button" /> diff --git a/android/app/src/main/res/layout/item_bid_history.xml b/android/app/src/main/res/layout/item_bid_history.xml index a494b065e..d1286340c 100644 --- a/android/app/src/main/res/layout/item_bid_history.xml +++ b/android/app/src/main/res/layout/item_bid_history.xml @@ -50,7 +50,8 @@ style="@style/Caption" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:maxLines="1" + android:gravity="center" + android:maxLines="2" android:text="@{item.bidDateTime.format(dateTimeFormatter)}" android:textColor="@color/grey_500" app:layout_constraintBottom_toBottomOf="@id/tv_bid_price" diff --git a/android/app/src/main/res/layout/view_profile.xml b/android/app/src/main/res/layout/view_profile.xml index c9158b8a4..78c3fa9cc 100644 --- a/android/app/src/main/res/layout/view_profile.xml +++ b/android/app/src/main/res/layout/view_profile.xml @@ -11,7 +11,7 @@ 최신 버전으로 업데이트가 필요합니다. yyyy년 M월 d일 h:mm a - yyyy-MM-dd HH:mm:ss + yyyy-MM-dd\nHH:mm:ss ( - ) \'뒤로\' 버튼을 한번 더 누르시면 종료됩니다 %,d 원