Change dashboard animations

This commit is contained in:
PavelRatushny 2017-11-21 18:15:27 +02:00
parent 1d695c8e5d
commit 67a6ccb0a2
28 changed files with 158 additions and 125 deletions

View file

@ -284,6 +284,12 @@ public class AndroidUtils {
decorView.setSystemUiVisibility(uiOptions);
}
public static int[] getViewLocation(View view) {
int[] coordinates = new int[2];
view.getLocationOnScreen(coordinates);
return coordinates;
}
public static void enterToFullScreen(Activity activity) {
if (Build.VERSION.SDK_INT >= 21) {
activity.getWindow().getDecorView()

View file

@ -252,7 +252,7 @@ public class ContextMenuAdapter {
ItemClickListener ca = item.getItemClickListener();
item.setSelected(isChecked);
if (ca != null) {
ca.onContextMenuClick(la, item.getTitleId(), position, isChecked);
ca.onContextMenuClick(la, item.getTitleId(), position, isChecked, null);
}
}
};
@ -348,7 +348,8 @@ public class ContextMenuAdapter {
boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter,
int itemId,
int position,
boolean isChecked);
boolean isChecked,
int[] viewCoordinates);
}
public interface ProgressListener {
@ -372,7 +373,7 @@ public class ContextMenuAdapter {
btn.setChecked(!btn.isChecked());
return false;
} else {
return onContextMenuClick(adapter, itemId, position, false);
return onContextMenuClick(adapter, itemId, position, false, null);
}
}
}

View file

