From 1a149c0d63b72ad2a53f62e88e1447408e0a259d Mon Sep 17 00:00:00 2001 From: Skalii Date: Thu, 25 Mar 2021 21:05:10 +0200 Subject: [PATCH] small fixes --- .../plus/monitoring/TripRecordingBottomSheet.java | 5 ++++- .../net/osmand/plus/myplaces/SegmentGPXAdapter.java | 9 ++------- OsmAnd/src/net/osmand/plus/track/SegmentsCard.java | 2 +- .../plus/views/controls/PagerSlidingTabStrip.java | 12 ------------ 4 files changed, 7 insertions(+), 21 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomSheet.java b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomSheet.java index 3decf5bbad..480e5affa8 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomSheet.java @@ -294,10 +294,13 @@ public class TripRecordingBottomSheet extends MenuBottomSheetDialogFragment impl viewGroup.removeAllViews(); setupDisplayHelper(); - View segmentView = SegmentGPXAdapter.createGpxTabsView(displayHelper, viewGroup, this, nightMode, true); + View segmentView = SegmentGPXAdapter.createGpxTabsView(displayHelper, viewGroup, this, nightMode); AndroidUiHelper.setVisibility(View.GONE, segmentView.findViewById(R.id.list_item_divider)); WrapContentHeightViewPager pager = segmentView.findViewById(R.id.pager); PagerSlidingTabStrip tabLayout = segmentView.findViewById(R.id.sliding_tabs); + tabLayout.setDividerWidth(AndroidUtils.dpToPx(app, 1)); + tabLayout.setDividerColor(ContextCompat.getColor(app, nightMode ? + R.color.stroked_buttons_and_links_outline_dark : R.color.stroked_buttons_and_links_outline_light)); tabLayout.setOnTabReselectedListener(new PagerSlidingTabStrip.OnTabReselectedListener() { @Override public void onTabSelected(int position) { diff --git a/OsmAnd/src/net/osmand/plus/myplaces/SegmentGPXAdapter.java b/OsmAnd/src/net/osmand/plus/myplaces/SegmentGPXAdapter.java index 9891c6ef5f..91f67afd22 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/SegmentGPXAdapter.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/SegmentGPXAdapter.java @@ -49,7 +49,7 @@ public class SegmentGPXAdapter extends ArrayAdapter { boolean create = false; if (row == null) { create = true; - row = createGpxTabsView(displayHelper, parent, listener, nightMode, false); + row = createGpxTabsView(displayHelper, parent, listener, nightMode); } GpxDisplayItem item = getItem(position); if (item != null) { @@ -67,7 +67,7 @@ public class SegmentGPXAdapter extends ArrayAdapter { } public static View createGpxTabsView(TrackDisplayHelper displayHelper, ViewGroup root, - SegmentActionsListener listener, boolean nightMode, boolean withDivider) { + SegmentActionsListener listener, boolean nightMode) { Context context = root.getContext(); View row = UiUtilities.getInflater(context, nightMode).inflate(R.layout.gpx_list_item_tab_content, root, false); @@ -75,11 +75,6 @@ public class SegmentGPXAdapter extends ArrayAdapter { tabLayout.setTabBackground(AndroidUtils.resolveAttribute(context, R.attr.btn_bg_border_inactive)); tabLayout.setIndicatorHeight(0); tabLayout.setShouldExpand(true); - if (withDivider) { - tabLayout.setDividerWidth(AndroidUtils.dpToPx(context, 1.0f)); - tabLayout.setDividerColor(ContextCompat.getColor(context, nightMode ? - R.color.stroked_buttons_and_links_outline_dark : R.color.stroked_buttons_and_links_outline_light)); - } WrapContentHeightViewPager pager = row.findViewById(R.id.pager); pager.setSwipeable(false); pager.setOffscreenPageLimit(2); diff --git a/OsmAnd/src/net/osmand/plus/track/SegmentsCard.java b/OsmAnd/src/net/osmand/plus/track/SegmentsCard.java index 8a49438bc6..a3ed324543 100644 --- a/OsmAnd/src/net/osmand/plus/track/SegmentsCard.java +++ b/OsmAnd/src/net/osmand/plus/track/SegmentsCard.java @@ -42,7 +42,7 @@ public class SegmentsCard extends BaseCard { container.removeAllViews(); List items = TrackDisplayHelper.flatten(displayHelper.getOriginalGroups(filterTypes)); for (GpxDisplayItem displayItem : items) { - View segmentView = SegmentGPXAdapter.createGpxTabsView(displayHelper, container, listener, nightMode, false); + View segmentView = SegmentGPXAdapter.createGpxTabsView(displayHelper, container, listener, nightMode); WrapContentHeightViewPager pager = segmentView.findViewById(R.id.pager); PagerSlidingTabStrip tabLayout = segmentView.findViewById(R.id.sliding_tabs); diff --git a/OsmAnd/src/net/osmand/plus/views/controls/PagerSlidingTabStrip.java b/OsmAnd/src/net/osmand/plus/views/controls/PagerSlidingTabStrip.java index 7eade8f2ba..bdb936f8ba 100644 --- a/OsmAnd/src/net/osmand/plus/views/controls/PagerSlidingTabStrip.java +++ b/OsmAnd/src/net/osmand/plus/views/controls/PagerSlidingTabStrip.java @@ -129,7 +129,6 @@ public class PagerSlidingTabStrip extends HorizontalScrollView { private int dividerWidth = 0; - private int dividerPadding = 0; @ColorInt private int dividerColor; @@ -183,7 +182,6 @@ public class PagerSlidingTabStrip extends HorizontalScrollView { scrollOffset = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, scrollOffset, dm); indicatorHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, indicatorHeight, dm); underlineHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, underlineHeight, dm); - dividerPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dividerPadding, dm); tabPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, tabPadding, dm); dividerWidth = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dividerWidth, dm); tabTextSize = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, tabTextSize, dm); @@ -214,7 +212,6 @@ public class PagerSlidingTabStrip extends HorizontalScrollView { dividerWidth = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsDividerWidth, dividerWidth); indicatorHeight = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsIndicatorHeight, indicatorHeight); underlineHeight = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsUnderlineHeight, underlineHeight); - dividerPadding = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsDividerPadding, dividerPadding); tabPadding = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsTabPaddingLeftRight, tabPadding); tabBackgroundResId = a.getResourceId(R.styleable.PagerSlidingTabStrip_pstsTabBackground, tabBackgroundResId); indicatorBgColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsTabBackground, Color.TRANSPARENT); @@ -720,10 +717,6 @@ public class PagerSlidingTabStrip extends HorizontalScrollView { return underlineHeight; } - public int getDividerPadding() { - return dividerPadding; - } - public int getScrollOffset() { return scrollOffset; } @@ -826,11 +819,6 @@ public class PagerSlidingTabStrip extends HorizontalScrollView { invalidate(); } - public void setDividerPadding(int dividerPaddingPx) { - this.dividerPadding = dividerPaddingPx; - invalidate(); - } - public void setScrollOffset(int scrollOffsetPx) { this.scrollOffset = scrollOffsetPx; invalidate();