ComboV2PairingActivity: toolbar
This commit is contained in:
parent
eda7c1e552
commit
510e640673
|
@ -8,6 +8,6 @@
|
|||
<activity
|
||||
android:name=".activities.ComboV2PairingActivity"
|
||||
android:exported="false"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
android:theme="@style/AppTheme" />
|
||||
</application>
|
||||
</manifest>
|
||||
|
|
|
@ -7,12 +7,16 @@ import android.os.Build
|
|||
import android.os.Bundle
|
||||
import android.text.Editable
|
||||
import android.text.TextWatcher
|
||||
import android.view.Menu
|
||||
import android.view.MenuInflater
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.OnBackPressedCallback
|
||||
import androidx.activity.result.ActivityResultLauncher
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.MenuProvider
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
|
@ -113,6 +117,10 @@ class ComboV2PairingActivity : TranslatedDaggerAppCompatActivity() {
|
|||
val binding: Combov2PairingActivityBinding = DataBindingUtil.setContentView(
|
||||
this, R.layout.combov2_pairing_activity)
|
||||
|
||||
title = rh.gs(R.string.combov2_pair_with_pump_title)
|
||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||
supportActionBar?.setDisplayShowHomeEnabled(true)
|
||||
|
||||
val thisActivity = this
|
||||
|
||||
// Set the pairing sections to initially show the "not initialized" one
|
||||
|
@ -194,6 +202,20 @@ class ComboV2PairingActivity : TranslatedDaggerAppCompatActivity() {
|
|||
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
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
|
@ -342,8 +364,8 @@ class ComboV2PairingActivity : TranslatedDaggerAppCompatActivity() {
|
|||
return@setOnClickListener
|
||||
}
|
||||
runBlocking {
|
||||
val PIN = PairingPIN(pinString.map { it - '0' }.toIntArray())
|
||||
combov2Plugin.providePairingPIN(PIN)
|
||||
val pin = PairingPIN(pinString.map { it - '0' }.toIntArray())
|
||||
combov2Plugin.providePairingPIN(pin)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -383,14 +405,14 @@ class ComboV2PairingActivity : TranslatedDaggerAppCompatActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
binding.combov2CurrentPairingStepDesc.text = when (val progStage = stage) {
|
||||
binding.combov2CurrentPairingStepDesc.text = when (stage) {
|
||||
BasicProgressStage.ScanningForPumpStage ->
|
||||
rh.gs(R.string.combov2_scanning_for_pump)
|
||||
|
||||
is BasicProgressStage.EstablishingBtConnection -> {
|
||||
rh.gs(
|
||||
R.string.combov2_establishing_bt_connection,
|
||||
progStage.currentAttemptNr
|
||||
stage.currentAttemptNr
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout 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">
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
|
@ -9,38 +8,6 @@
|
|||
android:orientation="vertical"
|
||||
tools:context=".activities.ComboV2PairingActivity">
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:id="@+id/header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:background="?attr/activity_title_backgroundColor"
|
||||
android:orientation="horizontal"
|
||||
android:padding="5dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="42dp"
|
||||
android:layout_height="42dp"
|
||||
android:importantForAccessibility="no"
|
||||
android:scaleType="fitXY"
|
||||
app:srcCompat="@drawable/ic_combo_128" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:text="@string/combov2_pair_with_pump_title"
|
||||
android:textAlignment="center"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/combov2_pairing_section_cannot_pair_driver_not_initialized"
|
||||
android:layout_width="match_parent"
|
||||
|
|
Loading…
Reference in a new issue