Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2015-08-25 23:16:48 +02:00
commit ff127bb846
3 changed files with 59 additions and 51 deletions

View file

@ -477,13 +477,17 @@ public class FavouritesDbHelper {
String s2 = o2.getName();
int i1 = Algorithms.extractIntegerNumber(s1);
int i2 = Algorithms.extractIntegerNumber(s2);
if(i1 == i2) {
String ot1 = Algorithms.extractIntegerPrefix(s1);
String ot2 = Algorithms.extractIntegerPrefix(s2);
return collator.compare(ot1, ot2);
String ot1 = Algorithms.extractIntegerPrefix(s1);
String ot2 = Algorithms.extractIntegerPrefix(s2);
int res = collator.compare(ot1, ot2);
if (res == 0) {
res = i1 - i2;
}
return i1 - i2;
if (res == 0) {
res = collator.compare(s1, s2);
}
return res;
}
};
return favoritesComparator;

View file

@ -54,7 +54,7 @@ public class FavoritesListFragment extends OsmAndListFragment implements SearchA
settings = getApplication().getSettings();
OsmandApplication app = getApplication();
favouritesAdapter = new FavouritesAdapter(activity, app.getFavorites().getFavouritePoints(),
!selectFavoriteMode);
false);
setListAdapter(favouritesAdapter);
setHasOptionsMenu(true);

View file

@ -1,5 +1,37 @@
package net.osmand.plus.activities;
import gnu.trove.list.array.TIntArrayList;
import java.io.File;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import net.osmand.access.AccessibleToast;
import net.osmand.data.FavouritePoint;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
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.IconsCache;
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.dialogs.DirectionsDialogs;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.helpers.ColorDialogs;
import net.osmand.plus.myplaces.FavoritesActivity;
import net.osmand.util.MapUtils;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
@ -37,39 +69,6 @@ import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import net.osmand.access.AccessibleToast;
import net.osmand.data.FavouritePoint;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
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.IconsCache;
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.dialogs.DirectionsDialogs;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.helpers.ColorDialogs;
import net.osmand.plus.myplaces.FavoritesActivity;
import net.osmand.util.MapUtils;
import java.io.File;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import gnu.trove.list.array.TIntArrayList;
public class FavoritesTreeFragment extends OsmandExpandableListFragment {
@ -605,6 +604,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
class FavouritesAdapter extends OsmandBaseExpandableListAdapter implements Filterable {
private static final boolean showOptionsButton = false;
Map<FavoriteGroup, List<FavouritePoint>> favoriteGroups = new LinkedHashMap<FavoriteGroup, List<FavouritePoint>>();
List<FavoriteGroup> groups = new ArrayList<FavoriteGroup>();
Filter myFilter;
@ -760,19 +760,23 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
TextView name = (TextView) row.findViewById(R.id.favourite_label);
TextView distanceText = (TextView) row.findViewById(R.id.distance);
ImageView icon = (ImageView) row.findViewById(R.id.favourite_icon);
ImageView options = (ImageView) row.findViewById(R.id.options);
options.setFocusable(false);
options.setImageDrawable(getMyApplication().getIconsCache()
.getContentIcon(R.drawable.ic_overflow_menu_white));
options.setVisibility(View.VISIBLE);
final FavouritePoint model = (FavouritePoint) getChild(groupPosition, childPosition);
row.setTag(model);
options.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showItemPopupOptionsMenu(model, v);
}
});
if (showOptionsButton) {
ImageView options = (ImageView) row.findViewById(R.id.options);
options.setFocusable(false);
options.setImageDrawable(getMyApplication().getIconsCache().getContentIcon(
R.drawable.ic_overflow_menu_white));
options.setVisibility(View.VISIBLE);
options.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showItemPopupOptionsMenu(model, v);
}
});
}
icon.setImageDrawable(FavoriteImageDrawable.getOrCreate(getActivity(), model.getColor(), 0));
LatLon lastKnownMapLocation = getMyApplication().getSettings().getLastKnownMapLocation();
int dist = (int) (MapUtils.getDistance(model.getLatitude(), model.getLongitude(),