Use custom theme for Keyboard theme switch

This change reduces the number of layout files and make these
theme-generic.  This might be very helpful to re-design suggestion
strip.

Bug: 4175031
Change-Id: Idca10a4aa0bf7ac496eedd1879311e59780a423b
diff --git a/java/res/drawable/btn_keyboard_key_gingerbread_popup.xml b/java/res/drawable/btn_keyboard_key_popup.xml
similarity index 93%
rename from java/res/drawable/btn_keyboard_key_gingerbread_popup.xml
rename to java/res/drawable/btn_keyboard_key_popup.xml
index 9b6d23b..860cfd5 100644
--- a/java/res/drawable/btn_keyboard_key_gingerbread_popup.xml
+++ b/java/res/drawable/btn_keyboard_key_popup.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 The Android Open Source Project
+<!-- 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.
diff --git a/java/res/drawable/btn_keyboard_key_honeycomb_popup.xml b/java/res/drawable/btn_keyboard_key_popup_honeycomb.xml
similarity index 93%
rename from java/res/drawable/btn_keyboard_key_honeycomb_popup.xml
rename to java/res/drawable/btn_keyboard_key_popup_honeycomb.xml
index 6c27136..f5a191f 100644
--- a/java/res/drawable/btn_keyboard_key_honeycomb_popup.xml
+++ b/java/res/drawable/btn_keyboard_key_popup_honeycomb.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 The Android Open Source Project
+<!-- 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.
diff --git a/java/res/layout-xlarge/candidate.xml b/java/res/layout-xlarge/candidate.xml
deleted file mode 100644
index 582e642..0000000
--- a/java/res/layout-xlarge/candidate.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2010, 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.
-*/
--->
-
-<LinearLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="wrap_content"
-    android:layout_height="match_parent"
-    android:orientation="horizontal"
->
-    <ImageView
-        android:id="@+id/candidate_divider"
-        android:layout_width="wrap_content"
-        android:layout_height="match_parent"
-        android:src="@drawable/keyboard_suggest_strip_divider"
-        android:paddingRight="@dimen/candidate_padding"
-        android:paddingLeft="@dimen/candidate_padding"
-        android:visibility="invisible"
-        android:focusable="false"
-        android:clickable="false"
-        android:gravity="center_vertical|center_horizontal" />
-    <Button
-        android:id="@+id/candidate_word"
-        android:layout_width="wrap_content"
-        android:layout_height="match_parent"
-        android:minWidth="@dimen/candidate_min_width"
-        android:textSize="@dimen/candidate_text_size"
-        android:textColor="@color/candidate_normal"
-        android:background="@drawable/btn_candidate_holo"
-        android:focusable="true"
-        android:clickable="true"
-        android:gravity="center_vertical|center_horizontal" />
-    <TextView
-        android:id="@+id/candidate_debug_info"
-        android:layout_width="wrap_content"
-        android:layout_height="match_parent"
-        android:visibility="gone"
-        android:textSize="10dip"
-        android:textColor="#ff808080"
-        android:focusable="false"
-        android:clickable="false"
-        android:gravity="bottom" />
-</LinearLayout>
diff --git a/java/res/layout-xlarge/candidate_preview.xml b/java/res/layout-xlarge/candidate_preview.xml
deleted file mode 100644
index 61d5f8e..0000000
--- a/java/res/layout-xlarge/candidate_preview.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2010, 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.
-*/
--->
-
-<TextView
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="wrap_content"
-    android:layout_height="wrap_content"
-    android:textSize="18sp"
-    android:textColor="?android:attr/textColorPrimaryInverse"
-    android:minWidth="32dip"
-    android:gravity="center"
-    android:background="@drawable/keyboard_popup_panel_background_holo" />
diff --git a/java/res/layout-xlarge/candidates.xml b/java/res/layout-xlarge/candidates.xml
index e111acd..93b0304 100644
--- a/java/res/layout-xlarge/candidates.xml
+++ b/java/res/layout-xlarge/candidates.xml
@@ -34,9 +34,9 @@
         android:orientation="horizontal"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:background="@drawable/keyboard_suggest_strip_holo"
         android:paddingRight="@dimen/candidate_strip_padding"
         android:paddingLeft="@dimen/candidate_strip_padding"
