Remove a couple Eclipse and Android Lint warnings

Change-Id: I0c29c5d2abcbf80759b996d34b534deb083cd7d3
main
Jean Chalard 2012-12-06 20:47:19 +09:00
parent 2b6a1fed76
commit 2da8866518
12 changed files with 21 additions and 42 deletions

View File

@ -19,7 +19,7 @@
--> -->
<resources> <resources>
<!-- Device form factor. This value must be aligned with {@link KeyboardId.DEVICE_FORM_FACTOR_TABLET7} --> <!-- Device form factor. This value must be aligned with {@link KeyboardId.FORM_FACTOR_TABLET7} -->
<integer name="config_device_form_factor">1</integer> <integer name="config_device_form_factor">1</integer>
<bool name="config_enable_show_voice_key_option">false</bool> <bool name="config_enable_show_voice_key_option">false</bool>
<bool name="config_enable_show_popup_on_keypress_option">false</bool> <bool name="config_enable_show_popup_on_keypress_option">false</bool>

View File

@ -19,7 +19,7 @@
--> -->
<resources> <resources>
<!-- Device form factor. This value must be aligned with {@link KeyboardId.DEVICE_FORM_FACTOR_TABLET10} --> <!-- Device form factor. This value must be aligned with {@link KeyboardId.FORM_FACTOR_TABLET10} -->
<integer name="config_device_form_factor">2</integer> <integer name="config_device_form_factor">2</integer>
<bool name="config_enable_show_voice_key_option">false</bool> <bool name="config_enable_show_voice_key_option">false</bool>
<bool name="config_enable_show_popup_on_keypress_option">false</bool> <bool name="config_enable_show_popup_on_keypress_option">false</bool>

View File

@ -19,7 +19,7 @@
--> -->
<resources> <resources>
<!-- Device form factor. This value must be aligned with {@link KeyboardId.DEVICE_FORM_FACTOR_PHONE} --> <!-- Device form factor. This value must be aligned with {@link KeyboardId.FORM_FACTOR_PHONE} -->
<integer name="config_device_form_factor">0</integer> <integer name="config_device_form_factor">0</integer>
<bool name="config_use_fullscreen_mode">false</bool> <bool name="config_use_fullscreen_mode">false</bool>
<bool name="config_enable_show_voice_key_option">true</bool> <bool name="config_enable_show_voice_key_option">true</bool>

View File

@ -16,7 +16,6 @@
package com.android.inputmethod.latin; package com.android.inputmethod.latin;
import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.pm.PackageInfo; import android.content.pm.PackageInfo;

View File

