HistoryBrowser: toolbar
This commit is contained in:
parent
5c6af3c3e1
commit
36dee44ffc
2 changed files with 23 additions and 1 deletions
|
@ -73,7 +73,7 @@
|
|||
<activity
|
||||
android:name=".activities.HistoryBrowseActivity"
|
||||
android:exported="false"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
android:theme="@style/AppTheme" />
|
||||
<!-- Receive new BG readings from other local apps -->
|
||||
<receiver
|
||||
android:name=".receivers.DataReceiver"
|
||||
|
|
|
@ -4,10 +4,14 @@ import android.annotation.SuppressLint
|
|||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.util.DisplayMetrics
|
||||
import android.view.Menu
|
||||
import android.view.MenuInflater
|
||||
import android.view.MenuItem
|
||||
import android.view.ViewGroup
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.RelativeLayout
|
||||
import android.widget.TextView
|
||||
import androidx.core.view.MenuProvider
|
||||
import com.google.android.material.datepicker.MaterialDatePicker
|
||||
import com.jjoe64.graphview.GraphView
|
||||
import dagger.android.HasAndroidInjector
|
||||
|
@ -76,6 +80,10 @@ class HistoryBrowseActivity : TranslatedDaggerAppCompatActivity() {
|
|||
binding = ActivityHistorybrowseBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
||||
title = rh.gs(info.nightscout.plugins.R.string.nav_history_browser)
|
||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||
supportActionBar?.setDisplayShowHomeEnabled(true)
|
||||
|
||||
binding.left.setOnClickListener {
|
||||
adjustTimeRange(historyBrowserData.overviewData.fromTime - T.hours(rangeToDisplay.toLong()).msecs())
|
||||
loadAll("onClickLeft")
|
||||
|
@ -140,6 +148,20 @@ class HistoryBrowseActivity : TranslatedDaggerAppCompatActivity() {
|
|||
historyBrowserData.overviewData.fromTime = bundle.getLong("start", 0)
|
||||
historyBrowserData.overviewData.toTime = bundle.getLong("end", 0)
|
||||
}
|
||||
// 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 onPause() {
|
||||
|
|
Loading…
Reference in a new issue