Necessary upgrades to compileSdk and targetSdk and adjusting code

This commit is contained in:
Ryan Harg 2022-12-06 09:31:09 +01:00
parent d734953b54
commit 2de6ca303e
No known key found for this signature in database
GPG Key ID: 89106F3A84E6958C
11 changed files with 44 additions and 39 deletions

View File

@ -36,6 +36,8 @@ android {
targetCompatibility = JavaVersion.VERSION_1_8
}
namespace = "audio.funkwhale.ffa"
testCoverage {
version = "0.8.7"
}
@ -52,7 +54,7 @@ android {
disable += listOf("MissingTranslation", "ExtraTranslation")
}
compileSdk = 31
compileSdk = 33
defaultConfig {
@ -62,7 +64,7 @@ android {
versionName = androidGitVersion.name()
minSdk = 24
targetSdk = 30
targetSdk = 33
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="audio.funkwhale.ffa">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
@ -22,7 +21,8 @@
android:name=".activities.SplashActivity"
android:launchMode="singleInstance"
android:noHistory="true"
android:screenOrientation="portrait">
android:screenOrientation="portrait"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@ -61,7 +61,8 @@
<service
android:name=".playback.PlayerService"
android:foregroundServiceType="mediaPlayback">
android:foregroundServiceType="mediaPlayback"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.MEDIA_BUTTON" />
@ -80,7 +81,8 @@
</service>
<receiver android:name="androidx.media.session.MediaButtonReceiver">
<receiver android:name="androidx.media.session.MediaButtonReceiver"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.MEDIA_BUTTON" />
</intent-filter>

View File

@ -43,23 +43,23 @@ class LoginActivity : AppCompatActivity() {
private var resultLauncher =
registerForActivityResult(StartActivityForResult()) { result ->
result.data?.let {
oAuth.exchange(this, it) {
PowerPreference
.getFileByName(AppContext.PREFS_CREDENTIALS)
.setBoolean("anonymous", false)
result.data?.let {
oAuth.exchange(this, it) {
PowerPreference
.getFileByName(AppContext.PREFS_CREDENTIALS)
.setBoolean("anonymous", false)
lifecycleScope.launch(Main) {
Userinfo.get(this@LoginActivity, oAuth)?.let {
startActivity(Intent(this@LoginActivity, MainActivity::class.java))
lifecycleScope.launch(Main) {
Userinfo.get(this@LoginActivity, oAuth)?.let {
startActivity(Intent(this@LoginActivity, MainActivity::class.java))
return@launch finish()
return@launch finish()
}
throw Exception(getString(R.string.login_error_userinfo))
}
throw Exception(getString(R.string.login_error_userinfo))
}
}
}
}
override fun onResume() {
super.onResume()

View File

@ -244,8 +244,8 @@ class MainActivity : AppCompatActivity() {
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW)
item.actionView = View(this)
item.setOnActionExpandListener(object : MenuItem.OnActionExpandListener {
override fun onMenuItemActionExpand(item: MenuItem?) = false
override fun onMenuItemActionCollapse(item: MenuItem?) = false
override fun onMenuItemActionExpand(item: MenuItem) = false
override fun onMenuItemActionCollapse(item: MenuItem) = false
})
item.isChecked = !item.isChecked
@ -358,7 +358,7 @@ class MainActivity : AppCompatActivity() {
.alpha(0.0f)
.setDuration(400)
.setListener(object : AnimatorListenerAdapter() {
override fun onAnimationEnd(animator: Animator?) {
override fun onAnimationEnd(animator: Animator) {
binding.nowPlaying.visibility = View.GONE
}
})

View File

@ -80,16 +80,20 @@ class PinService : DownloadService(AppContext.NOTIFICATION_DOWNLOADS) {
override fun getScheduler(): Scheduler? = null
override fun getForegroundNotification(downloads: MutableList<Download>,
notMetRequirements: Int): Notification {
override fun getForegroundNotification(
downloads: MutableList<Download>,
notMetRequirements: Int
): Notification {
val description =
resources.getQuantityString(R.plurals.downloads_description, downloads.size, downloads.size)
return DownloadNotificationHelper(
this,
AppContext.NOTIFICATION_CHANNEL_DOWNLOADS
).buildProgressNotification(this, R.drawable.downloads, null, description,
downloads, notMetRequirements)
).buildProgressNotification(
this, R.drawable.downloads, null, description,
downloads, notMetRequirements
)
}
private fun getDownloads() = downloadManager.downloadIndex.getDownloads()

View File

@ -438,10 +438,10 @@ class PlayerService : Service() {
}
if (!playWhenReady) {
Build.VERSION_CODES.N.onApi(
{ stopForeground(STOP_FOREGROUND_DETACH) },
{ stopForeground(false) }
)
Build.VERSION_CODES.N.onApi(
{ stopForeground(STOP_FOREGROUND_DETACH) },
{ stopForeground(false) }
)
}
}

View File

@ -11,8 +11,8 @@ import audio.funkwhale.ffa.model.Track
import audio.funkwhale.ffa.model.TracksCache
import audio.funkwhale.ffa.model.TracksResponse
import audio.funkwhale.ffa.utils.OAuth
import com.github.kittinunf.fuel.gson.gsonDeserializerOf
import audio.funkwhale.ffa.utils.mustNormalizeUrl
import com.github.kittinunf.fuel.gson.gsonDeserializerOf
import com.google.android.exoplayer2.offline.DownloadManager
import com.google.android.exoplayer2.upstream.cache.Cache
import com.google.gson.reflect.TypeToken

View File

@ -7,8 +7,8 @@ import audio.funkwhale.ffa.model.TracksCache
import audio.funkwhale.ffa.model.TracksResponse
import audio.funkwhale.ffa.utils.OAuth
import audio.funkwhale.ffa.utils.getMetadata
import com.github.kittinunf.fuel.gson.gsonDeserializerOf
import audio.funkwhale.ffa.utils.mustNormalizeUrl
import com.github.kittinunf.fuel.gson.gsonDeserializerOf
import com.google.android.exoplayer2.offline.Download
import com.google.android.exoplayer2.offline.DownloadManager
import com.google.android.exoplayer2.upstream.cache.Cache

View File

@ -88,7 +88,7 @@ object CommandBus {
var commands = _commands.asSharedFlow()
fun send(command: Command) {
GlobalScope.launch(IO) {
_commands.emit(command)
_commands.emit(command)
}
}

View File

@ -10,10 +10,8 @@ import audio.funkwhale.ffa.model.DownloadInfo
import audio.funkwhale.ffa.repositories.Repository
import com.github.kittinunf.fuel.core.FuelError
import com.github.kittinunf.fuel.core.Request
import com.github.kittinunf.fuel.core.ResponseDeserializable
import com.google.android.exoplayer2.offline.Download
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import com.squareup.picasso.Picasso
import com.squareup.picasso.RequestCreator
import kotlinx.coroutines.CompletableDeferred
@ -23,7 +21,6 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import net.openid.appauth.ClientSecretPost
import java.io.Reader
import java.text.SimpleDateFormat
import java.util.Date
import kotlin.coroutines.CoroutineContext

View File

@ -52,7 +52,7 @@ class NowPlayingView : MaterialCardView {
viewTreeObserver.addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlobalLayoutListener {
override fun onGlobalLayout() {
gestureDetectorCallback = OnGestureDetection()
gestureDetector = GestureDetector(context, gestureDetectorCallback)
gestureDetector = GestureDetector(context, gestureDetectorCallback!!)
setOnTouchListener { _, motionEvent ->
val ret = gestureDetector?.onTouchEvent(motionEvent) ?: false
@ -128,8 +128,8 @@ class NowPlayingView : MaterialCardView {
}
override fun onFling(
firstMotionEvent: MotionEvent?,
secondMotionEvent: MotionEvent?,
firstMotionEvent: MotionEvent,
secondMotionEvent: MotionEvent,
velocityX: Float,
velocityY: Float
): Boolean {
@ -195,7 +195,7 @@ class NowPlayingView : MaterialCardView {
return true
}
override fun onSingleTapUp(e: MotionEvent?): Boolean {
override fun onSingleTapUp(e: MotionEvent): Boolean {
layoutParams.let {
if (height != minHeight) return true