Skip to content

Commit

Permalink
Reverted removal of startup folders
Browse files Browse the repository at this point in the history
  • Loading branch information
harshad1 committed Nov 7, 2024
1 parent bc817e8 commit e9d6b24
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,8 @@ public GsFileBrowserOptions.Options getFilesystemFragmentOptions(GsFileBrowserOp
public void onFsViewerConfig(GsFileBrowserOptions.Options dopt) {
dopt.descModtimeInsteadOfParent = true;
dopt.rootFolder = _appSettings.getNotebookDirectory();
final File file = MarkorContextUtils.getValidIntentFile(getIntent(), dopt.rootFolder);
final File fallback = _appSettings.getFolderToLoadByMenuId(_appSettings.getAppStartupFolderMenuId());
final File file = MarkorContextUtils.getValidIntentFile(getIntent(), fallback);
if (!GsFileBrowserListAdapter.isVirtualFolder(file) && file.isFile()) {
dopt.startFolder = file.getParentFile();
toShow = file;
Expand Down
51 changes: 51 additions & 0 deletions app/src/main/java/net/gsantner/markor/model/AppSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,57 @@ public String getNavigationBarColor() {
return getString(R.string.pref_key__navigationbar_color, "#000000");
}

public String getAppStartupFolderMenuId() {
return getString(R.string.pref_key__app_start_folder, "notebook");
}

public File getFolderToLoadByMenuId(String itemId) {
List<Pair<File, String>> appDataPublicDirs = _cu.getAppDataPublicDirs(_context, false, true, false);
switch (itemId) {
case "storage": {
return new File("/storage");
}
case "notebook": {
return getNotebookDirectory();
}
case "popular_documents": {
return GsFileBrowserListAdapter.VIRTUAL_STORAGE_POPULAR;
}
case "recently_viewed_documents": {
return GsFileBrowserListAdapter.VIRTUAL_STORAGE_RECENTS;
}
case "favourites": {
return GsFileBrowserListAdapter.VIRTUAL_STORAGE_FAVOURITE;
}
case "appdata_private": {
return _cu.getAppDataPrivateDir(_context);
}
case "internal_storage": {
return Environment.getExternalStorageDirectory();
}
case "appdata_sdcard_1": {
if (appDataPublicDirs.size() > 0) {
return appDataPublicDirs.get(0).first;
}
return Environment.getExternalStorageDirectory();
}
case "appdata_sdcard_2": {
if (appDataPublicDirs.size() > 1) {
return appDataPublicDirs.get(1).first;
}
return Environment.getExternalStorageDirectory();
}
case "appdata_public": {
appDataPublicDirs = _cu.getAppDataPublicDirs(_context, true, false, false);
if (appDataPublicDirs.size() > 0) {
return appDataPublicDirs.get(0).first;
}
return _cu.getAppDataPrivateDir(_context);
}
}
return getNotebookDirectory();
}

public int getTabWidth() {
return getInt(R.string.pref_key__tab_width_v2, 1);
}
Expand Down

0 comments on commit e9d6b24

Please sign in to comment.