Merge pull request #10672 from osmandapp/fix_online_routing_ui_p4

Fix online routing UI p4
This commit is contained in:
Vitaliy 2021-01-27 13:11:52 +02:00 committed by GitHub
commit 20dfb00b1f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 2 deletions

View file

@ -2,6 +2,7 @@ package net.osmand.plus.onlinerouting.ui;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.Gravity;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnFocusChangeListener;
@ -79,6 +80,7 @@ public class OnlineRoutingCard extends BaseCard {
int activeColor = ContextCompat.getColor(app, appMode.getIconColorInfo().getColor(nightMode));
textFieldBoxes.setPrimaryColor(activeColor);
textFieldBoxes.setGravityFloatingLabel(Gravity.START);
editText.addTextChangedListener(new TextWatcher() {
@Override

View file

@ -26,7 +26,30 @@ public class OsmandTextFieldBoxes extends TextFieldBoxes {
floatingLabel.setVisibility(View.GONE);
labelSpace.setVisibility(View.GONE);
labelSpaceBelow.setVisibility(View.GONE);
int paddingH = getResources().getDimensionPixelSize(R.dimen.route_info_card_details_margin);
inputLayout.setPadding(0, paddingH, 0, paddingH);
int paddingV = getResources().getDimensionPixelSize(R.dimen.route_info_card_details_margin);
inputLayout.setPadding(0, paddingV, 0, paddingV);
}
public void setGravityFloatingLabel(int gravity) {
floatingLabel.setGravity(gravity);
}
@Override
public void setLabelText(String labelText) {
super.setLabelText(labelText);
floatingLabel.post(new Runnable() {
@Override
public void run() {
if (floatingLabel.getLineCount() > 1) {
inputLayout.setPadding(
inputLayout.getPaddingLeft(),
getResources().getDimensionPixelOffset(useDenseSpacing ? R.dimen.dense_editTextLayout_padding_top : R.dimen.editTextLayout_padding_top) +
getResources().getDimensionPixelSize(useDenseSpacing ? R.dimen.context_menu_first_line_top_margin : R.dimen.content_padding_small),
inputLayout.getPaddingRight(),
inputLayout.getPaddingBottom()
);
}
}
});
}
}