Merge pull request #9653 from osmandapp/plan_route_exit_wo_saving

Fix Plan route exit without saving
This commit is contained in:
Vitaliy 2020-08-18 12:56:08 +03:00 committed by GitHub
commit e6235305c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 60 additions and 24 deletions

View file

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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="wrap_content"
android:background="?attr/selectableItemBackground"
android:minHeight="@dimen/bottom_sheet_selected_item_title_height"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingTop="@dimen/measurement_tool_menu_title_padding_top"
android:orientation="vertical"
android:paddingEnd="@dimen/content_padding"
android:paddingStart="@dimen/content_padding">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:gravity="center_vertical"
android:maxLines="1"
android:paddingBottom="@dimen/measurement_tool_menu_title_padding_bottom"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_medium"
tools:text="Some title" />
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lineSpacingMultiplier="@dimen/bottom_sheet_text_spacing_multiplier"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_regular"
tools:text="Some description" />
</LinearLayout>

View file

@ -14,8 +14,8 @@
android:paddingLeft="@dimen/content_padding"
android:paddingEnd="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingTop="@dimen/multi_selection_menu_padding_top"
android:paddingBottom="@dimen/bottom_sheet_title_padding_bottom"
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" />

View file

@ -304,7 +304,7 @@
android:paddingLeft="@dimen/measurement_tool_button_padding"
android:paddingRight="@dimen/measurement_tool_button_padding"
android:text="@string/shared_string_apply"
android:textColor="?attr/color_dialog_buttons"
android:textColor="@color/color_white"
android:textAllCaps="false"
android:paddingEnd="@dimen/measurement_tool_button_padding"
android:paddingStart="@dimen/measurement_tool_button_padding" />

View file

@ -20,8 +20,10 @@
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/choose_navigation_title"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_title_height"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingTop="@dimen/measurement_tool_menu_title_padding_top"
android:paddingBottom="@dimen/measurement_tool_menu_title_padding_bottom"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
@ -42,7 +44,6 @@
android:textColor="?android:textColorPrimary"
android:lineSpacingMultiplier="@dimen/bottom_sheet_text_spacing_multiplier"
osmand:typeface="@string/font_roboto_regular"
android:letterSpacing="@dimen/description_letter_spacing"
android:textSize="@dimen/default_desc_text_size" />
<include layout="@layout/custom_radio_buttons" />
@ -61,7 +62,6 @@
android:textColor="?android:textColorPrimary"
android:lineSpacingMultiplier="@dimen/bottom_sheet_text_spacing_multiplier"
osmand:typeface="@string/font_roboto_regular"
android:letterSpacing="@dimen/description_letter_spacing"
android:textSize="@dimen/default_desc_text_size" />
</LinearLayout>

View file

@ -248,6 +248,8 @@
<dimen name="content_padding_small">12dp</dimen>
<dimen name="content_padding_half">8dp</dimen>
<dimen name="bottom_sheet_content_padding_small">8dp</dimen>
<dimen name="measurement_tool_menu_title_padding_top">13dp</dimen>
<dimen name="measurement_tool_menu_title_padding_bottom">5dp</dimen>
<dimen name="measurement_tool_divider_margin">8dp</dimen>
<dimen name="measurement_tool_content_padding_medium">12dp</dimen>
<dimen name="text_margin_small">4dp</dimen>

View file

