Open markers list in full screen

This commit is contained in:
Alex 2017-10-09 13:36:17 +03:00
parent 75c7dfe949
commit 0b86ae8643
3 changed files with 129 additions and 124 deletions

View file

@ -14,118 +14,133 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:clickable="true" android:clickable="true"
android:orientation="vertical" android:orientation="vertical">
tools:background="@drawable/bg_bottom_menu_dark">
<ProgressBar <ImageView
android:id="@+id/snap_to_road_progress_bar" android:id="@+id/plan_route_shadow"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:minHeight="0dp" android:scaleType="fitXY"
android:visibility="gone" android:src="@drawable/bg_shadow_onmap"/>
tools:visibility="visible"/>
<LinearLayout <LinearLayout
android:id="@+id/up_down_row" android:id="@+id/background_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/measurement_tool_up_down_row_height" android:layout_height="match_parent"
android:background="?attr/selectableItemBackground"> android:orientation="vertical"
tools:background="@color/bg_color_dark">
<ImageView <ProgressBar
android:id="@+id/up_down_icon" android:id="@+id/snap_to_road_progress_bar"
android:layout_width="wrap_content" style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:minHeight="0dp"
android:layout_marginEnd="@dimen/bottom_sheet_content_margin" android:visibility="gone"
android:layout_marginLeft="@dimen/bottom_sheet_content_margin" tools:visibility="visible"/>
android:layout_marginRight="@dimen/bottom_sheet_content_margin"
android:layout_marginStart="@dimen/bottom_sheet_content_margin"
android:background="@null"
tools:src="@drawable/ic_action_arrow_down"/>
<LinearLayout <LinearLayout
android:layout_width="0dp" android:id="@+id/up_down_row"
android:layout_height="wrap_content" android:layout_width="match_parent"
android:layout_gravity="center_vertical" android:layout_height="@dimen/measurement_tool_up_down_row_height"
android:layout_weight="1" android:background="?attr/selectableItemBackground">
android:orientation="vertical">
<LinearLayout <ImageView
android:layout_width="match_parent" android:id="@+id/up_down_icon"
android:layout_height="match_parent">
<TextView
android:id="@+id/markers_distance_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="@dimen/measurement_tool_text_margin_small"
android:layout_marginLeft="@dimen/measurement_tool_text_margin"
android:layout_marginRight="@dimen/measurement_tool_text_margin_small"
android:layout_marginStart="@dimen/measurement_tool_text_margin"
android:ellipsize="end"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.ListItemTitle"
tools:text="1.39 km,"/>
<TextView
android:id="@+id/markers_time_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_list_text_size"
tools:text="~ 45 min."/>
</LinearLayout>
<TextView
android:id="@+id/markers_count_text_view"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/measurement_tool_text_margin" android:layout_marginEnd="@dimen/bottom_sheet_content_margin"
android:layout_marginStart="@dimen/measurement_tool_text_margin" android:layout_marginLeft="@dimen/bottom_sheet_content_margin"
android:layout_marginRight="@dimen/bottom_sheet_content_margin"
android:layout_marginStart="@dimen/bottom_sheet_content_margin"
android:background="@null"
tools:src="@drawable/ic_action_arrow_down"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/markers_distance_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="@dimen/measurement_tool_text_margin_small"
android:layout_marginLeft="@dimen/measurement_tool_text_margin"
android:layout_marginRight="@dimen/measurement_tool_text_margin_small"
android:layout_marginStart="@dimen/measurement_tool_text_margin"
android:ellipsize="end"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.ListItemTitle"
tools:text="1.39 km,"/>
<TextView
android:id="@+id/markers_time_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_list_text_size"
tools:text="~ 45 min."/>
</LinearLayout>
<TextView
android:id="@+id/markers_count_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/measurement_tool_text_margin"
android:layout_marginStart="@dimen/measurement_tool_text_margin"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_sub_text_size"
tools:text="3 markers"/>
</LinearLayout>
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/select_all_button"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="?attr/selectableItemBackground"
android:ellipsize="end" android:ellipsize="end"
android:gravity="center_vertical"
android:maxLines="1" android:maxLines="1"
android:textColor="?android:textColorSecondary" android:paddingEnd="@dimen/measurement_tool_text_button_padding_small"
android:textSize="@dimen/default_sub_text_size" android:paddingLeft="@dimen/measurement_tool_text_button_padding"
tools:text="3 markers"/> android:paddingRight="@dimen/measurement_tool_text_button_padding_small"
android:paddingStart="@dimen/measurement_tool_text_button_padding"
android:text="@string/shared_string_select_all"
android:textColor="?attr/color_dialog_buttons"
osmand:textAllCapsCompat="true"
osmand:typeface="@string/font_roboto_medium"/>
</LinearLayout> </LinearLayout>
<net.osmand.plus.widgets.TextViewEx <FrameLayout
android:id="@+id/select_all_button" android:id="@+id/markers_list_container"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="?attr/selectableItemBackground"
android:ellipsize="end"
android:gravity="center_vertical"
android:maxLines="1"
android:paddingEnd="@dimen/measurement_tool_text_button_padding_small"
android:paddingLeft="@dimen/measurement_tool_text_button_padding"
android:paddingRight="@dimen/measurement_tool_text_button_padding_small"
android:paddingStart="@dimen/measurement_tool_text_button_padding"
android:text="@string/shared_string_select_all"
android:textColor="?attr/color_dialog_buttons"
osmand:textAllCapsCompat="true"
osmand:typeface="@string/font_roboto_medium"/>
</LinearLayout>
<FrameLayout
android:id="@+id/markers_list_container"
android:layout_width="match_parent"
android:layout_height="@dimen/measurement_tool_points_list_container_height"
android:background="@color/ctx_menu_info_view_bg_dark">
<android.support.v7.widget.RecyclerView
android:id="@+id/markers_recycler_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"/> android:layout_height="@dimen/measurement_tool_points_list_container_height"
android:background="@color/ctx_menu_info_view_bg_dark">
<include layout="@layout/card_bottom_divider"/> <android.support.v7.widget.RecyclerView
</FrameLayout> android:id="@+id/markers_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<include layout="@layout/card_bottom_divider"/>
</FrameLayout>
</LinearLayout>
</LinearLayout> </LinearLayout>

