133873d2b41a5cd2597b20a4e88eb8942944c0f23Tyler Schultzpackage com.xtremelabs.robolectric.shadows;
26eedf728138e6f79fa898ff3e31bf61c9b1151dChristian Williams & Tyler Schulz
3a739b57a6b1a99f14d586f609f0f62f48b8e2284Ian Fisher & Tyler Schultzimport android.content.Context;
4ac2aa24a0f43988de36443e0beb8c2e0aacf2ceePhil Goodwin & Rick Kawalaimport android.graphics.Typeface;
5924f851cb0ec279b6974744ce623f25bdc657551Ryan Richardimport android.graphics.drawable.Drawable;
6085b7edfe02ef0ae1870b514066bb5b8b2176fadAmrit Thakur & Chris Perryimport android.text.Layout;
77c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richardimport android.text.SpannableStringBuilder;
87c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richardimport android.text.TextPaint;
97c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richardimport android.text.TextWatcher;
10a7f06139c4d3795b9301db66cc7cdfa6eb6b35ceRobert Taylorimport android.text.method.MovementMethod;
119e562ba543ceec13e2553e043c24b15ff6d999ebPhil Goodwin & Tyler Schultzimport android.text.method.TransformationMethod;
121712b8163f6212ee27c973d4cdffc8c9bf0ad2ecChristian Williams & Jay Phillipsimport android.text.style.URLSpan;
13542bd08b00db32a43d0a5ffe137017e04bcd7022Christian Williamsimport android.text.util.Linkify;
145411bf7cde998b5c2e70b69fe3d7227b6783ab7cChristian Williamsimport android.view.KeyEvent;
15085b7edfe02ef0ae1870b514066bb5b8b2176fadAmrit Thakur & Chris Perryimport android.view.MotionEvent;
1668984598dcddf1115c1cf25d464bed946b698fe1Graeme Duncanimport android.view.inputmethod.EditorInfo;
176eedf728138e6f79fa898ff3e31bf61c9b1151dChristian Williams & Tyler Schulzimport android.widget.TextView;
1822c22c9aa4ca68c2deac6164edc1d82bc9645310Christian Williams & Phil Goodwinimport com.xtremelabs.robolectric.internal.Implementation;
1922c22c9aa4ca68c2deac6164edc1d82bc9645310Christian Williams & Phil Goodwinimport com.xtremelabs.robolectric.internal.Implements;
206eedf728138e6f79fa898ff3e31bf61c9b1151dChristian Williams & Tyler Schulz
21ae27d6b8b8a2625fd075798272330227ba29e7daTyler Schultzimport java.util.ArrayList;
22ae27d6b8b8a2625fd075798272330227ba29e7daTyler Schultzimport java.util.List;
23ae27d6b8b8a2625fd075798272330227ba29e7daTyler Schultz
24ae27d6b8b8a2625fd075798272330227ba29e7daTyler Schultzimport static android.view.View.VISIBLE;
25e429b89e0edf6b77099f40e7e3af40b0cc1e7fc4Amrit Thakur & Ryan Richardimport static com.xtremelabs.robolectric.Robolectric.shadowOf;
26ae27d6b8b8a2625fd075798272330227ba29e7daTyler Schultzimport static com.xtremelabs.robolectric.Robolectric.shadowOf_;
27ae27d6b8b8a2625fd075798272330227ba29e7daTyler Schultz
280b378afcde0200166e546c46a7642015accfce49Christian Williams & Ian Fisher@SuppressWarnings({"UnusedDeclaration"})
290b378afcde0200166e546c46a7642015accfce49Christian Williams & Ian Fisher@Implements(TextView.class)
30afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williamspublic class ShadowTextView extends ShadowView {
3107002220b5af63a89e960902a080af69fc26e5f8Christian Williams    private CharSequence text = "";
32b523828506f361eb25c5ad2438793070c4dc0e3aAmrit Thakur & Phil Goodwin    private CompoundDrawables compoundDrawablesImpl = new CompoundDrawables(0, 0, 0, 0);
33e7cb7f6d274ac8c8cef12ef71644120bc479508bPhil Goodwin & Tyler Schultz    private Integer textColorHexValue;
3459efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry    private Integer hintColorHexValue;
35e7cb7f6d274ac8c8cef12ef71644120bc479508bPhil Goodwin & Tyler Schultz    private float textSize = 14.0f;
36620694ded8735cba729537b6cd7abfa5cdf57eb4Christian Williams & Phil Goodwin    private boolean autoLinkPhoneNumbers;
37542bd08b00db32a43d0a5ffe137017e04bcd7022Christian Williams    private int autoLinkMask;
38602a09d30446366755f442899b0563cc47af2b2bRyan Richard & Tyler Schultz    private CharSequence hintText;
39f956f7ee243bb701f1747b30629d1f6d9f703552Jon Boekenoogen    private CharSequence errorText;
40a329318a8b2661107af6f9b25ffecf892b3c2c72Christian Williams & Ryan Richard    private int compoundDrawablePadding;
41aa03b8dbd148420164db6b62f143ea0dc7710217Rich Humphrey    private MovementMethod movementMethod;
42cd1a58362a63860cbecd57e5234079fa51652783Rich Humphrey    private boolean linksClickable;
43d698df6daecfc469b84ace2c7fdaff79e85f21eaKathy Lin    private int gravity;
449d1f4261b8e45bd2589eb1b1d9c9ecb8b725ca4dMike Grafton & Tyler Schultz    private TextView.OnEditorActionListener onEditorActionListener;
4568984598dcddf1115c1cf25d464bed946b698fe1Graeme Duncan    private int imeOptions = EditorInfo.IME_NULL;
46a739b57a6b1a99f14d586f609f0f62f48b8e2284Ian Fisher & Tyler Schultz    private int textAppearanceId;
479e562ba543ceec13e2553e043c24b15ff6d999ebPhil Goodwin & Tyler Schultz    private TransformationMethod transformationMethod;
484d301be1f2097d19ddf02b2946118d843b73bda5Sebastien Plisson    private int inputType;
49ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin    protected int selectionStart = 0;
50ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin    protected int selectionEnd = 0;
51ac2aa24a0f43988de36443e0beb8c2e0aacf2ceePhil Goodwin & Rick Kawala    private Typeface typeface;
526eedf728138e6f79fa898ff3e31bf61c9b1151dChristian Williams & Tyler Schulz
53a7f06139c4d3795b9301db66cc7cdfa6eb6b35ceRobert Taylor    private List<TextWatcher> watchers = new ArrayList<TextWatcher>();
54ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin    private List<Integer> previousKeyCodes = new ArrayList<Integer>();
55ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin    private List<KeyEvent> previousKeyEvents = new ArrayList<KeyEvent>();
56085b7edfe02ef0ae1870b514066bb5b8b2176fadAmrit Thakur & Chris Perry    private Layout layout;
577c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard
58da0feef86ad33ac9ff8c0b9f9d700d3e94c0c5f1Joe Moore & Ryan Richard    @Override
59da0feef86ad33ac9ff8c0b9f9d700d3e94c0c5f1Joe Moore & Ryan Richard    public void applyAttributes() {
603c5249864cabd318d8b3f551f2f4ab7af7434f8bChristian Williams        super.applyAttributes();
6104bc6b2dbe94e0108e80c7dcef3d5b3c988e1222Phil Goodwin & Tyler Schultz        applyTextAttribute();
62da0feef86ad33ac9ff8c0b9f9d700d3e94c0c5f1Joe Moore & Ryan Richard        applyTextColorAttribute();
6359efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry        applyHintAttribute();
6459efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry        applyHintColorAttribute();
6504bc6b2dbe94e0108e80c7dcef3d5b3c988e1222Phil Goodwin & Tyler Schultz        applyCompoundDrawablesWithIntrinsicBoundsAttributes();
6670e43520d16dba344ad0f2f96e5d9300880153ffPhil Goodwin & Tyler Schultz    }
6770e43520d16dba344ad0f2f96e5d9300880153ffPhil Goodwin & Tyler Schultz
687c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard    @Implementation(i18nSafe = false)
69775ccf7ae53d9b4c77d3adf2514f26747cebd89cIan Fisher & Ryan Richard    public void setText(CharSequence text) {
707c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard        if (text == null) {
7135a84059bfd69e953541a69ba353a941c9579a99Phil Goodwin & Ryan Richard            text = "";
7235a84059bfd69e953541a69ba353a941c9579a99Phil Goodwin & Ryan Richard        }
737c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard
749125fa3a62463a074b6242cde6335202ee06d216Aaron VonderHaar & Ryan Richard        sendBeforeTextChanged(text);
759125fa3a62463a074b6242cde6335202ee06d216Aaron VonderHaar & Ryan Richard
767c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard        CharSequence oldValue = this.text;
776eedf728138e6f79fa898ff3e31bf61c9b1151dChristian Williams & Tyler Schulz        this.text = text;
787c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard
79a7f06139c4d3795b9301db66cc7cdfa6eb6b35ceRobert Taylor        sendOnTextChanged(oldValue);
80a7f06139c4d3795b9301db66cc7cdfa6eb6b35ceRobert Taylor        sendAfterTextChanged();
816eedf728138e6f79fa898ff3e31bf61c9b1151dChristian Williams & Tyler Schulz    }
827c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard
837c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard    @Implementation
847c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard    public final void append(CharSequence text) {
85ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin        boolean isSelectStartAtEnd = selectionStart == this.text.length();
86ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin        boolean isSelectEndAtEnd = selectionEnd == this.text.length();
870ca6ffe3e44f6bcdf8f4064567210f60b3cdd991Valtteri Virtanen        CharSequence oldValue = this.text;
880ca6ffe3e44f6bcdf8f4064567210f60b3cdd991Valtteri Virtanen        StringBuffer sb = new StringBuffer(this.text);
890ca6ffe3e44f6bcdf8f4064567210f60b3cdd991Valtteri Virtanen        sb.append(text);
907c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard
9192b72e88b2f0b73754a709ae432306f0652058deValtteri Virtanen        sendBeforeTextChanged(sb.toString());
920ca6ffe3e44f6bcdf8f4064567210f60b3cdd991Valtteri Virtanen        this.text = sb.toString();
937c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard
94ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin        if (isSelectStartAtEnd) {
95ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin            selectionStart = this.text.length();
96ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin        }
97ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin        if (isSelectEndAtEnd) {
98ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin            selectionEnd = this.text.length();
99ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin        }
100ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin
1010ca6ffe3e44f6bcdf8f4064567210f60b3cdd991Valtteri Virtanen        sendOnTextChanged(oldValue);
1020ca6ffe3e44f6bcdf8f4064567210f60b3cdd991Valtteri Virtanen        sendAfterTextChanged();
1030ca6ffe3e44f6bcdf8f4064567210f60b3cdd991Valtteri Virtanen    }
1046eedf728138e6f79fa898ff3e31bf61c9b1151dChristian Williams & Tyler Schulz
105de9feed5ddf1d91a3e76cbc71712c36a7652201eChristian Williams    @Implementation
106775ccf7ae53d9b4c77d3adf2514f26747cebd89cIan Fisher & Ryan Richard    public void setText(int textResourceId) {
1077c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard        sendBeforeTextChanged(text);
1087c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard
1097c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard        CharSequence oldValue = this.text;
110684ccc2fc5a1c79aa45af22b95c37f7c509a00c1Christian Williams        this.text = getResources().getText(textResourceId);
1117c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard
1127c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard        sendOnTextChanged(oldValue);
113a7f06139c4d3795b9301db66cc7cdfa6eb6b35ceRobert Taylor        sendAfterTextChanged();
114810ca4e6f0dc6d69504b3e03ef61155f10083fbeChristian Williams & Joe Moore    }
115810ca4e6f0dc6d69504b3e03ef61155f10083fbeChristian Williams & Joe Moore
116a7f06139c4d3795b9301db66cc7cdfa6eb6b35ceRobert Taylor    private void sendAfterTextChanged() {
1177c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard        for (TextWatcher watcher : watchers) {
118a7f06139c4d3795b9301db66cc7cdfa6eb6b35ceRobert Taylor            watcher.afterTextChanged(new SpannableStringBuilder(getText()));
119ae27d6b8b8a2625fd075798272330227ba29e7daTyler Schultz        }
1207c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard    }
121a7f06139c4d3795b9301db66cc7cdfa6eb6b35ceRobert Taylor
1227c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard    private void sendOnTextChanged(CharSequence oldValue) {
1237c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard        for (TextWatcher watcher : watchers) {
1247c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard            watcher.onTextChanged(text, 0, oldValue.length(), text.length());
125ae27d6b8b8a2625fd075798272330227ba29e7daTyler Schultz        }
1267c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard    }
127a7f06139c4d3795b9301db66cc7cdfa6eb6b35ceRobert Taylor
1287c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard    private void sendBeforeTextChanged(CharSequence newValue) {
1297c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard        for (TextWatcher watcher : watchers) {
1307c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard            watcher.beforeTextChanged(this.text, 0, this.text.length(), newValue.length());
131ae27d6b8b8a2625fd075798272330227ba29e7daTyler Schultz        }
1327c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard    }
1337c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard
134de9feed5ddf1d91a3e76cbc71712c36a7652201eChristian Williams    @Implementation
1356eedf728138e6f79fa898ff3e31bf61c9b1151dChristian Williams & Tyler Schulz    public CharSequence getText() {
1366eedf728138e6f79fa898ff3e31bf61c9b1151dChristian Williams & Tyler Schulz        return text;
1376eedf728138e6f79fa898ff3e31bf61c9b1151dChristian Williams & Tyler Schulz    }
13821da5e43a4a57a9c76b9f7a9e335268e93feb262Christian Williams & Harry Ugol
139de9feed5ddf1d91a3e76cbc71712c36a7652201eChristian Williams    @Implementation
140ac2aa24a0f43988de36443e0beb8c2e0aacf2ceePhil Goodwin & Rick Kawala    public Typeface getTypeface() {
141ac2aa24a0f43988de36443e0beb8c2e0aacf2ceePhil Goodwin & Rick Kawala        return typeface;
142ac2aa24a0f43988de36443e0beb8c2e0aacf2ceePhil Goodwin & Rick Kawala    }
143ac2aa24a0f43988de36443e0beb8c2e0aacf2ceePhil Goodwin & Rick Kawala
144ac2aa24a0f43988de36443e0beb8c2e0aacf2ceePhil Goodwin & Rick Kawala    @Implementation
145ac2aa24a0f43988de36443e0beb8c2e0aacf2ceePhil Goodwin & Rick Kawala    public void setTypeface(Typeface typeface) {
146ac2aa24a0f43988de36443e0beb8c2e0aacf2ceePhil Goodwin & Rick Kawala        this.typeface = typeface;
147ac2aa24a0f43988de36443e0beb8c2e0aacf2ceePhil Goodwin & Rick Kawala    }
148ac2aa24a0f43988de36443e0beb8c2e0aacf2ceePhil Goodwin & Rick Kawala
149ac2aa24a0f43988de36443e0beb8c2e0aacf2ceePhil Goodwin & Rick Kawala    @Implementation
1500f455051f747e5c472b939665ef66487819c3c6eChristian Williams & Ian Fisher    public int length() {
1510f455051f747e5c472b939665ef66487819c3c6eChristian Williams & Ian Fisher        return text.length();
1520f455051f747e5c472b939665ef66487819c3c6eChristian Williams & Ian Fisher    }
1530f455051f747e5c472b939665ef66487819c3c6eChristian Williams & Ian Fisher
154de9feed5ddf1d91a3e76cbc71712c36a7652201eChristian Williams    @Implementation
155f33e228a6f3eed1c97488df2ca30da315324aa1eHarry Ugol    public void setTextColor(int color) {
15618061bf213790ec5c347bf7fbb22f50fa858b1c2Ian Fisher & Tyler Schultz        textColorHexValue = color;
157f33e228a6f3eed1c97488df2ca30da315324aa1eHarry Ugol    }
158f33e228a6f3eed1c97488df2ca30da315324aa1eHarry Ugol
159de9feed5ddf1d91a3e76cbc71712c36a7652201eChristian Williams    @Implementation
160f33e228a6f3eed1c97488df2ca30da315324aa1eHarry Ugol    public void setTextSize(float size) {
161e7cb7f6d274ac8c8cef12ef71644120bc479508bPhil Goodwin & Tyler Schultz        textSize = size;
162f33e228a6f3eed1c97488df2ca30da315324aa1eHarry Ugol    }
163f33e228a6f3eed1c97488df2ca30da315324aa1eHarry Ugol
164de9feed5ddf1d91a3e76cbc71712c36a7652201eChristian Williams    @Implementation
16559efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry    public void setTextAppearance(Context context, int resid) {
16659efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry        textAppearanceId = resid;
16759efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry    }
16859efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry
16959efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry    @Implementation
1707c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard    public void setInputType(int type) {
1714d301be1f2097d19ddf02b2946118d843b73bda5Sebastien Plisson        this.inputType = type;
1724d301be1f2097d19ddf02b2946118d843b73bda5Sebastien Plisson    }
1734d301be1f2097d19ddf02b2946118d843b73bda5Sebastien Plisson
1744d301be1f2097d19ddf02b2946118d843b73bda5Sebastien Plisson    @Implementation
1754d301be1f2097d19ddf02b2946118d843b73bda5Sebastien Plisson    public int getInputType() {
1764d301be1f2097d19ddf02b2946118d843b73bda5Sebastien Plisson        return this.inputType;
1774d301be1f2097d19ddf02b2946118d843b73bda5Sebastien Plisson    }
1784d301be1f2097d19ddf02b2946118d843b73bda5Sebastien Plisson
1794d301be1f2097d19ddf02b2946118d843b73bda5Sebastien Plisson    @Implementation
180602a09d30446366755f442899b0563cc47af2b2bRyan Richard & Tyler Schultz    public final void setHint(int resId) {
181602a09d30446366755f442899b0563cc47af2b2bRyan Richard & Tyler Schultz        this.hintText = getResources().getText(resId);
182602a09d30446366755f442899b0563cc47af2b2bRyan Richard & Tyler Schultz    }
183602a09d30446366755f442899b0563cc47af2b2bRyan Richard & Tyler Schultz
1847c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard    @Implementation(i18nSafe = false)
18559efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry    public final void setHint(CharSequence hintText) {
18659efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry        this.hintText = hintText;
187a739b57a6b1a99f14d586f609f0f62f48b8e2284Ian Fisher & Tyler Schultz    }
188a739b57a6b1a99f14d586f609f0f62f48b8e2284Ian Fisher & Tyler Schultz
189a739b57a6b1a99f14d586f609f0f62f48b8e2284Ian Fisher & Tyler Schultz    @Implementation
190602a09d30446366755f442899b0563cc47af2b2bRyan Richard & Tyler Schultz    public CharSequence getHint() {
191602a09d30446366755f442899b0563cc47af2b2bRyan Richard & Tyler Schultz        return hintText;
192602a09d30446366755f442899b0563cc47af2b2bRyan Richard & Tyler Schultz    }
19359efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry
1947c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard    @Implementation
19559efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry    public final void setHintTextColor(int color) {
19659efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry        hintColorHexValue = color;
19759efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry    }
1987c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard
199aa03b8dbd148420164db6b62f143ea0dc7710217Rich Humphrey    @Implementation
200cd1a58362a63860cbecd57e5234079fa51652783Rich Humphrey    public final boolean getLinksClickable() {
2017c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard        return linksClickable;
202cd1a58362a63860cbecd57e5234079fa51652783Rich Humphrey    }
2037c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard
204cd1a58362a63860cbecd57e5234079fa51652783Rich Humphrey    @Implementation
205cd1a58362a63860cbecd57e5234079fa51652783Rich Humphrey    public final void setLinksClickable(boolean whether) {
2067c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard        linksClickable = whether;
207cd1a58362a63860cbecd57e5234079fa51652783Rich Humphrey    }
2087c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard
209cd1a58362a63860cbecd57e5234079fa51652783Rich Humphrey    @Implementation
210aa03b8dbd148420164db6b62f143ea0dc7710217Rich Humphrey    public final MovementMethod getMovementMethod() {
2117c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard        return movementMethod;
212aa03b8dbd148420164db6b62f143ea0dc7710217Rich Humphrey    }
213602a09d30446366755f442899b0563cc47af2b2bRyan Richard & Tyler Schultz
214de9feed5ddf1d91a3e76cbc71712c36a7652201eChristian Williams    @Implementation
215aa03b8dbd148420164db6b62f143ea0dc7710217Rich Humphrey    public final void setMovementMethod(MovementMethod movement) {
2167c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard        movementMethod = movement;
217aa03b8dbd148420164db6b62f143ea0dc7710217Rich Humphrey    }
2187c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard
219aa03b8dbd148420164db6b62f143ea0dc7710217Rich Humphrey    @Implementation
2201712b8163f6212ee27c973d4cdffc8c9bf0ad2ecChristian Williams & Jay Phillips    public URLSpan[] getUrls() {
2211712b8163f6212ee27c973d4cdffc8c9bf0ad2ecChristian Williams & Jay Phillips        String[] words = text.toString().split("\\s+");
2221712b8163f6212ee27c973d4cdffc8c9bf0ad2ecChristian Williams & Jay Phillips        List<URLSpan> urlSpans = new ArrayList<URLSpan>();
2231712b8163f6212ee27c973d4cdffc8c9bf0ad2ecChristian Williams & Jay Phillips        for (String word : words) {
2241712b8163f6212ee27c973d4cdffc8c9bf0ad2ecChristian Williams & Jay Phillips            if (word.startsWith("http://")) {
2251712b8163f6212ee27c973d4cdffc8c9bf0ad2ecChristian Williams & Jay Phillips                urlSpans.add(new URLSpan(word));
2261712b8163f6212ee27c973d4cdffc8c9bf0ad2ecChristian Williams & Jay Phillips            }
2271712b8163f6212ee27c973d4cdffc8c9bf0ad2ecChristian Williams & Jay Phillips        }
2281712b8163f6212ee27c973d4cdffc8c9bf0ad2ecChristian Williams & Jay Phillips        return urlSpans.toArray(new URLSpan[urlSpans.size()]);
2291712b8163f6212ee27c973d4cdffc8c9bf0ad2ecChristian Williams & Jay Phillips    }
2301712b8163f6212ee27c973d4cdffc8c9bf0ad2ecChristian Williams & Jay Phillips
231de9feed5ddf1d91a3e76cbc71712c36a7652201eChristian Williams    @Implementation
232542bd08b00db32a43d0a5ffe137017e04bcd7022Christian Williams    public final void setAutoLinkMask(int mask) {
233542bd08b00db32a43d0a5ffe137017e04bcd7022Christian Williams        autoLinkMask = mask;
234542bd08b00db32a43d0a5ffe137017e04bcd7022Christian Williams
235542bd08b00db32a43d0a5ffe137017e04bcd7022Christian Williams        autoLinkPhoneNumbers = (mask & Linkify.PHONE_NUMBERS) != 0;
236542bd08b00db32a43d0a5ffe137017e04bcd7022Christian Williams    }
237542bd08b00db32a43d0a5ffe137017e04bcd7022Christian Williams
238de9feed5ddf1d91a3e76cbc71712c36a7652201eChristian Williams    @Implementation
23921da5e43a4a57a9c76b9f7a9e335268e93feb262Christian Williams & Harry Ugol    public void setCompoundDrawablesWithIntrinsicBounds(int left, int top, int right, int bottom) {
240adfaceabbda4c8c51f24a0def8926075bd7306adChristian Williams        compoundDrawablesImpl = new CompoundDrawables(left, top, right, bottom);
24121da5e43a4a57a9c76b9f7a9e335268e93feb262Christian Williams & Harry Ugol    }
24221da5e43a4a57a9c76b9f7a9e335268e93feb262Christian Williams & Harry Ugol
243de9feed5ddf1d91a3e76cbc71712c36a7652201eChristian Williams    @Implementation
244924f851cb0ec279b6974744ce623f25bdc657551Ryan Richard    public void setCompoundDrawablesWithIntrinsicBounds(Drawable left, Drawable top,
245924f851cb0ec279b6974744ce623f25bdc657551Ryan Richard                                                        Drawable right, Drawable bottom) {
246adfaceabbda4c8c51f24a0def8926075bd7306adChristian Williams        compoundDrawablesImpl = new CompoundDrawables(left, top, right, bottom);
247a329318a8b2661107af6f9b25ffecf892b3c2c72Christian Williams & Ryan Richard    }
248a329318a8b2661107af6f9b25ffecf892b3c2c72Christian Williams & Ryan Richard
249a329318a8b2661107af6f9b25ffecf892b3c2c72Christian Williams & Ryan Richard    @Implementation
250a329318a8b2661107af6f9b25ffecf892b3c2c72Christian Williams & Ryan Richard    public void setCompoundDrawables(Drawable left, Drawable top, Drawable right, Drawable bottom) {
251adfaceabbda4c8c51f24a0def8926075bd7306adChristian Williams        compoundDrawablesImpl = new CompoundDrawables(left, top, right, bottom);
252924f851cb0ec279b6974744ce623f25bdc657551Ryan Richard    }
253924f851cb0ec279b6974744ce623f25bdc657551Ryan Richard
254de9feed5ddf1d91a3e76cbc71712c36a7652201eChristian Williams    @Implementation
255924f851cb0ec279b6974744ce623f25bdc657551Ryan Richard    public Drawable[] getCompoundDrawables() {
256620694ded8735cba729537b6cd7abfa5cdf57eb4Christian Williams & Phil Goodwin        if (compoundDrawablesImpl == null) {
257924f851cb0ec279b6974744ce623f25bdc657551Ryan Richard            return new Drawable[]{null, null, null, null};
258924f851cb0ec279b6974744ce623f25bdc657551Ryan Richard        }
259924f851cb0ec279b6974744ce623f25bdc657551Ryan Richard        return new Drawable[]{
260620694ded8735cba729537b6cd7abfa5cdf57eb4Christian Williams & Phil Goodwin                compoundDrawablesImpl.leftDrawable,
261620694ded8735cba729537b6cd7abfa5cdf57eb4Christian Williams & Phil Goodwin                compoundDrawablesImpl.topDrawable,
262620694ded8735cba729537b6cd7abfa5cdf57eb4Christian Williams & Phil Goodwin                compoundDrawablesImpl.rightDrawable,
263620694ded8735cba729537b6cd7abfa5cdf57eb4Christian Williams & Phil Goodwin                compoundDrawablesImpl.bottomDrawable
264924f851cb0ec279b6974744ce623f25bdc657551Ryan Richard        };
265924f851cb0ec279b6974744ce623f25bdc657551Ryan Richard    }
266924f851cb0ec279b6974744ce623f25bdc657551Ryan Richard
267de9feed5ddf1d91a3e76cbc71712c36a7652201eChristian Williams    @Implementation
268a329318a8b2661107af6f9b25ffecf892b3c2c72Christian Williams & Ryan Richard    public void setCompoundDrawablePadding(int compoundDrawablePadding) {
269a329318a8b2661107af6f9b25ffecf892b3c2c72Christian Williams & Ryan Richard        this.compoundDrawablePadding = compoundDrawablePadding;
270a329318a8b2661107af6f9b25ffecf892b3c2c72Christian Williams & Ryan Richard    }
271a329318a8b2661107af6f9b25ffecf892b3c2c72Christian Williams & Ryan Richard
272a329318a8b2661107af6f9b25ffecf892b3c2c72Christian Williams & Ryan Richard    @Implementation
273a329318a8b2661107af6f9b25ffecf892b3c2c72Christian Williams & Ryan Richard    public int getCompoundDrawablePadding() {
274a329318a8b2661107af6f9b25ffecf892b3c2c72Christian Williams & Ryan Richard        return compoundDrawablePadding;
275a329318a8b2661107af6f9b25ffecf892b3c2c72Christian Williams & Ryan Richard    }
276a329318a8b2661107af6f9b25ffecf892b3c2c72Christian Williams & Ryan Richard
277a329318a8b2661107af6f9b25ffecf892b3c2c72Christian Williams & Ryan Richard    @Implementation
2785411bf7cde998b5c2e70b69fe3d7227b6783ab7cChristian Williams    public boolean onKeyDown(int keyCode, KeyEvent event) {
279ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin        previousKeyCodes.add(keyCode);
280ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin        previousKeyEvents.add(event);
2815411bf7cde998b5c2e70b69fe3d7227b6783ab7cChristian Williams        if (onKeyListener != null) {
2825411bf7cde998b5c2e70b69fe3d7227b6783ab7cChristian Williams            return onKeyListener.onKey(realView, keyCode, event);
2835411bf7cde998b5c2e70b69fe3d7227b6783ab7cChristian Williams        } else {
2845411bf7cde998b5c2e70b69fe3d7227b6783ab7cChristian Williams            return false;
2855411bf7cde998b5c2e70b69fe3d7227b6783ab7cChristian Williams        }
2865411bf7cde998b5c2e70b69fe3d7227b6783ab7cChristian Williams    }
2877c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard
2887c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard    @Implementation
2897c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard    public boolean onKeyUp(int keyCode, KeyEvent event) {
290ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin        previousKeyCodes.add(keyCode);
291ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin        previousKeyEvents.add(event);
2927c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard        if (onKeyListener != null) {
2937c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard            return onKeyListener.onKey(realView, keyCode, event);
2947c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard        } else {
2957c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard            return false;
2967c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard        }
2977c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard    }
2987c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard
299ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin    public int getPreviousKeyCode(int index) {
300ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin        return previousKeyCodes.get(index);
301ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin    }
302ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin
303ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin    public KeyEvent getPreviousKeyEvent(int index) {
304ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin        return previousKeyEvents.get(index);
305ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin    }
306ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin
30768984598dcddf1115c1cf25d464bed946b698fe1Graeme Duncan    @Implementation
308d698df6daecfc469b84ace2c7fdaff79e85f21eaKathy Lin    public int getGravity() {
3097c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard        return gravity;
310d698df6daecfc469b84ace2c7fdaff79e85f21eaKathy Lin    }
3117c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard
312d698df6daecfc469b84ace2c7fdaff79e85f21eaKathy Lin    @Implementation
313d698df6daecfc469b84ace2c7fdaff79e85f21eaKathy Lin    public void setGravity(int gravity) {
3147c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard        this.gravity = gravity;
315d698df6daecfc469b84ace2c7fdaff79e85f21eaKathy Lin    }
3167c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard
3177c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard
3187598f0c0b1cce3bf1902772ea09139ef98083864Ryan Richard & Tyler Schultz    @Implementation
31968984598dcddf1115c1cf25d464bed946b698fe1Graeme Duncan    public int getImeOptions() {
3207c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard        return imeOptions;
32168984598dcddf1115c1cf25d464bed946b698fe1Graeme Duncan    }
3227c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard
32368984598dcddf1115c1cf25d464bed946b698fe1Graeme Duncan    @Implementation
32468984598dcddf1115c1cf25d464bed946b698fe1Graeme Duncan    public void setImeOptions(int imeOptions) {
3257c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard        this.imeOptions = imeOptions;
32668984598dcddf1115c1cf25d464bed946b698fe1Graeme Duncan    }
3277c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard
328da9cd404c0db2ebcef4ecfb50836de00b56622f1Christian Williams    /**
329da9cd404c0db2ebcef4ecfb50836de00b56622f1Christian Williams     * Returns the text string of this {@code TextView}.
33040c6251719cccc0a84ae99c976d2836b14374ce6Christian Williams     * <p/>
331da9cd404c0db2ebcef4ecfb50836de00b56622f1Christian Williams     * Robolectric extension.
332da9cd404c0db2ebcef4ecfb50836de00b56622f1Christian Williams     */
3332ff94a9e4df5b0d3eb21bda70793b27d9f1f353cChristian Williams & Phil Goodwin    @Override
3342ff94a9e4df5b0d3eb21bda70793b27d9f1f353cChristian Williams & Phil Goodwin    public String innerText() {
3354d709f74a8a630e677915cff8fba5e8b4888800fChristian Williams & Phil Goodwin        return (text == null || getVisibility() != VISIBLE) ? "" : text.toString();
3362ff94a9e4df5b0d3eb21bda70793b27d9f1f353cChristian Williams & Phil Goodwin    }
337f956f7ee243bb701f1747b30629d1f6d9f703552Jon Boekenoogen
338f956f7ee243bb701f1747b30629d1f6d9f703552Jon Boekenoogen    @Implementation
339f956f7ee243bb701f1747b30629d1f6d9f703552Jon Boekenoogen    public void setError(CharSequence error) {
340f956f7ee243bb701f1747b30629d1f6d9f703552Jon Boekenoogen      errorText = error;
341f956f7ee243bb701f1747b30629d1f6d9f703552Jon Boekenoogen    }
342f956f7ee243bb701f1747b30629d1f6d9f703552Jon Boekenoogen
343f956f7ee243bb701f1747b30629d1f6d9f703552Jon Boekenoogen    @Implementation
344f956f7ee243bb701f1747b30629d1f6d9f703552Jon Boekenoogen    public CharSequence getError() {
345f956f7ee243bb701f1747b30629d1f6d9f703552Jon Boekenoogen      return errorText;
346f956f7ee243bb701f1747b30629d1f6d9f703552Jon Boekenoogen    }
3472ff94a9e4df5b0d3eb21bda70793b27d9f1f353cChristian Williams & Phil Goodwin
3487c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard    @Override
3497c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard    @Implementation
350bbf6ae3d37d2303d8463094096ef0bb9906fd658Christian Williams    public boolean equals(Object o) {
351537f38b99433fee0ee08d7c634763e7381942f58Phil Goodwin        return super.equals(shadowOf_(o));
352537f38b99433fee0ee08d7c634763e7381942f58Phil Goodwin    }
353537f38b99433fee0ee08d7c634763e7381942f58Phil Goodwin
3547c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard    @Override
3557c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard    @Implementation
356537f38b99433fee0ee08d7c634763e7381942f58Phil Goodwin    public int hashCode() {
357537f38b99433fee0ee08d7c634763e7381942f58Phil Goodwin        return super.hashCode();
358537f38b99433fee0ee08d7c634763e7381942f58Phil Goodwin    }
3597c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard
3607c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard    public CompoundDrawables getCompoundDrawablesImpl() {
361620694ded8735cba729537b6cd7abfa5cdf57eb4Christian Williams & Phil Goodwin        return compoundDrawablesImpl;
362620694ded8735cba729537b6cd7abfa5cdf57eb4Christian Williams & Phil Goodwin    }
363620694ded8735cba729537b6cd7abfa5cdf57eb4Christian Williams & Phil Goodwin
364620694ded8735cba729537b6cd7abfa5cdf57eb4Christian Williams & Phil Goodwin    void setCompoundDrawablesImpl(CompoundDrawables compoundDrawablesImpl) {
365620694ded8735cba729537b6cd7abfa5cdf57eb4Christian Williams & Phil Goodwin        this.compoundDrawablesImpl = compoundDrawablesImpl;
366620694ded8735cba729537b6cd7abfa5cdf57eb4Christian Williams & Phil Goodwin    }
367620694ded8735cba729537b6cd7abfa5cdf57eb4Christian Williams & Phil Goodwin
368e7cb7f6d274ac8c8cef12ef71644120bc479508bPhil Goodwin & Tyler Schultz    public Integer getTextColorHexValue() {
369620694ded8735cba729537b6cd7abfa5cdf57eb4Christian Williams & Phil Goodwin        return textColorHexValue;
370620694ded8735cba729537b6cd7abfa5cdf57eb4Christian Williams & Phil Goodwin    }
371620694ded8735cba729537b6cd7abfa5cdf57eb4Christian Williams & Phil Goodwin
372a739b57a6b1a99f14d586f609f0f62f48b8e2284Ian Fisher & Tyler Schultz    public int getTextAppearanceId() {
373a739b57a6b1a99f14d586f609f0f62f48b8e2284Ian Fisher & Tyler Schultz        return textAppearanceId;
374a739b57a6b1a99f14d586f609f0f62f48b8e2284Ian Fisher & Tyler Schultz    }
375a739b57a6b1a99f14d586f609f0f62f48b8e2284Ian Fisher & Tyler Schultz
37659efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry    public Integer getHintColorHexValue() {
37759efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry        return hintColorHexValue;
37859efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry    }
37959efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry
380bbf6ae3d37d2303d8463094096ef0bb9906fd658Christian Williams    @Implementation
381e7cb7f6d274ac8c8cef12ef71644120bc479508bPhil Goodwin & Tyler Schultz    public float getTextSize() {
382620694ded8735cba729537b6cd7abfa5cdf57eb4Christian Williams & Phil Goodwin        return textSize;
383620694ded8735cba729537b6cd7abfa5cdf57eb4Christian Williams & Phil Goodwin    }
384620694ded8735cba729537b6cd7abfa5cdf57eb4Christian Williams & Phil Goodwin
385620694ded8735cba729537b6cd7abfa5cdf57eb4Christian Williams & Phil Goodwin    public boolean isAutoLinkPhoneNumbers() {
386620694ded8735cba729537b6cd7abfa5cdf57eb4Christian Williams & Phil Goodwin        return autoLinkPhoneNumbers;
387620694ded8735cba729537b6cd7abfa5cdf57eb4Christian Williams & Phil Goodwin    }
3887c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard
38904bc6b2dbe94e0108e80c7dcef3d5b3c988e1222Phil Goodwin & Tyler Schultz    private void applyTextAttribute() {
39070e43520d16dba344ad0f2f96e5d9300880153ffPhil Goodwin & Tyler Schultz        String text = attributeSet.getAttributeValue("android", "text");
3915101cf6874bcc7ceef92354819497ea9cea04c22Phil Goodwin & Tyler Schultz        if (text != null) {
3925101cf6874bcc7ceef92354819497ea9cea04c22Phil Goodwin & Tyler Schultz            if (text.startsWith("@string/")) {
39370e43520d16dba344ad0f2f96e5d9300880153ffPhil Goodwin & Tyler Schultz                int textResId = attributeSet.getAttributeResourceValue("android", "text", 0);
39470e43520d16dba344ad0f2f96e5d9300880153ffPhil Goodwin & Tyler Schultz                text = context.getResources().getString(textResId);
3955101cf6874bcc7ceef92354819497ea9cea04c22Phil Goodwin & Tyler Schultz            }
3965101cf6874bcc7ceef92354819497ea9cea04c22Phil Goodwin & Tyler Schultz            setText(text);
3975101cf6874bcc7ceef92354819497ea9cea04c22Phil Goodwin & Tyler Schultz        }
39870e43520d16dba344ad0f2f96e5d9300880153ffPhil Goodwin & Tyler Schultz    }
3995101cf6874bcc7ceef92354819497ea9cea04c22Phil Goodwin & Tyler Schultz
400da0feef86ad33ac9ff8c0b9f9d700d3e94c0c5f1Joe Moore & Ryan Richard    private void applyTextColorAttribute() {
401da0feef86ad33ac9ff8c0b9f9d700d3e94c0c5f1Joe Moore & Ryan Richard        String colorValue = attributeSet.getAttributeValue("android", "textColor");
402da0feef86ad33ac9ff8c0b9f9d700d3e94c0c5f1Joe Moore & Ryan Richard        if (colorValue != null) {
403da0feef86ad33ac9ff8c0b9f9d700d3e94c0c5f1Joe Moore & Ryan Richard            if (colorValue.startsWith("@color/") || colorValue.startsWith("@android:color/")) {
404da0feef86ad33ac9ff8c0b9f9d700d3e94c0c5f1Joe Moore & Ryan Richard                int colorResId = attributeSet.getAttributeResourceValue("android", "textColor", 0);
405da0feef86ad33ac9ff8c0b9f9d700d3e94c0c5f1Joe Moore & Ryan Richard                setTextColor(context.getResources().getColor(colorResId));
406da0feef86ad33ac9ff8c0b9f9d700d3e94c0c5f1Joe Moore & Ryan Richard            } else if (colorValue.startsWith("#")) {
407da0feef86ad33ac9ff8c0b9f9d700d3e94c0c5f1Joe Moore & Ryan Richard                int colorFromHex = (int) Long.valueOf(colorValue.replaceAll("#", ""), 16).longValue();
408da0feef86ad33ac9ff8c0b9f9d700d3e94c0c5f1Joe Moore & Ryan Richard                setTextColor(colorFromHex);
409da0feef86ad33ac9ff8c0b9f9d700d3e94c0c5f1Joe Moore & Ryan Richard            }
410da0feef86ad33ac9ff8c0b9f9d700d3e94c0c5f1Joe Moore & Ryan Richard        }
411da0feef86ad33ac9ff8c0b9f9d700d3e94c0c5f1Joe Moore & Ryan Richard    }
412da0feef86ad33ac9ff8c0b9f9d700d3e94c0c5f1Joe Moore & Ryan Richard
41359efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry    private void applyHintAttribute() {
41459efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry        String hint = attributeSet.getAttributeValue("android", "hint");
41559efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry        if (hint != null) {
41659efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry            if (hint.startsWith("@string/")) {
41759efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry                int textResId = attributeSet.getAttributeResourceValue("android", "hint", 0);
41859efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry                hint = context.getResources().getString(textResId);
41959efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry
42059efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry            }
42159efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry            setHint(hint);
42259efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry        }
42359efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry    }
42459efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry
42559efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry    private void applyHintColorAttribute() {
42659efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry        String colorValue = attributeSet.getAttributeValue("android", "hintColor");
42759efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry        if (colorValue != null) {
42859efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry            if (colorValue.startsWith("@color/") || colorValue.startsWith("@android:color/")) {
42959efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry                int colorResId = attributeSet.getAttributeResourceValue("android", "hintColor", 0);
43059efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry                setHintTextColor(context.getResources().getColor(colorResId));
43159efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry            } else if (colorValue.startsWith("#")) {
43259efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry                int colorFromHex = (int) Long.valueOf(colorValue.replaceAll("#", ""), 16).longValue();
43359efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry                setHintTextColor(colorFromHex);
43459efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry            }
43559efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry        }
43659efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry    }
43759efa20e4642bd011ef25fd1fc7711e44cb573dcChris Perry
43804bc6b2dbe94e0108e80c7dcef3d5b3c988e1222Phil Goodwin & Tyler Schultz    private void applyCompoundDrawablesWithIntrinsicBoundsAttributes() {
4395101cf6874bcc7ceef92354819497ea9cea04c22Phil Goodwin & Tyler Schultz        setCompoundDrawablesWithIntrinsicBounds(
44004bc6b2dbe94e0108e80c7dcef3d5b3c988e1222Phil Goodwin & Tyler Schultz                attributeSet.getAttributeResourceValue("android", "drawableLeft", 0),
44104bc6b2dbe94e0108e80c7dcef3d5b3c988e1222Phil Goodwin & Tyler Schultz                attributeSet.getAttributeResourceValue("android", "drawableTop", 0),
44204bc6b2dbe94e0108e80c7dcef3d5b3c988e1222Phil Goodwin & Tyler Schultz                attributeSet.getAttributeResourceValue("android", "drawableRight", 0),
44304bc6b2dbe94e0108e80c7dcef3d5b3c988e1222Phil Goodwin & Tyler Schultz                attributeSet.getAttributeResourceValue("android", "drawableBottom", 0));
4445101cf6874bcc7ceef92354819497ea9cea04c22Phil Goodwin & Tyler Schultz    }
4455101cf6874bcc7ceef92354819497ea9cea04c22Phil Goodwin & Tyler Schultz
4469d1f4261b8e45bd2589eb1b1d9c9ecb8b725ca4dMike Grafton & Tyler Schultz    @Implementation
4479d1f4261b8e45bd2589eb1b1d9c9ecb8b725ca4dMike Grafton & Tyler Schultz    public void setOnEditorActionListener(android.widget.TextView.OnEditorActionListener onEditorActionListener) {
4489d1f4261b8e45bd2589eb1b1d9c9ecb8b725ca4dMike Grafton & Tyler Schultz        this.onEditorActionListener = onEditorActionListener;
4499d1f4261b8e45bd2589eb1b1d9c9ecb8b725ca4dMike Grafton & Tyler Schultz    }
4509d1f4261b8e45bd2589eb1b1d9c9ecb8b725ca4dMike Grafton & Tyler Schultz
451704843212960a5b84a0a57eac9519084f4b7cfe7Aaron VonderHaar & Chris Perry    public boolean triggerEditorAction(int imeAction) {
452a95c7e06f9c326c3b97f7148f60999180fd52d28Amrit Thakur & Ryan Richard        if (onEditorActionListener != null) {
453704843212960a5b84a0a57eac9519084f4b7cfe7Aaron VonderHaar & Chris Perry            return onEditorActionListener.onEditorAction((TextView) realView, imeAction, null);
454a95c7e06f9c326c3b97f7148f60999180fd52d28Amrit Thakur & Ryan Richard        }
455704843212960a5b84a0a57eac9519084f4b7cfe7Aaron VonderHaar & Chris Perry        return false;
4569d1f4261b8e45bd2589eb1b1d9c9ecb8b725ca4dMike Grafton & Tyler Schultz    }
4579d1f4261b8e45bd2589eb1b1d9c9ecb8b725ca4dMike Grafton & Tyler Schultz
4589e562ba543ceec13e2553e043c24b15ff6d999ebPhil Goodwin & Tyler Schultz    @Implementation
4599e562ba543ceec13e2553e043c24b15ff6d999ebPhil Goodwin & Tyler Schultz    public void setTransformationMethod(TransformationMethod transformationMethod) {
4609e562ba543ceec13e2553e043c24b15ff6d999ebPhil Goodwin & Tyler Schultz        this.transformationMethod = transformationMethod;
4619e562ba543ceec13e2553e043c24b15ff6d999ebPhil Goodwin & Tyler Schultz    }
4629e562ba543ceec13e2553e043c24b15ff6d999ebPhil Goodwin & Tyler Schultz
4639e562ba543ceec13e2553e043c24b15ff6d999ebPhil Goodwin & Tyler Schultz    @Implementation
4649e562ba543ceec13e2553e043c24b15ff6d999ebPhil Goodwin & Tyler Schultz    public TransformationMethod getTransformationMethod() {
4659e562ba543ceec13e2553e043c24b15ff6d999ebPhil Goodwin & Tyler Schultz        return transformationMethod;
4669e562ba543ceec13e2553e043c24b15ff6d999ebPhil Goodwin & Tyler Schultz    }
4679e562ba543ceec13e2553e043c24b15ff6d999ebPhil Goodwin & Tyler Schultz
468a7f06139c4d3795b9301db66cc7cdfa6eb6b35ceRobert Taylor    @Implementation
469a7f06139c4d3795b9301db66cc7cdfa6eb6b35ceRobert Taylor    public void addTextChangedListener(TextWatcher watcher) {
470a7f06139c4d3795b9301db66cc7cdfa6eb6b35ceRobert Taylor        this.watchers.add(watcher);
471a7f06139c4d3795b9301db66cc7cdfa6eb6b35ceRobert Taylor    }
4727c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard
473c7ce4d9b6d4f56b6348cb3340d4332a746e0c190Phil Goodwin & Ryan Richard    @Implementation
474c7ce4d9b6d4f56b6348cb3340d4332a746e0c190Phil Goodwin & Ryan Richard    public void removeTextChangedListener(TextWatcher watcher) {
475c7ce4d9b6d4f56b6348cb3340d4332a746e0c190Phil Goodwin & Ryan Richard        this.watchers.remove(watcher);
476c7ce4d9b6d4f56b6348cb3340d4332a746e0c190Phil Goodwin & Ryan Richard    }
477c7ce4d9b6d4f56b6348cb3340d4332a746e0c190Phil Goodwin & Ryan Richard
4784dda01d613890b88a9370e46ec53ef54c123f9fbAndrew Dai & Rick Kawala    @Implementation
4794dda01d613890b88a9370e46ec53ef54c123f9fbAndrew Dai & Rick Kawala    public TextPaint getPaint() {
4804dda01d613890b88a9370e46ec53ef54c123f9fbAndrew Dai & Rick Kawala        return new TextPaint();
4814dda01d613890b88a9370e46ec53ef54c123f9fbAndrew Dai & Rick Kawala    }
4824dda01d613890b88a9370e46ec53ef54c123f9fbAndrew Dai & Rick Kawala
483085b7edfe02ef0ae1870b514066bb5b8b2176fadAmrit Thakur & Chris Perry    @Implementation
484085b7edfe02ef0ae1870b514066bb5b8b2176fadAmrit Thakur & Chris Perry    public Layout getLayout() {
485085b7edfe02ef0ae1870b514066bb5b8b2176fadAmrit Thakur & Chris Perry        return this.layout;
486085b7edfe02ef0ae1870b514066bb5b8b2176fadAmrit Thakur & Chris Perry    }
487085b7edfe02ef0ae1870b514066bb5b8b2176fadAmrit Thakur & Chris Perry
488ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin    public void setSelection(int index) {
489ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin        setSelection(index, index);
490ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin    }
491ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin
492ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin    public void setSelection(int start, int end) {
493ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin        selectionStart = start;
494ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin        selectionEnd = end;
495ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin    }
496ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin
497ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin    @Implementation
498ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin    public int getSelectionStart() {
499ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin        return selectionStart;
500ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin    }
501ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin
502ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin    @Implementation
503ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin    public int getSelectionEnd() {
504ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin        return selectionEnd;
505ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin    }
506ca06528611bf165936f7d5437da41dd9d2039b94Aaron VonderHaar & Phil Goodwin
507085b7edfe02ef0ae1870b514066bb5b8b2176fadAmrit Thakur & Chris Perry    @Implementation
508085b7edfe02ef0ae1870b514066bb5b8b2176fadAmrit Thakur & Chris Perry    public boolean onTouchEvent(MotionEvent event) {
509085b7edfe02ef0ae1870b514066bb5b8b2176fadAmrit Thakur & Chris Perry        boolean superResult = super.onTouchEvent(event);
510085b7edfe02ef0ae1870b514066bb5b8b2176fadAmrit Thakur & Chris Perry
511085b7edfe02ef0ae1870b514066bb5b8b2176fadAmrit Thakur & Chris Perry        if (movementMethod != null) {
512085b7edfe02ef0ae1870b514066bb5b8b2176fadAmrit Thakur & Chris Perry            boolean handled = movementMethod.onTouchEvent(null, null, event);
513085b7edfe02ef0ae1870b514066bb5b8b2176fadAmrit Thakur & Chris Perry
514085b7edfe02ef0ae1870b514066bb5b8b2176fadAmrit Thakur & Chris Perry            if (handled) {
515085b7edfe02ef0ae1870b514066bb5b8b2176fadAmrit Thakur & Chris Perry                return true;
516085b7edfe02ef0ae1870b514066bb5b8b2176fadAmrit Thakur & Chris Perry            }
517085b7edfe02ef0ae1870b514066bb5b8b2176fadAmrit Thakur & Chris Perry        }
518085b7edfe02ef0ae1870b514066bb5b8b2176fadAmrit Thakur & Chris Perry
519085b7edfe02ef0ae1870b514066bb5b8b2176fadAmrit Thakur & Chris Perry        return superResult;
520085b7edfe02ef0ae1870b514066bb5b8b2176fadAmrit Thakur & Chris Perry    }
521085b7edfe02ef0ae1870b514066bb5b8b2176fadAmrit Thakur & Chris Perry
522a7f06139c4d3795b9301db66cc7cdfa6eb6b35ceRobert Taylor    /**
523a7f06139c4d3795b9301db66cc7cdfa6eb6b35ceRobert Taylor     * @return the list of currently registered watchers/listeners
524a7f06139c4d3795b9301db66cc7cdfa6eb6b35ceRobert Taylor     */
525a7f06139c4d3795b9301db66cc7cdfa6eb6b35ceRobert Taylor    public List<TextWatcher> getWatchers() {
526a7f06139c4d3795b9301db66cc7cdfa6eb6b35ceRobert Taylor        return watchers;
527a7f06139c4d3795b9301db66cc7cdfa6eb6b35ceRobert Taylor    }
5287c3fa256ac67b52828164cff28ff5f4545962a1aPhil Goodwin & Ryan Richard
529085b7edfe02ef0ae1870b514066bb5b8b2176fadAmrit Thakur & Chris Perry    public void setLayout(Layout layout) {
530085b7edfe02ef0ae1870b514066bb5b8b2176fadAmrit Thakur & Chris Perry        this.layout = layout;
531085b7edfe02ef0ae1870b514066bb5b8b2176fadAmrit Thakur & Chris Perry    }
532085b7edfe02ef0ae1870b514066bb5b8b2176fadAmrit Thakur & Chris Perry
5338bb1af1810bfbfd724d88898d1c4e7aef9945fb9Christian Williams & Ian Fisher    public static class CompoundDrawables {
534924f851cb0ec279b6974744ce623f25bdc657551Ryan Richard        public Drawable leftDrawable;
535924f851cb0ec279b6974744ce623f25bdc657551Ryan Richard        public Drawable topDrawable;
536924f851cb0ec279b6974744ce623f25bdc657551Ryan Richard        public Drawable rightDrawable;
537924f851cb0ec279b6974744ce623f25bdc657551Ryan Richard        public Drawable bottomDrawable;
538924f851cb0ec279b6974744ce623f25bdc657551Ryan Richard
539924f851cb0ec279b6974744ce623f25bdc657551Ryan Richard        public CompoundDrawables(Drawable left, Drawable top, Drawable right, Drawable bottom) {
540924f851cb0ec279b6974744ce623f25bdc657551Ryan Richard            leftDrawable = left;
541924f851cb0ec279b6974744ce623f25bdc657551Ryan Richard            topDrawable = top;
542924f851cb0ec279b6974744ce623f25bdc657551Ryan Richard            rightDrawable = right;
543924f851cb0ec279b6974744ce623f25bdc657551Ryan Richard            bottomDrawable = bottom;
544924f851cb0ec279b6974744ce623f25bdc657551Ryan Richard        }
54521da5e43a4a57a9c76b9f7a9e335268e93feb262Christian Williams & Harry Ugol
5468bb1af1810bfbfd724d88898d1c4e7aef9945fb9Christian Williams & Ian Fisher        public CompoundDrawables(int left, int top, int right, int bottom) {
547c14c51ed650b1b61ee07621cb32bacc6d2d79c3fAmrit Thakur & Ryan Richard            leftDrawable = left != 0 ? ShadowDrawable.createFromResourceId(left) : null;
548c14c51ed650b1b61ee07621cb32bacc6d2d79c3fAmrit Thakur & Ryan Richard            topDrawable = top != 0 ? ShadowDrawable.createFromResourceId(top) : null;
549c14c51ed650b1b61ee07621cb32bacc6d2d79c3fAmrit Thakur & Ryan Richard            rightDrawable = right != 0 ? ShadowDrawable.createFromResourceId(right) : null;
550c14c51ed650b1b61ee07621cb32bacc6d2d79c3fAmrit Thakur & Ryan Richard            bottomDrawable = bottom != 0 ? ShadowDrawable.createFromResourceId(bottom) : null;
55121da5e43a4a57a9c76b9f7a9e335268e93feb262Christian Williams & Harry Ugol        }
5528bb1af1810bfbfd724d88898d1c4e7aef9945fb9Christian Williams & Ian Fisher
5538bb1af1810bfbfd724d88898d1c4e7aef9945fb9Christian Williams & Ian Fisher        @Override
5548bb1af1810bfbfd724d88898d1c4e7aef9945fb9Christian Williams & Ian Fisher        public boolean equals(Object o) {
5558bb1af1810bfbfd724d88898d1c4e7aef9945fb9Christian Williams & Ian Fisher            if (this == o) return true;
5568bb1af1810bfbfd724d88898d1c4e7aef9945fb9Christian Williams & Ian Fisher            if (o == null || getClass() != o.getClass()) return false;
5578bb1af1810bfbfd724d88898d1c4e7aef9945fb9Christian Williams & Ian Fisher
5588bb1af1810bfbfd724d88898d1c4e7aef9945fb9Christian Williams & Ian Fisher            CompoundDrawables that = (CompoundDrawables) o;
5598bb1af1810bfbfd724d88898d1c4e7aef9945fb9Christian Williams & Ian Fisher
560e429b89e0edf6b77099f40e7e3af40b0cc1e7fc4Amrit Thakur & Ryan Richard            if (getBottom() != that.getBottom()) return false;
561e429b89e0edf6b77099f40e7e3af40b0cc1e7fc4Amrit Thakur & Ryan Richard            if (getLeft() != that.getLeft()) return false;
562e429b89e0edf6b77099f40e7e3af40b0cc1e7fc4Amrit Thakur & Ryan Richard            if (getRight() != that.getRight()) return false;
563e429b89e0edf6b77099f40e7e3af40b0cc1e7fc4Amrit Thakur & Ryan Richard            if (getTop() != that.getTop()) return false;
5648bb1af1810bfbfd724d88898d1c4e7aef9945fb9Christian Williams & Ian Fisher
5658bb1af1810bfbfd724d88898d1c4e7aef9945fb9Christian Williams & Ian Fisher            return true;
5668bb1af1810bfbfd724d88898d1c4e7aef9945fb9Christian Williams & Ian Fisher        }
5678bb1af1810bfbfd724d88898d1c4e7aef9945fb9Christian Williams & Ian Fisher
5688bb1af1810bfbfd724d88898d1c4e7aef9945fb9Christian Williams & Ian Fisher        @Override
5698bb1af1810bfbfd724d88898d1c4e7aef9945fb9Christian Williams & Ian Fisher        public int hashCode() {
570e429b89e0edf6b77099f40e7e3af40b0cc1e7fc4Amrit Thakur & Ryan Richard            int result = getLeft();
571e429b89e0edf6b77099f40e7e3af40b0cc1e7fc4Amrit Thakur & Ryan Richard            result = 31 * result + getTop();
572e429b89e0edf6b77099f40e7e3af40b0cc1e7fc4Amrit Thakur & Ryan Richard            result = 31 * result + getRight();
573e429b89e0edf6b77099f40e7e3af40b0cc1e7fc4Amrit Thakur & Ryan Richard            result = 31 * result + getBottom();
5748bb1af1810bfbfd724d88898d1c4e7aef9945fb9Christian Williams & Ian Fisher            return result;
5758bb1af1810bfbfd724d88898d1c4e7aef9945fb9Christian Williams & Ian Fisher        }
5768bb1af1810bfbfd724d88898d1c4e7aef9945fb9Christian Williams & Ian Fisher
5778bb1af1810bfbfd724d88898d1c4e7aef9945fb9Christian Williams & Ian Fisher        @Override
5788bb1af1810bfbfd724d88898d1c4e7aef9945fb9Christian Williams & Ian Fisher        public String toString() {
5798bb1af1810bfbfd724d88898d1c4e7aef9945fb9Christian Williams & Ian Fisher            return "CompoundDrawables{" +
580e429b89e0edf6b77099f40e7e3af40b0cc1e7fc4Amrit Thakur & Ryan Richard                    "left=" + getLeft() +
581e429b89e0edf6b77099f40e7e3af40b0cc1e7fc4Amrit Thakur & Ryan Richard                    ", top=" + getTop() +
582e429b89e0edf6b77099f40e7e3af40b0cc1e7fc4Amrit Thakur & Ryan Richard                    ", right=" + getRight() +
583e429b89e0edf6b77099f40e7e3af40b0cc1e7fc4Amrit Thakur & Ryan Richard                    ", bottom=" + getBottom() +
5848bb1af1810bfbfd724d88898d1c4e7aef9945fb9Christian Williams & Ian Fisher                    '}';
5858bb1af1810bfbfd724d88898d1c4e7aef9945fb9Christian Williams & Ian Fisher        }
586e429b89e0edf6b77099f40e7e3af40b0cc1e7fc4Amrit Thakur & Ryan Richard
587e429b89e0edf6b77099f40e7e3af40b0cc1e7fc4Amrit Thakur & Ryan Richard        public int getLeft() {
588e429b89e0edf6b77099f40e7e3af40b0cc1e7fc4Amrit Thakur & Ryan Richard            return shadowOf(leftDrawable).getLoadedFromResourceId();
589e429b89e0edf6b77099f40e7e3af40b0cc1e7fc4Amrit Thakur & Ryan Richard        }
590e429b89e0edf6b77099f40e7e3af40b0cc1e7fc4Amrit Thakur & Ryan Richard
591e429b89e0edf6b77099f40e7e3af40b0cc1e7fc4Amrit Thakur & Ryan Richard        public int getTop() {
592e429b89e0edf6b77099f40e7e3af40b0cc1e7fc4Amrit Thakur & Ryan Richard            return shadowOf(topDrawable).getLoadedFromResourceId();
593e429b89e0edf6b77099f40e7e3af40b0cc1e7fc4Amrit Thakur & Ryan Richard        }
594e429b89e0edf6b77099f40e7e3af40b0cc1e7fc4Amrit Thakur & Ryan Richard
595e429b89e0edf6b77099f40e7e3af40b0cc1e7fc4Amrit Thakur & Ryan Richard        public int getRight() {
596e429b89e0edf6b77099f40e7e3af40b0cc1e7fc4Amrit Thakur & Ryan Richard            return shadowOf(rightDrawable).getLoadedFromResourceId();
597e429b89e0edf6b77099f40e7e3af40b0cc1e7fc4Amrit Thakur & Ryan Richard        }
598e429b89e0edf6b77099f40e7e3af40b0cc1e7fc4Amrit Thakur & Ryan Richard
599e429b89e0edf6b77099f40e7e3af40b0cc1e7fc4Amrit Thakur & Ryan Richard        public int getBottom() {
600e429b89e0edf6b77099f40e7e3af40b0cc1e7fc4Amrit Thakur & Ryan Richard            return shadowOf(bottomDrawable).getLoadedFromResourceId();
601e429b89e0edf6b77099f40e7e3af40b0cc1e7fc4Amrit Thakur & Ryan Richard        }
60221da5e43a4a57a9c76b9f7a9e335268e93feb262Christian Williams & Harry Ugol    }
6036eedf728138e6f79fa898ff3e31bf61c9b1151dChristian Williams & Tyler Schulz}
604