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.annotation.SuppressLint
|
||||||
import android.app.Dialog
|
import android.app.Dialog
|
||||||
import android.content.DialogInterface
|
import android.content.DialogInterface
|
||||||
|
import android.content.Intent
|
||||||
import android.graphics.BitmapFactory
|
import android.graphics.BitmapFactory
|
||||||
|
import android.net.Uri
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.Editable
|
import android.text.Editable
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
|
@ -27,6 +29,7 @@ import kotlinx.coroutines.flow.onEach
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
|
|
||||||
|
|
||||||
class ProfileDownloadFragment : BaseMaterialDialogFragment(),
|
class ProfileDownloadFragment : BaseMaterialDialogFragment(),
|
||||||
Toolbar.OnMenuItemClickListener, EuiccChannelFragmentMarker {
|
Toolbar.OnMenuItemClickListener, EuiccChannelFragmentMarker {
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -84,10 +87,19 @@ class ProfileDownloadFragment : BaseMaterialDialogFragment(),
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onScanResult(result: String) {
|
private fun onScanResult(result: String) {
|
||||||
val components = result.split("$")
|
when {
|
||||||
if (components.size < 3 || components[0] != "LPA:1") return
|
result.startsWith("LPA:") -> {
|
||||||
profileDownloadServer.editText?.setText(components[1])
|
val components = result.split("$")
|
||||||
profileDownloadCode.editText?.setText(components[2])
|
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(
|
override fun onCreateView(
|
||||||
|
|
Loading…
Add table
Reference in a new issue