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: I5f52c41dc8027c28a874ba8f198471eb3c9bdd1emain
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 996 B |
After Width: | Height: | Size: 3.6 KiB |
|
@ -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 |
After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 12 KiB |
|
@ -29,5 +29,5 @@
|
||||||
android:keyTextColor="@color/latinkeyboard_key_color_black"
|
android:keyTextColor="@color/latinkeyboard_key_color_black"
|
||||||
android:shadowColor="@color/latinkeyboard_key_color_white"
|
android:shadowColor="@color/latinkeyboard_key_color_white"
|
||||||
android:keyTextSize="22dip"
|
android:keyTextSize="22dip"
|
||||||
|
android:popupLayout="@layout/input7_popup"
|
||||||
/>
|
/>
|
||||||
<!-- android:keyBackground="@drawable/btn_keyboard_normal_metal"-->
|
|
||||||
|
|
|
@ -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(
|
mInputView = (LatinKeyboardView) mInputMethodService.getLayoutInflater().inflate(
|
||||||
LAYOUTS[newLayout], null);
|
LAYOUTS[newLayout], null);
|
||||||
|
mInputView.setExtentionLayoutResId(LAYOUTS[newLayout]);
|
||||||
mInputView.setOnKeyboardActionListener(mInputMethodService);
|
mInputView.setOnKeyboardActionListener(mInputMethodService);
|
||||||
mLayoutId = newLayout;
|
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 MINIMUMSENDINTERVAL = 300 * DateUtils.SECOND_IN_MILLIS; // 300 sec
|
||||||
private static final long MINIMUMCOUNTINTERVAL = 20 * DateUtils.SECOND_IN_MILLIS; // 20 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 char SEPARATER = ';';
|
||||||
private static final int ID_CLICKSUGGESTION = 0;
|
private static final int ID_CLICKSUGGESTION = 0;
|
||||||
private static final int ID_AUTOSUGGESTION = 1;
|
private static final int ID_AUTOSUGGESTIONCANCELLED = 1;
|
||||||
private static final int ID_AUTOSUGGESTIONCANCELED = 2;
|
private static final int ID_AUTOSUGGESTION = 2;
|
||||||
private static final int ID_INPUT_COUNT = 3;
|
private static final int ID_INPUT_COUNT = 3;
|
||||||
private static final int ID_DELETE_COUNT = 4;
|
private static final int ID_DELETE_COUNT = 4;
|
||||||
private static final int ID_WORD_COUNT = 5;
|
private static final int ID_WORD_COUNT = 5;
|
||||||
private static final int ID_ACTUAL_CHAR_COUNT = 6;
|
private static final int ID_ACTUAL_CHAR_COUNT = 6;
|
||||||
private static final int ID_THEME_ID = 7;
|
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_ENABLE_LOG = "enable_logging";
|
||||||
private static final String PREF_DEBUG_MODE = "debug_mode";
|
private static final String PREF_DEBUG_MODE = "debug_mode";
|
||||||
|
private static final String PREF_AUTO_COMPLETE = "auto_complete";
|
||||||
|
|
||||||
public static boolean sLogEnabled = true;
|
public static boolean sLogEnabled = true;
|
||||||
private static LatinImeLogger sLatinImeLogger = new LatinImeLogger();
|
private static LatinImeLogger sLatinImeLogger = new LatinImeLogger();
|
||||||
|
@ -132,12 +135,7 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
|
||||||
if (sDBG) {
|
if (sDBG) {
|
||||||
Log.d(TAG, "Check String safety: " + s);
|
Log.d(TAG, "Check String safety: " + s);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < s.length(); ++i) {
|
return !TextUtils.isDigitsOnly(s);
|
||||||
if (!Character.isDigit(s.charAt(i))) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addCountEntry(long time) {
|
private void addCountEntry(long time) {
|
||||||
|
@ -167,6 +165,16 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
|
||||||
new String[] {mThemeId}));
|
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() {
|
private void flushPrivacyLogSafely() {
|
||||||
if (sDBG) {
|
if (sDBG) {
|
||||||
Log.d(TAG, "Log theme Id. (" + mPrivacyLogBuffer.size() + ")");
|
Log.d(TAG, "Log theme Id. (" + mPrivacyLogBuffer.size() + ")");
|
||||||
|
@ -191,7 +199,6 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
|
||||||
if (((mLastTimeActive - mLastTimeCountEntry) > MINIMUMCOUNTINTERVAL)
|
if (((mLastTimeActive - mLastTimeCountEntry) > MINIMUMCOUNTINTERVAL)
|
||||||
|| (mDeleteCount == 0 && mInputCount == 0)) {
|
|| (mDeleteCount == 0 && mInputCount == 0)) {
|
||||||
addCountEntry(mLastTimeActive);
|
addCountEntry(mLastTimeActive);
|
||||||
addThemeIdEntry(mLastTimeActive);
|
|
||||||
}
|
}
|
||||||
mDeleteCount += (Integer)data;
|
mDeleteCount += (Integer)data;
|
||||||
break;
|
break;
|
||||||
|
@ -199,7 +206,6 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
|
||||||
if (((mLastTimeActive - mLastTimeCountEntry) > MINIMUMCOUNTINTERVAL)
|
if (((mLastTimeActive - mLastTimeCountEntry) > MINIMUMCOUNTINTERVAL)
|
||||||
|| (mDeleteCount == 0 && mInputCount == 0)) {
|
|| (mDeleteCount == 0 && mInputCount == 0)) {
|
||||||
addCountEntry(mLastTimeActive);
|
addCountEntry(mLastTimeActive);
|
||||||
addThemeIdEntry(mLastTimeActive);
|
|
||||||
}
|
}
|
||||||
mInputCount += (Integer)data;
|
mInputCount += (Integer)data;
|
||||||
break;
|
break;
|
||||||
|
@ -223,7 +229,7 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ID_AUTOSUGGESTIONCANCELED:
|
case ID_AUTOSUGGESTIONCANCELLED:
|
||||||
--mWordCount;
|
--mWordCount;
|
||||||
dataStrings = (String[]) data;
|
dataStrings = (String[]) data;
|
||||||
if (dataStrings.length < 2) {
|
if (dataStrings.length < 2) {
|
||||||
|
@ -258,6 +264,7 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
addCountEntry(now);
|
addCountEntry(now);
|
||||||
addThemeIdEntry(now);
|
addThemeIdEntry(now);
|
||||||
|
addSettingsEntry(now);
|
||||||
String s = LogSerializer.createStringFromEntries(mLogBuffer);
|
String s = LogSerializer.createStringFromEntries(mLogBuffer);
|
||||||
if (!TextUtils.isEmpty(s)) {
|
if (!TextUtils.isEmpty(s)) {
|
||||||
if (sDBG) {
|
if (sDBG) {
|
||||||
|
@ -307,6 +314,7 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
|
||||||
} else if (KeyboardSwitcher.PREF_KEYBOARD_LAYOUT.equals(key)) {
|
} else if (KeyboardSwitcher.PREF_KEYBOARD_LAYOUT.equals(key)) {
|
||||||
mThemeId = sharedPreferences.getString(KeyboardSwitcher.PREF_KEYBOARD_LAYOUT,
|
mThemeId = sharedPreferences.getString(KeyboardSwitcher.PREF_KEYBOARD_LAYOUT,
|
||||||
KeyboardSwitcher.DEFAULT_LAYOUT_ID);
|
KeyboardSwitcher.DEFAULT_LAYOUT_ID);
|
||||||
|
addThemeIdEntry(mLastTimeActive);
|
||||||
} else if (PREF_DEBUG_MODE.equals(key)) {
|
} else if (PREF_DEBUG_MODE.equals(key)) {
|
||||||
sDBG = sharedPreferences.getBoolean(PREF_DEBUG_MODE, sDBG);
|
sDBG = sharedPreferences.getBoolean(PREF_DEBUG_MODE, sDBG);
|
||||||
}
|
}
|
||||||
|
@ -318,9 +326,13 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
|
||||||
|
|
||||||
public static void commit() {
|
public static void commit() {
|
||||||
if (sLogEnabled) {
|
if (sLogEnabled) {
|
||||||
|
if (System.currentTimeMillis() - sLatinImeLogger.mLastTimeActive > MINIMUMCOUNTINTERVAL
|
||||||
|
|| (sLatinImeLogger.mLogBuffer.size()
|
||||||
|
+ sLatinImeLogger.mPrivacyLogBuffer.size() > MINIMUMSENDSIZE)) {
|
||||||
sLatinImeLogger.commitInternal();
|
sLatinImeLogger.commitInternal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Handle CharSequence instead of String
|
// TODO: Handle CharSequence instead of String
|
||||||
public static void logOnClickSuggestion(String before, String after, int position) {
|
public static void logOnClickSuggestion(String before, String after, int position) {
|
||||||
|
@ -337,7 +349,7 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
|
||||||
sLastAutoSuggestBefore = before;
|
sLastAutoSuggestBefore = before;
|
||||||
sLastAutoSuggestAfter = after;
|
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 (sLogEnabled) {
|
||||||
if (sLastAutoSuggestBefore != null && sLastAutoSuggestAfter != null) {
|
if (sLastAutoSuggestBefore != null && sLastAutoSuggestAfter != null) {
|
||||||
String[] strings = new String[] {sLastAutoSuggestBefore, sLastAutoSuggestAfter};
|
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 */
|
/** The y coordinate of the last row */
|
||||||
private int mLastRowY;
|
private int mLastRowY;
|
||||||
|
|
||||||
|
private int mExtensionLayoutResId = 0;
|
||||||
|
|
||||||
public LatinKeyboardView(Context context, AttributeSet attrs) {
|
public LatinKeyboardView(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
}
|
}
|
||||||
|
@ -77,6 +79,10 @@ public class LatinKeyboardView extends KeyboardView {
|
||||||
mPhoneKeyboard = phoneKeyboard;
|
mPhoneKeyboard = phoneKeyboard;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setExtentionLayoutResId (int id) {
|
||||||
|
mExtensionLayoutResId = id;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setKeyboard(Keyboard k) {
|
public void setKeyboard(Keyboard k) {
|
||||||
super.setKeyboard(k);
|
super.setKeyboard(k);
|
||||||
|
@ -294,7 +300,8 @@ public class LatinKeyboardView extends KeyboardView {
|
||||||
mExtensionPopup.setBackgroundDrawable(null);
|
mExtensionPopup.setBackgroundDrawable(null);
|
||||||
LayoutInflater li = (LayoutInflater) getContext().getSystemService(
|
LayoutInflater li = (LayoutInflater) getContext().getSystemService(
|
||||||
Context.LAYOUT_INFLATER_SERVICE);
|
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.setExtensionType(true);
|
||||||
mExtension.setOnKeyboardActionListener(
|
mExtension.setOnKeyboardActionListener(
|
||||||
new ExtensionKeyboardListener(getOnKeyboardActionListener()));
|
new ExtensionKeyboardListener(getOnKeyboardActionListener()));
|
||||||
|
|