Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions MultipleImagePicker.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Pod::Spec.new do |s|
add_dependency(s, "React-jsinspector", :framework_name => "jsinspector_modern")
add_dependency(s, "React-rendererconsistency", :framework_name => "React_rendererconsistency")
add_dependency(s, "React-jsinspectortracing", :framework_name => 'jsinspector_moderntracing')
add_dependency(s, "React-jsinspectorcdp", :framework_name => 'jsinspector_moderncdp')
end

load 'nitrogen/generated/ios/MultipleImagePicker+autolinking.rb'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.margelo.nitro.multipleimagepicker

import android.content.Context
import android.graphics.Color
import androidx.fragment.app.Fragment
import com.bumptech.glide.Glide
import com.facebook.react.bridge.ColorPropConverter
Expand Down Expand Up @@ -30,7 +31,7 @@ class CameraEngine(
camera.setOutputPathDir(getSandboxCameraOutputPath())

config.color?.let {
val primaryColor = ColorPropConverter.getColor(it, appContext)
val primaryColor = ColorPropConverter.getColor(it, appContext) ?: Color.BLACK
camera.setCaptureLoadingColor(primaryColor)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ class MultipleImagePickerImp(reactContext: ReactApplicationContext?) :
rejected: (reject: Double) -> Unit
) {
PictureAppMaster.getInstance().app = this
val activity = currentActivity
val activity = reactApplicationContext.currentActivity
?: throw IllegalStateException("No current Activity available")
val imageEngine = GlideEngine.createGlideEngine()

// set global config
Expand Down Expand Up @@ -258,7 +259,7 @@ class MultipleImagePickerImp(reactContext: ReactApplicationContext?) :
// Add listener before starting UCrop
reactApplicationContext.addActivityEventListener(cropActivityEventListener)

currentActivity?.let { uCrop.start(it, REQUEST_CROP) }
reactApplicationContext.currentActivity?.let { uCrop.start(it, REQUEST_CROP) }
} catch (e: Exception) {
rejected(0.0)
}
Expand Down Expand Up @@ -310,8 +311,10 @@ class MultipleImagePickerImp(reactContext: ReactApplicationContext?) :
}
}

val activity = reactApplicationContext.currentActivity
?: throw IllegalStateException("No current Activity available")
PictureSelector
.create(currentActivity)
.create(activity)
.openPreview()
.setImageEngine(imageEngine)
.setLanguage(getLanguage(config.language))
Expand Down Expand Up @@ -345,7 +348,8 @@ class MultipleImagePickerImp(reactContext: ReactApplicationContext?) :
resolved: (result: CameraResult) -> Unit,
rejected: (reject: Double) -> Unit
) {
val activity = currentActivity
val activity = reactApplicationContext.currentActivity
?: throw IllegalStateException("No current Activity available")
val chooseMode = getChooseMode(config.mediaType)

PictureSelector
Expand All @@ -361,7 +365,7 @@ class MultipleImagePickerImp(reactContext: ReactApplicationContext?) :
setCropEngine(CropEngine(cropOption))
}
}
.forResultActivity(object : OnResultCallbackListener<LocalMedia?> {
.forResult(object : OnResultCallbackListener<LocalMedia?> {
override fun onResult(results: java.util.ArrayList<LocalMedia?>?) {
results?.first()?.let {
val result = getResult(it)
Expand Down Expand Up @@ -505,7 +509,7 @@ class MultipleImagePickerImp(reactContext: ReactApplicationContext?) :
val iconBack =
if (isDark) com.luck.picture.lib.R.drawable.ps_ic_back else com.luck.picture.lib.R.drawable.ps_ic_black_back

cropOption.setLogoColor(primaryColor)
cropOption.setLogoColor(primaryColor ?: Color.BLACK)

// TITLE BAR
titleBar.titleBackgroundColor = background
Expand Down Expand Up @@ -547,7 +551,7 @@ class MultipleImagePickerImp(reactContext: ReactApplicationContext?) :
mainStyle.isAdapterItemIncludeEdge = true
mainStyle.isPreviewSelectRelativeBottom = false
// mainStyle.previewSelectTextSize = Constant.TOOLBAR_TEXT_SIZE
mainStyle.selectTextColor = primaryColor
mainStyle.selectTextColor = primaryColor ?: Color.BLACK
// mainStyle.selectTextSize = Constant.TOOLBAR_TEXT_SIZE
mainStyle.selectBackground = selectType
mainStyle.isSelectNumberStyle = isNumber
Expand Down