Refresh TextFieldBoxes library

This commit is contained in:
Nazar-Kutz 2020-02-27 16:04:18 +02:00
parent fc65678ce4
commit 0dc6c36b99
6 changed files with 8 additions and 65 deletions

View file

@ -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'
}

View file

@ -7,6 +7,7 @@
android:orientation="vertical">
<FrameLayout
android:id="@+id/select_nav_type_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/list_content_padding"
@ -14,7 +15,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">
<ImageView
android:id="@+id/type_down_arrow"
@ -30,7 +31,7 @@
android:id="@+id/master_profile_otfb"
android:layout_width="match_parent"
android:layout_height="60dp"
app:labelText="@string/master_profile"
app:labelText="@string/profile_type_base_string"
app:primaryColor="@color/active_color_primary_dark"
app:secondaryColor="?android:textColorSecondary">
@ -44,13 +45,6 @@
</net.osmand.plus.widgets.OsmandTextFieldBoxes>
<FrameLayout
android:id="@+id/select_nav_type_btn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:focusable="true" />
</FrameLayout>
</LinearLayout>

View file

@ -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

View file

@ -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) {

View file

@ -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);
}

View file

@ -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);
}
}