-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from icerockdev/develop
Release 0.11.0
- Loading branch information
Showing
25 changed files
with
442 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright 2019 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
plugins { | ||
id("dev.icerock.moko.gradle.multiplatform.mobile") | ||
id("dev.icerock.moko.gradle.publication") | ||
id("dev.icerock.moko.gradle.stub.javadoc") | ||
id("dev.icerock.moko.gradle.detekt") | ||
id("org.jetbrains.compose") | ||
} | ||
|
||
android { | ||
namespace = "dev.icerock.moko.media.compose" | ||
|
||
defaultConfig { | ||
minSdk = 21 | ||
} | ||
} | ||
|
||
dependencies { | ||
commonMainApi(projects.media) | ||
commonMainApi(compose.runtime) | ||
commonMainApi(compose.ui) | ||
commonMainApi(libs.mokoPermissionsCompose) | ||
|
||
androidMainImplementation(libs.appCompat) | ||
|
||
// without this i got Could not find "moko-media/media-compose/build/kotlinTransformedMetadataLibraries/commonMain/org.jetbrains.kotlinx-atomicfu-0.17.3-nativeInterop-8G5yng.klib" | ||
commonMainImplementation("org.jetbrains.kotlinx:atomicfu:0.17.3") | ||
} |
28 changes: 28 additions & 0 deletions
28
...se/src/androidMain/kotlin/dev/icerock/moko/media/compose/BindMediaPickerEffect.android.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright 2019 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
package dev.icerock.moko.media.compose | ||
|
||
import android.content.Context | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.LaunchedEffect | ||
import androidx.compose.ui.platform.LocalContext | ||
import androidx.compose.ui.platform.LocalLifecycleOwner | ||
import androidx.fragment.app.FragmentActivity | ||
import androidx.fragment.app.FragmentManager | ||
import androidx.lifecycle.LifecycleOwner | ||
import dev.icerock.moko.media.picker.MediaPickerController | ||
|
||
@Suppress("FunctionNaming") | ||
@Composable | ||
actual fun BindMediaPickerEffect(mediaPickerController: MediaPickerController) { | ||
val lifecycleOwner: LifecycleOwner = LocalLifecycleOwner.current | ||
val context: Context = LocalContext.current | ||
|
||
LaunchedEffect(mediaPickerController, lifecycleOwner, context) { | ||
val fragmentManager: FragmentManager = (context as FragmentActivity).supportFragmentManager | ||
|
||
mediaPickerController.bind(lifecycleOwner.lifecycle, fragmentManager) | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
media-compose/src/androidMain/kotlin/dev/icerock/moko/media/compose/BitmapExt.android.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
* Copyright 2023 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
package dev.icerock.moko.media.compose | ||
|
||
import androidx.compose.ui.graphics.ImageBitmap | ||
import androidx.compose.ui.graphics.asImageBitmap | ||
import dev.icerock.moko.media.Bitmap | ||
|
||
actual fun Bitmap.toImageBitmap(): ImageBitmap { | ||
return this.platformBitmap.asImageBitmap() | ||
} |
33 changes: 33 additions & 0 deletions
33
...androidMain/kotlin/dev/icerock/moko/media/compose/MediaPickerControllerFactory.android.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright 2023 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
package dev.icerock.moko.media.compose | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.remember | ||
import dev.icerock.moko.media.picker.MediaPickerController | ||
import dev.icerock.moko.permissions.PermissionsController | ||
import dev.icerock.moko.permissions.compose.PermissionsControllerFactory | ||
import dev.icerock.moko.permissions.compose.rememberPermissionsControllerFactory | ||
|
||
@Composable | ||
actual fun rememberMediaPickerControllerFactory(): MediaPickerControllerFactory { | ||
val permissionsControllerFactory: PermissionsControllerFactory = | ||
rememberPermissionsControllerFactory() | ||
return remember(permissionsControllerFactory) { | ||
object : MediaPickerControllerFactory { | ||
override fun createMediaPickerController( | ||
permissionsController: PermissionsController | ||
): MediaPickerController { | ||
return MediaPickerController(permissionsController) | ||
} | ||
|
||
override fun createMediaPickerController(): MediaPickerController { | ||
return MediaPickerController( | ||
permissionsController = permissionsControllerFactory.createPermissionsController() | ||
) | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.