-
Notifications
You must be signed in to change notification settings - Fork 55
GPS Signal Widget
The GPS signal widget shows the current GPS signal strength along with the number of satellites available and whether RTK is enabled on supported aircraft. By default, an icon with 5 vertical bars represents the current GPS signal strength.
The GPS icon changes color based on the connectivity status of the product. By default, it turns gray if the product is disconnected, and white if the product is connected.
When the flight controller is using values from an external GPS unit, the icon changes.
The status of the RTK is represented by an R to the right of the signal strength icon. If the R is hidden, RTK is not supported by the product or not enabled. If the R is red, RTK is enabled but not connected to a base station, or the accuracy of the RTK signal is low. If the R is white, the RTK signal has a high accuracy.
The number of satellites is displayed to the right of the icon.
<dji.ux.beta.core.widget.gpssignal.GPSSignalWidget
android:id="@+id/widget_gps_signal"
android:layout_width="42dp"
android:layout_height="22dp"/>
The ideal dimension ratio for this widget is 21:11
.
The UI elements can be customized to match the style of the user's application. The customizations can be done using attributes in XML or programmatically using the APIs.
<dji.ux.beta.core.widget.gpssignal.GPSSignalWidget
android:id="@+id/widget_gps_signal"
android:layout_width="42dp"
android:layout_height="22dp"
app:uxsdk_connectedStateIconColor="@color/black"
app:uxsdk_disconnectedStateIconColor="@color/blue"
app:uxsdk_gpsIcon="@drawable/ic_gps_fixed_black_24dp"
app:uxsdk_gpsSignalIcon="@drawable/ic_custom_gps_signal_level_list"
app:uxsdk_satelliteCountTextColor="@color/black" />
List of the customizable XML attributes
-
uxsdk_connectionStateIconColor
- The color used for the GPS display icon in the connected state. -
uxsdk_disconnectedStateIconColor
- The color used for the GPS display icon in the disconnected state. -
uxsdk_gpsIcon
- The drawable used as the GPS display icon. -
uxsdk_externalGPSIcon
- The drawable used as the GPS display icon when the flight controller is using values from an external GPS unit. -
uxsdk_gpsIconBackgroundDrawable
- The background of the GPS display icon. -
uxsdk_gpsSignalIcon
- The drawable used to display the signal strength, ideally a level-list drawable like the following.
<?xml version="1.0" encoding="utf-8"?>
<level-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:maxLevel="0" android:drawable="@drawable/ic_custom_signal_level_0" />
<item android:maxLevel="1" android:drawable="@drawable/ic_custom_signal_level_1" />
<item android:maxLevel="2" android:drawable="@drawable/ic_custom_signal_level_2" />
<item android:maxLevel="3" android:drawable="@drawable/ic_custom_signal_level_3" />
<item android:maxLevel="4" android:drawable="@drawable/ic_custom_signal_level_4" />
<item android:maxLevel="5" android:drawable="@drawable/ic_custom_signal_level_5" />
</level-list>
-
uxsdk_gpsSignalIconBackgroundDrawable
- The background of the GPS signal icon. -
uxsdk_satelliteCountTextAppearance
- The appearance of the satellite count text. -
uxsdk_satelliteCountTextSize
- The size of the satellite count text. -
uxsdk_satelliteCountTextColor
- The color of the satellite count text. -
uxsdk_satelliteCountBackgroundDrawable
- The background of the satellite count text view. -
uxsdk_rtkEnabledTextAppearance
- The appearance of the RTK enabled text. -
uxsdk_rtkEnabledTextSize
- The size of the RTK enabled text. -
uxsdk_rtkAccurateTextColor
- The color of the RTK enabled text when the RTK has high accuracy. -
uxsdk_rtkInaccurateTextColor
- The color of the RTK enabled text when the RTK has low accuracy. -
uxsdk_rtkEnabledBackgroundDrawable
- The background of the RTK enabled text view.
GPSSignalWidget gpsSignalWidget = findViewById(R.id.widget_gps_signal);
gpsSignalWidget.setConnectedStateIconColor(getResources().getColor(R.color.black));
gpsSignalWidget.setDisconnectedStateIconColor(getResources().getColor(R.color.blue));
gpsSignalWidget.setGPSIcon(getResources().getDrawable(R.drawable.ic_gps_fixed_black_24dp));
gpsSignalWidget.setGPSSignalIcon(getResources().getDrawable(R.drawable.ic_custom_gps_signal_level_list));
gpsSignalWidget.setSatelliteCountTextColor(getResources().getColor(R.color.black));
val gpsSignalWidget: GPSSignalWidget = findViewById(R.id.widget_gps_signal)
gpsSignalWidget.connectedStateIconColor = resources.getColor(R.color.black)
gpsSignalWidget.disconnectedStateIconColor = resources.getColor(R.color.blue)
gpsSignalWidget.gpsIcon = resources.getDrawable(R.drawable.ic_gps_fixed_black_24dp)
gpsSignalWidget.gpsSignalIcon = resources.getDrawable(R.drawable.ic_custom_gps_signal_level_list)
gpsSignalWidget.satelliteCountTextColor = resources.getColor(R.color.black)
List of the customization APIs
-
var connectedStateIconColor: Int
- The color of the GPS display icon when the product is connected. -
var disconnectedStateIconColor: Int
- The color of the GPS display icon when the product is disconnected. -
var rtkAccurateTextColor: Int
- The color of the RTK enabled text when the RTK has high accuracy. -
var rtkInaccurateTextColor: Int
- The color of the RTK enabled text when the RTK has low accuracy. -
var gpsIcon: Drawable?
- The drawable used as the GPS display icon. -
fun setGPSIcon(@DrawableRes resourceId: Int)
- Set the drawable used as the GPS display icon. -
var externalGPSIcon: Drawable?
- The drawable used as the GPS display icon when the flight controller is using values from an external GPS unit. -
fun setExternalGPSIcon(@DrawableRes resourceId: Int)
- Set the drawable used as the GPS display icon when the flight controller is using values from an external GPS unit. -
var gpsSignalIcon: Drawable?
- The drawable used to display the signal strength. -
fun setGPSSignalIcon(@DrawableRes resourceId: Int)
- Set the drawable used to display the signal strength. -
var gpsIconBackground: Drawable?
- The background of the GPS display icon. -
fun setGPSIconBackground(@DrawableRes resourceId: Int)
- Set the background of the GPS display icon. -
var gpsSignalIconBackground: Drawable?
- The background of the GPS signal strength icon. -
fun setGPSSignalIconBackground(@DrawableRes resourceId: Int)
- Set the background of the GPS signal strength icon. -
var satelliteCountTextColors: ColorStateList?
- The ColorStateList for the satellite count text. -
var satelliteCountTextColor: Int
- The color of the satellite count text. -
var satelliteCountTextSize: Float
- The size of the satellite count text. -
var satelliteCountTextBackground: Drawable?
- The background of the satellite count text view. -
fun setSatelliteCountTextAppearance(@StyleRes textAppearance: Int)
- Set the text appearance of the satellite count text view. -
var rtkEnabledTextSize: Float
- The size of the RTK status text. -
var rtkEnabledTextBackground: Drawable?
- The background of the RTK status text view. -
fun setRTKEnabledTextAppearance(@StyleRes textAppearance: Int)
- Set the text appearance of the RTK status text view.
The widget provides hooks for users to add functionality based on state changes in the widget. The GPS Signal widget provides the following hooks
-
ModelState
- Provides hooks in events received by the widget from the widget model.-
data class ProductConnected(val isConnected: Boolean) : ModelState()
- Event when product is connected or disconnected. -
data class GPSSignalQualityUpdated(val signalQuality: Int) : ModelState()
- Event when signal quality is updated. -
data class SatelliteCountUpdated(val satelliteCount: Int) : ModelState()
- Event when satellite count is updated. -
data class RTKEnabledUpdated(val rtkEnabled: Boolean) : ModelState()
- Event when the RTK is enabled or disabled. -
data class RTKAccurateUpdated(val isRTKAccurate: Boolean) : ModelState()
- Event when the accuracy of the RTK is updated. -
data class ExternalGPSUsedUpdated(val isExternalGPSUsed: Boolean) : ModelState()
- Event when the external GPS usage is updated.
-
The user can subscribe to this using public override fun getWidgetStateUpdate(): Flowable<ModelState>
.
-
UIState
- Provides hooks in events related to user interaction with the widget.-
object WidgetClick : UIState()
- Event when the widget is clicked.
-
The user can subscribe to this using fun getUIStateUpdates(): Flowable<UIState>
.
DJI UX SDK Version 5 Beta 5
UX SDK 5.0 Overview
Core Module
Camera Core Module
Visual Cameras Module
- Camera Config