couple scrolling and item selecting related fixes

This commit is contained in:
tibbi 2018-02-07 19:20:43 +01:00
parent d4243a60e0
commit 55fb80693b
4 changed files with 16 additions and 8 deletions

View file

@ -45,7 +45,7 @@ ext {
}
dependencies {
implementation 'com.simplemobiletools:commons:3.10.6'
implementation 'com.simplemobiletools:commons:3.10.10'
implementation 'com.squareup:otto:1.3.8'
implementation 'com.facebook.stetho:stetho:1.5.0'

View file

@ -39,8 +39,13 @@ class SongAdapter(activity: SimpleActivity, var songs: ArrayList<Song>, val list
private var songsHashCode = songs.hashCode()
private var currentSong: Song? = null
private var navigationView: ViewGroup? = null
private var navigationViewHolder: NavigationViewHolder? = null
var isThirdPartyIntent = false
init {
positionOffset = LIST_HEADERS_COUNT
}
override fun getActionMenuId() = R.menu.cab
override fun prepareItemSelection(view: View) {}
@ -66,9 +71,7 @@ class SongAdapter(activity: SimpleActivity, var songs: ArrayList<Song>, val list
}
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
if (holder is NavigationViewHolder) {
} else if (holder !is TransparentViewHolder) {
if (holder !is TransparentViewHolder && holder !is NavigationViewHolder) {
val song = songs[position - LIST_HEADERS_COUNT]
val view = holder.bindView(song, !isThirdPartyIntent) { itemView, layoutPosition ->
setupView(itemView, song, layoutPosition)
@ -103,7 +106,12 @@ class SongAdapter(activity: SimpleActivity, var songs: ArrayList<Song>, val list
navigationView = activity.layoutInflater.inflate(R.layout.item_navigation, null) as ViewGroup
initNavigationView()
}
return NavigationViewHolder(navigationView!!)
if (navigationViewHolder == null) {
navigationViewHolder = NavigationViewHolder(navigationView!!)
}
return navigationViewHolder!!
}
private fun showProperties() {
@ -161,7 +169,7 @@ class SongAdapter(activity: SimpleActivity, var songs: ArrayList<Song>, val list
val SAFPath = songs[selectedPositions.first()].path
activity.handleSAFDialog(File(SAFPath)) {
selectedPositions.sortedDescending().forEach {
val song = songs[it]
val song = songs[it + positionOffset]
paths.add(song.path)
files.add(File(song.path))
removeSongs.add(song)

View file

@ -16,7 +16,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:src="@mipmap/ic_launcher"/>
android:src="@drawable/ic_headset"/>
</RelativeLayout>

View file

@ -1,5 +1,5 @@
<resources>
<dimen name="controls_row_height">60dp</dimen>
<dimen name="button_size">48dp</dimen>
<dimen name="top_art_height">200dp</dimen>
<dimen name="top_art_height">220dp</dimen>
</resources>