Drop support for Android versions below 3.0

Android 3.0 (API level 11) was released in Feb 2011.

These versions were already unsupported due to unavoidable calls to:
- MotionEvent.getActionMasked() (API 8)

And avoidable calls to:
- SharedPreferences.Editor.putStringSet() (API 11)
This commit is contained in:
Jules Aguillon 2024-02-10 17:24:15 +01:00
parent 93d8af4505
commit 332413ed3c
4 changed files with 6 additions and 16 deletions

View File

@ -8,7 +8,7 @@ android {
defaultConfig { defaultConfig {
applicationId "juloo.keyboard2" applicationId "juloo.keyboard2"
minSdk 4 minSdk 11
targetSdkVersion 33 targetSdkVersion 33
versionCode 38 versionCode 38
versionName "1.26.0" versionName "1.26.0"

View File

@ -3,7 +3,6 @@ package juloo.keyboard2;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.content.res.Resources; import android.content.res.Resources;
import android.os.Build;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.KeyEvent; import android.view.KeyEvent;
@ -358,12 +357,9 @@ public final class Config
case "jungle": return R.style.Jungle; case "jungle": return R.style.Jungle;
default: default:
case "system": case "system":
if (Build.VERSION.SDK_INT >= 8) int night_mode = res.getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
{ if ((night_mode & Configuration.UI_MODE_NIGHT_NO) != 0)
int night_mode = res.getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; return R.style.Light;
if ((night_mode & Configuration.UI_MODE_NIGHT_NO) != 0)
return R.style.Light;
}
return R.style.Dark; return R.style.Dark;
} }
} }

View File

@ -1,7 +1,6 @@
package juloo.keyboard2; package juloo.keyboard2;
import android.content.Context; import android.content.Context;
import android.os.Build.VERSION;
import android.os.Vibrator; import android.os.Vibrator;
import android.view.HapticFeedbackConstants; import android.view.HapticFeedbackConstants;
import android.view.View; import android.view.View;
@ -17,9 +16,8 @@ public final class VibratorCompat
} }
else else
{ {
if (VERSION.SDK_INT >= 8) v.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP,
v.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
} }
} }

View File

@ -27,8 +27,6 @@ class VoiceImeSwitcher
public static boolean switch_to_voice_ime(InputMethodService ims, public static boolean switch_to_voice_ime(InputMethodService ims,
InputMethodManager imm, SharedPreferences prefs) InputMethodManager imm, SharedPreferences prefs)
{ {
if (VERSION.SDK_INT < 11) // Due to InputMethodSubtype
return false;
List<IME> imes = get_voice_ime_list(imm); List<IME> imes = get_voice_ime_list(imm);
String last_used = prefs.getString(PREF_LAST_USED, null); String last_used = prefs.getString(PREF_LAST_USED, null);
String last_known_imes = prefs.getString(PREF_KNOWN_IMES, null); String last_known_imes = prefs.getString(PREF_KNOWN_IMES, null);
@ -46,8 +44,6 @@ class VoiceImeSwitcher
public static boolean choose_voice_ime(InputMethodService ims, public static boolean choose_voice_ime(InputMethodService ims,
InputMethodManager imm, SharedPreferences prefs) InputMethodManager imm, SharedPreferences prefs)
{ {
if (VERSION.SDK_INT < 11) // Due to InputMethodSubtype
return false;
List<IME> imes = get_voice_ime_list(imm); List<IME> imes = get_voice_ime_list(imm);
choose_voice_ime_and_update_prefs(ims, prefs, imes); choose_voice_ime_and_update_prefs(ims, prefs, imes);
return true; return true;