Skip to content

Commit

Permalink
规整代码
Browse files Browse the repository at this point in the history
  • Loading branch information
leavesCZY committed Oct 26, 2023
1 parent de8facf commit e7d6b24
Show file tree
Hide file tree
Showing 12 changed files with 50 additions and 13 deletions.
3 changes: 3 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.parcelize)
alias(libs.plugins.google.ksp)
}

android {
Expand Down Expand Up @@ -116,7 +117,9 @@ dependencies {
implementation(libs.coil.compose)
implementation(libs.coil.gif)
implementation(libs.coil.video)
implementation(libs.glide)
implementation(libs.glide.compose)
ksp(libs.glide.ksp)
implementation(libs.zoomImage.coil)
implementation(libs.zoomImage.glide)
implementation(libs.zoomableImage.coil)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package github.leavesczy.matisse.samples

import android.content.Context
import com.bumptech.glide.GlideBuilder
import com.bumptech.glide.annotation.GlideModule
import com.bumptech.glide.load.DecodeFormat
import com.bumptech.glide.module.AppGlideModule
import com.bumptech.glide.request.RequestOptions

/**
* @Author: leavesCZY
* @Date: 2023/10/26 17:33
* @Desc:
*/
@GlideModule
class MatisseAppGlideModule : AppGlideModule() {

override fun isManifestParsingEnabled(): Boolean {
return false
}

override fun applyOptions(context: Context, builder: GlideBuilder) {
builder.setDefaultRequestOptions(
RequestOptions()
.format(DecodeFormat.PREFER_RGB_565)
)
}

}
Binary file added app/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ plugins {
alias(libs.plugins.android.library).apply(false)
alias(libs.plugins.kotlin.android).apply(false)
alias(libs.plugins.kotlin.parcelize).apply(false)
alias(libs.plugins.google.ksp).apply(false)
}
14 changes: 11 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[versions]
android-plugin = "8.1.2"
kotlin-plugin = "1.9.10"
ksp-plugin = "1.9.10-1.0.13"

junit-junit = "4.13.2"
androidx-junit = "1.1.5"
Expand All @@ -15,15 +16,20 @@ compose-compiler = "1.5.3"
matisse = "1.1.1"

coil = "2.4.0"
glide = "1.0.0-beta01"
zoomImage = "1.0.0-beta03"

glide = "5.0.0-rc01"
glideCompose = "1.0.0-beta01"

zoomImage = "1.0.0-beta04"

zoomableImage = "0.6.2"

[plugins]
android-application = { id = "com.android.application", version.ref = "android-plugin" }
android-library = { id = "com.android.library", version.ref = "android-plugin" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin-plugin" }
kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin-plugin" }
google-ksp = { id = "com.google.devtools.ksp", version.ref = "ksp-plugin" }

[libraries]
test-junit = { module = "junit:junit", version.ref = "junit-junit" }
Expand All @@ -46,7 +52,9 @@ coil-compose = { module = "io.coil-kt:coil-compose", version.ref = "coil" }
coil-gif = { module = "io.coil-kt:coil-gif", version.ref = "coil" }
coil-video = { module = "io.coil-kt:coil-video", version.ref = "coil" }

glide-compose = { module = "com.github.bumptech.glide:compose", version.ref = "glide" }
glide = { module = "com.github.bumptech.glide:glide", version.ref = "glide" }
glide-ksp = { module = "com.github.bumptech.glide:ksp", version.ref = "glide" }
glide-compose = { module = "com.github.bumptech.glide:compose", version.ref = "glideCompose" }

zoomImage-coil = { module = "io.github.panpf.zoomimage:zoomimage-compose-coil", version.ref = "zoomImage" }
zoomImage-glide = { module = "io.github.panpf.zoomimage:zoomimage-compose-glide", version.ref = "zoomImage" }
Expand Down
4 changes: 2 additions & 2 deletions matisse/src/main/java/github/leavesczy/matisse/Matisse.kt
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ enum class MimeType(val type: String) {

}

val isImage: Boolean
internal val isImage: Boolean
get() = type.startsWith(prefix = "image")

val isVideo: Boolean
internal val isVideo: Boolean
get() = type.startsWith(prefix = "video")

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@ import kotlinx.coroutines.withContext
internal class MatisseViewModel(application: Application, matisse: Matisse) :
AndroidViewModel(application) {

companion object {

private const val DEFAULT_BUCKET_ID = "&__defaultBucketId__&"

}

private val context: Context
get() = getApplication()

Expand All @@ -41,8 +35,10 @@ internal class MatisseViewModel(application: Application, matisse: Matisse) :

private val mediaFilter = matisse.mediaFilter

private val defaultBucketId = "&__matisseDefaultBucketId__&"

private val defaultBucket = MediaBucket(
id = DEFAULT_BUCKET_ID,
id = defaultBucketId,
name = getString(R.string.matisse_default_bucket_name),
resources = emptyList(),
supportCapture = supportCapture
Expand Down Expand Up @@ -160,7 +156,7 @@ internal class MatisseViewModel(application: Application, matisse: Matisse) :
buildList {
add(
element = MediaBucket(
id = DEFAULT_BUCKET_ID,
id = defaultBucketId,
name = getString(R.string.matisse_default_bucket_name),
resources = resources,
supportCapture = supportCapture
Expand Down

0 comments on commit e7d6b24

Please sign in to comment.