SmsCommunicatorOtpActivity: toolbar
This commit is contained in:
parent
67d5b2a7ee
commit
2db4f162ad
|
@ -15,7 +15,7 @@
|
|||
<activity
|
||||
android:name=".general.smsCommunicator.activities.SmsCommunicatorOtpActivity"
|
||||
android:exported="false"
|
||||
android:theme="@style/AppTheme.NoActionBar">
|
||||
android:theme="@style/AppTheme">
|
||||
<intent-filter>
|
||||
<action android:name="info.nightscout.androidaps.plugins.general.smsCommunicator.activities.SmsCommunicatorOtpActivity" />
|
||||
|
||||
|
|
|
@ -8,8 +8,12 @@ import android.graphics.Color
|
|||
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 android.view.WindowManager
|
||||
import androidx.core.view.MenuProvider
|
||||
import com.google.common.primitives.Ints.min
|
||||
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel
|
||||
import info.nightscout.core.ui.activities.TranslatedDaggerAppCompatActivity
|
||||
|
@ -45,6 +49,10 @@ class SmsCommunicatorOtpActivity : TranslatedDaggerAppCompatActivity() {
|
|||
binding = SmscommunicatorActivityOtpBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
||||
title = rh.gs(R.string.smscommunicator_tab_otp_label)
|
||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||
supportActionBar?.setDisplayShowHomeEnabled(true)
|
||||
|
||||
binding.otpVerifyEdit.addTextChangedListener(object : TextWatcher {
|
||||
override fun afterTextChanged(s: Editable) {
|
||||
val checkResult = otp.checkOTP(s.toString())
|
||||
|
@ -99,6 +107,20 @@ class SmsCommunicatorOtpActivity : TranslatedDaggerAppCompatActivity() {
|
|||
|
||||
true
|
||||
}
|
||||
// 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
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<ScrollView 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="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
|
@ -103,7 +104,9 @@
|
|||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:text="@string/smscommunicator_otp_reset_btn"
|
||||
android:textColor="?attr/treatmentButton" />
|
||||
android:textColor="?attr/treatmentButton"
|
||||
app:icon="@drawable/ic_local_reset"
|
||||
app:iconTint="@color/ic_local_reset" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
Loading…
Reference in a new issue