From 92b30e119a7503ee9e07cc8674507116a16b0c2a Mon Sep 17 00:00:00 2001 From: Li Guanglin <60415467+guanglinn@users.noreply.github.com> Date: Mon, 19 Aug 2024 05:48:30 +0800 Subject: [PATCH] Filebrowser: Fix file modification time not reloaded, closes #2196 (PR #2385) --- .../frontend/filebrowser/GsFileBrowserListAdapter.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/net/gsantner/opoc/frontend/filebrowser/GsFileBrowserListAdapter.java b/app/src/main/java/net/gsantner/opoc/frontend/filebrowser/GsFileBrowserListAdapter.java index 923d229d0d..071f827c29 100644 --- a/app/src/main/java/net/gsantner/opoc/frontend/filebrowser/GsFileBrowserListAdapter.java +++ b/app/src/main/java/net/gsantner/opoc/frontend/filebrowser/GsFileBrowserListAdapter.java @@ -187,11 +187,11 @@ public void onBindViewHolder(@NonNull FilesystemViewerViewHolder holder, int pos final boolean isFile = file.isFile(); holder.description.setText(!_dopt.descModtimeInsteadOfParent || holder.title.getText().toString().equals("..") - ? descriptionFile.getAbsolutePath() : formatFileDescription(file, _prefApp.getString("pref_key__file_description_format", ""))); + ? descriptionFile.getAbsolutePath() : formatFileDescription(file, _prefApp.getString("pref_key__file_description_format", ""))); holder.description.setTextColor(ContextCompat.getColor(_context, _dopt.secondaryTextColor)); holder.image.setImageResource(isSelected ? _dopt.selectedItemImage : isFile ? _dopt.fileImage : _dopt.folderImage); holder.image.setColorFilter(ContextCompat.getColor(_context, - isSelected ? _dopt.accentColor : isFile? _dopt.fileColor : _dopt.folderColor), + isSelected ? _dopt.accentColor : isFile ? _dopt.fileColor : _dopt.folderColor), android.graphics.PorterDuff.Mode.SRC_ATOP); if (!isSelected && isFavourite) { holder.image.setColorFilter(0xFFE3B51B); @@ -668,7 +668,7 @@ private void loadFolder(final File folder, final @Nullable File toShow) { for (final File externalFileDir : ContextCompat.getExternalFilesDirs(_context, null)) { for (final File file : newData) { final String absPath = file.getAbsolutePath(); - final String absExt = externalFileDir.getAbsolutePath() ; + final String absExt = externalFileDir.getAbsolutePath(); if (!canWrite(file) && !absPath.equals("/") && absExt.startsWith(absPath)) { final int depth = GsTextUtils.countChars(absPath, '/')[0]; if (depth < 3) { @@ -736,6 +736,8 @@ private void loadFolder(final File folder, final @Nullable File toShow) { if (_currentFile != null) { _recyclerView.post(() -> { showAndFlash(_currentFile); + final int position = getFilePosition(_currentFile); + if (position >= 0) notifyItemChanged(position); _currentFile = null; }); }