carlw
08/27/2018, 1:37 PMiLobanov
08/27/2018, 1:49 PMchickenfresh
08/27/2018, 3:37 PMprivate val listener = ChangeListener<Number> { _, _, nv ->
if ( userData != null) {
val scrollable = userData as ScrollableItemWrapper
val pos = listView.height - this.height - nv.toDouble()
if (scrollable.lastItem && pos > 0 && (pos < this.height/4) && index+1 == maxRange*50) {
println("$currentRange cur.range| ${scrollable.lastItem} item| $pos pos| ${this.height} height| $index index| ${maxRange*50} max.range")
}
if ( scrollable.lastItem && pos > 0 && (pos < this.height/4) && index+1 == maxRange*50) {
runAsync {
getNextMessages()
} ui {
records.addAll( it )
listView.scrollTo(index+1-(listView.height/this.height).toInt())
}
}
}
}
final version of listener for endless scroll, without any problems 🙂chickenfresh
08/27/2018, 3:41 PMcarlw
08/27/2018, 3:43 PMchickenfresh
08/27/2018, 3:43 PMchickenfresh
08/27/2018, 3:44 PMcarlw
08/27/2018, 3:47 PMcarlw
08/27/2018, 3:48 PMcarlw
08/27/2018, 3:48 PMchickenfresh
08/27/2018, 3:51 PMscrollTo
as it pauses scrolling, for example I’m scrolling with speed 10 rows/sec and then it drops the speed/stopschickenfresh
08/27/2018, 3:51 PMchickenfresh
08/27/2018, 3:52 PMseiv
08/27/2018, 5:41 PMbj0
08/28/2018, 12:33 AMchickenfresh
08/28/2018, 2:30 AMprivate val listener = ChangeListener<Number> { _, _, nv ->
if ( userData != null) {
curIndex = index
val pos = listView.height - this.height - nv.toDouble()
val rowsOnView = (listView.height/this.height).toInt()
val firstPos = (pos-this.height*rowsOnView).toInt()
if (index == 0 && ((firstPos > 0 && firstPos<this.height/2) || (firstPos < 0 && firstPos > -(this.height/2)))){
runAsync {
getPrevMessages()
} ui {
records.addAll(0, it)
listView.scrollTo(index+50)
}
} else if ( (userData as ScrollableItemWrapper).lastItem && pos > 0 && (pos < this.height/4) && index+1 == maxRange*50) {
runAsync {
getNextMessages()
} ui {
records.addAll( it )
listView.scrollTo(index+1-rowsOnView)
}
}
}
}
chickenfresh
08/28/2018, 2:33 AMthis.height
values to 60 so I’m dividing it to 2 and 4, but its about accuracy
and length of list is 50, may be its better to have private var
with size of last ‘update’, but I’m sure so left it as default value for mechickenfresh
08/28/2018, 4:07 AMoverride fun updateItem
is so buggy, I’m getting ghost objects and duplicates everywherechickenfresh
08/28/2018, 4:07 AMchickenfresh
08/28/2018, 4:18 AMoverride fun updateItem
returns ghost objects from nowhere if there’s not enough objects to fulfil ui, why’s that and how can be fixed?
I can capture screen for detailscarlw
08/28/2018, 10:19 AMcarlw
08/28/2018, 10:20 AMchickenfresh
08/28/2018, 10:40 AMchickenfresh
08/28/2018, 10:41 AMif( item != null && !empty ) { ... } else {
text = null
userData = null
}
abhinay
08/28/2018, 12:25 PMInherited Platform declaration clash
. I am not extending an abstract class and my class doesn't override the method. Basically, its just this:
class MyTableRowSkin<S>(val tableRow: TableRow<S>) : TableRowSkin<S>(tableRow) {
}
The compilation error is thrown for fun createCell()
. TableRowSkin
has a body for the function, which is inherited from TableRowSkinBase
(where the method is abstract). Please note, I am using JDK 9 where TableRowSkin
is a public API. cc @edvincarlw
08/28/2018, 12:26 PMedvin
08/28/2018, 1:03 PMtableRow
declared as a val
in the constructor is shadowing a getTableRow()
or a tableRow
property in TableRowSkin
? I don't have JDK9 installed so I can't confirm, but that's my first thought.edvin
08/28/2018, 1:04 PMval
, since you're passing it on to the TableRowSkin
constructor, hence it is probably already available to you, no need to declare a new property to access it.abhinay
08/28/2018, 1:10 PMval
. It doesn't help. I think tableRow
is not the problem here since it doesn't complain about getTableRow()
.abhinay
08/28/2018, 1:10 PM