Compare commits

..

1 Commits

Author SHA1 Message Date
Yannik Bloscheck
34ddffccb8 Display subtypes in search results
Signed-off-by: Yannik Bloscheck <git@yannikbloscheck.com>
2026-01-15 19:28:17 +01:00
20 changed files with 48 additions and 37 deletions

View File

@@ -8,7 +8,7 @@
android:layout_margin="4dp"
android:clickable="true"
android:focusable="true"
app:cardBackgroundColor="?appBackground"
app:cardBackgroundColor="?cardBackground"
app:cardCornerRadius="12dp"
app:cardElevation="2dp"
tools:showIn="@layout/item_charging_sockets">

View File

@@ -6,7 +6,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:background="@color/bg_editor"
tools:context=".editor.EditorActivity">
<LinearLayout
android:layout_width="match_parent"
@@ -431,6 +430,7 @@
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginBottom="@dimen/margin_quarter"
app:backgroundTint="?cardBackground"
android:textColor="@color/base_red"
app:strokeColor="@color/base_red"
android:text="@string/editor_business_vacant_button"/>
@@ -441,6 +441,7 @@
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginBottom="@dimen/margin_base"
app:backgroundTint="?cardBackground"
android:textColor="@color/base_red"
app:strokeColor="@color/base_red"
tools:text="Reset my changes"/>

View File

@@ -2,9 +2,10 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="?windowBackgroundForced"
android:orientation="vertical">
<com.google.android.material.appbar.MaterialToolbar

View File

@@ -10,13 +10,13 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/frameLayout"
android:background="@color/bg_editor"
android:layout_marginBottom="@dimen/margin_quarter">
android:background="?windowBackgroundForced">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/phones_recycler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?cardBackground"
android:scrollbars="vertical" />
</FrameLayout>

View File

@@ -9,7 +9,7 @@
style="@style/MwmWidget.FrameLayout.Elevation"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bg_editor"
android:background="?windowBackgroundForced"
android:layout_above="@+id/tv__mode_switch"
android:layout_below="@id/toolbar"/>
@@ -19,13 +19,14 @@
android:layout_height="wrap_content"
android:layout_alignTop="@+id/tv__mode_switch"
android:layout_alignParentBottom="true"
android:background="@color/bg_editor"/>
android:background="?cardBackground"/>
<com.google.android.material.textview.MaterialTextView
android:id="@+id/tv__mode_switch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="?clickableBackground"
android:gravity="center_vertical"
android:padding="@dimen/margin_base"
android:text="@string/editor_time_advanced"
@@ -34,7 +35,7 @@
android:textColor="?colorSecondary" />
<include
layout="@layout/item_divider"
layout="@layout/shadow_bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/tv__mode_switch"/>

View File

@@ -5,7 +5,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bg_editor">
android:background="?windowBackgroundForced">
<LinearLayout
android:layout_width="match_parent"
@@ -17,7 +17,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_half"
style="@style/MwmWidget.M3.Editor.CardView">
style="@style/MwmWidget.M3.Editor.CardView"
app:cardBackgroundColor="?cardBackground">
<LinearLayout
android:id="@+id/examples"

View File

@@ -4,7 +4,7 @@
android:id="@+id/recycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bg_editor"
android:background="?windowBackgroundForced"
android:paddingStart="@dimen/margin_half"
android:paddingEnd="@dimen/margin_half"
android:scrollbars="vertical"/>

View File

@@ -6,7 +6,7 @@
android:layout_margin="4dp"
android:clickable="true"
android:focusable="true"
app:cardBackgroundColor="?appBackground"
app:cardBackgroundColor="?cardBackground"
app:cardCornerRadius="12dp"
app:cardElevation="2dp">

View File

@@ -21,6 +21,5 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit_socket_info_tooltip"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_marginBottom="@dimen/margin_quarter"/>
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>

View File

@@ -7,7 +7,6 @@
android:orientation="vertical"
android:paddingEnd="@dimen/margin_base"
android:paddingStart="@dimen/margin_base"
android:background="@color/fg_editor"
android:animateLayoutChanges="true">
<com.google.android.material.textview.MaterialTextView
@@ -21,12 +20,7 @@
android:textAppearance="@style/MwmTextAppearance.Body3"
tools:drawableEnd="@drawable/ic_expand_more" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/fg_editor"
android:scrollbars="vertical"/>
<include layout="@layout/recycler_default" />
<com.google.android.material.button.MaterialButton
android:id="@+id/more_names"

View File

@@ -4,5 +4,5 @@
android:id="@+id/recycler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?appBackground"
android:background="?cardBackground"
android:scrollbars="vertical"/>

View File

@@ -16,8 +16,6 @@
<color name="bg_panel">@color/bg_window</color>
<color name="bg_primary_dark">#FF588157</color>
<color name="bg_app">#10140F</color>
<color name="bg_editor">#161b14</color>
<color name="fg_editor">#282e25</color>
<color name="bg_menu">#CC2D3237</color>

View File