@ -14,7 +14,6 @@ import net.osmand.plus.base.MenuBottomSheetDialogFragment;
import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemButton;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerSpaceItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.ShortDescriptionItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
public class ExitBottomSheetDialogFragment extends MenuBottomSheetDialogFragment {
@ -27,12 +26,10 @@ public class ExitBottomSheetDialogFragment extends MenuBottomSheetDialogFragment
@Override
public void createMenuItems(Bundle savedInstanceState) {
items.add(new TitleItem(getString(R.string.exit_without_saving)));
items.add(new ShortDescriptionItem.Builder()
.setDescription(getString(R.string.plan_route_exit_dialog_descr))
.setDescriptionColorId(nightMode ? R.color.text_color_primary_dark : R.color.text_color_primary_light)
.setLayoutId(R.layout.bottom_sheet_item_description_long)
.setTitle(getString(R.string.exit_without_saving))
.setLayoutId(R.layout.bottom_sheet_item_list_title_with_descr)
.create());
items.add(new DividerSpaceItem(getContext(),
@ -75,7 +72,7 @@ public class ExitBottomSheetDialogFragment extends MenuBottomSheetDialogFragment
@Override
protected int getDismissButtonTextId() {
return R.string.shared_string_close;
return R.string.shared_string_cancel;
}
public static void showInstance(@NonNull FragmentManager fragmentManager, @Nullable Fragment targetFragment) {

View file

@ -37,6 +37,7 @@ import java.util.List;
import static net.osmand.plus.UiUtilities.CustomRadioButtonType.*;
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;
public class RouteBetweenPointsBottomSheetDialogFragment extends BottomSheetDialogFragment {
@ -70,7 +71,8 @@ public class RouteBetweenPointsBottomSheetDialogFragment extends BottomSheetDial
nightMode = app.getDaynightHelper().isNightModeForMapControls();
FragmentActivity activity = requireActivity();
portrait = AndroidUiHelper.isOrientationPortrait(activity);
final View mainView = inflater.inflate(R.layout.fragment_route_between_points_bottom_sheet_dialog,
final View mainView = UiUtilities.getInflater(getContext(), nightMode)
.inflate(R.layout.fragment_route_between_points_bottom_sheet_dialog,
container, false);
AndroidUtils.setBackground(activity, mainView, nightMode,
portrait ? R.drawable.bg_bottom_menu_light : R.drawable.bg_bottom_sheet_topsides_landscape_light,
@ -101,7 +103,7 @@ public class RouteBetweenPointsBottomSheetDialogFragment extends BottomSheetDial
@Override
public void onClick(View view) {
snapToRoadEnabled = false;
ApplicationMode mode = null;
ApplicationMode mode = DEFAULT_APP_MODE;
if ((int) view.getTag() != STRAIGHT_LINE_TAG) {
mode = modes.get((int) view.getTag());
snapToRoadEnabled = true;
@ -116,7 +118,7 @@ public class RouteBetweenPointsBottomSheetDialogFragment extends BottomSheetDial
Drawable icon = app.getUIUtilities().getIcon(R.drawable.ic_action_split_interval, nightMode);
addProfileView(navigationType, onClickListener, STRAIGHT_LINE_TAG, icon,
app.getText(R.string.routing_profile_straightline), snapToRoadAppMode == null);
app.getText(R.string.routing_profile_straightline), snapToRoadAppMode == DEFAULT_APP_MODE);
addDelimiterView(navigationType);
for (int i = 0; i < modes.size(); i++) {

View file

@ -8,14 +8,12 @@ import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import net.osmand.PlatformUtil;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithDescription;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerSpaceItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
import net.osmand.plus.helpers.GpxTrackAdapter;
import org.apache.commons.logging.Log;
@ -38,15 +36,13 @@ public class SnapTrackWarningBottomSheet extends MenuBottomSheetDialogFragment {
if (activity instanceof MapActivity) {
activity.findViewById(R.id.snap_to_road_image_button).setVisibility(View.GONE);
}
OsmandApplication app = requiredMyApplication();
items.add(new TitleItem(getString(R.string.route_between_points)));
BaseBottomSheetItem description = new BottomSheetItemWithDescription.Builder()
.setDescription(app.getString(R.string.rourte_between_points_warning_desc))
.setDescriptionColorId(R.color.text_color_primary_light)
.setLayoutId(R.layout.bottom_sheet_item_description_long)
.setDescription(getString(R.string.rourte_between_points_warning_desc))
.setTitle(getString(R.string.route_between_points))
.setLayoutId(R.layout.bottom_sheet_item_list_title_with_descr)
.create();
items.add(description);
items.add(new DividerSpaceItem(app, app.getResources().getDimensionPixelSize(R.dimen.content_padding_half)));
items.add(new DividerSpaceItem(getContext(), getResources().getDimensionPixelSize(R.dimen.content_padding_half)));
}
@Override