diff --git a/OsmAnd/build.gradle b/OsmAnd/build.gradle index e52705773c..1de4d7f005 100644 --- a/OsmAnd/build.gradle +++ b/OsmAnd/build.gradle @@ -495,7 +495,7 @@ dependencies { exclude group: 'com.android.support' } implementation 'com.github.PhilJay:MPAndroidChart:v3.0.1' - implementation ("com.github.HITGIF:TextFieldBoxes:1.3.5"){ + implementation ("com.github.HITGIF:TextFieldBoxes:1.4.4"){ exclude group: 'com.android.support' } diff --git a/OsmAnd/res/layout/preference_dropdown_list.xml b/OsmAnd/res/layout/preference_dropdown_list.xml index 58d5baedba..78e57317f9 100644 --- a/OsmAnd/res/layout/preference_dropdown_list.xml +++ b/OsmAnd/res/layout/preference_dropdown_list.xml @@ -14,7 +14,7 @@ android:layout_marginTop="@dimen/list_header_top_margin" android:layout_marginEnd="@dimen/list_content_padding" android:layout_marginRight="@dimen/list_content_padding" - android:layout_marginBottom="8dp"> + android:layout_marginBottom="@dimen/content_padding_half"> diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/SaveAsTrackBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/SaveAsTrackBottomSheetDialogFragment.java index 0c893db19b..dab783ff26 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/SaveAsTrackBottomSheetDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/SaveAsTrackBottomSheetDialogFragment.java @@ -105,9 +105,6 @@ public class SaveAsTrackBottomSheetDialogFragment extends BottomSheetDialogFragm final EditText nameEditText = (EditText) mainView.findViewById(R.id.name_edit_text); nameEditText.setText(displayedName); nameEditText.setTextColor(ContextCompat.getColor(getContext(), textPrimaryColor)); - if (textBox instanceof OsmandTextFieldBoxes) { - ((OsmandTextFieldBoxes) textBox).activate(true); - } mainView.findViewById(R.id.save_button).setOnClickListener(new View.OnClickListener() { @Override diff --git a/OsmAnd/src/net/osmand/plus/monitoring/OnSaveCurrentTrackFragment.java b/OsmAnd/src/net/osmand/plus/monitoring/OnSaveCurrentTrackFragment.java index 6765a435c1..4ca4097e0a 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/OnSaveCurrentTrackFragment.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/OnSaveCurrentTrackFragment.java @@ -86,7 +86,6 @@ public class OnSaveCurrentTrackFragment extends BottomSheetDialogFragment { final EditText nameEditText = (EditText) mainView.findViewById(R.id.name_edit_text); nameEditText.setText(savedGpxName); nameEditText.setTextColor(ContextCompat.getColor(ctx, textPrimaryColor)); - textBox.activate(true); nameEditText.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { diff --git a/OsmAnd/src/net/osmand/plus/settings/bottomsheets/EditTextPreferenceBottomSheet.java b/OsmAnd/src/net/osmand/plus/settings/bottomsheets/EditTextPreferenceBottomSheet.java index 3868fcc6f2..07b29c57f4 100644 --- a/OsmAnd/src/net/osmand/plus/settings/bottomsheets/EditTextPreferenceBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/settings/bottomsheets/EditTextPreferenceBottomSheet.java @@ -7,8 +7,8 @@ import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.view.View; +import android.view.ViewGroup; import android.widget.EditText; -import android.widget.RelativeLayout; import net.osmand.AndroidUtils; import net.osmand.plus.ApplicationMode; @@ -50,9 +50,9 @@ public class EditTextPreferenceBottomSheet extends BasePreferenceBottomSheet { editText = view.findViewById(R.id.edit_text); editText.setText(text); - RelativeLayout editTextLayout = view.findViewById(R.id.text_field_boxes_editTextLayout); - if (editTextLayout != null && editTextLayout.getLayoutParams() instanceof RelativeLayout.LayoutParams) { - RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) editTextLayout.getLayoutParams(); + ViewGroup editTextLayout = view.findViewById(R.id.text_field_boxes_editTextLayout); + if (editTextLayout != null && editTextLayout.getLayoutParams() instanceof ViewGroup.MarginLayoutParams) { + ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) editTextLayout.getLayoutParams(); params.setMargins(params.leftMargin, AndroidUtils.dpToPx(ctx, 9), params.rightMargin, params.bottomMargin); } diff --git a/OsmAnd/src/net/osmand/plus/widgets/OsmandTextFieldBoxes.java b/OsmAnd/src/net/osmand/plus/widgets/OsmandTextFieldBoxes.java index 7449a29a0c..9f6aed3c9e 100644 --- a/OsmAnd/src/net/osmand/plus/widgets/OsmandTextFieldBoxes.java +++ b/OsmAnd/src/net/osmand/plus/widgets/OsmandTextFieldBoxes.java @@ -1,20 +1,12 @@ package net.osmand.plus.widgets; import android.content.Context; -import android.support.v4.view.ViewCompat; import android.util.AttributeSet; -import android.view.View; -import android.view.inputmethod.InputMethodManager; -import net.osmand.plus.R; - -import studio.carbonylgroup.textfieldboxes.ExtendedEditText; import studio.carbonylgroup.textfieldboxes.TextFieldBoxes; public class OsmandTextFieldBoxes extends TextFieldBoxes { - private boolean useOsmandKeyboard; - public OsmandTextFieldBoxes(Context context) { super(context); } @@ -27,83 +19,4 @@ public class OsmandTextFieldBoxes extends TextFieldBoxes { super(context, attrs, defStyleAttr); } - public void setUseOsmandKeyboard(boolean useOsmandKeyboard) { - this.useOsmandKeyboard = useOsmandKeyboard; - } - - @Override - protected void onFinishInflate() { - super.onFinishInflate(); - if (editText != null) { - this.panel.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View view) { - select(); - } - }); - - this.iconImageButton.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - select(); - } - }); - } - } - - public void select() { - if(!OsmandTextFieldBoxes.this.isActivated()) { - OsmandTextFieldBoxes.this.activate(true); - } - - OsmandTextFieldBoxes.this.setHasFocus(true); - if (!useOsmandKeyboard) { - OsmandTextFieldBoxes.this.inputMethodManager.showSoftInput(OsmandTextFieldBoxes.this.editText, InputMethodManager.SHOW_IMPLICIT); - } - performClick(); - } - - @Override - public void activate(boolean animated) { - super.activate(animated); - } - - @Override - public void deactivate() { - if(this.editText.getText().toString().isEmpty()) { - ViewCompat.animate(this.floatingLabel).alpha(1.0F).scaleX(1.0F).scaleY(1.0F).translationY(0.0F).setDuration((long)this.ANIMATION_DURATION); - this.editTextLayout.setVisibility(View.INVISIBLE); - if(this.editText.hasFocus()) { - if (!useOsmandKeyboard) { - this.inputMethodManager.hideSoftInputFromWindow(this.editText.getWindowToken(), InputMethodManager.RESULT_UNCHANGED_SHOWN); - } - this.editText.clearFocus(); - } - } - - this.activated = false; - } - - public ExtendedEditText getEditText() { - return editText; - } - - @Override - protected void makeCursorBlink() { - CharSequence hintCache = this.editText.getHint(); - this.editText.setHint(" "); - this.editText.setHint(hintCache); - } - - @Override - public void setError(String errorText, boolean giveFocus) { - super.setError(errorText, giveFocus); - this.findViewById(R.id.text_field_boxes_bottom).setVisibility(View.VISIBLE); - } - - @Override - public void removeError() { - super.removeError(); - this.findViewById(R.id.text_field_boxes_bottom).setVisibility(View.GONE); - } }