+        style="?attr/suggestionsStripBackgroundStyle"
     >
         <HorizontalScrollView
             android:layout_width="match_parent"
diff --git a/java/res/layout/candidate.xml b/java/res/layout/candidate.xml
index 5472a1d..aea34ac 100644
--- a/java/res/layout/candidate.xml
+++ b/java/res/layout/candidate.xml
@@ -42,10 +42,10 @@
         android:minWidth="@dimen/candidate_min_width"
         android:textSize="@dimen/candidate_text_size"
         android:textColor="@color/candidate_normal"
-        android:background="@drawable/btn_candidate"
         android:focusable="true"
         android:clickable="true"
-        android:gravity="center_vertical|center_horizontal" />
+        android:gravity="center_vertical|center_horizontal"
+        style="?attr/suggestionBackgroundStyle" />
     <TextView
         android:id="@+id/candidate_debug_info"
         android:layout_width="wrap_content"
diff --git a/java/res/layout/candidate_preview.xml b/java/res/layout/candidate_preview.xml
index fe2002d..32705c9 100644
--- a/java/res/layout/candidate_preview.xml
+++ b/java/res/layout/candidate_preview.xml
@@ -19,11 +19,10 @@
 -->
 
 <TextView xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="wrap_content" 
+    android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:textSize="18sp"
     android:textColor="?android:attr/textColorPrimaryInverse"
     android:minWidth="32dip"
     android:gravity="center"
-    android:background="@drawable/candidate_feedback_background"
-    />
+    style="?attr/suggestionPreviewBackgroundStyle" />
diff --git a/java/res/layout/candidates.xml b/java/res/layout/candidates.xml
index 5c29f73..2bcafc9 100644
--- a/java/res/layout/candidates.xml
+++ b/java/res/layout/candidates.xml
@@ -32,10 +32,10 @@
     <HorizontalScrollView
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:background="@drawable/keyboard_suggest_strip"
         android:fadingEdge="horizontal"
         android:fadingEdgeLength="@dimen/candidate_strip_fading_edge_length"
         android:scrollbars="none"
+        style="?attr/suggestionsStripBackgroundStyle"
     >
         <com.android.inputmethod.latin.CandidateView
             android:id="@+id/candidates"
