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
main
Tadashi G. Takaoka 2011-05-24 21:08:20 +09:00
parent 6c4add55f9
commit 13a7419994
25 changed files with 194 additions and 446 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?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"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?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"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -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>

View File

@ -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" />

View File

@ -34,9 +34,9 @@
android:orientation="horizontal" android:orientation="horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/keyboard_suggest_strip_holo"
android:paddingRight="@dimen/candidate_strip_padding" android:paddingRight="@dimen/candidate_strip_padding"
android:paddingLeft="@dimen/candidate_strip_padding" android:paddingLeft="@dimen/candidate_strip_padding"
style="?attr/suggestionsStripBackgroundStyle"
> >
<HorizontalScrollView <HorizontalScrollView
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -42,10 +42,10 @@
android:minWidth="@dimen/candidate_min_width" android:minWidth="@dimen/candidate_min_width"
android:textSize="@dimen/candidate_text_size" android:textSize="@dimen/candidate_text_size"
android:textColor="@color/candidate_normal" android:textColor="@color/candidate_normal"
android:background="@drawable/btn_candidate"
android:focusable="true" android:focusable="true"
android:clickable="true" android:clickable="true"
android:gravity="center_vertical|center_horizontal" /> android:gravity="center_vertical|center_horizontal"
style="?attr/suggestionBackgroundStyle" />
<TextView <TextView
android:id="@+id/candidate_debug_info" android:id="@+id/candidate_debug_info"
android:layout_width="wrap_content" android:layout_width="wrap_content"

View File

@ -25,5 +25,4 @@
android:textColor="?android:attr/textColorPrimaryInverse" android:textColor="?android:attr/textColorPrimaryInverse"
android:minWidth="32dip" android:minWidth="32dip"
android:gravity="center" android:gravity="center"
android:background="@drawable/candidate_feedback_background" style="?attr/suggestionPreviewBackgroundStyle" />
/>

View File

@ -32,10 +32,10 @@
<HorizontalScrollView <HorizontalScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/keyboard_suggest_strip"
android:fadingEdge="horizontal" android:fadingEdge="horizontal"
android:fadingEdgeLength="@dimen/candidate_strip_fading_edge_length" android:fadingEdgeLength="@dimen/candidate_strip_fading_edge_length"
android:scrollbars="none" android:scrollbars="none"
style="?attr/suggestionsStripBackgroundStyle"
> >
<com.android.inputmethod.latin.CandidateView <com.android.inputmethod.latin.CandidateView
android:id="@+id/candidates" android:id="@+id/candidates"

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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"); ** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License. ** you may not use this file except in compliance with the License.
@ -32,7 +32,5 @@
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="0dip" android:padding="0dip" />
android:background="@android:color/black"
latin:keyBackground="@drawable/btn_keyboard_key3" />
</LinearLayout> </LinearLayout>

View File

@ -25,5 +25,5 @@
android:textColor="@color/latinkeyboard_key_color_white" android:textColor="@color/latinkeyboard_key_color_white"
android:minWidth="32dip" android:minWidth="32dip"
android:gravity="center" android:gravity="center"
android:background="@drawable/keyboard_key_feedback" style="?attr/keyPreviewStyle"
/> />

View File

@ -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"
/>

View File

@ -22,9 +22,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:orientation="horizontal"
android:background="@drawable/keyboard_popup_panel_background" style="?attr/popupMiniKeyboardPanelStyle"
android:paddingLeft="@dimen/mini_keyboard_horizontal_padding"
android:paddingRight="@dimen/mini_keyboard_horizontal_padding"
> >
<com.android.inputmethod.keyboard.PopupMiniKeyboardView <com.android.inputmethod.keyboard.PopupMiniKeyboardView
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
@ -32,9 +30,5 @@
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="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> </LinearLayout>

View File

@ -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>

View File

@ -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>

View File

@ -15,11 +15,20 @@
--> -->
<resources> <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"> <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 <!-- Image for the key. This image needs to be a StateListDrawable, with the following
possible states: normal, pressed, checkable, checkable+pressed, checkable+checked, possible states: normal, pressed, checkable, checkable+pressed, checkable+checked,
checkable+checked+pressed. --> checkable+checked+pressed. -->

View File

