Add bookmarks to Nearby map (#3728)

* Remove bookmark button from row button set and put to upper level list item

* Fix npe caused by lookinf for parent fragment, we don't have one anymore

* style

* Add new icons for bookmarked places

* Change bookmarked info when bookmarked

* Add pic field to bookmark dao so that we can retrieve them later

* Put bookmarks as the first item of list

* Add bookmark as a label

* Add logic to filter nearby

* remove unneeded changes

* fix word

* Remove logs

* Remove unused part of code

* Fix tests

* Remove logs

* simplify icon picking

* remove redundant margin left

* Remove non needed map and swap

* Add main thread annotation

* Fix tests
This commit is contained in:
neslihanturan 2020-05-21 13:58:27 +03:00 committed by GitHub
parent 384afa6c44
commit 3f31c3eded
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 161 additions and 90 deletions

View file

@ -9,6 +9,7 @@ import android.os.RemoteException;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import fr.free.nrw.commons.nearby.NearbyController;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -74,8 +75,10 @@ public class BookmarkLocationsDao {
boolean bookmarkExists = findBookmarkLocation(bookmarkLocation); boolean bookmarkExists = findBookmarkLocation(bookmarkLocation);
if (bookmarkExists) { if (bookmarkExists) {
deleteBookmarkLocation(bookmarkLocation); deleteBookmarkLocation(bookmarkLocation);
NearbyController.updateMarkerLabelListBookmark(bookmarkLocation, false);
} else { } else {
addBookmarkLocation(bookmarkLocation); addBookmarkLocation(bookmarkLocation);
NearbyController.updateMarkerLabelListBookmark(bookmarkLocation, true);
} }
return !bookmarkExists; return !bookmarkExists;
} }
@ -160,10 +163,9 @@ public class BookmarkLocationsDao {
location, location,
cursor.getString(cursor.getColumnIndex(Table.COLUMN_CATEGORY)), cursor.getString(cursor.getColumnIndex(Table.COLUMN_CATEGORY)),
builder.build(), builder.build(),
null, cursor.getString(cursor.getColumnIndex(Table.COLUMN_PIC)),
null null
); );
// TODO: add pic and destroyed to bookmark location dao
} }
private ContentValues toContentValues(Place bookmarkLocation) { private ContentValues toContentValues(Place bookmarkLocation) {

View file

@ -4,7 +4,9 @@ import android.os.Parcel;
import androidx.annotation.DrawableRes; import androidx.annotation.DrawableRes;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import fr.free.nrw.commons.R; import fr.free.nrw.commons.R;
@ -17,6 +19,7 @@ import fr.free.nrw.commons.R;
*/ */
public enum Label { public enum Label {
BOOKMARKS("BOOKMARK", R.drawable.ic_filled_star_24dp),
BUILDING("Q41176", R.drawable.round_icon_generic_building), BUILDING("Q41176", R.drawable.round_icon_generic_building),
HOUSE("Q3947", R.drawable.round_icon_house), HOUSE("Q3947", R.drawable.round_icon_house),
COTTAGE("Q5783996", R.drawable.round_icon_house), COTTAGE("Q5783996", R.drawable.round_icon_house),
@ -92,4 +95,8 @@ public enum Label {
Label label = TEXT_TO_DESCRIPTION.get(text); Label label = TEXT_TO_DESCRIPTION.get(text);
return label == null ? UNKNOWN : label; return label == null ? UNKNOWN : label;
} }
public static List<Label> valuesAsList() {
return Arrays.asList(Label.values());
}
} }

View file

@ -4,6 +4,7 @@ import android.content.Context;
import android.content.res.Resources; import android.content.res.Resources;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import androidx.annotation.MainThread;
import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat; import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat;
import com.mapbox.mapboxsdk.annotations.IconFactory; import com.mapbox.mapboxsdk.annotations.IconFactory;
@ -14,6 +15,7 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.ListIterator;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
@ -166,36 +168,6 @@ public class NearbyController {
VectorDrawableCompat vectorDrawable = null; VectorDrawableCompat vectorDrawable = null;
VectorDrawableCompat vectorDrawableGreen = null; VectorDrawableCompat vectorDrawableGreen = null;
VectorDrawableCompat vectorDrawableGrey = null; VectorDrawableCompat vectorDrawableGrey = null;
try {
vectorDrawable = VectorDrawableCompat.create(
context.getResources(), R.drawable.ic_custom_bookmark_marker, context.getTheme()
);
} catch (Resources.NotFoundException e) {
// ignore when running tests.
}
if (vectorDrawable != null) {
Bitmap icon = UiUtils.getBitmap(vectorDrawable);
for (Place place : bookmarkplacelist) {
String distance = formatDistanceBetween(curLatLng, place.location);
place.setDistance(distance);
NearbyBaseMarker nearbyBaseMarker = new NearbyBaseMarker();
nearbyBaseMarker.title(place.name);
nearbyBaseMarker.position(
new com.mapbox.mapboxsdk.geometry.LatLng(
place.location.getLatitude(),
place.location.getLongitude()));
nearbyBaseMarker.place(place);
nearbyBaseMarker.icon(IconFactory.getInstance(context)
.fromBitmap(icon));
placeList.remove(place);
baseMarkerOptions.add(nearbyBaseMarker);
}
}
vectorDrawable = null; vectorDrawable = null;
try { try {
vectorDrawable = VectorDrawableCompat.create( vectorDrawable = VectorDrawableCompat.create(
@ -255,4 +227,19 @@ public class NearbyController {
public LatLng curLatLng; // Current location when this places are populated public LatLng curLatLng; // Current location when this places are populated
public LatLng searchLatLng; // Search location for finding this places public LatLng searchLatLng; // Search location for finding this places
} }
/**
* Updates makerLabelList item isBookmarked value
* @param place place which is bookmarked
* @param isBookmarked true is bookmarked, false if bookmark removed
*/
@MainThread
public static void updateMarkerLabelListBookmark(Place place, boolean isBookmarked) {
for (ListIterator<MarkerPlaceGroup> iter = markerLabelList.listIterator(); iter.hasNext();) {
MarkerPlaceGroup markerPlaceGroup = iter.next();
if (markerPlaceGroup.getPlace().getWikiDataEntityId().equals(place.getWikiDataEntityId())) {
iter.set(new MarkerPlaceGroup(markerPlaceGroup.getMarker(), isBookmarked, place));
}
}
}
} }

View file

@ -20,6 +20,7 @@ import java.util.ArrayList;
import fr.free.nrw.commons.R; import fr.free.nrw.commons.R;
import fr.free.nrw.commons.nearby.presenter.NearbyParentFragmentPresenter; import fr.free.nrw.commons.nearby.presenter.NearbyParentFragmentPresenter;
import java.util.Collections;
public class NearbyFilterSearchRecyclerViewAdapter public class NearbyFilterSearchRecyclerViewAdapter
extends RecyclerView.Adapter<NearbyFilterSearchRecyclerViewAdapter.RecyclerViewHolder> extends RecyclerView.Adapter<NearbyFilterSearchRecyclerViewAdapter.RecyclerViewHolder>

View file

@ -54,9 +54,7 @@ public class PlaceRenderer extends Renderer<Place> {
@BindView(R.id.iconOverflow) LinearLayout iconOverflow; @BindView(R.id.iconOverflow) LinearLayout iconOverflow;
@BindView(R.id.cameraButtonText) TextView cameraButtonText; @BindView(R.id.cameraButtonText) TextView cameraButtonText;
@BindView(R.id.galleryButtonText) TextView galleryButtonText; @BindView(R.id.galleryButtonText) TextView galleryButtonText;
@BindView(R.id.bookmarkRowButton) LinearLayout bookmarkButton; @BindView(R.id.bookmarkButtonImage) ImageView bookmarkButtonImage;
@BindView(R.id.bookmarkButtonText) TextView bookmarkButtonText;
@BindView(R.id.bookmarkRowButtonImage) ImageView bookmarkButtonImage;
@BindView(R.id.directionsButtonText) TextView directionsButtonText; @BindView(R.id.directionsButtonText) TextView directionsButtonText;
@BindView(R.id.iconOverflowText) TextView iconOverflowText; @BindView(R.id.iconOverflowText) TextView iconOverflowText;
@ -172,7 +170,7 @@ public class PlaceRenderer extends Renderer<Place> {
} }
}); });
bookmarkButton.setOnClickListener(view4 -> { bookmarkButtonImage.setOnClickListener(view4 -> {
if (applicationKvStore.getBoolean("login_skipped", false)) { if (applicationKvStore.getBoolean("login_skipped", false)) {
// prompt the user to login // prompt the user to login
new AlertDialog.Builder(getContext()) new AlertDialog.Builder(getContext())
@ -192,8 +190,7 @@ public class PlaceRenderer extends Renderer<Place> {
onBookmarkClick.onClick(); onBookmarkClick.onClick();
} }
else { else {
((NearbyParentFragment) (fragment.getParentFragment())). ((NearbyParentFragment) (fragment)).updateMarker(isBookmarked, place, null);
updateMarker(isBookmarked, place, null);
} }
} }
}); });

