Skip to content

Commit

Permalink
Statistics uses xml from statistic.xml instead of page_fragment.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
neeldoshii committed Mar 31, 2024
1 parent 1c5a6b3 commit db6a951
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
12 changes: 11 additions & 1 deletion AnkiDroid/src/main/java/com/ichi2/anki/pages/Statistics.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ import android.content.Intent
import android.os.Bundle
import android.print.PrintAttributes
import android.print.PrintManager
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.content.ContextCompat.getSystemService
import com.google.android.material.appbar.MaterialToolbar
import com.ichi2.anki.CollectionManager
Expand All @@ -34,10 +36,18 @@ class Statistics : PageFragment() {
get() = resources.getString(R.string.statistics)

override val pageName = "graphs"
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.statistics, container, false)
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
view.findViewById<MaterialToolbar>(R.id.toolbar)?.apply {
val toolbar = view.findViewById(R.id.toolbar) as MaterialToolbar
toolbar.apply {
inflateMenu(R.menu.statistics)
menu.findItem(R.id.action_export_stats).title = CollectionManager.TR.statisticsSavePdf()
setOnMenuItemClickListener { item ->
Expand Down
36 changes: 36 additions & 0 deletions AnkiDroid/src/main/res/layout/statistics.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">

<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">

<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:navigationContentDescription="@string/abc_action_bar_up_description"
app:navigationIcon="?attr/homeAsUpIndicator"
app:layout_scrollFlags="scroll|enterAlways|snap" />
</com.google.android.material.appbar.AppBarLayout>

<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="invisible"/>
</androidx.core.widget.NestedScrollView>

</androidx.coordinatorlayout.widget.CoordinatorLayout>

0 comments on commit db6a951

Please sign in to comment.