@ -74,7 +74,7 @@ public class HelpActivity extends OsmandActionBarActivity implements AdapterView
ContextMenuAdapter.ItemClickListener listener =
mAdapter.getItem(position).getItemClickListener();
if (listener != null) {
listener.onContextMenuClick(mAdapter, position, position, false);
listener.onContextMenuClick(mAdapter, position, position, false, null);
}
}
@ -200,7 +200,8 @@ public class HelpActivity extends OsmandActionBarActivity implements AdapterView
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter,
int itemId,
int position,
boolean isChecked) {
boolean isChecked,
int[] viewCoordinates) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(intent);
return false;
@ -227,7 +228,7 @@ public class HelpActivity extends OsmandActionBarActivity implements AdapterView
}
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int position, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int position, boolean isChecked, int[] viewCoordinates) {
String title = mTitle == null ? adapter.getItem(position).getTitle() : mTitle;
HelpArticleDialogFragment.instantiateWithAsset(filename, title)
.show(ctx.getSupportFragmentManager(), "DIALOG_HELP_ARTICLE");

View file

@ -18,6 +18,7 @@ import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import net.osmand.AndroidUtils;
import net.osmand.IndexConstants;
import net.osmand.Location;
import net.osmand.PlatformUtil;
@ -282,7 +283,7 @@ public class MapActivityActions implements DialogProvider {
ContextMenuAdapter.ItemClickListener listener = new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int resId, int pos, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int resId, int pos, boolean isChecked, int[] viewCoordinates) {
if (resId == R.string.context_menu_item_add_waypoint) {
mapActivity.getContextMenu().addWptPt();
} else if (resId == R.string.context_menu_item_edit_waypoint) {
@ -322,7 +323,7 @@ public class MapActivityActions implements DialogProvider {
int standardId = item.getTitleId();
ItemClickListener click = item.getItemClickListener();
if (click != null) {
click.onContextMenuClick(listAdapter, standardId, which, false);
click.onContextMenuClick(listAdapter, standardId, which, false, null);
} else if (standardId == R.string.context_menu_item_last_intermediate_point) {
mapActivity.getContextMenu().addAsLastIntermediate();
} else if (standardId == R.string.context_menu_item_search) {
@ -612,11 +613,11 @@ public class MapActivityActions implements DialogProvider {
.setIcon(R.drawable.map_dashboard)
.setListener(new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
app.logEvent(mapActivity, "drawer_dashboard_open");
MapActivity.clearPrevActivityIntent();
mapActivity.closeDrawer();
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.DASHBOARD);
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.DASHBOARD, viewCoordinates);
return true;
}
}).createItem());
@ -625,7 +626,7 @@ public class MapActivityActions implements DialogProvider {
.setIcon(R.drawable.ic_action_flag_dark)
.setListener(new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
app.logEvent(mapActivity, "drawer_markers_open");
MapActivity.clearPrevActivityIntent();
MapMarkersDialogFragment.showInstance(mapActivity);
@ -637,10 +638,10 @@ public class MapActivityActions implements DialogProvider {
.setIcon(R.drawable.ic_action_intermediate)
.setListener(new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
app.logEvent(mapActivity, "drawer_waypoints_open");
MapActivity.clearPrevActivityIntent();
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.WAYPOINTS);
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.WAYPOINTS, viewCoordinates);
return false;
}
}).createItem());
@ -650,7 +651,7 @@ public class MapActivityActions implements DialogProvider {
.setIcon(R.drawable.ic_action_fav_dark)
.setListener(new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
app.logEvent(mapActivity, "drawer_myplaces_open");
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization()
.getFavoritesActivity());
@ -664,7 +665,7 @@ public class MapActivityActions implements DialogProvider {
.setIcon(R.drawable.ic_action_search_dark)
.setListener(new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
app.logEvent(mapActivity, "drawer_search_open");
mapActivity.showQuickSearch(MapActivity.ShowQuickSearchMode.NEW_IF_EXPIRED, false);
return true;
@ -676,7 +677,7 @@ public class MapActivityActions implements DialogProvider {
.setIcon(R.drawable.ic_action_search_dark)
.setListener(new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
app.logEvent(mapActivity, "drawer_legacy_search_open");
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization()
.getSearchActivity());
@ -697,7 +698,7 @@ public class MapActivityActions implements DialogProvider {
.setIcon(R.drawable.ic_action_gdirections_dark)
.setListener(new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
app.logEvent(mapActivity, "drawer_directions_open");
MapControlsLayer mapControlsLayer = mapActivity.getMapLayers().getMapControlsLayer();
if (mapControlsLayer != null) {
@ -724,10 +725,10 @@ public class MapActivityActions implements DialogProvider {
.setIcon(R.drawable.ic_action_layers_dark)
.setListener(new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
app.logEvent(mapActivity, "drawer_config_map_open");
MapActivity.clearPrevActivityIntent();
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.CONFIGURE_MAP);
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.CONFIGURE_MAP, viewCoordinates);
return false;
}
}).createItem());
@ -743,7 +744,7 @@ public class MapActivityActions implements DialogProvider {
.setTitle(d).setIcon(R.drawable.ic_type_archive)
.setListener(new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
app.logEvent(mapActivity, "drawer_download_maps_open");
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization()
.getDownloadActivity());
@ -758,7 +759,7 @@ public class MapActivityActions implements DialogProvider {
.setIcon(R.drawable.ic_action_osm_live)
.setListener(new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
app.logEvent(mapActivity, "drawer_osm_live_open");
Intent intent = new Intent(mapActivity, OsmLiveActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
@ -772,7 +773,7 @@ public class MapActivityActions implements DialogProvider {
.setIcon(R.drawable.ic_action_ruler)
.setListener(new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int position, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int position, boolean isChecked, int[] viewCoordinates) {
MeasurementToolFragment.showInstance(mapActivity.getSupportFragmentManager());
return true;
}
@ -782,10 +783,10 @@ public class MapActivityActions implements DialogProvider {
.setIcon(R.drawable.ic_configure_screen_dark)
.setListener(new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
app.logEvent(mapActivity, "drawer_config_screen_open");
MapActivity.clearPrevActivityIntent();
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.CONFIGURE_SCREEN);
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.CONFIGURE_SCREEN, viewCoordinates);
return false;
}
}).createItem());
@ -794,7 +795,7 @@ public class MapActivityActions implements DialogProvider {
.setIcon(R.drawable.ic_extension_dark)
.setListener(new ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
app.logEvent(mapActivity, "drawer_plugins_open");
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization()
.getPluginsActivity());
@ -808,7 +809,7 @@ public class MapActivityActions implements DialogProvider {
.setIcon(R.drawable.ic_action_settings)
.setListener(new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
app.logEvent(mapActivity, "drawer_settings_open");
final Intent settings = new Intent(mapActivity, getMyApplication().getAppCustomization()
.getSettingsActivity());
@ -835,7 +836,7 @@ public class MapActivityActions implements DialogProvider {
.setIcon(R.drawable.ic_action_help)
.setListener(new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
app.logEvent(mapActivity, "drawer_help_open");
Intent intent = new Intent(mapActivity, HelpActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
@ -946,7 +947,7 @@ public class MapActivityActions implements DialogProvider {
ContextMenuItem item = contextMenuAdapter.getItem(position);
ContextMenuAdapter.ItemClickListener click = item.getItemClickListener();
if (click != null && click.onContextMenuClick(simpleListAdapter, item.getTitleId(),
position, false)) {
position, false, AndroidUtils.getViewLocation(view))) {
mapActivity.closeDrawer();
}
}

View file

@ -293,7 +293,7 @@ public class MapActivityLayers {
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
ContextMenuItem item = listAdapter.getItem(position);
item.setSelected(!item.getSelected());
item.getItemClickListener().onContextMenuClick(listAdapter, position, position, item.getSelected());
item.getItemClickListener().onContextMenuClick(listAdapter, position, position, item.getSelected(), null);
listAdapter.notifyDataSetChanged();
}
});
@ -416,7 +416,7 @@ public class MapActivityLayers {
builder.setListener(new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter,
int itemId, int position, boolean isChecked) {
int itemId, int position, boolean isChecked, int[] viewCoordinates) {
ContextMenuItem item = adapter.getItem(position);
item.setSelected(isChecked);
return false;

View file

@ -623,7 +623,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
public void registerLayerContextMenuActions(final OsmandMapTileView mapView, ContextMenuAdapter adapter, final MapActivity mapActivity) {
ItemClickListener listener = new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
if (itemId == R.string.layer_recordings) {
SHOW_RECORDINGS.set(!SHOW_RECORDINGS.get());
adapter.getItem(pos).setColorRes(SHOW_RECORDINGS.get() ?
@ -653,7 +653,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
.setListener(new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
recordAudio(latitude, longitude, mapActivity);
return true;
}
@ -664,7 +664,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
.setListener(new ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
recordVideo(latitude, longitude, mapActivity, false);
return true;
}
@ -674,7 +674,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
.setIcon(R.drawable.ic_action_photo_dark)
.setListener(new ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
takePhoto(latitude, longitude, mapActivity, false, false);
return true;
}

View file

@ -15,6 +15,7 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import net.osmand.AndroidUtils;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.plus.R;
@ -85,7 +86,7 @@ public class DashWaypointsFragment extends DashLocationFragment {
@Override
public void onClick(View v) {
dashboard.setDashboardVisibility(true, DashboardType.WAYPOINTS);
dashboard.setDashboardVisibility(true, DashboardType.WAYPOINTS, AndroidUtils.getViewLocation(v));
}
});
LinearLayout favorites = (LinearLayout) mainView.findViewById(R.id.items);

View file

@ -1,5 +1,9 @@
package net.osmand.plus.dashboard;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
@ -19,9 +23,6 @@ import android.view.Gravity;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewTreeObserver;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.TranslateAnimation;
import android.view.inputmethod.InputMethodManager;
import android.widget.AbsListView;
import android.widget.AdapterView;
@ -510,7 +511,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
@Override
public void onClick(View v) {
setDashboardVisibility(true, flatNow ? DashboardType.WAYPOINTS : DashboardType.WAYPOINTS_FLAT,
previousVisibleType, false);
previousVisibleType, false, AndroidUtils.getViewLocation(v));
}
});
}
@ -661,7 +662,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
markersSelectionButton.onClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
setDashboardVisibility(true, DashboardType.MAP_MARKERS_SELECTION);
setDashboardVisibility(true, DashboardType.MAP_MARKERS_SELECTION, AndroidUtils.getViewLocation(v));
}
};
@ -759,12 +760,20 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
}
public void setDashboardVisibility(boolean visible, DashboardType type) {
setDashboardVisibility(visible, type, null);
}
public void setDashboardVisibility(boolean visible, DashboardType type, int[] animationCoordinates) {
boolean animate = !getMyApplication().getSettings().DO_NOT_USE_ANIMATIONS.get();
setDashboardVisibility(visible, type, this.visible ? visibleType : null, animate);
setDashboardVisibility(visible, type, this.visible ? visibleType : null, animate, animationCoordinates);
}
public void setDashboardVisibility(boolean visible, DashboardType type, boolean animation) {
setDashboardVisibility(visible, type, this.visible ? visibleType : null, animation);
setDashboardVisibility(visible, type, animation, null);
}
public void setDashboardVisibility(boolean visible, DashboardType type, boolean animation, int[] animationCoordinates) {
setDashboardVisibility(visible, type, this.visible ? visibleType : null, animation, animationCoordinates);
}
public void refreshDashboardFragments() {
@ -776,7 +785,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
return R.color.status_bar_transparent_gradient;
}
public void setDashboardVisibility(boolean visible, DashboardType type, DashboardType prevItem, boolean animation) {
public void setDashboardVisibility(boolean visible, DashboardType type, DashboardType prevItem, boolean animation, int[] animationCoordinates) {
if (visible == this.visible && type == visibleType) {
return;
}
@ -868,7 +877,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
updateToolbarActions();
//fabButton.showFloatingActionButton();
open(dashboardView.findViewById(R.id.animateContent), animation);
open(dashboardView.findViewById(R.id.animateContent), animation, animationCoordinates);
updateLocation(true, true, false);
// addOrUpdateDashboardFragments();
mapActivity.getRoutingHelper().addListener(this);
@ -1121,7 +1130,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
if (btn != null && btn.getVisibility() == View.VISIBLE) {
btn.setChecked(!btn.isChecked());
} else {
if (click.onContextMenuClick(listAdapter, item.getTitleId(), which, false)) {
if (click.onContextMenuClick(listAdapter, item.getTitleId(), which, false, null)) {
hideDashboard();
}
}
@ -1202,51 +1211,58 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
// To animate view slide out from right to left
private void open(View view, boolean animation) {
private void open(final View view, boolean animation, int[] animationCoordinates) {
if (animation) {
TranslateAnimation animate = new TranslateAnimation(-mapActivity.findViewById(R.id.MapHudButtonsOverlay)
.getWidth(), 0, 0, 0);
animate.setDuration(500);
animate.setFillAfter(true);
view.startAnimation(animate);
AnimatorSet set = new AnimatorSet();
List<Animator> animators = new ArrayList<>();
if (animationCoordinates != null) {
int screenHeight = mapActivity.getResources().getDisplayMetrics().heightPixels;
int screenWidth = mapActivity.getResources().getDisplayMetrics().widthPixels;
animators.add(ObjectAnimator.ofFloat(view, View.TRANSLATION_X, animationCoordinates[0] - screenWidth / 2, 0));
animators.add(ObjectAnimator.ofFloat(view, View.TRANSLATION_Y, animationCoordinates[1] - screenHeight / 2, 0));
}
animators.add(ObjectAnimator.ofFloat(view, View.ALPHA, 0f, 1f));
animators.add(ObjectAnimator.ofFloat(view, View.SCALE_X, 0.2f, 1f));
animators.add(ObjectAnimator.ofFloat(view, View.SCALE_Y, 0.2f, 1f));
set.setDuration(300).playTogether(animators);
set.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
super.onAnimationStart(animation);
view.setVisibility(View.VISIBLE);
}
});
set.start();
} else {
view.setVisibility(View.VISIBLE);
}
}
private void hide(View view, boolean animation) {
private void hide(final View view, boolean animation) {
if (compassButton != null) {
mapActivity.getMapLayers().getMapControlsLayer().restoreCompassButton(nightMode);
compassButton = null;
}
if (!animation) {
dashboardView.setVisibility(View.GONE);
view.setVisibility(View.GONE);
} else {
TranslateAnimation animate = new TranslateAnimation(0, -mapActivity.findViewById(R.id.MapHudButtonsOverlay)
.getWidth(), 0, 0);
animate.setDuration(500);
animate.setFillAfter(true);
animate.setAnimationListener(new AnimationListener() {
AnimatorSet set = new AnimatorSet();
set.setDuration(300).playTogether(
ObjectAnimator.ofFloat(view, View.ALPHA, 1f, 0f),
ObjectAnimator.ofFloat(view, View.TRANSLATION_Y, 0, view.getHeight())
);
set.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
dashboardView.setVisibility(View.GONE);
view.setVisibility(View.GONE);
view.setTranslationY(0);
}
});
view.startAnimation(animate);
set.start();
}
view.setVisibility(View.GONE);
}

View file

@ -61,7 +61,7 @@ public class OsmandDevelopmentPlugin extends OsmandPlugin {
.setIcon(R.drawable.ic_action_gabout_dark)
.setListener(new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
final Intent mapIntent = new Intent(mapActivity, ContributionVersionActivity.class);
mapActivity.startActivityForResult(mapIntent, 0);
return true;

View file

@ -157,13 +157,13 @@ public class ConfigureMapMenu {
adapter.notifyDataSetChanged();
return false;
} else {
return onContextMenuClick(adapter, itemId, pos, false);
return onContextMenuClick(adapter, itemId, pos, false, null);
}
}
}
@Override
public boolean onContextMenuClick(final ArrayAdapter<ContextMenuItem> adapter, int itemId, final int pos, boolean isChecked) {
public boolean onContextMenuClick(final ArrayAdapter<ContextMenuItem> adapter, int itemId, final int pos, boolean isChecked, int[] viewCoordinates) {
final OsmandSettings settings = ma.getMyApplication().getSettings();
final PoiFiltersHelper poiFiltersHelper = ma.getMyApplication().getPoiFilters();
final ContextMenuItem item = cm.getItem(pos);
@ -331,14 +331,14 @@ public class ConfigureMapMenu {
adapter.notifyDataSetChanged();
return false;
} else {
return onContextMenuClick(adapter, itemId, position, false);
return onContextMenuClick(adapter, itemId, position, false, null);
}
}
}
@Override
public boolean onContextMenuClick(final ArrayAdapter<ContextMenuItem> ad, int itemId,
final int pos, boolean isChecked) {
final int pos, boolean isChecked, int[] viewCoordinates) {
if (transportSelectedInner) {
for (int i = 0; i < transportPrefs.size(); i++) {
transportPrefs.get(i).set(false);
@ -499,7 +499,7 @@ public class ConfigureMapMenu {
.setIcon(R.drawable.ic_map).setListener(new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(final ArrayAdapter<ContextMenuItem> ad, int itemId,
final int pos, boolean isChecked) {
final int pos, boolean isChecked, int[] viewCoordinates) {
AlertDialog.Builder bld = new AlertDialog.Builder(activity);
bld.setTitle(R.string.renderers);
final OsmandApplication app = activity.getMyApplication();
@ -552,7 +552,7 @@ public class ConfigureMapMenu {
.setIcon(getDayNightIcon(activity)).setListener(new ItemClickListener() {
@Override
public boolean onContextMenuClick(final ArrayAdapter<ContextMenuItem> ad, int itemId,
final int pos, boolean isChecked) {
final int pos, boolean isChecked, int[] viewCoordinates) {
final OsmandMapTileView view = activity.getMapView();
AlertDialog.Builder bld = new AlertDialog.Builder(view.getContext());
bld.setTitle(R.string.daynight);
@ -588,7 +588,7 @@ public class ConfigureMapMenu {
.setIcon(R.drawable.ic_action_map_magnifier).setListener(new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(final ArrayAdapter<ContextMenuItem> ad, int itemId,
final int pos, boolean isChecked) {
final int pos, boolean isChecked, int[] viewCoordinates) {
final OsmandMapTileView view = activity.getMapView();
final OsmandSettings.OsmandPreference<Float> mapDensity = view.getSettings().MAP_DENSITY;
final AlertDialog.Builder bld = new AlertDialog.Builder(view.getContext());
@ -651,7 +651,7 @@ public class ConfigureMapMenu {
.setIcon(R.drawable.ic_action_map_text_size).setListener(new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(final ArrayAdapter<ContextMenuItem> ad, int itemId,
final int pos, boolean isChecked) {
final int pos, boolean isChecked, int[] viewCoordinates) {
final OsmandMapTileView view = activity.getMapView();
AlertDialog.Builder b = new AlertDialog.Builder(view.getContext());
// test old descr as title
@ -690,7 +690,7 @@ public class ConfigureMapMenu {
.setListener(new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(final ArrayAdapter<ContextMenuItem> ad, int itemId,
final int pos, boolean isChecked) {
final int pos, boolean isChecked, int[] viewCoordinates) {
final OsmandMapTileView view = activity.getMapView();
final AlertDialog.Builder b = new AlertDialog.Builder(view.getContext());
@ -889,7 +889,7 @@ public class ConfigureMapMenu {
final ItemClickListener clickListener = new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> a, int itemId, int pos,
boolean isChecked) {
boolean isChecked, int[] viewCoordinates) {
if (!isChecked && !useDescription) {
if (defaultSettings != null) {
defaultSettings.set("");
@ -939,8 +939,8 @@ public class ConfigureMapMenu {
} else {
builder.setListener(new OnRowItemClick() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> a, int itemId, int pos, boolean isChecked) {
return clickListener.onContextMenuClick(a, itemId, pos, isChecked);
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> a, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
return clickListener.onContextMenuClick(a, itemId, pos, isChecked, null);
}
@Override
@ -1210,7 +1210,7 @@ public class ConfigureMapMenu {
.setListener(new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
pref.set(!pref.get());
refreshMapComplete(activity);
return false;
@ -1233,7 +1233,7 @@ public class ConfigureMapMenu {
@Override
public boolean onContextMenuClick(final ArrayAdapter<ContextMenuItem> ad,
final int itemId, final int pos, boolean isChecked) {
final int itemId, final int pos, boolean isChecked, int[] viewCoordinates) {
AlertDialog.Builder b = new AlertDialog.Builder(view.getContext());
// test old descr as title
b.setTitle(propertyDescr);

View file

@ -99,7 +99,7 @@ public class RasterMapMenu {
@Override
public boolean onContextMenuClick(final ArrayAdapter<ContextMenuItem> adapter,
final int itemId, final int pos, final boolean isChecked) {
final int itemId, final int pos, final boolean isChecked, int[] viewCoordinates) {
if (itemId == toggleActionStringId) {
app.runInUIThread(new Runnable() {
@Override

View file

@ -658,7 +658,7 @@ public class DistanceCalculatorPlugin extends OsmandPlugin {
ContextMenuAdapter.ItemClickListener listener = new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
if (itemId == R.string.delete_point) {
for (int i = 0; i < measurementPoints.size(); i++) {
Iterator<WptPt> it = measurementPoints.get(i).iterator();

View file

@ -166,7 +166,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
ContextMenuItem item = adapter.getItem(which);
if (item.getItemClickListener() != null) {
item.getItemClickListener().onContextMenuClick(null,
item.getTitleId(), which, false);
item.getTitleId(), which, false, null);
}
}
@ -178,7 +178,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
private void basicFileOperation(final LocalIndexInfo info, ContextMenuAdapter adapter) {
ItemClickListener listener = new ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int resId, int pos, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int resId, int pos, boolean isChecked, int[] viewCoordinates) {
return performBasicOperation(resId, info);
}
};
@ -619,7 +619,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
ItemClickListener listener = new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter,
int itemId, int pos, boolean isChecked) {
int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
localOptionsMenu(itemId);
return true;
}
@ -681,7 +681,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
for (int i = 0; i < optionsMenuAdapter.length(); i++) {
ContextMenuItem contextMenuItem = optionsMenuAdapter.getItem(i);
if (itemId == contextMenuItem.getTitleId()) {
contextMenuItem.getItemClickListener().onContextMenuClick(null, itemId, i, false);
contextMenuItem.getItemClickListener().onContextMenuClick(null, itemId, i, false, null);
return true;
}
}

View file

@ -14,6 +14,7 @@ import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.CompoundButton;
import net.osmand.AndroidUtils;
import net.osmand.map.ITileSource;
import net.osmand.map.TileSourceManager;
import net.osmand.plus.ApplicationMode;
@ -150,14 +151,14 @@ public class MapillaryPlugin extends OsmandPlugin {
@Override
public boolean onRowItemClick(ArrayAdapter<ContextMenuItem> adapter, View view, int itemId, int position) {
if (itemId == R.string.mapillary) {
mapActivity.getDashboard().setDashboardVisibility(true, DashboardOnMap.DashboardType.MAPILLARY);
mapActivity.getDashboard().setDashboardVisibility(true, DashboardOnMap.DashboardType.MAPILLARY, AndroidUtils.getViewLocation(view));
return false;
}
return true;
}
@Override
public boolean onContextMenuClick(final ArrayAdapter<ContextMenuItem> adapter, int itemId, final int pos, boolean isChecked) {
public boolean onContextMenuClick(final ArrayAdapter<ContextMenuItem> adapter, int itemId, final int pos, boolean isChecked, int[] viewCoordinates) {
final OsmandSettings settings = mapActivity.getMyApplication().getSettings();
if (itemId == R.string.mapillary) {
OsmandMapTileView mapView = mapActivity.getMapView();

View file

@ -450,7 +450,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
optionsMenuAdapter = new ContextMenuAdapter();
ItemClickListener listener = new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, final int itemId, int pos, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, final int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
if (itemId == R.string.local_index_mi_reload) {
reloadTracks();
} else if (itemId == R.string.shared_string_show_on_map) {
@ -521,7 +521,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
for (int i = 0; i < optionsMenuAdapter.length(); i++) {
ContextMenuItem contextMenuItem = optionsMenuAdapter.getItem(i);
if (itemId == contextMenuItem.getTitleId()) {
contextMenuItem.getItemClickListener().onContextMenuClick(null, itemId, i, false);
contextMenuItem.getItemClickListener().onContextMenuClick(null, itemId, i, false, null);
return true;
}
}

View file

@ -173,7 +173,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
final Object selectedObj) {
ContextMenuAdapter.ItemClickListener listener = new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int resId, int pos, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int resId, int pos, boolean isChecked, int[] viewCoordinates) {
if (resId == R.string.context_menu_item_create_poi) {
//getPoiActions(mapActivity).showCreateDialog(latitude, longitude);
EditPoiDialogFragment editPoiDialogFragment =
@ -273,7 +273,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
.setListener(new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
if (itemId == R.string.layer_osm_bugs) {
OsmandSettings.OsmandPreference<Boolean> showOsmBugs = settings.SHOW_OSM_BUGS;
showOsmBugs.set(isChecked);
@ -303,7 +303,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
.setListener(new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
sendGPXFiles(la, (AvailableGPXFragment) fragment, (GpxInfo) info);
return true;
}
@ -321,7 +321,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
.setListener(new ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
f.openSelectionMode(R.string.local_index_mi_upload_gpx, R.drawable.ic_action_export,
R.drawable.ic_action_export, new OnClickListener() {
@Override

View file

@ -282,7 +282,7 @@ public class OsMoPlugin extends OsmandPlugin implements OsMoReactor {
.setIcon(R.drawable.ic_osmo_dark)
.setListener(new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
Intent intent = new Intent(mapActivity, OsMoGroupsActivity.class);
mapActivity.startActivity(intent);
return true;

View file

@ -220,7 +220,7 @@ public class ParkingPositionPlugin extends OsmandPlugin {
ItemClickListener addListener = new ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int resId,
int pos, boolean isChecked) {
int pos, boolean isChecked, int[] viewCoordinates) {
if (resId == R.string.context_menu_item_add_parking_point) {
showAddParkingDialog(mapActivity, latitude, longitude);
}

View file

@ -15,6 +15,7 @@ import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;
import net.osmand.AndroidUtils;
import net.osmand.IndexConstants;
import net.osmand.ResultMatcher;
import net.osmand.StateChangedListener;
@ -241,18 +242,19 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
ContextMenuAdapter.ItemClickListener listener = new ContextMenuAdapter.OnRowItemClick() {
@Override
public boolean onRowItemClick(ArrayAdapter<ContextMenuItem> adapter, View view, int itemId, int position) {
int[] viewCoordinates = AndroidUtils.getViewLocation(view);
if (itemId == R.string.layer_overlay) {
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.OVERLAY_MAP);
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.OVERLAY_MAP, viewCoordinates);
return false;
} else if (itemId == R.string.layer_underlay) {
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.UNDERLAY_MAP);
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.UNDERLAY_MAP, viewCoordinates);
return false;
}
return true;
}
@Override
public boolean onContextMenuClick(final ArrayAdapter<ContextMenuItem> adapter, int itemId, final int pos, boolean isChecked) {
public boolean onContextMenuClick(final ArrayAdapter<ContextMenuItem> adapter, int itemId, final int pos, boolean isChecked, int[] viewCoordinates) {
final OsmandSettings settings = mapActivity.getMyApplication().getSettings();
switch (itemId) {
case R.string.layer_overlay:
@ -346,7 +348,7 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
if (mapView.getMainLayer() instanceof MapTileLayer) {
ItemClickListener listener = new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int resId, int pos, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int resId, int pos, boolean isChecked, int[] viewCoordinates) {
if (resId == R.string.context_menu_item_update_map) {
mapActivity.getMapActions().reloadTile(mapView.getZoom(), latitude, longitude);
} else if (resId == R.string.shared_string_download_map) {

View file

@ -88,7 +88,7 @@ public class RoutePointsLayer extends OsmandMapLayer implements ContextMenuLaye
final GPXUtilities.WptPt point = (GPXUtilities.WptPt) o;
ContextMenuAdapter.ItemClickListener listener = new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
if (itemId == R.string.mark_as_not_visited){
plugin.getCurrentRoute().markPoint(point,false);
plugin.saveCurrentRoute();

View file

@ -96,7 +96,7 @@ public class ContourLinesMenu {
@Override
public boolean onContextMenuClick(final ArrayAdapter<ContextMenuItem> adapter,
final int itemId, final int pos, final boolean isChecked) {
final int itemId, final int pos, final boolean isChecked, int[] viewCoordinates) {
if (itemId == toggleActionStringId) {
app.runInUIThread(new Runnable() {
@Override
@ -268,7 +268,7 @@ public class ContourLinesMenu {
.setIcon(DownloadActivityType.SRTM_COUNTRY_FILE.getIconResource())
.setListener(new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int position, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int position, boolean isChecked, int[] viewCoordinates) {
ContextMenuItem item = adapter.getItem(position);
if (downloadThread.isDownloading(indexItem)) {
downloadThread.cancelDownload(indexItem);

View file

@ -56,7 +56,7 @@ public class HillshadeMenu {
@Override
public boolean onContextMenuClick(final ArrayAdapter<ContextMenuItem> adapter,
final int itemId, final int pos, final boolean isChecked) {
final int itemId, final int pos, final boolean isChecked, int[] viewCoordinates) {
if (itemId == toggleActionStringId) {
app.runInUIThread(new Runnable() {
@Override
@ -146,7 +146,7 @@ public class HillshadeMenu {
.setIcon(DownloadActivityType.HILLSHADE_FILE.getIconResource())
.setListener(new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int position, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int position, boolean isChecked, int[] viewCoordinates) {
ContextMenuItem item = adapter.getItem(position);
if (downloadThread.isDownloading(indexItem)) {
downloadThread.cancelDownload(indexItem);

View file

@ -7,6 +7,7 @@ import android.support.v7.app.AlertDialog;
import android.view.View;
import android.widget.ArrayAdapter;
import net.osmand.AndroidUtils;
import net.osmand.plus.ApplicationMode;
import net.osmand.plus.ContextMenuAdapter;
import net.osmand.plus.ContextMenuItem;
@ -129,11 +130,12 @@ public class SRTMPlugin extends OsmandPlugin {
@Override
public boolean onRowItemClick(ArrayAdapter<ContextMenuItem> adapter, View view, int itemId, int position) {
int[] viewCoordinates = AndroidUtils.getViewLocation(view);
if (itemId == R.string.srtm_plugin_name) {
mapActivity.getDashboard().setDashboardVisibility(true, DashboardOnMap.DashboardType.CONTOUR_LINES);
mapActivity.getDashboard().setDashboardVisibility(true, DashboardOnMap.DashboardType.CONTOUR_LINES, viewCoordinates);
return false;
} else if (itemId == R.string.layer_hillshade) {
mapActivity.getDashboard().setDashboardVisibility(true, DashboardOnMap.DashboardType.HILLSHADE);
mapActivity.getDashboard().setDashboardVisibility(true, DashboardOnMap.DashboardType.HILLSHADE, viewCoordinates);
return false;
}
return true;
@ -143,7 +145,8 @@ public class SRTMPlugin extends OsmandPlugin {
public boolean onContextMenuClick(final ArrayAdapter<ContextMenuItem> adapter,
final int itemId,
final int position,
final boolean isChecked) {
final boolean isChecked,
final int[] viewCoordinates) {
if (itemId == R.string.srtm_plugin_name) {
toggleContourLines(mapActivity, isChecked, new Runnable() {
@Override

View file

@ -242,7 +242,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
if (menu.hasHiddenBottomInfo()) {
ContextMenuAdapter.ItemClickListener listener = new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
menu.openMenuFullScreen();
return true;
}
@ -256,7 +256,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
if (isObjectMoveable(o)) {
ContextMenuAdapter.ItemClickListener listener = new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
RotatedTileBox tileBox = activity.getMapView().getCurrentRotatedTileBox();
enterMovingMode(tileBox);
return true;

View file

@ -218,7 +218,7 @@ public class ImpassableRoadsLayer extends OsmandMapLayer implements
ContextMenuAdapter.ItemClickListener listener = new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
if (itemId == R.string.avoid_road) {
activity.getMyApplication().getAvoidSpecificRoads().addImpassableRoad(
activity, latLon, false, null, false);

View file

@ -249,7 +249,7 @@ public class MapControlsLayer extends OsmandMapLayer {
@Override
public void onClick(View v) {
MapActivity.clearPrevActivityIntent();
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.CONFIGURE_MAP);
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.CONFIGURE_MAP, AndroidUtils.getViewLocation(v));
}
});
@ -410,7 +410,7 @@ public class MapControlsLayer extends OsmandMapLayer {
public void onClick(View v) {
MapActivity.clearPrevActivityIntent();
if (dash) {
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.DASHBOARD);
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.DASHBOARD, AndroidUtils.getViewLocation(v));
} else {
mapActivity.openDrawer();
}

View file

@ -10,6 +10,7 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import net.osmand.AndroidUtils;
import net.osmand.Location;
import net.osmand.binary.RouteDataObject;
import net.osmand.data.LatLon;
@ -881,7 +882,7 @@ public class MapInfoWidgetsFactory {
all.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
map.getDashboard().setDashboardVisibility(true, DashboardType.WAYPOINTS);
map.getDashboard().setDashboardVisibility(true, DashboardType.WAYPOINTS, AndroidUtils.getViewLocation(view));
}
});
remove.setOnClickListener(new OnClickListener() {

View file

@ -326,7 +326,7 @@ public class MapWidgetRegistry {
.setDescription(settings.MAP_MARKERS_MODE.get().toHumanString(map))
.setListener(new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(final ArrayAdapter<ContextMenuItem> adapter, int itemId, final int position, boolean isChecked) {
public boolean onContextMenuClick(final ArrayAdapter<ContextMenuItem> adapter, int itemId, final int position, boolean isChecked, int[] viewCoordinates) {
DirectionIndicationDialogFragment fragment = new DirectionIndicationDialogFragment();
fragment.setListener(new DirectionIndicationDialogFragment.DirectionIndicationFragmentListener() {
@Override
@ -418,7 +418,7 @@ public class MapWidgetRegistry {
.setSecondaryIcon( R.drawable.ic_action_additional_option)
.setListener(new ContextMenuAdapter.OnRowItemClick() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int position, boolean isChecked) {
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int position, boolean isChecked, int[] viewCoordinates) {
setVisibility(adapter, position, isChecked);
return false;
}
@ -557,7 +557,7 @@ public class MapWidgetRegistry {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> a,
int itemId, int pos, boolean isChecked) {
int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
setVisibility(a, pos, isChecked, false);
return false;
}
@ -780,7 +780,7 @@ public class MapWidgetRegistry {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> a,
int itemId, int pos, boolean isChecked) {
int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
pref.set(!pref.get());
map.updateApplicationModeSettings();
a.notifyDataSetChanged();