From 077d5fcf6cda376fd9d39f898f1d069a0486e2ff Mon Sep 17 00:00:00 2001 From: Dima-1 Date: Tue, 26 May 2020 23:10:23 +0300 Subject: [PATCH 1/4] Fix appbar height --- .../res/layout/global_preference_toolbar.xml | 1 + ...global_preferences_toolbar_with_switch.xml | 1 + .../res/layout/profile_preference_toolbar.xml | 1 + .../profile_preference_toolbar_with_icon.xml | 1 + OsmAnd/res/layout/search_advanced_coords.xml | 27 +++++++++++-------- OsmAnd/res/layout/search_custom_poi.xml | 16 ++++++----- OsmAnd/res/layout/search_dialog_fragment.xml | 5 ++-- OsmAnd/res/values-large/sizes.xml | 1 - OsmAnd/res/values/sizes.xml | 3 ++- OsmAnd/res/values/styles.xml | 2 ++ 10 files changed, 36 insertions(+), 22 deletions(-) diff --git a/OsmAnd/res/layout/global_preference_toolbar.xml b/OsmAnd/res/layout/global_preference_toolbar.xml index 44b75ad95f..9419eed5f0 100644 --- a/OsmAnd/res/layout/global_preference_toolbar.xml +++ b/OsmAnd/res/layout/global_preference_toolbar.xml @@ -5,6 +5,7 @@ android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" + android:minHeight="@dimen/toolbar_height" android:background="?attr/actionModeBackground" android:padding="0dp" app:contentInsetLeft="0dp" diff --git a/OsmAnd/res/layout/global_preferences_toolbar_with_switch.xml b/OsmAnd/res/layout/global_preferences_toolbar_with_switch.xml index 8d062117ae..ba39eb6412 100644 --- a/OsmAnd/res/layout/global_preferences_toolbar_with_switch.xml +++ b/OsmAnd/res/layout/global_preferences_toolbar_with_switch.xml @@ -6,6 +6,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?attr/actionModeBackground" + android:minHeight="@dimen/toolbar_height" app:contentInsetLeft="0dp" app:contentInsetStart="0dp" app:contentInsetRight="0dp" diff --git a/OsmAnd/res/layout/profile_preference_toolbar.xml b/OsmAnd/res/layout/profile_preference_toolbar.xml index 3b38185038..2c013b3f00 100644 --- a/OsmAnd/res/layout/profile_preference_toolbar.xml +++ b/OsmAnd/res/layout/profile_preference_toolbar.xml @@ -4,6 +4,7 @@ android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" + android:minHeight="@dimen/toolbar_height" osmand:contentInsetLeft="0dp" osmand:contentInsetStart="0dp" osmand:contentInsetRight="0dp" diff --git a/OsmAnd/res/layout/profile_preference_toolbar_with_icon.xml b/OsmAnd/res/layout/profile_preference_toolbar_with_icon.xml index d8b1dafaaa..98f2b0966d 100644 --- a/OsmAnd/res/layout/profile_preference_toolbar_with_icon.xml +++ b/OsmAnd/res/layout/profile_preference_toolbar_with_icon.xml @@ -6,6 +6,7 @@ android:layout_height="wrap_content" android:background="?attr/actionModeBackground" android:minHeight="@dimen/toolbar_height" + android:padding="0dp" osmand:contentInsetLeft="0dp" osmand:contentInsetStart="0dp" osmand:contentInsetRight="0dp" diff --git a/OsmAnd/res/layout/search_advanced_coords.xml b/OsmAnd/res/layout/search_advanced_coords.xml index 04f7aaa16e..75b3ee5b4e 100644 --- a/OsmAnd/res/layout/search_advanced_coords.xml +++ b/OsmAnd/res/layout/search_advanced_coords.xml @@ -1,10 +1,11 @@ + xmlns:osmand="http://schemas.android.com/apk/res-auto" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> @@ -28,10 +31,11 @@ android:gravity="center_vertical" android:orientation="horizontal"> - + osmand:typeface="@string/font_roboto_medium" + android:textSize="@dimen/dialog_header_text_size"/> + android:layout_marginStart="8dp" + android:layout_marginEnd="8dp" /> diff --git a/OsmAnd/res/layout/search_custom_poi.xml b/OsmAnd/res/layout/search_custom_poi.xml index 7023b905ce..23234ebc92 100644 --- a/OsmAnd/res/layout/search_custom_poi.xml +++ b/OsmAnd/res/layout/search_custom_poi.xml @@ -9,7 +9,7 @@ + android:layout_height="@dimen/toolbar_height"> @@ -31,15 +33,14 @@ - + osmand:typeface="@string/font_roboto_medium" + android:textSize="@dimen/dialog_header_text_size"/> diff --git a/OsmAnd/res/layout/search_dialog_fragment.xml b/OsmAnd/res/layout/search_dialog_fragment.xml index 964a025182..3b8e813f83 100644 --- a/OsmAnd/res/layout/search_dialog_fragment.xml +++ b/OsmAnd/res/layout/search_dialog_fragment.xml @@ -24,8 +24,9 @@ android:minHeight="@dimen/dashboard_map_toolbar" android:padding="0dp" android:theme="?attr/toolbar_theme" - app:contentInsetLeft="54dp" - app:contentInsetStart="54dp" + app:contentInsetStartWithNavigation="@dimen/toolbar_inset_start_with_navigation" + app:contentInsetLeft="0dp" + app:contentInsetStart="0dp" app:contentInsetRight="0dp" app:contentInsetEnd="0dp"> diff --git a/OsmAnd/res/values-large/sizes.xml b/OsmAnd/res/values-large/sizes.xml index 70b9e5eb7e..07047222d2 100644 --- a/OsmAnd/res/values-large/sizes.xml +++ b/OsmAnd/res/values-large/sizes.xml @@ -121,7 +121,6 @@ 450dp 54dp - 64dp 24dp \ No newline at end of file diff --git a/OsmAnd/res/values/sizes.xml b/OsmAnd/res/values/sizes.xml index cd33774ac5..8f6a9e92ab 100644 --- a/OsmAnd/res/values/sizes.xml +++ b/OsmAnd/res/values/sizes.xml @@ -9,7 +9,7 @@ 60dp 56dp 4dp - 64dp + 56dp 32dp 20dp 28sp @@ -335,6 +335,7 @@ 56dp 96dp + 72dp 36dp 80dp diff --git a/OsmAnd/res/values/styles.xml b/OsmAnd/res/values/styles.xml index 468bdfe57d..9213c31d88 100644 --- a/OsmAnd/res/values/styles.xml +++ b/OsmAnd/res/values/styles.xml @@ -287,6 +287,7 @@ @style/OsmandPreferenceTheme @color/stroked_buttons_and_links_outline_light @drawable/btn_bg_border_inactive_light + @dimen/action_bar_height + + diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsFragment.java index aef82939d1..ca633e3885 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsFragment.java @@ -124,7 +124,7 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl MAP_DURING_NAVIGATION(MapDuringNavigationFragment.class.getName(), true, ApplyQueryType.SNACK_BAR, R.xml.map_during_navigation, R.layout.profile_preference_toolbar), TURN_SCREEN_ON(TurnScreenOnFragment.class.getName(), true, ApplyQueryType.SNACK_BAR, R.xml.turn_screen_on, R.layout.profile_preference_toolbar_with_switch), DATA_STORAGE(DataStorageFragment.class.getName(), false, null, R.xml.data_storage, R.layout.global_preference_toolbar), - DIALOGS_AND_NOTIFICATIONS_SETTINGS(DialogsAndNotificationsSettingsFragment.class.getName(), false, null, R.xml.dialogs_and_notifications_preferences, R.layout.global_preferences_toolbar_with_switch), + DIALOGS_AND_NOTIFICATIONS_SETTINGS(DialogsAndNotificationsSettingsFragment.class.getName(), false, null, R.xml.dialogs_and_notifications_preferences, R.layout.global_preference_toolbar), PROFILE_APPEARANCE(ProfileAppearanceFragment.TAG, true, null, R.xml.profile_appearance, R.layout.profile_preference_toolbar), OPEN_STREET_MAP_EDITING(OsmEditingFragment.class.getName(), false, null, R.xml.osm_editing, R.layout.global_preference_toolbar), MULTIMEDIA_NOTES(MultimediaNotesFragment.class.getName(), true, ApplyQueryType.SNACK_BAR, R.xml.multimedia_notes, R.layout.profile_preference_toolbar), diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/DialogsAndNotificationsSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/DialogsAndNotificationsSettingsFragment.java index 5fc75b9685..95c4d8e29d 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/DialogsAndNotificationsSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/DialogsAndNotificationsSettingsFragment.java @@ -15,7 +15,6 @@ public class DialogsAndNotificationsSettingsFragment extends BaseSettingsFragmen @Override protected void createToolbar(LayoutInflater inflater, View view) { super.createToolbar(inflater, view); - view.findViewById(R.id.toolbar_switch_container).setVisibility(View.GONE); } @Override From ed5f75193419152b7efc7d00da80cf3c4b2edfdb Mon Sep 17 00:00:00 2001 From: Dima-1 Date: Thu, 28 May 2020 11:46:38 +0300 Subject: [PATCH 4/4] Fix review --- .../res/layout-land/fragment_coordinate_input_dialog.xml | 8 ++++---- .../DialogsAndNotificationsSettingsFragment.java | 8 -------- .../explore/travelcards/TravelDownloadUpdateCard.java | 6 ++---- 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/OsmAnd/res/layout-land/fragment_coordinate_input_dialog.xml b/OsmAnd/res/layout-land/fragment_coordinate_input_dialog.xml index c130a2b515..940317d3bb 100644 --- a/OsmAnd/res/layout-land/fragment_coordinate_input_dialog.xml +++ b/OsmAnd/res/layout-land/fragment_coordinate_input_dialog.xml @@ -57,15 +57,15 @@ android:ellipsize="end" android:gravity="center_vertical" android:maxLines="1" - android:paddingLeft="16dp" - android:paddingRight="16dp" + android:paddingLeft="@dimen/content_padding" + android:paddingRight="@dimen/content_padding" android:text="@string/shared_string_options" android:textAllCaps="true" android:textColor="@color/color_white" android:textSize="@dimen/default_list_text_size" osmand:typeface="@string/font_roboto_medium" - android:paddingStart="16dp" - android:paddingEnd="16dp" /> + android:paddingStart="@dimen/content_padding" + android:paddingEnd="@dimen/content_padding" /> diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/DialogsAndNotificationsSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/DialogsAndNotificationsSettingsFragment.java index 95c4d8e29d..ec29d13f98 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/DialogsAndNotificationsSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/DialogsAndNotificationsSettingsFragment.java @@ -1,8 +1,5 @@ package net.osmand.plus.settings.fragments; -import android.view.LayoutInflater; -import android.view.View; - import androidx.preference.Preference; import androidx.preference.SwitchPreferenceCompat; @@ -12,11 +9,6 @@ public class DialogsAndNotificationsSettingsFragment extends BaseSettingsFragmen public static final String TAG = DialogsAndNotificationsSettingsFragment.class.getSimpleName(); - @Override - protected void createToolbar(LayoutInflater inflater, View view) { - super.createToolbar(inflater, view); - } - @Override protected void setupPreferences() { Preference mapDuringNavigationInfo = findPreference("dialogs_and_notifications_preferences_info"); diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/TravelDownloadUpdateCard.java b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/TravelDownloadUpdateCard.java index 49984b1604..d7aaa23bb7 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/TravelDownloadUpdateCard.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/TravelDownloadUpdateCard.java @@ -9,8 +9,6 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.StringRes; -import androidx.appcompat.content.res.AppCompatResources; -import androidx.core.content.ContextCompat; import androidx.recyclerview.widget.RecyclerView; import net.osmand.plus.OsmandApplication; @@ -68,7 +66,7 @@ public class TravelDownloadUpdateCard extends BaseTravelCard { DownloadUpdateVH holder = (DownloadUpdateVH) viewHolder; this.ref = new WeakReference(holder); holder.title.setText(getTitle(loading)); - holder.icon.setImageResource(getIcon()); + holder.icon.setImageResource(getIconRes()); holder.description.setText(getDescription()); if (indexItem == null) { holder.fileDataContainer.setVisibility(View.GONE); @@ -117,7 +115,7 @@ public class TravelDownloadUpdateCard extends BaseTravelCard { return app.getString(download ? R.string.download_file : R.string.update_is_available); } - private int getIcon() { + private int getIconRes() { return download ? R.drawable.travel_card_download_icon : R.drawable.travel_card_update_icon; }