Skip to content

Commit

Permalink
Get relative size between image and text.
Browse files Browse the repository at this point in the history
  • Loading branch information
anpez committed Jan 21, 2016
1 parent 102710a commit 696835e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 3 additions & 3 deletions textimageview/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ext {
siteUrl = 'https://github.com/ANPez/TextImageView'
gitUrl = 'https://github.com/ANPez/TextImageView.git'

libraryVersion = '2.2.1'
libraryVersion = '2.3'

developerId = 'anpez'
developerName = 'Antonio Nicolás Pina'
Expand All @@ -31,8 +31,8 @@ android {
defaultConfig {
minSdkVersion 5
targetSdkVersion 23
versionCode 6
versionName "2.2.1"
versionCode 7
versionName "2.3"
}
buildTypes {
release {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public void setText(String text) {
*/
public void setTypeface(Typeface typeface) {
paint.setTypeface(typeface);
invalidate();
setText(text);
}

/**
Expand Down Expand Up @@ -242,4 +242,12 @@ public PointF getTextPosition() {
public void setOnTextMovedListener(OnTextMovedListener listener) {
this.onTextMovedListener = listener;
}

/**
* Get the relative size between the image and the text.
* @return Relative size. Eg. 0.5=text half the height of the image.
*/
public float getTextRelativeSize() {
return paint.getTextSize() / imageRect.height();
}
}

0 comments on commit 696835e

Please sign in to comment.