Updated on 2026-08-14
This commit is contained in:
parent
bd61d38716
commit
fc79d11fb0
2 changed files with 17 additions and 3 deletions
|
|
@ -1,6 +1,7 @@
|
|||
package com.tangem.tangem_sdk_new
|
||||
|
||||
import android.animation.ObjectAnimator
|
||||
import android.view.HapticFeedbackConstants
|
||||
import android.view.View
|
||||
import android.view.animation.DecelerateInterpolator
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
|
|
@ -77,7 +78,8 @@ class DefaultCardManagerDelegate(private val reader: NfcReader) : CardManagerDel
|
|||
readingDialog?.tvTaskTitle?.text = activity.getText(R.string.dialog_security_delay)
|
||||
readingDialog?.tvTaskText?.text =
|
||||
activity.getText(R.string.dialog_security_delay_description)
|
||||
// readingDialog?.pbSecurityDelay?.isIndeterminate = false
|
||||
|
||||
performHapticFeedback()
|
||||
|
||||
if (readingDialog?.pbSecurityDelay?.max != totalDurationSeconds) {
|
||||
readingDialog?.pbSecurityDelay?.max = totalDurationSeconds
|
||||
|
|
@ -99,10 +101,12 @@ class DefaultCardManagerDelegate(private val reader: NfcReader) : CardManagerDel
|
|||
postUI {
|
||||
readingDialog?.lTouchCard?.hide()
|
||||
readingDialog?.flSecurityDelay?.show()
|
||||
readingDialog?.tvRemainingTime?.text = (((total - current) / step ) + 1).toString()
|
||||
readingDialog?.tvRemainingTime?.text = (((total - current) / step) + 1).toString()
|
||||
readingDialog?.tvTaskTitle?.text = "Operation in process"
|
||||
readingDialog?.tvTaskText?.text = "Please hold the card firmly until the operation is completed…"
|
||||
|
||||
performHapticFeedback()
|
||||
|
||||
if (readingDialog?.pbSecurityDelay?.max != total) {
|
||||
readingDialog?.pbSecurityDelay?.max = total
|
||||
}
|
||||
|
|
@ -116,7 +120,8 @@ class DefaultCardManagerDelegate(private val reader: NfcReader) : CardManagerDel
|
|||
animation.duration = 300
|
||||
animation.interpolator = DecelerateInterpolator()
|
||||
animation.start()
|
||||
} }
|
||||
}
|
||||
}
|
||||
|
||||
override fun onTagLost() {
|
||||
postUI {
|
||||
|
|
@ -133,6 +138,7 @@ class DefaultCardManagerDelegate(private val reader: NfcReader) : CardManagerDel
|
|||
readingDialog?.flSecurityDelay?.hide()
|
||||
readingDialog?.flCompletion?.show()
|
||||
readingDialog?.ivCompletion?.setImageDrawable(activity.getDrawable(R.drawable.ic_done_135dp))
|
||||
performHapticFeedback()
|
||||
}
|
||||
postUI(300) { readingDialog?.dismiss() }
|
||||
}
|
||||
|
|
@ -145,6 +151,7 @@ class DefaultCardManagerDelegate(private val reader: NfcReader) : CardManagerDel
|
|||
readingDialog?.flError?.show()
|
||||
readingDialog?.tvTaskTitle?.text = activity.getText(R.string.dialog_error)
|
||||
readingDialog?.tvTaskText?.text = "${error::class.simpleName}: ${error.code}"
|
||||
performHapticFeedback()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -152,6 +159,12 @@ class DefaultCardManagerDelegate(private val reader: NfcReader) : CardManagerDel
|
|||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
private fun performHapticFeedback() {
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
|
||||
readingDialog?.llHeader?.isHapticFeedbackEnabled = true
|
||||
readingDialog?.llHeader?.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setLogger() {
|
||||
Log.setLogger(
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
app:layout_behavior="@string/bottom_sheet_behavior">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/llHeader"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:background="#e2e5e6"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue