aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
diff options
context:
space:
mode:
authorKen Wakasa <kwakasa@google.com>2012-08-29 05:21:25 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-08-29 05:21:25 -0700
commitacde9cc7fc22d6fe5cfcc19eff3399c1346304f7 (patch)
treecb6ca35418c344550faf60f1327ee372b85e6626 /java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
parent03196271ee495ab5d01fbae60e9f5ec09b5df843 (diff)
parent775f27c88180bd9bf875c0c76b32cfe2cab9da59 (diff)
downloadlatinime-acde9cc7fc22d6fe5cfcc19eff3399c1346304f7.tar.gz
latinime-acde9cc7fc22d6fe5cfcc19eff3399c1346304f7.tar.xz
latinime-acde9cc7fc22d6fe5cfcc19eff3399c1346304f7.zip
am 775f27c8: am cc6ddb05: Merge "Revert "Move resource related methods to ResourceUtils"" into jb-mr1-dev
* commit '775f27c88180bd9bf875c0c76b32cfe2cab9da59': Revert "Move resource related methods to ResourceUtils"
Diffstat (limited to 'java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java')
-rw-r--r--java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java19
1 files changed, 11 insertions, 8 deletions
diff --git a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
index 9e8ab81b0..03263d274 100644
--- a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
+++ b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
@@ -61,7 +61,6 @@ import com.android.inputmethod.latin.AutoCorrection;
import com.android.inputmethod.latin.CollectionUtils;
import com.android.inputmethod.latin.LatinImeLogger;
import com.android.inputmethod.latin.R;
-import com.android.inputmethod.latin.ResourceUtils;
import com.android.inputmethod.latin.StaticInnerHandlerWrapper;
import com.android.inputmethod.latin.SuggestedWords;
import com.android.inputmethod.latin.Utils;
@@ -197,15 +196,15 @@ public class SuggestionStripView extends RelativeLayout implements OnClickListen
R.styleable.SuggestionStripView, defStyle, R.style.SuggestionStripViewStyle);
mSuggestionStripOption = a.getInt(
R.styleable.SuggestionStripView_suggestionStripOption, 0);
- final float alphaValidTypedWord = ResourceUtils.getFraction(a,
+ final float alphaValidTypedWord = getFraction(a,
R.styleable.SuggestionStripView_alphaValidTypedWord, 1.0f);
- final float alphaTypedWord = ResourceUtils.getFraction(a,
+ final float alphaTypedWord = getFraction(a,
R.styleable.SuggestionStripView_alphaTypedWord, 1.0f);
- final float alphaAutoCorrect = ResourceUtils.getFraction(a,
+ final float alphaAutoCorrect = getFraction(a,
R.styleable.SuggestionStripView_alphaAutoCorrect, 1.0f);
- final float alphaSuggested = ResourceUtils.getFraction(a,
+ final float alphaSuggested = getFraction(a,
R.styleable.SuggestionStripView_alphaSuggested, 1.0f);
- mAlphaObsoleted = ResourceUtils.getFraction(a,
+ mAlphaObsoleted = getFraction(a,
R.styleable.SuggestionStripView_alphaSuggested, 1.0f);
mColorValidTypedWord = applyAlpha(a.getColor(
R.styleable.SuggestionStripView_colorValidTypedWord, 0), alphaValidTypedWord);
@@ -218,13 +217,13 @@ public class SuggestionStripView extends RelativeLayout implements OnClickListen
mSuggestionsCountInStrip = a.getInt(
R.styleable.SuggestionStripView_suggestionsCountInStrip,
DEFAULT_SUGGESTIONS_COUNT_IN_STRIP);
- mCenterSuggestionWeight = ResourceUtils.getFraction(a,
+ mCenterSuggestionWeight = getFraction(a,
R.styleable.SuggestionStripView_centerSuggestionPercentile,
DEFAULT_CENTER_SUGGESTION_PERCENTILE);
mMaxMoreSuggestionsRow = a.getInt(
R.styleable.SuggestionStripView_maxMoreSuggestionsRow,
DEFAULT_MAX_MORE_SUGGESTIONS_ROW);
- mMinMoreSuggestionsWidth = ResourceUtils.getFraction(a,
+ mMinMoreSuggestionsWidth = getFraction(a,
R.styleable.SuggestionStripView_minMoreSuggestionsWidth, 1.0f);
a.recycle();
@@ -279,6 +278,10 @@ public class SuggestionStripView extends RelativeLayout implements OnClickListen
return new BitmapDrawable(res, buffer);
}
+ static float getFraction(final TypedArray a, final int index, final float defValue) {
+ return a.getFraction(index, 1, 1, defValue);
+ }
+
private CharSequence getStyledSuggestionWord(SuggestedWords suggestedWords, int pos) {
final CharSequence word = suggestedWords.getWord(pos);
final boolean isAutoCorrect = pos == 1 && suggestedWords.willAutoCorrect();