ErosPodManagementActivity: toolbar

This commit is contained in:
Milos Kozak 2023-08-19 12:13:52 +02:00
parent ac3015bc86
commit f65c7bb517
4 changed files with 24 additions and 14 deletions

View file

@ -52,7 +52,7 @@ class DashPodManagementActivity : TranslatedDaggerAppCompatActivity() {
binding = OmnipodDashPodManagementBinding.inflate(layoutInflater) binding = OmnipodDashPodManagementBinding.inflate(layoutInflater)
setContentView(binding.root) setContentView(binding.root)
title = rh.gs(info.nightscout.androidaps.plugins.pump.omnipod.common.R.string.omnipod_common_pod_management_heading_actions) title = rh.gs(info.nightscout.androidaps.plugins.pump.omnipod.common.R.string.omnipod_common_pod_management_title)
supportActionBar?.setDisplayHomeAsUpEnabled(true) supportActionBar?.setDisplayHomeAsUpEnabled(true)
supportActionBar?.setDisplayShowHomeEnabled(true) supportActionBar?.setDisplayShowHomeEnabled(true)

View file

@ -17,7 +17,7 @@
<activity <activity
android:name=".ui.ErosPodManagementActivity" android:name=".ui.ErosPodManagementActivity"
android:exported="false" android:exported="false"
android:theme="@style/AppTheme.NoActionBar" /> android:theme="@style/AppTheme" />
<activity <activity
android:name=".ui.ErosPodHistoryActivity" android:name=".ui.ErosPodHistoryActivity"
android:exported="false" android:exported="false"

View file

@ -5,6 +5,10 @@ import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.os.Handler import android.os.Handler
import android.os.HandlerThread import android.os.HandlerThread
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
import androidx.core.view.MenuProvider
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusActivity import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusActivity
@ -70,6 +74,10 @@ class ErosPodManagementActivity : TranslatedDaggerAppCompatActivity() {
binding = OmnipodErosPodManagementBinding.inflate(layoutInflater) binding = OmnipodErosPodManagementBinding.inflate(layoutInflater)
setContentView(binding.root) setContentView(binding.root)
title = rh.gs(info.nightscout.androidaps.plugins.pump.omnipod.common.R.string.omnipod_common_pod_management_title)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
supportActionBar?.setDisplayShowHomeEnabled(true)
binding.buttonActivatePod.setOnClickListener { binding.buttonActivatePod.setOnClickListener {
val type: PodActivationWizardActivity.Type = if (podStateManager.isPodInitialized val type: PodActivationWizardActivity.Type = if (podStateManager.isPodInitialized
and podStateManager.activationProgress.isAtLeast(ActivationProgress.PRIMING_COMPLETED) and podStateManager.activationProgress.isAtLeast(ActivationProgress.PRIMING_COMPLETED)
@ -145,6 +153,20 @@ class ErosPodManagementActivity : TranslatedDaggerAppCompatActivity() {
binding.buttonPodHistory.setOnClickListener { binding.buttonPodHistory.setOnClickListener {
startActivity(Intent(this, ErosPodHistoryActivity::class.java)) startActivity(Intent(this, ErosPodHistoryActivity::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() { override fun onResume() {

View file

@ -13,18 +13,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_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" />
<LinearLayout <LinearLayout
android:id="@+id/waiting_for_rl_layout" android:id="@+id/waiting_for_rl_layout"
android:layout_width="match_parent" android:layout_width="match_parent"