From d1136c317afa30a57267973c63bab38154bb1ea8 Mon Sep 17 00:00:00 2001 From: Aurelien Hubert Date: Thu, 6 Jun 2019 18:10:46 +0200 Subject: [PATCH] Update Top 10 UI --- .../android/ui/view/RowViewType.kt | 29 ++++--- app/src/main/res/layout/row_top_10.xml | 80 +++++++++++++++++-- 2 files changed, 94 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/net/pokeranalytics/android/ui/view/RowViewType.kt b/app/src/main/java/net/pokeranalytics/android/ui/view/RowViewType.kt index 3ad02065..244e8674 100644 --- a/app/src/main/java/net/pokeranalytics/android/ui/view/RowViewType.kt +++ b/app/src/main/java/net/pokeranalytics/android/ui/view/RowViewType.kt @@ -539,18 +539,27 @@ enum class RowViewType(private var layoutRes: Int) { part1.text = row.getFormattedGameType(itemView.context) } - itemView.findViewById(R.id.top10ResultPart2)?.let { part2 -> - var content = row.getFormattedDuration() - - if (!row.location?.name.isNullOrEmpty()) { - content += " - " + row.location?.name - } else if (!row.bankroll?.name.isNullOrEmpty()) { - content += " - " + row.bankroll?.name - } - - part2.text = content + // Duration + val durationIcon = itemView.findViewById(R.id.sessionInfoDurationIcon) + val durationText = itemView.findViewById(R.id.sessionInfoDuration) + durationIcon?.isVisible = true + durationText?.isVisible = true + durationText?.text = row.getFormattedDuration() + + // Location + val locationIcon = itemView.findViewById(R.id.sessionInfoLocationIcon) + val locationText = itemView.findViewById(R.id.sessionInfoLocation) + + if (!row.location?.name.isNullOrEmpty()) { + locationIcon?.isVisible = true + locationText?.isVisible = true + locationText?.text = row.location?.name + } else { + locationIcon?.isVisible = false + locationText?.isVisible = false } + itemView.findViewById(R.id.top10ResultPart3)?.let { part3 -> part3.text = row.creationDate.longDate() } diff --git a/app/src/main/res/layout/row_top_10.xml b/app/src/main/res/layout/row_top_10.xml index 6d143692..157d62a2 100644 --- a/app/src/main/res/layout/row_top_10.xml +++ b/app/src/main/res/layout/row_top_10.xml @@ -13,8 +13,8 @@ android:layout_height="wrap_content" android:layout_marginStart="16dp" android:layout_marginTop="8dp" - android:gravity="center" android:layout_marginEnd="16dp" + android:gravity="center" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" @@ -25,17 +25,87 @@ style="@style/PokerAnalyticsTheme.TextView.Top10Row" android:layout_width="0dp" android:layout_height="wrap_content" - android:layout_marginStart="16dp" + android:layout_marginStart="8dp" android:layout_marginTop="4dp" - android:layout_marginEnd="16dp" + android:layout_marginEnd="8dp" android:gravity="center" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintHorizontal_bias="0.5" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/gameResult" app:layout_constraintVertical_chainStyle="packed" tools:text="$300 NL Hold'em" /> + + + + + + + + + + +