Skip to content

Commit e9ce5f0

Browse files
committed
Refine
1 parent f7a7605 commit e9ce5f0

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

app/src/main/kotlin/com/w2sv/autocrop/activities/crop/fragments/cropping/CropFragment.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,17 @@ class CropFragment
6262
)
6363

6464
private val screenshotUris: List<Uri> = savedStateHandle[MainActivity.EXTRA_SELECTED_IMAGE_URIS]!!
65-
val nScreenshots: Int get() = screenshotUris.size
65+
66+
val nScreenshots: Int
67+
get() = screenshotUris.size
6668

6769
fun getNUncroppableImages(): Int =
6870
nScreenshots - cropBundles.size
6971

7072
val cropBundles = mutableListOf<CropBundle>()
7173
val liveProgress: LiveData<Int> = MutableLiveData(0)
7274

73-
suspend fun launchCroppingCoroutine(
75+
suspend fun launchCropCoroutine(
7476
contentResolver: ContentResolver,
7577
onFinishedListener: () -> Unit
7678
) {
@@ -138,9 +140,7 @@ class CropFragment
138140
super.onResume()
139141

140142
lifecycleScope.launch {
141-
viewModel.launchCroppingCoroutine(
142-
requireContext().contentResolver,
143-
) {
143+
viewModel.launchCropCoroutine(requireContext().contentResolver) {
144144
invokeSubsequentScreen()
145145
}
146146
}

app/src/main/kotlin/com/w2sv/autocrop/cropbundle/io/extensions/ContentResolver.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ fun ContentResolver.loadBitmap(uri: Uri): Bitmap =
1717
*
1818
* @return flag indicating whether image was successfully deleted
1919
*/
20-
fun ContentResolver.deleteImage(mediaStoreId: Long): Boolean {
21-
return try {
20+
fun ContentResolver.deleteImage(mediaStoreId: Long): Boolean =
21+
try {
2222
val rowsDeleted = delete(
2323
MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
2424
"${MediaStore.Images.Media._ID}=?",
@@ -36,7 +36,6 @@ fun ContentResolver.deleteImage(mediaStoreId: Long): Boolean {
3636
i(e)
3737
false
3838
}
39-
}
4039

4140
/**
4241
* @see

0 commit comments

Comments
 (0)