diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 4f56cb1ec..016006d7b 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -50,11 +50,8 @@
-
-
-
+
+
+
+
+
@@ -287,4 +300,25 @@ class ChannelFragment : ScreenFragment("Channel"), Logging {
return ChannelProtos.ChannelSettings.ModemConfig.UNRECOGNIZED
}
-}
+
+ override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
+ val result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data)
+ if (result != null) {
+ if (result.contents == null) {
+ Snackbar.make(binding.scanButton, R.string.channel_invalid, Snackbar.LENGTH_LONG).show()
+ } else {
+ try {
+ val intent = Intent(Intent.ACTION_VIEW)
+ intent.data = ChannelSet(Uri.parse(result.contents)).getChannelUrl(false)
+ startActivity(intent)
+ } catch (ex: ActivityNotFoundException) {
+ Snackbar.make(binding.scanButton, R.string.channel_invalid, Snackbar.LENGTH_LONG).show()
+ } catch (ex: MalformedURLException) {
+ Snackbar.make(binding.scanButton, R.string.channel_invalid, Snackbar.LENGTH_LONG).show()
+ }
+ }
+ } else {
+ super.onActivityResult(requestCode, resultCode, data)
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/layout/channel_fragment.xml b/app/src/main/res/layout/channel_fragment.xml
index af5ea0dbb..d916757ca 100644
--- a/app/src/main/res/layout/channel_fragment.xml
+++ b/app/src/main/res/layout/channel_fragment.xml
@@ -98,30 +98,40 @@
android:id="@+id/resetButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginStart="32dp"
+ android:layout_marginEnd="10dp"
android:text="@string/reset"
app:icon="@drawable/ic_twotone_public_24"
app:layout_constraintBottom_toBottomOf="@id/bottomButtonsGuideline"
- app:layout_constraintStart_toStartOf="parent" />
+ app:layout_constraintEnd_toStartOf="@id/editableCheckbox" />
+
+
+ app:layout_constraintLeft_toLeftOf="parent"
+ app:layout_constraintRight_toRightOf="parent" />