Compare commits

..

1 Commits

Author SHA1 Message Date
Jean-Baptiste
88a7a7ddbf [android] Use M3 dark background in the app
Signed-off-by: Jean-Baptiste <jeanbaptiste.charron@outlook.fr>
2026-01-01 08:49:29 +01:00
18 changed files with 57 additions and 56 deletions

View File

@@ -16,7 +16,8 @@ import app.organicmaps.sdk.bookmarks.data.BookmarkCategory;
import app.organicmaps.sdk.bookmarks.data.BookmarkManager; import app.organicmaps.sdk.bookmarks.data.BookmarkManager;
import app.organicmaps.util.InputUtils; import app.organicmaps.util.InputUtils;
import app.organicmaps.util.Utils; import app.organicmaps.util.Utils;
import com.google.android.material.button.MaterialButton; import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.imageview.ShapeableImageView;
import com.google.android.material.textfield.TextInputEditText; import com.google.android.material.textfield.TextInputEditText;
import com.google.android.material.textfield.TextInputLayout; import com.google.android.material.textfield.TextInputLayout;
import java.util.Objects; import java.util.Objects;
@@ -37,7 +38,7 @@ public class BookmarkCategorySettingsFragment extends BaseMwmToolbarFragment
@NonNull @NonNull
private TextInputEditText mEditCategoryNameView; private TextInputEditText mEditCategoryNameView;
@NonNull @NonNull
private MaterialButton mSaveView; private ShapeableImageView mSaveView;
@Override @Override
public void onCreate(@Nullable Bundle savedInstanceState) public void onCreate(@Nullable Bundle savedInstanceState)
@@ -74,32 +75,12 @@ public class BookmarkCategorySettingsFragment extends BaseMwmToolbarFragment
@Override @Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) public void onTextChanged(CharSequence charSequence, int i, int i1, int i2)
{ {
if (charSequence.length() >= 1) clearNameBtn.setEndIconVisible(charSequence.length() > 0);
{
clearNameBtn.setEndIconVisible(true);
mSaveView.setEnabled(true);
}
else
{
clearNameBtn.setEndIconVisible(false);
mSaveView.setEnabled(false);
mEditCategoryNameView.setError(getString(R.string.bookmarks_error_title_empty_list_name));
}
} }
@Override @Override
public void afterTextChanged(Editable editable) public void afterTextChanged(Editable editable)
{ {}
if (BookmarkManager.INSTANCE.isUsedCategoryName(getEditableCategoryName()) && !TextUtils.equals(getEditableCategoryName(), mCategory.getName()))
{
mEditCategoryNameView.setError(getString(R.string.bookmarks_error_title_list_name_already_taken));
mSaveView.setEnabled(false);
}
else
{
mSaveView.setEnabled(true);
}
}
}); });
mEditDescView = root.findViewById(R.id.edit_description); mEditDescView = root.findViewById(R.id.edit_description);
mEditDescView.setText(mCategory.getDescription()); mEditDescView.setText(mCategory.getDescription());
@@ -110,6 +91,8 @@ public class BookmarkCategorySettingsFragment extends BaseMwmToolbarFragment
private void onEditDoneClicked() private void onEditDoneClicked()
{ {
final String newCategoryName = getEditableCategoryName(); final String newCategoryName = getEditableCategoryName();
if (!validateCategoryName(newCategoryName))
return;
if (isCategoryNameChanged()) if (isCategoryNameChanged())
BookmarkManager.INSTANCE.setCategoryName(mCategory.getId(), newCategoryName); BookmarkManager.INSTANCE.setCategoryName(mCategory.getId(), newCategoryName);
@@ -126,6 +109,30 @@ public class BookmarkCategorySettingsFragment extends BaseMwmToolbarFragment
return !TextUtils.equals(categoryName, mCategory.getName()); return !TextUtils.equals(categoryName, mCategory.getName());
} }
private boolean validateCategoryName(@Nullable String name)
{
if (TextUtils.isEmpty(name))
{
new MaterialAlertDialogBuilder(requireActivity(), R.style.MwmTheme_AlertDialog)
.setTitle(R.string.bookmarks_error_title_empty_list_name)
.setMessage(R.string.bookmarks_error_message_empty_list_name)
.setPositiveButton(R.string.ok, null)
.show();
return false;
}
if (BookmarkManager.INSTANCE.isUsedCategoryName(name) && !TextUtils.equals(name, mCategory.getName()))
{
new MaterialAlertDialogBuilder(requireActivity(), R.style.MwmTheme_AlertDialog)
.setTitle(R.string.bookmarks_error_title_list_name_already_taken)
.setMessage(R.string.bookmarks_error_message_list_name_already_taken)
.setPositiveButton(R.string.ok, null)
.show();
return false;
}
return true;
}
@NonNull @NonNull
private String getEditableCategoryName() private String getEditableCategoryName()
{ {

View File

@@ -13,7 +13,6 @@
android:paddingTop="@dimen/margin_half" android:paddingTop="@dimen/margin_half"
android:paddingBottom="@dimen/margin_half" android:paddingBottom="@dimen/margin_half"
android:layout_marginEnd="@dimen/margin_base" android:layout_marginEnd="@dimen/margin_base"
android:background="?cardBackground"
android:textAppearance="@style/MwmTextAppearance.Caption" android:textAppearance="@style/MwmTextAppearance.Caption"
tools:text="Downloaded" tools:text="Downloaded"
tools:background="#80FF0000"/> tools:background="#80FF0000"/>

View File

@@ -6,7 +6,7 @@
android:id="@+id/rl__bookmark_details" android:id="@+id/rl__bookmark_details"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?cardBackground" android:background="?appBackground"
android:padding="@dimen/margin_half"> android:padding="@dimen/margin_half">
<LinearLayout <LinearLayout
android:id="@+id/ll__bookmark_name" android:id="@+id/ll__bookmark_name"

View File

@@ -3,7 +3,7 @@
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" android:orientation="vertical"
android:background="?cardBackground" android:background="?appBackground"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<com.google.android.material.appbar.MaterialToolbar <com.google.android.material.appbar.MaterialToolbar
@@ -12,15 +12,13 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:theme="@style/MwmWidget.ToolbarTheme"> android:theme="@style/MwmWidget.ToolbarTheme">
<com.google.android.material.button.MaterialButton <com.google.android.material.imageview.ShapeableImageView
android:id="@+id/save" android:id="@+id/save"
android:layout_width="?actionBarSize" android:layout_width="?actionBarSize"
android:layout_height="?actionBarSize" android:layout_height="?actionBarSize"
android:scaleType="centerInside"
android:layout_gravity="end|center_vertical" android:layout_gravity="end|center_vertical"
app:icon="@drawable/ic_done" app:srcCompat="@drawable/ic_done"/>
app:iconGravity="textStart"
app:iconPadding="0dp"
app:iconSize="24dp" />
</com.google.android.material.appbar.MaterialToolbar> </com.google.android.material.appbar.MaterialToolbar>
<androidx.core.widget.NestedScrollView <androidx.core.widget.NestedScrollView
android:scrollbars="none" android:scrollbars="none"
@@ -71,7 +69,6 @@
android:inputType="textMultiLine"/> android:inputType="textMultiLine"/>
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
<View <View
android:background="?cardBackground"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"/> android:layout_height="match_parent"/>
</LinearLayout> </LinearLayout>

View File

@@ -4,7 +4,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
style="@style/MwmWidget.Floating" style="@style/MwmWidget.Floating"
android:background="?cardBackground" android:background="?appBackground"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<include layout="@layout/toolbar_with_search"/> <include layout="@layout/toolbar_with_search"/>

View File

@@ -4,7 +4,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?cardBackground"> android:background="?appBackground">
<com.google.android.material.appbar.MaterialToolbar <com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar" android:id="@+id/toolbar"
style="@style/MwmWidget.ToolbarStyle" style="@style/MwmWidget.ToolbarStyle"

View File

@@ -10,13 +10,12 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:id="@+id/frameLayout" android:id="@+id/frameLayout"
android:background="?cardBackground"> android:background="?appBackground">
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/phones_recycler" android:id="@+id/phones_recycler"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?cardBackground"
android:scrollbars="vertical" /> android:scrollbars="vertical" />
</FrameLayout> </FrameLayout>

View File

@@ -61,12 +61,12 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:clickable="true" android:clickable="true"
android:focusable="true" android:focusable="true"
android:background="?cardBackground"> android:background="?appBackground">
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler" android:id="@+id/recycler"
android:clipToPadding="false" android:clipToPadding="false"
android:background="?cardBackground" android:background="?appBackground"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
/> />

View File

@@ -9,7 +9,7 @@
style="@style/MwmWidget.FrameLayout.Elevation" style="@style/MwmWidget.FrameLayout.Elevation"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?windowBackgroundForced" android:background="?appBackground"
android:layout_above="@+id/tv__mode_switch" android:layout_above="@+id/tv__mode_switch"
android:layout_below="@id/toolbar"/> android:layout_below="@id/toolbar"/>
@@ -19,7 +19,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignTop="@+id/tv__mode_switch" android:layout_alignTop="@+id/tv__mode_switch"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:background="?cardBackground"/> android:background="?appBackground"/>
<com.google.android.material.textview.MaterialTextView <com.google.android.material.textview.MaterialTextView
android:id="@+id/tv__mode_switch" android:id="@+id/tv__mode_switch"

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<ScrollView <ScrollView
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@@ -17,9 +17,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
style="@style/MwmWidget.M3.Editor.CardView" style="@style/MwmWidget.M3.Editor.CardView"
card_view:cardBackgroundColor="?cardBackground" app:cardBackgroundColor="?cardBackground"
card_view:cardCornerRadius="2dp" app:cardElevation="4dp">
card_view:cardElevation="4dp">
<com.google.android.material.textfield.TextInputEditText <com.google.android.material.textfield.TextInputEditText
android:id="@+id/et__timetable" android:id="@+id/et__timetable"
@@ -40,9 +39,9 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_half" android:layout_marginTop="@dimen/margin_half"
card_view:cardBackgroundColor="?cardBackground" style="@style/MwmWidget.M3.Editor.CardView"
card_view:cardCornerRadius="2dp" app:cardBackgroundColor="?cardBackground"
card_view:cardElevation="4dp"> app:cardElevation="4dp">
<LinearLayout <LinearLayout
android:id="@+id/examples" android:id="@+id/examples"

View File

@@ -3,7 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?cardBackground" android:background="?appBackground"
android:padding="@dimen/margin_base"> android:padding="@dimen/margin_base">
<LinearLayout <LinearLayout

View File

@@ -5,7 +5,7 @@
style="@style/MwmTextAppearance.Headline6" style="@style/MwmTextAppearance.Headline6"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?windowBackgroundForced" android:background="?appBackground"
android:gravity="start|center_vertical" android:gravity="start|center_vertical"
android:paddingStart="@dimen/margin_base" android:paddingStart="@dimen/margin_base"
android:paddingTop="@dimen/margin_base_plus" android:paddingTop="@dimen/margin_base_plus"

View File

@@ -6,7 +6,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_gravity="center" android:layout_gravity="center"
android:orientation="vertical" android:orientation="vertical"
android:background="?cardBackground" android:background="?appBackground"
android:padding="@dimen/margin_base"> android:padding="@dimen/margin_base">
<com.google.android.material.textview.MaterialTextView <com.google.android.material.textview.MaterialTextView
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@@ -4,7 +4,7 @@
android:id="@+id/menu_frame" android:id="@+id/menu_frame"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?cardBackground" android:background="?appBackground"
android:clickable="true" android:clickable="true"
android:visibility="gone" android:visibility="gone"
tools:visibility="visible"> tools:visibility="visible">

View File

@@ -2,7 +2,7 @@
<LinearLayout <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:orientation="horizontal"
android:background="?cardBackground" android:background="?appBackground"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">

View File

@@ -29,7 +29,7 @@
<com.google.android.material.textview.MaterialTextView <com.google.android.material.textview.MaterialTextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?cardBackground" android:background="?appBackground"
android:padding="@dimen/margin_base" android:padding="@dimen/margin_base"
android:text="@string/editor_focus_map_on_location" android:text="@string/editor_focus_map_on_location"
app:layout_constraintTop_toBottomOf="@+id/toolbar_point_chooser" /> app:layout_constraintTop_toBottomOf="@+id/toolbar_point_chooser" />

View File

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

View File

@@ -6,7 +6,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:minHeight="@dimen/height_block_base" android:minHeight="@dimen/height_block_base"
android:background="?cardBackground" android:background="?appBackground"
android:baselineAligned="false"> android:baselineAligned="false">
<LinearLayout <LinearLayout
android:id="@+id/btn__search_point" android:id="@+id/btn__search_point"