build: upgrade deps

Upgrade dependencies

AGP -> 7.2.2
Activity -> 2.5.1
Fragment -> 2.5.1
Lifecycle -> 2.5.1
Navigation -> 2.5.1
This commit is contained in:
OxygenCobalt 2022-08-04 11:52:57 -06:00
parent 85eb4cad6c
commit f6429a878a
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
11 changed files with 79 additions and 58 deletions

View file

@ -17,7 +17,7 @@ android {
// API 33 is still busted, waiting until the XML element issue is fixed // API 33 is still busted, waiting until the XML element issue is fixed
// noinspection OldTargetApi // noinspection OldTargetApi
minSdk 21 minSdk 21
targetSdk 32 targetSdk 33
buildFeatures { buildFeatures {
viewBinding true viewBinding true
@ -70,8 +70,8 @@ dependencies {
// General // General
implementation "androidx.core:core-ktx:1.8.0" implementation "androidx.core:core-ktx:1.8.0"
implementation "androidx.activity:activity-ktx:1.5.0" implementation "androidx.activity:activity-ktx:1.5.1"
implementation "androidx.fragment:fragment-ktx:1.5.0" implementation "androidx.fragment:fragment-ktx:1.5.1"
// UI // UI
implementation "androidx.recyclerview:recyclerview:1.2.1" implementation "androidx.recyclerview:recyclerview:1.2.1"
@ -79,7 +79,7 @@ dependencies {
implementation "androidx.viewpager2:viewpager2:1.1.0-beta01" implementation "androidx.viewpager2:viewpager2:1.1.0-beta01"
// Lifecycle // Lifecycle
def lifecycle_version = "2.5.0" def lifecycle_version = "2.5.1"
implementation "androidx.lifecycle:lifecycle-common:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-common:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"

View file

@ -46,9 +46,8 @@ class AuxioApp : Application(), ImageLoaderFactory {
.setLongLabel(getString(R.string.lbl_shuffle_shortcut_long)) .setLongLabel(getString(R.string.lbl_shuffle_shortcut_long))
.setIcon(IconCompat.createWithResource(this, R.drawable.ic_shortcut_shuffle_24)) .setIcon(IconCompat.createWithResource(this, R.drawable.ic_shortcut_shuffle_24))
.setIntent( .setIntent(
Intent(this, MainActivity::class.java).apply { Intent(this, MainActivity::class.java)
action = INTENT_KEY_SHORTCUT_SHUFFLE .setAction(INTENT_KEY_SHORTCUT_SHUFFLE))
})
.build())) .build()))
} }

View file

