diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 4caf0748..37e6961f 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -49,6 +49,11 @@
android:launchMode="singleTop"
android:screenOrientation="portrait" />
+
+
= ArrayList()
+
+ override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
+ return inflater.inflate(R.layout.fragment_calendar_details, container, false)
+ }
+
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ super.onViewCreated(view, savedInstanceState)
+ initUI()
+ }
+
+ /**
+ * Init UI
+ */
+ private fun initUI() {
+
+ parentActivity = activity as PokerAnalyticsActivity
+
+ // Avoid a bug during setting the title
+ toolbar.title = ""
+
+ parentActivity.setSupportActionBar(toolbar)
+ parentActivity.supportActionBar?.setDisplayHomeAsUpEnabled(true)
+ setHasOptionsMenu(true)
+
+ /*
+ toolbar.title = stat.localizedTitle(requireContext())
+
+ val fragmentManager = parentActivity.supportFragmentManager
+ val fragmentTransaction = fragmentManager.beginTransaction()
+ val fragment = GraphFragment()
+
+ fragmentTransaction.add(R.id.container, fragment)
+ fragmentTransaction.commit()
+
+ StatisticDetailsActivity.parameters?.let {
+ fragment.setData(it.stat, it.report)
+ StatisticDetailsActivity.parameters = null
+ } ?: run {
+ throw Exception("Missing graph parameters")
+ }
+ */
+ }
+
+ /**
+ * Set data
+ */
+ fun setData(stat: Stat, entries: List) {
+ //this.stat = stat
+ //this.entries = entries
+ }
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/net/pokeranalytics/android/ui/fragment/CalendarFragment.kt b/app/src/main/java/net/pokeranalytics/android/ui/fragment/CalendarFragment.kt
index b11bb28f..48ddeb9a 100644
--- a/app/src/main/java/net/pokeranalytics/android/ui/fragment/CalendarFragment.kt
+++ b/app/src/main/java/net/pokeranalytics/android/ui/fragment/CalendarFragment.kt
@@ -18,6 +18,7 @@ import net.pokeranalytics.android.calculus.ComputedResults
import net.pokeranalytics.android.calculus.Stat
import net.pokeranalytics.android.model.comparison.Comparator
import net.pokeranalytics.android.model.comparison.combined
+import net.pokeranalytics.android.ui.activity.CalendarDetailsActivity
import net.pokeranalytics.android.ui.adapter.RowRepresentableAdapter
import net.pokeranalytics.android.ui.adapter.RowRepresentableDelegate
import net.pokeranalytics.android.ui.adapter.StaticRowRepresentableDataSource
@@ -35,8 +36,6 @@ import java.util.*
import kotlin.coroutines.CoroutineContext
-
-
class CalendarFragment : SessionObserverFragment(), CoroutineScope, StaticRowRepresentableDataSource, RowRepresentableDelegate {
private enum class SessionType {
@@ -69,6 +68,7 @@ class CalendarFragment : SessionObserverFragment(), CoroutineScope, StaticRowRep
private var rows: ArrayList = ArrayList()
private var sortedMonthlyReports: SortedMap = HashMap().toSortedMap()
private var sortedYearlyReports: SortedMap = HashMap().toSortedMap()
+ private var datesForRows: HashMap = HashMap()
private var currentSessionType = SessionType.ALL
private var currentTimeFilter = TimeFilter.MONTH
@@ -93,7 +93,8 @@ class CalendarFragment : SessionObserverFragment(), CoroutineScope, StaticRowRep
}
override fun onRowSelected(position: Int, row: RowRepresentable, fromAction: Boolean) {
- //toast("Open $row")
+ Timber.d("Open ${datesForRows[row]}")
+ CalendarDetailsActivity.newInstance(requireContext())
}
override fun sessionsChanged() {
@@ -304,6 +305,7 @@ class CalendarFragment : SessionObserverFragment(), CoroutineScope, StaticRowRep
val startDate = Date()
+ datesForRows.clear()
rows.clear()
when (currentTimeFilter) {
@@ -323,14 +325,16 @@ class CalendarFragment : SessionObserverFragment(), CoroutineScope, StaticRowRep
}
sortedMonthlyReports[date]?.computedStat(currentStat)?.let { computedStat ->
- rows.add(
- CustomizableRowRepresentable(
- customViewType = RowViewType.TITLE_VALUE_ARROW,
- title = date.getDateMonth(),
- computedStat = computedStat,
- isSelectable = true
- )
+
+ val row = CustomizableRowRepresentable(
+ customViewType = RowViewType.TITLE_VALUE_ARROW,
+ title = date.getDateMonth(),
+ computedStat = computedStat,
+ isSelectable = true
)
+
+ rows.add(row)
+ datesForRows.put(row, date)
}
}
}
@@ -339,14 +343,15 @@ class CalendarFragment : SessionObserverFragment(), CoroutineScope, StaticRowRep
TimeFilter.YEAR -> {
sortedYearlyReports.keys.forEach { date ->
sortedYearlyReports[date]?.computedStat(currentStat)?.let { computedStat ->
- rows.add(
- CustomizableRowRepresentable(
- customViewType = RowViewType.TITLE_VALUE_ARROW,
- title = date.getDateYear(),
- computedStat = computedStat,
- isSelectable = true
- )
+ val row = CustomizableRowRepresentable(
+ customViewType = RowViewType.TITLE_VALUE_ARROW,
+ title = date.getDateYear(),
+ computedStat = computedStat,
+ isSelectable = true
)
+
+ rows.add(row)
+ datesForRows.put(row, date)
}
}
}
diff --git a/app/src/main/res/layout/activity_calendar_details.xml b/app/src/main/res/layout/activity_calendar_details.xml
new file mode 100644
index 00000000..5085b07e
--- /dev/null
+++ b/app/src/main/res/layout/activity_calendar_details.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_calendar_details.xml b/app/src/main/res/layout/fragment_calendar_details.xml
new file mode 100644
index 00000000..44e1e283
--- /dev/null
+++ b/app/src/main/res/layout/fragment_calendar_details.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+