diff --git a/OsmAnd/res/layout-land/share_menu_fragment.xml b/OsmAnd/res/layout-land/share_menu_fragment.xml
deleted file mode 100644
index 07eb8e6db1..0000000000
--- a/OsmAnd/res/layout-land/share_menu_fragment.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/OsmAnd/res/layout/fragment_add_waypoint_bottom_sheet_dialog.xml b/OsmAnd/res/layout/fragment_add_waypoint_bottom_sheet_dialog.xml
index 6afb08ce0a..f38c3a37f2 100644
--- a/OsmAnd/res/layout/fragment_add_waypoint_bottom_sheet_dialog.xml
+++ b/OsmAnd/res/layout/fragment_add_waypoint_bottom_sheet_dialog.xml
@@ -43,13 +43,12 @@
android:paddingStart="@dimen/content_padding">
+ android:src="@drawable/list_destination"/>
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+ android:layout_height="@dimen/bottom_sheet_title_height"
+ android:ellipsize="end"
+ android:gravity="center_vertical"
+ android:maxLines="1"
+ android:paddingLeft="@dimen/content_padding"
+ android:paddingRight="@dimen/content_padding"
+ android:text="@string/share_menu_location"
+ android:textAppearance="@style/TextAppearance.ListItemTitle"
+ osmand:typeface="@string/font_roboto_medium"/>
-
-
-
-
-
-
-
-
-
-
-
+ android:divider="@null"
+ android:dividerHeight="0dp"/>
-
\ No newline at end of file
+
+
+
+
+
+
+
+
diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml
index 28cb806bd8..ad57d5f7b0 100644
--- a/OsmAnd/res/values/strings.xml
+++ b/OsmAnd/res/values/strings.xml
@@ -9,6 +9,7 @@
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
-->
+ Make as Start Point
Current
Adds the last stop along the route
Adds the first stop on the route
diff --git a/OsmAnd/src/net/osmand/plus/dialogs/AddWaypointBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/dialogs/AddWaypointBottomSheetDialogFragment.java
index 777c454622..67f1c11105 100644
--- a/OsmAnd/src/net/osmand/plus/dialogs/AddWaypointBottomSheetDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/dialogs/AddWaypointBottomSheetDialogFragment.java
@@ -20,6 +20,7 @@ import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.plus.R;
import net.osmand.plus.TargetPointsHelper;
+import net.osmand.plus.TargetPointsHelper.TargetPoint;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
@@ -43,10 +44,10 @@ public class AddWaypointBottomSheetDialogFragment extends MenuBottomSheetDialogF
R.layout.fragment_add_waypoint_bottom_sheet_dialog, container);
((TextView) mainView.findViewById(R.id.current_dest_text_view))
- .setText(getCurrentDestinationName(targetPointsHelper.getPointToNavigate()));
+ .setText(getCurrentPointName(targetPointsHelper.getPointToNavigate(), false));
+ ((TextView) mainView.findViewById(R.id.current_start_text_view))
+ .setText(getCurrentPointName(targetPointsHelper.getPointToStart(), true));
- ((ImageView) mainView.findViewById(R.id.current_dest_icon))
- .setImageDrawable(getBackgroundIcon(R.drawable.ic_action_point_destination));
((ImageView) mainView.findViewById(R.id.subsequent_dest_icon)).setImageDrawable(getSubsequentDestIcon());
((ImageView) mainView.findViewById(R.id.first_interm_dest_icon)).setImageDrawable(getFirstIntermDestIcon());
((ImageView) mainView.findViewById(R.id.last_interm_dest_icon)).setImageDrawable(getLastIntermDistIcon());
@@ -57,6 +58,13 @@ public class AddWaypointBottomSheetDialogFragment extends MenuBottomSheetDialogF
int id = v.getId();
if (id == R.id.replace_dest_row) {
targetPointsHelper.navigateToPoint(latLon, true, -1, name);
+ } else if (id == R.id.replace_start_row) {
+ TargetPoint start = targetPointsHelper.getPointToStart();
+ if (start != null) {
+ targetPointsHelper.navigateToPoint(new LatLon(start.getLatitude(), start.getLongitude()),
+ false, 0, start.getOriginalPointDescription());
+ }
+ targetPointsHelper.setStartPoint(latLon, true, name);
} else if (id == R.id.subsequent_dest_row) {
targetPointsHelper.navigateToPoint(latLon, true,
targetPointsHelper.getIntermediatePoints().size() + 1, name);
@@ -70,6 +78,7 @@ public class AddWaypointBottomSheetDialogFragment extends MenuBottomSheetDialogF
};
mainView.findViewById(R.id.replace_dest_row).setOnClickListener(onClickListener);
+ mainView.findViewById(R.id.replace_start_row).setOnClickListener(onClickListener);
mainView.findViewById(R.id.subsequent_dest_row).setOnClickListener(onClickListener);
mainView.findViewById(R.id.first_intermediate_dest_row).setOnClickListener(onClickListener);
mainView.findViewById(R.id.last_intermediate_dest_row).setOnClickListener(onClickListener);
@@ -135,18 +144,20 @@ public class AddWaypointBottomSheetDialogFragment extends MenuBottomSheetDialogF
R.drawable.ic_action_route_last_intermediate_point);
}
- private String getCurrentDestinationName(@Nullable TargetPointsHelper.TargetPoint finish) {
+ private String getCurrentPointName(@Nullable TargetPoint point, boolean start) {
Context ctx = getContext();
StringBuilder builder = new StringBuilder(ctx.getString(R.string.shared_string_current));
builder.append(": ");
- if (finish != null) {
- if (finish.getOnlyName().length() > 0) {
- builder.append(finish.getOnlyName());
+ if (point != null) {
+ if (point.getOnlyName().length() > 0) {
+ builder.append(point.getOnlyName());
} else {
builder.append(ctx.getString(R.string.route_descr_map_location));
builder.append(" ");
- builder.append(ctx.getString(R.string.route_descr_lat_lon, finish.getLatitude(), finish.getLongitude()));
+ builder.append(ctx.getString(R.string.route_descr_lat_lon, point.getLatitude(), point.getLongitude()));
}
+ } else if (start) {
+ builder.append(ctx.getString(R.string.shared_string_my_location));
}
return builder.toString();
}
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java
index 0c29ea1973..5e141b90fe 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java
@@ -1688,7 +1688,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
}
private void doLayoutMenu() {
- final int posY = getPosY(getViewY(), false);
+ final int posY = getPosY(getViewY(), false, menu.getCurrentMenuState());
setViewY(posY, true, !initLayout || !centered);
updateMainViewLayout(posY);
}
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java
index af3f4ad44b..b576166b68 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java
@@ -131,32 +131,7 @@ public abstract class MenuController extends BaseMenuController implements Colla
this.builder.setLight(isLight());
}
- public void onCreated() {
- /*
- toolbarController = new ContextMenuToolbarController(this);
- toolbarController.setTitle(getNameStr());
- toolbarController.setOnBackButtonClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- if (mapContextMenu != null) {
- mapContextMenu.backToolbarAction(MenuController.this);
- }
- }
- });
- toolbarController.setOnTitleClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- }
- });
- toolbarController.setOnCloseButtonClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- if (mapContextMenu != null) {
- mapContextMenu.close();
- }
- }
- });
- */
+ protected void onCreated() {
}
@Override
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/ShareMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/ShareMenuFragment.java
index bc19c75e1b..650cfa12c9 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/ShareMenuFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/ShareMenuFragment.java
@@ -3,7 +3,7 @@ package net.osmand.plus.mapcontextmenu.other;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.support.annotation.Nullable;
-import android.support.v4.app.FragmentManager;
+import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -17,13 +17,14 @@ import android.widget.TextView;
import net.osmand.AndroidUtils;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
-import net.osmand.plus.base.BaseOsmAndFragment;
+import net.osmand.plus.base.MenuBottomSheetDialogFragment;
import net.osmand.plus.mapcontextmenu.other.ShareMenu.ShareItem;
+import net.osmand.plus.widgets.TextViewEx;
import java.util.List;
-public class ShareMenuFragment extends BaseOsmAndFragment implements OnItemClickListener {
+public class ShareMenuFragment extends MenuBottomSheetDialogFragment implements OnItemClickListener {
public static final String TAG = "ShareMenuFragment";
private ArrayAdapter listAdapter;
@@ -40,56 +41,41 @@ public class ShareMenuFragment extends BaseOsmAndFragment implements OnItemClick
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
- View view = inflater.inflate(R.layout.share_menu_fragment, container, false);
+ final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
+ final View view = View.inflate(new ContextThemeWrapper(getContext(), themeRes),
+ R.layout.share_menu_fragment, container);
- View mainView = view.findViewById(R.id.main_view);
- if (menu.isLandscapeLayout()) {
- AndroidUtils.addStatusBarPadding21v(getContext(), view);
- AndroidUtils.setBackground(view.getContext(), mainView, !menu.isLight(),
- R.drawable.bg_left_menu_light, R.drawable.bg_left_menu_dark);
- } else {
- AndroidUtils.setBackground(view.getContext(), mainView, !menu.isLight(),
- R.drawable.bg_bottom_menu_light, R.drawable.bg_bottom_menu_dark);
+ if (nightMode) {
+ ((TextViewEx) view.findViewById(R.id.title_text_view)).setTextColor(getResources().getColor(R.color.ctx_menu_info_text_dark));
}
- TextView headerCaption = (TextView) view.findViewById(R.id.header_caption);
- AndroidUtils.setTextSecondaryColor(view.getContext(), headerCaption, !menu.isLight());
-
ListView listView = (ListView) view.findViewById(R.id.list);
listAdapter = createAdapter();
listView.setAdapter(listAdapter);
listView.setOnItemClickListener(this);
+ view.findViewById(R.id.cancel_row).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ dismiss();
+ }
+ });
+
+ setupHeightAndBackground(view, R.id.scroll_view);
+
return view;
}
- @Override
- public void onStart() {
- super.onStart();
- menu.getMapActivity().getContextMenu().setBaseFragmentVisibility(false);
- }
-
- @Override
- public void onStop() {
- super.onStop();
- menu.getMapActivity().getContextMenu().setBaseFragmentVisibility(true);
- }
-
@Override
public void onSaveInstanceState(Bundle outState) {
menu.saveMenu(outState);
}
public static void showInstance(ShareMenu menu) {
- int slideInAnim = menu.getSlideInAnimation();
- int slideOutAnim = menu.getSlideOutAnimation();
-
ShareMenuFragment fragment = new ShareMenuFragment();
fragment.menu = menu;
- menu.getMapActivity().getSupportFragmentManager().beginTransaction()
- .setCustomAnimations(slideInAnim, slideOutAnim, slideInAnim, slideOutAnim)
- .add(R.id.fragmentContainer, fragment, TAG)
- .addToBackStack(TAG).commit();
+ fragment.setUsedOnMap(true);
+ fragment.show(menu.getMapActivity().getSupportFragmentManager(), ShareMenuFragment.TAG);
}
private ArrayAdapter createAdapter() {
@@ -103,13 +89,13 @@ public class ShareMenuFragment extends BaseOsmAndFragment implements OnItemClick
if (v == null) {
v = menu.getMapActivity().getLayoutInflater().inflate(R.layout.share_list_item, null);
}
- AndroidUtils.setBackground(v.getContext(), v, !menu.isLight(), R.drawable.expandable_list_item_background_light, R.drawable.expandable_list_item_background_dark);
+ AndroidUtils.setBackground(v.getContext(), v, nightMode, R.drawable.expandable_list_item_background_light, R.drawable.expandable_list_item_background_dark);
final ShareItem item = getItem(position);
ImageView icon = (ImageView) v.findViewById(R.id.icon);
icon.setImageDrawable(menu.getMapActivity().getMyApplication()
- .getIconsCache().getIcon(item.getIconResourceId(), menu.isLight()));
+ .getIconsCache().getIcon(item.getIconResourceId(), !nightMode));
TextView name = (TextView) v.findViewById(R.id.name);
- AndroidUtils.setTextPrimaryColor(v.getContext(), name, !menu.isLight());
+ AndroidUtils.setTextPrimaryColor(v.getContext(), name, nightMode);
name.setText(getContext().getText(item.getTitleResourceId()));
return v;
}
@@ -118,15 +104,12 @@ public class ShareMenuFragment extends BaseOsmAndFragment implements OnItemClick
@Override
public void onItemClick(AdapterView> parent, View view, int position, long id) {
+ dismiss();
menu.share(listAdapter.getItem(position));
- disableTransitionAnimation();
- dismissMenu();
}
public void dismissMenu() {
- menu.getMapActivity().getSupportFragmentManager().popBackStackImmediate(TAG, FragmentManager.POP_BACK_STACK_INCLUSIVE);
- if (menu.getMapActivity().getContextMenu().isVisible()) {
- menu.getMapActivity().getContextMenu().close();
- }
+ dismiss();
+ menu.getMapActivity().getContextMenu().close();
}
}