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
This commit is contained in:
satok 2010-05-26 22:56:13 +09:00
parent b72f348467
commit f22d479e48
22 changed files with 114 additions and 17 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 996 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 280 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 191 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

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

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

View File

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

View File

@ -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);
}
}
}

View File

@ -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()));