- Remove dead code
- Add colors

Change-Id: I011146b33a37375d2a0b12342d65bad62ba7542b
main
satok 2010-05-11 17:34:49 +09:00
parent 44357b74a3
commit 9e820fa0f4
8 changed files with 35 additions and 126 deletions

View File

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

View File

@ -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;
@ -456,7 +455,6 @@ public class LatinIME extends InputMethodService
mCompletionOn = false;
mCompletions = null;
mCapsLock = false;
mEmailText = false;
mEnteredText = null;
switch (attribute.inputType & EditorInfo.TYPE_MASK_CLASS) {
@ -479,9 +477,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;
@ -681,7 +676,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]);
@ -1122,7 +1117,7 @@ public class LatinIME extends InputMethodService
sendKeyChar((char)primaryCode);
}
updateShiftKeyState(getCurrentInputEditorInfo());
measureCps();
if (LatinIME.PERF_DEBUG) measureCps();
TextEntryState.typedCharacter((char) primaryCode, isWordSeparator(primaryCode));
}
@ -1858,7 +1853,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);
@ -1995,7 +1990,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];
@ -2003,7 +1997,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;

View File

@ -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,9 +495,10 @@ 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)) {
Log.d(TAG, "CORRECTED !!!!!!");
if (DEBUG_PREFERRED_LETTER) {
if (mPrefLetter == code && !key.isInsideSuper(x, y)) {
Log.d(TAG, "CORRECTED !!!!!!");
}
}
return mPrefLetter == code;
} else {
@ -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);

View File

@ -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;
@ -452,27 +451,30 @@ public class LatinKeyboardView extends KeyboardView {
}
}
}
void startPlaying(String s) {
if (!DEBUG_AUTO_PLAY) return;
if (s == null) return;
mStringToPlay = s.toLowerCase();
mPlaying = true;
mDownDelivered = false;
mStringIndex = 0;
mHandler2.sendEmptyMessageDelayed(MSG_TOUCH_DOWN, 10);
public void startPlaying(String s) {
if (DEBUG_AUTO_PLAY) {
if (s == null) return;
mStringToPlay = s.toLowerCase();
mPlaying = true;
mDownDelivered = false;
mStringIndex = 0;
mHandler2.sendEmptyMessageDelayed(MSG_TOUCH_DOWN, 10);
}
}
@Override
public void draw(Canvas c) {
super.draw(c);
if (DEBUG_AUTO_PLAY && mPlaying) {
mHandler2.removeMessages(MSG_TOUCH_DOWN);
mHandler2.removeMessages(MSG_TOUCH_UP);
if (mDownDelivered) {
mHandler2.sendEmptyMessageDelayed(MSG_TOUCH_UP, 20);
} else {
mHandler2.sendEmptyMessageDelayed(MSG_TOUCH_DOWN, 20);
if (DEBUG_AUTO_PLAY) {
if (mPlaying) {
mHandler2.removeMessages(MSG_TOUCH_DOWN);
mHandler2.removeMessages(MSG_TOUCH_UP);
if (mDownDelivered) {
mHandler2.sendEmptyMessageDelayed(MSG_TOUCH_UP, 20);
} else {
mHandler2.sendEmptyMessageDelayed(MSG_TOUCH_DOWN, 20);
}
}
}
if (DEBUG_LINE) {

View File

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

View File

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

View File

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

View File

@ -1,5 +0,0 @@
package com.google.android.voicesearch;
import com.android.inputmethod.latin.LatinIMESettings;
public class LatinIMEWithVoiceSettings extends LatinIMESettings {}