diff --git a/java/res/layout/input_basic.xml b/java/res/layout/input_basic.xml
deleted file mode 100644
index ec2f60e..0000000
--- a/java/res/layout/input_basic.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/* 
-**
-** Copyright 2008, 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.
-*/
--->
-
-<LinearLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
-    android:orientation="vertical"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
->
-    <include
-        layout="@layout/candidates" />
-    <com.android.inputmethod.keyboard.LatinKeyboardView
-        android:id="@+id/latin_keyboard_view"
-        android:layout_alignParentBottom="true"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:padding="0dip"
-        android:background="@drawable/keyboard_background"
-        latin:keyBackground="@drawable/btn_keyboard_key" />
-</LinearLayout>
diff --git a/java/res/layout/input_gingerbread.xml b/java/res/layout/input_gingerbread.xml
deleted file mode 100644
index f620151..0000000
--- a/java/res/layout/input_gingerbread.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2010, 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.
-*/
--->
-
-<LinearLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
-    android:orientation="vertical"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
->
-    <include
-        layout="@layout/candidates" />
-    <com.android.inputmethod.keyboard.LatinKeyboardView
-        android:id="@+id/latin_keyboard_view"
-        android:layout_alignParentBottom="true"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:padding="0dip"
-        android:background="@drawable/keyboard_dark_background"
-        latin:keyBackground="@drawable/btn_keyboard_key_gingerbread"
-        latin:keyLetterStyle="bold" />
-</LinearLayout>
diff --git a/java/res/layout/input_honeycomb.xml b/java/res/layout/input_honeycomb.xml
deleted file mode 100644
index 5a7dcb0..0000000
--- a/java/res/layout/input_honeycomb.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2010, 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.
-*/
--->
-
-<LinearLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
-    android:orientation="vertical"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
->
-    <include
-        layout="@layout/candidates" />
-    <com.android.inputmethod.keyboard.LatinKeyboardView
-        android:id="@+id/latin_keyboard_view"
-        android:layout_alignParentBottom="true"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:padding="0dip"
-        android:background="@drawable/keyboard_background_holo"
-        latin:keyBackground="@drawable/btn_keyboard_key_honeycomb"
-        latin:keyPreviewLayout="@layout/key_preview_honeycomb"
-        latin:keyPreviewHeight="@dimen/key_preview_height_holo"
-        latin:keyPreviewOffset="@dimen/key_preview_offset_holo"
-        latin:popupLayout="@layout/keyboard_popup_honeycomb"
-        latin:keyTextColorDisabled="#FF63666D"
-        latin:keyLetterStyle="bold"
-        latin:shadowColor="#00000000"
-        latin:shadowRadius="0.0" />
-</LinearLayout>
diff --git a/java/res/layout/input_stone_bold.xml b/java/res/layout/input_stone_bold.xml
deleted file mode 100644
index ca0794c..0000000
--- a/java/res/layout/input_stone_bold.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2010, 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.
-*/
--->
-
-<LinearLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
-    android:orientation="vertical"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
->
-    <include
-        layout="@layout/candidates" />
-    <com.android.inputmethod.keyboard.LatinKeyboardView
-        android:id="@+id/latin_keyboard_view"
-        android:layout_alignParentBottom="true"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:padding="0dip"
-        android:background="@drawable/keyboard_background"
-        latin:keyBackground="@drawable/btn_keyboard_key_stone"
-        latin:keyTextColor="@color/latinkeyboard_key_color_black"
-        latin:keyTextColorDisabled="#FF808080"
-        latin:shadowColor="@color/latinkeyboard_key_color_white"
-        latin:keyLetterStyle="bold"
-        latin:colorScheme="black"
-        latin:popupLayout="@layout/keyboard_popup_stone" />
-</LinearLayout>
diff --git a/java/res/layout/input_stone_normal.xml b/java/res/layout/input_stone_normal.xml
deleted file mode 100644
index 9d5afb6..0000000
--- a/java/res/layout/input_stone_normal.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2010, 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.
-*/
--->
-
-<LinearLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
-    android:orientation="vertical"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
->
-    <include
-        layout="@layout/candidates" />
-    <com.android.inputmethod.keyboard.LatinKeyboardView
-        android:id="@+id/latin_keyboard_view"
-        android:layout_alignParentBottom="true"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:padding="0dip"
-        android:background="@drawable/keyboard_background"
-        latin:keyBackground="@drawable/btn_keyboard_key_stone"
-        latin:keyTextColor="@color/latinkeyboard_key_color_black"
-        latin:keyTextColorDisabled="#FF808080"
-        latin:shadowColor="@color/latinkeyboard_key_color_white"
-        latin:colorScheme="black"
-        latin:popupLayout="@layout/keyboard_popup_stone" />
-</LinearLayout>
diff --git a/java/res/layout/input_basic_highcontrast.xml b/java/res/layout/input_view.xml
similarity index 85%
rename from java/res/layout/input_basic_highcontrast.xml
rename to java/res/layout/input_view.xml
index 0a34b1f..c8820b0 100644
--- a/java/res/layout/input_basic_highcontrast.xml
+++ b/java/res/layout/input_view.xml
@@ -2,7 +2,7 @@
 <!--
 /*
 **
-** Copyright 2010, The Android Open Source Project
+** Copyright 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.
@@ -32,7 +32,5 @@
         android:layout_alignParentBottom="true"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:padding="0dip"
-        android:background="@android:color/black"
-        latin:keyBackground="@drawable/btn_keyboard_key3" />
+        android:padding="0dip" />
 </LinearLayout>
diff --git a/java/res/layout/key_preview.xml b/java/res/layout/key_preview.xml
index de03506..5032dd5 100644
--- a/java/res/layout/key_preview.xml
+++ b/java/res/layout/key_preview.xml
@@ -25,5 +25,5 @@
     android:textColor="@color/latinkeyboard_key_color_white"
     android:minWidth="32dip"
     android:gravity="center"
-    android:background="@drawable/keyboard_key_feedback"
+    style="?attr/keyPreviewStyle"
     />
diff --git a/java/res/layout/key_preview_honeycomb.xml b/java/res/layout/key_preview_honeycomb.xml
deleted file mode 100644
index 2fbfbb5..0000000
--- a/java/res/layout/key_preview_honeycomb.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2010, 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.
-*/
--->
-
-<TextView xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="wrap_content"
-    android:layout_height="80sp"
-    android:textSize="40sp"
-    android:textColor="@color/latinkeyboard_key_color_white"
-    android:minWidth="32dip"
-    android:gravity="center"
-    android:background="@drawable/keyboard_key_feedback_honeycomb"
-    />
diff --git a/java/res/layout/keyboard_popup.xml b/java/res/layout/keyboard_popup.xml
index 0317d8d..e2508da 100644
--- a/java/res/layout/keyboard_popup.xml
+++ b/java/res/layout/keyboard_popup.xml
@@ -22,9 +22,7 @@
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:orientation="horizontal"
-        android:background="@drawable/keyboard_popup_panel_background"
-        android:paddingLeft="@dimen/mini_keyboard_horizontal_padding"
-        android:paddingRight="@dimen/mini_keyboard_horizontal_padding"
+        style="?attr/popupMiniKeyboardPanelStyle"
         >
     <com.android.inputmethod.keyboard.PopupMiniKeyboardView
             xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
