Merge pull request #9697 from osmandapp/plan_route_fixes

Plan route fixes first part
This commit is contained in:
max-klaus 2020-08-26 10:57:36 +03:00 committed by GitHub
commit 5a64dcbc84
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 142 additions and 91 deletions

View file

@ -1,9 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<net.osmand.plus.widgets.TextViewEx
@ -12,9 +17,9 @@
android:layout_height="wrap_content"
android:paddingStart="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingTop="@dimen/measurement_tool_menu_title_padding_top"
android:paddingEnd="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingTop="@dimen/measurement_tool_menu_title_padding_top"
android:paddingBottom="@dimen/measurement_tool_menu_title_padding_bottom"
android:text="@string/plan_route_open_existing_track"
android:textAppearance="@style/TextAppearance.ListItemTitle"
@ -38,23 +43,24 @@
android:id="@+id/folder_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding"
android:paddingEnd="@dimen/content_padding"
android:clipToPadding="false"
android:orientation="horizontal"
android:paddingStart="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingEnd="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
tools:itemCount="3"
tools:orientation="horizontal"
tools:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/point_editor_icon_category_item" />
tools:listitem="@layout/point_editor_icon_category_item"
tools:orientation="horizontal" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/gpx_track_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:itemCount="1"
tools:listitem="@layout/gpx_track_select_item">
tools:listitem="@layout/gpx_track_select_item" />
</androidx.recyclerview.widget.RecyclerView>
</LinearLayout>
</androidx.core.widget.NestedScrollView>

View file

@ -1,9 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
@ -12,17 +17,17 @@
android:orientation="horizontal"
android:paddingStart="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingTop="@dimen/bottom_sheet_title_padding_top"
android:paddingEnd="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingTop="@dimen/bottom_sheet_title_padding_top"
android:paddingBottom="@dimen/bottom_sheet_title_padding_bottom">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/last_edited"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/plan_route_last_edited"
android:letterSpacing="@dimen/description_letter_spacing"
android:text="@string/plan_route_last_edited"
android:textColor="?attr/active_color_basic"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium" />
@ -35,7 +40,8 @@
android:layout_height="0dp"
android:layout_weight="1"
tools:itemCount="1"
tools:listitem="@layout/gpx_track_select_item">
tools:listitem="@layout/gpx_track_select_item" />
</androidx.recyclerview.widget.RecyclerView>
</LinearLayout>
</androidx.core.widget.NestedScrollView>

View file

@ -11,8 +11,26 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include layout="@layout/context_menu_top_shadow" />
<include
layout="@layout/plan_route_progress_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom" />
</FrameLayout>
<LinearLayout
android:id="@+id/gpx_approximation_top_shadow_all"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
<FrameLayout
android:id="@+id/bottom_container"
android:layout_width="match_parent"
@ -36,8 +54,6 @@
</net.osmand.plus.LockableScrollView>
<include layout="@layout/plan_route_progress_bar"/>
</FrameLayout>
</LinearLayout>

View file

@ -66,6 +66,7 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment {
private View view;
private OnLayoutChangeListener containerLayoutListener;
private View topShadow;
private ViewGroup topView;
private View bottomScrollView;
private LinearLayout cardsContainer;
private FrameLayout bottomContainer;
@ -167,6 +168,11 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment {
return mainView;
}
@Nullable
public ViewGroup getTopView() {
return topView;
}
public boolean isNightMode() {
return nightMode;
}
@ -290,7 +296,7 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment {
final int touchSlop = vc.getScaledTouchSlop();
if (getTopViewId() != 0) {
View topView = view.findViewById(getTopViewId());
topView = view.findViewById(getTopViewId());
AndroidUtils.setBackground(app, topView, nightMode, R.color.card_and_list_background_light, R.color.card_and_list_background_dark);
}
if (!portrait) {

View file

@ -61,6 +61,11 @@ public class GpxApproximationFragment extends ContextMenuScrollFragment
return R.layout.fragment_gpx_approximation_bottom_sheet_dialog;
}
@Override
public int getTopViewId() {
return R.id.gpx_approximation_top_shadow_all;
}
@Override
public int getHeaderViewHeight() {
return menuTitleHeight;
@ -259,9 +264,11 @@ public class GpxApproximationFragment extends ContextMenuScrollFragment
ViewGroup cardsContainer = getCardsContainer();
cardsContainer.removeAllViews();
if (getTopView() != null) {
SliderCard sliderCard = new SliderCard(mapActivity, distanceThreshold);
sliderCard.setListener(this);
cardsContainer.addView(sliderCard.build(mapActivity));
getTopView().addView(sliderCard.build(mapActivity));
}
ProfileCard profileCard = new ProfileCard(mapActivity, snapToRoadAppMode);
profileCard.setListener(this);

View file

@ -15,6 +15,7 @@ import net.osmand.plus.routepreparationmenu.cards.BaseCard;
import net.osmand.plus.settings.backend.ApplicationMode;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class ProfileCard extends BaseCard {
@ -34,9 +35,15 @@ public class ProfileCard extends BaseCard {
@Override
protected void updateContent() {
final List<ApplicationMode> modes = new ArrayList<>(ApplicationMode.values(app));
modes.remove(ApplicationMode.DEFAULT);
Iterator<ApplicationMode> iterator = modes.iterator();
while (iterator.hasNext()) {
ApplicationMode mode = iterator.next();
if ("public_transport".equals(mode.getRoutingProfile())) {
iterator.remove();
}
}
for (int i = 0; i < modes.size(); i++) {
ApplicationMode mode = modes.get(i);
LinearLayout container = view.findViewById(R.id.content_container);

View file

@ -34,7 +34,8 @@ import org.apache.commons.logging.Log;
import java.util.ArrayList;
import java.util.List;
import static net.osmand.plus.UiUtilities.CustomRadioButtonType.*;
import static net.osmand.plus.UiUtilities.CustomRadioButtonType.LEFT;
import static net.osmand.plus.UiUtilities.CustomRadioButtonType.RIGHT;
import static net.osmand.plus.measurementtool.MeasurementEditingContext.CalculationMode.NEXT_SEGMENT;
import static net.osmand.plus.measurementtool.MeasurementEditingContext.CalculationMode.WHOLE_TRACK;
import static net.osmand.plus.measurementtool.MeasurementEditingContext.DEFAULT_APP_MODE;
@ -120,9 +121,11 @@ public class RouteBetweenPointsBottomSheetDialogFragment extends BottomSheetDial
for (int i = 0; i < modes.size(); i++) {
ApplicationMode mode = modes.get(i);
if (!"public_transport".equals(mode.getRoutingProfile())) {
icon = app.getUIUtilities().getIcon(mode.getIconRes(), mode.getIconColorInfo().getColor(nightMode));
addProfileView(navigationType, onClickListener, i, icon, mode.toHumanString(), mode.equals(appMode));
}
}
segmentBtn.setOnClickListener(new View.OnClickListener() {
@Override

View file

@ -477,8 +477,8 @@ public class MapRouteInfoMenuFragment extends ContextMenuFragment {
AndroidUtils.setBackground(ctx, getCardsContainer(), isNightMode(),
R.color.activity_background_light, R.color.activity_background_dark);
if (getTopViewId() != 0) {
View topView = view.findViewById(getTopViewId());
if (getTopView() != null) {
View topView = getTopView();
AndroidUtils.setBackground(ctx, topView, isNightMode(), R.color.card_and_list_background_light, R.color.card_and_list_background_dark);
}