Skip to content

Commit

Permalink
File browser: Make Folder and file icons visually better distinct (ou…
Browse files Browse the repository at this point in the history
…tlined icon for file), (PR by @wshoy #2331 fixes #2186)
  • Loading branch information
wshoy authored Jul 16, 2024
1 parent 92744b3 commit 0508b4b
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ public static GsFileBrowserOptions.Options prepareFsViewerOpts(
opts.secondaryTextColor = R.color.secondary_text;
opts.backgroundColor = R.color.background;
opts.titleTextColor = R.color.primary_text;
opts.fileColor = R.color.file;
opts.folderColor = R.color.folder;
opts.fileImage = R.drawable.ic_file_white_24dp;
opts.folderImage = R.drawable.ic_folder_white_24dp;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ public GsFileBrowserListAdapter(GsFileBrowserOptions.Options options, Context co
if (_dopt.titleTextColor == 0) {
_dopt.titleTextColor = _dopt.primaryTextColor;
}
if (_dopt.fileColor == 0) {
_dopt.fileColor = cu.getResId(context, GsContextUtils.ResType.COLOR, "file");
}
if (_dopt.folderColor == 0) {
_dopt.folderColor = cu.getResId(context, GsContextUtils.ResType.COLOR, "folder");
}

loadFolder(_dopt.startFolder != null ? _dopt.startFolder : _dopt.rootFolder, null);
}
Expand Down Expand Up @@ -185,7 +191,7 @@ public void onBindViewHolder(@NonNull FilesystemViewerViewHolder holder, int pos
? descriptionFile.getAbsolutePath() : formatFileDescription(file, _prefApp.getString("pref_key__file_description_format", "")));
}, 60);
holder.image.setColorFilter(ContextCompat.getColor(_context,
isSelected ? _dopt.accentColor : _dopt.secondaryTextColor),
isSelected ? _dopt.accentColor : (!file.isFile() ? _dopt.folderColor : _dopt.fileColor)),
android.graphics.PorterDuff.Mode.SRC_ATOP);
if (!isSelected && isFavourite) {
holder.image.setColorFilter(0xFFE3B51B);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ public static class Options {
public int secondaryTextColor = 0;
@ColorRes
public int titleTextColor = 0;
@ColorRes
public int fileColor = 0;
@ColorRes
public int folderColor = 0;

public Collection<File> favouriteFiles, recentFiles, popularFiles = null;
public GsCallback.a1<CharSequence> setTitle = null, setSubtitle = null;
Expand Down
6 changes: 4 additions & 2 deletions app/src/main/res/drawable/ic_file_gray_24dp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FFB4B4B4"
android:pathData="M6,2c-1.1,0 -1.99,0.9 -1.99,2L4,20c0,1.1 0.89,2 1.99,2L18,22c1.1,0 2,-0.9 2,-2L20,8l-6,-6L6,2zM13,9L13,3.5L18.5,9L13,9z"/>
android:strokeColor="#FF757575"
android:strokeWidth="3"
android:strokeLineJoin="round"
android:pathData="M6,2c-1.1,0 -1.99,0.9 -1.99,2L4,20c0,1.1 0.89,2 1.99,2L18,22c1.1,0 2,-0.9 2,-2L20,8l-6,-6L6,2zM13,9z"/>
</vector>
6 changes: 4 additions & 2 deletions app/src/main/res/drawable/ic_file_white_24dp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#ffffffff"
android:pathData="M6,2c-1.1,0 -1.99,0.9 -1.99,2L4,20c0,1.1 0.89,2 1.99,2L18,22c1.1,0 2,-0.9 2,-2L20,8l-6,-6L6,2zM13,9L13,3.5L18.5,9L13,9z"/>
android:strokeColor="#FFFFFFFF"
android:strokeWidth="3"
android:strokeLineJoin="round"
android:pathData="M6,2c-1.1,0 -1.99,0.9 -1.99,2L4,20c0,1.1 0.89,2 1.99,2L18,22c1.1,0 2,-0.9 2,-2L20,8l-6,-6L6,2zM13,9z"/>
</vector>
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/ic_folder_gray_24dp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FFB4B4B4"
android:fillColor="#FF757575"
android:pathData="M10,4H4c-1.1,0 -1.99,0.9 -1.99,2L2,18c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2V8c0,-1.1 -0.9,-2 -2,-2h-8l-2,-2z"/>
</vector>
4 changes: 3 additions & 1 deletion app/src/main/res/values-night/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
<!-- Named colors -->
<color name="colorPrimary">@color/primary_dark</color>
<color name="primary_text">@color/white</color>
<color name="secondary_text">#9e9e9e</color>
<color name="secondary_text">@color/dark__secondary_text</color>
<color name="file">@color/dark__file</color>
<color name="folder">@color/dark__folder</color>
<color name="background">@color/dark__background</color>
<color name="background_2">@color/dark__background_2</color>
<color name="textActionBarColor">@color/dark__background_2</color>
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
<color name="colorPrimary">@color/primary</color>
<color name="primary_text">@color/light__primary_text</color>
<color name="secondary_text">@color/light__secondary_text</color>
<color name="file">@color/light__file</color>
<color name="folder">@color/light__folder</color>
<color name="background">@color/light__background</color>
<color name="background_2">@color/light__background_2</color>
<color name="textActionBarColor">@color/lighter_grey</color>
Expand All @@ -36,11 +38,15 @@
<color name="light__background_2">#F9F9F9</color>
<color name="light__primary_text">#212121</color>
<color name="light__secondary_text">#757575</color>
<color name="light__file">#757575</color>
<color name="light__folder">#757575</color>

<color name="dark__background">#222222</color>
<color name="dark__background_2">#424242</color>
<color name="dark__primary_text">@color/white</color>
<color name="dark__secondary_text">#9E9E9E</color>
<color name="dark__file">#9E9E9E</color>
<color name="dark__folder">#9E9E9E</color>

<color name="ic_launcher_background">#636363</color>
<color name="white">#FFFFFFFF</color>
Expand Down

0 comments on commit 0508b4b

Please sign in to comment.