|
|
@ -91,7 +91,7 @@ object FilePicker { |
|
|
|
activity: BaseActivity, |
|
|
|
activity: BaseActivity, |
|
|
|
requestCode: Int, |
|
|
|
requestCode: Int, |
|
|
|
title: String = activity.getString(R.string.select_file), |
|
|
|
title: String = activity.getString(R.string.select_file), |
|
|
|
type: String, |
|
|
|
type: Array<String>, |
|
|
|
allowExtensions: Array<String>?, |
|
|
|
allowExtensions: Array<String>?, |
|
|
|
default: (() -> Unit)? = null |
|
|
|
default: (() -> Unit)? = null |
|
|
|
) { |
|
|
|
) { |
|
|
@ -107,7 +107,7 @@ object FilePicker { |
|
|
|
1 -> { |
|
|
|
1 -> { |
|
|
|
try { |
|
|
|
try { |
|
|
|
val intent = createSelectFileIntent() |
|
|
|
val intent = createSelectFileIntent() |
|
|
|
intent.type = type//设置类型 |
|
|
|
intent.putExtra(Intent.EXTRA_MIME_TYPES, type) |
|
|
|
activity.startActivityForResult(intent, requestCode) |
|
|
|
activity.startActivityForResult(intent, requestCode) |
|
|
|
} catch (e: java.lang.Exception) { |
|
|
|
} catch (e: java.lang.Exception) { |
|
|
|
e.printStackTrace() |
|
|
|
e.printStackTrace() |
|
|
@ -131,7 +131,7 @@ object FilePicker { |
|
|
|
fragment: Fragment, |
|
|
|
fragment: Fragment, |
|
|
|
requestCode: Int, |
|
|
|
requestCode: Int, |
|
|
|
title: String = fragment.getString(R.string.select_file), |
|
|
|
title: String = fragment.getString(R.string.select_file), |
|
|
|
type: String, |
|
|
|
type: Array<String>, |
|
|
|
allowExtensions: Array<String>, |
|
|
|
allowExtensions: Array<String>, |
|
|
|
default: (() -> Unit)? = null |
|
|
|
default: (() -> Unit)? = null |
|
|
|
) { |
|
|
|
) { |
|
|
@ -148,7 +148,7 @@ object FilePicker { |
|
|
|
1 -> { |
|
|
|
1 -> { |
|
|
|
try { |
|
|
|
try { |
|
|
|
val intent = createSelectFileIntent() |
|
|
|
val intent = createSelectFileIntent() |
|
|
|
intent.type = type//设置类型 |
|
|
|
intent.putExtra(Intent.EXTRA_MIME_TYPES, type) |
|
|
|
fragment.startActivityForResult(intent, requestCode) |
|
|
|
fragment.startActivityForResult(intent, requestCode) |
|
|
|
} catch (e: java.lang.Exception) { |
|
|
|
} catch (e: java.lang.Exception) { |
|
|
|
e.printStackTrace() |
|
|
|
e.printStackTrace() |
|
|
|