This commit is contained in:
ろむねこ 2024-01-22 19:28:42 +09:00
parent bc304f8535
commit fe4999384a
No known key found for this signature in database
GPG Key ID: FA1F39A1BA37D168
2 changed files with 14 additions and 8 deletions

View File

@ -115,7 +115,8 @@ public class LibraryPageFragment extends Fragment {
Toast.makeText(getContext(), "Folder selected! folderId: " + folderId + ", folderName: " + folderName, Toast.LENGTH_SHORT).show(); Toast.makeText(getContext(), "Folder selected! folderId: " + folderId + ", folderName: " + folderName, Toast.LENGTH_SHORT).show();
FragmentNavigation fragmentNavigation = (FragmentNavigation) getActivity(); FragmentNavigation fragmentNavigation = (FragmentNavigation) getActivity();
assert fragmentNavigation != null; 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 @Override

View File

@ -39,6 +39,10 @@ public class PublicPath {
} }
public PublicPath parse(String path) { public PublicPath parse(String path) {
if (path == null) {
this.path.clear();
this.path.add("/");
} else {
if (path.startsWith("/")) { if (path.startsWith("/")) {
this.path.clear(); this.path.clear();
path = path.substring(1); path = path.substring(1);
@ -48,6 +52,7 @@ public class PublicPath {
Log.d("PublicPath", "parse: " + p); Log.d("PublicPath", "parse: " + p);
resolveInternal(p); resolveInternal(p);
} }
}
return this; return this;
} }