0
0
mirror of https://github.com/ankidroid/Anki-Android.git synced 2024-09-19 19:42:17 +02:00

Statistics uses xml from statistic.xml instead of page_fragment.xml

Refactor : Code Improvement
FIX :Correct AppBar Small Bug
This commit is contained in:
Neel Doshi 2024-03-31 06:45:05 +05:30 committed by David Allison
parent 1c5a6b3c22
commit 7a4dfd093d
2 changed files with 45 additions and 1 deletions

View File

@ -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
@ -34,10 +36,17 @@ 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 {
view.findViewById<MaterialToolbar>(R.id.toolbar).apply {
inflateMenu(R.menu.statistics)
menu.findItem(R.id.action_export_stats).title = CollectionManager.TR.statisticsSavePdf()
setOnMenuItemClickListener { item ->

View File

@ -0,0 +1,35 @@
<?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">
<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>