From 9fdfa1270b085a60a46e78836f1a9a142b06c4c8 Mon Sep 17 00:00:00 2001 From: nazar-kutz Date: Mon, 5 Apr 2021 20:19:16 +0300 Subject: [PATCH] Show current card header on main header --- .../bottom_sheet_item_with_two_text.xml | 44 +++++++++++++ OsmAnd/res/layout/route_line_appearance.xml | 23 +------ OsmAnd/res/layout/route_line_color_card.xml | 39 +---------- OsmAnd/res/layout/route_line_width_card.xml | 39 +---------- .../routing/cards/RouteLineColorCard.java | 39 ++++++----- .../routing/cards/RouteLineWidthCard.java | 24 +++++-- .../RouteLineAppearanceFragment.java | 65 ++++++++++++++++--- 7 files changed, 148 insertions(+), 125 deletions(-) create mode 100644 OsmAnd/res/layout/bottom_sheet_item_with_two_text.xml diff --git a/OsmAnd/res/layout/bottom_sheet_item_with_two_text.xml b/OsmAnd/res/layout/bottom_sheet_item_with_two_text.xml new file mode 100644 index 0000000000..eb2efab2ef --- /dev/null +++ b/OsmAnd/res/layout/bottom_sheet_item_with_two_text.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/layout/route_line_appearance.xml b/OsmAnd/res/layout/route_line_appearance.xml index e5410cdd2f..5564b3b867 100644 --- a/OsmAnd/res/layout/route_line_appearance.xml +++ b/OsmAnd/res/layout/route_line_appearance.xml @@ -19,9 +19,7 @@ android:layout_height="wrap_content" android:background="?attr/bg_color" android:minHeight="@dimen/bottom_sheet_title_height" - android:orientation="vertical" - android:paddingLeft="@dimen/content_padding" - android:paddingRight="@dimen/content_padding"> + android:orientation="vertical"> - - - - - + diff --git a/OsmAnd/res/layout/route_line_color_card.xml b/OsmAnd/res/layout/route_line_color_card.xml index c25332de88..f8db414f16 100644 --- a/OsmAnd/res/layout/route_line_color_card.xml +++ b/OsmAnd/res/layout/route_line_color_card.xml @@ -9,43 +9,8 @@ - - - - - - - - + android:orientation="horizontal" + android:paddingTop="@dimen/content_padding_small"> + + - - - - - - - - colorCard.getViewHeight() + headerTitle.getBottom()) { + selectedHeader = widthCard; + } else { + selectedHeader = colorCard; + } + selectedHeader.onNeedHeaderUpdate(); + } + private void initVisibleRect() { MapActivity ctx = getMapActivity(); int screenHeight = AndroidUtils.getScreenHeight(ctx); @@ -385,7 +424,6 @@ public class RouteLineAppearanceFragment extends ContextMenuScrollFragment imple colorCard.onColorSelected(prevColor, newColor); } - @Override public void onSelectedColorChanged() { updateColorItems(); } @@ -418,7 +456,6 @@ public class RouteLineAppearanceFragment extends ContextMenuScrollFragment imple } } - @Override public void onMapThemeUpdated(@NonNull DayNightMode mapTheme) { changeMapTheme(mapTheme); updateColorItems(); @@ -435,4 +472,14 @@ public class RouteLineAppearanceFragment extends ContextMenuScrollFragment imple public interface OnApplyRouteLineListener { void applyRouteLineAppearance(@NonNull RouteLineDrawInfo routeLineDrawInfo); } + + public interface HeaderUiAdapter { + void onHeaderUpdate(@NonNull HeaderInfo headerInfo, + @NonNull String title, + @NonNull String description); + } + + public interface HeaderInfo { + void onNeedHeaderUpdate(); + } }