Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
fddaf229e2
7 changed files with 60 additions and 66 deletions
|
@ -62,8 +62,7 @@
|
|||
android:layout_marginRight="12dp"
|
||||
android:text="@string/search_address_building"
|
||||
android:textSize="@dimen/default_list_text_size_large"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textStyle="bold"/>
|
||||
android:textColor="?android:textColorPrimary"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/context_menu_line2"
|
||||
|
|
|
@ -437,14 +437,14 @@
|
|||
<string name="poi_chalet">Шале</string>
|
||||
|
||||
<string name="poi_place_of_worship">Место поклонения</string>
|
||||
<string name="poi_religion_christian">Храм, церковь (часовня)</string>
|
||||
<string name="poi_religion_jewish">Синагога</string>
|
||||
<string name="poi_religion_muslim">Мечеть</string>
|
||||
<string name="poi_religion_sikh">Место поклонения: сикхизм</string>
|
||||
<string name="poi_religion_buddhist">Место поклонения: буддизм</string>
|
||||
<string name="poi_religion_hindu">Место поклонения: индуизм</string>
|
||||
<string name="poi_religion_shinto">Место поклонения: синтоизм</string>
|
||||
<string name="poi_religion_taoist">Место поклонения: даосизм</string>
|
||||
<string name="poi_religion_christian">Христианство</string>
|
||||
<string name="poi_religion_jewish">Иудаизм</string>
|
||||
<string name="poi_religion_muslim">Мусульманство</string>
|
||||
<string name="poi_religion_sikh">Сикхизм</string>
|
||||
<string name="poi_religion_buddhist">Буддизм</string>
|
||||
<string name="poi_religion_hindu">Индуизм</string>
|
||||
<string name="poi_religion_shinto">Синтоизм</string>
|
||||
<string name="poi_religion_taoist">Даосизм</string>
|
||||
<string name="poi_monastery">Монастырь</string>
|
||||
<string name="poi_historic_monastery">Исторический монастырь</string>
|
||||
<string name="poi_wayside_cross">Придорожный крест</string>
|
||||
|
|
|
@ -627,24 +627,24 @@
|
|||
<string name="poi_hunting_lodge">Hunting lodge</string>
|
||||
|
||||
<string name="poi_place_of_worship">Place of worship</string>
|
||||
<string name="poi_religion_christian">Place of worship: christian</string>
|
||||
<string name="poi_religion_jewish">Place of worship: jewish</string>
|
||||
<string name="poi_religion_muslim">Place of worship: muslim</string>
|
||||
<string name="poi_religion_sikh">Place of worship: sikh</string>
|
||||
<string name="poi_religion_buddhist">Place of worship: buddhist</string>
|
||||
<string name="poi_religion_hindu">Place of worship: hindu</string>
|
||||
<string name="poi_religion_shinto">Place of worship: shinto</string>
|
||||
<string name="poi_religion_taoist">Place of worship: taoist</string>
|
||||
<string name="poi_religion_christian">Сhristianity</string>
|
||||
<string name="poi_religion_jewish">Judaism</string>
|
||||
<string name="poi_religion_muslim">Islam</string>
|
||||
<string name="poi_religion_sikh">Sikhism</string>
|
||||
<string name="poi_religion_buddhist">Buddhism</string>
|
||||
<string name="poi_religion_hindu">Hinduism</string>
|
||||
<string name="poi_religion_shinto">Shinto</string>
|
||||
<string name="poi_religion_taoist">Taoism</string>
|
||||
<string name="poi_religion_voodoo">Voodoo</string>
|
||||
<string name="poi_religion_unitarian_universalist">Unitarian universalist</string>
|
||||
<string name="poi_religion_unitarian_universalist">Unitarian universalism</string>
|
||||
<string name="poi_religion_multifaith">Multifaith</string>
|
||||
<string name="poi_religion_jain">Jain</string>
|
||||
<string name="poi_religion_spiritualist">Spiritualist</string>
|
||||
<string name="poi_religion_bahai">Bahai</string>
|
||||
<string name="poi_religion_scientologist">Scientologist</string>
|
||||
<string name="poi_religion_pagan">Pagan</string>
|
||||
<string name="poi_religion_jain">Jainism</string>
|
||||
<string name="poi_religion_spiritualist">Spiritualism</string>
|
||||
<string name="poi_religion_bahai">Bahaism</string>
|
||||
<string name="poi_religion_scientologist">Scientologism</string>
|
||||
<string name="poi_religion_pagan">Paganism</string>
|
||||
<string name="poi_religion_tenrikyo">Tenrikyo</string>
|
||||
<string name="poi_religion_zoroastrian">Zoroastrian</string>
|
||||
<string name="poi_religion_zoroastrian">Zoroastrism</string>
|
||||
|
||||
<string name="poi_denomination_catholic">Catholic</string>
|
||||
<string name="poi_denomination_baptist">Baptist</string>
|
||||
|
|
|
@ -125,6 +125,7 @@ public class MapActivity extends AccessibleActivity {
|
|||
private boolean intentLocation = false;
|
||||
|
||||
private DashboardOnMap dashboardOnMap = new DashboardOnMap(this);
|
||||
private MapContextMenu contextMenuOnMap;
|
||||
private AppInitializeListener initListener;
|
||||
private IMapDownloaderCallback downloaderCallback;
|
||||
private DrawerLayout drawerLayout;
|
||||
|
@ -156,6 +157,7 @@ public class MapActivity extends AccessibleActivity {
|
|||
app = getMyApplication();
|
||||
settings = app.getSettings();
|
||||
app.applyTheme(this);
|
||||
contextMenuOnMap = new MapContextMenu(app);
|
||||
supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
super.onCreate(savedInstanceState);
|
||||
// Full screen is not used here
|
||||
|
@ -249,9 +251,6 @@ public class MapActivity extends AccessibleActivity {
|
|||
});
|
||||
|
||||
drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||
|
||||
MapContextMenu.getInstance().setApp(app);
|
||||
MapContextMenu.getInstance().setMapActivity(this);
|
||||
}
|
||||
|
||||
|
||||
|
@ -975,6 +974,10 @@ public class MapActivity extends AccessibleActivity {
|
|||
return dashboardOnMap;
|
||||
}
|
||||
|
||||
public MapContextMenu getContextMenu() {
|
||||
return contextMenuOnMap;
|
||||
}
|
||||
|
||||
public void openDrawer() {
|
||||
drawerLayout.openDrawer(Gravity.LEFT);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ import net.osmand.util.Algorithms;
|
|||
|
||||
public class MapContextMenu {
|
||||
|
||||
private MapActivity mapActivity;
|
||||
private OsmandApplication app;
|
||||
private OsmandSettings settings;
|
||||
|
||||
|
@ -30,7 +29,7 @@ public class MapContextMenu {
|
|||
|
||||
private String foundStreetName;
|
||||
|
||||
public boolean isMenuVisible() {
|
||||
public boolean isMenuVisible(MapActivity mapActivity) {
|
||||
return mapActivity.getSupportFragmentManager().findFragmentByTag("MapContextMenuFragment") != null;
|
||||
}
|
||||
|
||||
|
@ -42,29 +41,15 @@ public class MapContextMenu {
|
|||
return object;
|
||||
}
|
||||
|
||||
public void setMapActivity(MapActivity mapActivity) {
|
||||
this.mapActivity = mapActivity;
|
||||
}
|
||||
|
||||
public void setApp(OsmandApplication app) {
|
||||
public MapContextMenu(OsmandApplication app) {
|
||||
this.app = app;
|
||||
settings = app.getSettings();
|
||||
}
|
||||
|
||||
private static MapContextMenu ourInstance = new MapContextMenu();
|
||||
public void show(MapActivity mapActivity, PointDescription pointDescription, Object object) {
|
||||
|
||||
public static MapContextMenu getInstance() {
|
||||
return ourInstance;
|
||||
}
|
||||
|
||||
private MapContextMenu() {
|
||||
|
||||
}
|
||||
|
||||
public void show(PointDescription pointDescription, Object object) {
|
||||
|
||||
if (isMenuVisible())
|
||||
hide();
|
||||
if (isMenuVisible(mapActivity))
|
||||
hide(mapActivity);
|
||||
|
||||
this.pointDescription = pointDescription;
|
||||
this.object = object;
|
||||
|
@ -75,7 +60,7 @@ public class MapContextMenu {
|
|||
|
||||
}
|
||||
|
||||
public void hide() {
|
||||
public void hide(MapActivity mapActivity) {
|
||||
|
||||
Fragment fragment = mapActivity.getSupportFragmentManager().findFragmentByTag("MapContextMenuFragment");
|
||||
if (fragment != null)
|
||||
|
@ -139,7 +124,7 @@ public class MapContextMenu {
|
|||
return Algorithms.isEmpty(res) ? "Address is unknown yet" : res; // todo: text constant
|
||||
}
|
||||
|
||||
public String getLocationStr() {
|
||||
public String getLocationStr(MapActivity mapActivity) {
|
||||
if (foundStreetName == null)
|
||||
return pointDescription.getLocationName(mapActivity, true).replaceAll("\n", "");
|
||||
else
|
||||
|
@ -157,11 +142,11 @@ public class MapContextMenu {
|
|||
return null;
|
||||
}
|
||||
|
||||
public void buttonNavigatePressed() {
|
||||
public void buttonNavigatePressed(MapActivity mapActivity) {
|
||||
mapActivity.getMapActions().showNavigationContextMenuPoint(pointDescription.getLat(), pointDescription.getLon());
|
||||
}
|
||||
|
||||
public void buttonFavoritePressed() {
|
||||
public void buttonFavoritePressed(MapActivity mapActivity) {
|
||||
if (object != null && object instanceof FavouritePoint) {
|
||||
mapActivity.getMapActions().editFavoritePoint((FavouritePoint)object);
|
||||
} else {
|
||||
|
@ -169,11 +154,11 @@ public class MapContextMenu {
|
|||
}
|
||||
}
|
||||
|
||||
public void buttonSharePressed() {
|
||||
public void buttonSharePressed(MapActivity mapActivity) {
|
||||
mapActivity.getMapActions().shareLocation(pointDescription.getLat(), pointDescription.getLon());
|
||||
}
|
||||
|
||||
public void buttonMorePressed() {
|
||||
public void buttonMorePressed(MapActivity mapActivity) {
|
||||
final ContextMenuAdapter menuAdapter = new ContextMenuAdapter(mapActivity);
|
||||
if (object != null) {
|
||||
for (OsmandMapLayer layer : mapActivity.getMapView().getLayers()) {
|
||||
|
|
|
@ -241,7 +241,7 @@ public class MapContextMenuFragment extends Fragment {
|
|||
IconsCache iconsCache = getMyApplication().getIconsCache();
|
||||
boolean light = getMyApplication().getSettings().isLightContent();
|
||||
|
||||
int iconId = MapContextMenu.getInstance().getLeftIconId();
|
||||
int iconId = getCtxMenu().getLeftIconId();
|
||||
|
||||
final View iconLayout = view.findViewById(R.id.context_menu_icon_layout);
|
||||
final ImageView iconView = (ImageView)view.findViewById(R.id.context_menu_icon_view);
|
||||
|
@ -254,11 +254,11 @@ public class MapContextMenuFragment extends Fragment {
|
|||
|
||||
// Text line 1
|
||||
TextView line1 = (TextView) view.findViewById(R.id.context_menu_line1);
|
||||
line1.setText(MapContextMenu.getInstance().getAddressStr());
|
||||
line1.setText(getCtxMenu().getAddressStr());
|
||||
|
||||
// Text line 2
|
||||
TextView line2 = (TextView) view.findViewById(R.id.context_menu_line2);
|
||||
line2.setText(MapContextMenu.getInstance().getLocationStr());
|
||||
line2.setText(getCtxMenu().getLocationStr(getMapActivity()));
|
||||
|
||||
// Close button
|
||||
final ImageView closeButtonView = (ImageView)view.findViewById(R.id.context_menu_close_btn_view);
|
||||
|
@ -279,7 +279,7 @@ public class MapContextMenuFragment extends Fragment {
|
|||
buttonNavigate.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
MapContextMenu.getInstance().buttonNavigatePressed();
|
||||
getCtxMenu().buttonNavigatePressed(getMapActivity());
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -289,7 +289,7 @@ public class MapContextMenuFragment extends Fragment {
|
|||
buttonFavorite.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
MapContextMenu.getInstance().buttonFavoritePressed();
|
||||
getCtxMenu().buttonFavoritePressed(getMapActivity());
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -299,7 +299,7 @@ public class MapContextMenuFragment extends Fragment {
|
|||
buttonShare.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
MapContextMenu.getInstance().buttonSharePressed();
|
||||
getCtxMenu().buttonSharePressed(getMapActivity());
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -309,12 +309,12 @@ public class MapContextMenuFragment extends Fragment {
|
|||
buttonMore.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
MapContextMenu.getInstance().buttonMorePressed();
|
||||
getCtxMenu().buttonMorePressed(getMapActivity());
|
||||
}
|
||||
});
|
||||
|
||||
// Menu controller
|
||||
menuController = MapContextMenu.getInstance().getMenuController();
|
||||
menuController = getCtxMenu().getMenuController();
|
||||
bottomView = view.findViewById(R.id.context_menu_bottom_view);
|
||||
if (menuController != null) {
|
||||
bottomView.setOnTouchListener(new View.OnTouchListener() {
|
||||
|
@ -397,14 +397,22 @@ public class MapContextMenuFragment extends Fragment {
|
|||
.addToBackStack(null).commit();
|
||||
}
|
||||
|
||||
private MapContextMenu getCtxMenu() {
|
||||
return ((MapActivity)getActivity()).getContextMenu();
|
||||
}
|
||||
|
||||
private MapActivity getMapActivity() {
|
||||
return (MapActivity)getActivity();
|
||||
}
|
||||
|
||||
// Utils
|
||||
public int getScreenHeight() {
|
||||
private int getScreenHeight() {
|
||||
DisplayMetrics dm = new DisplayMetrics();
|
||||
getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
|
||||
return dm.heightPixels;
|
||||
}
|
||||
|
||||
public int dpToPx(float dp) {
|
||||
private int dpToPx(float dp) {
|
||||
Resources r = getActivity().getResources();
|
||||
return (int) TypedValue.applyDimension(
|
||||
COMPLEX_UNIT_DIP,
|
||||
|
|
|
@ -23,7 +23,6 @@ import net.osmand.data.RotatedTileBox;
|
|||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
@ -511,7 +510,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
|||
this.latLon = new LatLon(pointDescription.getLat(), pointDescription.getLon());
|
||||
|
||||
showMapContextMenuMarker();
|
||||
MapContextMenu.getInstance().show(pointDescription, selectedObj);
|
||||
activity.getContextMenu().show(activity, pointDescription, selectedObj);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue