From ce1b921447409188986d8fd3f9701a35c3026219 Mon Sep 17 00:00:00 2001 From: "Daniele Verducci (Slimpenguin)" Date: Fri, 1 Mar 2024 07:20:29 +0100 Subject: [PATCH] Category reset button --- .../detail/GeofavoriteDetailActivity.java | 6 +++ app/src/main/res/drawable/ic_clear.xml | 5 +++ .../layout/activity_geofavorite_detail.xml | 39 ++++++++++++------- 3 files changed, 37 insertions(+), 13 deletions(-) create mode 100644 app/src/main/res/drawable/ic_clear.xml diff --git a/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/detail/GeofavoriteDetailActivity.java b/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/detail/GeofavoriteDetailActivity.java index 00e151f..49a9b05 100644 --- a/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/detail/GeofavoriteDetailActivity.java +++ b/app/src/main/java/it/danieleverducci/nextcloudmaps/activity/detail/GeofavoriteDetailActivity.java @@ -307,6 +307,12 @@ public class GeofavoriteDetailActivity extends NextcloudMapsStyledActivity imple CategoriesAdapter categoriesAdapter = new CategoriesAdapter(binding.root.getContext()); this.binding.categoryAt.setAdapter(categoriesAdapter); this.binding.categoryAt.setText(Geofavorite.DEFAULT_CATEGORY); + this.binding.categoryAtClear.setOnClickListener((v) -> { + if (this.binding.categoryAt.getText().toString().isEmpty()) + this.binding.categoryAt.setText(Geofavorite.DEFAULT_CATEGORY); + else + this.binding.categoryAt.setText(""); + }); // Set map properties this.binding.map.getZoomController().setVisibility(CustomZoomButtonsController.Visibility.NEVER); diff --git a/app/src/main/res/drawable/ic_clear.xml b/app/src/main/res/drawable/ic_clear.xml new file mode 100644 index 0000000..844b6b6 --- /dev/null +++ b/app/src/main/res/drawable/ic_clear.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/layout/activity_geofavorite_detail.xml b/app/src/main/res/layout/activity_geofavorite_detail.xml index 8becd41..4d10f5f 100644 --- a/app/src/main/res/layout/activity_geofavorite_detail.xml +++ b/app/src/main/res/layout/activity_geofavorite_detail.xml @@ -198,21 +198,34 @@ android:drawableTint="@color/defaultBrand" android:hint="@string/description"/> - + android:orientation="horizontal" + android:layout_marginTop="20dp"> + + + + + +