Skip to content

Commit

Permalink
fix awesometextview not respecting android:gravity if present
Browse files Browse the repository at this point in the history
  • Loading branch information
fractalwrench committed Dec 10, 2016
1 parent ea1a1f1 commit 508253e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,13 @@ private void initialise(AttributeSet attrs) {
markdownText = a.getString(R.styleable.AwesomeTextView_bootstrapText);

setClickable(clickable); // allows view to reach android:state_pressed

int gravity = a.getInt(R.styleable.AwesomeTextView_android_gravity, Gravity.CENTER);
setGravity(gravity);
}
finally {
a.recycle();
}
setGravity(Gravity.CENTER);

if (markdownText != null) {
setMarkdownText(markdownText);
Expand Down
1 change: 1 addition & 0 deletions AndroidBootstrap/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<attr name="typicon"/>
<attr name="materialIcon" />
<attr name="android:clickable" />
<attr name="android:gravity" />
</declare-styleable>

<declare-styleable name="BootstrapLabel">
Expand Down
3 changes: 2 additions & 1 deletion sample/src/main/res/layout/example_awesome_text_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@
style="@style/wrapping_fa_text"
android:textSize="30dp"
app:bootstrapBrand="primary"
app:bootstrapText="Escaped \{fa_facebook\} icon"
app:bootstrapText="Escaped \{fa_facebook\} icon (gravity=start)"
android:gravity="start"
tools:ignore="SpUsage"
/>

Expand Down
4 changes: 2 additions & 2 deletions sample/src/main/res/layout/example_bootstrap_button.xml
Original file line number Diff line number Diff line change
Expand Up @@ -466,8 +466,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/micro_padding"
android:gravity="center"
android:text="Matching"
android:gravity="right"
android:text="Matching (gravity right)"
app:bootstrapBrand="info"
/>

Expand Down
4 changes: 2 additions & 2 deletions sample/src/main/res/layout/example_bootstrap_label.xml
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/micro_padding"
android:gravity="center"
android:text="Match Parent"
android:gravity="end"
android:text="Match Parent (gravity end)"
app:bootstrapBrand="primary"
/>

Expand Down

0 comments on commit 508253e

Please sign in to comment.