Skip to content

Commit

Permalink
Many fixes to navigation and go back
Browse files Browse the repository at this point in the history
  • Loading branch information
harshad1 committed Jul 29, 2024
1 parent a3cc214 commit a25a941
Show file tree
Hide file tree
Showing 9 changed files with 186 additions and 157 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ public static GsFileBrowserOptions.Options prepareFsViewerOpts(
opts.newDirButtonText = R.string.create_folder;
opts.upButtonEnable = true;
opts.homeButtonEnable = true;
opts.mustStartWithRootFolder = false;
opts.contentDescriptionFolder = R.string.folder;
opts.contentDescriptionSelected = R.string.selected;
opts.contentDescriptionFile = R.string.file;
Expand All @@ -68,6 +67,7 @@ public static GsFileBrowserOptions.Options prepareFsViewerOpts(
opts.folderColor = R.color.folder;
opts.fileImage = R.drawable.ic_file_white_24dp;
opts.folderImage = R.drawable.ic_folder_white_24dp;
opts.descriptionFormat = appSettings.getString(R.string.pref_key__file_description_format, "");

opts.titleText = R.string.select;

Expand Down Expand Up @@ -109,6 +109,7 @@ public static GsFileBrowserDialog showFileDialog(
) {
final GsFileBrowserOptions.Options opts = prepareFsViewerOpts(context, false, listener);
opts.fileOverallFilter = fileOverallFilter;
opts.descModtimeInsteadOfParent = true;
return showDialog(fm, opts);
}

Expand All @@ -119,6 +120,7 @@ public static GsFileBrowserDialog showFolderDialog(
) {
final GsFileBrowserOptions.Options opts = prepareFsViewerOpts(context, true, listener);
opts.okButtonText = R.string.select_this_folder;
opts.descModtimeInsteadOfParent = true;
return showDialog(fm, opts);
}
}
4 changes: 2 additions & 2 deletions app/src/main/java/net/gsantner/markor/model/AppSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ public void addRecentFile(final File file) {
public void setFavouriteFiles(final Collection<File> files) {
final Set<String> set = new LinkedHashSet<>();
for (final File f : files) {
if (f != null && (f.exists() || GsFileBrowserListAdapter.isVirtualStorage(f))) {
if (f != null && (f.exists() || GsFileBrowserListAdapter.isVirtualFolder(f))) {
set.add(f.getAbsolutePath());
}
}
Expand Down Expand Up @@ -600,7 +600,7 @@ public static Set<File> getFileSet(final List<String> paths) {
final Set<File> set = new LinkedHashSet<>();
for (final String fp : paths) {
final File f = new File(fp);
if (f.exists() || GsFileBrowserListAdapter.isVirtualStorage(f)) {
if (f.exists() || GsFileBrowserListAdapter.isVirtualFolder(f)) {
set.add(f);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ public void onViewCreated(final View root, final @Nullable Bundle savedInstanceS
_toolBar.setTitleTextColor(rcolor(_dopt.titleTextColor));
_toolBar.setTitle(_dopt.titleText);
_toolBar.setSubtitleTextColor(rcolor(_dopt.secondaryTextColor));
_toolBar.setSubtitleTextAppearance(activity, R.style.TextAppearance_AppCompat_Subhead_Ellipsize);

_homeButton.setImageResource(_dopt.homeButtonImage);
_homeButton.setVisibility(_dopt.homeButtonEnable ? View.VISIBLE : View.GONE);
Expand All @@ -149,9 +150,9 @@ public void onViewCreated(final View root, final @Nullable Bundle savedInstanceS

root.setBackgroundColor(rcolor(_dopt.backgroundColor));

// final LinearLayoutManager lam = (LinearLayoutManager) _recyclerList.getLayoutManager();
// final DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(activity, lam.getOrientation());
// _recyclerList.addItemDecoration(dividerItemDecoration);
final LinearLayoutManager lam = (LinearLayoutManager) _recyclerList.getLayoutManager();
final DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(activity, lam.getOrientation());
_recyclerList.addItemDecoration(dividerItemDecoration);
_recyclerList.setItemViewCacheSize(20);

_filesystemViewerAdapter = new GsFileBrowserListAdapter(_dopt, activity);
Expand Down Expand Up @@ -280,7 +281,7 @@ public void onFsViewerDoUiUpdate(GsFileBrowserListAdapter adapter) {
_callback.onFsViewerDoUiUpdate(adapter);
}
if (adapter.getCurrentFolder() != null) {
_toolBar.setSubtitle(adapter.getCurrentFolder().getName());
_toolBar.setSubtitle(adapter.getCurrentFolder().getPath());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,7 @@ public void onFsViewerItemLongPressed(File file, boolean doSelectMultiple) {

@Override
public boolean onBackPressed() {
if (_filesystemViewerAdapter != null && _filesystemViewerAdapter.canGoUp() && !_filesystemViewerAdapter.isCurrentFolderHome()) {
_filesystemViewerAdapter.goUp();
if (_filesystemViewerAdapter != null && _filesystemViewerAdapter.goBack()) {
return true;
}
return super.onBackPressed();
Expand Down
Loading

0 comments on commit a25a941

Please sign in to comment.