Improve layouts

feature/top10
Aurelien Hubert 7 years ago
parent 3d56a6bbbe
commit 6a4adbb061
  1. 10
      app/src/main/java/net/pokeranalytics/android/model/realm/Session.kt
  2. 8
      app/src/main/java/net/pokeranalytics/android/ui/view/RowViewType.kt
  3. 70
      app/src/main/res/layout/row_header_title_amount_big.xml
  4. 8
      app/src/main/res/layout/row_header_title_value.xml
  5. 17
      app/src/main/res/layout/row_title_switch.xml

@ -229,7 +229,7 @@ open class Session : RealmObject(), SessionInterface, Savable,
// get all sessions part of the deleted session set
val sessionsFromSet = set.sessions
// cleanup unecessary related objects
// cleanup unnecessary related objects
set.deleteFromRealm()
this.timeFrame?.deleteFromRealm()
this.result?.deleteFromRealm()
@ -288,7 +288,7 @@ open class Session : RealmObject(), SessionInterface, Savable,
}
override fun getDisplayName(): String {
return "session ${this.creationDate}"
return "Session ${this.creationDate}"
}
override fun adapterRows(): ArrayList<RowRepresentable> {
@ -299,7 +299,7 @@ open class Session : RealmObject(), SessionInterface, Savable,
SessionState.STARTED -> {
rows.add(
HeaderRowRepresentable(
RowViewType.HEADER_TITLE_AMOUNT,
RowViewType.HEADER_TITLE_AMOUNT_BIG,
title = getDuration(), value = result?.net.toString()
)
)
@ -307,7 +307,7 @@ open class Session : RealmObject(), SessionInterface, Savable,
SessionState.PAUSED -> {
rows.add(
HeaderRowRepresentable(
RowViewType.HEADER_TITLE_AMOUNT,
RowViewType.HEADER_TITLE_AMOUNT_BIG,
resId = R.string.pause, value = result?.net.toString()
)
)
@ -315,7 +315,7 @@ open class Session : RealmObject(), SessionInterface, Savable,
SessionState.FINISHED -> {
rows.add(
HeaderRowRepresentable(
RowViewType.HEADER_TITLE_AMOUNT,
RowViewType.HEADER_TITLE_AMOUNT_BIG,
title = getDuration(), value = result?.net.toString()
)
)

@ -33,6 +33,7 @@ enum class RowViewType {
HEADER,
HEADER_TITLE_VALUE,
HEADER_TITLE_AMOUNT,
HEADER_TITLE_AMOUNT_BIG,
EDIT_TEXT,
TITLE,
TITLE_VALUE,
@ -227,6 +228,13 @@ enum class RowViewType {
false
)
)
HEADER_TITLE_AMOUNT_BIG -> HeaderTitleAmountViewHolder(
LayoutInflater.from(parent.context).inflate(
R.layout.row_header_title_amount_big,
parent,
false
)
)
TITLE -> TitleViewHolder(
LayoutInflater.from(parent.context).inflate(
R.layout.row_title,

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.LinearLayoutCompat 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/rowHeaderTitleAmount.container"
android:layout_width="match_parent"
android:layout_height="56dp"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/green_header">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/rowHeaderTitleAmount.title"
style="@style/PokerAnalyticsTheme.TextView.RowTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
android:fontFamily="@font/roboto_medium"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="@+id/guidelineStart"
app:layout_constraintTop_toTopOf="parent"
tools:text="Title" />
<net.pokeranalytics.android.ui.view.PokerAnalyticsTextView
android:id="@+id/rowHeaderTitleAmount.value"
style="@style/PokerAnalyticsTheme.TextView.RowValue"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:ellipsize="end"
android:fontFamily="@font/roboto_medium"
android:textSize="20sp"
android:gravity="end"
android:maxLines="1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/guidelineEnd"
app:layout_constraintStart_toEndOf="@+id/rowHeaderTitleAmount.title"
app:layout_constraintTop_toTopOf="parent"
tools:text="Value" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guidelineStart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_begin="16dp" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guidelineEnd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_end="16dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
<FrameLayout
android:id="@+id/rowHeaderTitleAmount.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="visible" />
</androidx.appcompat.widget.LinearLayoutCompat>

@ -4,12 +4,12 @@
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rowHeaderTitleValue.container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="48dp"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:background="@color/green_header">
<androidx.appcompat.widget.AppCompatTextView
@ -17,8 +17,6 @@
style="@style/PokerAnalyticsTheme.TextView.RowTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="@+id/guidelineStart"
app:layout_constraintTop_toTopOf="parent"
@ -30,8 +28,6 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:ellipsize="end"
android:gravity="end"
android:maxLines="1"

@ -11,13 +11,15 @@
android:id="@+id/rowTitleSwitch.title"
android:layout_width="0dp"
android:layout_height="wrap_content"
style="@style/PokerAnalyticsTheme.TextView.RowTitle"
android:layout_marginTop="16dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="16dp"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/guidelineEnd"
app:layout_constraintEnd_toStartOf="@+id/rowTitleSwitch.switch"
app:layout_constraintStart_toStartOf="@+id/guidelineStart"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0"
tools:text="Data Type Title" />
<androidx.constraintlayout.widget.Guideline
@ -33,13 +35,14 @@
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_end="16dp" />
<Switch
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/rowTitleSwitch.switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/rowTitleSwitch.switch"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="@+id/rowTitleSwitch.title"
app:layout_constraintStart_toStartOf="parent" android:layout_marginStart="356dp"/>
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/guidelineEnd"
app:layout_constraintTop_toTopOf="parent" />
<FrameLayout
android:id="@+id/rowTitleSwitch.separator"

Loading…
Cancel
Save