更新条件を修正

This commit is contained in:
ろむねこ 2024-01-25 14:55:55 +09:00
parent 5f89955d80
commit ce1686a1d7
No known key found for this signature in database
GPG Key ID: FA1F39A1BA37D168
2 changed files with 14 additions and 6 deletions

View File

@ -88,18 +88,18 @@ public class LacertaSelectDirDialog extends DialogFragment {
getActivity().runOnUiThread(() -> {
int currentCount = adapter.getItemCount();
String currentDirId = adapter.getCurrentId();
if (currentDirId == null && libraryItemPage.getPageId() != null) {
// Rootから推移してきた場合
if (currentDirId == null) {
// Rootが関わる推移 (Rootからの推移)
adapter.setListItems(libraryItemPage);
adapter.notifyItemRangeRemoved(0, currentCount);
adapter.notifyItemRangeInserted(0, libraryItemPage.getListItems().size());
} else if (libraryItemPage.getPageId() == null) {
// Rootに推移した場合
// Rootが関わる推移 (Rootへの推移)
adapter.setListItems(libraryItemPage);
adapter.notifyItemRangeRemoved(0, currentCount);
adapter.notifyItemRangeInserted(0, libraryItemPage.getListItems().size());
} else if (currentDirId != null && libraryItemPage.getPageId() != null) {
// 通常の遷
} else if (libraryItemPage.getPageId() != null) {
// Rootが関わらない推
adapter.setListItems(libraryItemPage);
adapter.notifyItemRangeRemoved(1, currentCount);
adapter.notifyItemRangeInserted(1, libraryItemPage.getListItems().size());

View File

@ -59,7 +59,15 @@ public class SelectDirDialogItemAdapter extends RecyclerView.Adapter<SelectDirDi
}
public String getCurrentId() {
return this.libraryItemPage == null ? null : this.libraryItemPage.getPageId();
if (this.libraryItemPage == null) {
return null;
} else {
if (this.libraryItemPage.getPageId() == null) {
return null;
} else {
return this.libraryItemPage.getPageId();
}
}
}
public static class SelectDirDialogItemViewHolder extends RecyclerView.ViewHolder {