mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
fix: Fingerprint button
This commit is contained in:
@@ -629,7 +629,7 @@ class AdvancedUnlockFragment: StylishFragment(), AdvancedUnlockManager.AdvancedU
|
||||
@RequiresApi(Build.VERSION_CODES.M)
|
||||
private fun setAdvancedUnlockedMessageView(text: CharSequence) {
|
||||
lifecycleScope.launch(Dispatchers.Main) {
|
||||
mAdvancedUnlockInfoView?.message = text
|
||||
mAdvancedUnlockInfoView?.setMessage(text)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.annotation.StringRes
|
||||
import com.kunzisoft.keepass.R
|
||||
@@ -41,7 +42,6 @@ class AdvancedUnlockInfoView @JvmOverloads constructor(context: Context,
|
||||
private val unlockContainerView: View
|
||||
private var unlockAnimatedVector: FingerPrintAnimatedVector? = null
|
||||
private var unlockTitleTextView: TextView? = null
|
||||
private var unlockMessageTextView: TextView? = null
|
||||
private var unlockIconImageView: ImageView? = null
|
||||
|
||||
init {
|
||||
@@ -51,7 +51,6 @@ class AdvancedUnlockInfoView @JvmOverloads constructor(context: Context,
|
||||
|
||||
unlockContainerView = findViewById(R.id.fingerprint_container)
|
||||
unlockTitleTextView = findViewById(R.id.biometric_title)
|
||||
unlockMessageTextView = findViewById(R.id.biometric_message)
|
||||
unlockIconImageView = findViewById(R.id.biometric_image)
|
||||
}
|
||||
|
||||
@@ -85,6 +84,7 @@ class AdvancedUnlockInfoView @JvmOverloads constructor(context: Context,
|
||||
unlockContainerView.alpha = 0.8f
|
||||
}
|
||||
unlockIconImageView?.setOnClickListener(listener)
|
||||
unlockTitleTextView?.setOnClickListener(listener)
|
||||
}
|
||||
|
||||
var title: CharSequence
|
||||
@@ -99,22 +99,13 @@ class AdvancedUnlockInfoView @JvmOverloads constructor(context: Context,
|
||||
title = context.getString(textId)
|
||||
}
|
||||
|
||||
var message: CharSequence?
|
||||
get() {
|
||||
return unlockMessageTextView?.text?.toString() ?: ""
|
||||
}
|
||||
set(value) {
|
||||
if (value == null || value.isEmpty()) {
|
||||
unlockMessageTextView?.visibility = GONE
|
||||
} else {
|
||||
unlockMessageTextView?.visibility = VISIBLE
|
||||
stopIconViewAnimation()
|
||||
}
|
||||
unlockMessageTextView?.text = value ?: ""
|
||||
}
|
||||
fun setMessage(text: CharSequence) {
|
||||
if (text.isNotEmpty())
|
||||
Toast.makeText(context, text, Toast.LENGTH_LONG).show()
|
||||
}
|
||||
|
||||
fun setMessage(@StringRes textId: Int) {
|
||||
message = context.getString(textId)
|
||||
Toast.makeText(context, textId, Toast.LENGTH_LONG).show()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -26,38 +26,23 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:filterTouchesWhenObscured="true">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/biometric_message"
|
||||
style="@style/KeepassDXStyle.TextAppearance.Warning.TextOnPrimary"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toTopOf="@+id/biometric_image"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="Sample error" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/biometric_image"
|
||||
android:layout_width="42dp"
|
||||
android:layout_height="42dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:elevation="8dp"
|
||||
android:layout_margin="4dp"
|
||||
android:src="@drawable/fingerprint"
|
||||
android:background="@drawable/background_image"
|
||||
android:backgroundTint="?attr/colorAccent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/biometric_title"
|
||||
style="@style/KeepassDXStyle.TextAppearance.Secondary.TextOnPrimary"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="8dp"
|
||||
android:orientation="vertical"
|
||||
style="@style/KeepassDXStyle.TextAppearance.Tiny.Secondary"
|
||||
android:layout_margin="8dp"
|
||||
android:gravity="start|center_vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/biometric_image"
|
||||
|
||||
@@ -175,7 +175,8 @@
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp">
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/fragment_advanced_unlock_container_view"
|
||||
android:layout_width="0dp"
|
||||
@@ -190,6 +191,7 @@
|
||||
android:focusable="true"
|
||||
android:text="@string/unlock"
|
||||
app:icon="@drawable/ic_lock_open_white_24dp"
|
||||
app:layout_constraintStart_toEndOf="@+id/fragment_advanced_unlock_container_view"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
@@ -479,7 +479,12 @@
|
||||
<style name="KeepassDXStyle.TextAppearance.Tiny" parent="KeepassDXStyle.TextAppearance">
|
||||
<item name="android:textSize">12sp</item>
|
||||
</style>
|
||||
<style name="KeepassDXStyle.TextAppearance.Warning" parent="KeepassDXStyle.TextAppearance">
|
||||
<style name="KeepassDXStyle.TextAppearance.Tiny.Secondary" parent="KeepassDXStyle.TextAppearance">
|
||||
<item name="android:textSize">12sp</item>
|
||||
<item name="android:textColor">?attr/colorAccent</item>
|
||||
</style>
|
||||
|
||||
<style name="KeepassDXStyle.TextAppearance.Warning" parent="KeepassDXStyle.TextAppearance">
|
||||
<item name="android:textColor">?attr/colorAccent</item>
|
||||
</style>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user