diff --git a/java/res/drawable-hdpi/btn_keyboard_key_popup_selected_holo.9.png b/java/res/drawable-hdpi/btn_keyboard_key_popup_selected_holo.9.png index 26a5427733935907097b8523f96f1e1cc989b4de..1ab6160b2dad37bf7b88bc645f5021876f3409df 100644 Binary files a/java/res/drawable-hdpi/btn_keyboard_key_popup_selected_holo.9.png and b/java/res/drawable-hdpi/btn_keyboard_key_popup_selected_holo.9.png differ diff --git a/java/res/drawable-hdpi/keyboard_suggest_strip_divider.png b/java/res/drawable-hdpi/keyboard_suggest_strip_divider.png new file mode 100644 index 0000000000000000000000000000000000000000..7ca3e6131b03adfd1b2d2fa7a29ce314d086a981 Binary files /dev/null and b/java/res/drawable-hdpi/keyboard_suggest_strip_divider.png differ diff --git a/java/res/drawable-hdpi/sym_keyboard_space_led_holo.9.png b/java/res/drawable-hdpi/sym_keyboard_space_led_holo.9.png new file mode 100644 index 0000000000000000000000000000000000000000..34a1ebde2910f04c9f0f07254a04052bfc10a625 Binary files /dev/null and b/java/res/drawable-hdpi/sym_keyboard_space_led_holo.9.png differ diff --git a/java/res/drawable-mdpi/btn_keyboard_key_popup_selected_holo.9.png b/java/res/drawable-mdpi/btn_keyboard_key_popup_selected_holo.9.png index a2df532900f27204ab00e022856fb36d16c9b734..7d767439ae199e8c6efecb1f3c7e42507d882fd1 100644 Binary files a/java/res/drawable-mdpi/btn_keyboard_key_popup_selected_holo.9.png and b/java/res/drawable-mdpi/btn_keyboard_key_popup_selected_holo.9.png differ diff --git a/java/res/drawable-mdpi/keyboard_suggest_strip_divider.png b/java/res/drawable-mdpi/keyboard_suggest_strip_divider.png new file mode 100644 index 0000000000000000000000000000000000000000..363936362f40906afd59b09cdbcd70693ab1b004 Binary files /dev/null and b/java/res/drawable-mdpi/keyboard_suggest_strip_divider.png differ diff --git a/java/res/drawable-mdpi/sym_keyboard_space_led_holo.9.png b/java/res/drawable-mdpi/sym_keyboard_space_led_holo.9.png new file mode 100644 index 0000000000000000000000000000000000000000..abd8b742ef3aacd3b169f3ba2f08ad997d1ba07e Binary files /dev/null and b/java/res/drawable-mdpi/sym_keyboard_space_led_holo.9.png differ diff --git a/java/res/drawable-xhdpi/btn_keyboard_key_popup_selected_holo.9.png b/java/res/drawable-xhdpi/btn_keyboard_key_popup_selected_holo.9.png index b5e514bb5e5bab9d6aa21ba1b1c488f41b70fa2f..47eee3296c7bf5d71d2d9178e005074f6faa6ffb 100644 Binary files a/java/res/drawable-xhdpi/btn_keyboard_key_popup_selected_holo.9.png and b/java/res/drawable-xhdpi/btn_keyboard_key_popup_selected_holo.9.png differ diff --git a/java/res/drawable-xhdpi/sym_keyboard_space_led_holo.9.png b/java/res/drawable-xhdpi/sym_keyboard_space_led_holo.9.png new file mode 100644 index 0000000000000000000000000000000000000000..e192aaf276edf584c605ee4a08b5123f5e3f6894 Binary files /dev/null and b/java/res/drawable-xhdpi/sym_keyboard_space_led_holo.9.png differ diff --git a/java/res/layout/candidate_divider.xml b/java/res/layout/candidate_divider.xml index a1059dc2fe96e5e6e46d9792f76e102cb215c0e2..dc5e779663fee7ce568460058581295c878c654c 100644 --- a/java/res/layout/candidate_divider.xml +++ b/java/res/layout/candidate_divider.xml @@ -18,13 +18,10 @@ */ --> -<TextView +<ImageView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="match_parent" - android:text="@string/label_candidate_divider" - android:textSize="@dimen/candidate_text_size" - android:gravity="center" + android:src="@drawable/keyboard_suggest_strip_divider" android:padding="0dp" - android:focusable="false" - android:clickable="false" /> + android:gravity="center" /> diff --git a/java/res/layout/candidate_info.xml b/java/res/layout/candidate_info.xml index f3557289c5d468e4ae2cb801dada956872a0a962..a364d46aaeff1a002348d808460d29d83fcb8754 100644 --- a/java/res/layout/candidate_info.xml +++ b/java/res/layout/candidate_info.xml @@ -24,5 +24,4 @@ android:layout_height="wrap_content" android:textSize="6sp" android:textColor="@android:color/white" - android:visibility="gone" style="?attr/suggestionBackgroundStyle" /> diff --git a/java/res/layout/candidates_strip.xml b/java/res/layout/candidates_strip.xml index 0f542c0a256a72a0575cccce158351d17320a8c7..2d908863cbb1d3f4e77d9901a0bf640dbb12ecd7 100644 --- a/java/res/layout/candidates_strip.xml +++ b/java/res/layout/candidates_strip.xml @@ -27,9 +27,7 @@ android:orientation="horizontal" android:layout_weight="1.0" android:layout_width="0dp" - android:layout_height="match_parent" - > - </LinearLayout> + android:layout_height="match_parent" /> <LinearLayout android:id="@+id/candidates_pane_control" android:orientation="horizontal" @@ -42,22 +40,22 @@ android:gravity="center" android:layout_width="wrap_content" android:layout_height="match_parent" - android:minWidth="30dp" android:textSize="@dimen/candidate_text_size" - android:padding="0dp" + android:paddingRight="8dp" + android:paddingLeft="8dp" android:visibility="visible" - style="?attr/suggestionBackgroundStyle" /> + android:background="@drawable/btn_keyboard_key_ics" /> <TextView android:id="@+id/close_candidates_pane" android:text="@string/label_close_candidates_pane" android:gravity="center" android:layout_width="wrap_content" android:layout_height="match_parent" - android:minWidth="30dp" android:textSize="@dimen/candidate_text_size" - android:padding="0dp" + android:paddingRight="8dp" + android:paddingLeft="8dp" android:visibility="gone" - style="?attr/suggestionBackgroundStyle" /> + android:background="@drawable/btn_keyboard_key_ics" /> </LinearLayout> <LinearLayout android:id="@+id/touch_to_save" diff --git a/java/res/values-land/dimens.xml b/java/res/values-land/dimens.xml index d5ca250632e7128305f7c9be1fbeb663edadd36c..4a07156aa481f1cd3e3867462a358ac3f18e9208 100644 --- a/java/res/values-land/dimens.xml +++ b/java/res/values-land/dimens.xml @@ -57,7 +57,7 @@ <dimen name="key_preview_offset_ics">0.01in</dimen> - <dimen name="candidate_strip_height">38dip</dimen> + <dimen name="candidate_strip_height">36dip</dimen> <dimen name="candidate_strip_fading_edge_length">63dip</dimen> <!-- Amount of allowance for selecting keys in a mini popup keyboard by sliding finger. --> <!-- popup_key_height x 1.2 --> diff --git a/java/res/values-sw600dp/dimens.xml b/java/res/values-sw600dp/dimens.xml index 1a82b0c6c70d048b887daaf18036ad4e3c4cca6a..c89a5cdfb3b1cb81febd5f24b65e6ac7d6f9d236 100644 --- a/java/res/values-sw600dp/dimens.xml +++ b/java/res/values-sw600dp/dimens.xml @@ -68,7 +68,7 @@ <dimen name="key_preview_height_ics">15.0mm</dimen> <dimen name="key_preview_offset_ics">0.05in</dimen> - <dimen name="candidate_strip_height">46dip</dimen> + <dimen name="candidate_strip_height">44dip</dimen> <dimen name="candidate_strip_padding">15.0mm</dimen> <dimen name="candidate_min_width">0.3in</dimen> <dimen name="candidate_padding">12dip</dimen> diff --git a/java/res/values-sw768dp/dimens.xml b/java/res/values-sw768dp/dimens.xml index 81a68e233c2dfeba68dfc694e18200489acae70e..f98cabba4df9f54f9b3601afd6256fd4a07d1a09 100644 --- a/java/res/values-sw768dp/dimens.xml +++ b/java/res/values-sw768dp/dimens.xml @@ -69,7 +69,7 @@ <dimen name="key_preview_height_ics">15.0mm</dimen> <dimen name="key_preview_offset_ics">0.05in</dimen> - <dimen name="candidate_strip_height">46dip</dimen> + <dimen name="candidate_strip_height">44dip</dimen> <!-- candidate_strip_minimum_height = key_preview_height_holo - key_preview_offset_holo + alpha --> <dimen name="candidate_strip_minimum_height">18mm</dimen> diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml index fb99336e873e92b3c6a61059115fa47e086ce892..cf9138ba202fb41c157bd97ad9a7d2f63cf52f7b 100644 --- a/java/res/values/attrs.xml +++ b/java/res/values/attrs.xml @@ -120,7 +120,6 @@ <attr name="colorTypedWord" format="color" /> <attr name="colorAutoCorrect" format="color" /> <attr name="colorSuggested" format="color" /> - <attr name="colorDivider" format="color" /> <attr name="candidateCountInStrip" format="integer" /> </declare-styleable> diff --git a/java/res/values/dimens.xml b/java/res/values/dimens.xml index 6cf5fe99cba7389e9bfeb787c3a8434de48a0552..095ef422717bc8d45e4e03d617f58895894f081f 100644 --- a/java/res/values/dimens.xml +++ b/java/res/values/dimens.xml @@ -73,7 +73,7 @@ <dimen name="key_preview_height_ics">80sp</dimen> <dimen name="key_preview_offset_ics">0.05in</dimen> - <dimen name="candidate_strip_height">42dip</dimen> + <dimen name="candidate_strip_height">40dip</dimen> <!-- candidate_strip_minimum_height = key_preview_height_holo - key_preview_offset_holo + alpha --> <dimen name="candidate_strip_minimum_height">100sp</dimen> diff --git a/java/res/values/keyboard-icons-ics.xml b/java/res/values/keyboard-icons-ics.xml index c813152848020531bc461dc8ac0dc1b57cf8d4fd..bf2d13d300483763ad45db10eea685193ce519b6 100644 --- a/java/res/values/keyboard-icons-ics.xml +++ b/java/res/values/keyboard-icons-ics.xml @@ -50,7 +50,7 @@ <item name="iconPreviewSettingsKey">@drawable/sym_keyboard_settings_holo</item> <item name="iconPreviewShortcutKey">@drawable/sym_keyboard_feedback_mic</item> <!-- LatinKeyboard icons --> - <item name="autoCorrectionSpacebarLedIcon">@drawable/sym_keyboard_space_led</item> + <item name="autoCorrectionSpacebarLedIcon">@drawable/sym_keyboard_space_led_holo</item> <item name="disabledShortcutIcon">@drawable/sym_keyboard_voice_off_holo</item> </style> </resources> diff --git a/java/res/values/styles.xml b/java/res/values/styles.xml index c0cc8fbda526eb95233dd852026d2ec9b7ea20af..f731d01338e9c965afb77405ef66f1772c5339d5 100644 --- a/java/res/values/styles.xml +++ b/java/res/values/styles.xml @@ -92,7 +92,6 @@ <item name="colorTypedWord">#FFFFFFFF</item> <item name="colorAutoCorrect">#FFFCAE00</item> <item name="colorSuggested">#FFFCAE00</item> - <item name="colorDivider">#20FFFFFF</item> <item name="candidateCountInStrip">@integer/candidate_count_in_strip</item> </style> <!-- Theme "Basic high contrast" --> @@ -191,9 +190,8 @@ <style name="CandidateViewStyle.IceCreamSandwich" parent="SuggestionsStripBackgroundStyle.IceCreamSandwich"> <item name="autoCorrectHighlight">autoCorrectBold|autoCorrectInvert</item> <item name="colorTypedWord">#FFFFFFFF</item> - <item name="colorAutoCorrect">#FFFFFFFF</item> + <item name="colorAutoCorrect">#FF3DC8FF</item> <item name="colorSuggested">#FFFFFFFF</item> - <item name="colorDivider">#20FFFFFF</item> <item name="candidateCountInStrip">@integer/candidate_count_in_strip</item> </style> <style name="PopupMiniKeyboardAnimation"> diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java index 203cde915c1237736080d654103f394c354bd7b3..752f87d6646d5813032b7c527025d51fc92ac57f 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java @@ -394,6 +394,8 @@ public class KeyboardView extends View implements PointerTracker.UIProxy { public int mKeyLetterSize; public final int[] mCoordinates = new int[2]; + private static final int PREVIEW_ALPHA = 240; + public KeyPreviewDrawParams(TypedArray a, KeyDrawParams keyDrawParams) { mPreviewBackground = a.getDrawable(R.styleable.KeyboardView_keyPreviewBackground); mPreviewLeftBackground = a.getDrawable( @@ -402,6 +404,9 @@ public class KeyboardView extends View implements PointerTracker.UIProxy { R.styleable.KeyboardView_keyPreviewRightBackground); mPreviewSpacebarBackground = a.getDrawable( R.styleable.KeyboardView_keyPreviewSpacebarBackground); + setAlpha(mPreviewBackground, PREVIEW_ALPHA); + setAlpha(mPreviewLeftBackground, PREVIEW_ALPHA); + setAlpha(mPreviewRightBackground, PREVIEW_ALPHA); mPreviewOffset = a.getDimensionPixelOffset( R.styleable.KeyboardView_keyPreviewOffset, 0); mPreviewHeight = a.getDimensionPixelSize( @@ -417,6 +422,12 @@ public class KeyboardView extends View implements PointerTracker.UIProxy { mPreviewTextSize = (int)(keyHeight * mPreviewTextRatio); mKeyLetterSize = (int)(keyHeight * mKeyLetterRatio); } + + private static void setAlpha(Drawable drawable, int alpha) { + if (drawable == null) + return; + drawable.setAlpha(alpha); + } } public KeyboardView(Context context, AttributeSet attrs) { diff --git a/java/src/com/android/inputmethod/latin/CandidateView.java b/java/src/com/android/inputmethod/latin/CandidateView.java index ecabe6792bd284ec46ae4743d8afed4465133099..01b1dd6e3e2d35d75a15b433be15f087f4d9e9cb 100644 --- a/java/src/com/android/inputmethod/latin/CandidateView.java +++ b/java/src/com/android/inputmethod/latin/CandidateView.java @@ -61,8 +61,8 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo private static final CharacterStyle UNDERLINE_SPAN = new UnderlineSpan(); // The maximum number of suggestions available. See {@link Suggest#mPrefMaxSuggestions}. private static final int MAX_SUGGESTIONS = 18; - private static final int MATCH_PARENT = ViewGroup.LayoutParams.MATCH_PARENT; private static final int WRAP_CONTENT = ViewGroup.LayoutParams.WRAP_CONTENT; + private static final int MATCH_PARENT = ViewGroup.LayoutParams.MATCH_PARENT; private static final boolean DBG = LatinImeLogger.sDBG; @@ -90,7 +90,6 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo private final int mColorTypedWord; private final int mColorAutoCorrect; private final int mColorSuggestedCandidate; - private final int mColorDivider; private final PopupWindow mPreviewPopup; private final TextView mPreviewText; @@ -184,6 +183,7 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo final float textSize = res.getDimension(R.dimen.candidate_text_size); mPaint.setTextSize(textSize); mPadding = res.getDimensionPixelSize(R.dimen.candidate_padding); + divider.measure(WRAP_CONTENT, MATCH_PARENT); mDividerWidth = divider.getMeasuredWidth(); mDividerHeight = divider.getMeasuredHeight(); mControlWidth = control.getMeasuredWidth(); @@ -295,7 +295,6 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo mColorTypedWord = a.getColor(R.styleable.CandidateView_colorTypedWord, 0); mColorAutoCorrect = a.getColor(R.styleable.CandidateView_colorAutoCorrect, 0); mColorSuggestedCandidate = a.getColor(R.styleable.CandidateView_colorSuggested, 0); - mColorDivider = a.getColor(R.styleable.CandidateView_colorDivider, 0); mCandidateCountInStrip = a.getInt( R.styleable.CandidateView_candidateCountInStrip, DEFAULT_CANDIDATE_COUNT_IN_STRIP); a.recycle(); @@ -321,7 +320,7 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo word.setOnLongClickListener(this); mWords.add(word); mInfos.add((TextView)inflater.inflate(R.layout.candidate_info, null)); - mDividers.add(getDivider(inflater)); + mDividers.add(inflater.inflate(R.layout.candidate_divider, null)); } mTouchToSave = findViewById(R.id.touch_to_save); @@ -333,6 +332,7 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo mCandidatesPaneControl = (ViewGroup)findViewById(R.id.candidates_pane_control); mExpandCandidatesPane = (TextView)findViewById(R.id.expand_candidates_pane); + mExpandCandidatesPane.getBackground().setAlpha(180); mExpandCandidatesPane.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { @@ -340,6 +340,7 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo } }); mCloseCandidatesPane = (TextView)findViewById(R.id.close_candidates_pane); + mCloseCandidatesPane.getBackground().setAlpha(180); mCloseCandidatesPane.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { @@ -348,15 +349,8 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo }); mCandidatesPaneControl.measure(WRAP_CONTENT, WRAP_CONTENT); - mParams = new CandidateViewLayoutParams(res, mDividers.get(0), mCandidatesPaneControl, - mAutoCorrectHighlight); - } - - private View getDivider(LayoutInflater inflater) { - final TextView divider = (TextView)inflater.inflate(R.layout.candidate_divider, null); - divider.setTextColor(mColorDivider); - divider.measure(WRAP_CONTENT, WRAP_CONTENT); - return divider; + mParams = new CandidateViewLayoutParams( + res, mDividers.get(0), mCandidatesPaneControl, mAutoCorrectHighlight); } /** @@ -429,7 +423,7 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo ? PUNCTUATIONS_IN_STRIP : mCandidateCountInStrip); final int count = Math.min(mWords.size(), suggestions.size()); - if (count <= params.mCountInStrip) { + if (count <= params.mCountInStrip && !DBG) { mCandidatesPaneControl.setVisibility(GONE); } else { mCandidatesPaneControl.setVisibility(VISIBLE); @@ -437,8 +431,8 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo } final int countInStrip = params.mCountInStrip; - int fromIndex = countInStrip; - int x = 0, y = 0; + View centeringFrom = null, lastView = null; + int x = 0, y = 0, infoX = 0; for (int i = 0; i < count; i++) { final int pos; if (i <= 1) { @@ -497,18 +491,18 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo } mCandidatesStrip.addView(word); if (params.mCanUseFixedWidthColumns) { - setLayoutWeight(word, 1.0f); + setLayoutWeight(word, 1.0f, mCandidateStripHeight); } else { final int width = getTextWidth(text, paint) + params.mPadding * 2; - setLayoutWeight(word, width); + setLayoutWeight(word, width, mCandidateStripHeight); } if (info != null) { - word.measure(WRAP_CONTENT, MATCH_PARENT); - final int width = word.getMeasuredWidth(); + mCandidatesPane.addView(info); info.measure(WRAP_CONTENT, WRAP_CONTENT); - final int infoWidth = info.getMeasuredWidth(); - FrameLayoutCompatUtils.placeViewAt( - info, width - infoWidth, 0, infoWidth, info.getMeasuredHeight()); + final int width = info.getMeasuredWidth(); + y = info.getMeasuredHeight(); + FrameLayoutCompatUtils.placeViewAt(info, infoX, 0, width, y); + infoX += width * 2; } } else { paint.setTextScaleX(1.0f); @@ -516,10 +510,9 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo int available = paneWidth - x - params.mPadding * 2; if (textWidth >= available) { // Needs new row, centering previous row. - centeringCandidates(fromIndex, i - 1, x, paneWidth); + centeringCandidates(centeringFrom, lastView, x, paneWidth); x = 0; y += mCandidateStripHeight; - fromIndex = i; } if (x != 0) { // Add divider if this isn't the left most suggestion in current row. @@ -536,46 +529,45 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo word.setText(text); word.setTextScaleX(scaleX); mCandidatesPane.addView(word); - word.measure(WRAP_CONTENT, WRAP_CONTENT); + lastView = word; + if (x == 0) centeringFrom = word; + word.measure(WRAP_CONTENT, + MeasureSpec.makeMeasureSpec(mCandidateStripHeight, MeasureSpec.EXACTLY)); final int width = word.getMeasuredWidth(); final int height = word.getMeasuredHeight(); FrameLayoutCompatUtils.placeViewAt( word, x, y + (mCandidateStripHeight - height) / 2, width, height); + x += width; if (info != null) { mCandidatesPane.addView(info); + lastView = info; info.measure(WRAP_CONTENT, WRAP_CONTENT); final int infoWidth = info.getMeasuredWidth(); FrameLayoutCompatUtils.placeViewAt( - info, x + width - infoWidth, y, infoWidth, info.getMeasuredHeight()); + info, x - infoWidth, y, infoWidth, info.getMeasuredHeight()); } - x += width; } } if (x != 0) { // Centering last candidates row. - centeringCandidates(fromIndex, count - 1, x, paneWidth); + centeringCandidates(centeringFrom, lastView, x, paneWidth); } } - private static void setLayoutWeight(View v, float weight) { + private static void setLayoutWeight(View v, float weight, int height) { final ViewGroup.LayoutParams lp = v.getLayoutParams(); if (lp instanceof LinearLayout.LayoutParams) { final LinearLayout.LayoutParams llp = (LinearLayout.LayoutParams)lp; llp.weight = weight; llp.width = 0; - llp.height = MATCH_PARENT; + llp.height = height; } } - private void centeringCandidates(int from, int to, int width, int paneWidth) { + private void centeringCandidates(View from, View to, int width, int paneWidth) { final ViewGroup pane = mCandidatesPane; - final int fromIndex = pane.indexOfChild(mWords.get(from)); - final int toIndex; - if (mInfos.get(to).getParent() != null) { - toIndex = pane.indexOfChild(mInfos.get(to)); - } else { - toIndex = pane.indexOfChild(mWords.get(to)); - } + final int fromIndex = pane.indexOfChild(from); + final int toIndex = pane.indexOfChild(to); final int offset = (paneWidth - width) / 2; for (int index = fromIndex; index <= toIndex; index++) { offsetMargin(pane.getChildAt(index), offset, 0);