dependency updates and compatibility fixes

This commit is contained in:
dkanada 2022-08-27 10:10:34 +09:00
commit fb3102c06b
16 changed files with 57 additions and 47 deletions

View file

@ -2,11 +2,11 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 30
compileSdkVersion 32
defaultConfig {
minSdkVersion 19
targetSdkVersion 30
targetSdkVersion 32
versionCode 16
versionName '1.3.3'
@ -44,7 +44,7 @@ android {
viewBinding true
}
lintOptions {
lint {
disable 'MissingTranslation'
abortOnError false
}
@ -52,33 +52,33 @@ android {
compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
}
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.21'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.1'
implementation 'com.github.jellyfin.jellyfin-apiclient-java:android:0.7.3'
implementation 'com.github.woltapp:blurhash:f41a23cc50'
implementation 'com.google.android.exoplayer:exoplayer:2.12.2'
implementation 'com.google.android.material:material:1.4.0'
implementation 'com.google.android.exoplayer:exoplayer:2.14.2'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.media:media:1.4.1'
implementation 'androidx.fragment:fragment-ktx:1.3.6'
implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.media:media:1.6.0'
implementation 'androidx.fragment:fragment-ktx:1.5.2'
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.appcompat:appcompat:1.5.0'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.palette:palette-ktx:1.0.0'
implementation 'androidx.annotation:annotation:1.2.0'
implementation 'androidx.annotation:annotation:1.4.0'
implementation 'androidx.percentlayout:percentlayout:1.0.0'
implementation 'androidx.preference:preference-ktx:1.1.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
implementation 'androidx.preference:preference-ktx:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.github.kabouzeid:RecyclerView-FastScroll:1.0.16-kmod'
implementation 'com.github.kabouzeid:SeekArc:1.2-kmod'
@ -101,8 +101,8 @@ dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
annotationProcessor 'androidx.room:room-compiler:2.3.0'
implementation 'androidx.room:room-runtime:2.3.0'
annotationProcessor 'androidx.room:room-compiler:2.4.3'
implementation 'androidx.room:room-runtime:2.4.3'
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
implementation 'com.github.bumptech.glide:annotations:4.12.0'

View file

@ -30,7 +30,7 @@
<activity android:name=".activities.details.GenreDetailActivity" />
<activity android:name=".activities.details.PlaylistDetailActivity" />
<activity android:name=".activities.SearchActivity" />
<activity android:name=".activities.SplashActivity">
<activity android:name=".activities.SplashActivity" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.MUSIC_PLAYER" />
@ -70,7 +70,7 @@
<service android:name=".service.LoginService" />
<service android:name=".service.MusicService" />
<receiver android:name=".service.receivers.MediaButtonIntentReceiver">
<receiver android:name=".service.receivers.MediaButtonIntentReceiver" android:exported="false">
<intent-filter>
<action android:name="android.intent.action.MEDIA_BUTTON" />
</intent-filter>
@ -83,7 +83,7 @@
android:name="com.lge.support.SPLIT_WINDOW"
android:value="true" />
<receiver android:name=".views.widgets.BootReceiver">
<receiver android:name=".views.widgets.BootReceiver" android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />

View file

@ -95,9 +95,18 @@ public class SettingsActivity extends AbsBaseActivity {
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.Q) {
downloadLocationPreference.setEnabled(false);
// stock Android 11 removed the album cover on lock screens
// supported on LineageOS so we might want to add a check at some point
showAlbumCoverPreference.setEnabled(false);
}
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.R) {
// custom notification layouts were removed entirely in Android 12
classicNotification.setEnabled(false);
coloredNotification.setEnabled(false);
}
categoryPreference.setOnPreferenceClickListener(preference -> {
CategoryPreferenceDialog.create().show(getParentFragmentManager(), CategoryPreferenceDialog.TAG);
return false;

View file

@ -55,7 +55,7 @@ public class SleepTimerDialog extends DialogFragment {
final int minutes = seekArcProgress;
PendingIntent pi = makeTimerPendingIntent(PendingIntent.FLAG_CANCEL_CURRENT);
PendingIntent pi = makeTimerPendingIntent(PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_IMMUTABLE);
final long nextSleepTimerElapsedTime = SystemClock.elapsedRealtime() + minutes * 60 * 1000;
PreferenceUtil.getInstance(getActivity()).setNextSleepTimerElapsedRealtime(nextSleepTimerElapsedTime);
@ -65,7 +65,7 @@ public class SleepTimerDialog extends DialogFragment {
Toast.makeText(getActivity(), requireActivity().getResources().getString(R.string.sleep_timer_set, minutes), Toast.LENGTH_SHORT).show();
})
.onNeutral((dialog, which) -> {
final PendingIntent previous = makeTimerPendingIntent(PendingIntent.FLAG_NO_CREATE);
final PendingIntent previous = makeTimerPendingIntent(PendingIntent.FLAG_NO_CREATE | PendingIntent.FLAG_IMMUTABLE);
if (previous != null) {
AlarmManager am = (AlarmManager) requireActivity().getSystemService(Context.ALARM_SERVICE);
am.cancel(previous);
@ -80,7 +80,7 @@ public class SleepTimerDialog extends DialogFragment {
}
})
.showListener(dialog -> {
if (makeTimerPendingIntent(PendingIntent.FLAG_NO_CREATE) != null) {
if (makeTimerPendingIntent(PendingIntent.FLAG_NO_CREATE | PendingIntent.FLAG_IMMUTABLE) != null) {
timerUpdater.start();
}
})

View file

@ -269,7 +269,7 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON);
mediaButtonIntent.setComponent(mediaButtonReceiverComponentName);
PendingIntent mediaButtonReceiverPendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, mediaButtonIntent, 0);
PendingIntent mediaButtonReceiverPendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, mediaButtonIntent, PendingIntent.FLAG_IMMUTABLE);
mediaSession = new MediaSessionCompat(this, getResources().getString(R.string.app_name), mediaButtonReceiverComponentName, mediaButtonReceiverPendingIntent);
mediaSession.setCallback(new MediaSessionCompat.Callback() {

View file

@ -53,10 +53,10 @@ public class DownloadNotification {
this.maximum += maximum;
Intent action = new Intent(context, MainActivity.class).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent clickIntent = PendingIntent.getActivity(context, 0, action, 0);
PendingIntent clickIntent = PendingIntent.getActivity(context, 0, action, PendingIntent.FLAG_IMMUTABLE);
Intent cancel = new Intent(context, DownloadService.class).setAction(DownloadService.ACTION_CANCEL);
PendingIntent pendingCancel = PendingIntent.getService(context, 0, cancel, 0);
PendingIntent pendingCancel = PendingIntent.getService(context, 0, cancel, PendingIntent.FLAG_IMMUTABLE);
NotificationCompat.InboxStyle style = new NotificationCompat.InboxStyle();
for (Song item : songs.stream().limit(5).collect(Collectors.toList())) {

View file

@ -66,7 +66,7 @@ public class PlayingNotificationMarshmallow extends PlayingNotification {
Intent action = new Intent(service, MainActivity.class);
action.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
final PendingIntent clickIntent = PendingIntent.getActivity(service, 0, action, 0);
final PendingIntent clickIntent = PendingIntent.getActivity(service, 0, action, PendingIntent.FLAG_IMMUTABLE);
final PendingIntent deleteIntent = buildPendingIntent(service, MusicService.ACTION_QUIT, null);
final Notification notification = new NotificationCompat.Builder(service, NOTIFICATION_CHANNEL_ID)
@ -185,6 +185,6 @@ public class PlayingNotificationMarshmallow extends PlayingNotification {
Intent intent = new Intent(action);
intent.setComponent(serviceName);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
return PendingIntent.getService(context, 0, intent, 0);
return PendingIntent.getService(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);
}
}

View file

@ -41,12 +41,12 @@ public class PlayingNotificationNougat extends PlayingNotification {
Intent action = new Intent(service, MainActivity.class);
action.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
final PendingIntent clickIntent = PendingIntent.getActivity(service, 0, action, 0);
final PendingIntent clickIntent = PendingIntent.getActivity(service, 0, action, PendingIntent.FLAG_IMMUTABLE);
final ComponentName serviceName = new ComponentName(service, MusicService.class);
Intent intent = new Intent(MusicService.ACTION_QUIT);
intent.setComponent(serviceName);
final PendingIntent deleteIntent = PendingIntent.getService(service, 0, intent, 0);
final PendingIntent deleteIntent = PendingIntent.getService(service, 0, intent, PendingIntent.FLAG_IMMUTABLE);
final int bigNotificationImageSize = service.getResources().getDimensionPixelSize(R.dimen.notification_big_image_size);
service.runOnUiThread(() -> CustomGlideRequest.Builder
@ -114,6 +114,6 @@ public class PlayingNotificationNougat extends PlayingNotification {
Intent intent = new Intent(action);
intent.setComponent(serviceName);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
return PendingIntent.getService(service, 0, intent, 0);
return PendingIntent.getService(service, 0, intent, PendingIntent.FLAG_IMMUTABLE);
}
}

View file

@ -101,6 +101,7 @@ public class LocalPlayer implements Playback {
.build();
exoPlayer.addListener(eventListener);
exoPlayer.setThrowsWhenUsingWrongThread(false);
exoPlayer.prepare();
long cacheSize = PreferenceUtil.getInstance(context).getMediaCacheSize();

View file

@ -227,11 +227,11 @@ public final class PreferenceUtil {
}
public final boolean getColoredNotification() {
return mPreferences.getBoolean(COLORED_NOTIFICATION, true);
return mPreferences.getBoolean(COLORED_NOTIFICATION, false);
}
public final boolean getClassicNotification() {
return mPreferences.getBoolean(CLASSIC_NOTIFICATION, Build.VERSION.SDK_INT <= Build.VERSION_CODES.O);
return mPreferences.getBoolean(CLASSIC_NOTIFICATION, false);
}
public final boolean getColoredShortcuts() {
@ -255,11 +255,11 @@ public final class PreferenceUtil {
}
public final boolean getShowAlbumCover() {
return mPreferences.getBoolean(SHOW_ALBUM_COVER, true);
return mPreferences.getBoolean(SHOW_ALBUM_COVER, false);
}
public final boolean getBlurAlbumCover() {
return mPreferences.getBoolean(BLUR_ALBUM_COVER, true);
return mPreferences.getBoolean(BLUR_ALBUM_COVER, false);
}
public final SortOrder getAlbumSortOrder() {

View file

@ -83,7 +83,7 @@ public abstract class BaseAppWidget extends AppWidgetProvider {
ComponentName serviceName = new ComponentName(context, MusicService.class);
Intent action = new Intent(context, MainActivity.class);
PendingIntent open = PendingIntent.getActivity(context, 0, action, 0);
PendingIntent open = PendingIntent.getActivity(context, 0, action, PendingIntent.FLAG_IMMUTABLE);
for (int id : clickableViews) {
views.setOnClickPendingIntent(id, open);
@ -104,9 +104,9 @@ public abstract class BaseAppWidget extends AppWidgetProvider {
intent.setComponent(serviceName);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
return PendingIntent.getForegroundService(context, 0, intent, 0);
return PendingIntent.getForegroundService(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);
} else {
return PendingIntent.getService(context, 0, intent, 0);
return PendingIntent.getService(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);
}
}

View file

@ -5,14 +5,14 @@
<SwitchPreference
app:iconSpaceReserved="false"
android:defaultValue="true"
android:defaultValue="false"
android:key="show_album_cover"
android:summary="@string/pref_summary_show_album_art"
android:title="@string/pref_title_show_album_art" />
<SwitchPreference
app:iconSpaceReserved="false"
android:defaultValue="true"
android:defaultValue="false"
android:dependency="show_album_cover"
android:key="blur_album_cover"
android:summary="@string/pref_summary_blur_album_art"

View file

@ -5,14 +5,14 @@
<SwitchPreference
app:iconSpaceReserved="false"
android:defaultValue="true"
android:defaultValue="false"
android:key="classic_notification"
android:summary="@string/pref_summary_classic_notification"
android:title="@string/pref_title_classic_notification" />
<SwitchPreference
app:iconSpaceReserved="false"
android:defaultValue="true"
android:defaultValue="false"
android:key="colored_notification"
android:summary="@string/pref_summary_colored_notification"
android:title="@string/pref_title_colored_notification" />