Skip to content

AGL Altitude Widget

Siddharth Utgikar edited this page Dec 22, 2020 · 1 revision

The AGL Altitude Widget is a TEXT type of Base Telemetry Widget. It shows the current above-ground-level(AGL) altitude.

State Image
Disconnected
Metric Unit System
Imperial Unit System

Usage

<dji.ux.beta.core.widget.altitude.AGLAltitudeWidget
     android:layout_width="wrap_content"
     android:layout_height="wrap_content" />

Customizations

The UI elements can be customized to match the style of the user's application. The widget supports all the Text Customizations provided in the Base Telemetry Widget.

XML Example

<dji.ux.beta.core.widget.altitude.AGLAltitudeWidget
     android:layout_width="wrap_content"
     android:layout_height="150dp"
     android:background="@color/white"
     app:uxsdk_label_text_color="@color/black"
     app:uxsdk_value_text_color="@color/blue"
     app:uxsdk_unit_text_color="@color/blue"/>
State Image
Disconnected
Metric Unit System
Imperial Unit System

Kotlin Example

val aglAltitude = AGLAltitudeWidget(context)
aglAltitude.setBackgroundColor(resources.getColor(R.color.white))
aglAltitude.labelTextColor = resources.getColor(R.color.black)
aglAltitude.valueTextColor = resources.getColor(R.color.blue)
aglAltitude.unitTextColor = resources.getColor(R.color.blue)

Java Example

AGLAltitudeWidget aglAltitude = new AGLAltitudeWidget(this);
aglAltitude.setBackgroundColor(getResources().getColor(R.color.white));
aglAltitude.setLabelTextColor(getResources().getColor(R.color.black));
aglAltitude.setValueTextColor(getResources().getColor(R.color.blue));
aglAltitude.setUnitTextColor(getResources().getColor(R.color.blue));

Hooks

The widget provides hooks for the users to add functionality based on the state changes in the widget. The AGLAltitudeWidget provides the following hooks

  1. ModelState - Provides hooks in events received by the widget from the widget model.
    • data class ProductConnected(val isConnected: Boolean) : ModelState() - Event when the product is connected or disconnected.
    • data class AltitudeStateUpdated(val altitudeState: AltitudeState) : ModelState() - Event when altitude of the drone is updated.

The user can subscribe to this using public override fun getWidgetStateUpdate(): Flowable<ModelState>.

Clone this wiki locally