Merge pull request #10672 from osmandapp/fix_online_routing_ui_p4
Fix online routing UI p4
This commit is contained in:
commit
20dfb00b1f
2 changed files with 27 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue