Fix status bar icons color and description padding

This commit is contained in:
Vitaliy 2021-04-06 00:47:08 +03:00
parent 27fd305e4c
commit 553258c09a
2 changed files with 12 additions and 16 deletions

View file

@ -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);

View file

@ -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);
}
}
return isNightMode() ? R.color.status_bar_color_dark : R.color.status_bar_color_light;
}
return -1;
}