@@ -32,9 +30,5 @@
             android:layout_alignParentBottom="true"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-
-            latin:keyBackground="@drawable/btn_keyboard_key_gingerbread_popup"
-            latin:keyHysteresisDistance="0dip"
-            latin:verticalCorrection="@dimen/mini_keyboard_vertical_correction"
             />
 </LinearLayout>
diff --git a/java/res/layout/keyboard_popup_honeycomb.xml b/java/res/layout/keyboard_popup_honeycomb.xml
deleted file mode 100644
index 2ddcbdc..0000000
--- a/java/res/layout/keyboard_popup_honeycomb.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2010, 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.
-*/
--->
-<LinearLayout
-        xmlns:android="http://schemas.android.com/apk/res/android"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:orientation="horizontal"
-        android:background="@drawable/keyboard_popup_panel_background_holo"
-        android:paddingLeft="@dimen/mini_keyboard_horizontal_padding_holo"
-        android:paddingRight="@dimen/mini_keyboard_horizontal_padding_holo"
-        >
-    <com.android.inputmethod.keyboard.PopupMiniKeyboardView
-            xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
-            android:id="@+id/mini_keyboard_view"
-            android:layout_alignParentBottom="true"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-
-            latin:keyBackground="@drawable/btn_keyboard_key_honeycomb_popup"
-            latin:keyHysteresisDistance="0dip"
-            latin:verticalCorrection="@dimen/mini_keyboard_vertical_correction"
-            />
-</LinearLayout>
diff --git a/java/res/layout/keyboard_popup_stone.xml b/java/res/layout/keyboard_popup_stone.xml
deleted file mode 100644
index 94176b2..0000000
--- a/java/res/layout/keyboard_popup_stone.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2010, 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.
-*/
--->
-
-<LinearLayout
-        xmlns:android="http://schemas.android.com/apk/res/android"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:orientation="horizontal"
-        android:background="@drawable/keyboard_popup_panel_background"
-        >
-    <com.android.inputmethod.keyboard.PopupMiniKeyboardView
-            xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
-            android:id="@+id/mini_keyboard_view"
-            android:layout_alignParentBottom="true"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:background="@drawable/keyboard_background"
-
-            latin:keyBackground="@drawable/btn_keyboard_key_stone"
-            latin:keyTextColor="@color/latinkeyboard_key_color_black"
-            latin:shadowColor="@color/latinkeyboard_key_color_white"
-        />
-</LinearLayout>
diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml
index f03da4f..0e5b38b 100644
--- a/java/res/values/attrs.xml
+++ b/java/res/values/attrs.xml
@@ -15,11 +15,20 @@
 -->
 
 <resources>
+    <declare-styleable name="KeyboardTheme">
+        <!-- KeyboardView style -->
+        <attr name="keyboardViewStyle" format="reference" />
+        <attr name="keyPreviewStyle" format="reference" />
+        <!-- PopupMiniKeyboardView style -->
+        <attr name="popupMiniKeyboardViewStyle" format="reference" />
+        <attr name="popupMiniKeyboardPanelStyle" format="reference" />
+        <!-- Suggestions strip style -->
+        <attr name="suggestionsStripBackgroundStyle" format="reference" />
+        <attr name="suggestionBackgroundStyle" format="reference" />
+        <attr name="suggestionPreviewBackgroundStyle" format="reference" />
+    </declare-styleable>
 
     <declare-styleable name="KeyboardView">
