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