SetupWizard: toolbar
This commit is contained in:
parent
d065f1fd86
commit
5c6af3c3e1
9 changed files with 25 additions and 54 deletions
|
@ -58,7 +58,7 @@
|
|||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
android:theme="@style/AppTheme">
|
||||
android:theme="@style/AppTheme.NoActionBar">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
|
|
@ -22,7 +22,6 @@ class PreferencesActivity : DaggerAppCompatActivityWithResult(), PreferenceFragm
|
|||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setTheme(info.nightscout.core.ui.R.style.AppTheme)
|
||||
binding = ActivityPreferencesBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
android:name=".setupwizard.SetupWizardActivity"
|
||||
android:configChanges="orientation|keyboardHidden|screenSize"
|
||||
android:exported="false"
|
||||
android:label="@string/title_activity_setup_wizard"
|
||||
android:theme="@style/AppTheme" />
|
||||
<activity
|
||||
android:name=".maintenance.activities.LogSettingActivity"
|
||||
|
|
|
@ -33,7 +33,6 @@ open class DaggerAppCompatActivityWithResult : DaggerAppCompatActivity() {
|
|||
|
||||
public override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setTheme(info.nightscout.core.ui.R.style.AppTheme_NoActionBar)
|
||||
|
||||
compositeDisposable.add(rxBus.toObservable(EventThemeSwitch::class.java).subscribe {
|
||||
recreate()
|
||||
|
|
|
@ -89,7 +89,7 @@ class SWDefinition @Inject constructor(
|
|||
}
|
||||
|
||||
private val screenSetupWizard
|
||||
get() = SWScreen(injector, R.string.nav_setupwizard)
|
||||
get() = SWScreen(injector, R.string.welcome)
|
||||
.add(SWInfoText(injector).label(R.string.welcometosetupwizard))
|
||||
|
||||
private val screenEula
|
||||
|
|
|
@ -2,9 +2,13 @@ package info.nightscout.configuration.setupwizard
|
|||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.Menu
|
||||
import android.view.MenuInflater
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
import androidx.activity.OnBackPressedCallback
|
||||
import androidx.core.view.MenuProvider
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.configuration.R
|
||||
import info.nightscout.configuration.activities.DaggerAppCompatActivityWithResult
|
||||
|
@ -51,6 +55,10 @@ class SetupWizardActivity : DaggerAppCompatActivityWithResult() {
|
|||
binding = ActivitySetupwizardBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
||||
title = rh.gs(R.string.nav_setupwizard)
|
||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||
supportActionBar?.setDisplayShowHomeEnabled(true)
|
||||
|
||||
swDefinition.activity = this
|
||||
screens = swDefinition.getScreens()
|
||||
val intent = intent
|
||||
|
@ -71,6 +79,20 @@ class SetupWizardActivity : DaggerAppCompatActivityWithResult() {
|
|||
OKDialog.showConfirmation(this@SetupWizardActivity, rh.gs(R.string.exitwizard)) { finish() } else showPreviousPage(null)
|
||||
}
|
||||
})
|
||||
addMenuProvider(object : MenuProvider {
|
||||
override fun onCreateMenu(menu: Menu, menuInflater: MenuInflater) {}
|
||||
|
||||
override fun onMenuItemSelected(menuItem: MenuItem): Boolean =
|
||||
when (menuItem.itemId) {
|
||||
android.R.id.home -> {
|
||||
sp.putBoolean(R.string.key_setupwizard_processed, true)
|
||||
OKDialog.showConfirmation(this@SetupWizardActivity, rh.gs(R.string.exitwizard)) { finish() }
|
||||
true
|
||||
}
|
||||
|
||||
else -> false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
|
@ -141,12 +163,6 @@ class SetupWizardActivity : DaggerAppCompatActivityWithResult() {
|
|||
}
|
||||
}
|
||||
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
fun exitPressed(view: View?) {
|
||||
sp.putBoolean(R.string.key_setupwizard_processed, true)
|
||||
OKDialog.showConfirmation(this, rh.gs(R.string.exitwizard)) { finish() }
|
||||
}
|
||||
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
fun showNextPage(view: View?) {
|
||||
finish()
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M16.495,12.092l-4.921,-4.92l-1.444,1.444l2.468,2.467l-9.765,0l0,2.042l9.765,0l-2.468,2.467l1.444,1.444l4.921,-4.92l-0.012,-0.012z"
|
||||
android:fillColor="?attr/defaultTextColor" />
|
||||
<path
|
||||
android:pathData="M18.682,2.975H5.152c-1.272,0 -2.307,1.035 -2.307,2.307v3.801h2.126V5.282c0,-0.1 0.081,-0.181 0.181,-0.181h13.53c0.1,0 0.181,0.081 0.181,0.181v13.436c0,0.1 -0.081,0.181 -0.181,0.181H5.152c-0.1,0 -0.181,-0.081 -0.181,-0.181v-3.593H2.845v3.593c0,1.272 1.035,2.307 2.307,2.307h13.53c1.272,0 2.308,-1.034 2.308,-2.307V5.282C20.989,4.01 19.954,2.975 18.682,2.975z"
|
||||
android:fillColor="?attr/defaultTextColor" />
|
||||
</vector>
|
|
@ -1,41 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context="info.nightscout.configuration.setupwizard.SetupWizardActivity">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/sw_exit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@android:color/transparent"
|
||||
android:importantForAccessibility="no"
|
||||
android:onClick="exitPressed"
|
||||
app:srcCompat="@drawable/ic_exit_to_app" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/exit"
|
||||
android:onClick="exitPressed"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sw_content"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
|
||||
<string name="units">Units</string>
|
||||
<string name="setupwizard_units_prompt">Select units you want to display values in</string>
|
||||
<string name="title_activity_setup_wizard" translatable="false">SetupWizardActivity</string>
|
||||
<string name="next_button">Next</string>
|
||||
<string name="previous_button">Prev</string>
|
||||
<string name="nav_setupwizard">Setup Wizard</string>
|
||||
<string name="setupwizard_finish">FINISH</string>
|
||||
<string name="welcome">Welcome</string>
|
||||
<string name="welcometosetupwizard">Welcome to setup wizard. It will guide you through the setup process\n</string>
|
||||
<string name="end_user_license_agreement">End User License Agreement</string>
|
||||
<string name="end_user_license_agreement_text">MUST NOT BE USED TO MAKE MEDICAL DECISIONS. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.</string>
|
||||
|
|
Loading…
Reference in a new issue