View file

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map_hud_bottom_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom" android:layout_gravity="bottom"
@ -223,6 +224,7 @@
</FrameLayout> </FrameLayout>
<FrameLayout <FrameLayout
android:id="@+id/fragments_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">

View file

@ -157,18 +157,14 @@ public class PlanRouteFragment extends Fragment {
} }
if (portrait) { if (portrait) {
AndroidUtils.setBackground(mapActivity, mainView, nightMode, R.drawable.bg_bottom_menu_light, R.drawable.bg_bottom_menu_dark); mainView.findViewById(R.id.background_view).setBackgroundResource(nightMode ? R.color.bg_color_dark : R.color.bg_color_light);
((ImageView) mainView.findViewById(R.id.up_down_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_arrow_up)); ((ImageView) mainView.findViewById(R.id.up_down_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_arrow_up));
mainView.findViewById(R.id.up_down_row).setOnClickListener(new View.OnClickListener() { mainView.findViewById(R.id.up_down_row).setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
if (!markersListOpened) { showHideMarkersList();
showMarkersList();
} else {
hideMarkersList();
}
} }
}); });
@ -337,7 +333,7 @@ public class PlanRouteFragment extends Fragment {
super.onDestroyView(); super.onDestroyView();
exitPlanRouteMode(); exitPlanRouteMode();
if (markersListOpened) { if (markersListOpened) {
hideMarkersList(); showHideMarkersList();
} }
} }
@ -604,30 +600,22 @@ public class PlanRouteFragment extends Fragment {
} }
} }
//todo create one method private void showHideMarkersList() {
private void showMarkersList() {
MapActivity mapActivity = getMapActivity(); MapActivity mapActivity = getMapActivity();
if (mapActivity != null && portrait) { if (mapActivity != null && portrait) {
markersListOpened = true; markersListOpened = !markersListOpened;
mapActivity.findViewById(R.id.bottom_controls_container).setVisibility(View.GONE); int height = markersListOpened ? ViewGroup.LayoutParams.MATCH_PARENT : ViewGroup.LayoutParams.WRAP_CONTENT;
((ImageView) mainView.findViewById(R.id.up_down_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_arrow_down)); int listHeight = markersListOpened ? ViewGroup.LayoutParams.MATCH_PARENT : closedListContainerHeight;
View listContainer = mainView.findViewById(R.id.markers_list_container); int visibility = markersListOpened ? View.GONE : View.VISIBLE;
if (listContainer != null) { Drawable arrow = getContentIcon(markersListOpened ? R.drawable.ic_action_arrow_down : R.drawable.ic_action_arrow_up);
listContainer.getLayoutParams().height = ViewGroup.LayoutParams.MATCH_PARENT;
}
}
}
private void hideMarkersList() { ((ImageView) mainView.findViewById(R.id.up_down_icon)).setImageDrawable(arrow);
MapActivity mapActivity = getMapActivity(); mapActivity.findViewById(R.id.bottom_controls_container).setVisibility(visibility);
if (mapActivity != null && portrait) { mapActivity.findViewById(R.id.map_hud_bottom_container).getLayoutParams().height = height;
markersListOpened = false; mapActivity.findViewById(R.id.fragments_container).getLayoutParams().height = height;
mapActivity.findViewById(R.id.bottom_controls_container).setVisibility(View.VISIBLE); mainView.findViewById(R.id.markers_list_container).getLayoutParams().height = listHeight;
((ImageView) mainView.findViewById(R.id.up_down_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_arrow_up)); mainView.findViewById(R.id.plan_route_shadow).setVisibility(visibility);
View listContainer = mainView.findViewById(R.id.markers_list_container); mainView.getLayoutParams().height = height;
if (listContainer != null) {
listContainer.getLayoutParams().height = closedListContainerHeight;
}
} }
} }
@ -682,8 +670,8 @@ public class PlanRouteFragment extends Fragment {
} }
public boolean quit(boolean hideMarkersListFirst) { public boolean quit(boolean hideMarkersListFirst) {
if (portrait && markersListOpened && hideMarkersListFirst) { if (markersListOpened && hideMarkersListFirst) {
hideMarkersList(); showHideMarkersList();
return false; return false;
} else { } else {
dismiss(getMapActivity()); dismiss(getMapActivity());
@ -692,8 +680,8 @@ public class PlanRouteFragment extends Fragment {
} }
private void dismiss(MapActivity activity) { private void dismiss(MapActivity activity) {
if (portrait && markersListOpened) { if (markersListOpened) {
hideMarkersList(); showHideMarkersList();
} }
planRouteContext.setFragmentVisible(false); planRouteContext.setFragmentVisible(false);
activity.getSupportFragmentManager().beginTransaction().remove(this).commitAllowingStateLoss(); activity.getSupportFragmentManager().beginTransaction().remove(this).commitAllowingStateLoss();