From fe4999384a855aea07bf2ac4a2c3f9e30234c291 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Mon, 22 Jan 2024 19:28:42 +0900 Subject: [PATCH] Fix --- .../feature/library/LibraryPageFragment.java | 3 ++- .../one/nem/lacerta/model/PublicPath.java | 19 ++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryPageFragment.java b/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryPageFragment.java index 506fe2d7..412bbbbb 100644 --- a/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryPageFragment.java +++ b/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryPageFragment.java @@ -115,7 +115,8 @@ public class LibraryPageFragment extends Fragment { Toast.makeText(getContext(), "Folder selected! folderId: " + folderId + ", folderName: " + folderName, Toast.LENGTH_SHORT).show(); FragmentNavigation fragmentNavigation = (FragmentNavigation) getActivity(); assert fragmentNavigation != null; - fragmentNavigation.navigateToFragment(LibraryPageFragment.newInstance(folderId, folderName, new PublicPath().parse(publicPath).resolve(folderName).getStringPath())); + logger.debug("LibraryTopFragment", "publicPath: " + publicPath); + fragmentNavigation.navigateToFragment(LibraryPageFragment.newInstance(folderId, folderName, publicPath == null ? new PublicPath().parse("/").resolve(folderName).getStringPath() : new PublicPath().parse(publicPath).resolve(folderName).getStringPath())); } @Override diff --git a/model/src/main/java/one/nem/lacerta/model/PublicPath.java b/model/src/main/java/one/nem/lacerta/model/PublicPath.java index ccd902cb..d1639a7d 100644 --- a/model/src/main/java/one/nem/lacerta/model/PublicPath.java +++ b/model/src/main/java/one/nem/lacerta/model/PublicPath.java @@ -39,14 +39,19 @@ public class PublicPath { } public PublicPath parse(String path) { - if (path.startsWith("/")) { + if (path == null) { this.path.clear(); - path = path.substring(1); - } - String[] pathArray = path.split("/"); - for (String p : pathArray) { - Log.d("PublicPath", "parse: " + p); - resolveInternal(p); + this.path.add("/"); + } else { + if (path.startsWith("/")) { + this.path.clear(); + path = path.substring(1); + } + String[] pathArray = path.split("/"); + for (String p : pathArray) { + Log.d("PublicPath", "parse: " + p); + resolveInternal(p); + } } return this; }