DashPodManagementActivity: toolbar

This commit is contained in:
Milos Kozak 2023-08-19 11:00:31 +02:00
parent 7d272cd4d7
commit 5746f4fe0d
3 changed files with 23 additions and 21 deletions

View file

@ -19,7 +19,7 @@
<activity
android:name=".ui.DashPodManagementActivity"
android:exported="false"
android:theme="@style/AppTheme.NoActionBar" />
android:theme="@style/AppTheme" />
<activity
android:name=".ui.DashPodHistoryActivity"
android:exported="false"

View file

@ -3,6 +3,10 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.ui
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
import androidx.core.view.MenuProvider
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.plugins.pump.omnipod.common.queue.command.CommandPlayTestBeep
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.PodActivationWizardActivity
@ -48,6 +52,10 @@ class DashPodManagementActivity : TranslatedDaggerAppCompatActivity() {
binding = OmnipodDashPodManagementBinding.inflate(layoutInflater)
setContentView(binding.root)
title = rh.gs(info.nightscout.androidaps.plugins.pump.omnipod.common.R.string.omnipod_common_pod_management_heading_actions)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
supportActionBar?.setDisplayShowHomeEnabled(true)
binding.buttonActivatePod.setOnClickListener {
val type: PodActivationWizardActivity.Type =
if (podStateManager.activationProgress.isAtLeast(ActivationProgress.PRIME_COMPLETED)) {
@ -102,6 +110,20 @@ class DashPodManagementActivity : TranslatedDaggerAppCompatActivity() {
binding.buttonPodHistory.setOnClickListener {
startActivity(Intent(this, DashPodHistoryActivity::class.java))
}
// 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() {

View file

@ -13,26 +13,6 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="10dp"
android:gravity="center"
android:text="@string/omnipod_common_pod_management_title"
android:textAlignment="center"
android:textSize="12pt"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:paddingStart="15dp"
android:paddingEnd="15dp"
android:text="@string/omnipod_common_pod_management_heading_actions" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/Actions_Row_1"
android:layout_width="match_parent"