Get Start(中文)
// YourApplication.kt
override fun onCreate() {
super.onCreate()
...
MediaLibManager.install(this, reactNativeHost.reactInstanceManager)
}
U can observe a signal in ur 'MediaLib' container(maybe a activity or a fragment) to get selector result list.
U must choose one between Point.2 and Point.3
...
// (1) get GalleryViewModel
val model = ViewModelProviders.of(this).get(GalleryViewModel::class.java)
// (2) observe nextStep
model.nextStep.observe(this) {
if (it != true) return@observe
// (3) obtain all selected item
val allSelected = model.getAllSelected()
allSelected ?: return@observe
// (4) for example: open a new native page
openANewNativePage(allSelected)
}
private fun openANewNativePage(temp: List<LocalMedia>) {
val intent = Intent(this, NativeNextActivity::class.java)
val data: ArrayList<LocalMedia> = arrayListOf()
data.addAll(temp)
intent.putExtra("data", data)
startActivity(intent)
}
...