diff options
Diffstat (limited to 'java')
-rw-r--r-- | java/res/layout/suggestions_strip.xml | 15 | ||||
-rw-r--r-- | java/res/values/attrs.xml | 6 | ||||
-rw-r--r-- | java/res/values/dimens.xml | 2 | ||||
-rw-r--r-- | java/res/values/styles.xml | 48 | ||||
-rw-r--r-- | java/res/values/themes-basic-highcontrast.xml | 4 | ||||
-rw-r--r-- | java/res/values/themes-basic.xml | 4 | ||||
-rw-r--r-- | java/res/values/themes-gingerbread.xml | 4 | ||||
-rw-r--r-- | java/res/values/themes-ics.xml | 4 | ||||
-rw-r--r-- | java/res/values/themes-stone-bold.xml | 6 | ||||
-rw-r--r-- | java/res/values/themes-stone.xml | 4 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/compat/LinearLayoutCompatUtils.java | 55 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/latin/MoreSuggestionsView.java | 2 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/latin/SuggestionsView.java | 26 |
13 files changed, 53 insertions, 127 deletions
diff --git a/java/res/layout/suggestions_strip.xml b/java/res/layout/suggestions_strip.xml index 9252017b4..cbf31e6dc 100644 --- a/java/res/layout/suggestions_strip.xml +++ b/java/res/layout/suggestions_strip.xml @@ -22,16 +22,9 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" > - <!-- Placer for debug information --> - <RelativeLayout - android:id="@+id/suggestions_placer" + <LinearLayout + android:id="@+id/suggestions_strip" + android:orientation="horizontal" android:layout_width="match_parent" - android:layout_height="match_parent" - > - <LinearLayout - android:id="@+id/suggestions_strip" - android:orientation="horizontal" - android:layout_width="match_parent" - android:layout_height="match_parent" /> - </RelativeLayout> + android:layout_height="match_parent" /> </merge> diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml index fa6b2eb39..2af2554a0 100644 --- a/java/res/values/attrs.xml +++ b/java/res/values/attrs.xml @@ -27,11 +27,11 @@ <attr name="miniKeyboardPanelStyle" format="reference" /> <!-- Suggestions strip style --> <attr name="suggestionsStripBackgroundStyle" format="reference" /> - <attr name="suggestionsPaneViewStyle" format="reference" /> + <attr name="suggestionsViewStyle" format="reference" /> + <attr name="moreSuggestionsViewStyle" format="reference" /> <attr name="suggestionBackgroundStyle" format="reference" /> <attr name="suggestionPreviewBackgroundStyle" format="reference" /> - <attr name="suggestionsViewStyle" format="reference" /> - </declare-styleable> + </declare-styleable> <declare-styleable name="KeyboardView"> <!-- Image for the key. This image needs to be a StateListDrawable, with the following diff --git a/java/res/values/dimens.xml b/java/res/values/dimens.xml index c5c298df5..0ec65e3f8 100644 --- a/java/res/values/dimens.xml +++ b/java/res/values/dimens.xml @@ -80,7 +80,7 @@ <dimen name="more_suggestions_key_horizontal_padding">12dip</dimen> <dimen name="more_suggestions_row_height">40dip</dimen> <dimen name="more_suggestions_slide_allowance">0.2in</dimen> - <fraction name="more_suggestions_info_ratio">12%</fraction> + <fraction name="more_suggestions_info_ratio">18%</fraction> <dimen name="key_preview_backing_height">40dip</dimen> <dimen name="suggestions_strip_padding">0dip</dimen> <dimen name="suggestion_min_width">44dip</dimen> diff --git a/java/res/values/styles.xml b/java/res/values/styles.xml index 17b3d14ab..45b98ca4c 100644 --- a/java/res/values/styles.xml +++ b/java/res/values/styles.xml @@ -79,20 +79,9 @@ <item name="android:paddingLeft">@dimen/mini_keyboard_horizontal_edges_padding</item> <item name="android:paddingRight">@dimen/mini_keyboard_horizontal_edges_padding</item> </style> - <style - name="SuggestionsPaneViewStyle" - parent="MiniKeyboardView" - > - </style> <style name="SuggestionsStripBackgroundStyle"> <item name="android:background">@drawable/keyboard_suggest_strip</item> </style> - <style name="SuggestionBackgroundStyle"> - <item name="android:background">@drawable/btn_suggestion</item> - </style> - <style name="SuggestionPreviewBackgroundStyle"> - <item name="android:background">@drawable/suggestion_feedback_background</item> - </style> <style name="SuggestionsViewStyle" parent="SuggestionsStripBackgroundStyle" @@ -104,6 +93,17 @@ <item name="suggestionsCountInStrip">@integer/suggestions_count_in_strip</item> <item name="centerSuggestionPercentile">@integer/center_suggestion_percentile</item> </style> + <style + name="MoreSuggestionsViewStyle" + parent="MiniKeyboardView" + > + </style> + <style name="SuggestionBackgroundStyle"> + <item name="android:background">@drawable/btn_suggestion</item> + </style> + <style name="SuggestionPreviewBackgroundStyle"> + <item name="android:background">@drawable/suggestion_feedback_background</item> + </style> <!-- Theme "Basic high contrast" --> <style name="KeyboardView.HighContrast" @@ -232,19 +232,6 @@ <style name="SuggestionsStripBackgroundStyle.IceCreamSandwich"> <item name="android:background">@drawable/keyboard_suggest_strip_holo</item> </style> - <style name="SuggestionBackgroundStyle.IceCreamSandwich"> - <item name="android:background">@drawable/btn_suggestion_ics</item> - </style> - <style - name="SuggestionPreviewBackgroundStyle.IceCreamSandwich" - parent="MiniKeyboardPanelStyle.IceCreamSandwich" - > - </style> - <style - name="SuggestionsPaneViewStyle.IceCreamSandwich" - parent="MiniKeyboardView.IceCreamSandwich" - > - </style> <style name="SuggestionsViewStyle.IceCreamSandwich" parent="SuggestionsStripBackgroundStyle.IceCreamSandwich" @@ -256,6 +243,19 @@ <item name="suggestionsCountInStrip">@integer/suggestions_count_in_strip</item> <item name="centerSuggestionPercentile">@integer/center_suggestion_percentile</item> </style> + <style + name="MoreSuggestionsViewStyle.IceCreamSandwich" + parent="MiniKeyboardView.IceCreamSandwich" + > + </style> + <style name="SuggestionBackgroundStyle.IceCreamSandwich"> + <item name="android:background">@drawable/btn_suggestion_ics</item> + </style> + <style + name="SuggestionPreviewBackgroundStyle.IceCreamSandwich" + parent="MiniKeyboardPanelStyle.IceCreamSandwich" + > + </style> <style name="MiniKeyboardAnimation"> <item name="android:windowEnterAnimation">@anim/mini_keyboard_fadein</item> <item name="android:windowExitAnimation">@anim/mini_keyboard_fadeout</item> diff --git a/java/res/values/themes-basic-highcontrast.xml b/java/res/values/themes-basic-highcontrast.xml index ee4109326..a45fa5239 100644 --- a/java/res/values/themes-basic-highcontrast.xml +++ b/java/res/values/themes-basic-highcontrast.xml @@ -22,9 +22,9 @@ <item name="miniKeyboardViewStyle">@style/MiniKeyboardView</item> <item name="miniKeyboardPanelStyle">@style/MiniKeyboardPanelStyle</item> <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item> - <item name="suggestionsPaneViewStyle">@style/SuggestionsPaneViewStyle</item> + <item name="suggestionsViewStyle">@style/SuggestionsViewStyle</item> + <item name="moreSuggestionsViewStyle">@style/MoreSuggestionsViewStyle</item> <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item> <item name="suggestionPreviewBackgroundStyle">@style/SuggestionPreviewBackgroundStyle</item> - <item name="suggestionsViewStyle">@style/SuggestionsViewStyle</item> </style> </resources> diff --git a/java/res/values/themes-basic.xml b/java/res/values/themes-basic.xml index ff7f9ed35..4f754844f 100644 --- a/java/res/values/themes-basic.xml +++ b/java/res/values/themes-basic.xml @@ -22,9 +22,9 @@ <item name="miniKeyboardViewStyle">@style/MiniKeyboardView</item> <item name="miniKeyboardPanelStyle">@style/MiniKeyboardPanelStyle</item> <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item> - <item name="suggestionsPaneViewStyle">@style/SuggestionsPaneViewStyle</item> + <item name="suggestionsViewStyle">@style/SuggestionsViewStyle</item> + <item name="moreSuggestionsViewStyle">@style/MoreSuggestionsViewStyle</item> <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item> <item name="suggestionPreviewBackgroundStyle">@style/SuggestionPreviewBackgroundStyle</item> - <item name="suggestionsViewStyle">@style/SuggestionsViewStyle</item> </style> </resources> diff --git a/java/res/values/themes-gingerbread.xml b/java/res/values/themes-gingerbread.xml index af91c3bed..f3a74f33e 100644 --- a/java/res/values/themes-gingerbread.xml +++ b/java/res/values/themes-gingerbread.xml @@ -22,9 +22,9 @@ <item name="miniKeyboardViewStyle">@style/MiniKeyboardView.Gingerbread</item> <item name="miniKeyboardPanelStyle">@style/MiniKeyboardPanelStyle</item> <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item> - <item name="suggestionsPaneViewStyle">@style/SuggestionsPaneViewStyle</item> + <item name="suggestionsViewStyle">@style/SuggestionsViewStyle</item> + <item name="moreSuggestionsViewStyle">@style/MoreSuggestionsViewStyle</item> <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item> <item name="suggestionPreviewBackgroundStyle">@style/SuggestionPreviewBackgroundStyle</item> - <item name="suggestionsViewStyle">@style/SuggestionsViewStyle</item> </style> </resources> diff --git a/java/res/values/themes-ics.xml b/java/res/values/themes-ics.xml index 341afcc53..4b5ae6d20 100644 --- a/java/res/values/themes-ics.xml +++ b/java/res/values/themes-ics.xml @@ -22,9 +22,9 @@ <item name="miniKeyboardViewStyle">@style/MiniKeyboardView.IceCreamSandwich</item> <item name="miniKeyboardPanelStyle">@style/MiniKeyboardPanelStyle.IceCreamSandwich</item> <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle.IceCreamSandwich</item> - <item name="suggestionsPaneViewStyle">@style/SuggestionsPaneViewStyle.IceCreamSandwich</item> + <item name="suggestionsViewStyle">@style/SuggestionsViewStyle.IceCreamSandwich</item> + <item name="moreSuggestionsViewStyle">@style/MoreSuggestionsViewStyle.IceCreamSandwich</item> <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle.IceCreamSandwich</item> <item name="suggestionPreviewBackgroundStyle">@style/SuggestionPreviewBackgroundStyle.IceCreamSandwich</item> - <item name="suggestionsViewStyle">@style/SuggestionsViewStyle.IceCreamSandwich</item> </style> </resources> diff --git a/java/res/values/themes-stone-bold.xml b/java/res/values/themes-stone-bold.xml index 915f2263e..3cff0f123 100644 --- a/java/res/values/themes-stone-bold.xml +++ b/java/res/values/themes-stone-bold.xml @@ -22,9 +22,9 @@ <item name="miniKeyboardViewStyle">@style/MiniKeyboardView.Stone</item> <item name="miniKeyboardPanelStyle">@style/MiniKeyboardPanelStyle</item> <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item> - <item name="suggestionsPaneViewStyle">@style/SuggestionsPaneViewStyle</item> - <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item> - <item name="suggestionPreviewBackgroundStyle">@style/SuggestionPreviewBackgroundStyle</item> <item name="suggestionsViewStyle">@style/SuggestionsViewStyle</item> + <item name="moreSuggestionsViewStyle">@style/MoreSuggestionsViewStyle</item> + <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item> + <item name="suggestionPreviewBackgroundStyle">@style/SuggestionPreviewBackgroundStyle</item> </style> </resources> diff --git a/java/res/values/themes-stone.xml b/java/res/values/themes-stone.xml index 6d5b9dbae..785f4107f 100644 --- a/java/res/values/themes-stone.xml +++ b/java/res/values/themes-stone.xml @@ -22,9 +22,9 @@ <item name="miniKeyboardViewStyle">@style/MiniKeyboardView.Stone</item> <item name="miniKeyboardPanelStyle">@style/MiniKeyboardPanelStyle</item> <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item> - <item name="suggestionsPaneViewStyle">@style/SuggestionsPaneViewStyle</item> + <item name="suggestionsViewStyle">@style/SuggestionsViewStyle</item> + <item name="moreSuggestionsViewStyle">@style/MoreSuggestionsViewStyle</item> <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item> <item name="suggestionPreviewBackgroundStyle">@style/SuggestionPreviewBackgroundStyle</item> - <item name="suggestionsViewStyle">@style/SuggestionsViewStyle</item> </style> </resources> diff --git a/java/src/com/android/inputmethod/compat/LinearLayoutCompatUtils.java b/java/src/com/android/inputmethod/compat/LinearLayoutCompatUtils.java deleted file mode 100644 index 674cbe74b..000000000 --- a/java/src/com/android/inputmethod/compat/LinearLayoutCompatUtils.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.inputmethod.compat; - -import android.content.Context; -import android.content.res.TypedArray; -import android.graphics.drawable.Drawable; -import android.util.AttributeSet; -import android.util.Log; - -import java.lang.reflect.Field; - -public class LinearLayoutCompatUtils { - private static final String TAG = LinearLayoutCompatUtils.class.getSimpleName(); - - private static final Class<?> CLASS_R_STYLEABLE = CompatUtils.getClass( - "com.android.internal.R$styleable"); - private static final Field STYLEABLE_VIEW = CompatUtils.getField( - CLASS_R_STYLEABLE, "View"); - private static final Field STYLEABLE_VIEW_BACKGROUND = CompatUtils.getField( - CLASS_R_STYLEABLE, "View_background"); - private static final Object VALUE_STYLEABLE_VIEW = CompatUtils.getFieldValue( - null, null, STYLEABLE_VIEW); - private static final Integer VALUE_STYLEABLE_VIEW_BACKGROUND = - (Integer)CompatUtils.getFieldValue(null, null, STYLEABLE_VIEW_BACKGROUND); - - public static Drawable getBackgroundDrawable(Context context, AttributeSet attrs, - int defStyleAttr, int defStyleRes) { - if (!(VALUE_STYLEABLE_VIEW instanceof int[]) || VALUE_STYLEABLE_VIEW_BACKGROUND == null) { - Log.w(TAG, "Can't get View background attribute using reflection"); - return null; - } - - final int[] styleableView = (int[])VALUE_STYLEABLE_VIEW; - final TypedArray a = context.obtainStyledAttributes( - attrs, styleableView, defStyleAttr, defStyleRes); - final Drawable background = a.getDrawable(VALUE_STYLEABLE_VIEW_BACKGROUND); - a.recycle(); - return background; - } -} diff --git a/java/src/com/android/inputmethod/latin/MoreSuggestionsView.java b/java/src/com/android/inputmethod/latin/MoreSuggestionsView.java index 9fd90241b..0f8192bbb 100644 --- a/java/src/com/android/inputmethod/latin/MoreSuggestionsView.java +++ b/java/src/com/android/inputmethod/latin/MoreSuggestionsView.java @@ -73,7 +73,7 @@ public class MoreSuggestionsView extends KeyboardView implements MoreKeysPanel { }; public MoreSuggestionsView(Context context, AttributeSet attrs) { - this(context, attrs, R.attr.suggestionsPaneViewStyle); + this(context, attrs, R.attr.moreSuggestionsViewStyle); } public MoreSuggestionsView(Context context, AttributeSet attrs, int defStyle) { diff --git a/java/src/com/android/inputmethod/latin/SuggestionsView.java b/java/src/com/android/inputmethod/latin/SuggestionsView.java index 10cd73dd3..f11ac1dcf 100644 --- a/java/src/com/android/inputmethod/latin/SuggestionsView.java +++ b/java/src/com/android/inputmethod/latin/SuggestionsView.java @@ -45,10 +45,10 @@ import android.view.View.OnLongClickListener; import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.PopupWindow; +import android.widget.RelativeLayout; import android.widget.TextView; import com.android.inputmethod.compat.FrameLayoutCompatUtils; -import com.android.inputmethod.compat.LinearLayoutCompatUtils; import com.android.inputmethod.keyboard.KeyboardActionListener; import com.android.inputmethod.keyboard.KeyboardView; import com.android.inputmethod.keyboard.MoreKeysPanel; @@ -58,7 +58,8 @@ import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; import java.util.ArrayList; import java.util.List; -public class SuggestionsView extends LinearLayout implements OnClickListener, OnLongClickListener { +public class SuggestionsView extends RelativeLayout implements OnClickListener, + OnLongClickListener { public interface Listener { public boolean addWordToDictionary(String word); public void pickSuggestionManually(int index, CharSequence word); @@ -69,7 +70,6 @@ public class SuggestionsView extends LinearLayout implements OnClickListener, On private static final boolean DBG = LatinImeLogger.sDBG; - private final ViewGroup mSuggestionsPlacer; private final ViewGroup mSuggestionsStrip; private KeyboardView mKeyboardView; @@ -451,18 +451,7 @@ public class SuggestionsView extends LinearLayout implements OnClickListener, On } public SuggestionsView(Context context, AttributeSet attrs, int defStyle) { - // Note: Up to version 10 (Gingerbread) of the API, LinearLayout doesn't have 3-argument - // constructor. - // TODO: Call 3-argument constructor, super(context, attrs, defStyle), when we abandon - // backward compatibility with the version 10 or earlier of the API. - super(context, attrs); - if (defStyle != R.attr.suggestionsViewStyle) { - throw new IllegalArgumentException( - "can't accept defStyle other than R.attr.suggestionsViewStyle: defStyle=" - + defStyle); - } - setBackgroundDrawable(LinearLayoutCompatUtils.getBackgroundDrawable( - context, attrs, defStyle, R.style.SuggestionsViewStyle)); + super(context, attrs, defStyle); final LayoutInflater inflater = LayoutInflater.from(context); inflater.inflate(R.layout.suggestions_strip, this); @@ -474,7 +463,6 @@ public class SuggestionsView extends LinearLayout implements OnClickListener, On mPreviewPopup.setContentView(mPreviewText); mPreviewPopup.setBackgroundDrawable(null); - mSuggestionsPlacer = (ViewGroup)findViewById(R.id.suggestions_placer); mSuggestionsStrip = (ViewGroup)findViewById(R.id.suggestions_strip); for (int pos = 0; pos < MAX_SUGGESTIONS; pos++) { final TextView word = (TextView)inflater.inflate(R.layout.suggestion_word, null); @@ -527,7 +515,7 @@ public class SuggestionsView extends LinearLayout implements OnClickListener, On if (mSuggestions.size() == 0) return; - mParams.layout(mSuggestions, mSuggestionsStrip, mSuggestionsPlacer, getWidth()); + mParams.layout(mSuggestions, mSuggestionsStrip, this, getWidth()); } private static CharSequence getDebugInfo(SuggestedWords suggestions, int pos) { @@ -648,9 +636,9 @@ public class SuggestionsView extends LinearLayout implements OnClickListener, On public void clear() { mShowingAutoCorrectionInverted = false; - mSuggestionsPlacer.removeAllViews(); - mSuggestionsPlacer.addView(mSuggestionsStrip); mSuggestionsStrip.removeAllViews(); + removeAllViews(); + addView(mSuggestionsStrip); dismissMoreSuggestions(); } |