Add colorValidTypedWord and alphaValidTypedWord
This change fixes Gingerbread theme. Change-Id: I142437ac0173df48ab36390f47ed67c6cea24a65main
parent
e9a0efc242
commit
a44685ab32
|
@ -127,9 +127,11 @@
|
||||||
<flag name="autoCorrectUnderline" value="0x02" />
|
<flag name="autoCorrectUnderline" value="0x02" />
|
||||||
<flag name="validTypedWordBold" value="0x04" />
|
<flag name="validTypedWordBold" value="0x04" />
|
||||||
</attr>
|
</attr>
|
||||||
|
<attr name="colorValidTypedWord" format="color" />
|
||||||
<attr name="colorTypedWord" format="color" />
|
<attr name="colorTypedWord" format="color" />
|
||||||
<attr name="colorAutoCorrect" format="color" />
|
<attr name="colorAutoCorrect" format="color" />
|
||||||
<attr name="colorSuggested" format="color" />
|
<attr name="colorSuggested" format="color" />
|
||||||
|
<attr name="alphaValidTypedWord" format="integer" />
|
||||||
<attr name="alphaTypedWord" format="integer" />
|
<attr name="alphaTypedWord" format="integer" />
|
||||||
<attr name="alphaAutoCorrect" format="integer" />
|
<attr name="alphaAutoCorrect" format="integer" />
|
||||||
<attr name="alphaSuggested" format="integer" />
|
<attr name="alphaSuggested" format="integer" />
|
||||||
|
|
|
@ -97,7 +97,8 @@
|
||||||
name="SuggestionsViewStyle"
|
name="SuggestionsViewStyle"
|
||||||
parent="SuggestionsStripBackgroundStyle"
|
parent="SuggestionsStripBackgroundStyle"
|
||||||
>
|
>
|
||||||
<item name="suggestionStripOption">autoCorrectBold</item>
|
<item name="suggestionStripOption">autoCorrectBold|validTypedWordBold</item>
|
||||||
|
<item name="colorValidTypedWord">#FFFCAE00</item>
|
||||||
<item name="colorTypedWord">@android:color/white</item>
|
<item name="colorTypedWord">@android:color/white</item>
|
||||||
<item name="colorAutoCorrect">#FFFCAE00</item>
|
<item name="colorAutoCorrect">#FFFCAE00</item>
|
||||||
<item name="colorSuggested">#FFFCAE00</item>
|
<item name="colorSuggested">#FFFCAE00</item>
|
||||||
|
@ -296,11 +297,12 @@
|
||||||
>
|
>
|
||||||
<item name="suggestionStripOption">autoCorrectBold|validTypedWordBold</item>
|
<item name="suggestionStripOption">autoCorrectBold|validTypedWordBold</item>
|
||||||
<!-- android:color/holo_blue_light=#FF33B5E5 -->
|
<!-- android:color/holo_blue_light=#FF33B5E5 -->
|
||||||
|
<item name="colorValidTypedWord">@android:color/holo_blue_light</item>
|
||||||
<item name="colorTypedWord">@android:color/holo_blue_light</item>
|
<item name="colorTypedWord">@android:color/holo_blue_light</item>
|
||||||
<item name="colorAutoCorrect">@android:color/holo_blue_light</item>
|
<item name="colorAutoCorrect">@android:color/holo_blue_light</item>
|
||||||
<item name="colorSuggested">@android:color/holo_blue_light</item>
|
<item name="colorSuggested">@android:color/holo_blue_light</item>
|
||||||
|
<item name="alphaValidTypedWord">85</item>
|
||||||
<item name="alphaTypedWord">85</item>
|
<item name="alphaTypedWord">85</item>
|
||||||
<item name="alphaAutoCorrect">100</item>
|
|
||||||
<item name="alphaSuggested">70</item>
|
<item name="alphaSuggested">70</item>
|
||||||
<item name="alphaObsoleted">70</item>
|
<item name="alphaObsoleted">70</item>
|
||||||
<item name="suggestionsCountInStrip">@integer/suggestions_count_in_strip</item>
|
<item name="suggestionsCountInStrip">@integer/suggestions_count_in_strip</item>
|
||||||
|
|
|
@ -141,6 +141,7 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener,
|
||||||
private final List<View> mDividers;
|
private final List<View> mDividers;
|
||||||
private final List<TextView> mInfos;
|
private final List<TextView> mInfos;
|
||||||
|
|
||||||
|
private final int mColorValidTypedWord;
|
||||||
private final int mColorTypedWord;
|
private final int mColorTypedWord;
|
||||||
private final int mColorAutoCorrect;
|
private final int mColorAutoCorrect;
|
||||||
private final int mColorSuggested;
|
private final int mColorSuggested;
|
||||||
|
@ -184,6 +185,8 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener,
|
||||||
final TypedArray a = context.obtainStyledAttributes(
|
final TypedArray a = context.obtainStyledAttributes(
|
||||||
attrs, R.styleable.SuggestionsView, defStyle, R.style.SuggestionsViewStyle);
|
attrs, R.styleable.SuggestionsView, defStyle, R.style.SuggestionsViewStyle);
|
||||||
mSuggestionStripOption = a.getInt(R.styleable.SuggestionsView_suggestionStripOption, 0);
|
mSuggestionStripOption = a.getInt(R.styleable.SuggestionsView_suggestionStripOption, 0);
|
||||||
|
final float alphaValidTypedWord = getPercent(a,
|
||||||
|
R.styleable.SuggestionsView_alphaValidTypedWord, 100);
|
||||||
final float alphaTypedWord = getPercent(a,
|
final float alphaTypedWord = getPercent(a,
|
||||||
R.styleable.SuggestionsView_alphaTypedWord, 100);
|
R.styleable.SuggestionsView_alphaTypedWord, 100);
|
||||||
final float alphaAutoCorrect = getPercent(a,
|
final float alphaAutoCorrect = getPercent(a,
|
||||||
|
@ -191,6 +194,9 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener,
|
||||||
final float alphaSuggested = getPercent(a,
|
final float alphaSuggested = getPercent(a,
|
||||||
R.styleable.SuggestionsView_alphaSuggested, 100);
|
R.styleable.SuggestionsView_alphaSuggested, 100);
|
||||||
mAlphaObsoleted = getPercent(a, R.styleable.SuggestionsView_alphaSuggested, 100);
|
mAlphaObsoleted = getPercent(a, R.styleable.SuggestionsView_alphaSuggested, 100);
|
||||||
|
mColorValidTypedWord = applyAlpha(
|
||||||
|
a.getColor(R.styleable.SuggestionsView_colorValidTypedWord, 0),
|
||||||
|
alphaValidTypedWord);
|
||||||
mColorTypedWord = applyAlpha(
|
mColorTypedWord = applyAlpha(
|
||||||
a.getColor(R.styleable.SuggestionsView_colorTypedWord, 0), alphaTypedWord);
|
a.getColor(R.styleable.SuggestionsView_colorTypedWord, 0), alphaTypedWord);
|
||||||
mColorAutoCorrect = applyAlpha(
|
mColorAutoCorrect = applyAlpha(
|
||||||
|
@ -288,6 +294,8 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener,
|
||||||
final int color;
|
final int color;
|
||||||
if (index == mCenterSuggestionIndex && Utils.willAutoCorrect(suggestions)) {
|
if (index == mCenterSuggestionIndex && Utils.willAutoCorrect(suggestions)) {
|
||||||
color = mColorAutoCorrect;
|
color = mColorAutoCorrect;
|
||||||
|
} else if (index == mCenterSuggestionIndex && suggestions.mTypedWordValid) {
|
||||||
|
color = mColorValidTypedWord;
|
||||||
} else if (isSuggested) {
|
} else if (isSuggested) {
|
||||||
color = mColorSuggested;
|
color = mColorSuggested;
|
||||||
} else {
|
} else {
|
||||||
|
@ -423,7 +431,7 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener,
|
||||||
|
|
||||||
final TextView word = mWords.get(index);
|
final TextView word = mWords.get(index);
|
||||||
word.setEnabled(true);
|
word.setEnabled(true);
|
||||||
word.setTextColor(mColorTypedWord);
|
word.setTextColor(mColorAutoCorrect);
|
||||||
final CharSequence text = suggestions.getWord(index);
|
final CharSequence text = suggestions.getWord(index);
|
||||||
word.setText(text);
|
word.setText(text);
|
||||||
word.setTextScaleX(1.0f);
|
word.setTextScaleX(1.0f);
|
||||||
|
|
Loading…
Reference in New Issue