feature/top10
Laurent 7 years ago
commit 74dd8116a3
  1. 11
      app/src/main/java/net/pokeranalytics/android/ui/fragment/CalendarFragment.kt
  2. 29
      app/src/main/java/net/pokeranalytics/android/ui/view/CalendarTabs.kt
  3. 24
      app/src/main/res/layout/fragment_calendar.xml
  4. 24
      app/src/main/res/layout/fragment_comparison_chart.xml

@ -6,7 +6,8 @@ import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.LinearLayoutManager
import io.realm.Realm
import kotlinx.android.synthetic.main.fragment_stats.*
import kotlinx.android.synthetic.main.fragment_calendar.*
import kotlinx.android.synthetic.main.fragment_stats.recyclerView
import kotlinx.coroutines.*
import net.pokeranalytics.android.R
import net.pokeranalytics.android.calculus.Calculator
@ -15,9 +16,11 @@ import net.pokeranalytics.android.calculus.Stat
import net.pokeranalytics.android.model.comparison.Comparator
import net.pokeranalytics.android.model.filter.QueryCondition
import net.pokeranalytics.android.ui.fragment.components.SessionObserverFragment
import net.pokeranalytics.android.ui.view.CalendarTabs
import java.util.*
import kotlin.coroutines.CoroutineContext
class CalendarFragment : SessionObserverFragment(), CoroutineScope {
companion object {
@ -127,6 +130,12 @@ class CalendarFragment : SessionObserverFragment(), CoroutineScope {
*/
private fun initUI() {
CalendarTabs.values().forEach {
val tab = tabs.newTab()
tab.text = getString(it.resId)
tabs.addTab(tab)
}
val viewManager = LinearLayoutManager(requireContext())
recyclerView.apply {

@ -0,0 +1,29 @@
package net.pokeranalytics.android.ui.view
import net.pokeranalytics.android.R
enum class CalendarTabs : Displayable {
NET_RESULTS,
NET_HOURLY_RATE,
NUMBER_OF_GAMES,
WIN_RATIO,
STANDARD_DEVIATION_PER_HOUR,
AVERAGE_NET_RESULT,
AVERAGE_DURATION,
DURATION_OF_PLAY;
override val resId: Int
get() {
return when (this) {
NET_RESULTS -> R.string.net_result
NET_HOURLY_RATE -> R.string.hour_rate_without_pauses
NUMBER_OF_GAMES -> R.string.number_of_records
WIN_RATIO -> R.string.win_ratio
STANDARD_DEVIATION_PER_HOUR -> R.string.standard_deviation_per_hour
AVERAGE_NET_RESULT -> R.string.average_net_result
AVERAGE_DURATION -> R.string.average_hours_played
DURATION_OF_PLAY -> R.string.total_hours_played
}
}
}

@ -1,11 +1,29 @@
<?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:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:theme="@style/PokerAnalyticsTheme.Toolbar.Session"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabMode="scrollable">
</com.google.android.material.tabs.TabLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="0dp"
@ -13,6 +31,6 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toBottomOf="@+id/appBar" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -7,11 +7,12 @@
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBar"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:theme="@style/PokerAnalyticsTheme.Toolbar.Session"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
@ -24,24 +25,7 @@
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/bar" />
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/line" />
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/table" />
</com.google.android.material.tabs.TabLayout>
android:layout_height="wrap_content" />
</com.google.android.material.appbar.AppBarLayout>

Loading…
Cancel
Save