@ -1085,7 +1085,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
public boolean onEvaluateFullscreenMode() { public boolean onEvaluateFullscreenMode() {
// Reread resource value here, because this method is called by framework anytime as needed. // Reread resource value here, because this method is called by framework anytime as needed.
final boolean isFullscreenModeAllowed = final boolean isFullscreenModeAllowed =
mCurrentSettings.isFullscreenModeAllowed(getResources()); SettingsValues.isFullscreenModeAllowed(getResources());
if (super.onEvaluateFullscreenMode() && isFullscreenModeAllowed) { if (super.onEvaluateFullscreenMode() && isFullscreenModeAllowed) {
// TODO: Remove this hack. Actually we should not really assume NO_EXTRACT_UI // TODO: Remove this hack. Actually we should not really assume NO_EXTRACT_UI
// implies NO_FULLSCREEN. However, the framework mistakenly does. i.e. NO_EXTRACT_UI // implies NO_FULLSCREEN. However, the framework mistakenly does. i.e. NO_EXTRACT_UI

View File

@ -65,12 +65,6 @@ public final class RichInputConnection {
* This contains the currently composing text, as LatinIME thinks the TextView is seeing it. * This contains the currently composing text, as LatinIME thinks the TextView is seeing it.
*/ */
private StringBuilder mComposingText = new StringBuilder(); private StringBuilder mComposingText = new StringBuilder();
/**
* This is a one-character string containing the character after the cursor. Since LatinIME
* never touches it directly, it's never modified by any means other than re-reading from the
* TextView when the cursor position is changed by the user.
*/
private CharSequence mCharAfterTheCursor = "";
// A hint on how many characters to cache from the TextView. A good value of this is given by // A hint on how many characters to cache from the TextView. A good value of this is given by
// how many characters we need to be able to almost always find the caps mode. // how many characters we need to be able to almost always find the caps mode.
private static final int DEFAULT_TEXT_CACHE_SIZE = 100; private static final int DEFAULT_TEXT_CACHE_SIZE = 100;
@ -146,7 +140,6 @@ public final class RichInputConnection {
mCommittedTextBeforeComposingText.setLength(0); mCommittedTextBeforeComposingText.setLength(0);
final CharSequence textBeforeCursor = getTextBeforeCursor(DEFAULT_TEXT_CACHE_SIZE, 0); final CharSequence textBeforeCursor = getTextBeforeCursor(DEFAULT_TEXT_CACHE_SIZE, 0);
if (null != textBeforeCursor) mCommittedTextBeforeComposingText.append(textBeforeCursor); if (null != textBeforeCursor) mCommittedTextBeforeComposingText.append(textBeforeCursor);
mCharAfterTheCursor = getTextAfterCursor(1, 0);
if (null != mIC) { if (null != mIC) {
mIC.finishComposingText(); mIC.finishComposingText();
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.IS_EXPERIMENTAL) {
@ -398,6 +391,7 @@ public final class RichInputConnection {
if (DEBUG_PREVIOUS_TEXT) checkConsistencyForDebug(); if (DEBUG_PREVIOUS_TEXT) checkConsistencyForDebug();
} }
@SuppressWarnings("unused")
public String getNthPreviousWord(final String sentenceSeperators, final int n) { public String getNthPreviousWord(final String sentenceSeperators, final int n) {
mIC = mParent.getCurrentInputConnection(); mIC = mParent.getCurrentInputConnection();
if (null == mIC) return null; if (null == mIC) return null;

View File

@ -63,7 +63,7 @@ public final class UserHistoryDictIOUtils {
@Override @Override
public int readUnsignedByte() { public int readUnsignedByte() {
return ((int)mBuffer[mPosition++]) & 0xFF; return mBuffer[mPosition++] & 0xFF;
} }
@Override @Override

View File

@ -376,10 +376,10 @@ public final class UserHistoryDictionary extends ExpandableDictionary {
final byte fc = fcp.getFc(); final byte fc = fcp.getFc();
final boolean isValid = fcp.isValid(); final boolean isValid = fcp.isValid();
if (prevFc > 0 && prevFc == fc) { if (prevFc > 0 && prevFc == fc) {
freq = ((int)fc) & 0xFF; freq = fc & 0xFF;
} else if (UserHistoryForgettingCurveUtils. } else if (UserHistoryForgettingCurveUtils.
needsToSave(fc, isValid, mAddLevel0Bigrams)) { needsToSave(fc, isValid, mAddLevel0Bigrams)) {
freq = ((int)fc) & 0xFF; freq = fc & 0xFF;
} else { } else {
// Delete this entry // Delete this entry
freq = -1; freq = -1;

View File

@ -41,6 +41,7 @@ import java.io.PrintWriter;
import java.nio.channels.FileChannel; import java.nio.channels.FileChannel;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.Locale;
public final class Utils { public final class Utils {
private Utils() { private Utils() {
@ -193,7 +194,7 @@ public final class Utils {
private UsabilityStudyLogUtils() { private UsabilityStudyLogUtils() {
mDate = new Date(); mDate = new Date();
mDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss.SSSZ"); mDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss.SSSZ", Locale.US);
HandlerThread handlerThread = new HandlerThread("UsabilityStudyLogUtils logging task", HandlerThread handlerThread = new HandlerThread("UsabilityStudyLogUtils logging task",
Process.THREAD_PRIORITY_BACKGROUND); Process.THREAD_PRIORITY_BACKGROUND);
@ -255,7 +256,7 @@ public final class Utils {
final long currentTime = System.currentTimeMillis(); final long currentTime = System.currentTimeMillis();
mDate.setTime(currentTime); mDate.setTime(currentTime);
final String printString = String.format("%s\t%d\t%s\n", final String printString = String.format(Locale.US, "%s\t%d\t%s\n",
mDateFormat.format(mDate), currentTime, log); mDateFormat.format(mDate), currentTime, log);
if (LatinImeLogger.sDBG) { if (LatinImeLogger.sDBG) {
Log.d(USABILITY_TAG, "Write: " + log); Log.d(USABILITY_TAG, "Write: " + log);
@ -297,7 +298,7 @@ public final class Utils {
final Date date = new Date(); final Date date = new Date();
date.setTime(System.currentTimeMillis()); date.setTime(System.currentTimeMillis());
final String currentDateTimeString = final String currentDateTimeString =
new SimpleDateFormat("yyyyMMdd-HHmmssZ").format(date); new SimpleDateFormat("yyyyMMdd-HHmmssZ", Locale.US).format(date);
if (mFile == null) { if (mFile == null) {
Log.w(USABILITY_TAG, "No internal log file found."); Log.w(USABILITY_TAG, "No internal log file found.");
return; return;
@ -313,11 +314,15 @@ public final class Utils {
+ "/research-" + currentDateTimeString + ".log"; + "/research-" + currentDateTimeString + ".log";
final File destFile = new File(destPath); final File destFile = new File(destPath);
try { try {
final FileChannel src = (new FileInputStream(mFile)).getChannel(); final FileInputStream srcStream = new FileInputStream(mFile);
final FileChannel dest = (new FileOutputStream(destFile)).getChannel(); final FileOutputStream destStream = new FileOutputStream(destFile);
final FileChannel src = srcStream.getChannel();
final FileChannel dest = destStream.getChannel();
src.transferTo(0, src.size(), dest); src.transferTo(0, src.size(), dest);
src.close(); src.close();
srcStream.close();
dest.close(); dest.close();
destStream.close();
} catch (FileNotFoundException e1) { } catch (FileNotFoundException e1) {
Log.w(USABILITY_TAG, e1); Log.w(USABILITY_TAG, e1);
return; return;

View File

@ -921,6 +921,7 @@ public final class BinaryDictInputOutput {
* @param formatOptions file format options. * @param formatOptions file format options.
* @return the address of the END of the node. * @return the address of the END of the node.
*/ */
@SuppressWarnings("unused")
private static int writePlacedNode(final FusionDictionary dict, byte[] buffer, private static int writePlacedNode(final FusionDictionary dict, byte[] buffer,
final Node node, final FormatOptions formatOptions) { final Node node, final FormatOptions formatOptions) {
// TODO: Make the code in common with BinaryDictIOUtils#writeCharGroup // TODO: Make the code in common with BinaryDictIOUtils#writeCharGroup
@ -1407,6 +1408,7 @@ public final class BinaryDictInputOutput {
// TODO: static!? This will behave erratically when used in multi-threaded code. // TODO: static!? This will behave erratically when used in multi-threaded code.
// We need to fix this // We need to fix this
private static int[] sGetWordBuffer = new int[FormatSpec.MAX_WORD_LENGTH]; private static int[] sGetWordBuffer = new int[FormatSpec.MAX_WORD_LENGTH];
@SuppressWarnings("unused")
private static WeightedString getWordAtAddressWithParentAddress( private static WeightedString getWordAtAddressWithParentAddress(
final FusionDictionaryBufferInterface buffer, final int headerSize, final int address, final FusionDictionaryBufferInterface buffer, final int headerSize, final int address,
final FormatOptions options) { final FormatOptions options) {

View File

@ -617,6 +617,7 @@ public final class FusionDictionary implements Iterable<Word> {
/** /**
* Helper method to find a word in a given branch. * Helper method to find a word in a given branch.
*/ */
@SuppressWarnings("unused")
public static CharGroup findWordInTree(Node node, final String s) { public static CharGroup findWordInTree(Node node, final String s) {
int index = 0; int index = 0;
final StringBuilder checker = DBG ? new StringBuilder() : null; final StringBuilder checker = DBG ? new StringBuilder() : null;

View File

@ -57,7 +57,6 @@ import com.android.inputmethod.keyboard.Keyboard;
import com.android.inputmethod.keyboard.KeyboardId; import com.android.inputmethod.keyboard.KeyboardId;
import com.android.inputmethod.keyboard.KeyboardView; import com.android.inputmethod.keyboard.KeyboardView;
import com.android.inputmethod.keyboard.MainKeyboardView; import com.android.inputmethod.keyboard.MainKeyboardView;
import com.android.inputmethod.latin.CollectionUtils;
import com.android.inputmethod.latin.Constants; import com.android.inputmethod.latin.Constants;
import com.android.inputmethod.latin.Dictionary; import com.android.inputmethod.latin.Dictionary;
import com.android.inputmethod.latin.InputTypeUtils; import com.android.inputmethod.latin.InputTypeUtils;
@ -144,7 +143,6 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
private final Statistics mStatistics; private final Statistics mStatistics;
private Intent mUploadIntent; private Intent mUploadIntent;
private PendingIntent mUploadPendingIntent;
private LogUnit mCurrentLogUnit = new LogUnit(); private LogUnit mCurrentLogUnit = new LogUnit();
@ -189,7 +187,6 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
mInputMethodService = ims; mInputMethodService = ims;
mPrefs = prefs; mPrefs = prefs;
mUploadIntent = new Intent(mInputMethodService, UploaderService.class); mUploadIntent = new Intent(mInputMethodService, UploaderService.class);
mUploadPendingIntent = PendingIntent.getService(mInputMethodService, 0, mUploadIntent, 0);
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.IS_EXPERIMENTAL) {
scheduleUploadingService(mInputMethodService); scheduleUploadingService(mInputMethodService);
@ -428,21 +425,6 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
} }
private long mResumeTime = 0L; private long mResumeTime = 0L;
private void suspendLoggingUntil(long time) {
mIsLoggingSuspended = true;
mResumeTime = time;
requestIndicatorRedraw();
}
private void resumeLogging() {
mResumeTime = 0L;
updateSuspendedState();
requestIndicatorRedraw();
if (isAllowedToLog()) {
restart();
}
}
private void updateSuspendedState() { private void updateSuspendedState() {
final long time = System.currentTimeMillis(); final long time = System.currentTimeMillis();
if (time > mResumeTime) { if (time > mResumeTime) {
@ -840,10 +822,6 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
stop(); stop();
} }
private static final String[] EVENTKEYS_USER_FEEDBACK = {
"UserFeedback", "FeedbackContents"
};
private static final String[] EVENTKEYS_PREFS_CHANGED = { private static final String[] EVENTKEYS_PREFS_CHANGED = {
"PrefsChanged", "prefs" "PrefsChanged", "prefs"
}; };