diff --git a/OsmAnd/res/layout/track_width_card.xml b/OsmAnd/res/layout/track_width_card.xml index 3710ad43b4..e919df6e29 100644 --- a/OsmAnd/res/layout/track_width_card.xml +++ b/OsmAnd/res/layout/track_width_card.xml @@ -52,7 +52,6 @@ android:layout_height="wrap_content" android:orientation="horizontal" android:paddingStart="@dimen/content_padding" - android:paddingTop="@dimen/content_padding" android:paddingEnd="@dimen/content_padding"> + android:textColor="?android:textColorSecondary" + android:textSize="@dimen/default_list_text_size" + tools:text="1" /> + + - - + android:textSize="@dimen/default_list_text_size" + tools:text="1" /> + android:textSize="@dimen/default_list_text_size" + tools:text="24" /> diff --git a/OsmAnd/src/net/osmand/plus/UiUtilities.java b/OsmAnd/src/net/osmand/plus/UiUtilities.java index 269800c630..08f8e182f9 100644 --- a/OsmAnd/src/net/osmand/plus/UiUtilities.java +++ b/OsmAnd/src/net/osmand/plus/UiUtilities.java @@ -633,8 +633,9 @@ public class UiUtilities { } int activeDisableColor = getColorWithAlpha(activeColor, 0.25f); ColorStateList activeCsl = new ColorStateList(states, new int[] {activeColor, activeDisableColor}); - int inactiveColor = ContextCompat.getColor(ctx, nightMode ? R.color.icon_color_default_dark : R.color.icon_color_secondary_light); - ColorStateList inactiveCsl = new ColorStateList(states, new int[] {inactiveColor, inactiveColor}); + int inactiveColor = getColorWithAlpha(activeColor, 0.5f); + int inactiveDisableColor = ContextCompat.getColor(ctx, nightMode ? R.color.icon_color_default_dark : R.color.icon_color_secondary_light); + ColorStateList inactiveCsl = new ColorStateList(states, new int[] {inactiveColor, inactiveDisableColor}); slider.setTrackActiveTintList(activeCsl); slider.setTrackInactiveTintList(inactiveCsl); slider.setHaloTintList(activeCsl); diff --git a/OsmAnd/src/net/osmand/plus/track/TrackWidthCard.java b/OsmAnd/src/net/osmand/plus/track/TrackWidthCard.java index 2a8f34c024..a6bc058b6d 100644 --- a/OsmAnd/src/net/osmand/plus/track/TrackWidthCard.java +++ b/OsmAnd/src/net/osmand/plus/track/TrackWidthCard.java @@ -45,6 +45,7 @@ public class TrackWidthCard extends BaseCard { private GpxWidthAdapter widthAdapter; private View sliderContainer; + private RecyclerView groupRecyclerView; public TrackWidthCard(MapActivity mapActivity, TrackDrawInfo trackDrawInfo, OnNeedScrollListener onNeedScrollListener) { @@ -65,9 +66,10 @@ public class TrackWidthCard extends BaseCard { updateCustomWidthSlider(); widthAdapter = new GpxWidthAdapter(appearanceItems); - RecyclerView groupRecyclerView = view.findViewById(R.id.recycler_view); + groupRecyclerView = view.findViewById(R.id.recycler_view); groupRecyclerView.setAdapter(widthAdapter); groupRecyclerView.setLayoutManager(new LinearLayoutManager(app, RecyclerView.HORIZONTAL, false)); + scrollMenuToSelectedItem(); AndroidUiHelper.updateVisibility(view.findViewById(R.id.top_divider), isShowDivider()); } @@ -155,7 +157,7 @@ public class TrackWidthCard extends BaseCard { } } }); - UiUtilities.setupSlider(widthSlider, nightMode, null); + UiUtilities.setupSlider(widthSlider, nightMode, null, true); ScrollUtils.addOnGlobalLayoutListener(sliderContainer, new Runnable() { @Override public void run() { @@ -175,6 +177,11 @@ public class TrackWidthCard extends BaseCard { mapActivity.refreshMap(); } + private void scrollMenuToSelectedItem() { + int position = widthAdapter.getItemPosition(selectedItem); + groupRecyclerView.scrollToPosition(position); + } + private class GpxWidthAdapter extends RecyclerView.Adapter { private List items; @@ -219,6 +226,7 @@ public class TrackWidthCard extends BaseCard { updateHeader(); updateCustomWidthSlider(); + scrollMenuToSelectedItem(); CardListener listener = getListener(); if (listener != null) {