Skip to content

Commit

Permalink
Nearby: Add View on map optionto customize toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
cooltey committed Nov 29, 2023
1 parent 2c6ec6b commit 025f69c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ enum class PageActionItem constructor(val id: Int,
cb.onViewEditHistorySelected()
}
},
VIEW_ON_MAP(13, R.id.page_view_on_map, R.string.action_item_view_on_map, R.drawable.baseline_location_on_24, true) {
override fun select(cb: Callback) {
cb.onViewOnMapSelected()
}
},
NEW_TAB(9, R.id.page_new_tab, R.string.menu_new_tab, R.drawable.ic_add_gray_white_24dp) {
override fun select(cb: Callback) {
cb.onNewTabSelected()
Expand Down Expand Up @@ -101,11 +106,12 @@ enum class PageActionItem constructor(val id: Int,
fun onExploreSelected()
fun onCategoriesSelected()
fun onEditArticleSelected()
fun onViewOnMapSelected()
fun forwardClick()
}

companion object {
val MAP = EnumCodeMap(PageActionItem::class.java)
private val MAP = EnumCodeMap(PageActionItem::class.java)

fun size(): Int {
return MAP.size()
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/org/wikipedia/settings/Prefs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ object Prefs {

var customizeToolbarMenuOrder: List<Int>
get() {
val notInToolbarList = PageActionItem.entries.map { it.code() }.subtract(customizeToolbarOrder)
val notInToolbarList = PageActionItem.entries.map { it.code() }.subtract(customizeToolbarOrder.toSet())
val currentList = JsonUtil.decodeFromString<List<Int>>(PrefsIoUtil.getString(R.string.preference_key_customize_toolbar_menu_order, null))
?: notInToolbarList
return currentList.union(notInToolbarList).toList()
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-qq/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1457,6 +1457,8 @@
<string name="media_playback_error">Error shown when the selected media could not be played.</string>
<string name="user_contrib_menu_label">Menu label for accessing the contributions of the current user.</string>
<string name="user_contrib_filter_activity_title">Screen title for applying the filters for the contributions of a user.</string>
<string name="action_item_view_on_map">Menu label for accessing the map for the geographical coordinates of the page.</string>
<string name="action_item_view_on_map_unavailable">Message that indicates the geographical coordinates of the page are not available.</string>
<string name="shareable_reading_lists_import_dialog_title">Title text for the import reading list dialog.</string>
<string name="shareable_reading_lists_import_dialog_content">Content text for the import reading list dialog.</string>
<string name="shareable_reading_lists_new_indicator">Label indicating that the imported list in the list view.</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/ids.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@
<item name="page_explore" type="id" />
<item name="page_categories" type="id" />
<item name="page_edit_article" type="id" />
<item name="page_view_on_map" type="id" />
</resources>
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1518,6 +1518,8 @@
<string name="media_playback_error">Error playing media.</string>
<string name="user_contrib_menu_label">Contributions</string>
<string name="user_contrib_filter_activity_title">Filter contributions</string>
<string name="action_item_view_on_map">View on map</string>
<string name="action_item_view_on_map_unavailable">Geographical coordinates are not available for this page</string>

<!-- Shareable reading lists -->
<string name="shareable_reading_lists_import_dialog_title">Import shared reading list</string>
Expand Down

0 comments on commit 025f69c

Please sign in to comment.