-        <!-- Default KeyboardView style. -->
-        <attr name="keyboardViewStyle" format="reference" />
-
         <!-- Image for the key. This image needs to be a StateListDrawable, with the following
              possible states: normal, pressed, checkable, checkable+pressed, checkable+checked,
              checkable+checked+pressed. -->
diff --git a/java/res/values/styles.xml b/java/res/values/styles.xml
index 3a389e5..7cb4593 100644
--- a/java/res/values/styles.xml
+++ b/java/res/values/styles.xml
@@ -15,9 +15,9 @@
 -->
 
 <resources>
+    <!-- Theme "Basic" -->
     <style name="KeyboardView">
         <item name="android:background">@drawable/keyboard_background</item>
-
         <item name="keyBackground">@drawable/btn_keyboard_key</item>
         <item name="keyLetterRatio">@fraction/key_letter_ratio</item>
         <item name="keyLetterStyle">normal</item>
@@ -35,6 +35,91 @@
         <item name="backgroundDimAmount">0.5</item>
         <item name="colorScheme">white</item>
     </style>
+    <style name="KeyPreviewStyle">
+        <item name="android:background">@drawable/keyboard_key_feedback</item>
+    </style>
+    <style name="PopupMiniKeyboardView" parent="KeyboardView">
+        <item name="keyBackground">@drawable/btn_keyboard_key_popup</item>
+        <item name="keyHysteresisDistance">0dip</item>
+        <item name="verticalCorrection">@dimen/mini_keyboard_vertical_correction</item>
+    </style>
+    <style name="PopupMiniKeyboardPanelStyle">
+        <item name="android:background">@drawable/keyboard_popup_panel_background</item>
+        <item name="android:paddingLeft">@dimen/mini_keyboard_horizontal_padding</item>
+        <item name="android:paddingRight">@dimen/mini_keyboard_horizontal_padding</item>
+    </style>
+    <style name="SuggestionsStripBackgroundStyle">
+        <item name="android:background">@drawable/keyboard_suggest_strip</item>
+    </style>
+    <style name="SuggestionBackgroundStyle">
+        <item name="android:background">@drawable/btn_candidate</item>
+    </style>
+    <style name="SuggestionPreviewBackgroundStyle">
+        <item name="android:background">@drawable/candidate_feedback_background</item>
+    </style>
+    <!-- Theme "Basic high contrast" -->
+    <style name="KeyboardView.HighContrast" parent="KeyboardView">
+        <item name="android:background">@android:color/black</item>
+        <item name="keyBackground">@drawable/btn_keyboard_key3</item>
+    </style>
+    <!-- Theme "Stone" -->
+    <style name="KeyboardView.Stone" parent="KeyboardView">
+        <item name="keyBackground">@drawable/btn_keyboard_key_stone</item>
+        <item name="keyTextColor">@color/latinkeyboard_key_color_black</item>
+        <item name="keyTextColorDisabled">#FF808080</item>
+        <item name="shadowColor">@color/latinkeyboard_key_color_white</item>
+        <item name="colorScheme">black</item>
+    </style>
+    <style name="PopupMiniKeyboardView.Stone" parent="PopupMiniKeyboardView">
+        <item name="keyBackground">@drawable/btn_keyboard_key_stone</item>
+        <item name="keyTextColor">@color/latinkeyboard_key_color_black</item>
+        <item name="shadowColor">@color/latinkeyboard_key_color_white</item>
+    </style>
+    <!-- Theme "Stone bold" -->
+    <style name="KeyboardView.Stone.Bold" parent="KeyboardView.Stone">
+        <item name="keyLetterStyle">bold</item>
+    </style>
+    <!-- Theme "Gingerbread" -->
+    <style name="KeyboardView.Gingerbread" parent="KeyboardView">
+        <item name="android:background">@drawable/keyboard_dark_background</item>
+        <item name="keyBackground">@drawable/btn_keyboard_key_gingerbread</item>
+        <item name="keyLetterStyle">bold</item>
+    </style>
+    <style name="PopupMiniKeyboardView.Gingerbread" parent="PopupMiniKeyboardView">
+        <item name="android:background">@null</item>
+    </style>
+    <!-- Theme "Honeycomb" -->
+    <style name="KeyboardView.Honeycomb" parent="KeyboardView">
+        <item name="android:background">@drawable/keyboard_background_holo</item>
+        <item name="keyBackground">@drawable/btn_keyboard_key_honeycomb</item>
+        <item name="keyPreviewHeight">@dimen/key_preview_height_holo</item>
+        <item name="keyPreviewOffset">@dimen/key_preview_offset_holo</item>
+        <item name="keyTextColorDisabled">#FF63666D</item>
+        <item name="keyLetterStyle">bold</item>
+        <item name="shadowColor">#00000000</item>
+        <item name="shadowRadius">0.0</item>
+    </style>
+    <style name="KeyPreviewStyle.Honeycomb">
+        <item name="android:background">@drawable/keyboard_key_feedback_honeycomb</item>
+    </style>
+    <style name="PopupMiniKeyboardView.Honeycomb" parent="PopupMiniKeyboardView">
+        <item name="android:background">@null</item>
+        <item name="keyBackground">@drawable/btn_keyboard_key_popup_honeycomb</item>
+    </style>
+    <style name="PopupMiniKeyboardPanelStyle.Honeycomb">
+        <item name="android:background">@drawable/keyboard_popup_panel_background_holo</item>
+        <item name="android:paddingLeft">@dimen/mini_keyboard_horizontal_padding_holo</item>
+        <item name="android:paddingRight">@dimen/mini_keyboard_horizontal_padding_holo</item>
+    </style>
+    <style name="SuggestionsStripBackgroundStyle.Holo">
+        <item name="android:background">@drawable/keyboard_suggest_strip_holo</item>
+    </style>
+    <style name="SuggestionBackgroundStyle.Holo">
+        <item name="android:background">@drawable/btn_candidate_holo</item>
+    </style>
+    <style name="SuggestionPreviewBackgroundStyle.Holo">
+        <item name="android:background">@drawable/keyboard_popup_panel_background_holo</item>
+    </style>
     <style name="PopupMiniKeyboardAnimation">
         <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.xml b/java/res/values/themes.xml
