From 0dc6c36b99cab135bee936b7d4668e2a521ecdd2 Mon Sep 17 00:00:00 2001 From: Nazar-Kutz Date: Thu, 27 Feb 2020 16:04:18 +0200 Subject: [PATCH 1/3] Refresh TextFieldBoxes library --- OsmAnd/build.gradle | 2 +- .../res/layout/preference_dropdown_list.xml | 12 ++--- .../SaveAsTrackBottomSheetDialogFragment.java | 3 -- .../OnSaveCurrentTrackFragment.java | 1 - .../EditTextPreferenceBottomSheet.java | 8 ++-- .../plus/widgets/OsmandTextFieldBoxes.java | 47 ------------------- 6 files changed, 8 insertions(+), 65 deletions(-) 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..9f3bb7945f 100644 --- a/OsmAnd/res/layout/preference_dropdown_list.xml +++ b/OsmAnd/res/layout/preference_dropdown_list.xml @@ -7,6 +7,7 @@ android:orientation="vertical"> + android:layout_marginBottom="@dimen/content_padding_half"> @@ -44,13 +45,6 @@ - - \ No newline at end of file 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..565abc93b3 100644 --- a/OsmAnd/src/net/osmand/plus/widgets/OsmandTextFieldBoxes.java +++ b/OsmAnd/src/net/osmand/plus/widgets/OsmandTextFieldBoxes.java @@ -1,14 +1,10 @@ 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 { @@ -63,47 +59,4 @@ public class OsmandTextFieldBoxes extends TextFieldBoxes { 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); - } } From ead1fa4c4b94bee9c7b6122df0a75ced07db43fc Mon Sep 17 00:00:00 2001 From: Nazar-Kutz Date: Fri, 28 Feb 2020 18:27:57 +0200 Subject: [PATCH 2/3] Fix "Master Profile" is not clickable --- OsmAnd/res/layout/preference_dropdown_list.xml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/layout/preference_dropdown_list.xml b/OsmAnd/res/layout/preference_dropdown_list.xml index 9f3bb7945f..78e57317f9 100644 --- a/OsmAnd/res/layout/preference_dropdown_list.xml +++ b/OsmAnd/res/layout/preference_dropdown_list.xml @@ -7,7 +7,6 @@ android:orientation="vertical"> + + \ No newline at end of file From c87177782af212d1741add54cba831a5ab033365 Mon Sep 17 00:00:00 2001 From: Nazar-Kutz Date: Fri, 28 Feb 2020 18:36:39 +0200 Subject: [PATCH 3/3] Remove unnecessary code --- .../plus/widgets/OsmandTextFieldBoxes.java | 40 ------------------- 1 file changed, 40 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/widgets/OsmandTextFieldBoxes.java b/OsmAnd/src/net/osmand/plus/widgets/OsmandTextFieldBoxes.java index 565abc93b3..9f6aed3c9e 100644 --- a/OsmAnd/src/net/osmand/plus/widgets/OsmandTextFieldBoxes.java +++ b/OsmAnd/src/net/osmand/plus/widgets/OsmandTextFieldBoxes.java @@ -2,15 +2,11 @@ package net.osmand.plus.widgets; import android.content.Context; import android.util.AttributeSet; -import android.view.View; -import android.view.inputmethod.InputMethodManager; import studio.carbonylgroup.textfieldboxes.TextFieldBoxes; public class OsmandTextFieldBoxes extends TextFieldBoxes { - private boolean useOsmandKeyboard; - public OsmandTextFieldBoxes(Context context) { super(context); } @@ -23,40 +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(); - } - }