Skip to content

Commit

Permalink
Added support for Android 14. Libraries update. Fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreyPavlenko committed Oct 7, 2023
1 parent 4345a93 commit 17db2f0
Show file tree
Hide file tree
Showing 32 changed files with 378 additions and 294 deletions.
12 changes: 6 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
ext {
def abi = project.properties['ABI']
VERSION_CODE = 227
VERSION_NAME = "1.9.4"
VERSION_CODE = 232
VERSION_NAME = "1.9.5"
SDK_MIN_VERSION = 23
SDK_TARGET_VERSION = 34
SDK_COMPILE_VERSION = 34
BUILD_TOOLS_VERSION = "33.0.1"
ABI_FILTERS = (abi != null) ? abi.split(",") : ['arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64']
localProps = gradle.ext.localProps

ANDROID_MATERIAL_VERSION = '1.9.0'
ANDROID_MATERIAL_VERSION = '1.10.0'
ANDROID_PLAY_CORE_VERSION = '1.10.3'
ANDROIDX_CORE_VERSION = '1.3.2'
ANDROIDX_CORE_VERSION = '1.12.0'
ANDROIDX_MEDIA_VERSION = '1.6.0'
ANDROIDX_APPCOMPAT_VERSION = '1.6.1'
ANDROIDX_CONSTRAINTLAYOUT_VERSION = '2.1.4'
Expand All @@ -27,8 +27,8 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:8.1.1'
classpath 'com.google.gms:google-services:4.3.15'
classpath 'com.android.tools.build:gradle:8.1.2'
classpath 'com.google.gms:google-services:4.4.0'
}
}

Expand Down
4 changes: 2 additions & 2 deletions fermata/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
<uses-permission
android:name="android.permission.WRITE_SETTINGS"
tools:ignore="ProtectedPermissions" />
Expand Down Expand Up @@ -61,8 +62,7 @@
android:requestLegacyExternalStorage="true"
android:supportsRtl="true"
android:theme="@style/AppTheme.Dark"
android:usesCleartextTraffic="true"
tools:targetApi="TIRAMISU">
android:usesCleartextTraffic="true">

<meta-data
android:name="com.google.android.gms.car.application"
Expand Down
2 changes: 2 additions & 0 deletions fermata/src/main/java/me/aap/fermata/action/Action.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@

import java.util.List;

import me.aap.fermata.BuildConfig;
import me.aap.fermata.R;
import me.aap.fermata.media.service.MediaSessionCallback;
import me.aap.fermata.ui.activity.MainActivityDelegate;
import me.aap.utils.app.App;
import me.aap.utils.log.Log;
import me.aap.utils.ui.activity.ActivityDelegate;

