Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warning view occlusion #1727

Merged
merged 3 commits into from
Apr 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ dependencies {
compile "com.google.android.gms:play-services-location:${play_services_version}"
compile "com.google.android.gms:play-services-analytics:${play_services_version}"

compile 'com.sothree.slidinguppanel:library:2.0.2'

compile "com.android.support:support-v4:${support_lib_version}"
compile "com.android.support:appcompat-v7:${support_lib_version}"
compile "com.android.support:cardview-v7:${support_lib_version}"
Expand All @@ -26,6 +24,7 @@ dependencies {
compile 'me.grantland:autofittextview:0.2.1'
compile(name:'shimmer-android-release', ext:'aar')
compile(name:'libuvccamera-release', ext:'aar')
compile(name:'sliding-up-panel-3.3.0', ext:'aar')

compile files('libs/droneapi-java-0.3-SNAPSHOT.jar')
compile files('libs/protobuf-java-2.5.0.jar')
Expand Down
Binary file added Android/libs/sliding-up-panel-3.3.0.aar
Binary file not shown.
178 changes: 99 additions & 79 deletions Android/res/layout/fragment_flight_data.xml
Original file line number Diff line number Diff line change
@@ -1,100 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<com.sothree.slidinguppanel.SlidingUpPanelLayout
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:sothree="http://schemas.android.com/apk/res-auto"
android:id="@+id/slidingPanelContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom"
sothree:shadowHeight="0dp"
sothree:paralaxOffset="0dp"
sothree:fadeColor="@android:color/transparent"
sothree:dragView="@+id/flightActionsFragment"
sothree:overlay="true">
android:orientation="vertical">

<RelativeLayout
<FrameLayout
android:id="@+id/flight_map_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

<com.sothree.slidinguppanel.SlidingUpPanelLayout
android:id="@+id/slidingPanelContainer"
xmlns:sothree="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
>
android:gravity="bottom"
android:layout_above="@+id/warningContainer"
sothree:umanoDragView="@+id/flightActionsFragment"
sothree:umanoFadeColor="@android:color/transparent"
sothree:umanoOverlay="true"
sothree:umanoParallaxOffset="0dp"
sothree:umanoShadowHeight="0dp">

<FrameLayout
android:id="@+id/flight_map_fragment"
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"/>
android:layout_height="match_parent"
>

<View
android:layout_alignParentTop="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_width="match_parent"
android:layout_height="0dp"
android:id="@+id/actionbar_shadow"/>
<View
android:id="@+id/actionbar_shadow"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_alignParentTop="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"/>

<TextView
android:id="@+id/failsafeTextView"
style="@style/editorMissionOverviewText"
android:layout_width="match_parent"
android:layout_height="64dp"
android:background="#D8ee2d3e"
android:gravity="start|center_vertical"
android:visibility="gone"
android:paddingLeft="55dp"
android:layout_below="@+id/actionbar_shadow"
android:layout_alignLeft="@+id/actionbar_shadow"
android:layout_alignStart="@+id/actionbar_shadow"
android:layout_alignRight="@+id/actionbar_shadow"
android:layout_alignEnd="@+id/actionbar_shadow"
/>

<include
android:layout_width="wrap_content"
android:layout_height="wrap_content"
layout="@layout/button_my_location"
android:layout_marginTop="8dp"
android:layout_gravity="center_vertical|start"
android:layout_below="@+id/actionbar_shadow"
android:layout_alignLeft="@+id/actionbar_shadow"
android:layout_alignStart="@+id/actionbar_shadow"
/>

</RelativeLayout>
<!-- Sliding layout -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:focusable="false"
android:clickable="false"
style="@style/slidingPanelGravity"
>
<include
layout="@layout/button_my_location"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/actionbar_shadow"
android:layout_alignStart="@+id/actionbar_shadow"
android:layout_below="@+id/actionbar_shadow"
android:layout_gravity="center_vertical|start"
android:layout_marginTop="8dp"
/>

<org.droidplanner.android.view.FitsSystemWindowsFrameLayout
android:id="@+id/flightActionsFragment"
android:layout_width="wrap_content"
</RelativeLayout>
<!-- Sliding layout -->
<LinearLayout
style="@style/slidingPanelGravity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:layout="@layout/fragment_flight_actions_bar"
android:fitsSystemWindows="true"/>
android:clickable="false"
android:focusable="false"
android:orientation="vertical"
>

<android.support.v7.widget.CardView
android:layout_width="@dimen/flight_actions_container_width"
android:layout_height="wrap_content"
android:clickable="true">
<org.droidplanner.android.view.FitsSystemWindowsFrameLayout
android:id="@+id/flightActionsFragment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
tools:layout="@layout/fragment_flight_actions_bar"/>

<ScrollView
<android.support.v7.widget.CardView
android:layout_width="@dimen/flight_actions_container_width"
android:layout_height="wrap_content"
android:minHeight="@dimen/flight_actions_container_height"
android:background="@color/transparent_light_grey"
>
android:clickable="true">

<FrameLayout
android:id="@+id/sliding_drawer_content"
android:layout_width="match_parent"
<ScrollView
android:layout_width="@dimen/flight_actions_container_width"
android:layout_height="wrap_content"
tools:layout="@layout/fragment_flight_mode_panel"/>
</ScrollView>
</android.support.v7.widget.CardView>
android:background="@color/transparent_light_grey"
android:minHeight="@dimen/flight_actions_container_height"
>

<FrameLayout
android:id="@+id/sliding_drawer_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:layout="@layout/fragment_flight_mode_panel"/>
</ScrollView>
</android.support.v7.widget.CardView>
</LinearLayout>
</com.sothree.slidinguppanel.SlidingUpPanelLayout>

<LinearLayout
style="@style/warningPanelGravity"
android:id="@+id/warningContainer"
android:layout_width="@dimen/flight_actions_container_width"
android:layout_height="56dp"
android:orientation="horizontal"
android:visibility="gone"
tools:visibility="visible"
android:background="#D8ee2d3e"
android:layout_alignParentBottom="true">

<TextView
android:id="@+id/failsafeTextView"
style="@style/editorMissionOverviewText"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="start|center_vertical"
android:background="?attr/selectableItemBackground"
/>

<ImageView
android:id="@+id/close_warning_view"
android:layout_width="56dp"
android:layout_height="match_parent"
android:background="?attr/selectableItemBackground"
android:scaleType="center"
android:src="@drawable/close"/>
</LinearLayout>
</com.sothree.slidinguppanel.SlidingUpPanelLayout>
</RelativeLayout>
6 changes: 6 additions & 0 deletions Android/res/values-land/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,10 @@
<item name="android:gravity">start</item>
<item name="android:paddingLeft">55dp</item>
</style>

<style name="warningPanelGravity">
<item name="android:layout_gravity">start</item>
<item name="android:layout_marginLeft">55dp</item>
<item name="android:layout_alignParentLeft">true</item>
</style>
</resources>
5 changes: 5 additions & 0 deletions Android/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,11 @@
<item name="android:gravity">center_horizontal</item>
</style>

<style name="warningPanelGravity">
<item name="android:layout_gravity">center_horizontal</item>
<item name="android:layout_centerHorizontal">true</item>
</style>

<style name="Telemetry" />

<style name="Telemetry.Entry" >
Expand Down
55 changes: 29 additions & 26 deletions Android/src/org/droidplanner/android/activities/FlightActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,27 +140,22 @@ public void onPanelSlide(View view, float v) {
}

@Override
public void onPanelCollapsed(View view) {
resetActionDrawerBottomMargin();
}

@Override
public void onPanelExpanded(View view) {
//Update the bottom margin for the action drawer
final View flightActionBar = ((ViewGroup)view).getChildAt(0);
final int[] viewLocs = new int[2];
flightActionBar.getLocationInWindow(viewLocs);
updateActionDrawerBottomMargin(viewLocs[0] + flightActionBar.getWidth(), view.getHeight());
}

@Override
public void onPanelAnchored(View view) {

}

@Override
public void onPanelHidden(View view) {
resetActionDrawerBottomMargin();
public void onPanelStateChanged(View panel, SlidingUpPanelLayout.PanelState previousState, SlidingUpPanelLayout.PanelState newState) {
switch(newState){
case COLLAPSED:
case HIDDEN:
resetActionDrawerBottomMargin();
break;

case EXPANDED:
//Update the bottom margin for the action drawer
ViewGroup slidingPanel = (ViewGroup) ((ViewGroup)panel).getChildAt(1);
final View flightActionBar = slidingPanel.getChildAt(0);
final int[] viewLocs = new int[2];
flightActionBar.getLocationInWindow(viewLocs);
updateActionDrawerBottomMargin(viewLocs[0] + flightActionBar.getWidth(), slidingPanel.getHeight());
break;
}
}

private void updateActionDrawerBottomMargin(int rightEdge, int bottomMargin){
Expand All @@ -171,16 +166,24 @@ private void updateActionDrawerBottomMargin(int rightEdge, int bottomMargin){
actionDrawer.getLocationInWindow(actionDrawerLocs);

if(actionDrawerLocs[0] <= rightEdge) {
ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) actionDrawerParent.getLayoutParams();
lp.bottomMargin = bottomMargin;
actionDrawerParent.requestLayout();
updateActionDrawerBottomMargin(bottomMargin);
}
}

private void resetActionDrawerBottomMargin(){
private int getActionDrawerBottomMargin(){
final ViewGroup actionDrawerParent = (ViewGroup) getActionDrawer();
ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) actionDrawerParent.getLayoutParams();
lp.bottomMargin = (int) getResources().getDimension(R.dimen.action_drawer_margin_bottom);;
return lp.bottomMargin;
}

private void updateActionDrawerBottomMargin(int newBottomMargin){
final ViewGroup actionDrawerParent = (ViewGroup) getActionDrawer();
ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) actionDrawerParent.getLayoutParams();
lp.bottomMargin = newBottomMargin;
actionDrawerParent.requestLayout();
}

private void resetActionDrawerBottomMargin(){
updateActionDrawerBottomMargin((int) getResources().getDimension(R.dimen.action_drawer_margin_bottom));
}
}
Loading