1
0
Fork 0

code cleanup

This commit is contained in:
sspanak 2025-03-03 13:35:18 +02:00 committed by Dimo Karaivanov
parent 6cff3dd25b
commit 996b025d1e
6 changed files with 6 additions and 9 deletions

View file

@ -120,5 +120,4 @@ abstract public class Predictions {
abstract public void onAccept(String word, String sequence); abstract public void onAccept(String word, String sequence);
abstract protected boolean isRetryAllowed(); abstract protected boolean isRetryAllowed();
abstract protected void onDbWords(ArrayList<String> dbWords, boolean retryAllowed); abstract protected void onDbWords(ArrayList<String> dbWords, boolean retryAllowed);
abstract protected ArrayList<String> generateWordVariations(String baseWord);
} }

View file

@ -83,7 +83,6 @@ public class SyllablePredictions extends Predictions {
} }
@Override
protected ArrayList<String> generateWordVariations(String baseWord) { protected ArrayList<String> generateWordVariations(String baseWord) {
baseWord = baseWord == null ? "" : baseWord; baseWord = baseWord == null ? "" : baseWord;
ArrayList<String> variants = new ArrayList<>(); ArrayList<String> variants = new ArrayList<>();

View file

@ -41,7 +41,7 @@ public class PreferencesActivity extends ActivityWithNavigation implements Prefe
/** /**
* onBackPressed() is deprecated, so calling the onBackPressed() on the Fragments is now more complicated. * onBackPressed() is deprecated, so calling the onBackPressed() on the Fragments is now more complicated.
*/ */
@NonNull public OnBackPressedCallback onBackPressedCallback = new OnBackPressedCallback(true) { @NonNull public final OnBackPressedCallback onBackPressedCallback = new OnBackPressedCallback(true) {
@Override @Override
public void handleOnBackPressed() { public void handleOnBackPressed() {
Fragment previousFragment = getSupportFragmentManager().findFragmentById(R.id.preferences_container); Fragment previousFragment = getSupportFragmentManager().findFragmentById(R.id.preferences_container);

View file

@ -11,7 +11,7 @@ import io.github.sspanak.tt9.preferences.settings.SettingsStore;
public class HotkeysScreen extends BaseScreenFragment { public class HotkeysScreen extends BaseScreenFragment {
public static final String NAME = "Hotkeys"; public static final String NAME = "Hotkeys";
@NonNull static HashMap<String, PreferenceHotkey> hotkeys = new HashMap<>(); @NonNull static final HashMap<String, PreferenceHotkey> hotkeys = new HashMap<>();
public HotkeysScreen() { init(); } public HotkeysScreen() { init(); }

View file

@ -65,7 +65,8 @@ abstract class BaseMainLayout {
protected WindowInsets onApplyInsets(@NonNull View v, @NonNull WindowInsets windowInsets) { protected WindowInsets onApplyInsets(@NonNull View v, @NonNull WindowInsets windowInsets) {
if (DeviceInfo.AT_LEAST_ANDROID_15) { if (DeviceInfo.AT_LEAST_ANDROID_15) {
return preventEdgeToEdge(v, windowInsets); preventEdgeToEdge(v, windowInsets);
return WindowInsets.CONSUMED;
} else { } else {
return windowInsets; return windowInsets;
} }
@ -77,7 +78,7 @@ abstract class BaseMainLayout {
* the bottom of the View will be cut off by the system navigation bar. * the bottom of the View will be cut off by the system navigation bar.
*/ */
@RequiresApi(api = Build.VERSION_CODES.VANILLA_ICE_CREAM) @RequiresApi(api = Build.VERSION_CODES.VANILLA_ICE_CREAM)
protected WindowInsets preventEdgeToEdge(@NonNull View v, @NonNull WindowInsets windowInsets) { protected void preventEdgeToEdge(@NonNull View v, @NonNull WindowInsets windowInsets) {
Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars()); Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars());
v.setPadding(insets.left, 0, insets.right, insets.bottom); v.setPadding(insets.left, 0, insets.right, insets.bottom);
@ -90,8 +91,6 @@ abstract class BaseMainLayout {
e2ePaddingBottomPortrait = insets.bottom; e2ePaddingBottomPortrait = insets.bottom;
} }
} }
return WindowInsets.CONSUMED;
} }

View file

@ -75,7 +75,7 @@ public class SystemSettings {
/** /**
* Even though the background changes automatically on Android 15, thanks to edge-to-edge, * Even though the background changes automatically on Android 15, thanks to edge-to-edge,
* the text/icon color remains the device default. This function allows us to change it. * the text/icon color remains the device default. This function allows us to change it.
* @see : <a href="https://stackoverflow.com/a/77240330">the only working solution</a>. * @see: <a href="https://stackoverflow.com/a/77240330">the only working solution</a>.
*/ */
public static void setNavigationBarDarkTheme(@Nullable Window window, boolean dark) { public static void setNavigationBarDarkTheme(@Nullable Window window, boolean dark) {
if (!DeviceInfo.AT_LEAST_ANDROID_11) { if (!DeviceInfo.AT_LEAST_ANDROID_11) {