Skip to content

Commit

Permalink
refactor: #708 프로필 정보 뷰 텍스트 대응 및 탭 레이아웃 백그라운드 속성 수정 (#711)
Browse files Browse the repository at this point in the history
* refactor: 프로필 정보 뷰 텍스트 크기 대응

* refactor: 입찰 내역 날짜 뷰 수정 추가

* refactor: 탭 레이아웃 백그라운듯 색상 지정 속성 변경

* refactor: 어댑터 분리

* refactor: view_profile.xml 마진 수정
  • Loading branch information
rhthrhrl0 authored Oct 18, 2023
1 parent 765d3ea commit 55fe89a
Show file tree
Hide file tree
Showing 12 changed files with 54 additions and 92 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<BidHistoryModel, BidHistoryViewHolder>(BidHistoryDiffUtil) {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BidHistoryViewHolder {
return BidHistoryViewHolder.create(parent, dateTimeFormatter)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<MessageViewItem, MessageViewHolder>(MessageDiffUtil) {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MessageViewHolder {
return MessageViewHolder.of(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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) }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@ data class SellerModel(
val profileUrl: String,
val nickname: String,
val reliability: Float?,
)
) {
fun toProfileModel(): ProfileModel {
return ProfileModel(nickname, profileUrl, reliability)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
67 changes: 6 additions & 61 deletions android/app/src/main/res/layout/fragment_auction_info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,72 +82,17 @@
app:layout_constraintTop_toBottomOf="@id/tv_direct_exchange_regions"
tools:itemCount="3" />

<TextView
android:id="@+id/tv_seller_info"
style="@style/Header2"
<include
android:id="@+id/view_profile"
layout="@layout/view_profile"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:text="@string/detail_auction_info_seller_info"
app:layout_constraintEnd_toEndOf="@id/gl_end"
app:layout_constraintStart_toEndOf="@id/gl_begin"
app:layout_constraintTop_toBottomOf="@id/rv_direct_exchange_regions" />

<androidx.cardview.widget.CardView
android:id="@+id/cv_profile"
android:layout_width="64dp"
android:layout_height="64dp"
android:layout_marginTop="8dp"
app:cardCornerRadius="32dp"
app:cardElevation="0dp"
app:layout_constraintStart_toEndOf="@id/gl_begin"
app:layout_constraintTop_toBottomOf="@id/tv_seller_info">

<ImageView
android:id="@+id/iv_seller_profile"
imageUrl="@{activityViewModel.auctionDetailModel.sellerModel.profileUrl}"
placeholder="@{@drawable/img_default_profile}"
android:layout_width="64dp"
android:layout_height="64dp"
android:contentDescription="@string/detail_seller_profile_description"
android:scaleType="centerCrop" />
</androidx.cardview.widget.CardView>
app:layout_constraintStart_toStartOf="@id/gl_begin"
app:layout_constraintTop_toBottomOf="@id/rv_direct_exchange_regions"
app:profile="@{activityViewModel.auctionDetailModel.sellerModel.toProfileModel()}" />

<TextView
android:id="@+id/tv_seller_nickname"
style="@style/Body"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:text="@{activityViewModel.auctionDetailModel.sellerModel.nickname}"
app:layout_constraintBottom_toTopOf="@id/iv_reliability_icon"
app:layout_constraintEnd_toStartOf="@id/gl_end"
app:layout_constraintStart_toEndOf="@id/cv_profile"
app:layout_constraintTop_toTopOf="@id/cv_profile"
app:layout_constraintVertical_chainStyle="packed"
tools:text="카붕이" />

<ImageView
android:id="@+id/iv_reliability_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/all_reliability_icon_description"
android:src="@drawable/ic_star_18"
app:layout_constraintBottom_toBottomOf="@id/cv_profile"
app:layout_constraintStart_toStartOf="@id/tv_seller_nickname"
app:layout_constraintTop_toBottomOf="@id/tv_seller_nickname" />

<TextView
android:id="@+id/tv_seller_reliability_score"
style="@style/Body"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:text="@{activityViewModel.auctionDetailModel.sellerModel.reliability == null ? @string/all_default_reliability : @string/all_reliability(activityViewModel.auctionDetailModel.sellerModel.reliability)}"
app:layout_constraintBottom_toBottomOf="@id/iv_reliability_icon"
app:layout_constraintStart_toEndOf="@id/iv_reliability_icon"
app:layout_constraintTop_toTopOf="@id/iv_reliability_icon"
tools:text="(9.7)" />

</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
Expand Down
13 changes: 7 additions & 6 deletions android/app/src/main/res/layout/fragment_my_page.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
app:layout_constraintTop_toTopOf="parent">

<TextView
style="@style/Header1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_side_layout"
android:text="@string/mypage"
style="@style/Header1" />
android:text="@string/mypage" />
</androidx.appcompat.widget.Toolbar>

<ScrollView
Expand Down Expand Up @@ -60,9 +60,10 @@
<include
android:id="@+id/view_profile"
layout="@layout/view_profile"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
app:layout_constraintEnd_toEndOf="@id/gl_end"
app:layout_constraintStart_toStartOf="@id/gl_begin"
app:layout_constraintTop_toTopOf="parent"
bind:profile="@{viewModel.profile}" />
Expand Down Expand Up @@ -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}" />

Expand Down Expand Up @@ -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" />

</androidx.constraintlayout.widget.ConstraintLayout>

Expand Down
3 changes: 2 additions & 1 deletion android/app/src/main/res/layout/item_bid_history.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
9 changes: 5 additions & 4 deletions android/app/src/main/res/layout/view_profile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</data>

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<androidx.cardview.widget.CardView
Expand Down Expand Up @@ -41,13 +41,14 @@

<TextView
android:id="@+id/tv_nickname"
android:layout_width="wrap_content"
style="@style/Header2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:text="@{profile.name}"
style="@style/Header2"
android:textColor="@color/grey_800"
app:layout_constraintBottom_toTopOf="@id/iv_reliability_icon"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/cv_profile_image"
app:layout_constraintTop_toTopOf="@id/cv_profile_image"
app:layout_constraintVertical_chainStyle="packed"
Expand All @@ -66,11 +67,11 @@

<TextView
android:id="@+id/tv_reliability_score"
style="@style/Body"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:text="@{profile.reliability == null ? @string/all_default_reliability : @string/all_reliability(profile.reliability)}"
style="@style/Body"
app:layout_constraintBottom_toBottomOf="@id/iv_reliability_icon"
app:layout_constraintStart_toEndOf="@id/iv_reliability_icon"
app:layout_constraintTop_toTopOf="@id/iv_reliability_icon"
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<string name="all_must_update_to_latest_version">최신 버전으로 업데이트가 필요합니다.</string>
<string name="all_date_format">yyyy년 M월 d일</string>
<string name="all_time_format">h:mm a</string>
<string name="all_date_time_format">yyyy-MM-dd HH:mm:ss</string>
<string name="all_date_time_format">yyyy-MM-dd\nHH:mm:ss</string>
<string name="all_default_reliability">( - )</string>
<string name="all_back_key_check_message">\'뒤로\' 버튼을 한번 더 누르시면 종료됩니다</string>
<string name="all_price">%,d 원</string>
Expand Down

0 comments on commit 55fe89a

Please sign in to comment.