/**
Expand Down
56 changes: 29 additions & 27 deletions fermata/src/main/java/me/aap/fermata/action/Key.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@ public enum Key {
MEDIA_NEXT(KeyEvent.KEYCODE_MEDIA_NEXT, Action.NEXT),
MEDIA_REWIND(KeyEvent.KEYCODE_MEDIA_REWIND, Action.RW, Action.RW, Action.RW),
MEDIA_FAST_FORWARD(KeyEvent.KEYCODE_MEDIA_FAST_FORWARD, Action.FF, Action.FF, Action.FF),
VOLUME_UP(KeyEvent.KEYCODE_VOLUME_UP, Action.VOLUME_UP),
VOLUME_DOWN(KeyEvent.KEYCODE_VOLUME_DOWN, Action.VOLUME_DOWN),
HEADSETHOOK(KeyEvent.KEYCODE_HEADSETHOOK, Action.PLAY_PAUSE, Action.NEXT,
VOLUME_UP(KeyEvent.KEYCODE_VOLUME_UP, Action.VOLUME_UP, Action.VOLUME_UP, Action.VOLUME_UP),
VOLUME_DOWN(KeyEvent.KEYCODE_VOLUME_DOWN, Action.VOLUME_DOWN, Action.VOLUME_DOWN,
Action.VOLUME_DOWN),
HEADSETHOOK(KeyEvent.KEYCODE_HEADSETHOOK, Action.PLAY_PAUSE, Action.STOP,
Action.ACTIVATE_VOICE_CTRL),
SEARCH(KeyEvent.KEYCODE_SEARCH, Action.ACTIVATE_VOICE_CTRL),
BACK(KeyEvent.KEYCODE_BACK, Action.BACK_OR_EXIT, Action.NONE, Action.NONE),
BACK(KeyEvent.KEYCODE_BACK, Action.BACK_OR_EXIT),
ESCAPE(KeyEvent.KEYCODE_ESCAPE, Action.BACK_OR_EXIT),
DEL(KeyEvent.KEYCODE_DEL, Action.STOP),
MENU(KeyEvent.KEYCODE_MENU, Action.MENU, Action.CP_MENU, Action.CP_MENU),
Expand All @@ -57,25 +58,25 @@ public enum Key {
private final PreferenceStore.Pref<IntSupplier> dblActionPref;
private final PreferenceStore.Pref<IntSupplier> longActionPref;
@Nullable
private Action.Handler clickHandler;
private Action clickAction;
@Nullable
private Action.Handler dblClickHandler;
private Action dblClickAction;
@Nullable
private Action.Handler longClickHandler;
private Action longClickAction;

Key(int code, Action action) {
this(code, action, action, action);
this(code, action, Action.NONE, Action.NONE);
}

Key(int code, Action action, Action dblAction, Action longAction) {
Key(int code, Action clickAction, Action dblClickAction, Action longClickAction) {
this.code = code;
var name = name();
media = name.startsWith("MEDIA_") || name.startsWith("VOLUME_");
actionPref =
PreferenceStore.Pref.i("KEY_ACTION_" + name, action.ordinal()).withInheritance(false);
dblActionPref = PreferenceStore.Pref.i("KEY_ACTION_DBL_" + name, dblAction.ordinal())
PreferenceStore.Pref.i("KEY_ACTION_" + name, clickAction.ordinal()).withInheritance(false);
dblActionPref = PreferenceStore.Pref.i("KEY_ACTION_DBL_" + name, dblClickAction.ordinal())
.withInheritance(false);
longActionPref = PreferenceStore.Pref.i("KEY_ACTION_LONG_" + name, longAction.ordinal())
longActionPref = PreferenceStore.Pref.i("KEY_ACTION_LONG_" + name, longClickAction.ordinal())
.withInheritance(false);
}

Expand Down Expand Up @@ -105,24 +106,25 @@ public PreferenceStore.Pref<IntSupplier> getLongActionPref() {
}

@Nullable
public Action.Handler getClickHandler() {
if (clickHandler != null) return clickHandler;
var a = Action.get(getPrefs().getIntPref(actionPref));
return (a == null) ? null : (clickHandler = a.getHandler());
public Action getClickAction() {
if (clickAction != null) return clickAction;
return Action.get(getPrefs().getIntPref(actionPref));
}

@Nullable
public Action.Handler getDblClickHandler() {
if (dblClickHandler != null) return dblClickHandler;
var a = Action.get(getPrefs().getIntPref(dblActionPref));
return (a == null) ? null : (dblClickHandler = a.getHandler());
public Action getDblClickAction() {
if (dblClickAction != null) return dblClickAction;
return Action.get(getPrefs().getIntPref(dblActionPref));
}

@Nullable
public Action.Handler getLongClickHandler() {
if (longClickHandler != null) return longClickHandler;
var a = Action.get(getPrefs().getIntPref(longActionPref));
return (a == null) ? null : (longClickHandler = a.getHandler());
public Action getLongClickAction() {
if (longClickAction != null) return longClickAction;
return Action.get(getPrefs().getIntPref(longActionPref));
}

public int getCode() {
return code;
}

public boolean isMedia() {
Expand All @@ -136,9 +138,9 @@ public void onPreferenceChanged(PreferenceStore store, List<PreferenceStore.Pref
for (var p : prefs) {
if (p.getName().startsWith("KEY_ACTION_")) {
for (var k : Key.all) {
k.clickHandler = null;
k.dblClickHandler = null;
k.longClickHandler = null;
k.clickAction = null;
k.dblClickAction = null;
k.longClickAction = null;
}
return;
}
Expand Down
Loading

0 comments on commit 17db2f0

Please sign in to comment.