Fixes #1450 Add filter to nearby (#3178)

* Add layout items for nearby filter list and filter item

(cherry picked from commit b96f8a68ce)

* Edit nearby query

(cherry picked from commit 1f3c8c8deb)

* Add filter items to nearby parent fragment xml

(cherry picked from commit d0beadd0e0)

* Add icon for green marker

(cherry picked from commit f65ca0387a)

* Add layout util file to organize layout utilities

(cherry picked from commit 5c57939245)

* Add pic parameter to nearby result item

(cherry picked from commit 86007e4bb6)

* Add pic parameter to place type

(cherry picked from commit 25c358b67f)

* Add green marker styling

(cherry picked from commit 929c92d887)

* Inıt search layouts on Nearby parent

(cherry picked from commit 2ac38a1919)

* Style green markers at nearby controller

(cherry picked from commit 3e08f39f8e)

* Edit bookmark daos to include pic to tables

(cherry picked from commit 48d69edf3b)

* TODO foc bookmark dao item but works now

(cherry picked from commit f748399720)

* Style nearby filter area

(cherry picked from commit 6267e488b0)

* fix style of filter tab

(cherry picked from commit 5f843bf366)

* Add nearby list adapter

(cherry picked from commit 56334afe03)

* Current status, list size is working, visibility working, filter mechanism is ready

(cherry picked from commit 7d75c9c589)

* Filtering works

(cherry picked from commit 8a13cf7728)

* Filter function works

(cherry picked from commit 78368a2c0c)

* Fix style issues

(cherry picked from commit 2204f70255)

* Add divider to recyclerview

(cherry picked from commit c8100b55d7)

* Hide bottom sheets accordingly

(cherry picked from commit c5deba8b0b)

* Code cleanup

(cherry picked from commit cf8f64f3cb)

* Add actions to chips

* Fetch destroyed information from servers

* Add destroyed places icon

* Make chip filter functions work

* Revert irrelevant changes

* Revert accidentally replaced strings

* Remove unneeded lines

* Remove only places expalanation from trings

* Do not filter if nearby places are not loaded

* Add triple checkbox for add none and neutral

* Make tri checkbox work

* Fix travis issue

* Add coments

* fix search this area button locaton

* Set initial place type state and recover it between each populate places
This commit is contained in:
neslihanturan 2019-11-28 11:22:32 +03:00 committed by Josephine Lim
parent 5c6ab3b253
commit b3c11842f3
35 changed files with 1264 additions and 66 deletions

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/current_marker_stroke" android:state_checked="true" />
<item android:color="@color/cardview_light_background" />
</selector>

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="@color/button_blue"
android:pathData="M19,3L5,3c-1.11,0 -2,0.9 -2,2v14c0,1.1 0.89,2 2,2h14c1.11,0 2,-0.9 2,-2L21,5c0,-1.1 -0.89,-2 -2,-2zM10,17l-5,-5 1.41,-1.41L10,14.17l7.59,-7.59L19,8l-9,9z"/>
</vector>

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="@color/button_blue"
android:pathData="M19,5v14H5V5h14m0,-2H5c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2V5c0,-1.1 -0.9,-2 -2,-2z"/>
</vector>

View file

@ -0,0 +1,23 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="28dp"
android:viewportWidth="24.0"
android:viewportHeight="28.0">
<path
android:fillAlpha="0.1"
android:fillColor="#48000000"
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:strokeWidth="1" />
<path
android:fillAlpha="1"
android:fillColor="#4D000000"
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" />
<path
android:fillAlpha="1"
android:fillColor="#7CE4E0D9"
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:strokeAlpha="1"
android:strokeColor="#54003B59"
android:strokeWidth="1" />
</vector>

View file

@ -0,0 +1,23 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="28dp"
android:viewportWidth="24.0"
android:viewportHeight="28.0">
<path
android:fillAlpha="0.1"
android:fillColor="#000000"
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:strokeWidth="1" />
<path
android:fillAlpha="1"
android:fillColor="#000000"
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" />
<path
android:fillAlpha="1"
android:fillColor="#4CAF50"
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:strokeAlpha="1"
android:strokeColor="#003b59"
android:strokeWidth="1" />
</vector>

View file

