Updated on 2026-08-14
This commit is contained in:
parent
e5d82031d2
commit
69521ee467
1 changed files with 15 additions and 7 deletions
|
|
@ -1,10 +1,13 @@
|
|||
package com.tangem.tangem_sdk_new
|
||||
|
||||
import android.animation.ObjectAnimator
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.provider.Settings
|
||||
import android.view.HapticFeedbackConstants
|
||||
import android.view.View
|
||||
import android.view.animation.DecelerateInterpolator
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialog
|
||||
import com.tangem.Log
|
||||
import com.tangem.LoggerInterface
|
||||
|
|
@ -14,7 +17,6 @@ import com.tangem.common.CompletionResult
|
|||
import com.tangem.tangem_sdk_new.extensions.hide
|
||||
import com.tangem.tangem_sdk_new.extensions.show
|
||||
import com.tangem.tangem_sdk_new.nfc.NfcReader
|
||||
import com.tangem.tangem_sdk_new.ui.NfcEnableDialog
|
||||
import com.tangem.tangem_sdk_new.ui.TouchCardAnimation
|
||||
import kotlinx.android.synthetic.main.layout_touch_card.*
|
||||
import kotlinx.android.synthetic.main.nfc_bottom_sheet.*
|
||||
|
|
@ -25,9 +27,8 @@ import kotlinx.android.synthetic.main.nfc_bottom_sheet.*
|
|||
*/
|
||||
class DefaultSessionViewDelegate(private val reader: NfcReader) : SessionViewDelegate {
|
||||
|
||||
lateinit var activity: FragmentActivity
|
||||
lateinit var activity: Activity
|
||||
private var readingDialog: BottomSheetDialog? = null
|
||||
private var nfcEnableDialog: NfcEnableDialog? = null
|
||||
|
||||
init {
|
||||
setLogger()
|
||||
|
|
@ -39,7 +40,7 @@ class DefaultSessionViewDelegate(private val reader: NfcReader) : SessionViewDel
|
|||
if (!reader.nfcEnabled) showNFCEnableDialog()
|
||||
}
|
||||
|
||||
private fun showReadingDialog(activity: FragmentActivity, cardId: String?, message: Message?) {
|
||||
private fun showReadingDialog(activity: Activity, cardId: String?, message: Message?) {
|
||||
val dialogView = activity.layoutInflater.inflate(R.layout.nfc_bottom_sheet, null)
|
||||
readingDialog = BottomSheetDialog(activity)
|
||||
readingDialog?.setContentView(dialogView)
|
||||
|
|
@ -70,8 +71,15 @@ class DefaultSessionViewDelegate(private val reader: NfcReader) : SessionViewDel
|
|||
}
|
||||
|
||||
private fun showNFCEnableDialog() {
|
||||
nfcEnableDialog = NfcEnableDialog()
|
||||
activity.supportFragmentManager.let { nfcEnableDialog?.show(it, NfcEnableDialog.TAG) }
|
||||
val builder = AlertDialog.Builder(activity)
|
||||
.setCancelable(false)
|
||||
.setIcon(R.drawable.ic_action_nfc_gray)
|
||||
.setTitle(R.string.dialog_nfc_enable_title)
|
||||
.setMessage(R.string.dialog_nfc_enable_text)
|
||||
builder.setPositiveButton(R.string.general_ok) { _, _ ->
|
||||
activity.startActivity(Intent(Settings.ACTION_NFC_SETTINGS))
|
||||
}
|
||||
builder.create().show()
|
||||
}
|
||||
|
||||
override fun onSecurityDelay(ms: Int, totalDurationSeconds: Int) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue