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

View File

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

View File

@ -43,23 +43,23 @@ class LoginActivity : AppCompatActivity() {
private var resultLauncher = private var resultLauncher =
registerForActivityResult(StartActivityForResult()) { result -> registerForActivityResult(StartActivityForResult()) { result ->
result.data?.let { result.data?.let {
oAuth.exchange(this, it) { oAuth.exchange(this, it) {
PowerPreference PowerPreference
.getFileByName(AppContext.PREFS_CREDENTIALS) .getFileByName(AppContext.PREFS_CREDENTIALS)
.setBoolean("anonymous", false) .setBoolean("anonymous", false)
lifecycleScope.launch(Main) { lifecycleScope.launch(Main) {
Userinfo.get(this@LoginActivity, oAuth)?.let { Userinfo.get(this@LoginActivity, oAuth)?.let {
startActivity(Intent(this@LoginActivity, MainActivity::class.java)) 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() { override fun onResume() {
super.onResume() super.onResume()

View File

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

View File

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

View File

@ -438,10 +438,10 @@ class PlayerService : Service() {
} }
if (!playWhenReady) { if (!playWhenReady) {
Build.VERSION_CODES.N.onApi( Build.VERSION_CODES.N.onApi(
{ stopForeground(STOP_FOREGROUND_DETACH) }, { stopForeground(STOP_FOREGROUND_DETACH) },
{ stopForeground(false) } { 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.TracksCache
import audio.funkwhale.ffa.model.TracksResponse import audio.funkwhale.ffa.model.TracksResponse
import audio.funkwhale.ffa.utils.OAuth import audio.funkwhale.ffa.utils.OAuth
import com.github.kittinunf.fuel.gson.gsonDeserializerOf
import audio.funkwhale.ffa.utils.mustNormalizeUrl 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.offline.DownloadManager
import com.google.android.exoplayer2.upstream.cache.Cache import com.google.android.exoplayer2.upstream.cache.Cache
import com.google.gson.reflect.TypeToken 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.model.TracksResponse
import audio.funkwhale.ffa.utils.OAuth import audio.funkwhale.ffa.utils.OAuth
import audio.funkwhale.ffa.utils.getMetadata import audio.funkwhale.ffa.utils.getMetadata
import com.github.kittinunf.fuel.gson.gsonDeserializerOf
import audio.funkwhale.ffa.utils.mustNormalizeUrl 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.Download
import com.google.android.exoplayer2.offline.DownloadManager import com.google.android.exoplayer2.offline.DownloadManager
import com.google.android.exoplayer2.upstream.cache.Cache import com.google.android.exoplayer2.upstream.cache.Cache

View File

@ -88,7 +88,7 @@ object CommandBus {
var commands = _commands.asSharedFlow() var commands = _commands.asSharedFlow()
fun send(command: Command) { fun send(command: Command) {
GlobalScope.launch(IO) { 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 audio.funkwhale.ffa.repositories.Repository
import com.github.kittinunf.fuel.core.FuelError import com.github.kittinunf.fuel.core.FuelError
import com.github.kittinunf.fuel.core.Request import com.github.kittinunf.fuel.core.Request
import com.github.kittinunf.fuel.core.ResponseDeserializable
import com.google.android.exoplayer2.offline.Download import com.google.android.exoplayer2.offline.Download
import com.google.gson.Gson import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import com.squareup.picasso.Picasso import com.squareup.picasso.Picasso
import com.squareup.picasso.RequestCreator import com.squareup.picasso.RequestCreator
import kotlinx.coroutines.CompletableDeferred import kotlinx.coroutines.CompletableDeferred
@ -23,7 +21,6 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking
import net.openid.appauth.ClientSecretPost import net.openid.appauth.ClientSecretPost
import java.io.Reader
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Date import java.util.Date
import kotlin.coroutines.CoroutineContext import kotlin.coroutines.CoroutineContext

View File

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