diff options
Diffstat (limited to 'java')
22 files changed, 114 insertions, 17 deletions
diff --git a/java/res/drawable-hdpi/btn_close_normal.png b/java/res/drawable-hdpi/btn_close_normal.png Binary files differnew file mode 100644 index 000000000..38b49f1a3 --- /dev/null +++ b/java/res/drawable-hdpi/btn_close_normal.png diff --git a/java/res/drawable-hdpi/btn_close_pressed.png b/java/res/drawable-hdpi/btn_close_pressed.png Binary files differnew file mode 100644 index 000000000..aa9ea49f0 --- /dev/null +++ b/java/res/drawable-hdpi/btn_close_pressed.png diff --git a/java/res/drawable-hdpi/btn_close_selected.png b/java/res/drawable-hdpi/btn_close_selected.png Binary files differnew file mode 100644 index 000000000..870c670f7 --- /dev/null +++ b/java/res/drawable-hdpi/btn_close_selected.png diff --git a/java/res/drawable-hdpi/keyboard_popup_panel_background.9.png b/java/res/drawable-hdpi/keyboard_popup_panel_background.9.png Binary files differnew file mode 100644 index 000000000..8e2461b3f --- /dev/null +++ b/java/res/drawable-hdpi/keyboard_popup_panel_background.9.png diff --git a/java/res/drawable-hdpi/keyboard_popup_panel_trans_background.9.png b/java/res/drawable-hdpi/keyboard_popup_panel_trans_background.9.png Binary files differnew file mode 100644 index 000000000..fd7366e20 --- /dev/null +++ b/java/res/drawable-hdpi/keyboard_popup_panel_trans_background.9.png diff --git a/java/res/drawable-mdpi/btn_close_normal.png b/java/res/drawable-mdpi/btn_close_normal.png Binary files differnew file mode 100644 index 000000000..4c6e79dc8 --- /dev/null +++ b/java/res/drawable-mdpi/btn_close_normal.png diff --git a/java/res/drawable-mdpi/btn_close_pressed.png b/java/res/drawable-mdpi/btn_close_pressed.png Binary files differnew file mode 100644 index 000000000..fc983afdc --- /dev/null +++ b/java/res/drawable-mdpi/btn_close_pressed.png diff --git a/java/res/drawable-mdpi/btn_close_selected.png b/java/res/drawable-mdpi/btn_close_selected.png Binary files differnew file mode 100644 index 000000000..f2bf91a2d --- /dev/null +++ b/java/res/drawable-mdpi/btn_close_selected.png diff --git a/java/res/drawable-mdpi/keyboard_popup_panel_background.9.png b/java/res/drawable-mdpi/keyboard_popup_panel_background.9.png Binary files differnew file mode 100644 index 000000000..36d75df6f --- /dev/null +++ b/java/res/drawable-mdpi/keyboard_popup_panel_background.9.png diff --git a/java/res/drawable-mdpi/keyboard_popup_panel_trans_background.9.png b/java/res/drawable-mdpi/keyboard_popup_panel_trans_background.9.png Binary files differnew file mode 100644 index 000000000..4ba2a4908 --- /dev/null +++ b/java/res/drawable-mdpi/keyboard_popup_panel_trans_background.9.png diff --git a/java/res/drawable/btn_close.xml b/java/res/drawable/btn_close.xml new file mode 100644 index 000000000..ee5813898 --- /dev/null +++ b/java/res/drawable/btn_close.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 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. +--> + +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + + <item android:state_pressed="false" android:state_focused="false" + android:drawable="@drawable/btn_close_normal" /> + + <item android:state_pressed="true" + android:drawable="@drawable/btn_close_pressed" /> + + <item android:state_focused="true" + android:drawable="@drawable/btn_close_selected" /> +</selector> diff --git a/java/res/drawable/keyboard_background_2.jpg b/java/res/drawable/keyboard_background_2.jpg Binary files differdeleted file mode 100644 index 400aa27be..000000000 --- a/java/res/drawable/keyboard_background_2.jpg +++ /dev/null diff --git a/java/res/drawable/keyboard_background_3.jpg b/java/res/drawable/keyboard_background_3.jpg Binary files differdeleted file mode 100644 index 4e64844be..000000000 --- a/java/res/drawable/keyboard_background_3.jpg +++ /dev/null diff --git a/java/res/drawable/keyboard_background_4.jpg b/java/res/drawable/keyboard_background_4.jpg Binary files differdeleted file mode 100755 index 5998f489e..000000000 --- a/java/res/drawable/keyboard_background_4.jpg +++ /dev/null diff --git a/java/res/drawable/keyboard_background_4.png b/java/res/drawable/keyboard_background_4.png Binary files differnew file mode 100644 index 000000000..74fc2e762 --- /dev/null +++ b/java/res/drawable/keyboard_background_4.png diff --git a/java/res/drawable/keyboard_background_5.jpg b/java/res/drawable/keyboard_background_5.jpg Binary files differdeleted file mode 100644 index 2fe7c5fb8..000000000 --- a/java/res/drawable/keyboard_background_5.jpg +++ /dev/null diff --git a/java/res/drawable/keyboard_background_5.png b/java/res/drawable/keyboard_background_5.png Binary files differnew file mode 100644 index 000000000..2e0fb289f --- /dev/null +++ b/java/res/drawable/keyboard_background_5.png diff --git a/java/res/layout/input7.xml b/java/res/layout/input7.xml index 111d87ba7..91697b656 100755 --- a/java/res/layout/input7.xml +++ b/java/res/layout/input7.xml @@ -29,5 +29,5 @@ android:keyTextColor="@color/latinkeyboard_key_color_black" android:shadowColor="@color/latinkeyboard_key_color_white" android:keyTextSize="22dip" - /> -<!-- android:keyBackground="@drawable/btn_keyboard_normal_metal"--> + android:popupLayout="@layout/input7_popup" + /> diff --git a/java/res/layout/input7_popup.xml b/java/res/layout/input7_popup.xml new file mode 100755 index 000000000..56e2fbdc6 --- /dev/null +++ b/java/res/layout/input7_popup.xml @@ -0,0 +1,50 @@ +<?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" + > + <android.inputmethodservice.KeyboardView + xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@android:id/keyboardView" + android:layout_alignParentBottom="true" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:keyBackground="@drawable/btn_keyboard_key_ginger" + android:background="@drawable/background_gradient" + android:keyTextColor="@color/latinkeyboard_key_color_black" + android:shadowColor="@color/latinkeyboard_key_color_white" + android:keyTextSize="22dip" + android:popupLayout="@layout/input7_popup" + /> + <ImageButton android:id="@android:id/closeButton" + android:background="@android:color/transparent" + android:src="@drawable/btn_close" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:layout_marginLeft="8dp" + android:clickable="true" + /> +</LinearLayout>
\ No newline at end of file diff --git a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java index d90261935..c8e226d75 100644 --- a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java +++ b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java @@ -378,6 +378,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha } mInputView = (LatinKeyboardView) mInputMethodService.getLayoutInflater().inflate( LAYOUTS[newLayout], null); + mInputView.setExtentionLayoutResId(LAYOUTS[newLayout]); mInputView.setOnKeyboardActionListener(mInputMethodService); mLayoutId = newLayout; } diff --git a/java/src/com/android/inputmethod/latin/LatinImeLogger.java b/java/src/com/android/inputmethod/latin/LatinImeLogger.java index dcd1962c0..747340eea 100644 --- a/java/src/com/android/inputmethod/latin/LatinImeLogger.java +++ b/java/src/com/android/inputmethod/latin/LatinImeLogger.java @@ -35,18 +35,21 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang private static final long MINIMUMSENDINTERVAL = 300 * DateUtils.SECOND_IN_MILLIS; // 300 sec private static final long MINIMUMCOUNTINTERVAL = 20 * DateUtils.SECOND_IN_MILLIS; // 20 sec + private static final long MINIMUMSENDSIZE = 40; private static final char SEPARATER = ';'; private static final int ID_CLICKSUGGESTION = 0; - private static final int ID_AUTOSUGGESTION = 1; - private static final int ID_AUTOSUGGESTIONCANCELED = 2; + private static final int ID_AUTOSUGGESTIONCANCELLED = 1; + private static final int ID_AUTOSUGGESTION = 2; private static final int ID_INPUT_COUNT = 3; private static final int ID_DELETE_COUNT = 4; private static final int ID_WORD_COUNT = 5; private static final int ID_ACTUAL_CHAR_COUNT = 6; private static final int ID_THEME_ID = 7; + private static final int ID_SETTING_AUTO_COMPLETE = 8; private static final String PREF_ENABLE_LOG = "enable_logging"; private static final String PREF_DEBUG_MODE = "debug_mode"; + private static final String PREF_AUTO_COMPLETE = "auto_complete"; public static boolean sLogEnabled = true; private static LatinImeLogger sLatinImeLogger = new LatinImeLogger(); @@ -132,12 +135,7 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang if (sDBG) { Log.d(TAG, "Check String safety: " + s); } - for (int i = 0; i < s.length(); ++i) { - if (!Character.isDigit(s.charAt(i))) { - return true; - } - } - return false; + return !TextUtils.isDigitsOnly(s); } private void addCountEntry(long time) { @@ -167,6 +165,16 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang new String[] {mThemeId})); } + private void addSettingsEntry(long time) { + if (sDBG) { + Log.d(TAG, "Log settings. (1)"); + } + final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext); + mLogBuffer.add(new LogEntry (time, ID_SETTING_AUTO_COMPLETE, + new String[] {String.valueOf(prefs.getBoolean(PREF_AUTO_COMPLETE, + mContext.getResources().getBoolean(R.bool.enable_autocorrect)))})); + } + private void flushPrivacyLogSafely() { if (sDBG) { Log.d(TAG, "Log theme Id. (" + mPrivacyLogBuffer.size() + ")"); @@ -191,7 +199,6 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang if (((mLastTimeActive - mLastTimeCountEntry) > MINIMUMCOUNTINTERVAL) || (mDeleteCount == 0 && mInputCount == 0)) { addCountEntry(mLastTimeActive); - addThemeIdEntry(mLastTimeActive); } mDeleteCount += (Integer)data; break; @@ -199,7 +206,6 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang if (((mLastTimeActive - mLastTimeCountEntry) > MINIMUMCOUNTINTERVAL) || (mDeleteCount == 0 && mInputCount == 0)) { addCountEntry(mLastTimeActive); - addThemeIdEntry(mLastTimeActive); } mInputCount += (Integer)data; break; @@ -223,7 +229,7 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang } } break; - case ID_AUTOSUGGESTIONCANCELED: + case ID_AUTOSUGGESTIONCANCELLED: --mWordCount; dataStrings = (String[]) data; if (dataStrings.length < 2) { @@ -258,6 +264,7 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang long now = System.currentTimeMillis(); addCountEntry(now); addThemeIdEntry(now); + addSettingsEntry(now); String s = LogSerializer.createStringFromEntries(mLogBuffer); if (!TextUtils.isEmpty(s)) { if (sDBG) { @@ -307,6 +314,7 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang } else if (KeyboardSwitcher.PREF_KEYBOARD_LAYOUT.equals(key)) { mThemeId = sharedPreferences.getString(KeyboardSwitcher.PREF_KEYBOARD_LAYOUT, KeyboardSwitcher.DEFAULT_LAYOUT_ID); + addThemeIdEntry(mLastTimeActive); } else if (PREF_DEBUG_MODE.equals(key)) { sDBG = sharedPreferences.getBoolean(PREF_DEBUG_MODE, sDBG); } @@ -318,7 +326,11 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang public static void commit() { if (sLogEnabled) { - sLatinImeLogger.commitInternal(); + if (System.currentTimeMillis() - sLatinImeLogger.mLastTimeActive > MINIMUMCOUNTINTERVAL + || (sLatinImeLogger.mLogBuffer.size() + + sLatinImeLogger.mPrivacyLogBuffer.size() > MINIMUMSENDSIZE)) { + sLatinImeLogger.commitInternal(); + } } } @@ -337,7 +349,7 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang sLastAutoSuggestBefore = before; sLastAutoSuggestAfter = after; } - sLatinImeLogger.sendLogToDropBox(ID_AUTOSUGGESTIONCANCELED, strings); + sLatinImeLogger.sendLogToDropBox(ID_AUTOSUGGESTION, strings); } } @@ -345,7 +357,7 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang if (sLogEnabled) { if (sLastAutoSuggestBefore != null && sLastAutoSuggestAfter != null) { String[] strings = new String[] {sLastAutoSuggestBefore, sLastAutoSuggestAfter}; - sLatinImeLogger.sendLogToDropBox(ID_AUTOSUGGESTION, strings); + sLatinImeLogger.sendLogToDropBox(ID_AUTOSUGGESTIONCANCELLED, strings); } } } diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardView.java index 323f4bf6b..6e3226ae5 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboardView.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboardView.java @@ -65,6 +65,8 @@ public class LatinKeyboardView extends KeyboardView { /** The y coordinate of the last row */ private int mLastRowY; + private int mExtensionLayoutResId = 0; + public LatinKeyboardView(Context context, AttributeSet attrs) { super(context, attrs); } @@ -77,6 +79,10 @@ public class LatinKeyboardView extends KeyboardView { mPhoneKeyboard = phoneKeyboard; } + public void setExtentionLayoutResId (int id) { + mExtensionLayoutResId = id; + } + @Override public void setKeyboard(Keyboard k) { super.setKeyboard(k); @@ -294,7 +300,8 @@ public class LatinKeyboardView extends KeyboardView { mExtensionPopup.setBackgroundDrawable(null); LayoutInflater li = (LayoutInflater) getContext().getSystemService( Context.LAYOUT_INFLATER_SERVICE); - mExtension = (LatinKeyboardView) li.inflate(R.layout.input_trans, null); + mExtension = (LatinKeyboardView) li.inflate(mExtensionLayoutResId == 0 ? + R.layout.input_trans : mExtensionLayoutResId, null); mExtension.setExtensionType(true); mExtension.setOnKeyboardActionListener( new ExtensionKeyboardListener(getOnKeyboardActionListener())); |