From d2389f771b18419bf7974f8cd447b6d14902c546 Mon Sep 17 00:00:00 2001 From: daigorian Date: Mon, 27 Sep 2021 11:29:39 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=A2=E3=82=A4=E3=83=86=E3=83=A0=E5=89=8A?= =?UTF-8?q?=E9=99=A4=E6=99=82=E3=80=81=E6=9C=80=E5=BE=8C=E5=B0=BE=E3=81=AE?= =?UTF-8?q?=E3=80=8C=E7=B6=9A=E3=81=8D=E3=82=92=E8=AA=AD=E3=81=BF=E8=BE=BC?= =?UTF-8?q?=E3=82=80=E3=80=8D=E3=82=A2=E3=82=A4=E3=83=86=E3=83=A0=E3=81=AE?= =?UTF-8?q?=E3=82=AA=E3=83=95=E3=82=BB=E3=83=83=E3=83=88=E3=81=8C=E8=AA=BF?= =?UTF-8?q?=E6=95=B4=E3=81=95=E3=82=8C=E3=81=AA=E3=81=84=E3=81=9F=E3=82=81?= =?UTF-8?q?=E8=AA=AD=E3=81=BF=E8=BE=BC=E3=81=BE=E3=82=8C=E3=81=AA=E3=81=84?= =?UTF-8?q?=E5=8B=95=E7=94=BB=E3=81=8C=E5=87=BA=E3=81=A6=E3=81=84=E3=81=9F?= =?UTF-8?q?=E5=95=8F=E9=A1=8C=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DeleteEnabledArrayObjectAdapter.kt | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/app/src/main/java/com/daigorian/epcltvapp/DeleteEnabledArrayObjectAdapter.kt b/app/src/main/java/com/daigorian/epcltvapp/DeleteEnabledArrayObjectAdapter.kt index a212da2..a85a047 100644 --- a/app/src/main/java/com/daigorian/epcltvapp/DeleteEnabledArrayObjectAdapter.kt +++ b/app/src/main/java/com/daigorian/epcltvapp/DeleteEnabledArrayObjectAdapter.kt @@ -29,14 +29,17 @@ 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 ->{ @@ -44,12 +47,46 @@ open class DeleteEnabledArrayObjectAdapter : ArrayObjectAdapter { (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