From e583371b13ebd9aa336d0883e8c174ae4918c758 Mon Sep 17 00:00:00 2001
From: "Tadashi G. Takaoka" <takaoka@google.com>
Date: Mon, 4 Jul 2011 15:42:20 +0900
Subject: [PATCH] Use Key background for suggestions strip control

Change-Id: I5e43c0919e89972283fd18eb29d69f96f1bd0290
---
 java/res/layout/candidates_strip.xml              | 12 ++++--------
 .../android/inputmethod/latin/CandidateView.java  | 15 +++++++++++++--
 2 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/java/res/layout/candidates_strip.xml b/java/res/layout/candidates_strip.xml
index 2d908863cb..269bc1bc35 100644
--- a/java/res/layout/candidates_strip.xml
+++ b/java/res/layout/candidates_strip.xml
@@ -40,22 +40,18 @@
             android:gravity="center"
             android:layout_width="wrap_content"
             android:layout_height="match_parent"
+            android:minWidth="28dp"
             android:textSize="@dimen/candidate_text_size"
-            android:paddingRight="8dp"
-            android:paddingLeft="8dp"
-            android:visibility="visible"
-            android:background="@drawable/btn_keyboard_key_ics" />
+            android:visibility="visible" />
         <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="28dp"
             android:textSize="@dimen/candidate_text_size"
-            android:paddingRight="8dp"
-            android:paddingLeft="8dp"
-            android:visibility="gone"
-            android:background="@drawable/btn_keyboard_key_ics" />
+            android:visibility="gone" />
     </LinearLayout>
     <LinearLayout
         android:id="@+id/touch_to_save"
diff --git a/java/src/com/android/inputmethod/latin/CandidateView.java b/java/src/com/android/inputmethod/latin/CandidateView.java
index 1ab7c6d42b..7ec18b38ac 100644
--- a/java/src/com/android/inputmethod/latin/CandidateView.java
+++ b/java/src/com/android/inputmethod/latin/CandidateView.java
@@ -21,6 +21,7 @@ import android.content.res.Resources;
 import android.content.res.TypedArray;
 import android.graphics.Color;
 import android.graphics.Typeface;
+import android.graphics.drawable.Drawable;
 import android.os.Message;
 import android.text.Spannable;
 import android.text.SpannableString;
@@ -330,9 +331,18 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo
         mInvertedForegroundColorSpan = new ForegroundColorSpan(mColorTypedWord ^ 0x00ffffff);
         mInvertedBackgroundColorSpan = new BackgroundColorSpan(mColorTypedWord);
 
+        final TypedArray keyboardViewAttr = context.obtainStyledAttributes(
+                attrs, R.styleable.KeyboardView, R.attr.keyboardViewStyle, R.style.KeyboardView);
+        final Drawable keyBackground = keyboardViewAttr.getDrawable(
+                R.styleable.KeyboardView_keyBackground);
+        final int keyTextColor = keyboardViewAttr.getColor(
+                R.styleable.KeyboardView_keyTextColor, 0xFF000000);
+        keyboardViewAttr.recycle();
+
         mCandidatesPaneControl = (ViewGroup)findViewById(R.id.candidates_pane_control);
         mExpandCandidatesPane = (TextView)findViewById(R.id.expand_candidates_pane);
-        mExpandCandidatesPane.getBackground().setAlpha(180);
+        mExpandCandidatesPane.setBackgroundDrawable(keyBackground);
+        mExpandCandidatesPane.setTextColor(keyTextColor);
         mExpandCandidatesPane.setOnClickListener(new OnClickListener() {
             @Override
             public void onClick(View view) {
@@ -340,7 +350,8 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo
             }
         });
         mCloseCandidatesPane = (TextView)findViewById(R.id.close_candidates_pane);
-        mCloseCandidatesPane.getBackground().setAlpha(180);
+        mCloseCandidatesPane.setBackgroundDrawable(keyBackground);
+        mCloseCandidatesPane.setTextColor(keyTextColor);
         mCloseCandidatesPane.setOnClickListener(new OnClickListener() {
             @Override
             public void onClick(View view) {
-- 
GitLab