@@ -65,8 +65,6 @@
<color name="bg_panel">@color/bg_window</color>
<color name="bg_primary_dark">#37653F</color> <!-- secondary dark -->
<color name="bg_app">@android:color/white</color>
<color name="bg_editor">#ebefe4</color>
<color name="fg_editor">#f9faf2</color>
<color name="bg_dialog_translucent">#BB000000</color>
<color name="bg_text_translucent">#99FFFFFF</color>

View File

@@ -89,16 +89,8 @@
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginBottom">@dimen/margin_half</item>
<item name="cardBackgroundColor">@color/fg_editor</item>
<item name="cardBackgroundColor">?cardBackground</item>
<item name="android:padding">@dimen/margin_base</item>
<item name="cardPreventCornerOverlap">false</item>
</style>
<style name="MwmWidget.M3.CardView" parent="Widget.Material3.CardView.Elevated">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginBottom">@dimen/margin_half</item>
<item name="cardBackgroundColor">?appBackground</item>
<item name="android:padding">@dimen/margin_base</item>
<item name="cardPreventCornerOverlap">false</item>
</style>
</resources>

View File

@@ -239,6 +239,10 @@
<item name="android:foreground">@drawable/shadow_top</item>
</style>
<style name="MwmWidget.FrameLayout.BookmarkCategories">
<item name="android:background">?windowBackgroundForced</item>
</style>
<style name="MwmWidget.Counter">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>

View File

@@ -278,6 +278,10 @@
<style name="MwmTheme.Navigation">
<item name="iconTint">@color/white_primary</item>
</style>
<style name="PopupMenu" parent="ThemeOverlay.Material3">
<item name="android:popupBackground">?windowBackgroundForced</item>
</style>
<!-- Theme required to apply M3 dialog style on preference screen -->
<style name="MwmTheme.M3.AlertDialog" parent="ThemeOverlay.Material3.MaterialAlertDialog">
<item name="dialogCornerRadius">28dp</item>

View File

@@ -4,6 +4,7 @@
#include "indexer/feature_data.hpp"
#include "indexer/feature_visibility.hpp"
#include "indexer/ftypes_matcher.hpp"
#include "indexer/ftypes_subtypes.hpp"
#include "indexer/scales.hpp"
#include "platform/distance.hpp"
@@ -440,6 +441,19 @@ vector<int8_t> GetDescriptionLangPriority(RegionData const & regionData)
return PrioritizedLanguages(preferredLangs, DefaultLanguage(regionData, preferredLangs));
}
vector<string> GetLocalizedSubtypes(TypesHolder const & types)
{
TypesHolder copiedTypes = types;
copiedTypes.SortBySpec();
auto const & classificator = classif();
auto subtypes = ftypes::Subtypes::Instance();
vector<string> localizedSubtypes;
for (auto const type : copiedTypes)
if (subtypes.IsSubtype(type))
localizedSubtypes.push_back(platform::GetLocalizedTypeName(classificator.GetReadableObjectName(type)));
return localizedSubtypes;
}
vector<string> GetCuisines(TypesHolder const & types)
{
auto const & isCuisine = ftypes::IsCuisineChecker::Instance();

View File

@@ -149,6 +149,9 @@ bool GetPreferredName(StringUtf8Multilang const & src, int8_t deviceLang, std::s
/// - default language code;
std::vector<int8_t> GetDescriptionLangPriority(RegionData const & regionData);
// Returns vector of subtypes localized by platform.
std::vector<std::string> GetLocalizedSubtypes(TypesHolder const & types);
// Returns vector of cuisines readable names from classificator.
std::vector<std::string> GetCuisines(TypesHolder const & types);

View File

@@ -287,6 +287,8 @@ void FillDetails(FeatureType & ft, std::string const & name, Result::Details & d
if (isHotel && strings::to_uint(ft.GetMetadata(feature::Metadata::FMD_STARS), starsCount))
stars = feature::FormatStars(starsCount);
auto const subtypes = strings::JoinStrings(feature::GetLocalizedSubtypes(typesHolder), feature::kFieldsSeparator);
auto const cuisines = feature::GetLocalizedCuisines(typesHolder);
auto const cuisine = strings::JoinStrings(cuisines, feature::kFieldsSeparator);
@@ -318,6 +320,7 @@ void FillDetails(FeatureType & ft, std::string const & name, Result::Details & d
append(elevation);
append(cuisine);
append(recycling);
append(subtypes);
append(fee);
details.m_description = std::move(description);

View File

@@ -417,7 +417,6 @@ unordered_map<string, vector<string>> const kSynonyms = {
{"diag", {"diagonal"}},
{"dig", {"digues", "digue"}},
{"disem", {"diseminado"}},
{"dist", {"distribuidor"}},
{"distr", {"districte"}},
{"divers", {"diversion"}},
{"dkm", {"denkmal"}},
@@ -935,7 +934,6 @@ unordered_map<string, vector<string>> const kSynonyms = {
{"port", {"port"}},
{"pot", {"poterne"}},
{"pour", {"pourtour"}},
{"ppal", {"principal"}},
{"p", {"pfad", "polku", "phường", "pater", "paseo"}},
{"pplk", {"podplukovníka"}},
{"ppłk", {"ppułkownika", "podpułkownika", "podpułkownik"}},