Skip to content

Commit

Permalink
Add a help dialog explaining the difference between file logging and …
Browse files Browse the repository at this point in the history
…MQTT
  • Loading branch information
christianrowlands committed Nov 7, 2023
1 parent 37c2c44 commit a38f0bd
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,8 @@ private void initializeUiListeners()
binding.mqttFragmentButton.setOnClickListener(c -> navigateToMqttFragment());

binding.cdrHelpIcon.setOnClickListener(c -> showCdrHelpDialog());
binding.fileHelpIcon.setOnClickListener(c -> showFileMqttHelpDialog());
binding.mqttHelpIcon.setOnClickListener(c -> showFileMqttHelpDialog());
}

private void navigateToMqttFragment()
Expand Down Expand Up @@ -434,6 +436,23 @@ private void showCdrHelpDialog()
alertBuilder.create().show();
}

/**
* Displays a dialog with some information about the difference between file logging and MQTT.
*/
private void showFileMqttHelpDialog()
{
final Context context = getContext();
if (context == null) return;

AlertDialog.Builder alertBuilder = new AlertDialog.Builder(context);
alertBuilder.setCancelable(true);
alertBuilder.setTitle(getString(R.string.file_help_title));
alertBuilder.setMessage(getText(R.string.file_help));
alertBuilder.setPositiveButton(android.R.string.ok, (dialog, which) -> {
});
alertBuilder.create().show();
}

@SuppressLint("ClickableViewAccessibility")
private void initializeLoggingSwitch(SwitchCompat loggingSwitch, BiConsumer<Boolean, SwitchCompat> switchAction)
{
Expand Down
30 changes: 26 additions & 4 deletions networksurvey/src/main/res/layout/fragment_dashboard.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,23 @@
android:src="@drawable/ic_action_bar_logging" />

<TextView
android:id="@+id/cellular_details_title"
android:id="@+id/file_section_title"
style="@style/CardTitleStyle"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/card_title_logging_details" />

<ImageView
android:id="@+id/file_help_icon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center"
android:layout_marginStart="@dimen/x_small_margin"
android:layout_marginEnd="@dimen/x_small_margin"
android:contentDescription="@string/file_help_description"
android:src="@drawable/ic_help" />

</LinearLayout>

<LinearLayout
Expand Down Expand Up @@ -588,12 +599,23 @@
android:src="@drawable/ic_cloud_connection" />

<TextView
android:id="@+id/neighbors_title"
android:id="@+id/mqtt_section_title"
style="@style/CardTitleStyle"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/card_title_mqtt_details" />

<ImageView
android:id="@+id/mqtt_help_icon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center"
android:layout_marginStart="@dimen/x_small_margin"
android:layout_marginEnd="@dimen/x_small_margin"
android:contentDescription="@string/file_help_description"
android:src="@drawable/ic_help" />

</LinearLayout>

<LinearLayout
Expand Down
22 changes: 22 additions & 0 deletions networksurvey/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,27 @@
if it requests the SMS permission. If you are interested in a CDR logger that supports SMS events
and logging the "other" phone number for call events, reach out to me at [email protected]</string>


<string name="file_help_title">File Logging &amp; MQTT Streaming: Simplified</string>
<string name="file_help">Need help understanding the File Logging and MQTT sections? Here\'s a quick guide:\n\n
<b>File Logging Control:</b>\n
This section is all about saving data locally to your phone. When you toggle one of the options to <b>\'On\'</b>,
the app will start logging that data type to a file in GeoPackage and/or CSV format (depending on the configured
setting), which you can find on your device. Remember:\n
\n
- Toggle <b>Cellular</b>, <b>Wi-Fi</b>, <b>Bluetooth</b>, <b>GNSS</b>, and/or <b>CDR</b> under File Logging Control to save this data locally.\n
- Logging is completely optional and does not affect MQTT Streaming.\n
\n
<b>MQTT Connection Status:</b>\n
MQTT streaming lets you send your data in real-time to a remote server. No local storage is needed for this:\n
\n
- First, configure the broker connection settings.\n
- Ensure the switch is on to activate streaming.\n
- MQTT Streaming works independently of File Logging. You don\'t need to turn on File Logging to stream data.\n
\n
Use File Logging for local storage and MQTT Streaming for remote transmission. They both capture the same data,
but work independently, so you have full control over how you handle your data.</string>

<string name="bluetooth_permissions_rationale_title">Bluetooth Permissions</string>
<string name="bluetooth_permissions_rationale">The Find Nearby Devices permission is needed to perform a Bluetooth scan for survey. If this permission is denied then Bluetooth survey will not work.</string>

Expand Down Expand Up @@ -127,6 +148,7 @@
<string name="card_title_cellular_details_initial">Serving Cell Details</string>
<string name="card_title_cellular_details">%1$s Serving Cell Details</string>
<string name="cellular_icon_description">Cellular Tower Icon</string>
<string name="file_help_description">File Help Icon</string>
<string name="card_title_neighbors">Neighbors</string>
<string name="card_title_neighbors_gsm">GSM Neighbors</string>
<string name="card_title_neighbors_cdma">CDMA Neighbors</string>
Expand Down

0 comments on commit a38f0bd

Please sign in to comment.