Skip to content
Snippets Groups Projects
Commit bb5504c4 authored by Ken Wakasa's avatar Ken Wakasa Committed by Android (Google) Code Review
Browse files

Merge "Get rid of auto correction flash animation in the suggestion strip"

parents b6b7d81f 59f5cc85
No related branches found
No related tags found
No related merge requests found
...@@ -107,6 +107,7 @@ ...@@ -107,6 +107,7 @@
</declare-styleable> </declare-styleable>
<declare-styleable name="CandidateView"> <declare-styleable name="CandidateView">
<attr name="autoCorrectionVisualFlashEnabled" format="boolean" />
<attr name="autoCorrectHighlight" format="integer"> <attr name="autoCorrectHighlight" format="integer">
<flag name="autoCorrectBold" value="0x01" /> <flag name="autoCorrectBold" value="0x01" />
<flag name="autoCorrectUnderline" value="0x02" /> <flag name="autoCorrectUnderline" value="0x02" />
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
<bool name="config_default_recorrection_enabled">true</bool> <bool name="config_default_recorrection_enabled">true</bool>
<bool name="config_default_sound_enabled">false</bool> <bool name="config_default_sound_enabled">false</bool>
<bool name="config_auto_correction_spacebar_led_enabled">true</bool> <bool name="config_auto_correction_spacebar_led_enabled">true</bool>
<bool name="config_auto_correction_suggestion_strip_visual_flash_enabled">false</bool>
<!-- Showing mini keyboard, just above the touched point if true, aligned to the key if false --> <!-- Showing mini keyboard, just above the touched point if true, aligned to the key if false -->
<bool name="config_show_mini_keyboard_at_touched_point">false</bool> <bool name="config_show_mini_keyboard_at_touched_point">false</bool>
<!-- The language is never displayed if == 0, always displayed if < 0 --> <!-- The language is never displayed if == 0, always displayed if < 0 -->
......
...@@ -85,6 +85,7 @@ ...@@ -85,6 +85,7 @@
<item name="android:background">@drawable/candidate_feedback_background</item> <item name="android:background">@drawable/candidate_feedback_background</item>
</style> </style>
<style name="CandidateViewStyle" parent="SuggestionsStripBackgroundStyle"> <style name="CandidateViewStyle" parent="SuggestionsStripBackgroundStyle">
<item name="autoCorrectionVisualFlashEnabled">@bool/config_auto_correction_suggestion_strip_visual_flash_enabled</item>
<item name="autoCorrectHighlight">autoCorrectBold</item> <item name="autoCorrectHighlight">autoCorrectBold</item>
<item name="colorTypedWord">#FFFFFFFF</item> <item name="colorTypedWord">#FFFFFFFF</item>
<item name="colorAutoCorrect">#FFFCAE00</item> <item name="colorAutoCorrect">#FFFCAE00</item>
...@@ -188,6 +189,7 @@ ...@@ -188,6 +189,7 @@
<item name="android:background">@drawable/keyboard_popup_panel_background_holo</item> <item name="android:background">@drawable/keyboard_popup_panel_background_holo</item>
</style> </style>
<style name="CandidateViewStyle.IceCreamSandwich" parent="SuggestionsStripBackgroundStyle.IceCreamSandwich"> <style name="CandidateViewStyle.IceCreamSandwich" parent="SuggestionsStripBackgroundStyle.IceCreamSandwich">
<item name="autoCorrectionVisualFlashEnabled">@bool/config_auto_correction_suggestion_strip_visual_flash_enabled</item>
<item name="autoCorrectHighlight">autoCorrectBold|autoCorrectInvert</item> <item name="autoCorrectHighlight">autoCorrectBold|autoCorrectInvert</item>
<item name="colorTypedWord">#FFFFFFFF</item> <item name="colorTypedWord">#FFFFFFFF</item>
<item name="colorAutoCorrect">#FF3DC8FF</item> <item name="colorAutoCorrect">#FF3DC8FF</item>
......
...@@ -278,6 +278,7 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo ...@@ -278,6 +278,7 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo
private final ArrayList<CharSequence> mTexts = new ArrayList<CharSequence>(); private final ArrayList<CharSequence> mTexts = new ArrayList<CharSequence>();
public final boolean mAutoCorrectionVisualFlashEnabled;
public boolean mMoreSuggestionsAvailable; public boolean mMoreSuggestionsAvailable;
public SuggestionsStripParams(Context context, AttributeSet attrs, int defStyle, public SuggestionsStripParams(Context context, AttributeSet attrs, int defStyle,
...@@ -285,6 +286,8 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo ...@@ -285,6 +286,8 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo
super(words, dividers, infos); super(words, dividers, infos);
final TypedArray a = context.obtainStyledAttributes( final TypedArray a = context.obtainStyledAttributes(
attrs, R.styleable.CandidateView, defStyle, R.style.CandidateViewStyle); attrs, R.styleable.CandidateView, defStyle, R.style.CandidateViewStyle);
mAutoCorrectionVisualFlashEnabled = a.getBoolean(
R.styleable.CandidateView_autoCorrectionVisualFlashEnabled, false);
mAutoCorrectHighlight = a.getInt(R.styleable.CandidateView_autoCorrectHighlight, 0); mAutoCorrectHighlight = a.getInt(R.styleable.CandidateView_autoCorrectHighlight, 0);
mColorTypedWord = a.getColor(R.styleable.CandidateView_colorTypedWord, 0); mColorTypedWord = a.getColor(R.styleable.CandidateView_colorTypedWord, 0);
mColorAutoCorrect = a.getColor(R.styleable.CandidateView_colorAutoCorrect, 0); mColorAutoCorrect = a.getColor(R.styleable.CandidateView_colorAutoCorrect, 0);
...@@ -700,6 +703,9 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo ...@@ -700,6 +703,9 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo
} }
public void onAutoCorrectionInverted(CharSequence autoCorrectedWord) { public void onAutoCorrectionInverted(CharSequence autoCorrectedWord) {
if (!mStripParams.mAutoCorrectionVisualFlashEnabled) {
return;
}
final CharSequence inverted = mStripParams.getInvertedText(autoCorrectedWord); final CharSequence inverted = mStripParams.getInvertedText(autoCorrectedWord);
if (inverted == null) if (inverted == null)
return; return;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment