Clean style

feature/top10
Aurelien Hubert 7 years ago
parent eb3dec4e6b
commit ce1d3eff83
  1. 8
      app/src/main/java/net/pokeranalytics/android/ui/fragment/HistoryFragment.kt
  2. 2
      app/src/main/java/net/pokeranalytics/android/ui/fragment/StatsFragment.kt
  3. 13
      app/src/main/java/net/pokeranalytics/android/ui/view/RowViewType.kt
  4. 4
      app/src/main/java/net/pokeranalytics/android/ui/view/rowrepresentable/HeaderRowRepresentable.kt
  5. 10
      app/src/main/java/net/pokeranalytics/android/ui/view/rowrepresentable/SettingRow.kt
  6. BIN
      app/src/main/res/drawable-xxhdpi/add_tournament.png
  7. BIN
      app/src/main/res/drawable-xxhdpi/add_tournoi.png
  8. 6
      app/src/main/res/layout/fragment_history.xml
  9. 0
      app/src/main/res/layout/row_header_title.xml
  10. 2
      app/src/main/res/layout/row_session_view.xml
  11. 3
      app/src/main/res/layout/row_stats_title_value.xml
  12. 2
      app/src/main/res/layout/row_title.xml
  13. 2
      app/src/main/res/layout/row_title_arrow.xml
  14. 2
      app/src/main/res/layout/row_title_value.xml
  15. 2
      app/src/main/res/layout/row_title_value_action.xml
  16. 2
      app/src/main/res/values/colors.xml
  17. 7
      app/src/main/res/values/styles.xml

