Clean stats layout

feature/top10
Aurelien Hubert 7 years ago
parent 0b367b4370
commit 11a88e82c2
  1. 17
      app/src/main/java/net/pokeranalytics/android/ui/view/RowViewType.kt
  2. 41
      app/src/main/res/layout/row_stats_title_value.xml

@ -11,7 +11,6 @@ import androidx.core.view.isVisible
import androidx.core.widget.ContentLoadingProgressBar
import androidx.recyclerview.widget.RecyclerView
import kotlinx.android.synthetic.main.row_history_session.view.*
import kotlinx.android.synthetic.main.row_stats_title_value.view.*
import net.pokeranalytics.android.R
import net.pokeranalytics.android.model.realm.Session
import net.pokeranalytics.android.ui.adapter.RowRepresentableAdapter
@ -195,15 +194,23 @@ enum class RowViewType(private var layoutRes: Int) {
inner class StatsTitleValueViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView),
BindableHolder {
override fun bind(position: Int, row: RowRepresentable, adapter: RowRepresentableAdapter) {
itemView.rowStatsTitleValue_title.text = row.localizedTitle(itemView.context)
// Title
itemView.findViewById<AppCompatTextView?>(R.id.title)?.text = row.localizedTitle(itemView.context)
// Value
itemView.findViewById<AppCompatTextView?>(R.id.value)?.let {view ->
adapter.dataSource.contentDescriptorForRow(row)?.textFormat?.let {
itemView.rowStatsTitleValue_value.text = it.text
itemView.rowStatsTitleValue_value.setTextColor(it.getColor(itemView.context))
view.text = it.text
view.setTextColor(it.getColor(itemView.context))
}
}
// Listener
val listener = View.OnClickListener {
adapter.delegate?.onRowSelected(position, row)
}
itemView.rowStatsTitleValue_container.setOnClickListener(listener)
itemView.findViewById<View?>(R.id.container)?.setOnClickListener(listener)
}
}

@ -1,19 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rowStatsTitleValue.container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/rowStatsTitleValue.title"
android:id="@+id/title"
style="@style/PokerAnalyticsTheme.TextView.RowStatsTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -25,7 +20,7 @@
tools:text="Title" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/rowStatsTitleValue.value"
android:id="@+id/value"
style="@style/PokerAnalyticsTheme.TextView.RowStatsValue"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -34,10 +29,10 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/nextArrow"
app:layout_constraintStart_toStartOf="@+id/guidelineStart"
app:layout_constraintTop_toBottomOf="@+id/rowStatsTitleValue.title"
app:layout_constraintTop_toBottomOf="@+id/title"
tools:text="Value" />
<ImageView
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/nextArrow"
android:layout_width="24dp"
android:layout_height="24dp"
@ -62,26 +57,4 @@
android:orientation="vertical"
app:layout_constraintGuide_end="16dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
<FrameLayout
android:id="@+id/rowStatsTitleValue.separator"
android:layout_width="match_parent"
android:layout_height="16dp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:visibility="gone">
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_gravity="center"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:background="@color/kaki" />
</FrameLayout>
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.constraintlayout.widget.ConstraintLayout>

Loading…
Cancel
Save