From 553258c09aec727104cfef80bc1ecc03aac3fb29 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Tue, 6 Apr 2021 00:47:08 +0300 Subject: [PATCH] Fix status bar icons color and description padding --- .../net/osmand/plus/track/OverviewCard.java | 9 ++++++++- .../osmand/plus/track/TrackMenuFragment.java | 19 ++++--------------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/track/OverviewCard.java b/OsmAnd/src/net/osmand/plus/track/OverviewCard.java index 2822297f2e..c79638ec56 100644 --- a/OsmAnd/src/net/osmand/plus/track/OverviewCard.java +++ b/OsmAnd/src/net/osmand/plus/track/OverviewCard.java @@ -14,6 +14,7 @@ import androidx.annotation.NonNull; import androidx.appcompat.widget.AppCompatImageView; import androidx.recyclerview.widget.RecyclerView; +import net.osmand.AndroidUtils; import net.osmand.GPXUtilities.GPXFile; import net.osmand.GPXUtilities.Metadata; import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile; @@ -25,6 +26,7 @@ import net.osmand.plus.myplaces.SegmentActionsListener; import net.osmand.plus.routepreparationmenu.cards.BaseCard; import net.osmand.util.Algorithms; +import static net.osmand.AndroidUtils.dpToPx; import static net.osmand.plus.myplaces.TrackActivityFragmentAdapter.getMetadataImageLink; import static net.osmand.plus.myplaces.TrackActivityFragmentAdapter.isGpxFileSelected; import static net.osmand.plus.track.OptionsCard.APPEARANCE_BUTTON_INDEX; @@ -39,6 +41,7 @@ public class OverviewCard extends BaseCard { private View appearanceButton; private View editButton; private View directionsButton; + private TextView description; private final SegmentActionsListener actionsListener; private final SelectedGpxFile selectedGpxFile; private final GpxBlockStatisticsBuilder blockStatisticsBuilder; @@ -70,6 +73,7 @@ public class OverviewCard extends BaseCard { appearanceButton = view.findViewById(R.id.appearance_button); editButton = view.findViewById(R.id.edit_button); directionsButton = view.findViewById(R.id.directions_button); + description = view.findViewById(R.id.description); RecyclerView blocksView = view.findViewById(R.id.recycler_overview); blockStatisticsBuilder.setBlocksView(blocksView); @@ -81,6 +85,10 @@ public class OverviewCard extends BaseCard { initDirectionsButton(iconColorDef, iconColorPres); } blockStatisticsBuilder.initStatBlocks(actionsListener, getActiveColor()); + + if (blocksView.getVisibility() == View.VISIBLE && description.getVisibility() == View.VISIBLE) { + AndroidUtils.setPadding(description, 0, 0, 0, dpToPx(app, 12)); + } } private GPXFile getGPXFile() { @@ -142,7 +150,6 @@ public class OverviewCard extends BaseCard { gpxFile.metadata = new Metadata(); } - TextView description = view.findViewById(R.id.description); final String descriptionHtml = gpxFile.metadata.getDescription(); if (Algorithms.isBlank(descriptionHtml)) { AndroidUiHelper.updateVisibility(description, false); diff --git a/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java b/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java index 18d35953a0..248d376791 100644 --- a/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java @@ -746,19 +746,8 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card @Override public int getStatusBarColorId() { - View view = getView(); - if (view != null) { - boolean nightMode = isNightMode(); - if (getViewY() <= getFullScreenTopPosY() || !isPortrait()) { - if (Build.VERSION.SDK_INT >= 23 && !nightMode) { - view.setSystemUiVisibility(view.getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); - } - return nightMode ? R.color.status_bar_color_dark : R.color.status_bar_color_light; - } else { - if (Build.VERSION.SDK_INT >= 23 && !nightMode) { - view.setSystemUiVisibility(view.getSystemUiVisibility() & ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); - } - } + if (getViewY() <= getFullScreenTopPosY() || !isPortrait()) { + return isNightMode() ? R.color.status_bar_color_dark : R.color.status_bar_color_light; } return -1; } @@ -827,7 +816,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card segment = segments.get(0); } } - GpxDisplayItemType[] filterTypes = new GpxDisplayItemType[]{GpxDisplayItemType.TRACK_SEGMENT}; + GpxDisplayItemType[] filterTypes = new GpxDisplayItemType[] {GpxDisplayItemType.TRACK_SEGMENT}; List items = TrackDisplayHelper.flatten(displayHelper.getOriginalGroups(filterTypes)); if (segment != null && !Algorithms.isEmpty(items)) { SplitSegmentDialogFragment.showInstance(fragmentManager, displayHelper, items.get(0), segment); @@ -1220,7 +1209,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card @Override public void gpxSavingFinished(Exception errorMessage) { if (selectedGpxFile != null) { - List groups = displayHelper.getDisplayGroups(new GpxDisplayItemType[]{GpxDisplayItemType.TRACK_SEGMENT}); + List groups = displayHelper.getDisplayGroups(new GpxDisplayItemType[] {GpxDisplayItemType.TRACK_SEGMENT}); selectedGpxFile.setDisplayGroups(groups, app); selectedGpxFile.processPoints(app); }