Skip to content

Commit

Permalink
button automatic all caps off
Browse files Browse the repository at this point in the history
  • Loading branch information
fmerzadyan committed Nov 3, 2016
1 parent 0758ced commit c73e1d1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import java.util.HashMap;

import android.os.Build;
import org.appcelerator.kroll.KrollDict;
import org.appcelerator.kroll.KrollProxy;
import org.appcelerator.kroll.common.Log;
Expand Down Expand Up @@ -130,6 +131,12 @@ public void processProperties(KrollDict d)
if (needShadow) {
btn.setShadowLayer(shadowRadius, shadowX, shadowY, shadowColor);
}
if (d.containsKey(TiC.PROPERTY_TEXT_ALL_CAPS)){
boolean caps = TiConvert.toBoolean(d.get(TiC.PROPERTY_TEXT_ALL_CAPS), false);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
btn.setAllCaps(caps);
}
}
btn.invalidate();
}

Expand Down Expand Up @@ -182,6 +189,11 @@ public void propertyChanged(String key, Object oldValue, Object newValue, KrollP
} else {
btn.getBackground().setColorFilter( TiConvert.toColor(TiConvert.toString(newValue)), Mode.MULTIPLY);
}
} else if (key.equals(TiC.PROPERTY_TEXT_ALL_CAPS)) {
boolean caps = TiConvert.toBoolean(newValue);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
btn.setAllCaps(caps);
}
} else {
super.propertyChanged(key, oldValue, newValue, proxy);
}
Expand Down
5 changes: 5 additions & 0 deletions android/titanium/src/java/org/appcelerator/titanium/TiC.java
Original file line number Diff line number Diff line change
Expand Up @@ -2638,6 +2638,11 @@ public class TiC
*/
public static final String PROPERTY_TEXT_ALIGN = "textAlign";

/**
* @module.api
*/
public static final String PROPERTY_TEXT_ALL_CAPS = "textAllCaps";

/**
* @module.api
*/
Expand Down
7 changes: 7 additions & 0 deletions apidoc/Titanium/UI/Button.yml
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,13 @@ properties:
constants: Titanium.UI.TEXT_ALIGNMENT_*
default: <Titanium.UI.TEXT_ALIGNMENT_CENTER>

- name: textAllCaps
summary: |
All text to upper case letters, specified using true or false.
type: Boolean
since: "6.1.0"
platforms: [android]

- name: tintColor
summary: Button tint color.
type: String
Expand Down

0 comments on commit c73e1d1

Please sign in to comment.