remove unnecessary stuff

This commit is contained in:
Helium314 2024-01-25 14:05:39 +01:00
parent 911c609f7c
commit ecbee995bf
4 changed files with 5 additions and 15 deletions

View file

@ -51,8 +51,6 @@ import java.util.List;
import java.util.Locale;
import java.util.concurrent.locks.ReentrantLock;
import kotlin.jvm.functions.Function1;
public final class Settings implements SharedPreferences.OnSharedPreferenceChangeListener {
private static final String TAG = Settings.class.getSimpleName();
// Settings screens
@ -231,7 +229,7 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
final SharedPreferences prefs = mPrefs;
Log.i(TAG, "loadSettings");
mSettingsValues = RunInLocaleKt.runInLocale(context, locale,
(Function1<Context, SettingsValues>) ctx -> new SettingsValues(ctx, prefs, ctx.getResources(), inputAttributes));
ctx -> new SettingsValues(ctx, prefs, ctx.getResources(), inputAttributes));
} finally {
mSettingsValuesLock.unlock();
}

View file

@ -38,8 +38,6 @@ import org.dslul.openboard.inputmethod.latin.settings.UserDictionaryAddWordConte
import java.util.ArrayList;
import java.util.Collections;
import kotlin.Unit;
/**
* Fragment to add a word/shortcut to the user dictionary.
* As opposed to the UserDictionaryActivity, this is only invoked within Settings
@ -94,7 +92,7 @@ public class UserDictionaryAddWordFragment extends SubScreenFragment {
TextViewKt.doAfterTextChanged(mWordEditText, (editable) -> {
final int visibility = TextUtils.isEmpty(editable.toString()) ? View.INVISIBLE : View.VISIBLE;
saveWordButton.setVisibility(visibility);
return Unit.INSTANCE;
return null;
});
saveWordButton.setVisibility(TextUtils.isEmpty(mWordEditText.getText().toString()) ? View.INVISIBLE : View.VISIBLE);

View file

@ -18,8 +18,6 @@ import org.dslul.openboard.inputmethod.latin.utils.RunInLocaleKt;
import java.util.ArrayList;
import java.util.Locale;
import kotlin.jvm.functions.Function1;
/**
* This code is mostly lifted directly from android.service.textservice.SpellCheckerService in
* the framework; maybe that should be protected instead, so that implementers don't have to
@ -67,8 +65,7 @@ public class SentenceLevelAdapter {
private static class WordIterator {
private final SpacingAndPunctuations mSpacingAndPunctuations;
public WordIterator(final Resources res, final Locale locale) {
mSpacingAndPunctuations = RunInLocaleKt.runInLocale(res, locale,
(Function1<Resources, SpacingAndPunctuations>) r -> new SpacingAndPunctuations(r, false));
mSpacingAndPunctuations = RunInLocaleKt.runInLocale(res, locale, r -> new SpacingAndPunctuations(r, false));
}
public int getEndOfWord(final CharSequence sequence, final int fromIndex) {

View file

@ -24,8 +24,6 @@ import static org.dslul.openboard.inputmethod.latin.common.Constants.Subtype.Ext
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import kotlin.jvm.functions.Function1;
/**
* A helper class to deal with subtype locales.
*/
@ -188,8 +186,7 @@ public final class SubtypeLocaleUtils {
final String displayName;
if (exceptionalNameResId != null) {
displayName = RunInLocaleKt.runInLocale(sResources, displayLocale,
(Function1<Resources, String>) res -> res.getString(exceptionalNameResId));
displayName = RunInLocaleKt.runInLocale(sResources, displayLocale, res -> res.getString(exceptionalNameResId));
} else {
displayName = LocaleUtils.constructLocaleFromString(localeString)
.getDisplayName(displayLocale);
@ -246,7 +243,7 @@ public final class SubtypeLocaleUtils {
// TODO: rework this for multi-lingual subtypes
final int nameResId = subtype.getNameResId();
return RunInLocaleKt.runInLocale(sResources, displayLocale,
(Function1<Resources, String>) res -> {
res -> {
try {
return StringUtils.capitalizeFirstCodePoint(res.getString(nameResId, replacementString), displayLocale);
} catch (Resources.NotFoundException e) {