Fix profile name multiline, active color, hide keyboard when back pressed
This commit is contained in:
parent
0431e16a5c
commit
39a02f2eb2
2 changed files with 17 additions and 9 deletions
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
|
@ -10,22 +10,21 @@
|
|||
<net.osmand.plus.widgets.OsmandTextFieldBoxes
|
||||
android:id="@+id/profile_name_otfb"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_margin="@dimen/list_content_padding"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
app:labelText="@string/profile_name_hint"
|
||||
android:layout_margin="@dimen/list_content_padding"
|
||||
app:primaryColor="@color/active_color_primary_dark"
|
||||
app:secondaryColor="?android:textColorSecondary">
|
||||
app:secondaryColor="?android:textColorSecondary"
|
||||
app:labelText="@string/profile_name_hint">
|
||||
|
||||
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
|
||||
android:id="@+id/profile_name_et"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:lines="1"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:inputType="text|textMultiLine|textCapSentences"
|
||||
android:scrollHorizontally="false"
|
||||
android:maxLines="4"
|
||||
tools:text="@string/lorem_ipsum" />
|
||||
|
||||
</net.osmand.plus.widgets.OsmandTextFieldBoxes>
|
||||
|
||||
</LinearLayout>
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue