Skip to content

Commit

Permalink
[UI] Update spacing, padding and margins of layouts, chips and edittext
Browse files Browse the repository at this point in the history
  • Loading branch information
Denvar committed Mar 17, 2016
1 parent 8c352e1 commit 622dbc8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
9 changes: 5 additions & 4 deletions library/src/main/java/com/doodle/android/chips/ChipsView.java
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,9 @@ private void init() {
mEditText.requestFocus();

Resources r = getResources();
int px = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, r.getDisplayMetrics());
mEditText.setPadding(px, px, px, 0);
int px8 = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, r.getDisplayMetrics());
int px12 = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 12, r.getDisplayMetrics());
mEditText.setPadding(px8, px12, px8, 0);
//mEditText.setLineSpacing(1.0f, 1.0f);
addView(mEditText);

Expand All @@ -239,7 +240,7 @@ public void onClick(View v) {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
unSelectChipsExcept(null);
//unSelectChipsExcept(null);
}
}
});
Expand Down Expand Up @@ -311,7 +312,7 @@ public void run() {
}

RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.topMargin = (int) (textLineParams.row * (CHIP_HEIGHT * mDensity) + textLineParams.row * (TEXT_EXTRA_TOP_MARGIN * mDensity));
params.topMargin = (int) ((textLineParams.row * ((CHIP_HEIGHT * mDensity)) + (textLineParams.row * (TEXT_EXTRA_TOP_MARGIN * mDensity))));
mEditText.setLayoutParams(params);
addLeadingMarginSpan(textLineParams.lineMargin);
if (moveCursor) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public TextLineParams onChipsChanged(List<ChipsView.Chip> chips) {
Resources r = getResources();
int px8 = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, r.getDisplayMetrics());
MarginLayoutParams mlp = (MarginLayoutParams) view.getLayoutParams();
mlp.setMargins(0, 0, px8, px8);
mlp.setMargins(0, 0, px8, 0);
view.setLayoutParams(mlp);

view.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
Expand Down Expand Up @@ -93,10 +93,10 @@ public TextLineParams onChipsChanged(List<ChipsView.Chip> chips) {

private LinearLayout createHorizontalView() {
Resources r = getResources();
int px4 = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, r.getDisplayMetrics());
int px8 = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, r.getDisplayMetrics());
int px16 = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, r.getDisplayMetrics());
LinearLayout ll = new LinearLayout(getContext());
ll.setPadding(px16, 0, 0, (int) (ChipsView.CHIP_BOTTOM_PADDING * mDensity));
ll.setPadding(0, px8, 0, (int) (ChipsView.CHIP_BOTTOM_PADDING * mDensity));
ll.setOrientation(HORIZONTAL);
addView(ll);
mLineLayouts.add(ll);
Expand Down

0 comments on commit 622dbc8

Please sign in to comment.