diff --git a/app/src/main/java/com/geeksville/mesh/ui/SettingsFragment.kt b/app/src/main/java/com/geeksville/mesh/ui/SettingsFragment.kt
index 8fb001317..0290db4d5 100644
--- a/app/src/main/java/com/geeksville/mesh/ui/SettingsFragment.kt
+++ b/app/src/main/java/com/geeksville/mesh/ui/SettingsFragment.kt
@@ -27,6 +27,7 @@ import com.geeksville.mesh.R
import com.geeksville.mesh.model.UIViewModel
import com.geeksville.mesh.service.RadioInterfaceService
import com.geeksville.util.exceptionReporter
+import com.google.android.material.dialog.MaterialAlertDialogBuilder
import kotlinx.android.synthetic.main.settings_fragment.*
@@ -260,13 +261,32 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
requireActivity().hideKeyboard()
}
+ val app = (requireContext().applicationContext as GeeksvilleApplication)
+
// Set analytics checkbox
- analyticsOkayCheckbox.isChecked =
- (requireContext().applicationContext as GeeksvilleApplication).isAnalyticsAllowed
+ analyticsOkayCheckbox.isChecked = app.isAnalyticsAllowed
+
analyticsOkayCheckbox.setOnCheckedChangeListener { _, isChecked ->
debug("User changed analytics to $isChecked")
- (requireContext().applicationContext as GeeksvilleApplication).isAnalyticsAllowed =
- isChecked
+ app.isAnalyticsAllowed = isChecked
+ reportBugButton.isEnabled = app.isAnalyticsAllowed
+ }
+
+ // report bug button only enabled if analytics is allowed
+ reportBugButton.isEnabled = app.isAnalyticsAllowed
+ reportBugButton.setOnClickListener {
+ MaterialAlertDialogBuilder(requireContext())
+ .setTitle(R.string.report_a_bug)
+ .setMessage(getString(R.string.report_bug_text))
+ .setNeutralButton(R.string.cancel) { _, _ ->
+ debug("Decided not to report a bug")
+ }
+ .setPositiveButton(getString(R.string.report)) { _, _ ->
+ reportError("Clicked Report A Bug")
+ }
+ .show()
+
+ true
}
scanModel.errorText.observe(viewLifecycleOwner, Observer { errMsg ->
diff --git a/app/src/main/res/layout/settings_fragment.xml b/app/src/main/res/layout/settings_fragment.xml
index 76e8b7725..8ab7b2831 100644
--- a/app/src/main/res/layout/settings_fragment.xml
+++ b/app/src/main/res/layout/settings_fragment.xml
@@ -44,7 +44,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
- android:layout_marginTop="32dp"
+ android:layout_marginTop="16dp"
android:text="@string/looking_for_meshtastic_devices"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textInputLayout2" />
@@ -85,15 +85,25 @@
android:id="@+id/analyticsOkayCheckbox"
android:layout_width="0dp"
android:layout_height="wrap_content"
- android:layout_marginStart="16dp"
- android:layout_marginEnd="16dp"
+ android:layout_marginStart="8dp"
+ android:layout_marginBottom="8dp"
android:checked="true"
android:text="@string/analytics_okay"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintEnd_toStartOf="@+id/reportBugButton"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/deviceRadioGroup"
app:layout_constraintVertical_bias="1.0" />
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index bb77aaea2..b55d8e838 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -14,8 +14,7 @@
hey I found the cache, it is over here next to the big tiger. I\'m kinda scared.SKHSend Text
- You haven\'t yet paired a Meshtastic compatible radio with this phone. Please pair a device and set your username.\n\n
- This open-source application is in alpha-testing, if you find problems please post on our forum: meshtastic.discourse.group.\n\nFor more information see our web page - www.meshtastic.org.
+ You haven\'t yet paired a Meshtastic compatible radio with this phone. Please pair a device and set your username.\n\nThis open-source application is in alpha-testing, if you find problems please post on our forum: meshtastic.discourse.group.\n\nFor more information see our web page - www.meshtastic.org.Username unsetYour NameAnonymous usage statistics and crash reports.
@@ -38,4 +37,8 @@
If you are interested in us paying for mapbox (or switching to a different map provider), please post in meshtastic.discourse.group
A required permission is missing, Meshtastic won\'t be able to work properly. Please enable in application settings.Radio was sleeping, could not change channel
+ Report Bug
+ Report a bug
+ Are you sure you want to report a bug? After reporting, please post in meshtastic.discourse.group so we can match up the report with what you found.
+ Report