Skip to content

Commit

Permalink
Merge pull request #1828 from guiseco/develop
Browse files Browse the repository at this point in the history
Indicates whether the vehicle is going up or down
  • Loading branch information
m4gr3d authored Nov 16, 2016
2 parents 177612a + aa59786 commit f661585
Show file tree
Hide file tree
Showing 16 changed files with 35 additions and 6 deletions.
Binary file removed Android/res/drawable-hdpi/debug_step_out.png
Binary file not shown.
Binary file removed Android/res/drawable-hdpi/debug_step_over.png
Binary file not shown.
Binary file removed Android/res/drawable-mdpi/debug_step_out.png
Binary file not shown.
Binary file removed Android/res/drawable-mdpi/debug_step_over.png
Binary file not shown.
Binary file removed Android/res/drawable-xhdpi/debug_step_out.png
Binary file not shown.
Binary file removed Android/res/drawable-xhdpi/debug_step_over.png
Binary file not shown.
Binary file removed Android/res/drawable-xxhdpi/debug_step_out.png
Binary file not shown.
Binary file removed Android/res/drawable-xxhdpi/debug_step_over.png
Binary file not shown.
Binary file removed Android/res/drawable-xxxhdpi/debug_step_out.png
Binary file not shown.
Binary file removed Android/res/drawable-xxxhdpi/debug_step_over.png
Binary file not shown.
5 changes: 5 additions & 0 deletions Android/res/drawable/ic_debug_step_down.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector android:height="16dp" android:viewportHeight="48.0"
android:viewportWidth="48.0" android:width="16dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#000000"
android:pathData="M22,26l0,10 -4.3,-4.5c-3.7,-3.8 -4.6,-4.3 -6,-3.2 -1.6,1.1 -1,1.9 5.3,8.2l7,6.9 7,-6.9c6.3,-6.3 6.9,-7.1 5.3,-8.2 -1.4,-1.1 -2.3,-0.6 -6,3.2l-4.3,4.5 0,-10c0,-9.3 -0.1,-10 -2,-10 -1.9,0 -2,0.7 -2,10z" android:strokeColor="#00000000"/>
</vector>
4 changes: 4 additions & 0 deletions Android/res/drawable/ic_debug_step_none.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<vector android:height="16dp" android:viewportHeight="24.0"
android:viewportWidth="24.0" android:width="16dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M19,13H5v-2h14v2z"/>
</vector>
4 changes: 4 additions & 0 deletions Android/res/drawable/ic_debug_step_over.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<vector android:height="16dp" android:viewportHeight="24.0"
android:viewportWidth="24.0" android:width="16dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M12,4l-1.41,1.41L16.17,11H4v2h12.17l-5.58,5.59L12,20l8,-8z"/>
</vector>
5 changes: 5 additions & 0 deletions Android/res/drawable/ic_debug_step_up.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector android:height="16dp" android:viewportHeight="48.0"
android:viewportWidth="48.0" android:width="16dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#000000"
android:pathData="M16.6,11.9c-6.1,6.2 -6.6,7 -5,7.9 1.6,0.9 2.6,0.3 6.1,-3.4l4.3,-4.4 0,10c0,9.3 0.1,10 2,10 1.9,0 2,-0.7 2,-10l0,-10 4.3,4.4c3.5,3.7 4.5,4.3 6.1,3.4 1.6,-0.9 1.1,-1.7 -5,-7.9 -3.8,-3.8 -7.1,-6.9 -7.4,-6.9 -0.3,0 -3.6,3.1 -7.4,6.9z" android:strokeColor="#00000000"/>
</vector>
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@
style="@style/largeTelemetryText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/debug_step_over"
android:drawableLeft="@drawable/ic_debug_step_over"
android:drawablePadding="10dp"
android:drawableStart="@drawable/debug_step_over"
android:drawableStart="@drawable/ic_debug_step_over"
android:singleLine="true"
android:text="@string/horizontal_speed_empty"
tools:text="hs: 1000 mph" />
Expand All @@ -100,9 +100,9 @@
style="@style/largeTelemetryText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/debug_step_out"
android:drawableLeft="@drawable/ic_debug_step_none"
android:drawablePadding="10dp"
android:drawableStart="@drawable/debug_step_out"
android:drawableStart="@drawable/ic_debug_step_none"
android:singleLine="true"
android:text="@string/vertical_speed_empty"
tools:text="vs: 1000 mph" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import org.droidplanner.android.R
import org.droidplanner.android.fragments.widget.TowerWidget
import org.droidplanner.android.fragments.widget.TowerWidgets
import org.droidplanner.android.view.AttitudeIndicator
import java.lang.String
import java.util.*

/**
Expand All @@ -34,6 +33,7 @@ public class MiniWidgetAttitudeSpeedInfo : TowerWidget() {
temp.addAction(AttributeEvent.ATTITUDE_UPDATED)
temp.addAction(AttributeEvent.SPEED_UPDATED)
temp.addAction(AttributeEvent.GPS_POSITION)
temp.addAction(AttributeEvent.ALTITUDE_UPDATED)
temp.addAction(AttributeEvent.HOME_UPDATED)
return temp
}
Expand All @@ -43,7 +43,7 @@ public class MiniWidgetAttitudeSpeedInfo : TowerWidget() {
override fun onReceive(context: Context, intent: Intent) {
when (intent.action) {
AttributeEvent.ATTITUDE_UPDATED -> onOrientationUpdate()
AttributeEvent.SPEED_UPDATED -> onSpeedUpdate()
AttributeEvent.SPEED_UPDATED, AttributeEvent.ALTITUDE_UPDATED -> onSpeedUpdate()
}
}
}
Expand All @@ -58,6 +58,8 @@ public class MiniWidgetAttitudeSpeedInfo : TowerWidget() {

private var headingModeFPV: Boolean = false

private val MIN_VERTICAL_SPEED_MPS = 0.10 //Meters Per Second

override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return inflater?.inflate(R.layout.fragment_mini_widget_attitude_speed_info, container, false)
}
Expand Down Expand Up @@ -136,5 +138,14 @@ public class MiniWidgetAttitudeSpeedInfo : TowerWidget() {

horizontalSpeed?.text = getString(R.string.horizontal_speed_telem, speedUnitProvider.boxBaseValueToTarget(groundSpeedValue).toString())
verticalSpeed?.text = getString(R.string.vertical_speed_telem, speedUnitProvider.boxBaseValueToTarget(verticalSpeedValue).toString())

if (verticalSpeedValue >= MIN_VERTICAL_SPEED_MPS){
verticalSpeed?.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_debug_step_up, 0, 0, 0);
}else if(verticalSpeedValue <= -(MIN_VERTICAL_SPEED_MPS)){
verticalSpeed?.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_debug_step_down, 0, 0, 0);
}else{
verticalSpeed?.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_debug_step_none, 0, 0, 0);
}

}
}

0 comments on commit f661585

Please sign in to comment.