@ -0,0 +1,23 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="28dp"
android:viewportWidth="24.0"
android:viewportHeight="28.0">
<path
android:fillAlpha="0.1"
android:fillColor="#000000"
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:strokeWidth="1" />
<path
android:fillAlpha="1"
android:fillColor="#000000"
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" />
<path
android:fillAlpha="1"
android:fillColor="#454547"
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:strokeAlpha="1"
android:strokeColor="#003b59"
android:strokeWidth="1" />
</vector>

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="@color/button_blue"
android:pathData="M19,3L5,3c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2L21,5c0,-1.1 -0.9,-2 -2,-2zM17,13L7,13v-2h10v2z"/>
</vector>

View file

@ -0,0 +1,42 @@
<LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal"
android:layout_gravity="center_vertical"
xmlns:android="http://schemas.android.com/apk/res/android">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingStart="15dp"
android:text="@string/place_state"
android:textColor="@color/white"/>
<com.google.android.material.chip.ChipGroup
android:id="@+id/choice_chip_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:theme="@style/Theme.MaterialComponents.Light"
app:singleSelection="false">
<com.google.android.material.chip.Chip
android:id="@+id/choice_chip_exists"
style="@style/Widget.MaterialComponents.Chip.Filter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:chipBackgroundColor="@color/bg_chip_state"
android:text="@string/place_state_exists"/>
<com.google.android.material.chip.Chip
android:id="@+id/choice_chip_needs_photo"
style="@style/Widget.MaterialComponents.Chip.Filter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:chipBackgroundColor="@color/bg_chip_state"
android:text="@string/place_state_needs_photo"/>
</com.google.android.material.chip.ChipGroup>
</LinearLayout>

View file

@ -0,0 +1,24 @@
<LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/search_view_layout"
android:paddingVertical="15dp"
xmlns:android="http://schemas.android.com/apk/res/android">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingStart="15dp"
android:text="@string/place_type"
android:textColor="@color/white"/>
<SearchView
android:id="@+id/search_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:tint="@color/white"
android:queryHint="@string/nearby_search_hint"
android:searchIcon="@drawable/ic_search_white_24dp">
</SearchView>
</LinearLayout>

View file

@ -8,18 +8,47 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/status_bar_blue">
android:background="@color/status_bar_blue"
android:id="@+id/map_layout">
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:focusableInTouchMode="true"/>
<LinearLayout
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<include
layout="@layout/nearby_filter_all_items"
android:id="@+id/nearby_filter"/>
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<include layout="@layout/nearby_filter_list"
android:id="@+id/nearby_filter_list"
android:layout_below="@id/nearby_filter"
android:layout_height="160dp"
android:layout_width="160dp"
android:layout_alignParentEnd="true"/>
</LinearLayout>
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/nearby_filter"/>
<Button
android:id="@+id/search_this_area_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_gravity="center_horizontal"
android:layout_margin="8dp"
android:background="@color/white"
android:padding="8dp"
android:singleLine="true"
android:text="@string/search_this_area"
android:textColor="@color/status_bar_blue"
android:visibility="gone"
app:elevation="6dp"
android:layout_below="@id/nearby_filter"/>
<View
android:id="@+id/transparentView"
@ -37,9 +66,9 @@
android:id="@+id/fab_recenter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/toolbar"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_below="@id/nearby_filter"
android:clickable="true"
android:visibility="visible"
app:backgroundTint="@color/main_background_light"
@ -49,7 +78,6 @@
app:srcCompat="@drawable/ic_my_location_black_24dp"
app:useCompatPadding="true" />
</RelativeLayout>
<include layout="@layout/bottom_sheet_nearby" />
@ -58,21 +86,6 @@
android:id="@+id/bottom_sheet_details"
layout="@layout/bottom_sheet_details" />
<Button
android:id="@+id/search_this_area_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_gravity="center_horizontal"
android:layout_margin="8dp"
android:background="@color/white"
android:padding="8dp"
android:singleLine="true"
android:text="@string/search_this_area"
android:textColor="@color/status_bar_blue"
android:visibility="gone"
app:elevation="6dp" />
<ProgressBar
android:id="@+id/map_progress_bar"
android:layout_width="match_parent"

View file

@ -0,0 +1,22 @@
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">
<include
android:id="@+id/chip_view"
layout="@layout/filter_chip_view"
android:background="@color/deleteRed"
/>
<include android:id="@+id/search_view_layout" layout="@layout/filter_search_view_layout" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/search_view_layout"
android:background="@color/status_bar_blue">
</RelativeLayout>
</LinearLayout>