new file mode 100644
index 0000000..5315a9a
--- /dev/null
+++ b/java/res/values/themes.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<resources>
+    <style name="KeyboardTheme" parent="android:Theme">
+        <item name="keyboardViewStyle">@style/KeyboardView</item>
+        <item name="keyPreviewStyle">@style/KeyPreviewStyle</item>
+        <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView</item>
+        <item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle</item>
+        <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>
+        <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item>
+        <item name="suggestionPreviewBackgroundStyle">@style/SuggestionPreviewBackgroundStyle</item>
+    </style>
+    <style name="KeyboardTheme.HighContrast" parent="android:Theme">
+        <item name="keyboardViewStyle">@style/KeyboardView.HighContrast</item>
+        <item name="keyPreviewStyle">@style/KeyPreviewStyle</item>
+        <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView</item>
+        <item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle</item>
+        <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>
+        <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item>
+    </style>
+    <style name="KeyboardTheme.Stone" parent="android:Theme.Light">
+        <item name="keyboardViewStyle">@style/KeyboardView.Stone</item>
+        <item name="keyPreviewStyle">@style/KeyPreviewStyle</item>
+        <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView.Stone</item>
+        <item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle</item>
+        <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>
+        <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item>
+    </style>
+    <style name="KeyboardTheme.Stone.Bold" parent="android:Theme.Light">
+        <item name="keyboardViewStyle">@style/KeyboardView.Stone.Bold</item>
+        <item name="keyPreviewStyle">@style/KeyPreviewStyle</item>
+        <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView.Stone</item>
+        <item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle</item>
+        <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>
+        <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item>
+    </style>
+    <style name="KeyboardTheme.Gingerbread" parent="android:Theme.Black">
+        <item name="keyboardViewStyle">@style/KeyboardView.Gingerbread</item>
+        <item name="keyPreviewStyle">@style/KeyPreviewStyle</item>
+        <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView.Gingerbread</item>
+        <item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle</item>
+        <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>
+        <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item>
+    </style>
+    <style name="KeyboardTheme.Honeycomb" parent="android:Theme.Holo">
+        <item name="keyboardViewStyle">@style/KeyboardView.Honeycomb</item>
+        <item name="keyPreviewStyle">@style/KeyPreviewStyle.Honeycomb</item>
+        <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView.Honeycomb</item>
+        <item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle.Honeycomb</item>
+        <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle.Holo</item>
+        <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle.Holo</item>
+    </style>
+</resources>
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
index 3497310..195c929 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
@@ -20,6 +20,7 @@
 import android.content.SharedPreferences;
 import android.content.res.Resources;
 import android.util.Log;
