LogSettingActivity: toolbar
This commit is contained in:
parent
4d19608106
commit
67d5b2a7ee
4 changed files with 43 additions and 55 deletions
|
@ -12,7 +12,7 @@
|
||||||
<activity
|
<activity
|
||||||
android:name=".maintenance.activities.LogSettingActivity"
|
android:name=".maintenance.activities.LogSettingActivity"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:theme="@style/AppTheme.NoActionBar" />
|
android:theme="@style/AppTheme" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".maintenance.activities.PrefImportListActivity"
|
android:name=".maintenance.activities.PrefImportListActivity"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
|
|
|
@ -1,20 +1,26 @@
|
||||||
package info.nightscout.configuration.maintenance.activities
|
package info.nightscout.configuration.maintenance.activities
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.view.Menu
|
||||||
|
import android.view.MenuInflater
|
||||||
|
import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.CheckBox
|
import android.widget.CheckBox
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
|
import androidx.core.view.MenuProvider
|
||||||
import info.nightscout.configuration.R
|
import info.nightscout.configuration.R
|
||||||
import info.nightscout.configuration.databinding.ActivityLogsettingBinding
|
import info.nightscout.configuration.databinding.ActivityLogsettingBinding
|
||||||
import info.nightscout.core.ui.activities.TranslatedDaggerAppCompatActivity
|
import info.nightscout.core.ui.activities.TranslatedDaggerAppCompatActivity
|
||||||
import info.nightscout.rx.interfaces.L
|
import info.nightscout.rx.interfaces.L
|
||||||
import info.nightscout.rx.interfaces.LogElement
|
import info.nightscout.rx.interfaces.LogElement
|
||||||
|
import info.nightscout.shared.interfaces.ResourceHelper
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class LogSettingActivity : TranslatedDaggerAppCompatActivity() {
|
class LogSettingActivity : TranslatedDaggerAppCompatActivity() {
|
||||||
|
|
||||||
@Inject lateinit var l: L
|
@Inject lateinit var l: L
|
||||||
|
@Inject lateinit var rh: ResourceHelper
|
||||||
|
|
||||||
private lateinit var binding: ActivityLogsettingBinding
|
private lateinit var binding: ActivityLogsettingBinding
|
||||||
|
|
||||||
|
@ -23,13 +29,30 @@ class LogSettingActivity : TranslatedDaggerAppCompatActivity() {
|
||||||
binding = ActivityLogsettingBinding.inflate(layoutInflater)
|
binding = ActivityLogsettingBinding.inflate(layoutInflater)
|
||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
|
|
||||||
|
title = rh.gs(R.string.nav_logsettings)
|
||||||
|
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||||
|
supportActionBar?.setDisplayShowHomeEnabled(true)
|
||||||
|
|
||||||
createViewsForSettings()
|
createViewsForSettings()
|
||||||
|
|
||||||
binding.reset.setOnClickListener {
|
binding.reset.setOnClickListener {
|
||||||
l.resetToDefaults()
|
l.resetToDefaults()
|
||||||
createViewsForSettings()
|
createViewsForSettings()
|
||||||
}
|
}
|
||||||
binding.ok.setOnClickListener { finish() }
|
// 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 createViewsForSettings() {
|
private fun createViewsForSettings() {
|
||||||
|
|
|
@ -12,34 +12,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<RelativeLayout
|
<LinearLayout
|
||||||
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_aaps" />
|
|
||||||
|
|
||||||
<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/nav_logsettings"
|
|
||||||
android:textAlignment="center"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/spacer"
|
android:id="@+id/spacer"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -53,30 +26,22 @@
|
||||||
android:orientation="vertical" />
|
android:orientation="vertical" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/done_background"
|
android:layout_width="wrap_content"
|
||||||
android:layout_width="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="56dp"
|
android:layout_gravity="center"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal">
|
||||||
android:background="@android:color/transparent"
|
|
||||||
android:gravity="end"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:paddingBottom="8dp">
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/reset"
|
android:id="@+id/reset"
|
||||||
android:layout_height="wrap_content"
|
style="@style/GrayButton"
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_marginEnd="8dp"
|
|
||||||
style="@style/OkCancelButton.Text"
|
|
||||||
android:text="@string/resettodefaults" />
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
|
||||||
android:id="@+id/ok"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="16dp"
|
android:layout_gravity="center"
|
||||||
style="@style/OkCancelButton.Text"
|
android:paddingStart="10dp"
|
||||||
android:text="@string/ok" />
|
android:paddingEnd="10dp"
|
||||||
|
android:text="@string/resettodefaults"
|
||||||
|
app:icon="@drawable/ic_local_reset"
|
||||||
|
app:iconTint="@color/ic_local_reset" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="50dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:background="@android:color/transparent"
|
android:background="@android:color/transparent"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
@ -49,8 +49,8 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:paddingStart="1dp"
|
android:paddingStart="10dp"
|
||||||
android:paddingEnd="1dp"
|
android:paddingEnd="10dp"
|
||||||
android:text="@string/reset"
|
android:text="@string/reset"
|
||||||
app:icon="@drawable/ic_local_reset"
|
app:icon="@drawable/ic_local_reset"
|
||||||
app:iconTint="@color/ic_local_reset" />
|
app:iconTint="@color/ic_local_reset" />
|
||||||
|
@ -132,7 +132,7 @@
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="50dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
@ -142,8 +142,8 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:paddingStart="1dp"
|
android:paddingStart="10dp"
|
||||||
android:paddingEnd="1dp"
|
android:paddingEnd="10dp"
|
||||||
android:text="@string/reset"
|
android:text="@string/reset"
|
||||||
android:layout_marginEnd="8dp"
|
android:layout_marginEnd="8dp"
|
||||||
app:icon="@drawable/ic_local_reset"
|
app:icon="@drawable/ic_local_reset"
|
||||||
|
|
Loading…
Reference in a new issue