View file

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/nearby_filter_list_layout"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:elevation="8dp"
android:background="@color/white">
<fr.free.nrw.commons.nearby.CheckBoxTriStates
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/checkbox_tri_states"
android:layout_margin="10dp"
android:text="All"
/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@android:color/darker_gray"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/search_list_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginVertical="10dp"
/>
</LinearLayout>

View file

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/search_list_item"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="25dp"
>
<ImageView
android:id="@+id/place_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</ImageView>
<TextView
android:id="@+id/place_text"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</TextView>
</LinearLayout>

View file

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Authors:
* Cblair91
-->
<resources>
<string name="crash_dialog_title">Commons has crashed</string>
<string name="crash_dialog_text">Oops. Something went wrong!</string>
<string name="crash_dialog_comment_prompt">Tell us what you were doing, then share it via email to us. Will help us fix it!</string>
<string name="crash_dialog_ok_toast">Thank you!</string>
</resources>

View file

@ -380,7 +380,7 @@
<string name="next">ದುಂಬುದ</string>
<string name="previous">ಪಿರವುದ</string>
<string name="submit">ಒಪ್ಪಿಸಾಲೆ</string>
<string name="upload_title_duplicate">ಕಡತಪುದರ್ %1$s ದ ಒಂಜಿ ಕಡತ ಉಂಡು. ಈರ್ ಖಂಡಿತಾ ದುಂಬು ಪೋವರೆ ಬಯಕುವರಾ?\nA file with the file name exists. Are you sure you want to proceed?</string>
<string name="upload_title_duplicate">ಕಡತಪುದರ್ %1$s ದ ಒಂಜಿ ಕಡತ ಉಂಡು. ಈರ್ ಖಂಡಿತಾ ದುಂಬು ಪೋವರೆ ಬಯಕುವರಾ?\nA file with the file name destroyed. Are you sure you want to proceed?</string>
<string name="map_application_missing">ಹೊಂದುನ ನಕಾಶೆ ಪರಿಕರನ ಇರೆನ ಸಲಕರಣೆಡ್ ತಿಕ್ಕುಜಿ. ಈ ಗುಣಧರ್ಮನ್ ಬಳಸರೆ ದಯಮಲ್ತ್ ಒಂಜಿ ನಕಾಶೆ ಪರಿಕರನ ತಾಪನೆ ಮಲ್ಪುಲೆ.</string>
<plurals name="upload_count_title">
<item quantity="other">ಒಂಜಿ=%1$d ಮಿತೇರಾಯಿನ</item>

View file

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Authors:
* Ерней
-->
<resources>
<string name="crash_dialog_ok_toast">Рәхмәт!</string>
</resources>

View file

@ -172,7 +172,7 @@
<string name="title_activity_nearby">Nearby Places</string>
<string name="no_nearby">No nearby places found</string>
<string name="warning">Warning</string>
<string name="upload_image_duplicate">This file already exists on Commons. Are you sure you want to proceed?</string>
<string name="upload_image_duplicate">This file already destroyed on Commons. Are you sure you want to proceed?</string>
<string name="yes">Yes</string>
<string name="no">No</string>
<string name="media_detail_title">Title</string>
@ -410,7 +410,7 @@
<string name="next">Next</string>
<string name="previous">Previous</string>
<string name="submit">Submit</string>
<string name="upload_title_duplicate" formatted="true">A file with the file name %1$s exists. Are you sure you want to proceed?</string>
<string name="upload_title_duplicate" formatted="true">A file with the file name %1$s destroyed. Are you sure you want to proceed?</string>
<string name="map_application_missing">No compatible map application could be found on your device. Please install a map application to use this feature.</string>
<plurals name="upload_count_title">
<item quantity="one">%1$d Upload</item>
@ -582,5 +582,10 @@ Upload your first media by tapping on the add button.</string>
<string name="text_copy">Text copied to clipboard</string>
<string name="notification_mark_read">Notification marked as read</string>
<string name="some_error">There was some error!</string>
<string name="place_state">Place state:</string>
<string name="place_state_exists">Exists</string>
<string name="place_state_needs_photo">Needs Photo</string>
<string name="place_type">Place type:</string>
<string name="nearby_search_hint">Bridge, museum, hotel etc.</string>
<string name="you_must_reset_your_passsword">Something went wrong with login, you must reset your password !!</string>
</resources>