Skip to content

Commit

Permalink
Added image preview and a better analyze screen for a better UX
Browse files Browse the repository at this point in the history
  • Loading branch information
Mihai-Cristian Condrea committed Jun 29, 2024
1 parent b381b7a commit fb6a9f5
Show file tree
Hide file tree
Showing 5 changed files with 262 additions and 213 deletions.
2 changes: 2 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ dependencies {
// Image Compression
implementation(libs.compressor)
implementation(libs.glide)
implementation(libs.coil.compose)

// Test
testImplementation(libs.junit)
Expand All @@ -151,6 +152,7 @@ dependencies {
debugImplementation(libs.androidx.ui.test.manifest)



// TODO: Clean-up
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation("androidx.gridlayout:gridlayout:1.0.0")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
package com.d4rk.cleaner.ui.dialogs

import android.content.res.Resources
import android.graphics.Bitmap
import android.graphics.Canvas
import android.graphics.drawable.AdaptiveIconDrawable
import android.graphics.drawable.BitmapDrawable
import android.graphics.drawable.Drawable
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
Expand All @@ -25,6 +19,7 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.d4rk.cleaner.BuildConfig
import com.d4rk.cleaner.R
import com.d4rk.cleaner.utils.toBitmapDrawable

@Composable
fun VersionInfoDialog(onDismiss: () -> Unit) {
Expand Down Expand Up @@ -73,20 +68,4 @@ fun VersionInfoContent() {
)
}
}
}

fun Drawable.toBitmapDrawable(): BitmapDrawable {
return when (this) {
is BitmapDrawable -> this
is AdaptiveIconDrawable -> {
val bitmap =
Bitmap.createBitmap(intrinsicWidth, intrinsicHeight, Bitmap.Config.ARGB_8888)
val canvas = Canvas(bitmap)
setBounds(0, 0, canvas.width, canvas.height)
draw(canvas)
BitmapDrawable(Resources.getSystem(), bitmap)
}

else -> throw IllegalArgumentException("Unsupported drawable type: ${this::class.java.name}")
}
}
Loading

0 comments on commit fb6a9f5

Please sign in to comment.