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

View file

@ -38,8 +38,6 @@ import org.dslul.openboard.inputmethod.latin.settings.UserDictionaryAddWordConte
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import kotlin.Unit;
/** /**
* Fragment to add a word/shortcut to the user dictionary. * Fragment to add a word/shortcut to the user dictionary.
* As opposed to the UserDictionaryActivity, this is only invoked within Settings * As opposed to the UserDictionaryActivity, this is only invoked within Settings
@ -94,7 +92,7 @@ public class UserDictionaryAddWordFragment extends SubScreenFragment {
TextViewKt.doAfterTextChanged(mWordEditText, (editable) -> { TextViewKt.doAfterTextChanged(mWordEditText, (editable) -> {
final int visibility = TextUtils.isEmpty(editable.toString()) ? View.INVISIBLE : View.VISIBLE; final int visibility = TextUtils.isEmpty(editable.toString()) ? View.INVISIBLE : View.VISIBLE;
saveWordButton.setVisibility(visibility); saveWordButton.setVisibility(visibility);
return Unit.INSTANCE; return null;
}); });
saveWordButton.setVisibility(TextUtils.isEmpty(mWordEditText.getText().toString()) ? View.INVISIBLE : View.VISIBLE); 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.ArrayList;
import java.util.Locale; import java.util.Locale;
import kotlin.jvm.functions.Function1;
/** /**
* This code is mostly lifted directly from android.service.textservice.SpellCheckerService in * 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 * 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 static class WordIterator {
private final SpacingAndPunctuations mSpacingAndPunctuations; private final SpacingAndPunctuations mSpacingAndPunctuations;
public WordIterator(final Resources res, final Locale locale) { public WordIterator(final Resources res, final Locale locale) {
mSpacingAndPunctuations = RunInLocaleKt.runInLocale(res, locale, mSpacingAndPunctuations = RunInLocaleKt.runInLocale(res, locale, r -> new SpacingAndPunctuations(r, false));
(Function1<Resources, SpacingAndPunctuations>) r -> new SpacingAndPunctuations(r, false));
} }
public int getEndOfWord(final CharSequence sequence, final int fromIndex) { 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.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import kotlin.jvm.functions.Function1;
/** /**
* A helper class to deal with subtype locales. * A helper class to deal with subtype locales.
*/ */
@ -188,8 +186,7 @@ public final class SubtypeLocaleUtils {
final String displayName; final String displayName;
if (exceptionalNameResId != null) { if (exceptionalNameResId != null) {
displayName = RunInLocaleKt.runInLocale(sResources, displayLocale, displayName = RunInLocaleKt.runInLocale(sResources, displayLocale, res -> res.getString(exceptionalNameResId));
(Function1<Resources, String>) res -> res.getString(exceptionalNameResId));
} else { } else {
displayName = LocaleUtils.constructLocaleFromString(localeString) displayName = LocaleUtils.constructLocaleFromString(localeString)
.getDisplayName(displayLocale); .getDisplayName(displayLocale);
@ -246,7 +243,7 @@ public final class SubtypeLocaleUtils {
// TODO: rework this for multi-lingual subtypes // TODO: rework this for multi-lingual subtypes
final int nameResId = subtype.getNameResId(); final int nameResId = subtype.getNameResId();
return RunInLocaleKt.runInLocale(sResources, displayLocale, return RunInLocaleKt.runInLocale(sResources, displayLocale,
(Function1<Resources, String>) res -> { res -> {
try { try {
return StringUtils.capitalizeFirstCodePoint(res.getString(nameResId, replacementString), displayLocale); return StringUtils.capitalizeFirstCodePoint(res.getString(nameResId, replacementString), displayLocale);
} catch (Resources.NotFoundException e) { } catch (Resources.NotFoundException e) {