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,60 +1,66 @@
<?xml version="1.0" encoding="utf-8"?> <?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" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"> android:orientation="vertical">
<net.osmand.plus.widgets.TextViewEx <LinearLayout
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
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"
osmand:typeface="@string/font_roboto_medium" />
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingEnd="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingBottom="@dimen/content_padding"
android:text="@string/plan_route_select_track_file_for_open"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_regular" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/folder_list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="@dimen/content_padding" android:orientation="vertical">
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding"
android:paddingEnd="@dimen/content_padding"
android:clipToPadding="false"
android:orientation="horizontal"
tools:itemCount="3"
tools:orientation="horizontal"
tools:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/point_editor_icon_category_item" />
<androidx.recyclerview.widget.RecyclerView <net.osmand.plus.widgets.TextViewEx
android:id="@+id/gpx_track_list" android:id="@+id/title"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
tools:itemCount="1" android:paddingStart="@dimen/content_padding"
tools:listitem="@layout/gpx_track_select_item"> 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:paddingBottom="@dimen/measurement_tool_menu_title_padding_bottom"
android:text="@string/plan_route_open_existing_track"
android:textAppearance="@style/TextAppearance.ListItemTitle"
osmand:typeface="@string/font_roboto_medium" />
</androidx.recyclerview.widget.RecyclerView> <net.osmand.plus.widgets.TextViewEx
</LinearLayout> android:id="@+id/description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingEnd="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingBottom="@dimen/content_padding"
android:text="@string/plan_route_select_track_file_for_open"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_regular" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/folder_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
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:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
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" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>

View file

@ -1,41 +1,47 @@
<?xml version="1.0" encoding="utf-8"?> <?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" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:orientation="vertical">
android:paddingStart="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
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 <LinearLayout
android:id="@+id/last_edited" android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/plan_route_last_edited" android:orientation="horizontal"
android:letterSpacing="@dimen/description_letter_spacing" android:paddingStart="@dimen/content_padding"
android:textColor="?attr/active_color_basic" android:paddingLeft="@dimen/content_padding"
android:textSize="@dimen/default_desc_text_size" android:paddingTop="@dimen/bottom_sheet_title_padding_top"
osmand:typeface="@string/font_roboto_medium" /> android:paddingEnd="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
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: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" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/gpx_track_list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
tools:itemCount="1"
tools:listitem="@layout/gpx_track_select_item" />
</LinearLayout> </LinearLayout>
<androidx.recyclerview.widget.RecyclerView </androidx.core.widget.NestedScrollView>
android:id="@+id/gpx_track_list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
tools:itemCount="1"
tools:listitem="@layout/gpx_track_select_item">
</androidx.recyclerview.widget.RecyclerView>
</LinearLayout>

View file

@ -11,7 +11,25 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<include layout="@layout/context_menu_top_shadow" /> <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 <FrameLayout
android:id="@+id/bottom_container" android:id="@+id/bottom_container"
@ -36,8 +54,6 @@
</net.osmand.plus.LockableScrollView> </net.osmand.plus.LockableScrollView>
<include layout="@layout/plan_route_progress_bar"/>
</FrameLayout> </FrameLayout>
</LinearLayout> </LinearLayout>

View file

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

View file

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

View file

@ -15,6 +15,7 @@ import net.osmand.plus.routepreparationmenu.cards.BaseCard;
import net.osmand.plus.settings.backend.ApplicationMode; import net.osmand.plus.settings.backend.ApplicationMode;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator;
import java.util.List; import java.util.List;
public class ProfileCard extends BaseCard { public class ProfileCard extends BaseCard {
@ -34,9 +35,15 @@ public class ProfileCard extends BaseCard {
@Override @Override
protected void updateContent() { protected void updateContent() {
final List<ApplicationMode> modes = new ArrayList<>(ApplicationMode.values(app)); final List<ApplicationMode> modes = new ArrayList<>(ApplicationMode.values(app));
modes.remove(ApplicationMode.DEFAULT); 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++) { for (int i = 0; i < modes.size(); i++) {
ApplicationMode mode = modes.get(i); ApplicationMode mode = modes.get(i);
LinearLayout container = view.findViewById(R.id.content_container); 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.ArrayList;
import java.util.List; 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.NEXT_SEGMENT;
import static net.osmand.plus.measurementtool.MeasurementEditingContext.CalculationMode.WHOLE_TRACK; import static net.osmand.plus.measurementtool.MeasurementEditingContext.CalculationMode.WHOLE_TRACK;
import static net.osmand.plus.measurementtool.MeasurementEditingContext.DEFAULT_APP_MODE; import static net.osmand.plus.measurementtool.MeasurementEditingContext.DEFAULT_APP_MODE;
@ -120,8 +121,10 @@ public class RouteBetweenPointsBottomSheetDialogFragment extends BottomSheetDial
for (int i = 0; i < modes.size(); i++) { for (int i = 0; i < modes.size(); i++) {
ApplicationMode mode = modes.get(i); ApplicationMode mode = modes.get(i);
icon = app.getUIUtilities().getIcon(mode.getIconRes(), mode.getIconColorInfo().getColor(nightMode)); if (!"public_transport".equals(mode.getRoutingProfile())) {
addProfileView(navigationType, onClickListener, i, icon, mode.toHumanString(), mode.equals(appMode)); 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() { segmentBtn.setOnClickListener(new View.OnClickListener() {

View file

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