diff --git a/sample/.idea/.gitignore b/sample/.idea/.gitignore
new file mode 100644
index 00000000..26d33521
--- /dev/null
+++ b/sample/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/sample/.idea/gradle.xml b/sample/.idea/gradle.xml
new file mode 100644
index 00000000..89935b50
--- /dev/null
+++ b/sample/.idea/gradle.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sample/.idea/migrations.xml b/sample/.idea/migrations.xml
new file mode 100644
index 00000000..f8051a6f
--- /dev/null
+++ b/sample/.idea/migrations.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sample/.idea/misc.xml b/sample/.idea/misc.xml
new file mode 100644
index 00000000..3040d03e
--- /dev/null
+++ b/sample/.idea/misc.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sample/.idea/vcs.xml b/sample/.idea/vcs.xml
new file mode 100644
index 00000000..6c0b8635
--- /dev/null
+++ b/sample/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sample/src/main/kotlin/io/github/g00fy2/quickiesample/MainActivity.kt b/sample/src/main/kotlin/io/github/g00fy2/quickiesample/MainActivity.kt
index acf21d6a..701c7882 100644
--- a/sample/src/main/kotlin/io/github/g00fy2/quickiesample/MainActivity.kt
+++ b/sample/src/main/kotlin/io/github/g00fy2/quickiesample/MainActivity.kt
@@ -4,7 +4,6 @@ import android.content.ActivityNotFoundException
import android.content.Intent
import android.net.Uri
import android.os.Bundle
-import android.widget.ArrayAdapter
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import com.google.android.material.snackbar.Snackbar
@@ -13,47 +12,25 @@ import io.github.g00fy2.quickie.QRResult.QRError
import io.github.g00fy2.quickie.QRResult.QRMissingPermission
import io.github.g00fy2.quickie.QRResult.QRSuccess
import io.github.g00fy2.quickie.QRResult.QRUserCanceled
-import io.github.g00fy2.quickie.ScanCustomCode
import io.github.g00fy2.quickie.ScanQRCode
-import io.github.g00fy2.quickie.config.BarcodeFormat
-import io.github.g00fy2.quickie.config.ScannerConfig
import io.github.g00fy2.quickie.content.QRContent
import io.github.g00fy2.quickiesample.databinding.ActivityMainBinding
class MainActivity : AppCompatActivity() {
private lateinit var binding: ActivityMainBinding
- private var selectedBarcodeFormat = BarcodeFormat.FORMAT_ALL_FORMATS
private val scanQrCode = registerForActivityResult(ScanQRCode(), ::showSnackbar)
- private val scanCustomCode = registerForActivityResult(ScanCustomCode(), ::showSnackbar)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)
- setBarcodeFormatDropdown()
binding.qrScannerButton.setOnClickListener {
scanQrCode.launch(null)
}
- binding.customScannerButton.setOnClickListener {
- scanCustomCode.launch(
- ScannerConfig.build {
- setBarcodeFormats(listOf(selectedBarcodeFormat)) // set interested barcode formats
- setOverlayStringRes(R.string.scan_barcode) // string resource used for the scanner overlay
- setOverlayDrawableRes(R.drawable.ic_scan_barcode) // drawable resource used for the scanner overlay
- setHapticSuccessFeedback(false) // enable (default) or disable haptic feedback when a barcode was detected
- setShowTorchToggle(true) // show or hide (default) torch/flashlight toggle button
- setShowCloseButton(true) // show or hide (default) close button
- setHorizontalFrameRatio(2.2f) // set the horizontal overlay ratio (default is 1 / square frame)
- setUseFrontCamera(false) // use the front camera
- setKeepScreenOn(true) // keep the device's screen turned on
- }
- )
- }
-
if (intent.extras?.getBoolean(OPEN_SCANNER) == true) scanQrCode.launch(null)
}
@@ -77,7 +54,7 @@ class MainActivity : AppCompatActivity() {
if (result is QRSuccess) {
val content = result.content
if (content is QRContent.Url) {
- setAction(R.string.open_action) { openUrl(content.url) }
+ setAction(R.string.open_action) { openUrlInBrowser(content.url) }
return@apply
}
}
@@ -85,7 +62,7 @@ class MainActivity : AppCompatActivity() {
}.show()
}
- private fun openUrl(url: String) {
+ private fun openUrlInBrowser(url: String) {
try {
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(url)))
} catch (ignored: ActivityNotFoundException) {
@@ -93,16 +70,6 @@ class MainActivity : AppCompatActivity() {
}
}
- private fun setBarcodeFormatDropdown() {
- ArrayAdapter(this, android.R.layout.simple_spinner_dropdown_item, BarcodeFormat.entries.map { it.name }).let {
- binding.barcodeFormatsAutoCompleteTextView.setAdapter(it)
- binding.barcodeFormatsAutoCompleteTextView.setText(it.getItem(it.getPosition(selectedBarcodeFormat.name)), false)
- }
- binding.barcodeFormatsAutoCompleteTextView.setOnItemClickListener { _, _, position, _ ->
- selectedBarcodeFormat = BarcodeFormat.entries[position]
- }
- }
-
companion object {
const val OPEN_SCANNER = "open_scanner"
}
diff --git a/sample/src/main/res/layout/activity_main.xml b/sample/src/main/res/layout/activity_main.xml
index efcbfc5d..21712887 100644
--- a/sample/src/main/res/layout/activity_main.xml
+++ b/sample/src/main/res/layout/activity_main.xml
@@ -8,6 +8,13 @@
tools:context=".MainActivity"
>
+
+
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/sample/src/main/res/values/strings.xml b/sample/src/main/res/values/strings.xml
index 49757cf1..cfd353dc 100644
--- a/sample/src/main/res/values/strings.xml
+++ b/sample/src/main/res/values/strings.xml
@@ -1,10 +1,10 @@
-
- Quickie Sample
+
+ Docusign Webview Tester
- QR-Code Scanner
- Custom Scanner
+ Scan the QR-Code
OK
Open
Scan barcode
BarcodeFormat
+ This app opens the QR-Code URL in a Webview
\ No newline at end of file