feat: qrcode fallback #72
1 changed files with 16 additions and 4 deletions
|
@ -3,7 +3,9 @@ package im.angry.openeuicc.ui
|
|||
import android.annotation.SuppressLint
|
||||
import android.app.Dialog
|
||||
import android.content.DialogInterface
|
||||
import android.content.Intent
|
||||
import android.graphics.BitmapFactory
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.text.Editable
|
||||
import android.util.Log
|
||||
|
@ -27,6 +29,7 @@ import kotlinx.coroutines.flow.onEach
|
|||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
|
||||
class ProfileDownloadFragment : BaseMaterialDialogFragment(),
|
||||
Toolbar.OnMenuItemClickListener, EuiccChannelFragmentMarker {
|
||||
companion object {
|
||||
|
@ -84,12 +87,21 @@ class ProfileDownloadFragment : BaseMaterialDialogFragment(),
|
|||
}
|
||||
|
||||
private fun onScanResult(result: String) {
|
||||
when {
|
||||
result.startsWith("LPA:") -> {
|
||||
val components = result.split("$")
|
||||
if (components.size < 3 || components[0] != "LPA:1") return
|
||||
profileDownloadServer.editText?.setText(components[1])
|
||||
profileDownloadCode.editText?.setText(components[2])
|
||||
}
|
||||
|
||||
result.startsWith("http:", ignoreCase = true) or
|
||||
result.startsWith("https:", ignoreCase = true) -> {
|
||||
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(result)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
|
|
Loading…
Add table
Reference in a new issue