TDDStatsActivity: toolbar

This commit is contained in:
Milos Kozak 2023-08-19 10:34:11 +02:00
parent 2db4f162ad
commit eda7c1e552
3 changed files with 23 additions and 9 deletions

View file

@ -27,7 +27,7 @@
<activity <activity
android:name=".activities.TDDStatsActivity" android:name=".activities.TDDStatsActivity"
android:exported="false" android:exported="false"
android:theme="@style/AppTheme.NoActionBar" /> android:theme="@style/AppTheme" />
<activity <activity
android:name="info.nightscout.ui.activities.BolusProgressHelperActivity" android:name="info.nightscout.ui.activities.BolusProgressHelperActivity"
android:exported="false" android:exported="false"

View file

@ -5,6 +5,9 @@ import android.graphics.Rect
import android.os.Bundle import android.os.Bundle
import android.text.TextUtils import android.text.TextUtils
import android.view.KeyEvent import android.view.KeyEvent
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
import android.view.MotionEvent import android.view.MotionEvent
import android.view.View import android.view.View
import android.view.WindowManager import android.view.WindowManager
@ -14,6 +17,7 @@ import android.widget.EditText
import android.widget.TableLayout import android.widget.TableLayout
import android.widget.TableRow import android.widget.TableRow
import android.widget.TextView import android.widget.TextView
import androidx.core.view.MenuProvider
import info.nightscout.core.ui.activities.TranslatedDaggerAppCompatActivity import info.nightscout.core.ui.activities.TranslatedDaggerAppCompatActivity
import info.nightscout.core.utils.fabric.FabricPrivacy import info.nightscout.core.utils.fabric.FabricPrivacy
import info.nightscout.database.entities.TotalDailyDose import info.nightscout.database.entities.TotalDailyDose
@ -70,6 +74,10 @@ class TDDStatsActivity : TranslatedDaggerAppCompatActivity() {
binding = ActivityTddStatsBinding.inflate(layoutInflater) binding = ActivityTddStatsBinding.inflate(layoutInflater)
setContentView(binding.root) setContentView(binding.root)
title = rh.gs(info.nightscout.core.ui.R.string.tdd)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
supportActionBar?.setDisplayShowHomeEnabled(true)
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN) window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN)
binding.connectionStatus.visibility = View.GONE binding.connectionStatus.visibility = View.GONE
binding.message.visibility = View.GONE binding.message.visibility = View.GONE
@ -192,6 +200,20 @@ class TDDStatsActivity : TranslatedDaggerAppCompatActivity() {
} }
} }
loadDataFromDB() loadDataFromDB()
// Add menu items without overriding methods in the Activity
addMenuProvider(object : MenuProvider {
override fun onCreateMenu(menu: Menu, menuInflater: MenuInflater) {}
override fun onMenuItemSelected(menuItem: MenuItem): Boolean =
when (menuItem.itemId) {
android.R.id.home -> {
onBackPressedDispatcher.onBackPressed()
true
}
else -> false
}
})
} }
override fun onResume() { override fun onResume() {

View file

@ -18,14 +18,6 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/pillborder"
android:gravity="center_horizontal"
android:text="@string/tdd" />
<TableLayout <TableLayout
android:id="@+id/main_table" android:id="@+id/main_table"
android:layout_width="match_parent" android:layout_width="match_parent"