diff --git a/pump/dana/src/main/AndroidManifest.xml b/pump/dana/src/main/AndroidManifest.xml index 28dc40916c..c33dfd49b9 100644 --- a/pump/dana/src/main/AndroidManifest.xml +++ b/pump/dana/src/main/AndroidManifest.xml @@ -8,6 +8,6 @@ + android:theme="@style/AppTheme" /> diff --git a/pump/dana/src/main/java/info/nightscout/pump/dana/activities/DanaUserOptionsActivity.kt b/pump/dana/src/main/java/info/nightscout/pump/dana/activities/DanaUserOptionsActivity.kt index 66211cb83b..941a536cf3 100644 --- a/pump/dana/src/main/java/info/nightscout/pump/dana/activities/DanaUserOptionsActivity.kt +++ b/pump/dana/src/main/java/info/nightscout/pump/dana/activities/DanaUserOptionsActivity.kt @@ -2,6 +2,10 @@ package info.nightscout.pump.dana.activities import android.content.Context import android.os.Bundle +import android.view.Menu +import android.view.MenuInflater +import android.view.MenuItem +import androidx.core.view.MenuProvider import info.nightscout.core.ui.activities.TranslatedDaggerAppCompatActivity import info.nightscout.core.utils.fabric.FabricPrivacy import info.nightscout.interfaces.Constants @@ -70,6 +74,10 @@ class DanaUserOptionsActivity : TranslatedDaggerAppCompatActivity() { binding = DanarUserOptionsActivityBinding.inflate(layoutInflater) setContentView(binding.root) + title = rh.gs(R.string.danar_pump_settings) + supportActionBar?.setDisplayHomeAsUpEnabled(true) + supportActionBar?.setDisplayShowHomeEnabled(true) + binding.saveUserOptions.setOnClickListener { onSaveClick() } minBacklight = if (danaPump.hwModel < 7) 1 else 0 // Dana-i allows zero @@ -114,6 +122,21 @@ class DanaUserOptionsActivity : TranslatedDaggerAppCompatActivity() { aapsLogger.error(LTag.PUMP, "No settings loaded from pump!") else setData() + + // 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 + } + }) } private fun setData() { diff --git a/pump/dana/src/main/res/layout/danar_user_options_activity.xml b/pump/dana/src/main/res/layout/danar_user_options_activity.xml index 48586cdf48..207b5670cc 100644 --- a/pump/dana/src/main/res/layout/danar_user_options_activity.xml +++ b/pump/dana/src/main/res/layout/danar_user_options_activity.xml @@ -13,41 +13,6 @@ android:layout_height="wrap_content" android:orientation="vertical"> - - - - - - - - - -