mirror of
https://github.com/SimpleMobileTools/Simple-Gallery.git
synced 2024-12-19 12:04:30 +01:00
fix #438, properly handle GET_CONTENT intent
This commit is contained in:
parent
09ff1779e8
commit
124d44dfb9
@ -470,6 +470,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||||||
clipData.addItem(ClipData.Item(it))
|
clipData.addItem(ClipData.Item(it))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resultIntent.flags = Intent.FLAG_GRANT_READ_URI_PERMISSION
|
||||||
resultIntent.clipData = clipData
|
resultIntent.clipData = clipData
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
|||||||
|
|
||||||
val currAdapter = media_grid.adapter
|
val currAdapter = media_grid.adapter
|
||||||
if (currAdapter == null) {
|
if (currAdapter == null) {
|
||||||
media_grid.adapter = MediaAdapter(this, mMedia, this, mIsGetAnyIntent, mAllowPickingMultiple) {
|
media_grid.adapter = MediaAdapter(this, mMedia, this, mIsGetImageIntent || mIsGetVideoIntent || mIsGetAnyIntent, mAllowPickingMultiple) {
|
||||||
itemClicked(it.path)
|
itemClicked(it.path)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -25,7 +25,7 @@ import kotlinx.android.synthetic.main.photo_video_item_grid.view.*
|
|||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class MediaAdapter(val activity: SimpleActivity, var media: MutableList<Medium>, val listener: MediaOperationsListener?, val isPickIntent: Boolean,
|
class MediaAdapter(val activity: SimpleActivity, var media: MutableList<Medium>, val listener: MediaOperationsListener?, val isAGetIntent: Boolean,
|
||||||
val allowMultiplePicks: Boolean, val itemClick: (Medium) -> Unit) : RecyclerView.Adapter<MediaAdapter.ViewHolder>() {
|
val allowMultiplePicks: Boolean, val itemClick: (Medium) -> Unit) : RecyclerView.Adapter<MediaAdapter.ViewHolder>() {
|
||||||
|
|
||||||
private val config = activity.config
|
private val config = activity.config
|
||||||
@ -108,7 +108,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList<Medium>,
|
|||||||
override fun onPrepareActionMode(actionMode: ActionMode?, menu: Menu): Boolean {
|
override fun onPrepareActionMode(actionMode: ActionMode?, menu: Menu): Boolean {
|
||||||
menu.findItem(R.id.cab_rename).isVisible = selectedPositions.size == 1
|
menu.findItem(R.id.cab_rename).isVisible = selectedPositions.size == 1
|
||||||
menu.findItem(R.id.cab_open_with).isVisible = selectedPositions.size == 1
|
menu.findItem(R.id.cab_open_with).isVisible = selectedPositions.size == 1
|
||||||
menu.findItem(R.id.cab_confirm_selection).isVisible = isPickIntent && allowMultiplePicks && selectedPositions.size > 0
|
menu.findItem(R.id.cab_confirm_selection).isVisible = isAGetIntent && allowMultiplePicks && selectedPositions.size > 0
|
||||||
|
|
||||||
checkHideBtnVisibility(menu)
|
checkHideBtnVisibility(menu)
|
||||||
|
|
||||||
@ -279,7 +279,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList<Medium>,
|
|||||||
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ViewHolder {
|
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ViewHolder {
|
||||||
val layoutType = if (isListViewType) R.layout.photo_video_item_list else R.layout.photo_video_item_grid
|
val layoutType = if (isListViewType) R.layout.photo_video_item_list else R.layout.photo_video_item_grid
|
||||||
val view = LayoutInflater.from(parent?.context).inflate(layoutType, parent, false)
|
val view = LayoutInflater.from(parent?.context).inflate(layoutType, parent, false)
|
||||||
return ViewHolder(view, adapterListener, activity, multiSelectorMode, multiSelector, listener, allowMultiplePicks || !isPickIntent, itemClick)
|
return ViewHolder(view, adapterListener, activity, multiSelectorMode, multiSelector, listener, allowMultiplePicks || !isAGetIntent, itemClick)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||||
|
Loading…
Reference in New Issue
Block a user