Merge commit 'goog/master'
commit
f6ecc28767
|
@ -21,4 +21,8 @@
|
|||
<color name="candidate_normal">#FF000000</color>
|
||||
<color name="candidate_recommended">#FFE35900</color>
|
||||
<color name="candidate_other">#ff808080</color>
|
||||
<color name="latinkeyboard_transparent">#00000000</color>
|
||||
<color name="latinkeyboard_bar_language_shadow">#80000000</color>
|
||||
<color name="latinkeyboard_bar_language_text">#FF808080</color>
|
||||
<color name="latinkeyboard_text_color">#FF000000</color>
|
||||
</resources>
|
|
@ -40,7 +40,6 @@ import android.os.Message;
|
|||
import android.os.SystemClock;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.speech.SpeechRecognizer;
|
||||
import android.text.AutoText;
|
||||
import android.text.ClipboardManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
@ -78,6 +77,7 @@ public class LatinIME extends InputMethodService
|
|||
VoiceInput.UiListener,
|
||||
SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
private static final String TAG = "LatinIME";
|
||||
private static final boolean PERF_DEBUG = false;
|
||||
static final boolean DEBUG = false;
|
||||
static final boolean TRACE = false;
|
||||
static final boolean VOICE_INSTALLED = true;
|
||||
|
@ -189,7 +189,6 @@ public class LatinIME extends InputMethodService
|
|||
private boolean mAutoCorrectOn;
|
||||
private boolean mCapsLock;
|
||||
private boolean mPasswordText;
|
||||
private boolean mEmailText;
|
||||
private boolean mVibrateOn;
|
||||
private boolean mSoundOn;
|
||||
private boolean mAutoCap;
|
||||
|
@ -458,7 +457,6 @@ public class LatinIME extends InputMethodService
|
|||
mCompletionOn = false;
|
||||
mCompletions = null;
|
||||
mCapsLock = false;
|
||||
mEmailText = false;
|
||||
mEnteredText = null;
|
||||
|
||||
switch (attribute.inputType & EditorInfo.TYPE_MASK_CLASS) {
|
||||
|
@ -481,9 +479,6 @@ public class LatinIME extends InputMethodService
|
|||
variation == EditorInfo.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD ) {
|
||||
mPredictionOn = false;
|
||||
}
|
||||
if (variation == EditorInfo.TYPE_TEXT_VARIATION_EMAIL_ADDRESS) {
|
||||
mEmailText = true;
|
||||
}
|
||||
if (variation == EditorInfo.TYPE_TEXT_VARIATION_EMAIL_ADDRESS
|
||||
|| variation == EditorInfo.TYPE_TEXT_VARIATION_PERSON_NAME) {
|
||||
mAutoSpace = false;
|
||||
|
@ -683,7 +678,7 @@ public class LatinIME extends InputMethodService
|
|||
|
||||
@Override
|
||||
public void onDisplayCompletions(CompletionInfo[] completions) {
|
||||
if (false) {
|
||||
if (DEBUG) {
|
||||
Log.i("foo", "Received completions:");
|
||||
for (int i=0; i<(completions != null ? completions.length : 0); i++) {
|
||||
Log.i("foo", " #" + i + ": " + completions[i]);
|
||||
|
@ -1126,7 +1121,7 @@ public class LatinIME extends InputMethodService
|
|||
sendKeyChar((char)primaryCode);
|
||||
}
|
||||
updateShiftKeyState(getCurrentInputEditorInfo());
|
||||
measureCps();
|
||||
if (LatinIME.PERF_DEBUG) measureCps();
|
||||
TextEntryState.typedCharacter((char) primaryCode, isWordSeparator(primaryCode));
|
||||
}
|
||||
|
||||
|
@ -1868,7 +1863,7 @@ public class LatinIME extends InputMethodService
|
|||
launchSettings(LatinIMESettings.class);
|
||||
}
|
||||
|
||||
protected void launchSettings(Class settingsClass) {
|
||||
protected void launchSettings(Class<LatinIMESettings> settingsClass) {
|
||||
handleClose();
|
||||
Intent intent = new Intent();
|
||||
intent.setClass(LatinIME.this, settingsClass);
|
||||
|
@ -2005,7 +2000,6 @@ public class LatinIME extends InputMethodService
|
|||
|
||||
// Characters per second measurement
|
||||
|
||||
private static final boolean PERF_DEBUG = false;
|
||||
private long mLastCpsTime;
|
||||
private static final int CPS_BUFFER_SIZE = 16;
|
||||
private long[] mCpsIntervals = new long[CPS_BUFFER_SIZE];
|
||||
|
@ -2013,7 +2007,6 @@ public class LatinIME extends InputMethodService
|
|||
private boolean mInputTypeNoAutoCorrect;
|
||||
|
||||
private void measureCps() {
|
||||
if (!LatinIME.PERF_DEBUG) return;
|
||||
long now = System.currentTimeMillis();
|
||||
if (mLastCpsTime == 0) mLastCpsTime = now - 100; // Initial
|
||||
mCpsIntervals[mCpsIndex] = now - mLastCpsTime;
|
||||
|
|
|
@ -47,7 +47,6 @@ public class LatinKeyboard extends Keyboard {
|
|||
private Drawable mShiftLockIcon;
|
||||
private Drawable mShiftLockPreviewIcon;
|
||||
private Drawable mOldShiftIcon;
|
||||
private Drawable mOldShiftPreviewIcon;
|
||||
private Drawable mSpaceIcon;
|
||||
private Drawable mSpacePreviewIcon;
|
||||
private Drawable mMicIcon;
|
||||
|
@ -68,7 +67,6 @@ public class LatinKeyboard extends Keyboard {
|
|||
private LanguageSwitcher mLanguageSwitcher;
|
||||
private Resources mRes;
|
||||
private Context mContext;
|
||||
private int mMode;
|
||||
// Whether this keyboard has voice icon on it
|
||||
private boolean mHasVoiceButton;
|
||||
// Whether voice icon is enabled at all
|
||||
|
@ -77,9 +75,7 @@ public class LatinKeyboard extends Keyboard {
|
|||
private CharSequence m123Label;
|
||||
private boolean mCurrentlyInSpace;
|
||||
private SlidingLocaleDrawable mSlidingLocaleIcon;
|
||||
private Rect mBounds = new Rect();
|
||||
private int[] mPrefLetterFrequencies;
|
||||
private boolean mPreemptiveCorrection;
|
||||
private int mPrefLetter;
|
||||
private int mPrefLetterX;
|
||||
private int mPrefLetterY;
|
||||
|
@ -107,7 +103,6 @@ public class LatinKeyboard extends Keyboard {
|
|||
super(context, xmlLayoutResId, mode);
|
||||
final Resources res = context.getResources();
|
||||
mContext = context;
|
||||
mMode = mode;
|
||||
mRes = res;
|
||||
mShiftLockIcon = res.getDrawable(R.drawable.sym_keyboard_shift_locked);
|
||||
mShiftLockPreviewIcon = res.getDrawable(R.drawable.sym_keyboard_feedback_shift_locked);
|
||||
|
@ -224,7 +219,6 @@ public class LatinKeyboard extends Keyboard {
|
|||
((LatinKey)mShiftKey).enableShiftLock();
|
||||
}
|
||||
mOldShiftIcon = mShiftKey.icon;
|
||||
mOldShiftPreviewIcon = mShiftKey.iconPreview;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -338,21 +332,19 @@ public class LatinKeyboard extends Keyboard {
|
|||
}
|
||||
|
||||
private void drawSpaceBar(Canvas canvas, int width, int height, int opacity) {
|
||||
canvas.drawColor(0x00000000, PorterDuff.Mode.CLEAR);
|
||||
canvas.drawColor(mRes.getColor(R.color.latinkeyboard_transparent), PorterDuff.Mode.CLEAR);
|
||||
Paint paint = new Paint();
|
||||
paint.setAntiAlias(true);
|
||||
paint.setAlpha(opacity);
|
||||
// Get the text size from the theme
|
||||
paint.setTextSize(getTextSizeFromTheme(android.R.style.TextAppearance_Small, 14));
|
||||
paint.setTextAlign(Align.CENTER);
|
||||
//// Draw a drop shadow for the text
|
||||
//paint.setShadowLayer(2f, 0, 0, 0xFF000000);
|
||||
final String language = getInputLanguage(mSpaceKey.width, paint);
|
||||
final int ascent = (int) -paint.ascent();
|
||||
paint.setColor(0x80000000);
|
||||
paint.setColor(mRes.getColor(R.color.latinkeyboard_bar_language_shadow));
|
||||
canvas.drawText(language,
|
||||
width / 2, ascent - 1, paint);
|
||||
paint.setColor(0xFF808080);
|
||||
paint.setColor(mRes.getColor(R.color.latinkeyboard_bar_language_text));
|
||||
canvas.drawText(language,
|
||||
width / 2, ascent, paint);
|
||||
// Put arrows on either side of the text
|
||||
|
@ -503,10 +495,11 @@ public class LatinKeyboard extends Keyboard {
|
|||
// Handle preferred next letter
|
||||
final int[] pref = mPrefLetterFrequencies;
|
||||
if (mPrefLetter > 0) {
|
||||
if (DEBUG_PREFERRED_LETTER && mPrefLetter == code
|
||||
&& !key.isInsideSuper(x, y)) {
|
||||
if (DEBUG_PREFERRED_LETTER) {
|
||||
if (mPrefLetter == code && !key.isInsideSuper(x, y)) {
|
||||
Log.d(TAG, "CORRECTED !!!!!!");
|
||||
}
|
||||
}
|
||||
return mPrefLetter == code;
|
||||
} else {
|
||||
final boolean inside = key.isInsideSuper(x, y);
|
||||
|
@ -718,7 +711,7 @@ public class LatinKeyboard extends Keyboard {
|
|||
public void draw(Canvas canvas) {
|
||||
canvas.save();
|
||||
if (mHitThreshold) {
|
||||
mTextPaint.setColor(0xFF000000);
|
||||
mTextPaint.setColor(mRes.getColor(R.color.latinkeyboard_text_color));
|
||||
canvas.clipRect(0, 0, mWidth, mHeight);
|
||||
if (mCurrentLanguage == null) {
|
||||
mCurrentLanguage = getInputLanguage(mWidth, mTextPaint);
|
||||
|
|
|
@ -23,7 +23,6 @@ import android.graphics.Canvas;
|
|||
import android.graphics.Paint;
|
||||
import android.inputmethodservice.Keyboard;
|
||||
import android.inputmethodservice.KeyboardView;
|
||||
import android.inputmethodservice.KeyboardView.OnKeyboardActionListener;
|
||||
import android.inputmethodservice.Keyboard.Key;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
|
@ -453,8 +452,8 @@ public class LatinKeyboardView extends KeyboardView {
|
|||
}
|
||||
}
|
||||
|
||||
void startPlaying(String s) {
|
||||
if (!DEBUG_AUTO_PLAY) return;
|
||||
public void startPlaying(String s) {
|
||||
if (DEBUG_AUTO_PLAY) {
|
||||
if (s == null) return;
|
||||
mStringToPlay = s.toLowerCase();
|
||||
mPlaying = true;
|
||||
|
@ -462,11 +461,13 @@ public class LatinKeyboardView extends KeyboardView {
|
|||
mStringIndex = 0;
|
||||
mHandler2.sendEmptyMessageDelayed(MSG_TOUCH_DOWN, 10);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Canvas c) {
|
||||
super.draw(c);
|
||||
if (DEBUG_AUTO_PLAY && mPlaying) {
|
||||
if (DEBUG_AUTO_PLAY) {
|
||||
if (mPlaying) {
|
||||
mHandler2.removeMessages(MSG_TOUCH_DOWN);
|
||||
mHandler2.removeMessages(MSG_TOUCH_UP);
|
||||
if (mDownDelivered) {
|
||||
|
@ -475,6 +476,7 @@ public class LatinKeyboardView extends KeyboardView {
|
|||
mHandler2.sendEmptyMessageDelayed(MSG_TOUCH_DOWN, 20);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (DEBUG_LINE) {
|
||||
if (mPaint == null) {
|
||||
mPaint = new Paint();
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Google Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.android.inputmethod.voice;
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
import com.android.inputmethod.latin.LatinIME;
|
||||
|
||||
public class LatinIMEWithVoice extends LatinIME {
|
||||
@Override
|
||||
protected void launchSettings() {
|
||||
launchSettings(LatinIMEWithVoiceSettings.class);
|
||||
}
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Google Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.android.inputmethod.voice;
|
||||
|
||||
import com.android.inputmethod.latin.LatinIMESettings;
|
||||
|
||||
public class LatinIMEWithVoiceSettings extends LatinIMESettings {}
|
|
@ -1,29 +0,0 @@
|
|||
/*
|
||||
*
|
||||
* Copyright (C) 2009 Google Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.google.android.voicesearch;
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
import com.android.inputmethod.latin.LatinIME;
|
||||
|
||||
public class LatinIMEWithVoice extends LatinIME {
|
||||
@Override
|
||||
protected void launchSettings() {
|
||||
launchSettings(LatinIMEWithVoiceSettings.class);
|
||||
}
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
package com.google.android.voicesearch;
|
||||
|
||||
import com.android.inputmethod.latin.LatinIMESettings;
|
||||
|
||||
public class LatinIMEWithVoiceSettings extends LatinIMESettings {}
|
Loading…
Reference in New Issue