diff --git a/networksurvey/src/main/java/com/craxiom/networksurvey/NetworkSurveyActivity.kt b/networksurvey/src/main/java/com/craxiom/networksurvey/NetworkSurveyActivity.kt index 755190c5..08a24899 100644 --- a/networksurvey/src/main/java/com/craxiom/networksurvey/NetworkSurveyActivity.kt +++ b/networksurvey/src/main/java/com/craxiom/networksurvey/NetworkSurveyActivity.kt @@ -23,16 +23,12 @@ import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatDelegate import androidx.core.app.ActivityCompat import androidx.core.content.ContextCompat -import androidx.navigation.NavController -import androidx.navigation.ui.AppBarConfiguration -import androidx.navigation.ui.NavigationUI.navigateUp import androidx.preference.PreferenceManager import com.craxiom.networksurvey.constants.NetworkSurveyConstants import com.craxiom.networksurvey.listeners.IGnssFailureListener import com.craxiom.networksurvey.services.GrpcConnectionService import com.craxiom.networksurvey.services.NetworkSurveyService import com.craxiom.networksurvey.services.NetworkSurveyService.SurveyServiceBinder -import com.craxiom.networksurvey.ui.main.GnssFailureDialog import com.craxiom.networksurvey.ui.main.MainCompose import com.craxiom.networksurvey.util.NsUtils import com.craxiom.networksurvey.util.PreferenceUtils @@ -103,37 +99,35 @@ class NetworkSurveyActivity : AppCompatActivity() { gnssFailureListener = IGnssFailureListener { try { - setContent { - GnssFailureDialog( // FIXME Do this for real - onDismiss = { } - ) { } - } - - val fragmentView = LayoutInflater.from(this).inflate(R.layout.gnss_failure, null) - - val gnssFailureDialog = AlertDialog.Builder(this) - .setView(fragmentView) - .setPositiveButton(R.string.ok) { dialog: DialogInterface?, id: Int -> - val rememberDecisionCheckBox = - fragmentView.findViewById(R.id.failureRememberDecisionCheckBox) - val checked = rememberDecisionCheckBox.isChecked - if (checked) { - PreferenceUtils.saveBoolean( - Application.get() - .getString(R.string.pref_key_ignore_raw_gnss_failure), true - ) - // No need for GNSS failure updates anymore - if (networkSurveyService != null) { - networkSurveyService!!.clearGnssFailureListener() + runOnUiThread { + Timber.e("BLAH BLAH BLAH") + val fragmentView = + LayoutInflater.from(this).inflate(R.layout.gnss_failure, null) + + val gnssFailureDialog = AlertDialog.Builder(this) + .setView(fragmentView) + .setPositiveButton(R.string.ok) { _: DialogInterface?, _: Int -> + val rememberDecisionCheckBox = + fragmentView.findViewById(R.id.failureRememberDecisionCheckBox) + val checked = rememberDecisionCheckBox.isChecked + if (checked) { + PreferenceUtils.saveBoolean( + Application.get() + .getString(R.string.pref_key_ignore_raw_gnss_failure), true + ) + // No need for GNSS failure updates anymore + if (networkSurveyService != null) { + networkSurveyService!!.clearGnssFailureListener() + } } } - } - .create() + .create() - gnssFailureDialog.show() - val viewById = - gnssFailureDialog.findViewById(R.id.failureDescriptionTextView) - if (viewById != null) viewById.movementMethod = LinkMovementMethod.getInstance() + gnssFailureDialog.show() + val viewById = + gnssFailureDialog.findViewById(R.id.failureDescriptionTextView) + if (viewById != null) viewById.movementMethod = LinkMovementMethod.getInstance() + } } catch (t: Throwable) { Timber.e(t, "Something went wrong when trying to show the GNSS Failure Dialog") } diff --git a/networksurvey/src/main/java/com/craxiom/networksurvey/ui/main/AlertDialogs.kt b/networksurvey/src/main/java/com/craxiom/networksurvey/ui/main/AlertDialogs.kt index ed541b48..9b4e56d2 100644 --- a/networksurvey/src/main/java/com/craxiom/networksurvey/ui/main/AlertDialogs.kt +++ b/networksurvey/src/main/java/com/craxiom/networksurvey/ui/main/AlertDialogs.kt @@ -32,30 +32,6 @@ import com.craxiom.networksurvey.R import com.craxiom.networksurvey.model.GnssType import com.craxiom.networksurvey.util.PreferenceUtils -@Composable -fun GnssFailureDialog(onDismiss: () -> Unit, onConfirm: (Boolean) -> Unit) { - val checkedState = remember { mutableStateOf(false) } - - // TODO Validate that this dialog works - AlertDialog( - onDismissRequest = onDismiss, - confirmButton = { - TextButton( - onClick = { onConfirm(checkedState.value) } - ) { Text("OK") } - }, - text = { - Column { - Text("GNSS Failure") - Checkbox( - checked = checkedState.value, - onCheckedChange = { checkedState.value = it } - ) - } - } - ) -} - @Composable fun GnssFilterDialog( initialItems: Array, diff --git a/networksurvey/src/main/res/values/strings.xml b/networksurvey/src/main/res/values/strings.xml index ed5ca3d1..6722c5a6 100644 --- a/networksurvey/src/main/res/values/strings.xml +++ b/networksurvey/src/main/res/values/strings.xml @@ -498,7 +498,7 @@ but work independently, so you have full control over how you handle your data.< App Icon GNSS Features May Not Work - Network Survey is not receiving raw GNSS measurements from the phone, which are required for generating the GNSS GeoPackage files, or streaming GNSS records over MQTT. For more information and a list of devices that support raw GNSS, consult Android\'s Raw GNSS Measurements guide. + Network Survey is not receiving raw GNSS measurements from the phone, which are required for generating the GNSS GeoPackage/CSV files, or streaming GNSS records over MQTT. For more information and a list of devices that support raw GNSS, consult Android\'s Raw GNSS Measurements guide. Don\'t ask me again