Skip to content

Commit

Permalink
アイテム削除時、最後尾の「続きを読み込む」アイテムのオフセットが調整されないため読み込まれない動画が出ていた問題を修正
Browse files Browse the repository at this point in the history
  • Loading branch information
daigorian committed Sep 27, 2021
1 parent be73309 commit d2389f7
Showing 1 changed file with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,64 @@ open class DeleteEnabledArrayObjectAdapter : ArrayObjectAdapter {
val horizontalArrayObjectAdapter = row.adapter as? ArrayObjectAdapter
horizontalArrayObjectAdapter?.let{
var horizontalIndex = 0
var horizontalDeletedCount = 0
while(horizontalIndex < it.size()) {

when(it.get(horizontalIndex)){
//アイテムが見つかったら削除する
is RecordedProgram ->{
if(item is RecordedProgram &&
(it.get(horizontalIndex) as RecordedProgram).id == item.id){
it.removeItems(horizontalIndex,1)
horizontalIndex -= 1
horizontalDeletedCount += 1
}
}
is RecordedItem ->{
if(item is RecordedItem &&
(it.get(horizontalIndex) as RecordedItem).id == item.id){
it.removeItems(horizontalIndex,1)
horizontalIndex -= 1
horizontalDeletedCount += 1
}
}
//最後尾にある「続きを読み込む」アイテムがきたら、削除した分だけオフセットを下げる
is GetRecordedParam -> {
val currentItem = it.get(horizontalIndex) as GetRecordedParam
val newItem = GetRecordedParam(
limit = currentItem.limit,
offset = currentItem.offset - horizontalDeletedCount,
reverse = currentItem.reverse,
rule = currentItem.rule,
genre1 = currentItem.genre1,
channel = currentItem.channel,
keyword = currentItem.keyword,
hasTs = currentItem.hasTs,
recording = currentItem.recording
)
it.replace(horizontalIndex,newItem)
}
is GetRecordedParamV2 -> {
val currentItem = it.get(horizontalIndex) as GetRecordedParamV2
val newItem = GetRecordedParamV2(
isHalfWidth = currentItem.isHalfWidth,
offset = currentItem.offset - horizontalDeletedCount,
limit = currentItem.limit,
isReverse = currentItem.isReverse,
ruleId = currentItem.ruleId,
channelId = currentItem.channelId,
genre = currentItem.genre,
keyword = currentItem.keyword,
hasOriginalFile = currentItem.hasOriginalFile,
)
it.replace(horizontalIndex,newItem)
}
//現状上記以外のものは入らないはずだが、来たらitemが同じ時に限ってけしてやる。
else ->{
if(it.get(horizontalIndex).equals(item)){
it.removeItems(horizontalIndex,1)
horizontalIndex -= 1
horizontalDeletedCount += 1
}
}
}// when
Expand Down

0 comments on commit d2389f7

Please sign in to comment.