@ -127,7 +127,7 @@ class HistoryFragment : PokerAnalyticsFragment(), LiveRowRepresentableDataSource
if (!calendar.isSameDay(currentCalendar) || index == 0) {
calendar.time = currentCalendar.time
val header = HeaderRowRepresentable(
customViewType = RowViewType.HEADER_SESSION,
customViewType = RowViewType.HEADER_TITLE,
title = session.creationDate.longDate()
)
rows.add(header)
@ -136,7 +136,7 @@ class HistoryFragment : PokerAnalyticsFragment(), LiveRowRepresentableDataSource
if (!calendar.isSameMonth(currentCalendar) || index == 0) {
calendar.time = currentCalendar.time
val header = HeaderRowRepresentable(
customViewType = RowViewType.HEADER_SESSION,
customViewType = RowViewType.HEADER_TITLE,
title = session.creationDate.getMonthAndYear()
)
rows.add(header)
@ -165,8 +165,8 @@ class HistoryFragment : PokerAnalyticsFragment(), LiveRowRepresentableDataSource
}
override fun viewTypeForPosition(position: Int): Int {
return if (rows[position].viewType == RowViewType.HEADER_SESSION.ordinal) {
RowViewType.HEADER_SESSION.ordinal
return if (rows[position].viewType == RowViewType.HEADER_TITLE.ordinal) {
RowViewType.HEADER_TITLE.ordinal
} else {
RowViewType.ROW_SESSION.ordinal
}

@ -141,7 +141,7 @@ class StatsFragment : SessionObserverFragment(), StaticRowRepresentableDataSourc
val rows: ArrayList<RowRepresentable> = ArrayList()
results.forEach { results ->
rows.add(HeaderRowRepresentable(RowViewType.TITLE, title = results.group.name))
rows.add(HeaderRowRepresentable(title = results.group.name))
results.group.stats?.forEach { stat ->
rows.add(StatRepresentable(stat, results.computedStat(stat)))
}

@ -9,10 +9,10 @@ import androidx.constraintlayout.widget.ConstraintLayout
import androidx.recyclerview.widget.RecyclerView
import kotlinx.android.synthetic.main.row_bottom_sheet_grid_title.view.*
import kotlinx.android.synthetic.main.row_bottom_sheet_title.view.*
import kotlinx.android.synthetic.main.row_header_title.view.*
import kotlinx.android.synthetic.main.row_header_title_amount.view.*
import kotlinx.android.synthetic.main.row_header_title_value.view.*
import kotlinx.android.synthetic.main.row_history_session.view.*
import kotlinx.android.synthetic.main.row_history_session_header.view.*
import kotlinx.android.synthetic.main.row_stats_title_value.view.*
import kotlinx.android.synthetic.main.row_title.view.*
import kotlinx.android.synthetic.main.row_title_switch.view.*
@ -29,19 +29,16 @@ import net.pokeranalytics.android.ui.view.rowrepresentable.HeaderRowRepresentabl
* An interface used to factor the configuration of RecyclerView.ViewHolder
*/
interface BindableHolder {
fun bind(position: Int, row: RowRepresentable, adapter: RowRepresentableAdapter) {
}
}
enum class RowViewType {
HEADER,
HEADER_TITLE_VALUE,
HEADER_TITLE_AMOUNT,
HEADER_TITLE_AMOUNT_BIG,
HEADER_SESSION,
HEADER_TITLE,
EDIT_TEXT,
TITLE,
TITLE_ARROW,
@ -138,10 +135,10 @@ enum class RowViewType {
false
)
)
HEADER_SESSION -> {
HEADER_TITLE -> {
HeaderSessionViewHolder(
LayoutInflater.from(parent.context).inflate(
R.layout.row_history_session_header,
R.layout.row_header_title,
parent,
false
)
@ -187,7 +184,7 @@ enum class RowViewType {
BindableHolder {
override fun bind(position: Int, row: RowRepresentable, adapter: RowRepresentableAdapter) {
itemView.rowHeaderTitleValue_title.text = row.localizedTitle(itemView.context)
adapter.dataSource?.let {
adapter.dataSource.let {
itemView.rowHeaderTitleValue_value.text = it.stringForRow(row, itemView.context)
}
//val listener = View.OnClickListener {

@ -8,7 +8,7 @@ import net.pokeranalytics.android.ui.view.RowViewType
* A class to display headers as row representable
*/
class HeaderRowRepresentable(
var customViewType: RowViewType? = RowViewType.HEADER,
var customViewType: RowViewType? = RowViewType.HEADER_TITLE,
override var resId: Int? = null,
var title: String? = null,
var value: String? = null
@ -26,6 +26,6 @@ class HeaderRowRepresentable(
}
override val viewType: Int = customViewType?.ordinal ?: RowViewType.HEADER.ordinal
override val viewType: Int = customViewType?.ordinal ?: RowViewType.HEADER_TITLE.ordinal
}

@ -39,24 +39,24 @@ enum class SettingRow : RowRepresentable {
fun getRows(): ArrayList<RowRepresentable> {
val rows = ArrayList<RowRepresentable>()
rows.add(HeaderRowRepresentable(customViewType = RowViewType.HEADER_SESSION, resId = R.string.information))
rows.add(HeaderRowRepresentable(customViewType = RowViewType.HEADER_TITLE, resId = R.string.information))
rows.addAll(arrayListOf(VERSION, RATE_APP, CONTACT_US, BUG_REPORT))
rows.add(HeaderRowRepresentable(customViewType = RowViewType.HEADER_SESSION, resId = R.string.follow_us))
rows.add(HeaderRowRepresentable(customViewType = RowViewType.HEADER_TITLE, resId = R.string.follow_us))
rows.addAll(arrayListOf(FOLLOW_US))
rows.add(HeaderRowRepresentable(customViewType = RowViewType.HEADER_SESSION, resId = R.string.preferences))
rows.add(HeaderRowRepresentable(customViewType = RowViewType.HEADER_TITLE, resId = R.string.preferences))
rows.addAll(arrayListOf(CURRENCY))
rows.add(
HeaderRowRepresentable(
customViewType = RowViewType.HEADER_SESSION,
customViewType = RowViewType.HEADER_TITLE,
resId = R.string.data_management
)
)
rows.addAll(arrayListOf(BANKROLL, GAME, LOCATION, TOURNAMENT_TYPE))
rows.add(HeaderRowRepresentable(customViewType = RowViewType.HEADER_SESSION, resId = R.string.terms))
rows.add(HeaderRowRepresentable(customViewType = RowViewType.HEADER_TITLE, resId = R.string.terms))
rows.addAll(arrayListOf(PRIVACY_POLICY, TERMS_OF_USE, GDPR))
return rows

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

@ -82,7 +82,7 @@
android:layout_marginEnd="8dp"
android:text="@string/new_cash_game"
app:icon="@drawable/add_cash_game"
app:iconSize="32dp"
app:iconSize="28dp"
app:layout_constraintEnd_toStartOf="@+id/newTournament"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintHorizontal_chainStyle="spread"
@ -99,8 +99,8 @@
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:text="@string/new_tournament"
app:icon="@drawable/add_tournoi"
app:iconSize="32dp"
app:icon="@drawable/add_tournament"
app:iconSize="28dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/newCashGame"

@ -3,7 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="56dp"
android:background="?selectableItemBackground">
<androidx.appcompat.widget.AppCompatTextView

@ -31,7 +31,6 @@
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:paddingTop="-8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/nextArrow"
app:layout_constraintStart_toStartOf="@+id/guidelineStart"
@ -44,11 +43,11 @@
android:layout_height="24dp"
android:src="@drawable/ic_arrow_right"
android:tint="@color/gray_light"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/guidelineEnd"
app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guidelineStart"
android:layout_width="wrap_content"

@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rowTitle.container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="48dp"
android:background="?selectableItemBackground">
<androidx.appcompat.widget.AppCompatTextView

@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rowTitle.container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="48dp"
android:background="?selectableItemBackground">
<androidx.appcompat.widget.AppCompatTextView

@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rowTitleValue.container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="48dp"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout

@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rowTitleValueAction.container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="48dp"
android:background="?selectableItemBackground">
<androidx.appcompat.widget.AppCompatTextView

@ -8,7 +8,7 @@
<color name="white">#FFFFFF</color>
<color name="white_transparent">#30FFFFFF</color>
<color name="gray_light">#6AFFFFFF</color>
<color name="gray_light">#8AFFFFFF</color>
<color name="gray_darker">#141414</color>
<color name="gray_dark">#1B1F1B</color>

@ -111,7 +111,7 @@
</style>
<style name="PokerAnalyticsTheme.TextView.RowStatsValue">
<item name="android:textSize">24sp</item>
<item name="android:textSize">28sp</item>
<item name="android:textColor">@color/white</item>
<item name="android:fontFamily">@font/roboto_light</item>
<item name="android:maxLines">1</item>
@ -130,7 +130,7 @@
<item name="android:textColor">@color/kaki_medium</item>
<item name="android:maxLines">1</item>
<item name="android:ellipsize">end</item>
<item name="android:fontFamily">@font/roboto_bold</item>
<item name="android:fontFamily">@font/roboto_medium</item>
<item name="android:textSize">16sp</item>
</style>
@ -200,8 +200,9 @@
<!-- Button -->
<style name="PokerAnalyticsTheme.Button" parent="Widget.MaterialComponents.Button">
<item name="iconPadding">0dp</item>
<item name="android:height">48dp</item>
<item name="iconTint">@color/black</item>
<item name="android:letterSpacing">-0.02</item>
<item name="android:letterSpacing">0</item>
<item name="android:fontFamily">@font/roboto_medium</item>
<item name="android:textColor">@color/black</item>
<item name="android:paddingStart">4dp</item>

Loading…
Cancel
Save