Add missing dividers

This commit is contained in:
Vitaliy 2020-08-20 13:33:20 +03:00
parent f3f7916fbc
commit 9128691b52
2 changed files with 54 additions and 27 deletions

View file

@ -4,35 +4,44 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bg_color"
android:orientation="vertical"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding">
android:orientation="vertical">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/title"
<include layout="@layout/simple_divider_item" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:letterSpacing="@dimen/description_letter_spacing"
android:paddingTop="@dimen/list_header_settings_top_margin"
android:paddingBottom="@dimen/context_menu_padding_margin_tiny"
android:singleLine="true"
android:text="@string/navigate_to_track_descr"
android:textColor="@color/preference_category_title"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium" />
android:orientation="vertical"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding">
<include
android:id="@+id/pass_whole_route_container"
layout="@layout/radio_buttons_with_descr"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/content_padding_half" />
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:letterSpacing="@dimen/description_letter_spacing"
android:paddingTop="@dimen/list_header_settings_top_margin"
android:paddingBottom="@dimen/context_menu_padding_margin_tiny"
android:singleLine="true"
android:text="@string/navigate_to_track_descr"
android:textColor="@color/preference_category_title"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium" />
<include
android:id="@+id/navigation_type_container"
layout="@layout/radio_buttons_with_descr"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/content_padding" />
<include
android:id="@+id/pass_whole_route_container"
layout="@layout/radio_buttons_with_descr"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/content_padding_half" />
<include
android:id="@+id/navigation_type_container"
layout="@layout/radio_buttons_with_descr"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/content_padding" />
</LinearLayout>
</LinearLayout>

View file

@ -11,7 +11,9 @@ import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.ViewGroup.LayoutParams;
import android.view.ViewGroup.MarginLayoutParams;
import android.view.ViewTreeObserver.OnScrollChangedListener;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.LinearLayout;
@ -193,6 +195,7 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca
SelectTrackCard selectTrackCard = new SelectTrackCard(mapActivity);
selectTrackCard.setListener(this);
cardsContainer.addView(selectTrackCard.build(mapActivity));
cardsContainer.addView(buildDividerView(cardsContainer,false));
ApplicationMode mode = app.getRoutingHelper().getAppMode();
@ -210,6 +213,8 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca
cardsContainer.addView(reverseTrackCard.build(mapActivity));
// }
if (!gpxFile.hasRtePt()) {
cardsContainer.addView(buildDividerView(cardsContainer,true));
AttachTrackToRoadsCard attachTrackCard = new AttachTrackToRoadsCard(mapActivity);
attachTrackCard.setListener(this);
cardsContainer.addView(attachTrackCard.build(mapActivity));
@ -254,6 +259,19 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca
}
}
public View buildDividerView(@NonNull ViewGroup view, boolean needMargin) {
LayoutInflater themedInflater = UiUtilities.getInflater(view.getContext(), isNightMode());
View divider = themedInflater.inflate(R.layout.simple_divider_item, view, false);
LayoutParams params = divider.getLayoutParams();
if (needMargin && params instanceof MarginLayoutParams) {
AndroidUtils.setMargins((MarginLayoutParams) params, dpToPx(64), 0, 0, 0);
divider.setLayoutParams(params);
}
return divider;
}
@Override
protected void calculateLayout(View view, boolean initLayout) {
menuTitleHeight = view.findViewById(R.id.route_menu_top_shadow_all).getHeight()
@ -511,7 +529,7 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca
final View scrollView = getBottomScrollView();
final FrameLayout bottomContainer = getBottomContainer();
scrollView.getViewTreeObserver().addOnScrollChangedListener(new ViewTreeObserver.OnScrollChangedListener() {
scrollView.getViewTreeObserver().addOnScrollChangedListener(new OnScrollChangedListener() {
@Override
public void onScrollChanged() {