+import android.view.ContextThemeWrapper;
 import android.view.InflateException;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -45,12 +46,12 @@
     private static String sConfigDefaultKeyboardThemeId;
     public static final String PREF_KEYBOARD_LAYOUT = "pref_keyboard_layout_20100902";
     private static final int[] KEYBOARD_THEMES = {
-        R.layout.input_basic,
-        R.layout.input_basic_highcontrast,
-        R.layout.input_stone_normal,
-        R.layout.input_stone_bold,
-        R.layout.input_gingerbread,
-        R.layout.input_honeycomb,
+        R.style.KeyboardTheme,
+        R.style.KeyboardTheme_HighContrast,
+        R.style.KeyboardTheme_Stone,
+        R.style.KeyboardTheme_Stone_Bold,
+        R.style.KeyboardTheme_Gingerbread,
+        R.style.KeyboardTheme_Honeycomb,
     };
 
     private SubtypeSwitcher mSubtypeSwitcher;
@@ -730,8 +731,10 @@
         boolean tryGC = true;
         for (int i = 0; i < Utils.GCUtils.GC_TRY_LOOP_MAX && tryGC; ++i) {
             try {
-                mCurrentInputView = LayoutInflater.from(mInputMethodService).inflate(
-                        KEYBOARD_THEMES[themeIndex], null);
+                final Context themeContext = new ContextThemeWrapper(mInputMethodService,
+                        KEYBOARD_THEMES[themeIndex]);
+                mCurrentInputView = LayoutInflater.from(themeContext).inflate(
+                        R.layout.input_view, null);
                 tryGC = false;
             } catch (OutOfMemoryError e) {
                 Log.w(TAG, "load keyboard failed: " + e);
diff --git a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java
index 583b997..185f1f8 100644
--- a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java
@@ -16,10 +16,6 @@
 
 package com.android.inputmethod.keyboard;
 
-import com.android.inputmethod.deprecated.VoiceProxy;
-import com.android.inputmethod.latin.LatinImeLogger;
-import com.android.inputmethod.latin.Utils;
-
 import android.content.Context;
 import android.graphics.Canvas;
 import android.text.TextUtils;
@@ -27,6 +23,10 @@
 import android.util.Log;
 import android.view.MotionEvent;
 
+import com.android.inputmethod.deprecated.VoiceProxy;
+import com.android.inputmethod.latin.LatinImeLogger;
+import com.android.inputmethod.latin.Utils;
+
 // TODO: We should remove this class
 public class LatinKeyboardView extends KeyboardView {
     private static final String TAG = LatinKeyboardView.class.getSimpleName();
@@ -47,7 +47,7 @@
     private int mLastY;
 
     public LatinKeyboardView(Context context, AttributeSet attrs) {
-        this(context, attrs, 0);
+        super(context, attrs);
     }
 
     public LatinKeyboardView(Context context, AttributeSet attrs, int defStyle) {
diff --git a/java/src/com/android/inputmethod/keyboard/PopupMiniKeyboardView.java b/java/src/com/android/inputmethod/keyboard/PopupMiniKeyboardView.java
index 62a32cf..fa2aa87 100644
--- a/java/src/com/android/inputmethod/keyboard/PopupMiniKeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/PopupMiniKeyboardView.java
@@ -41,7 +41,7 @@
     private long mDownTime;
 
     public PopupMiniKeyboardView(Context context, AttributeSet attrs) {
-        this(context, attrs, R.attr.keyboardViewStyle);
+        this(context, attrs, R.attr.popupMiniKeyboardViewStyle);
     }
 
     public PopupMiniKeyboardView(Context context, AttributeSet attrs, int defStyle) {