Replace sort by menu with options menu
This commit is contained in:
parent
34d2e65c99
commit
a048d1d9fd
6 changed files with 303 additions and 135 deletions
|
@ -0,0 +1,226 @@
|
|||
<?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/bg_color"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/sort_by_scroll_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/bottom_sheet_content_padding_small">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_title_height"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingEnd="@dimen/bottom_sheet_content_padding"
|
||||
android:paddingLeft="@dimen/bottom_sheet_content_padding"
|
||||
android:paddingRight="@dimen/bottom_sheet_content_padding"
|
||||
android:paddingStart="@dimen/bottom_sheet_content_padding"
|
||||
android:text="@string/shared_string_options"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"
|
||||
osmand:typeface="@string/font_roboto_medium"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/navigate_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_list_item_height"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="@dimen/bottom_sheet_list_item_height"
|
||||
android:paddingEnd="@dimen/bottom_sheet_content_padding"
|
||||
android:paddingLeft="@dimen/bottom_sheet_content_padding"
|
||||
android:paddingRight="@dimen/bottom_sheet_content_padding"
|
||||
android:paddingStart="@dimen/bottom_sheet_content_padding">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/navigate_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
|
||||
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
|
||||
tools:src="@drawable/map_directions"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:text="@string/shared_string_navigate"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/make_round_trip_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:minHeight="@dimen/bottom_sheet_list_item_height"
|
||||
android:paddingEnd="@dimen/bottom_sheet_content_padding"
|
||||
android:paddingLeft="@dimen/bottom_sheet_content_padding"
|
||||
android:paddingRight="@dimen/bottom_sheet_content_padding"
|
||||
android:paddingStart="@dimen/bottom_sheet_content_padding">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/make_round_trip_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
|
||||
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
|
||||
tools:src="@drawable/ic_action_trip_round"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:text="@string/make_round_trip"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="2"
|
||||
android:text="@string/make_round_trip_descr"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size"/>
|
||||
</LinearLayout>
|
||||
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
android:id="@+id/make_round_trip_switch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="@dimen/bottom_sheet_content_margin"
|
||||
android:layout_marginStart="@dimen/bottom_sheet_content_margin"
|
||||
android:background="@null"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
android:focusableInTouchMode="false"/>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginTop="@dimen/bottom_sheet_content_padding_small"
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_title_height"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingEnd="@dimen/bottom_sheet_content_padding"
|
||||
android:paddingLeft="@dimen/bottom_sheet_content_padding"
|
||||
android:paddingRight="@dimen/bottom_sheet_content_padding"
|
||||
android:paddingStart="@dimen/bottom_sheet_content_padding"
|
||||
android:text="@string/sort_by"
|
||||
android:textAllCaps="true"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/door_to_door_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_list_item_height"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="@dimen/bottom_sheet_list_item_height"
|
||||
android:paddingEnd="@dimen/bottom_sheet_content_padding"
|
||||
android:paddingLeft="@dimen/bottom_sheet_content_padding"
|
||||
android:paddingRight="@dimen/bottom_sheet_content_padding"
|
||||
android:paddingStart="@dimen/bottom_sheet_content_padding">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/door_to_door_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
|
||||
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
|
||||
tools:src="@drawable/ic_action_sort_door_to_door"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:text="@string/intermediate_items_sort_by_distance"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/reverse_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_list_item_height"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="@dimen/bottom_sheet_list_item_height"
|
||||
android:paddingEnd="@dimen/bottom_sheet_content_padding"
|
||||
android:paddingLeft="@dimen/bottom_sheet_content_padding"
|
||||
android:paddingRight="@dimen/bottom_sheet_content_padding"
|
||||
android:paddingStart="@dimen/bottom_sheet_content_padding">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/reverse_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
|
||||
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
|
||||
tools:src="@drawable/ic_action_sort_reverse_order"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:text="@string/shared_string_reverse_order"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/cancel_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_cancel_button_height"
|
||||
android:background="?attr/selectableItemBackground">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/shared_string_cancel"
|
||||
android:textAllCaps="true"
|
||||
android:textColor="?attr/color_dialog_buttons"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
android:textStyle="bold"/>
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -1,117 +0,0 @@
|
|||
<?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/bg_color"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/sort_by_scroll_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/bottom_sheet_content_padding_small">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_title_height"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingEnd="@dimen/bottom_sheet_content_padding"
|
||||
android:paddingLeft="@dimen/bottom_sheet_content_padding"
|
||||
android:paddingRight="@dimen/bottom_sheet_content_padding"
|
||||
android:paddingStart="@dimen/bottom_sheet_content_padding"
|
||||
android:text="@string/sort_by"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"
|
||||
osmand:typeface="@string/font_roboto_medium"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/door_to_door_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_list_item_height"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="@dimen/bottom_sheet_list_item_height"
|
||||
android:paddingEnd="@dimen/bottom_sheet_content_padding"
|
||||
android:paddingLeft="@dimen/bottom_sheet_content_padding"
|
||||
android:paddingRight="@dimen/bottom_sheet_content_padding"
|
||||
android:paddingStart="@dimen/bottom_sheet_content_padding">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/door_to_door_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
|
||||
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
|
||||
tools:src="@drawable/ic_action_sort_door_to_door"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:text="@string/intermediate_items_sort_by_distance"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/reverse_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_list_item_height"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="@dimen/bottom_sheet_list_item_height"
|
||||
android:paddingEnd="@dimen/bottom_sheet_content_padding"
|
||||
android:paddingLeft="@dimen/bottom_sheet_content_padding"
|
||||
android:paddingRight="@dimen/bottom_sheet_content_padding"
|
||||
android:paddingStart="@dimen/bottom_sheet_content_padding">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/reverse_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
|
||||
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
|
||||
tools:src="@drawable/ic_action_sort_reverse_order"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:text="@string/shared_string_reverse_order"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/cancel_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_cancel_button_height"
|
||||
android:background="?attr/selectableItemBackground">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/shared_string_cancel"
|
||||
android:textAllCaps="true"
|
||||
android:textColor="?attr/color_dialog_buttons"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
android:textStyle="bold"/>
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -9,6 +9,9 @@
|
|||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||
-->
|
||||
<string name="make_round_trip_descr">Add copy of start point as destination.</string>
|
||||
<string name="make_round_trip">Make round trip</string>
|
||||
<string name="shared_string_navigate">Navigate</string>
|
||||
<string name="shared_string_markers">Markers</string>
|
||||
<string name="coordinates_format">Coordinates format</string>
|
||||
<string name="use_system_keyboard">Use system keyboard</string>
|
||||
|
|
|
@ -42,7 +42,7 @@ import net.osmand.plus.OsmandSettings;
|
|||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
import net.osmand.plus.mapmarkers.PlanRouteSortByBottomSheetDialogFragment.PlanRouteSortByFragmentListener;
|
||||
import net.osmand.plus.mapmarkers.PlanRouteOptionsBottomSheetDialogFragment.PlanRouteOptionsFragmentListener;
|
||||
import net.osmand.plus.mapmarkers.adapters.MapMarkersItemTouchHelperCallback;
|
||||
import net.osmand.plus.mapmarkers.adapters.MapMarkersListAdapter;
|
||||
import net.osmand.plus.measurementtool.RecyclerViewFragment;
|
||||
|
@ -114,9 +114,9 @@ public class PlanRouteFragment extends Fragment {
|
|||
if (snapToRoadFragment != null) {
|
||||
((SnapToRoadBottomSheetDialogFragment) snapToRoadFragment).setListener(createSnapToRoadFragmentListener());
|
||||
}
|
||||
Fragment sortByFragment = fragmentManager.findFragmentByTag(PlanRouteSortByBottomSheetDialogFragment.TAG);
|
||||
Fragment sortByFragment = fragmentManager.findFragmentByTag(PlanRouteOptionsBottomSheetDialogFragment.TAG);
|
||||
if (sortByFragment != null) {
|
||||
((PlanRouteSortByBottomSheetDialogFragment) sortByFragment).setListener(createSortByFragmentListener());
|
||||
((PlanRouteOptionsBottomSheetDialogFragment) sortByFragment).setListener(createOptionsFragmentListener());
|
||||
}
|
||||
// If rotate the screen from landscape to portrait when the list of markers is displayed then
|
||||
// the RecyclerViewFragment will exist without view. This is necessary to remove it.
|
||||
|
@ -188,9 +188,7 @@ public class PlanRouteFragment extends Fragment {
|
|||
mainView.findViewById(R.id.sort_button).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
PlanRouteSortByBottomSheetDialogFragment fragment = new PlanRouteSortByBottomSheetDialogFragment();
|
||||
fragment.setListener(createSortByFragmentListener());
|
||||
fragment.show(mapActivity.getSupportFragmentManager(), PlanRouteSortByBottomSheetDialogFragment.TAG);
|
||||
Toast.makeText(mapActivity, "Sort", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -212,6 +210,15 @@ public class PlanRouteFragment extends Fragment {
|
|||
}
|
||||
}
|
||||
});
|
||||
toolbarController.setSaveViewTextId(R.string.shared_string_options);
|
||||
toolbarController.setOnSaveViewClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
PlanRouteOptionsBottomSheetDialogFragment fragment = new PlanRouteOptionsBottomSheetDialogFragment();
|
||||
fragment.setListener(createOptionsFragmentListener());
|
||||
fragment.show(mapActivity.getSupportFragmentManager(), PlanRouteOptionsBottomSheetDialogFragment.TAG);
|
||||
}
|
||||
});
|
||||
mapActivity.showTopToolbar(toolbarController);
|
||||
|
||||
if (portrait) {
|
||||
|
@ -371,11 +378,25 @@ public class PlanRouteFragment extends Fragment {
|
|||
};
|
||||
}
|
||||
|
||||
private PlanRouteSortByFragmentListener createSortByFragmentListener() {
|
||||
return new PlanRouteSortByFragmentListener() {
|
||||
private PlanRouteOptionsFragmentListener createOptionsFragmentListener() {
|
||||
return new PlanRouteOptionsFragmentListener() {
|
||||
|
||||
private MapActivity mapActivity = getMapActivity();
|
||||
|
||||
@Override
|
||||
public void navigateOnClick() {
|
||||
if (mapActivity != null) {
|
||||
Toast.makeText(mapActivity, "navigate", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void makeRoundTripOnClick() {
|
||||
if (mapActivity != null) {
|
||||
Toast.makeText(mapActivity, "mare round trip", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doorToDoorOnClick() {
|
||||
if (mapActivity != null) {
|
||||
|
@ -955,6 +976,7 @@ public class PlanRouteFragment extends Fragment {
|
|||
setBgIds(R.drawable.gradient_toolbar, R.drawable.gradient_toolbar,
|
||||
R.drawable.gradient_toolbar, R.drawable.gradient_toolbar);
|
||||
setCloseBtnVisible(false);
|
||||
setSaveViewVisible(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -21,15 +21,15 @@ import net.osmand.plus.R;
|
|||
import net.osmand.plus.base.BottomSheetDialogFragment;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
|
||||
public class PlanRouteSortByBottomSheetDialogFragment extends BottomSheetDialogFragment {
|
||||
public class PlanRouteOptionsBottomSheetDialogFragment extends BottomSheetDialogFragment {
|
||||
|
||||
public final static String TAG = "PlanRouteSortByBottomSheetDialogFragment";
|
||||
public final static String TAG = "PlanRouteOptionsBottomSheetDialogFragment";
|
||||
|
||||
private boolean portrait;
|
||||
private boolean night;
|
||||
private PlanRouteSortByFragmentListener listener;
|
||||
private PlanRouteOptionsFragmentListener listener;
|
||||
|
||||
public void setListener(PlanRouteSortByFragmentListener listener) {
|
||||
public void setListener(PlanRouteOptionsFragmentListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ public class PlanRouteSortByBottomSheetDialogFragment extends BottomSheetDialogF
|
|||
night = getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
||||
final int themeRes = night ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
|
||||
|
||||
final View mainView = View.inflate(new ContextThemeWrapper(getContext(), themeRes), R.layout.fragment_plan_route_sort_by_bottom_sheet_dialog, container);
|
||||
final View mainView = View.inflate(new ContextThemeWrapper(getContext(), themeRes), R.layout.fragment_plan_route_options_bottom_sheet_dialog, container);
|
||||
if (portrait) {
|
||||
AndroidUtils.setBackground(getActivity(), mainView, night, R.drawable.bg_bottom_menu_light, R.drawable.bg_bottom_menu_dark);
|
||||
}
|
||||
|
@ -49,9 +49,29 @@ public class PlanRouteSortByBottomSheetDialogFragment extends BottomSheetDialogF
|
|||
((TextView) mainView.findViewById(R.id.title)).setTextColor(ContextCompat.getColor(getActivity(), R.color.ctx_menu_info_text_dark));
|
||||
}
|
||||
|
||||
((ImageView) mainView.findViewById(R.id.navigate_icon)).setImageDrawable(getContentIcon(R.drawable.map_directions));
|
||||
((ImageView) mainView.findViewById(R.id.make_round_trip_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_trip_round));
|
||||
((ImageView) mainView.findViewById(R.id.door_to_door_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_sort_door_to_door));
|
||||
((ImageView) mainView.findViewById(R.id.reverse_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_sort_reverse_order));
|
||||
|
||||
mainView.findViewById(R.id.navigate_row).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (listener != null) {
|
||||
listener.navigateOnClick();
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
});
|
||||
mainView.findViewById(R.id.make_round_trip_row).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (listener != null) {
|
||||
listener.makeRoundTripOnClick();
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
});
|
||||
mainView.findViewById(R.id.door_to_door_row).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
@ -133,7 +153,11 @@ public class PlanRouteSortByBottomSheetDialogFragment extends BottomSheetDialogF
|
|||
return getIcon(id, night ? R.color.ctx_menu_info_text_dark : R.color.on_map_icon_color);
|
||||
}
|
||||
|
||||
interface PlanRouteSortByFragmentListener {
|
||||
interface PlanRouteOptionsFragmentListener {
|
||||
|
||||
void navigateOnClick();
|
||||
|
||||
void makeRoundTripOnClick();
|
||||
|
||||
void doorToDoorOnClick();
|
||||
|
|
@ -249,6 +249,8 @@ public class MapInfoWidgetsFactory {
|
|||
String title = "";
|
||||
String description = null;
|
||||
|
||||
int saveViewTextId = -1;
|
||||
|
||||
OnClickListener onBackButtonClickListener;
|
||||
OnClickListener onTitleClickListener;
|
||||
OnClickListener onCloseButtonClickListener;
|
||||
|
@ -337,6 +339,10 @@ public class MapInfoWidgetsFactory {
|
|||
this.saveViewVisible = visible;
|
||||
}
|
||||
|
||||
public void setSaveViewTextId(int id) {
|
||||
this.saveViewTextId = id;
|
||||
}
|
||||
|
||||
public void setTopBarSwitchVisible(boolean visible) {
|
||||
this.topBarSwitchVisible = visible;
|
||||
}
|
||||
|
@ -649,6 +655,10 @@ public class MapInfoWidgetsFactory {
|
|||
refreshButton.setVisibility(View.GONE);
|
||||
}
|
||||
if (controller.saveViewVisible) {
|
||||
if (controller.saveViewTextId != -1) {
|
||||
saveView.setText(map.getString(controller.saveViewTextId));
|
||||
saveView.setContentDescription(map.getString(controller.saveViewTextId));
|
||||
}
|
||||
if (saveView.getVisibility() == View.GONE) {
|
||||
saveView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
@ -749,7 +759,7 @@ public class MapInfoWidgetsFactory {
|
|||
if (text == null) {
|
||||
text = "";
|
||||
} else {
|
||||
if(type[0] == null){
|
||||
if (type[0] == null) {
|
||||
showMarker = true;
|
||||
} else {
|
||||
turnDrawable.setColor(R.color.nav_arrow);
|
||||
|
@ -790,10 +800,10 @@ public class MapInfoWidgetsFactory {
|
|||
text = "";
|
||||
} else {
|
||||
Location lastKnownLocation = locationProvider.getLastKnownLocation();
|
||||
if(!Algorithms.isEmpty(text) && lastKnownLocation != null) {
|
||||
if (!Algorithms.isEmpty(text) && lastKnownLocation != null) {
|
||||
double dist =
|
||||
CurrentPositionHelper.getOrthogonalDistance(rt, lastKnownLocation);
|
||||
if(dist < 50) {
|
||||
if (dist < 50) {
|
||||
showMarker = true;
|
||||
} else {
|
||||
text = map.getResources().getString(R.string.shared_string_near) + " " + text;
|
||||
|
|
Loading…
Reference in a new issue