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

@ -33,6 +33,7 @@ enum class RowViewType {
HEADER, HEADER,
HEADER_TITLE_VALUE, HEADER_TITLE_VALUE,
HEADER_TITLE_AMOUNT, HEADER_TITLE_AMOUNT,
HEADER_TITLE_AMOUNT_BIG,
EDIT_TEXT, EDIT_TEXT,
TITLE, TITLE,
TITLE_VALUE, TITLE_VALUE,
@ -227,6 +228,13 @@ enum class RowViewType {
false false
) )
) )
HEADER_TITLE_AMOUNT_BIG -> HeaderTitleAmountViewHolder(
LayoutInflater.from(parent.context).inflate(
R.layout.row_header_title_amount_big,
parent,
false
)
)
TITLE -> TitleViewHolder( TITLE -> TitleViewHolder(
LayoutInflater.from(parent.context).inflate( LayoutInflater.from(parent.context).inflate(
R.layout.row_title, 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" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rowHeaderTitleValue.container" android:id="@+id/rowHeaderTitleValue.container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="48dp"
android:orientation="vertical"> android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:background="@color/green_header"> android:background="@color/green_header">
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView
@ -17,8 +17,6 @@
style="@style/PokerAnalyticsTheme.TextView.RowTitle" style="@style/PokerAnalyticsTheme.TextView.RowTitle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="@+id/guidelineStart" app:layout_constraintStart_toStartOf="@+id/guidelineStart"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
@ -30,8 +28,6 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:ellipsize="end" android:ellipsize="end"
android:gravity="end" android:gravity="end"
android:maxLines="1" android:maxLines="1"

@ -1,63 +1,66 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rowTitleSwitch.container" android:id="@+id/rowTitleSwitch.container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?selectableItemBackground"> android:background="?selectableItemBackground">
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView
android:id="@+id/rowTitleSwitch.title" android:id="@+id/rowTitleSwitch.title"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" style="@style/PokerAnalyticsTheme.TextView.RowTitle"
android:layout_marginBottom="16dp" android:layout_marginTop="16dp"
android:textSize="16sp" android:layout_marginEnd="8dp"
app:layout_constraintBottom_toBottomOf="parent" android:layout_marginBottom="16dp"
app:layout_constraintEnd_toEndOf="@+id/guidelineEnd" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="@+id/guidelineStart" app:layout_constraintEnd_toStartOf="@+id/rowTitleSwitch.switch"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintStart_toStartOf="@+id/guidelineStart"
tools:text="Data Type Title"/> app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0"
tools:text="Data Type Title" />
<androidx.constraintlayout.widget.Guideline <androidx.constraintlayout.widget.Guideline
android:id="@+id/guidelineStart" android:id="@+id/guidelineStart"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
app:layout_constraintGuide_begin="16dp"/> app:layout_constraintGuide_begin="16dp" />
<androidx.constraintlayout.widget.Guideline <androidx.constraintlayout.widget.Guideline
android:id="@+id/guidelineEnd" android:id="@+id/guidelineEnd"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
app:layout_constraintGuide_end="16dp"/> app:layout_constraintGuide_end="16dp" />
<Switch
android:layout_width="wrap_content" <androidx.appcompat.widget.SwitchCompat
android:layout_height="wrap_content" android:id="@+id/rowTitleSwitch.switch"
android:id="@+id/rowTitleSwitch.switch" android:layout_width="wrap_content"
app:layout_constraintTop_toTopOf="parent" android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="@+id/rowTitleSwitch.title" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" android:layout_marginStart="356dp"/> app:layout_constraintEnd_toStartOf="@+id/guidelineEnd"
app:layout_constraintTop_toTopOf="parent" />
<FrameLayout <FrameLayout
android:id="@+id/rowTitleSwitch.separator" android:id="@+id/rowTitleSwitch.separator"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="16dp" android:layout_height="16dp"
android:visibility="gone" android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
tools:visibility="visible"> tools:visibility="visible">
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1dp" android:layout_height="1dp"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:background="@color/kaki" /> android:background="@color/kaki" />
</FrameLayout> </FrameLayout>

Loading…
Cancel
Save