mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
small changes (#4789)
This commit is contained in:
parent
769b295647
commit
9c27f8510d
3 changed files with 4 additions and 4 deletions
|
|
@ -45,7 +45,7 @@ class CustomSelectorViewModel(var context: Context,var imageFileLoader: ImageFil
|
||||||
override fun onFailed(throwable: Throwable) {
|
override fun onFailed(throwable: Throwable) {
|
||||||
result.postValue(Result(CallbackStatus.SUCCESS, arrayListOf()))
|
result.postValue(Result(CallbackStatus.SUCCESS, arrayListOf()))
|
||||||
}
|
}
|
||||||
},scope)
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ class ImageFileLoader(val context: Context) : CoroutineScope{
|
||||||
/**
|
/**
|
||||||
* Load Device Images under coroutine.
|
* Load Device Images under coroutine.
|
||||||
*/
|
*/
|
||||||
fun loadDeviceImages(listener: ImageLoaderListener, scope: CoroutineScope) {
|
fun loadDeviceImages(listener: ImageLoaderListener) {
|
||||||
launch(Dispatchers.Main) {
|
launch(Dispatchers.Main) {
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
getImages(listener)
|
getImages(listener)
|
||||||
|
|
@ -82,7 +82,7 @@ class ImageFileLoader(val context: Context) : CoroutineScope{
|
||||||
|
|
||||||
|
|
||||||
if (file != null && file.exists()) {
|
if (file != null && file.exists()) {
|
||||||
if (id != null && name != null && path != null && bucketId != null && bucketName != null) {
|
if (name != null && path != null && bucketName != null) {
|
||||||
val uri = ContentUris.withAppendedId(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, id)
|
val uri = ContentUris.withAppendedId(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, id)
|
||||||
val image = Image(id, name, uri, path, bucketId, bucketName)
|
val image = Image(id, name, uri, path, bucketId, bucketName)
|
||||||
images.add(image)
|
images.add(image)
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ class ImageFileLoaderTest {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
fun testLoadDeviceImages() {
|
fun testLoadDeviceImages() {
|
||||||
imageFileLoader.loadDeviceImages(imageLoaderListener, coroutineScope)
|
imageFileLoader.loadDeviceImages(imageLoaderListener)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue