Skip to content

Commit 5fcc2af

Browse files
committed
- add build fun to FilePickerBuilder.kt to control start activity outside the library.
1 parent 3f57516 commit 5fcc2af

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

filepicker/src/main/java/droidninja/filepicker/FilePickerBuilder.kt

+7
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,13 @@ class FilePickerBuilder {
140140
start(context, requestCode)
141141
}
142142

143+
fun build(pickerType: Int, context: Activity): Intent {
144+
val intent = Intent(context, FilePickerActivity::class.java)
145+
mPickerOptionsBundle.putInt(FilePickerConst.EXTRA_PICKER_TYPE, pickerType)
146+
intent.putExtras(mPickerOptionsBundle)
147+
return intent
148+
}
149+
143150
private fun start(context: Activity, requestCode: Int) {
144151
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
145152
if (ContextCompat.checkSelfPermission(context, FilePickerConst.PERMISSIONS_FILE_PICKER) != PackageManager.PERMISSION_GRANTED) {

0 commit comments

Comments
 (0)