rely on selected state, not activated on long click
This commit is contained in:
parent
2545458c4a
commit
f3fd84dab9
|
@ -39,9 +39,9 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList<Direc
|
||||||
|
|
||||||
fun toggleItemSelection(itemView: View, select: Boolean) {
|
fun toggleItemSelection(itemView: View, select: Boolean) {
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP)
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP)
|
||||||
itemView.dir_frame.isActivated = select
|
itemView.dir_frame.isSelected = select
|
||||||
else
|
else
|
||||||
itemView.dir_thumbnail.isActivated = select
|
itemView.dir_thumbnail.isSelected = select
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,9 +39,9 @@ class MediaAdapter(val activity: SimpleActivity, val media: MutableList<Medium>,
|
||||||
|
|
||||||
fun toggleItemSelection(itemView: View, select: Boolean) {
|
fun toggleItemSelection(itemView: View, select: Boolean) {
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP)
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP)
|
||||||
itemView.medium_thumbnail_holder.isActivated = select
|
itemView.medium_thumbnail_holder.isSelected = select
|
||||||
else
|
else
|
||||||
itemView.medium_thumbnail.isActivated = select
|
itemView.medium_thumbnail.isSelected = select
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,22 +148,22 @@ class MediaAdapter(val activity: SimpleActivity, val media: MutableList<Medium>,
|
||||||
return selectedMedia
|
return selectedMedia
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
|
||||||
views.add(holder.bindView(activity, multiSelectorMode, multiSelector, media[position]))
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ViewHolder {
|
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ViewHolder {
|
||||||
val view = LayoutInflater.from(parent?.context).inflate(R.layout.photo_video_item, parent, false)
|
val view = LayoutInflater.from(parent?.context).inflate(R.layout.photo_video_item, parent, false)
|
||||||
return ViewHolder(view, itemClick)
|
return ViewHolder(view, itemClick)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||||
|
views.add(holder.bindView(activity, multiSelectorMode, multiSelector, media[position]))
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getItemCount() = media.size
|
||||||
|
|
||||||
fun updateDisplayFilenames(display: Boolean) {
|
fun updateDisplayFilenames(display: Boolean) {
|
||||||
displayFilenames = display
|
displayFilenames = display
|
||||||
notifyDataSetChanged()
|
notifyDataSetChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getItemCount() = media.size
|
|
||||||
|
|
||||||
class ViewHolder(view: View, val itemClick: (Medium) -> (Unit)) : SwappingHolder(view, MultiSelector()) {
|
class ViewHolder(view: View, val itemClick: (Medium) -> (Unit)) : SwappingHolder(view, MultiSelector()) {
|
||||||
fun bindView(activity: SimpleActivity, multiSelectorCallback: ModalMultiSelectorCallback, multiSelector: MultiSelector, medium: Medium): View {
|
fun bindView(activity: SimpleActivity, multiSelectorCallback: ModalMultiSelectorCallback, multiSelector: MultiSelector, medium: Medium): View {
|
||||||
itemView.play_outline.visibility = if (medium.isVideo) View.VISIBLE else View.GONE
|
itemView.play_outline.visibility = if (medium.isVideo) View.VISIBLE else View.GONE
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<selector>
|
<selector>
|
||||||
<item
|
<item
|
||||||
android:drawable="@color/activated_item_foreground"
|
android:drawable="@color/activated_item_foreground"
|
||||||
android:state_activated="true"/>
|
android:state_selected="true"/>
|
||||||
</selector>
|
</selector>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<item android:drawable="@drawable/selected_pressed_mask" android:state_pressed="true"/>
|
<item android:drawable="@drawable/selected_pressed_mask" android:state_pressed="true"/>
|
||||||
<item android:drawable="@drawable/selected_mask" android:state_activated="true"/>
|
<item android:drawable="@drawable/selected_mask" android:state_selected="true"/>
|
||||||
</selector>
|
</selector>
|
||||||
|
|
Loading…
Reference in New Issue