diff --git a/OsmAnd/res/layout/favourites_list_item.xml b/OsmAnd/res/layout/favourites_list_item.xml
index d265123266..fc82ad75f3 100644
--- a/OsmAnd/res/layout/favourites_list_item.xml
+++ b/OsmAnd/res/layout/favourites_list_item.xml
@@ -21,7 +21,7 @@
\ No newline at end of file
diff --git a/OsmAnd/res/layout/local_index_list_item.xml b/OsmAnd/res/layout/local_index_list_item.xml
index 1b195826b3..ca9db17741 100644
--- a/OsmAnd/res/layout/local_index_list_item.xml
+++ b/OsmAnd/res/layout/local_index_list_item.xml
@@ -3,45 +3,42 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
+ android:background="?attr/expandable_list_item_background"
android:minHeight="@dimen/list_item_height"
android:orientation="horizontal"
android:paddingBottom="4dp"
android:paddingLeft="@dimen/list_content_padding"
android:paddingRight="@dimen/list_content_padding"
- android:background="?attr/expandable_list_item_background"
+ android:descendantFocusability="blocksDescendants"
android:paddingTop="4dp">
-
+
+
+
+
+
-
-
-
-
-
-
-
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
-
+ android:gravity="right"
+ tools:text="@string/app_version"/>
-
+
+
+
\ No newline at end of file
diff --git a/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java b/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java
index 1d76fc8a91..c0b81de131 100644
--- a/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java
+++ b/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java
@@ -1,7 +1,5 @@
package net.osmand.plus;
-import android.app.AlertDialog;
-import android.content.DialogInterface;
import android.widget.*;
import gnu.trove.list.array.TIntArrayList;
diff --git a/OsmAnd/src/net/osmand/plus/activities/FavoritesListFragment.java b/OsmAnd/src/net/osmand/plus/activities/FavoritesListFragment.java
index 40e1260160..da158fde21 100644
--- a/OsmAnd/src/net/osmand/plus/activities/FavoritesListFragment.java
+++ b/OsmAnd/src/net/osmand/plus/activities/FavoritesListFragment.java
@@ -3,17 +3,14 @@
*/
package net.osmand.plus.activities;
-import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import android.support.v4.app.ListFragment;
import android.support.v7.widget.PopupMenu;
-import android.support.v7.widget.Toolbar;
import android.view.*;
import net.osmand.data.FavouritePoint;
import net.osmand.data.LatLon;
-import net.osmand.plus.ContextMenuAdapter;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
diff --git a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java
index 492dc8d954..8c548bedcd 100644
--- a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java
+++ b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java
@@ -1,8 +1,6 @@
package net.osmand.plus.activities;
-import android.app.Dialog;
import android.content.pm.ActivityInfo;
-import android.os.Bundle;
import android.os.Handler;
import android.support.v4.view.MenuItemCompat;
import android.support.v7.view.ActionMode;
@@ -12,8 +10,6 @@ import android.view.*;
import gnu.trove.list.array.TIntArrayList;
import java.io.File;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashSet;
@@ -28,21 +24,17 @@ import net.osmand.access.AccessibleToast;
import net.osmand.data.FavouritePoint;
import net.osmand.data.LatLon;
import net.osmand.plus.ContextMenuAdapter;
-import net.osmand.plus.ContextMenuAdapter.Item;
-import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
import net.osmand.plus.FavouritesDbHelper;
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
import net.osmand.plus.GPXUtilities;
import net.osmand.plus.GPXUtilities.GPXFile;
import net.osmand.plus.OsmAndFormatter;
-import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.TargetPointsHelper;
import net.osmand.plus.base.FavoriteImageDrawable;
import net.osmand.plus.dashboard.DashLocationFragment;
import net.osmand.plus.dialogs.DirectionsDialogs;
-import net.osmand.plus.dialogs.FavoriteDialogs;
import net.osmand.plus.helpers.ColorDialogs;
import net.osmand.plus.helpers.ScreenOrientationHelper;
import net.osmand.util.MapUtils;
@@ -56,7 +48,6 @@ import android.graphics.Typeface;
import android.net.Uri;
import android.os.AsyncTask;
import android.support.v4.app.FragmentActivity;
-import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.CheckBox;
diff --git a/OsmAnd/src/net/osmand/plus/activities/IntermediatePointsDialog.java b/OsmAnd/src/net/osmand/plus/activities/IntermediatePointsDialog.java
index a313a669e0..11bb2b5755 100644
--- a/OsmAnd/src/net/osmand/plus/activities/IntermediatePointsDialog.java
+++ b/OsmAnd/src/net/osmand/plus/activities/IntermediatePointsDialog.java
@@ -14,7 +14,6 @@ import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.TargetPointsHelper;
import net.osmand.plus.TargetPointsHelper.TargetPoint;
-import net.osmand.plus.helpers.WaypointDialogHelper;
import net.osmand.util.MapUtils;
import android.app.Activity;
import android.app.AlertDialog;
diff --git a/OsmAnd/src/net/osmand/plus/dialogs/DirectionsDialogs.java b/OsmAnd/src/net/osmand/plus/dialogs/DirectionsDialogs.java
index 9cb28dbc0f..72b5d124ac 100644
--- a/OsmAnd/src/net/osmand/plus/dialogs/DirectionsDialogs.java
+++ b/OsmAnd/src/net/osmand/plus/dialogs/DirectionsDialogs.java
@@ -157,7 +157,7 @@ public class DirectionsDialogs {
}
}
- private static void setupPopUpMenuIcon(PopupMenu menu){
+ public static void setupPopUpMenuIcon(PopupMenu menu){
try {
Field[] fields = menu.getClass().getDeclaredFields();
for (Field field : fields) {
diff --git a/OsmAnd/src/net/osmand/plus/download/LocalIndexesFragment.java b/OsmAnd/src/net/osmand/plus/download/LocalIndexesFragment.java
index 1984b7babf..c7c632357d 100644
--- a/OsmAnd/src/net/osmand/plus/download/LocalIndexesFragment.java
+++ b/OsmAnd/src/net/osmand/plus/download/LocalIndexesFragment.java
@@ -26,6 +26,7 @@ import net.osmand.plus.activities.LocalIndexHelper.LocalIndexType;
import net.osmand.plus.activities.LocalIndexInfo;
import net.osmand.plus.activities.OsmandBaseExpandableListAdapter;
import net.osmand.plus.activities.OsmandExpandableListFragment;
+import net.osmand.plus.dialogs.DirectionsDialogs;
import net.osmand.plus.helpers.FileNameTranslationHelper;
import net.osmand.util.Algorithms;
import android.app.Activity;
@@ -34,13 +35,16 @@ import android.app.AlertDialog.Builder;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.TypedArray;
+import android.graphics.PorterDuff;
import android.graphics.Typeface;
+import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.StatFs;
import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.ActionBar;
import android.support.v7.view.ActionMode;
+import android.support.v7.widget.PopupMenu;
import android.text.method.LinkMovementMethod;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
@@ -172,25 +176,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
OnContextMenuClick listener = new OnContextMenuClick() {
@Override
public boolean onContextMenuClick(ArrayAdapter> adapter, int resId, int pos, boolean isChecked) {
- if (resId == R.string.local_index_mi_rename) {
- renameFile(info);
- } else if (resId == R.string.local_index_mi_restore) {
- new LocalIndexOperationTask(RESTORE_OPERATION).execute(info);
- } else if (resId == R.string.local_index_mi_delete) {
- Builder confirm = new AlertDialog.Builder(getActivity());
- confirm.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- new LocalIndexOperationTask(DELETE_OPERATION).execute(info);
- }
- });
- confirm.setNegativeButton(R.string.default_buttons_no, null);
- confirm.setMessage(getString(R.string.delete_confirmation_msg, info.getFileName()));
- confirm.show();
- } else if (resId == R.string.local_index_mi_backup) {
- new LocalIndexOperationTask(BACKUP_OPERATION).execute(info);
- }
- return true;
+ return performBasicOperation(resId, info);
}
};
if(info.getType() == LocalIndexType.MAP_DATA || info.getType() == LocalIndexType.SRTM_DATA){
@@ -204,7 +190,29 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
adapter.item(R.string.local_index_mi_rename).listen(listener).position(3).reg();
adapter.item(R.string.local_index_mi_delete).listen(listener).position(4).reg();
}
-
+
+ private boolean performBasicOperation(int resId, final LocalIndexInfo info) {
+ if (resId == R.string.local_index_mi_rename) {
+ renameFile(info);
+ } else if (resId == R.string.local_index_mi_restore) {
+ new LocalIndexOperationTask(RESTORE_OPERATION).execute(info);
+ } else if (resId == R.string.local_index_mi_delete) {
+ Builder confirm = new Builder(getActivity());
+ confirm.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ new LocalIndexOperationTask(DELETE_OPERATION).execute(info);
+ }
+ });
+ confirm.setNegativeButton(R.string.default_buttons_no, null);
+ confirm.setMessage(getString(R.string.delete_confirmation_msg, info.getFileName()));
+ confirm.show();
+ } else if (resId == R.string.local_index_mi_backup) {
+ new LocalIndexOperationTask(BACKUP_OPERATION).execute(info);
+ }
+ return true;
+ }
+
private void renameFile(LocalIndexInfo info) {
final File f = new File(info.getPathToData());
Builder b = new AlertDialog.Builder(getActivity());
@@ -922,6 +930,12 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
v = inflater.inflate(net.osmand.plus.R.layout.local_index_list_item, parent, false);
}
TextView viewName = ((TextView) v.findViewById(R.id.local_index_name));
+ v.findViewById(R.id.options).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ openPopUpMenu(v, child);
+ }
+ });
viewName.setText(getNameToDisplay(child));
if (child.isNotSupported()) {
viewName.setTextColor(warningColor);
@@ -980,6 +994,47 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
return v;
}
+ private void openPopUpMenu(View v, final LocalIndexInfo info) {
+ boolean light = getMyApplication().getSettings().isLightContent();
+ final PopupMenu optionsMenu = new PopupMenu(getActivity(), v);
+ DirectionsDialogs.setupPopUpMenuIcon(optionsMenu);
+ final boolean restore = info.isBackupedData();
+ Drawable backup = getActivity().getResources().getDrawable(R.drawable.ic_type_archive);
+ backup.mutate();
+ if (light) {
+ backup.setColorFilter(0xff727272, PorterDuff.Mode.MULTIPLY);
+ }
+ MenuItem item = optionsMenu.getMenu().add(restore? R.string.local_index_mi_restore : R.string.local_index_mi_backup)
+ .setIcon(backup);
+ item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
+ @Override
+ public boolean onMenuItemClick(MenuItem item) {
+ performBasicOperation(restore ? R.string.local_index_mi_restore : R.string.local_index_mi_backup, info);
+ return true;
+ }
+ });
+ item = optionsMenu.getMenu().add(R.string.favourites_context_menu_edit)
+ .setIcon(light ? R.drawable.ic_action_edit_light : R.drawable.ic_action_edit_dark);
+ item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
+ @Override
+ public boolean onMenuItemClick(MenuItem item) {
+ performBasicOperation(R.string.local_index_mi_rename, info);
+ return true;
+ }
+ });
+
+ item = optionsMenu.getMenu().add(R.string.favourites_context_menu_delete)
+ .setIcon(light ? R.drawable.ic_action_delete_light : R.drawable.ic_action_delete_dark);
+ item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
+ @Override
+ public boolean onMenuItemClick(MenuItem item) {
+ performBasicOperation(R.string.local_index_mi_delete, info);
+ return true;
+ }
+ });
+ optionsMenu.show();
+ }
+
private String getNameToDisplay(LocalIndexInfo child) {
String mapDescr = getMapDescription(child.getFileName());
String mapName = FileNameTranslationHelper.getFileName(ctx,
diff --git a/OsmAnd/src/net/osmand/plus/render/MapVectorLayer.java b/OsmAnd/src/net/osmand/plus/render/MapVectorLayer.java
index 822c331239..1990367fc0 100644
--- a/OsmAnd/src/net/osmand/plus/render/MapVectorLayer.java
+++ b/OsmAnd/src/net/osmand/plus/render/MapVectorLayer.java
@@ -1,7 +1,6 @@
package net.osmand.plus.render;
import net.osmand.core.android.MapRendererView;
-import net.osmand.core.android.TileSourceProxyProvider;
import net.osmand.core.jni.MapLayerConfiguration;
import net.osmand.core.jni.PointI;
import net.osmand.data.LatLon;