From 58f9d8155547a040eb7d38d7fd7a59e6962ccb79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Thu, 25 Jan 2024 14:36:34 +0900 Subject: [PATCH] fix --- .../component/common/LacertaSelectDirDialog.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/component/common/src/main/java/one/nem/lacerta/component/common/LacertaSelectDirDialog.java b/component/common/src/main/java/one/nem/lacerta/component/common/LacertaSelectDirDialog.java index 7e07448b..f5dd84df 100644 --- a/component/common/src/main/java/one/nem/lacerta/component/common/LacertaSelectDirDialog.java +++ b/component/common/src/main/java/one/nem/lacerta/component/common/LacertaSelectDirDialog.java @@ -83,9 +83,15 @@ public class LacertaSelectDirDialog extends DialogFragment { lacertaLibrary.getFolderList(targetDirId).thenAccept(libraryItemPage -> { getActivity().runOnUiThread(() -> { int currentCount = adapter.getItemCount(); - adapter.notifyItemRangeRemoved(1, currentCount); // Backボタンを除くすべてのアイテムを削除 - adapter.setListItems(libraryItemPage); - adapter.notifyItemRangeInserted(1, libraryItemPage.getListItems().size()); + if (targetDirId == null) { // When root folder + adapter.setListItems(libraryItemPage); + adapter.notifyItemRangeRemoved(0, currentCount); + adapter.notifyItemRangeInserted(0, libraryItemPage.getListItems().size()); + } else { // When child folder + adapter.setListItems(libraryItemPage); + adapter.notifyItemRangeRemoved(1, currentCount); + adapter.notifyItemRangeInserted(1, libraryItemPage.getListItems().size()); + } }); }); }