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/share_menu_fragment.xml b/OsmAnd/res/layout/share_menu_fragment.xml
index 797b078199..c4bcd564c6 100644
--- a/OsmAnd/res/layout/share_menu_fragment.xml
+++ b/OsmAnd/res/layout/share_menu_fragment.xml
@@ -1,53 +1,61 @@
-
+
-
+ 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/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();
}
}