Merge branch 'sasha_pasha_branch' of ssh://github.com/osmandapp/Osmand into sasha_pasha_branch

This commit is contained in:
PavelRatushny 2017-09-08 16:46:44 +03:00
commit 3b37dfa1c5
4 changed files with 18 additions and 5 deletions

View file

@ -9,8 +9,8 @@
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <LinearLayout
android:layout_height="56dp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="56dp"
android:background="?attr/selectableItemBackground"> android:background="?attr/selectableItemBackground">
<android.support.v7.widget.AppCompatImageView <android.support.v7.widget.AppCompatImageView
@ -45,6 +45,8 @@
android:id="@+id/map_marker_title" android:id="@+id/map_marker_title"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:textColor="?android:textColorPrimary" android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size" android:textSize="@dimen/default_list_text_size"
tools:text="Van Gogh Museum"/> tools:text="Van Gogh Museum"/>

View file

@ -228,6 +228,7 @@ public class MapMarkersHelper {
return markersDbHelper.createGroupIfNeeded(name); return markersDbHelper.createGroupIfNeeded(name);
} }
@Nullable
public String getGroupName(long id) { public String getGroupName(long id) {
return markersDbHelper.getGroupName(id); return markersDbHelper.getGroupName(id);
} }
@ -355,7 +356,7 @@ public class MapMarkersHelper {
} }
if (colorIndex == -1) { if (colorIndex == -1) {
if (mapMarkers.size() > 0) { if (mapMarkers.size() > 0) {
colorIndex = (mapMarkers.get(0).colorIndex + 1) % MAP_MARKERS_COLORS_COUNT; colorIndex = (mapMarkers.get(mapMarkers.size() - 1).colorIndex + 1) % MAP_MARKERS_COLORS_COUNT;
} else { } else {
colorIndex = 0; colorIndex = 0;
} }

View file

@ -221,8 +221,9 @@ public class MapMarkersDbHelper {
marker.history ? HISTORY_NEXT_VALUE : TAIL_NEXT_VALUE}); marker.history ? HISTORY_NEXT_VALUE : TAIL_NEXT_VALUE});
} }
@Nullable
public String getGroupName(long id) { public String getGroupName(long id) {
String res = ""; String res = null;
SQLiteConnection db = openConnection(true); SQLiteConnection db = openConnection(true);
if (db != null) { if (db != null) {
try { try {
@ -269,7 +270,7 @@ public class MapMarkersDbHelper {
boolean active = query.getInt(4) == 1; boolean active = query.getInt(4) == 1;
long added = query.getLong(5); long added = query.getLong(5);
long visited = query.getLong(6); long visited = query.getLong(6);
long groupKey = query.getInt(7); long groupKey = query.getLong(7);
int colorIndex = query.getInt(8); int colorIndex = query.getInt(8);
long nextKey = query.getLong(9); long nextKey = query.getLong(9);

View file

@ -89,7 +89,16 @@ public class MapMarkersActiveAdapter extends RecyclerView.Adapter<MapMarkerItemV
holder.title.setText(marker.getName(mapActivity)); holder.title.setText(marker.getName(mapActivity));
holder.description.setText(marker.creationDate + ""); 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.setImageDrawable(iconsCache.getThemedIcon(R.drawable.ic_action_marker_passed));
holder.optionsBtn.setOnClickListener(new View.OnClickListener() { holder.optionsBtn.setOnClickListener(new View.OnClickListener() {