mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-20 14:19:08 +00:00
fix lint warnings and cleanup
This commit is contained in:
parent
916213d549
commit
faff1e2ba7
13 changed files with 23 additions and 51 deletions
|
@ -47,7 +47,8 @@
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:defaultToDeviceProtectedStorage="true"
|
android:defaultToDeviceProtectedStorage="true"
|
||||||
android:directBootAware="true">
|
android:directBootAware="true"
|
||||||
|
android:extractNativeLibs="false">
|
||||||
|
|
||||||
<!-- Services -->
|
<!-- Services -->
|
||||||
<service android:name="LatinIME"
|
<service android:name="LatinIME"
|
||||||
|
|
|
@ -221,11 +221,7 @@ public final class AccessibilityUtils {
|
||||||
|
|
||||||
// Platforms starting at SDK version 16 (Build.VERSION_CODES.JELLY_BEAN) should use
|
// Platforms starting at SDK version 16 (Build.VERSION_CODES.JELLY_BEAN) should use
|
||||||
// announce events.
|
// announce events.
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
event.setEventType(AccessibilityEventCompat.TYPE_ANNOUNCEMENT);
|
||||||
event.setEventType(AccessibilityEventCompat.TYPE_ANNOUNCEMENT);
|
|
||||||
} else {
|
|
||||||
event.setEventType(AccessibilityEvent.TYPE_VIEW_FOCUSED);
|
|
||||||
}
|
|
||||||
|
|
||||||
final ViewParent viewParent = view.getParent();
|
final ViewParent viewParent = view.getParent();
|
||||||
if ((viewParent == null) || !(viewParent instanceof ViewGroup)) {
|
if ((viewParent == null) || !(viewParent instanceof ViewGroup)) {
|
||||||
|
|
|
@ -41,10 +41,8 @@ public final class InputMethodSubtypeCompatUtils {
|
||||||
int.class, int.class, String.class, String.class, String.class, boolean.class,
|
int.class, int.class, String.class, String.class, String.class, boolean.class,
|
||||||
boolean.class, int.class);
|
boolean.class, int.class);
|
||||||
static {
|
static {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
if (CONSTRUCTOR_INPUT_METHOD_SUBTYPE == null) {
|
||||||
if (CONSTRUCTOR_INPUT_METHOD_SUBTYPE == null) {
|
android.util.Log.w(TAG, "Warning!!! Constructor is not defined.");
|
||||||
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,
|
public static InputMethodSubtype newInputMethodSubtype(int nameId, int iconId, String locale,
|
||||||
String mode, String extraValue, boolean isAuxiliary,
|
String mode, String extraValue, boolean isAuxiliary,
|
||||||
boolean overridesImplicitlyEnabledSubtype, int id) {
|
boolean overridesImplicitlyEnabledSubtype, int id) {
|
||||||
if (CONSTRUCTOR_INPUT_METHOD_SUBTYPE == null
|
if (CONSTRUCTOR_INPUT_METHOD_SUBTYPE == null) {
|
||||||
|| Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
|
||||||
return new InputMethodSubtype(nameId, iconId, locale, mode, extraValue, isAuxiliary,
|
return new InputMethodSubtype(nameId, iconId, locale, mode, extraValue, isAuxiliary,
|
||||||
overridesImplicitlyEnabledSubtype);
|
overridesImplicitlyEnabledSubtype);
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,11 +73,8 @@ public class NotificationCompatUtils {
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public static Notification build(final Notification.Builder builder) {
|
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
|
||||||
// #build was added in API level 16, JELLY_BEAN
|
return (Notification) CompatUtils.invoke(builder, null, METHOD_build);
|
||||||
return (Notification) CompatUtils.invoke(builder, null, METHOD_build);
|
|
||||||
}
|
|
||||||
// #getNotification was deprecated in API level 16, JELLY_BEAN
|
// #getNotification was deprecated in API level 16, JELLY_BEAN
|
||||||
return builder.getNotification();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1000,14 +1000,6 @@ public final class RichInputConnection implements PrivateCommandPerformer {
|
||||||
* On platforms on which this method is not present, this is a no-op.
|
* On platforms on which this method is not present, this is a no-op.
|
||||||
*/
|
*/
|
||||||
public void maybeMoveTheCursorAroundAndRestoreToWorkaroundABug() {
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -171,17 +171,12 @@ public class UserBinaryDictionary extends ExpandableBinaryDictionary {
|
||||||
requestArguments = localeElements;
|
requestArguments = localeElements;
|
||||||
}
|
}
|
||||||
final String requestString = request.toString();
|
final String requestString = request.toString();
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
try {
|
||||||
try {
|
addWordsFromProjectionLocked(PROJECTION_QUERY_WITH_SHORTCUT, requestString,
|
||||||
addWordsFromProjectionLocked(PROJECTION_QUERY_WITH_SHORTCUT, requestString,
|
requestArguments);
|
||||||
requestArguments);
|
} catch (IllegalArgumentException e) {
|
||||||
} catch (IllegalArgumentException e) {
|
// This may happen on some non-compliant devices where the declared API is JB+ but
|
||||||
// This may happen on some non-compliant devices where the declared API is JB+ but
|
// the SHORTCUT column is not present for some reason.
|
||||||
// the SHORTCUT column is not present for some reason.
|
|
||||||
addWordsFromProjectionLocked(PROJECTION_QUERY_WITHOUT_SHORTCUT, requestString,
|
|
||||||
requestArguments);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
addWordsFromProjectionLocked(PROJECTION_QUERY_WITHOUT_SHORTCUT, requestString,
|
addWordsFromProjectionLocked(PROJECTION_QUERY_WITHOUT_SHORTCUT, requestString,
|
||||||
requestArguments);
|
requestArguments);
|
||||||
}
|
}
|
||||||
|
@ -219,7 +214,7 @@ public class UserBinaryDictionary extends ExpandableBinaryDictionary {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addWordsLocked(final Cursor cursor) {
|
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 == null) return;
|
||||||
if (cursor.moveToFirst()) {
|
if (cursor.moveToFirst()) {
|
||||||
final int indexWord = cursor.getColumnIndex(Words.WORD);
|
final int indexWord = cursor.getColumnIndex(Words.WORD);
|
||||||
|
|
|
@ -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 DBG_USE_INTERNAL_PERSONAL_DICTIONARY_SETTINGS = false;
|
||||||
private static final boolean USE_INTERNAL_PERSONAL_DICTIONARY_SETTINGS =
|
private static final boolean USE_INTERNAL_PERSONAL_DICTIONARY_SETTINGS =
|
||||||
DBG_USE_INTERNAL_PERSONAL_DICTIONARY_SETTINGS
|
DBG_USE_INTERNAL_PERSONAL_DICTIONARY_SETTINGS;
|
||||||
|| Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN_MR2;
|
|
||||||
|
|
||||||
private SwitchPreference mUseContactsPreference;
|
private SwitchPreference mUseContactsPreference;
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ import org.dslul.openboard.inputmethod.latin.RichInputMethodManager;
|
||||||
public final class PreferencesSettingsFragment extends SubScreenFragment {
|
public final class PreferencesSettingsFragment extends SubScreenFragment {
|
||||||
|
|
||||||
private static final boolean VOICE_IME_ENABLED =
|
private static final boolean VOICE_IME_ENABLED =
|
||||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN;
|
true;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(final Bundle icicle) {
|
public void onCreate(final Bundle icicle) {
|
||||||
|
|
|
@ -139,9 +139,7 @@ public class SettingsValues {
|
||||||
mKeyPreviewPopupOn = Settings.readKeyPreviewPopupEnabled(prefs, res);
|
mKeyPreviewPopupOn = Settings.readKeyPreviewPopupEnabled(prefs, res);
|
||||||
mSlidingKeyInputPreviewEnabled = prefs.getBoolean(
|
mSlidingKeyInputPreviewEnabled = prefs.getBoolean(
|
||||||
DebugSettings.PREF_SLIDING_KEY_INPUT_PREVIEW, true);
|
DebugSettings.PREF_SLIDING_KEY_INPUT_PREVIEW, true);
|
||||||
mShowsVoiceInputKey = needsToShowVoiceInputKey(prefs, res)
|
mShowsVoiceInputKey = needsToShowVoiceInputKey(prefs, res) && mInputAttributes.mShouldShowVoiceInputKey;
|
||||||
&& mInputAttributes.mShouldShowVoiceInputKey
|
|
||||||
&& Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN;
|
|
||||||
mIncludesOtherImesInLanguageSwitchList = Settings.ENABLE_SHOW_LANGUAGE_SWITCH_KEY_SETTINGS
|
mIncludesOtherImesInLanguageSwitchList = Settings.ENABLE_SHOW_LANGUAGE_SWITCH_KEY_SETTINGS
|
||||||
? prefs.getBoolean(Settings.PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST, false)
|
? prefs.getBoolean(Settings.PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST, false)
|
||||||
: true /* forcibly */;
|
: true /* forcibly */;
|
||||||
|
|
|
@ -49,7 +49,7 @@ import java.util.Locale;
|
||||||
public class UserDictionarySettings extends ListFragment {
|
public class UserDictionarySettings extends ListFragment {
|
||||||
|
|
||||||
public static final boolean IS_SHORTCUT_API_SUPPORTED =
|
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 =
|
private static final String[] QUERY_PROJECTION_SHORTCUT_UNSUPPORTED =
|
||||||
{ UserDictionary.Words._ID, UserDictionary.Words.WORD};
|
{ UserDictionary.Words._ID, UserDictionary.Words.WORD};
|
||||||
|
|
|
@ -181,8 +181,7 @@ public final class AdditionalSubtypeUtils {
|
||||||
if (isAsciiCapable) {
|
if (isAsciiCapable) {
|
||||||
extraValueItems.add(ASCII_CAPABLE);
|
extraValueItems.add(ASCII_CAPABLE);
|
||||||
}
|
}
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN &&
|
if (SubtypeLocaleUtils.isExceptionalLocale(localeString)) {
|
||||||
SubtypeLocaleUtils.isExceptionalLocale(localeString)) {
|
|
||||||
extraValueItems.add(UNTRANSLATABLE_STRING_IN_SUBTYPE_NAME + "=" +
|
extraValueItems.add(UNTRANSLATABLE_STRING_IN_SUBTYPE_NAME + "=" +
|
||||||
SubtypeLocaleUtils.getKeyboardLayoutSetDisplayName(keyboardLayoutSetName));
|
SubtypeLocaleUtils.getKeyboardLayoutSetDisplayName(keyboardLayoutSetName));
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,8 +158,7 @@ public final class SubtypeLocaleUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getSubtypeNameId(final String localeString, final String keyboardLayoutName) {
|
public static int getSubtypeNameId(final String localeString, final String keyboardLayoutName) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN
|
if (isExceptionalLocale(localeString)) {
|
||||||
&& isExceptionalLocale(localeString)) {
|
|
||||||
return sExceptionalLocaleToWithLayoutNameIdsMap.get(localeString);
|
return sExceptionalLocaleToWithLayoutNameIdsMap.get(localeString);
|
||||||
}
|
}
|
||||||
final String key = NO_LANGUAGE.equals(localeString)
|
final String key = NO_LANGUAGE.equals(localeString)
|
||||||
|
@ -258,8 +257,7 @@ public final class SubtypeLocaleUtils {
|
||||||
@Nonnull
|
@Nonnull
|
||||||
private static String getReplacementString(@Nonnull final InputMethodSubtype subtype,
|
private static String getReplacementString(@Nonnull final InputMethodSubtype subtype,
|
||||||
@Nonnull final Locale displayLocale) {
|
@Nonnull final Locale displayLocale) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN
|
if (subtype.containsExtraValueKey(UNTRANSLATABLE_STRING_IN_SUBTYPE_NAME)) {
|
||||||
&& subtype.containsExtraValueKey(UNTRANSLATABLE_STRING_IN_SUBTYPE_NAME)) {
|
|
||||||
return subtype.getExtraValueOf(UNTRANSLATABLE_STRING_IN_SUBTYPE_NAME);
|
return subtype.getExtraValueOf(UNTRANSLATABLE_STRING_IN_SUBTYPE_NAME);
|
||||||
}
|
}
|
||||||
return getSubtypeLocaleDisplayNameInternal(subtype.getLocale(), displayLocale);
|
return getSubtypeLocaleDisplayNameInternal(subtype.getLocale(), displayLocale);
|
||||||
|
|
|
@ -1169,7 +1169,7 @@
|
||||||
<item> ¯\\_</item>
|
<item> ¯\\_</item>
|
||||||
<item>(ツ)</item>
|
<item>(ツ)</item>
|
||||||
<item>_/¯</item>
|
<item>_/¯</item>
|
||||||
<item>┬─┬</item>
|
<item>┬─┬</item>
|
||||||
<item>︵ /(</item>
|
<item>︵ /(</item>
|
||||||
<item>.□.\\</item>
|
<item>.□.\\</item>
|
||||||
</array>
|
</array>
|
||||||
|
|
Loading…
Add table
Reference in a new issue