Compare commits

..

1 Commits

Author SHA1 Message Date
Jean-Baptiste
908ba925ae [android] Simplify toolbar styles and themes
Signed-off-by: Jean-Baptiste <jeanbaptiste.charron@outlook.fr>
2025-12-28 19:26:27 +01:00
10 changed files with 12 additions and 74 deletions

View File

@@ -197,8 +197,10 @@ public class BookmarkCategoriesFragment extends BaseMwmRecyclerFragment<Bookmark
() -> onShareActionSelected(mSelectedCategory, KmlFileType.Text)));
items.add(new MenuBottomSheetItem(R.string.export_file_gpx, R.drawable.ic_file_gpx,
() -> onShareActionSelected(mSelectedCategory, KmlFileType.Gpx)));
items.add(new MenuBottomSheetItem(R.string.delete, R.drawable.ic_delete,
() -> onDeleteActionSelected(mSelectedCategory)));
// Disallow deleting the last category
if (getAdapter().getBookmarkCategories().size() > 1)
items.add(new MenuBottomSheetItem(R.string.delete, R.drawable.ic_delete,
() -> onDeleteActionSelected(mSelectedCategory)));
}
return items;
}
@@ -295,19 +297,8 @@ public class BookmarkCategoriesFragment extends BaseMwmRecyclerFragment<Bookmark
private void onDeleteActionSelected(@NonNull BookmarkCategory category)
{
// Disallow deleting the last category
if ((getAdapter().getBookmarkCategories().size() > 1))
{
BookmarkManager.INSTANCE.deleteCategory(category.getId());
getAdapter().notifyDataSetChanged();
}
else
{
new MaterialAlertDialogBuilder(requireActivity())
.setMessage(R.string.unable_to_delete_list)
.setPositiveButton(android.R.string.ok, (dialog, which) -> dialog.dismiss())
.show();
}
BookmarkManager.INSTANCE.deleteCategory(category.getId());
getAdapter().notifyDataSetChanged();
}
private void onSettingsActionSelected(@NonNull BookmarkCategory category)

View File

@@ -196,7 +196,7 @@ public final class UiUtils
public static void showHomeUpButton(MaterialToolbar toolbar)
{
toolbar.setNavigationIcon(
ThemeUtils.getResource(toolbar.getContext(), androidx.appcompat.R.attr.homeAsUpIndicator));
UiUtils.getStyledResourceId(toolbar.getContext(), androidx.appcompat.R.attr.homeAsUpIndicator));
}
// this method returns the total height of the display (in pixels) including notch and other touchable areas

View File

@@ -6,14 +6,7 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
style="@style/MwmWidget.ToolbarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="end|center_vertical"
android:theme="@style/MwmWidget.ToolbarTheme">
</com.google.android.material.appbar.MaterialToolbar>
<include layout="@layout/toolbar_default"/>
<LinearLayout
android:layout_marginTop="@dimen/margin_half_double_plus"
android:orientation="horizontal"

View File

@@ -30,8 +30,7 @@
android:layout_alignParentStart="true"
android:background="?selectableItemBackgroundBorderless"
app:srcCompat="?homeAsUpIndicator"
android:scaleType="center"
tools:src="@drawable/ic_expand_more" />
android:scaleType="center" />
<RadioGroup
android:id="@+id/route_type"

View File

@@ -8,8 +8,7 @@
android:id="@+id/toolbar"
style="@style/MwmWidget.ToolbarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/MwmWidget.ToolbarTheme.DownButton"/>
android:layout_height="wrap_content" />
<View
android:layout_width="match_parent"

View File

@@ -17,7 +17,6 @@
android:background="?selectableItemBackgroundBorderless"
app:srcCompat="?homeAsUpIndicator"
android:scaleType="center"
tools:src="@drawable/ic_expand_more"
android:contentDescription="@string/back"/>
<com.google.android.material.textfield.TextInputEditText

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.appbar.MaterialToolbar
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/toolbar"
style="@style/MwmWidget.ToolbarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/MwmWidget.ToolbarTheme.Transparent"/>

View File

@@ -974,5 +974,4 @@
<string name="download_resources_custom_url_hint">https://cdn-fi-1.comaps.app/</string>
<string name="download_resources_custom_url_summary_none">Not set</string>
<string name="download_resources_custom_url_error_scheme">Please enter a full URL starting with https:// and ending with /</string>
<string name="unable_to_delete_list">The last list cannot be deleted. Create a new list to remove it</string>
</resources>

View File

@@ -148,11 +148,6 @@
<item name="buttonGravity">center_vertical</item>
</style>
<style name="MwmWidget.ToolbarStyle.Light">
<item name="android:titleTextAppearance">@style/MwmTextAppearance.Toolbar.Title.Light</item>
<item name="titleTextAppearance">@style/MwmTextAppearance.Toolbar.Title.Light</item>
</style>
<style name="MwmWidget.ToolbarStyle.NoElevation">
<item name="android:elevation">0dp</item>
</style>
@@ -164,29 +159,6 @@
<item name="iconTint">@color/white_primary</item>
</style>
<style name="MwmWidget.ToolbarTheme.Light" parent="MwmWidget.ToolbarTheme">
<item name="android:gravity">center_vertical</item>
<item name="colorAccent">@android:color/white</item>
<item name="colorSecondary">#FF32363A</item>
</style>
<style name="MwmWidget.ToolbarTheme.Transparent" parent="ThemeOverlay.Material3.Dark.ActionBar">
<item name="android:gravity">center_vertical</item>
<item name="colorAccent">@android:color/white</item>
<item name="colorSecondary">@android:color/white</item>
<item name="android:windowActionBarOverlay">true</item>
<item name="windowActionBarOverlay">true</item>
</style>
<style
name="MwmWidget.ToolbarTheme.DownButton"
parent="ThemeOverlay.Material3.Dark.ActionBar">
<item name="android:gravity">center_vertical</item>
<item name="colorAccent">@android:color/white</item>
<item name="colorSecondary">@android:color/white</item>
<item name="android:homeAsUpIndicator">@drawable/ic_expand_more</item>
</style>
<style name="MwmWidget.ListView" parent="android:Widget.Material.ListView">
<item name="android:fadingEdge">none</item>
<item name="android:divider">@color/divider</item>

View File

@@ -1,7 +1,7 @@
{
"data_format": 1,
"data_url": "https://codeberg.org/comaps/comaps/raw/branch/main/data/taginfo.json",
"data_updated": "20251228T203737Z",
"data_updated": "20251120T121118Z",
"project": {
"name": "CoMaps",
"description": "CoMaps is a community-focused privacy navigation iOS & Android app for travelers - drivers, hikers, and cyclists.",
@@ -176,7 +176,7 @@
"description": "amenity=car_pooling",
"key": "amenity",
"value": "car_pooling",
"icon_url": "https://codeberg.org/comaps/comaps/raw/branch/main/data/styles/default/light/symbols/parking_pooling-m.svg"
"icon_url": "https://codeberg.org/comaps/comaps/raw/branch/main/data/styles/default/light/symbols/parking-pooling-m.svg"
},
{
"description": "amenity=car_rental",
@@ -431,12 +431,6 @@
"value": "hunting_stand",
"icon_url": "https://codeberg.org/comaps/comaps/raw/branch/main/data/styles/default/light/symbols/hunting-tower-m.svg"
},
{
"description": "amenity=hydrant",
"key": "amenity",
"value": "hydrant",
"icon_url": "https://codeberg.org/comaps/comaps/raw/branch/main/data/styles/default/light/symbols/hydrant-m.svg"
},
{
"description": "amenity=ice_cream",
"key": "amenity",