@ -44,8 +44,6 @@ import org.oxycblt.auxio.util.systemBarInsetsCompat
* *
* TODO: Add multi-select * TODO: Add multi-select
* *
* TODO: Find better way to handler recycler divider visibility
*
* @author OxygenCobalt * @author OxygenCobalt
*/ */
class MainActivity : AppCompatActivity() { class MainActivity : AppCompatActivity() {

View file

@ -22,12 +22,13 @@ import android.view.LayoutInflater
import android.view.ViewTreeObserver import android.view.ViewTreeObserver
import android.view.WindowInsets import android.view.WindowInsets
import androidx.activity.OnBackPressedCallback import androidx.activity.OnBackPressedCallback
import androidx.core.view.ViewCompat
import androidx.core.view.isInvisible import androidx.core.view.isInvisible
import androidx.core.view.updatePadding import androidx.core.view.updatePadding
import androidx.fragment.app.activityViewModels import androidx.fragment.app.activityViewModels
import androidx.navigation.findNavController import androidx.navigation.findNavController
import androidx.navigation.fragment.findNavController import androidx.navigation.fragment.findNavController
import com.google.android.material.bottomsheet.BottomSheetBehavior import com.google.android.material.bottomsheet.NeoBottomSheetBehavior
import com.google.android.material.shape.MaterialShapeDrawable import com.google.android.material.shape.MaterialShapeDrawable
import com.google.android.material.transition.MaterialFadeThrough import com.google.android.material.transition.MaterialFadeThrough
import kotlin.math.max import kotlin.math.max
@ -74,14 +75,20 @@ class MainFragment :
insets insets
} }
val playbackSheetBehavior = // Send meaningful accessibility events for bottom sheets
binding.playbackSheet.coordinatorLayoutBehavior as PlaybackSheetBehavior ViewCompat.setAccessibilityPaneTitle(
binding.playbackSheet, getString(R.string.lbl_playback))
ViewCompat.setAccessibilityPaneTitle(binding.queueSheet, getString(R.string.lbl_queue))
val queueSheetBehavior = binding.queueSheet.coordinatorLayoutBehavior as QueueSheetBehavior? val queueSheetBehavior = binding.queueSheet.coordinatorLayoutBehavior as QueueSheetBehavior?
if (queueSheetBehavior != null) { if (queueSheetBehavior != null) {
val playbackSheetBehavior =
binding.playbackSheet.coordinatorLayoutBehavior as PlaybackSheetBehavior
unlikelyToBeNull(binding.handleWrapper).setOnClickListener { unlikelyToBeNull(binding.handleWrapper).setOnClickListener {
if (playbackSheetBehavior.state == BottomSheetBehavior.STATE_EXPANDED && if (playbackSheetBehavior.state == NeoBottomSheetBehavior.STATE_EXPANDED &&
queueSheetBehavior.state == BottomSheetBehavior.STATE_COLLAPSED) { queueSheetBehavior.state == NeoBottomSheetBehavior.STATE_COLLAPSED) {
queueSheetBehavior.state = BottomSheetBehavior.STATE_EXPANDED queueSheetBehavior.state = NeoBottomSheetBehavior.STATE_EXPANDED
} }
} }
} else { } else {
@ -161,7 +168,7 @@ class MainFragment :
if (playbackModel.song.value != null) { if (playbackModel.song.value != null) {
// Hack around the playback sheet intercepting swipe events on the queue bar // Hack around the playback sheet intercepting swipe events on the queue bar
playbackSheetBehavior.isDraggable = playbackSheetBehavior.isDraggable =
queueSheetBehavior.state == BottomSheetBehavior.STATE_COLLAPSED queueSheetBehavior.state == NeoBottomSheetBehavior.STATE_COLLAPSED
} }
} else { } else {
// No queue sheet, fade normally based on the playback sheet // No queue sheet, fade normally based on the playback sheet
@ -233,9 +240,9 @@ class MainFragment :
val playbackSheetBehavior = val playbackSheetBehavior =
binding.playbackSheet.coordinatorLayoutBehavior as PlaybackSheetBehavior binding.playbackSheet.coordinatorLayoutBehavior as PlaybackSheetBehavior
if (playbackSheetBehavior.state == BottomSheetBehavior.STATE_COLLAPSED) { if (playbackSheetBehavior.state == NeoBottomSheetBehavior.STATE_COLLAPSED) {
// State is collapsed and non-hidden, expand // State is collapsed and non-hidden, expand
playbackSheetBehavior.state = BottomSheetBehavior.STATE_EXPANDED playbackSheetBehavior.state = NeoBottomSheetBehavior.STATE_EXPANDED
} }
} }
@ -244,13 +251,13 @@ class MainFragment :
val playbackSheetBehavior = val playbackSheetBehavior =
binding.playbackSheet.coordinatorLayoutBehavior as PlaybackSheetBehavior binding.playbackSheet.coordinatorLayoutBehavior as PlaybackSheetBehavior
if (playbackSheetBehavior.state == BottomSheetBehavior.STATE_EXPANDED) { if (playbackSheetBehavior.state == NeoBottomSheetBehavior.STATE_EXPANDED) {
// Make sure the queue is also collapsed here. // Make sure the queue is also collapsed here.
val queueSheetBehavior = val queueSheetBehavior =
binding.queueSheet.coordinatorLayoutBehavior as QueueSheetBehavior? binding.queueSheet.coordinatorLayoutBehavior as QueueSheetBehavior?
playbackSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED playbackSheetBehavior.state = NeoBottomSheetBehavior.STATE_COLLAPSED
queueSheetBehavior?.state = BottomSheetBehavior.STATE_COLLAPSED queueSheetBehavior?.state = NeoBottomSheetBehavior.STATE_COLLAPSED
} }
} }
@ -259,7 +266,7 @@ class MainFragment :
val playbackSheetBehavior = val playbackSheetBehavior =
binding.playbackSheet.coordinatorLayoutBehavior as PlaybackSheetBehavior binding.playbackSheet.coordinatorLayoutBehavior as PlaybackSheetBehavior
if (playbackSheetBehavior.state == BottomSheetBehavior.STATE_HIDDEN) { if (playbackSheetBehavior.state == NeoBottomSheetBehavior.STATE_HIDDEN) {
val queueSheetBehavior = val queueSheetBehavior =
binding.queueSheet.coordinatorLayoutBehavior as QueueSheetBehavior? binding.queueSheet.coordinatorLayoutBehavior as QueueSheetBehavior?
@ -269,7 +276,7 @@ class MainFragment :
playbackSheetBehavior.apply { playbackSheetBehavior.apply {
// Make sure the view is draggable, at least until the draw checks kick in. // Make sure the view is draggable, at least until the draw checks kick in.
isDraggable = true isDraggable = true
state = BottomSheetBehavior.STATE_COLLAPSED state = NeoBottomSheetBehavior.STATE_COLLAPSED
} }
} }
} }
@ -279,7 +286,7 @@ class MainFragment :
val playbackSheetBehavior = val playbackSheetBehavior =
binding.playbackSheet.coordinatorLayoutBehavior as PlaybackSheetBehavior binding.playbackSheet.coordinatorLayoutBehavior as PlaybackSheetBehavior
if (playbackSheetBehavior.state != BottomSheetBehavior.STATE_HIDDEN) { if (playbackSheetBehavior.state != NeoBottomSheetBehavior.STATE_HIDDEN) {
val queueSheetBehavior = val queueSheetBehavior =
binding.queueSheet.coordinatorLayoutBehavior as QueueSheetBehavior? binding.queueSheet.coordinatorLayoutBehavior as QueueSheetBehavior?
@ -287,12 +294,12 @@ class MainFragment :
queueSheetBehavior?.apply { queueSheetBehavior?.apply {
isDraggable = false isDraggable = false
state = BottomSheetBehavior.STATE_COLLAPSED state = NeoBottomSheetBehavior.STATE_COLLAPSED
} }
playbackSheetBehavior.apply { playbackSheetBehavior.apply {
isDraggable = false isDraggable = false
state = BottomSheetBehavior.STATE_HIDDEN state = NeoBottomSheetBehavior.STATE_HIDDEN
} }
} }
} }
@ -314,17 +321,17 @@ class MainFragment :
binding.queueSheet.coordinatorLayoutBehavior as QueueSheetBehavior? binding.queueSheet.coordinatorLayoutBehavior as QueueSheetBehavior?
if (queueSheetBehavior != null && if (queueSheetBehavior != null &&
queueSheetBehavior.state != BottomSheetBehavior.STATE_COLLAPSED && queueSheetBehavior.state != NeoBottomSheetBehavior.STATE_COLLAPSED &&
playbackSheetBehavior.state == BottomSheetBehavior.STATE_EXPANDED) { playbackSheetBehavior.state == NeoBottomSheetBehavior.STATE_EXPANDED) {
// Collapse the queue first if it is expanded. // Collapse the queue first if it is expanded.
queueSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED queueSheetBehavior.state = NeoBottomSheetBehavior.STATE_COLLAPSED
return return
} }
if (playbackSheetBehavior.state != BottomSheetBehavior.STATE_COLLAPSED && if (playbackSheetBehavior.state != NeoBottomSheetBehavior.STATE_COLLAPSED &&
playbackSheetBehavior.state != BottomSheetBehavior.STATE_HIDDEN) { playbackSheetBehavior.state != NeoBottomSheetBehavior.STATE_HIDDEN) {
// Then collapse the playback sheet. // Then collapse the playback sheet.
playbackSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED playbackSheetBehavior.state = NeoBottomSheetBehavior.STATE_COLLAPSED
return return
} }

