fix lint warnings and cleanup

This commit is contained in:
dslul 2020-01-21 11:49:48 +01:00
parent 916213d549
commit faff1e2ba7
13 changed files with 23 additions and 51 deletions

View file

@ -47,7 +47,8 @@
android:supportsRtl="true"
android:allowBackup="true"
android:defaultToDeviceProtectedStorage="true"
android:directBootAware="true">
android:directBootAware="true"
android:extractNativeLibs="false">
<!-- Services -->
<service android:name="LatinIME"

View file

@ -221,11 +221,7 @@ public final class AccessibilityUtils {
// Platforms starting at SDK version 16 (Build.VERSION_CODES.JELLY_BEAN) should use
// announce events.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
event.setEventType(AccessibilityEventCompat.TYPE_ANNOUNCEMENT);
} else {
event.setEventType(AccessibilityEvent.TYPE_VIEW_FOCUSED);
}
event.setEventType(AccessibilityEventCompat.TYPE_ANNOUNCEMENT);
final ViewParent viewParent = view.getParent();
if ((viewParent == null) || !(viewParent instanceof ViewGroup)) {

View file

@ -41,10 +41,8 @@ public final class InputMethodSubtypeCompatUtils {
int.class, int.class, String.class, String.class, String.class, boolean.class,
boolean.class, int.class);
static {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
if (CONSTRUCTOR_INPUT_METHOD_SUBTYPE == null) {
android.util.Log.w(TAG, "Warning!!! Constructor is not defined.");
}
if (CONSTRUCTOR_INPUT_METHOD_SUBTYPE == null) {
android.util.Log.w(TAG, "Warning!!! Constructor is not defined.");
}
}
@ -62,8 +60,7 @@ public final class InputMethodSubtypeCompatUtils {
public static InputMethodSubtype newInputMethodSubtype(int nameId, int iconId, String locale,
String mode, String extraValue, boolean isAuxiliary,
boolean overridesImplicitlyEnabledSubtype, int id) {
if (CONSTRUCTOR_INPUT_METHOD_SUBTYPE == null
|| Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
if (CONSTRUCTOR_INPUT_METHOD_SUBTYPE == null) {
return new InputMethodSubtype(nameId, iconId, locale, mode, extraValue, isAuxiliary,
overridesImplicitlyEnabledSubtype);
}

View file

@ -73,11 +73,8 @@ public class NotificationCompatUtils {
@SuppressWarnings("deprecation")
public static Notification build(final Notification.Builder builder) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
// #build was added in API level 16, JELLY_BEAN
return (Notification) CompatUtils.invoke(builder, null, METHOD_build);
}
// #build was added in API level 16, JELLY_BEAN
return (Notification) CompatUtils.invoke(builder, null, METHOD_build);
// #getNotification was deprecated in API level 16, JELLY_BEAN
return builder.getNotification();
}
}

View file

@ -1000,14 +1000,6 @@ public final class RichInputConnection implements PrivateCommandPerformer {
* On platforms on which this method is not present, this is a no-op.
*/
public void maybeMoveTheCursorAroundAndRestoreToWorkaroundABug() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
if (mExpectedSelStart > 0) {
mIC.setSelection(mExpectedSelStart - 1, mExpectedSelStart - 1);
} else {
mIC.setSelection(mExpectedSelStart + 1, mExpectedSelStart + 1);
}
mIC.setSelection(mExpectedSelStart, mExpectedSelEnd);
}
}
/**

View file

@ -171,17 +171,12 @@ public class UserBinaryDictionary extends ExpandableBinaryDictionary {
requestArguments = localeElements;
}
final String requestString = request.toString();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
try {
addWordsFromProjectionLocked(PROJECTION_QUERY_WITH_SHORTCUT, requestString,
requestArguments);
} catch (IllegalArgumentException e) {
// This may happen on some non-compliant devices where the declared API is JB+ but
// the SHORTCUT column is not present for some reason.
addWordsFromProjectionLocked(PROJECTION_QUERY_WITHOUT_SHORTCUT, requestString,
requestArguments);
}
} else {
try {
addWordsFromProjectionLocked(PROJECTION_QUERY_WITH_SHORTCUT, requestString,
requestArguments);
} catch (IllegalArgumentException e) {
// This may happen on some non-compliant devices where the declared API is JB+ but
// the SHORTCUT column is not present for some reason.
addWordsFromProjectionLocked(PROJECTION_QUERY_WITHOUT_SHORTCUT, requestString,
requestArguments);
}
@ -219,7 +214,7 @@ public class UserBinaryDictionary extends ExpandableBinaryDictionary {
}
private void addWordsLocked(final Cursor cursor) {
final boolean hasShortcutColumn = Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN;
final boolean hasShortcutColumn = true;
if (cursor == null) return;
if (cursor.moveToFirst()) {
final int indexWord = cursor.getColumnIndex(Words.WORD);

View file

@ -57,8 +57,7 @@ public final class CorrectionSettingsFragment extends SubScreenFragment
private static final boolean DBG_USE_INTERNAL_PERSONAL_DICTIONARY_SETTINGS = false;
private static final boolean USE_INTERNAL_PERSONAL_DICTIONARY_SETTINGS =
DBG_USE_INTERNAL_PERSONAL_DICTIONARY_SETTINGS
|| Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN_MR2;
DBG_USE_INTERNAL_PERSONAL_DICTIONARY_SETTINGS;
private SwitchPreference mUseContactsPreference;

View file

@ -41,7 +41,7 @@ import org.dslul.openboard.inputmethod.latin.RichInputMethodManager;
public final class PreferencesSettingsFragment extends SubScreenFragment {
private static final boolean VOICE_IME_ENABLED =
Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN;
true;
@Override
public void onCreate(final Bundle icicle) {

View file

@ -139,9 +139,7 @@ public class SettingsValues {
mKeyPreviewPopupOn = Settings.readKeyPreviewPopupEnabled(prefs, res);
mSlidingKeyInputPreviewEnabled = prefs.getBoolean(
DebugSettings.PREF_SLIDING_KEY_INPUT_PREVIEW, true);
mShowsVoiceInputKey = needsToShowVoiceInputKey(prefs, res)
&& mInputAttributes.mShouldShowVoiceInputKey
&& Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN;
mShowsVoiceInputKey = needsToShowVoiceInputKey(prefs, res) && mInputAttributes.mShouldShowVoiceInputKey;
mIncludesOtherImesInLanguageSwitchList = Settings.ENABLE_SHOW_LANGUAGE_SWITCH_KEY_SETTINGS
? prefs.getBoolean(Settings.PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST, false)
: true /* forcibly */;

View file

@ -49,7 +49,7 @@ import java.util.Locale;
public class UserDictionarySettings extends ListFragment {
public static final boolean IS_SHORTCUT_API_SUPPORTED =
Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN;
true;
private static final String[] QUERY_PROJECTION_SHORTCUT_UNSUPPORTED =
{ UserDictionary.Words._ID, UserDictionary.Words.WORD};

View file

@ -181,8 +181,7 @@ public final class AdditionalSubtypeUtils {
if (isAsciiCapable) {
extraValueItems.add(ASCII_CAPABLE);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN &&
SubtypeLocaleUtils.isExceptionalLocale(localeString)) {
if (SubtypeLocaleUtils.isExceptionalLocale(localeString)) {
extraValueItems.add(UNTRANSLATABLE_STRING_IN_SUBTYPE_NAME + "=" +
SubtypeLocaleUtils.getKeyboardLayoutSetDisplayName(keyboardLayoutSetName));
}

View file

@ -158,8 +158,7 @@ public final class SubtypeLocaleUtils {
}
public static int getSubtypeNameId(final String localeString, final String keyboardLayoutName) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN
&& isExceptionalLocale(localeString)) {
if (isExceptionalLocale(localeString)) {
return sExceptionalLocaleToWithLayoutNameIdsMap.get(localeString);
}
final String key = NO_LANGUAGE.equals(localeString)
@ -258,8 +257,7 @@ public final class SubtypeLocaleUtils {
@Nonnull
private static String getReplacementString(@Nonnull final InputMethodSubtype subtype,
@Nonnull final Locale displayLocale) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN
&& subtype.containsExtraValueKey(UNTRANSLATABLE_STRING_IN_SUBTYPE_NAME)) {
if (subtype.containsExtraValueKey(UNTRANSLATABLE_STRING_IN_SUBTYPE_NAME)) {
return subtype.getExtraValueOf(UNTRANSLATABLE_STRING_IN_SUBTYPE_NAME);
}
return getSubtypeLocaleDisplayNameInternal(subtype.getLocale(), displayLocale);

View file

@ -1169,7 +1169,7 @@
<item> ¯\\_</item>
<item>(ツ)</item>
<item>_/¯</item>
<item>┬─┬</item>
<item>┬─┬</item>
<item>︵ /(</item>
<item>.□.\\</item>
</array>