From 39a02f2eb246830e4f85a6bb9ecc050757a74c32 Mon Sep 17 00:00:00 2001 From: Dima-1 Date: Tue, 24 Dec 2019 13:54:23 +0200 Subject: [PATCH] Fix profile name multiline, active color, hide keyboard when back pressed --- OsmAnd/res/layout/preference_text_field.xml | 17 ++++++++--------- .../settings/ProfileAppearanceFragment.java | 9 +++++++++ 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/OsmAnd/res/layout/preference_text_field.xml b/OsmAnd/res/layout/preference_text_field.xml index c8fd71c944..53bfd30d10 100644 --- a/OsmAnd/res/layout/preference_text_field.xml +++ b/OsmAnd/res/layout/preference_text_field.xml @@ -1,7 +1,7 @@ + app:secondaryColor="?android:textColorSecondary" + app:labelText="@string/profile_name_hint"> - \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/settings/ProfileAppearanceFragment.java b/OsmAnd/src/net/osmand/plus/settings/ProfileAppearanceFragment.java index 089cdd8b97..d4be179b5e 100644 --- a/OsmAnd/src/net/osmand/plus/settings/ProfileAppearanceFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/ProfileAppearanceFragment.java @@ -4,6 +4,7 @@ import android.annotation.SuppressLint; import android.app.Activity; import android.content.Context; import android.content.DialogInterface; +import android.graphics.PorterDuff; import android.graphics.drawable.GradientDrawable; import android.os.Bundle; import android.support.annotation.Nullable; @@ -74,6 +75,7 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment { private EditText profileName; private FlowLayout colorItems; private FlowLayout iconItems; + private OsmandTextFieldBoxes profileNameOtfb; @Override public void onCreate(Bundle savedInstanceState) { @@ -256,8 +258,10 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment { changedProfile.name = s.toString(); } }); + profileNameOtfb = (OsmandTextFieldBoxes) holder.findViewById(R.id.profile_name_otfb); } else if (MASTER_PROFILE.equals(preference.getKey())) { baseProfileName = (EditText) holder.findViewById(R.id.master_profile_et); + baseProfileName.setFocusable(false); baseProfileName.setText(changedProfile.parent != null ? changedProfile.parent.toHumanString(getContext()) : getSelectedAppMode().toHumanString(getContext())); @@ -344,6 +348,10 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment { if (iconItems != null) { setIconNewColor(changedProfile.iconRes); } + int selectedColor = ContextCompat.getColor(app, + changedProfile.color.getColor(isNightMode())); + profileNameOtfb.setPrimaryColor(selectedColor); + profileName.getBackground().mutate().setColorFilter(selectedColor, PorterDuff.Mode.SRC_ATOP); updateProfileButton(); } @@ -487,6 +495,7 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment { } public boolean isProfileAppearanceChanged(final MapActivity mapActivity) { + hideKeyboard(); if (isChanged()) { AlertDialog.Builder dismissDialog = createWarningDialog(getActivity(), R.string.shared_string_dismiss, R.string.exit_without_saving, R.string.shared_string_cancel);