DanaUserOptionsActivity: toolbar
This commit is contained in:
parent
e3ff4f33d6
commit
7d272cd4d7
3 changed files with 24 additions and 36 deletions
|
@ -8,6 +8,6 @@
|
||||||
<activity
|
<activity
|
||||||
android:name="info.nightscout.pump.dana.activities.DanaUserOptionsActivity"
|
android:name="info.nightscout.pump.dana.activities.DanaUserOptionsActivity"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:theme="@style/AppTheme.NoActionBar" />
|
android:theme="@style/AppTheme" />
|
||||||
</application>
|
</application>
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|
|
@ -2,6 +2,10 @@ package info.nightscout.pump.dana.activities
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.os.Bundle
|
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.ui.activities.TranslatedDaggerAppCompatActivity
|
||||||
import info.nightscout.core.utils.fabric.FabricPrivacy
|
import info.nightscout.core.utils.fabric.FabricPrivacy
|
||||||
import info.nightscout.interfaces.Constants
|
import info.nightscout.interfaces.Constants
|
||||||
|
@ -70,6 +74,10 @@ class DanaUserOptionsActivity : TranslatedDaggerAppCompatActivity() {
|
||||||
binding = DanarUserOptionsActivityBinding.inflate(layoutInflater)
|
binding = DanarUserOptionsActivityBinding.inflate(layoutInflater)
|
||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
|
|
||||||
|
title = rh.gs(R.string.danar_pump_settings)
|
||||||
|
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||||
|
supportActionBar?.setDisplayShowHomeEnabled(true)
|
||||||
|
|
||||||
binding.saveUserOptions.setOnClickListener { onSaveClick() }
|
binding.saveUserOptions.setOnClickListener { onSaveClick() }
|
||||||
|
|
||||||
minBacklight = if (danaPump.hwModel < 7) 1 else 0 // Dana-i allows zero
|
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!")
|
aapsLogger.error(LTag.PUMP, "No settings loaded from pump!")
|
||||||
else
|
else
|
||||||
setData()
|
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() {
|
private fun setData() {
|
||||||
|
|
|
@ -13,41 +13,6 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:id="@+id/header"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:background="?attr/activity_title_backgroundColor"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:padding="5dp">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:importantForAccessibility="no"
|
|
||||||
app:srcCompat="@drawable/ic_user_options" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_centerInParent="true"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_marginStart="10dp"
|
|
||||||
android:layout_marginEnd="10dp"
|
|
||||||
android:text="@string/danar_pump_settings"
|
|
||||||
android:textAlignment="center"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/spacer"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:padding="5dp" />
|
|
||||||
|
|
||||||
<com.google.android.material.switchmaterial.SwitchMaterial
|
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||||
android:id="@+id/time_format"
|
android:id="@+id/time_format"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
Loading…
Reference in a new issue