-
-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ feat: add camera config, remove allowedCamera props
- Loading branch information
Showing
34 changed files
with
1,246 additions
and
691 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
android/src/main/java/com/margelo/nitro/multipleimagepicker/CameraEngine.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,38 @@ | ||
package com.margelo.nitro.multipleimagepicker | ||
|
||
import android.content.Context | ||
import androidx.fragment.app.Fragment | ||
import com.bumptech.glide.Glide | ||
import com.luck.lib.camerax.SimpleCameraX | ||
import com.luck.picture.lib.interfaces.OnCameraInterceptListener | ||
import java.io.File | ||
|
||
class CameraEngine(private val appContext: Context, val config: PickerCameraConfig) : OnCameraInterceptListener { | ||
override fun openCamera(fragment: Fragment, cameraMode: Int, requestCode: Int) { | ||
val camera = SimpleCameraX.of() | ||
camera.isAutoRotation(true) | ||
camera.setCameraMode(cameraMode) | ||
camera.isDisplayRecordChangeTime(true) | ||
camera.isManualFocusCameraPreview(true) | ||
camera.isZoomCameraPreview(true) | ||
camera.setOutputPathDir(getSandboxCameraOutputPath()) | ||
camera.setRecordVideoMaxSecond(config.videoMaximumDuration?.toInt() ?: 60) | ||
|
||
// camera.setPermissionDeniedListener(getSimpleXPermissionDeniedListener()) | ||
// camera.setPermissionDescriptionListener(getSimpleXPermissionDescriptionListener()) | ||
camera.setImageEngine { context, url, imageView -> | ||
Glide.with(context).load(url).into(imageView) | ||
} | ||
camera.start(fragment.requireActivity(), fragment, requestCode) | ||
} | ||
|
||
private fun getSandboxCameraOutputPath(): String { | ||
val externalFilesDir: File? = appContext.getExternalFilesDir("") | ||
val customFile = File(externalFilesDir?.absolutePath, "Sandbox") | ||
if (!customFile.exists()) { | ||
customFile.mkdirs() | ||
} | ||
return customFile.absolutePath + File.separator | ||
|
||
} | ||
} |
43 changes: 0 additions & 43 deletions
43
android/src/main/java/com/margelo/nitro/multipleimagepicker/CompressEngine.kt
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.