diff --git a/component/common/src/main/java/one/nem/lacerta/component/common/picker/LacertaDirPickerDialog.java b/component/common/src/main/java/one/nem/lacerta/component/common/picker/LacertaDirPickerDialog.java index 683f158a..5d135b10 100644 --- a/component/common/src/main/java/one/nem/lacerta/component/common/picker/LacertaDirPickerDialog.java +++ b/component/common/src/main/java/one/nem/lacerta/component/common/picker/LacertaDirPickerDialog.java @@ -18,6 +18,8 @@ import one.nem.lacerta.component.common.R; import one.nem.lacerta.component.common.picker.base.LacertaFilePickerAdapterBase; import one.nem.lacerta.component.common.picker.base.LacertaFilePickerDialogBase; import one.nem.lacerta.data.LacertaLibrary; +import one.nem.lacerta.model.ListItemType; +import one.nem.lacerta.model.PublicPath; @AndroidEntryPoint public class LacertaDirPickerDialog extends LacertaFilePickerDialogBase { @@ -53,13 +55,13 @@ public class LacertaDirPickerDialog extends LacertaFilePickerDialogBase { @Override public void onItemSelected(String dirId) { updateList(adapter, dirId); - currentDirTextView.setText(dirId); + updatePublicPath(currentDirTextView, dirId); } @Override public void onBackSelected(String dirId) { updateList(adapter, dirId); - currentDirTextView.setText(dirId); + updatePublicPath(currentDirTextView, dirId); } }); @@ -88,10 +90,20 @@ public class LacertaDirPickerDialog extends LacertaFilePickerDialogBase { return builder.create(); } + private void updatePublicPath(TextView currentDirTextView, String folderId) { + lacertaLibrary.getPublicPath(folderId, ListItemType.ITEM_TYPE_FOLDER).thenAccept(publicPath -> { + this.updatePathTextView(currentDirTextView, publicPath); + }); + } + private void updateList(LacertaFilePickerAdapterBase adapter, String folderId) { lacertaLibrary.getFolderList(folderId).thenAccept(libraryItemPage -> { - adapter.setListItems(libraryItemPage); - this.updateListView(adapter, libraryItemPage, adapter.getItemCount(), adapter.getCurrentId()); + int currentCount = adapter.getItemCount(); + String currentId = adapter.getCurrentId(); +// adapter.setListItems(libraryItemPage); + getActivity().runOnUiThread(() -> { + this.updateListView(adapter, libraryItemPage, currentCount, currentId); + }); }); } } diff --git a/component/common/src/main/java/one/nem/lacerta/component/common/picker/base/LacertaFilePickerDialogBase.java b/component/common/src/main/java/one/nem/lacerta/component/common/picker/base/LacertaFilePickerDialogBase.java index b765690a..2fedd677 100644 --- a/component/common/src/main/java/one/nem/lacerta/component/common/picker/base/LacertaFilePickerDialogBase.java +++ b/component/common/src/main/java/one/nem/lacerta/component/common/picker/base/LacertaFilePickerDialogBase.java @@ -51,7 +51,11 @@ public class LacertaFilePickerDialogBase extends DialogFragment { } } protected void updateListView(LacertaFilePickerAdapterBase adapter, LibraryItemPage libraryItemPage, int currentCount, String currentDirId) { - if (currentDirId == null) { + if (currentCount == 0) { + // 初回表示 + adapter.setListItems(libraryItemPage); + adapter.notifyItemRangeInserted(0, libraryItemPage.getListItems().size()); + } else if (currentDirId == null) { // Rootが関わる推移 (Rootからの推移) adapter.setListItems(libraryItemPage); adapter.notifyItemRangeRemoved(0, currentCount);