Log and UI fix
- add Log entry for the setting of auto completion - fix the parameter names - reduce the time to commit - copy popup window's resources from framework - change extention window to use the current layout Change-Id: I5f52c41dc8027c28a874ba8f198471eb3c9bdd1e
BIN
java/res/drawable-hdpi/btn_close_normal.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
java/res/drawable-hdpi/btn_close_pressed.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
java/res/drawable-hdpi/btn_close_selected.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
java/res/drawable-hdpi/keyboard_popup_panel_background.9.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.6 KiB |
BIN
java/res/drawable-mdpi/btn_close_normal.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
java/res/drawable-mdpi/btn_close_pressed.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
java/res/drawable-mdpi/btn_close_selected.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
java/res/drawable-mdpi/keyboard_popup_panel_background.9.png
Normal file
After Width: | Height: | Size: 996 B |
After Width: | Height: | Size: 3.6 KiB |
27
java/res/drawable/btn_close.xml
Normal file
@ -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>
|
Before Width: | Height: | Size: 125 KiB |
Before Width: | Height: | Size: 280 KiB |
Before Width: | Height: | Size: 191 KiB |
BIN
java/res/drawable/keyboard_background_4.png
Normal file
After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 3.6 KiB |
BIN
java/res/drawable/keyboard_background_5.png
Normal file
After Width: | Height: | Size: 12 KiB |
@ -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"
|
||||
/>
|
||||
|
50
java/res/layout/input7_popup.xml
Executable file
@ -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>
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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()));
|
||||
|