image: fix bad coverprovider conventions

This commit is contained in:
Alexander Capehart 2025-01-04 12:54:24 -07:00
parent b4a9f9af96
commit 07a0d01a06
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
2 changed files with 13 additions and 9 deletions

View file

@ -105,7 +105,7 @@
--> -->
<provider <provider
android:name=".image.CoverProvider" android:name=".image.CoverProvider"
android:authorities="org.oxycblt.auxio.image" android:authorities="org.oxycblt.auxio.image.CoverProvider"
android:exported="true" android:exported="true"
tools:ignore="ExportedContentProvider" /> tools:ignore="ExportedContentProvider" />

View file

@ -19,6 +19,7 @@
package org.oxycblt.auxio.image package org.oxycblt.auxio.image
import android.content.ContentProvider import android.content.ContentProvider
import android.content.ContentResolver
import android.content.ContentValues import android.content.ContentValues
import android.content.UriMatcher import android.content.UriMatcher
import android.database.Cursor import android.database.Cursor
@ -59,25 +60,28 @@ class CoverProvider : ContentProvider() {
sortOrder: String? sortOrder: String?
): Cursor = throw UnsupportedOperationException() ): Cursor = throw UnsupportedOperationException()
override fun insert(uri: Uri, values: ContentValues?): Uri = override fun insert(uri: Uri, values: ContentValues?): Uri? = null
throw UnsupportedOperationException()
override fun delete(uri: Uri, selection: String?, selectionArgs: Array<out String>?): Int = override fun delete(uri: Uri, selection: String?, selectionArgs: Array<out String>?): Int = 0
throw UnsupportedOperationException()
override fun update( override fun update(
uri: Uri, uri: Uri,
values: ContentValues?, values: ContentValues?,
selection: String?, selection: String?,
selectionArgs: Array<out String>? selectionArgs: Array<out String>?
): Int = throw UnsupportedOperationException() ): Int = 0
companion object { companion object {
private const val AUTHORITY = "org.oxycblt.auxio.image" private const val AUTHORITY = "org.oxycblt.auxio.image.CoverProvider"
private const val IMAGES_PATH = "covers" private const val IMAGES_PATH = "covers"
private val uriMatcher = private val uriMatcher =
UriMatcher(UriMatcher.NO_MATCH).apply { addURI(AUTHORITY, "$IMAGES_PATH/*", 1) } UriMatcher(UriMatcher.NO_MATCH).apply { addURI(AUTHORITY, "$IMAGES_PATH/*", 1) }
val CONTENT_URI: Uri = Uri.parse("content://$AUTHORITY/$IMAGES_PATH") val CONTENT_URI: Uri =
Uri.Builder()
.scheme(ContentResolver.SCHEME_CONTENT)
.authority(AUTHORITY)
.appendPath(IMAGES_PATH)
.build()
} }
} }