use of net.osmand.plus.activities.FavoritesListFragment.FavouritesAdapter in project Osmand by osmandapp.
the class FavoriteDialogs method createReplaceFavouriteDialog.
public static Dialog createReplaceFavouriteDialog(final Activity activity, final Bundle args) {
final FavouritesDbHelper helper = ((OsmandApplication) activity.getApplication()).getFavorites();
final List<FavouritePoint> points = new ArrayList<FavouritePoint>(helper.getFavouritePoints());
final FavouritesAdapter favouritesAdapter = new FavouritesAdapter(activity, ((OsmandApplication) activity.getApplication()).getFavorites().getFavouritePoints(), false);
final Dialog[] dlgHolder = new Dialog[1];
OnItemClickListener click = new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
confirmReplace(activity, args, helper, favouritesAdapter, dlgHolder, position);
}
};
if (activity instanceof MapActivity) {
favouritesAdapter.updateLocation(((MapActivity) activity).getMapLocation());
}
if (points.size() == 0) {
Toast.makeText(activity, activity.getString(R.string.fav_points_not_exist), Toast.LENGTH_SHORT).show();
return null;
}
return showFavoritesDialog(activity, favouritesAdapter, click, null, dlgHolder, true);
}
Aggregations