Fix small issue with Favorites

This commit is contained in:
Alexander Sytnyk 2017-09-08 16:41:20 +03:00
parent fb56e39c98
commit 76485ca60b
3 changed files with 13 additions and 4 deletions

View file

@ -228,6 +228,7 @@ public class MapMarkersHelper {
return markersDbHelper.createGroupIfNeeded(name);
}
@Nullable
public String getGroupName(long id) {
return markersDbHelper.getGroupName(id);
}

View file

@ -221,8 +221,9 @@ public class MapMarkersDbHelper {
marker.history ? HISTORY_NEXT_VALUE : TAIL_NEXT_VALUE});
}
@Nullable
public String getGroupName(long id) {
String res = "";
String res = null;
SQLiteConnection db = openConnection(true);
if (db != null) {
try {

View file

@ -89,9 +89,16 @@ public class MapMarkersActiveAdapter extends RecyclerView.Adapter<MapMarkerItemV
holder.title.setText(marker.getName(mapActivity));
holder.description.setText(marker.groupKey == -1
? marker.creationDate + ""
: mapActivity.getMyApplication().getMapMarkersHelper().getGroupName(marker.groupKey));
String descr;
if (marker.groupKey != -1
&& (descr = mapActivity.getMyApplication().getMapMarkersHelper().getGroupName(marker.groupKey)) != null) {
if (descr.equals("")) {
descr = mapActivity.getString(R.string.shared_string_favorites);
}
} else {
descr = marker.creationDate + "";
}
holder.description.setText(descr);
holder.optionsBtn.setImageDrawable(iconsCache.getThemedIcon(R.drawable.ic_action_marker_passed));
holder.optionsBtn.setOnClickListener(new View.OnClickListener() {