@ -15,9 +15,9 @@
--> -->
<resources> <resources>
<!-- Theme "Basic" -->
<style name="KeyboardView"> <style name="KeyboardView">
<item name="android:background">@drawable/keyboard_background</item> <item name="android:background">@drawable/keyboard_background</item>
<item name="keyBackground">@drawable/btn_keyboard_key</item> <item name="keyBackground">@drawable/btn_keyboard_key</item>
<item name="keyLetterRatio">@fraction/key_letter_ratio</item> <item name="keyLetterRatio">@fraction/key_letter_ratio</item>
<item name="keyLetterStyle">normal</item> <item name="keyLetterStyle">normal</item>
@ -35,6 +35,91 @@
<item name="backgroundDimAmount">0.5</item> <item name="backgroundDimAmount">0.5</item>
<item name="colorScheme">white</item> <item name="colorScheme">white</item>
</style> </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"> <style name="PopupMiniKeyboardAnimation">
<item name="android:windowEnterAnimation">@anim/mini_keyboard_fadein</item> <item name="android:windowEnterAnimation">@anim/mini_keyboard_fadein</item>
<item name="android:windowExitAnimation">@anim/mini_keyboard_fadeout</item> <item name="android:windowExitAnimation">@anim/mini_keyboard_fadeout</item>

View File

@ -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>

View File

@ -20,6 +20,7 @@ import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Resources; import android.content.res.Resources;
import android.util.Log; import android.util.Log;
import android.view.ContextThemeWrapper;
import android.view.InflateException; import android.view.InflateException;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -45,12 +46,12 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
private static String sConfigDefaultKeyboardThemeId; private static String sConfigDefaultKeyboardThemeId;
public static final String PREF_KEYBOARD_LAYOUT = "pref_keyboard_layout_20100902"; public static final String PREF_KEYBOARD_LAYOUT = "pref_keyboard_layout_20100902";
private static final int[] KEYBOARD_THEMES = { private static final int[] KEYBOARD_THEMES = {
R.layout.input_basic, R.style.KeyboardTheme,
R.layout.input_basic_highcontrast, R.style.KeyboardTheme_HighContrast,
R.layout.input_stone_normal, R.style.KeyboardTheme_Stone,
R.layout.input_stone_bold, R.style.KeyboardTheme_Stone_Bold,
R.layout.input_gingerbread, R.style.KeyboardTheme_Gingerbread,
R.layout.input_honeycomb, R.style.KeyboardTheme_Honeycomb,
}; };
private SubtypeSwitcher mSubtypeSwitcher; private SubtypeSwitcher mSubtypeSwitcher;
@ -730,8 +731,10 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
boolean tryGC = true; boolean tryGC = true;
for (int i = 0; i < Utils.GCUtils.GC_TRY_LOOP_MAX && tryGC; ++i) { for (int i = 0; i < Utils.GCUtils.GC_TRY_LOOP_MAX && tryGC; ++i) {
try { try {
mCurrentInputView = LayoutInflater.from(mInputMethodService).inflate( final Context themeContext = new ContextThemeWrapper(mInputMethodService,
KEYBOARD_THEMES[themeIndex], null); KEYBOARD_THEMES[themeIndex]);
mCurrentInputView = LayoutInflater.from(themeContext).inflate(
R.layout.input_view, null);
tryGC = false; tryGC = false;
} catch (OutOfMemoryError e) { } catch (OutOfMemoryError e) {
Log.w(TAG, "load keyboard failed: " + e); Log.w(TAG, "load keyboard failed: " + e);

View File

@ -16,10 +16,6 @@
package com.android.inputmethod.keyboard; 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.content.Context;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.text.TextUtils; import android.text.TextUtils;
@ -27,6 +23,10 @@ import android.util.AttributeSet;
import android.util.Log; import android.util.Log;
import android.view.MotionEvent; 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 // TODO: We should remove this class
public class LatinKeyboardView extends KeyboardView { public class LatinKeyboardView extends KeyboardView {
private static final String TAG = LatinKeyboardView.class.getSimpleName(); private static final String TAG = LatinKeyboardView.class.getSimpleName();
@ -47,7 +47,7 @@ public class LatinKeyboardView extends KeyboardView {
private int mLastY; private int mLastY;
public LatinKeyboardView(Context context, AttributeSet attrs) { public LatinKeyboardView(Context context, AttributeSet attrs) {
this(context, attrs, 0); super(context, attrs);
} }
public LatinKeyboardView(Context context, AttributeSet attrs, int defStyle) { public LatinKeyboardView(Context context, AttributeSet attrs, int defStyle) {

View File

@ -41,7 +41,7 @@ public class PopupMiniKeyboardView extends KeyboardView implements PopupPanel {
private long mDownTime; private long mDownTime;
public PopupMiniKeyboardView(Context context, AttributeSet attrs) { 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) { public PopupMiniKeyboardView(Context context, AttributeSet attrs, int defStyle) {