From 4c3fa4ae5f62d2a5ad9778b93be2bf3348fb823d Mon Sep 17 00:00:00 2001 From: Dmitry Brant Date: Mon, 5 Feb 2024 13:02:23 -0500 Subject: [PATCH] Places (feature branch). (#4182) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Quick stub of nearby. * Get it! * Do it. * Wire in our own OkHttp client. * Fix. * Create ViewModel for Nearby. * Disable logo and set attribution margins. * Basic markers. * Set max zoom, for now. * Apply proper limits on API call. * Cache annotations, and make them clickable. * Slightly better marker. * Slightly better marker. * Towards location tracking. * Real-time user location. * Introduce slop factor for fetching updated articles. * With thumbnails. * Yes. * Don't fetch updates if zoomed out too far. * Realign markers a bit. * Recycle remaining bitmaps on destroy. * Simplify initialization. * Correctly pass search radius. * Wire up link preview dialog. * Precalculate Paint and Rect objects. * Accept approximate location. * Adapt. * Explicitly specify referrer when fetching map tiles. * Use Open Sans font, and update endpoints to Labs. * Use production maps. * Update suggested style json. * Use correct font stack for markers. * qq strings. * Duplicate string. * Nearby: Move nearby to main nav more menu (#4298) Co-authored-by: Sharvani Haran * Update maplibre versions (#4306) * Change label to `Places` (#4323) * Change label to `Places` * Lint fix --------- Co-authored-by: Sharvani Haran * Places: adding dark theme JSON for the map (#4307) * Nearby: adding dark theme JSON * Update style * Update dark theme json * Rename * Update history entry constant. * Set HistoryEntry constant to what it used to be. * Places: Clustering (#4309) * wwip * Lint fix * Introduce clustering with desired styling * Design update * Update to themed color * Code review change * Places: slow animation from cluster to children (#4327) * Places: slow animation from cluster to children * Better animation * Update duration and add correct font * Design update * Use Express.literal() instead --------- Co-authored-by: Sharvani Haran Co-authored-by: cooltey Co-authored-by: Cooltey Feng * Places: Add View on map option to customize toolbar (#4308) * Nearby: Add View on map optionto customize toolbar * Add action logic * Add comments for later fix * Add default lists constant * Fix: make sure getting the coordinates from the page/summary endpoint * add FIXME and simplify the name * Add parameter for nearby * Add logic of pointing to target place * Design comment and fix some toolbar color and enable states * Fix logic * Update width of the menu * Fix error * Show bottomsheet for the article location * Fix lint * Zoom in to the max * A few preliminary bits. * A few more preliminaries. * Introduce Search bar at the top. * Use correct gravity and margins for compass and attribution. * Update style of FAB. * Fix error * Places: update UI elements on map (#4343) * Places: update UI elements on map * Fix lint * Lazy it * Disable the logo icon * Update compass and code review addressed * Lint * Use new compass icon * Use layer list to mimic shadow * Use regular one * Update compass svg * Use correct color for info icon * Use previous compass icon and adding bottom margin * Update ripple color * Don't create unnecessary bitmaps. (#4379) --------- Co-authored-by: Dmitry Brant * Places: Search (#4319) * Added search bar to nearby screen * Update tabs functionality * Set-up click listeners * Filter screen added * Add filter screen * Ui update to lang code button * Add global location search * Changed langCode layout and adjusted compass position * Updated location tracking with language switch * Use LatLng rather than Location * Magnify the searched/clicked/visited_from_article marker * Code clean-up * Trigger search when you visit from Places * Get language code from pagetitle * Minor clean-up * Fix edge-case language deletion bug * Minor fix * Do not use LatLng outside of Places. * Preliminary cleanup. * Lint. * Lint. * Lint fix * Marker update fix --------- Co-authored-by: Sharvani Haran Co-authored-by: Dmitry Brant * A touch of cleanup. * Stray bits. * Places condition change - Minor fix * change icons position and added a todo comment for optimization * Places: Update ‘article preview’ bottom sheet for places (#4334) * Places: Update ‘article preview’ bottom sheet for places * Dialog update * Update overflow menu * Update overflow menu and add method to callback * Update overflow menu and add method to callback * Update overflow menu * Add qq string * Update overlay buttons * Correct logic of add to new tab * Set watchlist logic correctly * Add timestamp for keep watch status updated. * Use correct pagetitle * Close bottomsheet before showing snackbar * Reduce watch status loading * Clear changed status before starting new watch action * Show distance * Show distance on the dialog * Fix lint * Fix build error * Fix errors * Fix another error * Add handle and adjust peek height * Reduce letter spacing in snackbar * Show save vs saved for reading list button * Optimze save to reading list logic * Remove dim background * Set correct state of the bottom sheet * Remove peek height * Rename strings name * Move logic to link preview dialog * Update expiry logic * Remove unused methods * Make handle always visible * Remove unused method * Fix error * Add comment for remove snackbar * Remain status bar color and update snackbar * Fix lint * Follow-up: run animation when opening in new tab. (#4389) * Change 8dp to 12dp for compass margin * Revert "Merge branch 'main' into nearby_design" This reverts commit 3318abca85a8ca538783def00330fa5d181dd048, reversing changes made to 6b0a379b8f3435da9c17c0ddf977e64b6d6f5f84. * Untangle from earlier merge. * Further untangle. * Minor: Add places condition to prefix search results too * Design tweak: Places search (#4392) Co-authored-by: Sharvani Haran * Places Filter screen: Design tweaks (#4383) * Places Filter screen: Design tweaks * Standardize langcode ui * Minor ui update * Update button style to h3 * Code review comments addressed * Minor fix --------- Co-authored-by: Sharvani Haran * Set title in xml. * Make search field single-line. * Factor out showing of link preview. * Use parcelable extension. * Bump z-order of selected marker, and clarify naming. * Factor out setting of magnified symbol. * Use highlightedPageTitle as it was intended. * Title could contain html. * Minor: Filter design update * Open up maximum zoom level in the map. (#4395) * Re-introduce minimum movement offset for querying map updates. (#4396) * (Places) Correctly handle insets. (#4397) * Places: reset the search bar text and icon after dismissing the link preview dialog (#4398) * Fix: clear search bar text and icon after dismissing the link preview dialog * Lint fix --------- Co-authored-by: Sharvani Haran * Show link preview dialog if access from an article (#4401) * (Places) remove postDelayed calls. (#4402) * Save last location information to the preference (#4400) * Save last location on map to reduce zoom-in animation when launch * Update with proper Preference method * Update preference correctly * Reduce animation duration * Put back 10ms delay. * Handle zoomlevel correctly * Fix lint --------- Co-authored-by: Dmitry Brant * (Places) Clean up searching, and correctly remember last search term. (#4403) * (Places) Clean up searching, and correctly remember last search term. * Style. * Remove unused method * Make sure the tab icon is visible when tab count > 0 * Places: Build a "list" view of places, alongside the "map" view (#4357) * Initial commit of adding toggle buttons * Adjust style * Apply base color to buttons * Use post for buttons * Add linearlayout * Add list item view * Add adapter and viewholder * Update binding * Update adapter * Show the list view correctly * Update search bar bgcolor * Update toggle buttons * Add location to nearbypage * Update recyclerview * Add strings for empty state * Fix lint * Add empty illustration * Use library to show circle image * Update list styles * Add clicklistener action * Add long press menu * Apply proper bottom margin for recyclerview * Update list item text size and toggle button height * Adjust margin * Adjust ripple color * Add drawable padding to the link preview dialog as well * Use correct style for text and show article summary if no description * Single line only if the description is extract * Add prop=extracts for list view items in Places (#4413) * Reset single line value * Reset single line value * (Places) Don't use extra list along with LiveData. (#4416) * Handle orientation change * Get correct last location * Apply margins to the layout params correctly * Open new foreground tab from map * Fix error --------- Co-authored-by: Dmitry Brant * Remove extracts usage and update list view design * Apply description once * Align to the middle of vertical correctly * Places: apply new language and tab counts view to Places (#4425) * Add new lang button to places * Unused import * Remove background from langCodeView * Add long press toast * Use linearLayout instead * Move transition parameter to the searchText and update contentDescripton for LangCodeView * Places: Bring back bottomsheet dim (#4426) Co-authored-by: Sharvani Haran * Places: Discovery with tooltips (#4407) * Places: Tooltips for discoverability * Changes tooltip order * Removed watchlist tooltip from both article screen and main screen * Lint fix * Design tweaks * Show main tooltip on second launch * Remove line-break in tooltip --------- Co-authored-by: Sharvani Haran * Places: Survey (#4412) * Initial commit * Fix strings * Added one time show logic * Minor update * update survey dialogs * Minor change * Code review comments addressed -1 * Addressed CR comments and Design Review suggestion * Design review comments addressed * Remove unnecesary line space * Build fix * Update survey conditions * Code review comment addressed * Code review comments addressed --------- Co-authored-by: Sharvani Haran * Simplify and optimize code in PlacesFilterActivity (#4430) * Respect isImageDownloadedEnabled setting in Places (#4436) * Fix: use null-safe for LinkPreviewDialog action button (#4433) * Fix: use lastKnownLocation instead of the last map location for distance (#4434) * Set distance location at binding time. * Fix: dismiss the LinkPreviewDialog when changing device's orientation (#4439) * Minor code update for Places (#4441) * Places: Data wiring (#4384) * Places event created and Search, mapview and entry points data wired * Minor change * Places: Tooltips for discoverability * Changes tooltip order * Initial commit * Fix strings * Added one time show logic * Minor update * update survey dialogs * Minor change * Code review comments addressed -1 * Addressed CR comments and Design Review suggestion * Design review comments addressed * Remove unnecesary line space * Removed watchlist tooltip from both article screen and main screen * Lint fix * Build fix * Design tweaks * Lint fix * Add tooltip wiring * Update survey conditions * Updated list view and preview dialog wiring * Complete data wiring * Data review comments updated * Code review comment addressed * Codereview comments addressed * stream wiring update --------- Co-authored-by: Sharvani Haran --------- Co-authored-by: Sharvani Haran Co-authored-by: Cooltey Feng Co-authored-by: Sharvani Haran Co-authored-by: cooltey --- app/build.gradle | 3 + app/src/main/AndroidManifest.xml | 9 + app/src/main/assets/mapstyle-dark.json | 4589 +++++++++++++++++ app/src/main/assets/mapstyle.json | 4589 +++++++++++++++++ app/src/main/java/org/wikipedia/Constants.kt | 1 + .../analytics/eventplatform/PlacesEvent.kt | 30 + .../java/org/wikipedia/dataclient/Service.kt | 4 +- .../okhttp/CommonHeaderRequestInterceptor.kt | 2 + .../diff/ArticleEditDetailsFragment.kt | 74 +- .../diff/ArticleEditDetailsViewModel.kt | 1 - .../org/wikipedia/history/HistoryEntry.kt | 1 + .../java/org/wikipedia/main/MainActivity.kt | 12 + .../java/org/wikipedia/main/MainFragment.kt | 19 +- .../org/wikipedia/navtab/MenuNavTabDialog.kt | 8 + .../page/ExtendedBottomSheetDialogFragment.kt | 10 - .../org/wikipedia/page/PageActionTabLayout.kt | 8 +- .../java/org/wikipedia/page/PageActivity.kt | 40 +- .../java/org/wikipedia/page/PageFragment.kt | 62 +- .../wikipedia/page/action/PageActionItem.kt | 10 + .../page/linkpreview/LinkPreviewDialog.kt | 43 +- .../page/linkpreview/LinkPreviewViewModel.kt | 2 +- .../org/wikipedia/places/PlacesActivity.kt | 24 + .../wikipedia/places/PlacesFilterActivity.kt | 152 + .../org/wikipedia/places/PlacesFragment.kt | 863 ++++ .../places/PlacesFragmentViewModel.kt | 69 + .../org/wikipedia/random/RandomFragment.kt | 8 - .../wikipedia/readinglist/LongPressMenu.kt | 41 +- .../ReadingListPreviewSaveDialogView.kt | 4 +- .../org/wikipedia/search/SearchFragment.kt | 17 +- .../java/org/wikipedia/search/SearchResult.kt | 16 +- .../org/wikipedia/search/SearchResults.kt | 2 +- .../wikipedia/search/SearchResultsFragment.kt | 15 +- .../search/SearchResultsViewModel.kt | 31 +- .../main/java/org/wikipedia/settings/Prefs.kt | 58 +- .../wikipedia/views/PageActionOverflowView.kt | 8 + .../java/org/wikipedia/views/SurveyDialog.kt | 116 + .../main/java/org/wikipedia/views/ViewUtil.kt | 7 +- .../res/drawable/baseline_location_on_24.xml | 5 + .../main/res/drawable/ic_compass_with_bg.xml | 25 + .../ic_places_empty_state_illustration.xml | 96 + app/src/main/res/drawable/map_marker.xml | 10 + .../main/res/drawable/map_marker_outline.xml | 11 + app/src/main/res/drawable/my_location_24.xml | 5 + app/src/main/res/drawable/watchlist.xml | 5 + .../res/layout/activity_places_filters.xml | 25 + .../main/res/layout/dialog_link_preview.xml | 1 + .../dialog_patrol_edit_feedback_options.xml | 38 +- app/src/main/res/layout/fragment_places.xml | 178 + app/src/main/res/layout/item_places_list.xml | 68 + app/src/main/res/layout/view_main_drawer.xml | 22 +- .../res/layout/view_places_filter_item.xml | 49 + .../res/layout/view_places_filters_footer.xml | 41 + .../layout/view_watchlist_filter_header.xml | 11 +- .../layout/view_watchlist_main_tooltip.xml | 29 - .../layout/view_watchlist_page_tooltip.xml | 28 - .../main/res/menu/menu_places_long_press.xml | 21 + app/src/main/res/values-qq/strings.xml | 1 + app/src/main/res/values/ids.xml | 1 + app/src/main/res/values/preference_keys.xml | 8 +- app/src/main/res/values/strings.xml | 4 +- app/src/main/res/values/styles.xml | 16 +- .../main/res/xml/developer_preferences.xml | 25 +- 62 files changed, 11383 insertions(+), 288 deletions(-) create mode 100644 app/src/main/assets/mapstyle-dark.json create mode 100644 app/src/main/assets/mapstyle.json create mode 100644 app/src/main/java/org/wikipedia/analytics/eventplatform/PlacesEvent.kt create mode 100644 app/src/main/java/org/wikipedia/places/PlacesActivity.kt create mode 100644 app/src/main/java/org/wikipedia/places/PlacesFilterActivity.kt create mode 100644 app/src/main/java/org/wikipedia/places/PlacesFragment.kt create mode 100644 app/src/main/java/org/wikipedia/places/PlacesFragmentViewModel.kt create mode 100644 app/src/main/java/org/wikipedia/views/SurveyDialog.kt create mode 100644 app/src/main/res/drawable/baseline_location_on_24.xml create mode 100644 app/src/main/res/drawable/ic_compass_with_bg.xml create mode 100644 app/src/main/res/drawable/ic_places_empty_state_illustration.xml create mode 100644 app/src/main/res/drawable/map_marker.xml create mode 100644 app/src/main/res/drawable/map_marker_outline.xml create mode 100644 app/src/main/res/drawable/my_location_24.xml create mode 100644 app/src/main/res/drawable/watchlist.xml create mode 100644 app/src/main/res/layout/activity_places_filters.xml create mode 100644 app/src/main/res/layout/fragment_places.xml create mode 100644 app/src/main/res/layout/item_places_list.xml create mode 100644 app/src/main/res/layout/view_places_filter_item.xml create mode 100644 app/src/main/res/layout/view_places_filters_footer.xml delete mode 100644 app/src/main/res/layout/view_watchlist_main_tooltip.xml delete mode 100644 app/src/main/res/layout/view_watchlist_page_tooltip.xml create mode 100644 app/src/main/res/menu/menu_places_long_press.xml diff --git a/app/build.gradle b/app/build.gradle index 05b069965bf..37e0c8a3d72 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -224,6 +224,9 @@ dependencies { implementation 'com.github.skydoves:balloon:1.6.4' implementation "com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:1.0.0" + implementation 'org.maplibre.gl:android-sdk:10.2.0' + implementation 'org.maplibre.gl:android-plugin-annotation-v9:2.0.2' + implementation("androidx.room:room-runtime:$roomVersion") annotationProcessor "androidx.room:room-compiler:$roomVersion" ksp "androidx.room:room-compiler:$roomVersion" diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index f8f1a3d5b8a..41ee448496a 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -37,6 +37,9 @@ + + + diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 5dfe2479c2f..61860edfb33 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -173,8 +173,6 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/xml/developer_preferences.xml b/app/src/main/res/xml/developer_preferences.xml index d7ab257a9ae..50977badedc 100644 --- a/app/src/main/res/xml/developer_preferences.xml +++ b/app/src/main/res/xml/developer_preferences.xml @@ -246,11 +246,6 @@ android:key="@string/preference_key_reading_list_login_reminder_enabled" android:title="@string/preference_key_reading_list_login_reminder_enabled" /> - - - - - - @@ -321,6 +308,13 @@ android:key="@string/preference_key_show_sequential_recent_edits_diff_tooltip" android:title="@string/preference_key_show_sequential_recent_edits_diff_tooltip" /> + + + @@ -469,6 +463,11 @@ android:key="ab_test_mBART25" android:title="Test group for machine generated article descriptions \n(0=no suggestions, 1=suggestions, 2=suggestions+blp)" /> + +