View file

@ -17,6 +17,7 @@ import android.content.IntentFilter;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.drawable.VectorDrawable;
import android.os.Bundle; import android.os.Bundle;
import android.provider.Settings; import android.provider.Settings;
import android.util.Log; import android.util.Log;
@ -34,6 +35,8 @@ import android.widget.RelativeLayout;
import android.widget.SearchView; import android.widget.SearchView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.recyclerview.widget.DividerItemDecoration; import androidx.recyclerview.widget.DividerItemDecoration;
@ -415,7 +418,7 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL); linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
recyclerView.setLayoutManager(linearLayoutManager); recyclerView.setLayoutManager(linearLayoutManager);
nearbyFilterSearchRecyclerViewAdapter = new NearbyFilterSearchRecyclerViewAdapter(getContext(),new ArrayList<>(TEXT_TO_DESCRIPTION.values()), recyclerView); nearbyFilterSearchRecyclerViewAdapter = new NearbyFilterSearchRecyclerViewAdapter(getContext(), new ArrayList<>(Label.valuesAsList()), recyclerView);
nearbyFilterSearchRecyclerViewAdapter.setCallback(new NearbyFilterSearchRecyclerViewAdapter.Callback() { nearbyFilterSearchRecyclerViewAdapter.setCallback(new NearbyFilterSearchRecyclerViewAdapter.Callback() {
@Override @Override
public void setCheckboxUnknown() { public void setCheckboxUnknown() {
@ -1131,7 +1134,8 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
// When label filter is engaged // When label filter is engaged
// then compare it against place's label // then compare it against place's label
if (selectedLabels != null && (selectedLabels.size() != 0 || !filterForPlaceState) if (selectedLabels != null && (selectedLabels.size() != 0 || !filterForPlaceState)
&& !selectedLabels.contains(place.getLabel())) { && (!selectedLabels.contains(place.getLabel())
&& !(selectedLabels.contains(Label.BOOKMARKS) && markerPlaceGroup.getIsBookmarked()))) {
continue; continue;
} }
@ -1172,24 +1176,9 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
public void updateMarker(boolean isBookmarked, Place place, @Nullable fr.free.nrw.commons.location.LatLng curLatLng) { public void updateMarker(boolean isBookmarked, Place place, @Nullable fr.free.nrw.commons.location.LatLng curLatLng) {
addPlaceToNearbyList(place); addPlaceToNearbyList(place);
VectorDrawableCompat vectorDrawable; VectorDrawableCompat vectorDrawable = VectorDrawableCompat.create(
if (isBookmarked) { getContext().getResources(), getIconFor(place, isBookmarked), getContext().getTheme());
vectorDrawable = VectorDrawableCompat.create(
getContext().getResources(), R.drawable.ic_custom_bookmark_marker, getContext().getTheme()
);
} else if (!place.pic.trim().isEmpty()) {
vectorDrawable = VectorDrawableCompat.create( // Means place has picture
getContext().getResources(), R.drawable.ic_custom_map_marker_green, getContext().getTheme()
);
} else if (!place.destroyed.trim().isEmpty()) { // Means place is destroyed
vectorDrawable = VectorDrawableCompat.create( // Means place has picture
getContext().getResources(), R.drawable.ic_custom_map_marker_grey, getContext().getTheme()
);
} else {
vectorDrawable = VectorDrawableCompat.create(
getContext().getResources(), R.drawable.ic_custom_map_marker, getContext().getTheme()
);
}
for (Marker marker : mapBox.getMarkers()) { for (Marker marker : mapBox.getMarkers()) {
if (marker.getTitle() != null && marker.getTitle().equals(place.getName())) { if (marker.getTitle() != null && marker.getTitle().equals(place.getName())) {
@ -1213,6 +1202,22 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
} }
} }
private @DrawableRes int getIconFor(Place place, Boolean isBookmarked) {
if (!place.pic.trim().isEmpty()) {
return (isBookmarked ?
R.drawable.ic_custom_map_marker_green_bookmarked :
R.drawable.ic_custom_map_marker_green);
} else if (!place.destroyed.trim().isEmpty()) { // Means place is destroyed
return (isBookmarked ?
R.drawable.ic_custom_map_marker_grey_bookmarked :
R.drawable.ic_custom_map_marker_grey);
} else {
return (isBookmarked ?
R.drawable.ic_custom_map_marker_blue_bookmarked :
R.drawable.ic_custom_map_marker);
}
}
/** /**
* Removes all markers except current location marker, an icon has been used * Removes all markers except current location marker, an icon has been used
* but it is transparent more than grey(as the name of the icon might suggest) * but it is transparent more than grey(as the name of the icon might suggest)

View file

@ -1,7 +1,9 @@
package fr.free.nrw.commons.nearby.presenter; package fr.free.nrw.commons.nearby.presenter;
import android.util.Log;
import android.view.View; import android.view.View;
import androidx.annotation.MainThread;
import com.mapbox.mapboxsdk.annotations.Marker; import com.mapbox.mapboxsdk.annotations.Marker;
import java.lang.reflect.Proxy; import java.lang.reflect.Proxy;
@ -301,6 +303,7 @@ public class NearbyParentFragmentPresenter
} }
@Override @Override
@MainThread
public void updateMapMarkersToController(List<NearbyBaseMarker> nearbyBaseMarkers) { public void updateMapMarkersToController(List<NearbyBaseMarker> nearbyBaseMarkers) {
NearbyController.markerExistsMap = new HashMap<>(); NearbyController.markerExistsMap = new HashMap<>();
NearbyController.markerNeedPicMap = new HashMap<>(); NearbyController.markerNeedPicMap = new HashMap<>();
@ -308,7 +311,7 @@ public class NearbyParentFragmentPresenter
for (int i = 0; i < nearbyBaseMarkers.size(); i++) { for (int i = 0; i < nearbyBaseMarkers.size(); i++) {
NearbyBaseMarker nearbyBaseMarker = nearbyBaseMarkers.get(i); NearbyBaseMarker nearbyBaseMarker = nearbyBaseMarkers.get(i);
NearbyController.markerLabelList.add( NearbyController.markerLabelList.add(
new MarkerPlaceGroup(nearbyBaseMarkers.get(i).getMarker(), bookmarkLocationDao.findBookmarkLocation(nearbyBaseMarkers.get(i).getPlace()), nearbyBaseMarker.getPlace())); new MarkerPlaceGroup(nearbyBaseMarker.getMarker(), bookmarkLocationDao.findBookmarkLocation(nearbyBaseMarker.getPlace()), nearbyBaseMarker.getPlace()));
//TODO: fix bookmark location //TODO: fix bookmark location
NearbyController.markerExistsMap.put((nearbyBaseMarkers.get(i).getPlace().hasWikidataLink()), nearbyBaseMarkers.get(i).getMarker()); NearbyController.markerExistsMap.put((nearbyBaseMarkers.get(i).getPlace().hasWikidataLink()), nearbyBaseMarkers.get(i).getMarker());
NearbyController.markerNeedPicMap.put(((nearbyBaseMarkers.get(i).getPlace().pic == null) ? true : false), nearbyBaseMarkers.get(i).getMarker()); NearbyController.markerNeedPicMap.put(((nearbyBaseMarkers.get(i).getPlace().pic == null) ? true : false), nearbyBaseMarkers.get(i).getMarker());

View file

@ -0,0 +1,29 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="28dp"
android:viewportWidth="24"
android:viewportHeight="28">
<path
android:pathData="M6.072,22.223a6.031,3.672 0,1 0,12.062 0a6.031,3.672 0,1 0,-12.062 0z"
android:strokeAlpha="0.1"
android:strokeWidth="1"
android:fillColor="#000000"
android:fillAlpha="0.1"/>
<path
android:pathData="M11.575,11.62C10.689,11.462 9.902,10.759 9.625,9.878 9.553,9.65 9.535,9.499 9.538,9.14c0.004,-0.397 0.019,-0.492 0.13,-0.787 0.236,-0.631 0.646,-1.099 1.212,-1.382 0.386,-0.193 0.709,-0.272 1.116,-0.272 0.676,0 1.263,0.247 1.744,0.734 0.355,0.359 0.541,0.682 0.657,1.136 0.327,1.278 -0.442,2.611 -1.723,2.987 -0.282,0.083 -0.817,0.114 -1.099,0.063z"
android:strokeWidth="1"
android:fillColor="#00ff00"/>
<path
android:pathData="M11.617,21.707C10.518,20.424 9.338,18.864 8.395,17.449 6.524,14.641 5.455,12.305 5.102,10.255 5.014,9.744 5.006,8.628 5.088,8.137 5.348,6.561 6.043,5.221 7.158,4.148 9.148,2.231 12.016,1.668 14.593,2.688c2.043,0.809 3.607,2.581 4.162,4.719 0.174,0.67 0.204,0.933 0.203,1.761 -0.001,0.81 -0.035,1.098 -0.22,1.857 -0.614,2.524 -2.571,5.977 -5.383,9.501 -0.645,0.809 -1.321,1.61 -1.358,1.61 -0.008,0 -0.179,-0.193 -0.381,-0.428zM12.617,11.603c0.783,-0.188 1.457,-0.795 1.738,-1.564 0.516,-1.415 -0.317,-2.962 -1.783,-3.312 -0.216,-0.052 -0.317,-0.059 -0.661,-0.047 -0.354,0.012 -0.441,0.025 -0.682,0.104 -0.673,0.221 -1.205,0.695 -1.506,1.344 -0.176,0.38 -0.218,0.584 -0.217,1.054 0.001,0.324 0.014,0.452 0.064,0.635 0.266,0.97 1.077,1.689 2.079,1.844 0.243,0.038 0.68,0.012 0.968,-0.057z"
android:strokeWidth="1"
android:fillColor="#006699"
android:strokeColor="#003b59"
android:fillAlpha="1"/>
<path
android:pathData="M17.9025,7.0798 L14.1612,6.7552 12.7003,3.3154c-0.2628,-0.6261 -1.1595,-0.6261 -1.4223,0L9.817,6.7629 6.0835,7.0798C5.4032,7.134 5.125,7.9842 5.6429,8.4326l2.8369,2.4581 -0.8503,3.6485c-0.1546,0.6648 0.5643,1.1904 1.1518,0.8348l3.2079,-1.9325 3.2079,1.9402c0.5875,0.3556 1.3064,-0.1701 1.1518,-0.8348L15.4985,10.8907 18.3354,8.4326C18.8533,7.9842 18.5827,7.134 17.9025,7.0798Z"
android:strokeAlpha="1"
android:strokeWidth="1"
android:fillColor="#f84d4d"
android:fillAlpha="1"
android:strokeColor="#003b59"/>
</vector>

View file

@ -0,0 +1,29 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="28dp"
android:viewportWidth="24"
android:viewportHeight="28">
<path
android:pathData="M6.072,22.223a6.031,3.672 0,1 0,12.062 0a6.031,3.672 0,1 0,-12.062 0z"
android:strokeAlpha="0.1"
android:strokeWidth="1"
android:fillColor="#000000"
android:fillAlpha="0.1"/>
<path
android:pathData="M11.575,11.62C10.689,11.462 9.902,10.759 9.625,9.878 9.553,9.65 9.535,9.499 9.538,9.14c0.004,-0.397 0.019,-0.492 0.13,-0.787 0.236,-0.631 0.646,-1.099 1.212,-1.382 0.386,-0.193 0.709,-0.272 1.116,-0.272 0.676,0 1.263,0.247 1.744,0.734 0.355,0.359 0.541,0.682 0.657,1.136 0.327,1.278 -0.442,2.611 -1.723,2.987 -0.282,0.083 -0.817,0.114 -1.099,0.063z"
android:strokeWidth="1"
android:fillColor="#00ff00"/>
<path
android:pathData="M11.617,21.707C10.518,20.424 9.338,18.864 8.395,17.449 6.524,14.641 5.455,12.305 5.102,10.255 5.014,9.744 5.006,8.628 5.088,8.137 5.348,6.561 6.043,5.221 7.158,4.148 9.148,2.231 12.016,1.668 14.593,2.688c2.043,0.809 3.607,2.581 4.162,4.719 0.174,0.67 0.204,0.933 0.203,1.761 -0.001,0.81 -0.035,1.098 -0.22,1.857 -0.614,2.524 -2.571,5.977 -5.383,9.501 -0.645,0.809 -1.321,1.61 -1.358,1.61 -0.008,0 -0.179,-0.193 -0.381,-0.428zM12.617,11.603c0.783,-0.188 1.457,-0.795 1.738,-1.564 0.516,-1.415 -0.317,-2.962 -1.783,-3.312 -0.216,-0.052 -0.317,-0.059 -0.661,-0.047 -0.354,0.012 -0.441,0.025 -0.682,0.104 -0.673,0.221 -1.205,0.695 -1.506,1.344 -0.176,0.38 -0.218,0.584 -0.217,1.054 0.001,0.324 0.014,0.452 0.064,0.635 0.266,0.97 1.077,1.689 2.079,1.844 0.243,0.038 0.68,0.012 0.968,-0.057z"
android:strokeWidth="1"
android:fillColor="#4caf50"
android:strokeColor="#003b59"
android:fillAlpha="1"/>
<path
android:pathData="M17.9025,7.0798 L14.1612,6.7552 12.7003,3.3154c-0.2628,-0.6261 -1.1595,-0.6261 -1.4223,0L9.817,6.7629 6.0835,7.0798C5.4032,7.134 5.125,7.9842 5.6429,8.4326l2.8369,2.4581 -0.8503,3.6485c-0.1546,0.6648 0.5643,1.1904 1.1518,0.8348l3.2079,-1.9325 3.2079,1.9402c0.5875,0.3556 1.3064,-0.1701 1.1518,-0.8348L15.4985,10.8907 18.3354,8.4326C18.8533,7.9842 18.5827,7.134 17.9025,7.0798Z"
android:strokeAlpha="1"
android:strokeWidth="1"
android:fillColor="#f84d4d"
android:fillAlpha="1"
android:strokeColor="#003b59"/>
</vector>

View file

@ -0,0 +1,29 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="28dp"
android:viewportWidth="24"
android:viewportHeight="28">
<path
android:pathData="M6.072,22.223a6.031,3.672 0,1 0,12.062 0a6.031,3.672 0,1 0,-12.062 0z"
android:strokeAlpha="0.1"
android:strokeWidth="1"
android:fillColor="#000000"
android:fillAlpha="0.1"/>
<path
android:pathData="M11.575,11.62C10.689,11.462 9.902,10.759 9.625,9.878 9.553,9.65 9.535,9.499 9.538,9.14c0.004,-0.397 0.019,-0.492 0.13,-0.787 0.236,-0.631 0.646,-1.099 1.212,-1.382 0.386,-0.193 0.709,-0.272 1.116,-0.272 0.676,0 1.263,0.247 1.744,0.734 0.355,0.359 0.541,0.682 0.657,1.136 0.327,1.278 -0.442,2.611 -1.723,2.987 -0.282,0.083 -0.817,0.114 -1.099,0.063z"
android:strokeWidth="1"
android:fillColor="#00ff00"/>
<path
android:pathData="M11.617,21.707C10.518,20.424 9.338,18.864 8.395,17.449 6.524,14.641 5.455,12.305 5.102,10.255 5.014,9.744 5.006,8.628 5.088,8.137 5.348,6.561 6.043,5.221 7.158,4.148 9.148,2.231 12.016,1.668 14.593,2.688c2.043,0.809 3.607,2.581 4.162,4.719 0.174,0.67 0.204,0.933 0.203,1.761 -0.001,0.81 -0.035,1.098 -0.22,1.857 -0.614,2.524 -2.571,5.977 -5.383,9.501 -0.645,0.809 -1.321,1.61 -1.358,1.61 -0.008,0 -0.179,-0.193 -0.381,-0.428zM12.617,11.603c0.783,-0.188 1.457,-0.795 1.738,-1.564 0.516,-1.415 -0.317,-2.962 -1.783,-3.312 -0.216,-0.052 -0.317,-0.059 -0.661,-0.047 -0.354,0.012 -0.441,0.025 -0.682,0.104 -0.673,0.221 -1.205,0.695 -1.506,1.344 -0.176,0.38 -0.218,0.584 -0.217,1.054 0.001,0.324 0.014,0.452 0.064,0.635 0.266,0.97 1.077,1.689 2.079,1.844 0.243,0.038 0.68,0.012 0.968,-0.057z"
android:strokeWidth="1"
android:fillColor="#454547"
android:strokeColor="#003b59"
android:fillAlpha="1"/>
<path
android:pathData="M17.9025,7.0798 L14.1612,6.7552 12.7003,3.3154c-0.2628,-0.6261 -1.1595,-0.6261 -1.4223,0L9.817,6.7629 6.0835,7.0798C5.4032,7.134 5.125,7.9842 5.6429,8.4326l2.8369,2.4581 -0.8503,3.6485c-0.1546,0.6648 0.5643,1.1904 1.1518,0.8348l3.2079,-1.9325 3.2079,1.9402c0.5875,0.3556 1.3064,-0.1701 1.1518,-0.8348L15.4985,10.8907 18.3354,8.4326C18.8533,7.9842 18.5827,7.134 17.9025,7.0798Z"
android:strokeAlpha="1"
android:strokeWidth="1"
android:fillColor="#f84d4d"
android:fillAlpha="1"
android:strokeColor="#003b59"/>
</vector>

View file

@ -6,13 +6,21 @@
android:focusableInTouchMode="true" android:focusableInTouchMode="true"
android:minHeight="@dimen/large_height"> android:minHeight="@dimen/large_height">
<ImageView
android:id="@+id/bookmarkButtonImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/standard_gap"
android:tint="?attr/rowButtonColor"
app:srcCompat="@drawable/ic_round_star_border_24px" />
<com.facebook.drawee.view.SimpleDraweeView <com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/icon" android:id="@+id/icon"
android:layout_width="@dimen/dimen_40" android:layout_width="@dimen/dimen_40"
android:layout_height="@dimen/dimen_40" android:layout_height="@dimen/dimen_40"
android:layout_marginLeft="@dimen/standard_gap"
android:layout_marginStart="@dimen/standard_gap" android:layout_marginStart="@dimen/standard_gap"
android:layout_marginTop="@dimen/standard_gap" android:layout_marginTop="@dimen/standard_gap"
android:layout_alignStart="@id/bookmarkButtonImage"
android:scaleType="centerCrop" android:scaleType="centerCrop"
tools:src="@drawable/empty_photo" tools:src="@drawable/empty_photo"
/> />

View file

@ -10,34 +10,6 @@
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
> >
<LinearLayout
android:id="@+id/bookmarkRowButton"
android:layout_width="@dimen/dimen_0"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="@dimen/standard_gap"
android:clickable="true"
android:orientation="vertical"
android:background="@drawable/button_background_selector"
>
<ImageView
android:id="@+id/bookmarkRowButtonImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
app:srcCompat="@drawable/ic_round_star_border_24px"
android:tint="?attr/bookmarkButtonColor"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/bookmarkButtonText"
android:paddingTop="@dimen/activity_margin_horizontal"
android:layout_gravity="center_horizontal"
android:text="CAMERA"
android:visibility="gone"
/>
</LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/cameraButton" android:id="@+id/cameraButton"
android:layout_width="@dimen/dimen_0" android:layout_width="@dimen/dimen_0"

View file

@ -35,7 +35,8 @@ class BookMarkLocationDaoTest {
COLUMN_WIKIDATA_LINK, COLUMN_WIKIDATA_LINK,
COLUMN_COMMONS_LINK, COLUMN_COMMONS_LINK,
COLUMN_LAT, COLUMN_LAT,
COLUMN_LONG) COLUMN_LONG,
COLUMN_PIC)
private val client: ContentProviderClient = mock() private val client: ContentProviderClient = mock()
private val database: SQLiteDatabase = mock() private val database: SQLiteDatabase = mock()
private val captor = argumentCaptor<ContentValues>() private val captor = argumentCaptor<ContentValues>()
@ -93,6 +94,7 @@ class BookMarkLocationDaoTest {
assertEquals(builder.build().wikipediaLink, it.siteLinks.wikipediaLink) assertEquals(builder.build().wikipediaLink, it.siteLinks.wikipediaLink)
assertEquals(builder.build().wikidataLink, it.siteLinks.wikidataLink) assertEquals(builder.build().wikidataLink, it.siteLinks.wikidataLink)
assertEquals(builder.build().commonsLink, it.siteLinks.commonsLink) assertEquals(builder.build().commonsLink, it.siteLinks.commonsLink)
assertEquals("picName",it.pic)
} }
} }
} }
@ -256,7 +258,7 @@ class BookMarkLocationDaoTest {
for (i in 0 until rowCount) { for (i in 0 until rowCount) {
addRow(listOf("placeName", "placeDescription","placeCategory", exampleLabel.text, exampleLabel.icon, addRow(listOf("placeName", "placeDescription","placeCategory", exampleLabel.text, exampleLabel.icon,
exampleUri, builder.build().wikipediaLink, builder.build().wikidataLink, builder.build().commonsLink, exampleUri, builder.build().wikipediaLink, builder.build().wikidataLink, builder.build().commonsLink,
exampleLocation.latitude, exampleLocation.longitude)) exampleLocation.latitude, exampleLocation.longitude, "picName"))
} }
} }
} }