View file

@ -20,7 +20,6 @@ package org.oxycblt.auxio.playback
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import androidx.fragment.app.activityViewModels import androidx.fragment.app.activityViewModels
import kotlin.math.max
import org.oxycblt.auxio.R import org.oxycblt.auxio.R
import org.oxycblt.auxio.databinding.FragmentPlaybackBarBinding import org.oxycblt.auxio.databinding.FragmentPlaybackBarBinding
import org.oxycblt.auxio.music.Song import org.oxycblt.auxio.music.Song
@ -33,8 +32,8 @@ import org.oxycblt.auxio.util.getColorStateListSafe
import org.oxycblt.auxio.util.textSafe import org.oxycblt.auxio.util.textSafe
/** /**
* A fragment showing the current playback state in a compact manner. Placed at the bottom of the * A fragment showing the current playback state in a compact manner. Used as the bar for the
* screen. This expands into [PlaybackPanelFragment]. * playback sheet.
* @author OxygenCobalt * @author OxygenCobalt
*/ */
class PlaybackBarFragment : ViewBindingFragment<FragmentPlaybackBarBinding>() { class PlaybackBarFragment : ViewBindingFragment<FragmentPlaybackBarBinding>() {

View file

@ -25,7 +25,6 @@ import android.view.View
import androidx.core.view.isInvisible import androidx.core.view.isInvisible
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.shape.MaterialShapeDrawable import com.google.android.material.shape.MaterialShapeDrawable
import java.util.*
import org.oxycblt.auxio.IntegerTable import org.oxycblt.auxio.IntegerTable
import org.oxycblt.auxio.R import org.oxycblt.auxio.R
import org.oxycblt.auxio.databinding.ItemQueueSongBinding import org.oxycblt.auxio.databinding.ItemQueueSongBinding
@ -107,7 +106,7 @@ private constructor(
get() = binding.interactBody.isActivated get() = binding.interactBody.isActivated
set(value) { set(value) {
// Activation does not affect clicking, make everything activated. // Activation does not affect clicking, make everything activated.
binding.interactBody.setActivated(value) binding.interactBody.isActivated = value
} }
init { init {

View file

@ -22,7 +22,6 @@ import android.content.Context
import android.content.res.ColorStateList import android.content.res.ColorStateList
import android.database.Cursor import android.database.Cursor
import android.database.sqlite.SQLiteDatabase import android.database.sqlite.SQLiteDatabase
import android.graphics.Insets
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.os.Build import android.os.Build
import android.view.View import android.view.View
@ -30,8 +29,10 @@ import android.view.WindowInsets
import android.widget.TextView import android.widget.TextView
import androidx.activity.viewModels import androidx.activity.viewModels
import androidx.annotation.ColorRes import androidx.annotation.ColorRes
import androidx.annotation.RequiresApi
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.coordinatorlayout.widget.CoordinatorLayout import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.core.graphics.Insets
import androidx.core.graphics.drawable.DrawableCompat import androidx.core.graphics.drawable.DrawableCompat
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels import androidx.fragment.app.activityViewModels
@ -251,9 +252,9 @@ val WindowInsets.systemBarInsetsCompat: Insets
get() = get() =
when { when {
Build.VERSION.SDK_INT >= Build.VERSION_CODES.R -> { Build.VERSION.SDK_INT >= Build.VERSION_CODES.R -> {
getInsets(WindowInsets.Type.systemBars()) getCompatInsets(WindowInsets.Type.systemBars())
} }
else -> systemWindowInsetsCompat else -> getSystemWindowCompatInsets()
} }
/** /**
@ -271,24 +272,31 @@ val WindowInsets.systemGestureInsetsCompat: Insets
when { when {
Build.VERSION.SDK_INT >= Build.VERSION_CODES.R -> { Build.VERSION.SDK_INT >= Build.VERSION_CODES.R -> {
Insets.max( Insets.max(
getInsets(WindowInsets.Type.systemGestures()), getCompatInsets(WindowInsets.Type.systemGestures()),
getInsets(WindowInsets.Type.systemBars())) getCompatInsets(WindowInsets.Type.systemBars()))
} }
Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q -> { Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q -> {
@Suppress("DEPRECATION") Insets.max(systemGestureInsets, systemBarInsetsCompat) @Suppress("DEPRECATION")
Insets.max(getSystemGestureCompatInsets(), getSystemWindowCompatInsets())
} }
else -> systemWindowInsetsCompat else -> getSystemWindowCompatInsets()
} }
@Suppress("DEPRECATION") @Suppress("DEPRECATION")
val WindowInsets.systemWindowInsetsCompat: Insets fun WindowInsets.getSystemWindowCompatInsets() =
get() =
Insets.of( Insets.of(
systemWindowInsetLeft, systemWindowInsetLeft,
systemWindowInsetTop, systemWindowInsetTop,
systemWindowInsetRight, systemWindowInsetRight,
systemWindowInsetBottom) systemWindowInsetBottom)
@Suppress("DEPRECATION")
@RequiresApi(Build.VERSION_CODES.Q)
fun WindowInsets.getSystemGestureCompatInsets() = Insets.toCompatInsets(systemGestureInsets)
@RequiresApi(Build.VERSION_CODES.R)
fun WindowInsets.getCompatInsets(typeMask: Int) = Insets.toCompatInsets(getInsets(typeMask))
/** /**
* Replaces the system bar insets in a version-aware manner. This can be used to modify the insets * Replaces the system bar insets in a version-aware manner. This can be used to modify the insets
* for child views in a way that follows all of the frustrating changes that were made between 8-11. * for child views in a way that follows all of the frustrating changes that were made between 8-11.
@ -302,7 +310,9 @@ fun WindowInsets.replaceSystemBarInsetsCompat(
return when { return when {
Build.VERSION.SDK_INT >= Build.VERSION_CODES.R -> { Build.VERSION.SDK_INT >= Build.VERSION_CODES.R -> {
WindowInsets.Builder(this) WindowInsets.Builder(this)
.setInsets(WindowInsets.Type.systemBars(), Insets.of(left, top, right, bottom)) .setInsets(
WindowInsets.Type.systemBars(),
Insets.of(left, top, right, bottom).toPlatformInsets())
.build() .build()
} }
else -> { else -> {

View file

@ -99,6 +99,8 @@ private val Any.autoTag: String
* KURDISTAN WORKERS PARTY KÜRDISTAN İŞÇI PARTISI (PKK) * KURDISTAN WORKERS PARTY KÜRDISTAN İŞÇI PARTISI (PKK)
* *
* TORTURE AND ASSASSINATION OF JAMAL KHASHOGGI مقتل جمال خاشقجي * TORTURE AND ASSASSINATION OF JAMAL KHASHOGGI مقتل جمال خاشقجي
*
* UNITED ARAB EMIRATES ENSLAVED MIGRANT WORKERS
*/ */
private fun basedCopyleftNotice() { private fun basedCopyleftNotice() {
if (BuildConfig.APPLICATION_ID != "org.oxycblt.auxio" && if (BuildConfig.APPLICATION_ID != "org.oxycblt.auxio" &&

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<size android:height="4dp" android:width="32dp" />
<corners android:radius="2dp" />
<solid android:color="#FFF" />
</shape>

View file

@ -40,8 +40,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
app:layout_behavior="org.oxycblt.auxio.playback.queue.QueueSheetBehavior" app:layout_behavior="org.oxycblt.auxio.playback.queue.QueueSheetBehavior">
app:behavior_hideable="false">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/handle_wrapper" android:id="@+id/handle_wrapper"
@ -53,8 +52,9 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/size_btn" android:layout_height="@dimen/size_btn"
android:scaleType="center" android:scaleType="center"
android:paddingBottom="@dimen/spacing_small" android:paddingBottom="@dimen/spacing_mid_large"
android:src="@drawable/ic_down_24" android:src="@drawable/ui_queue_drag_handle"
app:tint="?attr/colorOnSurfaceVariant"
android:contentDescription="@string/desc_queue_bar" android:contentDescription="@string/desc_queue_bar"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />

View file

@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript { buildscript {
ext.kotlin_version = '1.7.10' ext.kotlin_version = '1.7.10'
ext.navigation_version = "2.5.0" ext.navigation_version = "2.5.1"
repositories { repositories {
google() google()
@ -9,7 +9,7 @@ buildscript {
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:7.2.1' classpath 'com.android.tools.build:gradle:7.2.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$navigation_version" classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$navigation_version"
classpath "com.diffplug.spotless:spotless-plugin-gradle:6.6.1" classpath "com.diffplug.spotless:spotless-plugin-gradle:6.6.1"