Skip to content

Commit 1bd50c3

Browse files
committed
Added RowHeight and RowSpacing properties to UISkin (and simplified the SimpleFileBrowserCanvas prefab's hierarchy)
1 parent 6d57445 commit 1bd50c3

10 files changed

Lines changed: 494 additions & 504 deletions
Lines changed: 5 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -1,112 +1,6 @@
1-
= Simple File Browser (v1.6.1) =
1+
= Simple File Browser (v1.6.2) =
22

3-
Online documentation & example code available at: https://github.com/yasirkula/UnitySimpleFileBrowser
4-
E-mail: yasirkula@gmail.com
5-
6-
### ABOUT
7-
This plugin helps you show save/load dialogs during gameplay with its uGUI based file browser.
8-
9-
10-
### HOW TO
11-
The file browser can be shown either as a save dialog or a load dialog. In load mode, the returned path(s) always lead to existing files or folders. In save mode, the returned path(s) can point to non-existing files, as well.
12-
13-
File browser comes bundled with two premade skins in the Skins directory: LightSkin and DarkSkin. New UISkins can be created via "Assets-Create-yasirkula-SimpleFileBrowser-UI Skin". A UISkin can be assigned to the file browser in two ways:
14-
15-
- By changing SimpleFileBrowserCanvas prefab's Skin field
16-
- By changing the value of FileBrowser.Skin property from a C# script
17-
18-
19-
### FAQ
20-
- Android build fails, it says "error: attribute android:requestLegacyExternalStorage not found" in Console
21-
"android:requestLegacyExternalStorage" attribute in AndroidManifest.xml grants full access to device's storage on Android 10 but requires you to update your Android SDK to at least SDK 29. If this isn't possible for you, you should open SimpleFileBrowser.aar with WinRAR or 7-Zip and then remove the "<application ... />" tag from AndroidManifest.xml.
22-
23-
- Can't show the file browser on Android, it says "java.lang.ClassNotFoundException: com.yasirkula.unity.FileBrowserPermissionReceiver" in Logcat
24-
If you are sure that your plugin is up-to-date, then enable "Custom Proguard File" option from Player Settings and add the following line to that file: -keep class com.yasirkula.unity.* { *; }
25-
26-
- File browser doesn't show any files on Android 10+
27-
File browser uses Storage Access Framework on these Android versions and users must first click the "Pick Folder" button in the quick links section
28-
29-
- File browser doesn't show any files on Unity 2021.3.x
30-
Please see: https://github.com/yasirkula/UnitySimpleFileBrowser/issues/70
31-
32-
- RequestPermission returns Permission.Denied on Android
33-
Declare the WRITE_EXTERNAL_STORAGE permission manually in your Plugins/Android/AndroidManifest.xml file as follows: <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:node="replace"/>
34-
You'll need to add the following attribute to the '<manifest ...>' element: xmlns:tools="http://schemas.android.com/tools"
35-
36-
37-
### SCRIPTING API
38-
Please see the online documentation for a more in-depth documentation of the Scripting API: https://github.com/yasirkula/UnitySimpleFileBrowser
39-
40-
NOTE: On Android Q (10) or later, it is impossible to work with File APIs. On these devices, SimpleFileBrowser uses Storage Access Framework (SAF) to browse the files. However, paths returned by SAF are not File API compatible. To simulate the behaviour of the File API on all devices (including SAF), you can check out the FileBrowserHelpers functions. For reference, here is an example SAF path: content://com.android.externalstorage.documents/tree/primary%3A/document/primary%3APictures
41-
42-
// Namespace
43-
using SimpleFileBrowser;
44-
45-
public enum Permission { Denied = 0, Granted = 1, ShouldAsk = 2 };
46-
public enum PickMode { Files = 0, Folders = 1, FilesAndFolders = 2 };
47-
48-
public delegate void OnSuccess( string[] paths );
49-
public delegate void OnCancel();
50-
51-
// Changing the dialog's skin
52-
public static UISkin Skin { get; set; }
53-
54-
// Showing dialog
55-
bool ShowSaveDialog( OnSuccess onSuccess, OnCancel onCancel, PickMode pickMode, bool allowMultiSelection = false, string initialPath = null, string initialFilename = null, string title = "Save", string saveButtonText = "Save" );
56-
bool ShowLoadDialog( OnSuccess onSuccess, OnCancel onCancel, PickMode pickMode, bool allowMultiSelection = false, string initialPath = null, string initialFilename = null, string title = "Load", string loadButtonText = "Select" );
57-
58-
IEnumerator WaitForSaveDialog( PickMode pickMode, bool allowMultiSelection = false, string initialPath = null, string initialFilename = null, string title = "Save", string saveButtonText = "Save" );
59-
IEnumerator WaitForLoadDialog( PickMode pickMode, bool allowMultiSelection = false, string initialPath = null, string initialFilename = null, string title = "Load", string loadButtonText = "Select" );
60-
61-
// Force closing an open dialog
62-
void HideDialog( bool invokeCancelCallback = false );
63-
64-
// Customizing the dialog
65-
bool AddQuickLink( string name, string path, Sprite icon = null );
66-
void ClearQuickLinks();
67-
68-
void SetExcludedExtensions( params string[] excludedExtensions );
69-
70-
// Filters should include the period (e.g. ".jpg" instead of "jpg")
71-
void SetFilters( bool showAllFilesFilter, IEnumerable<string> filters );
72-
void SetFilters( bool showAllFilesFilter, params string[] filters );
73-
void SetFilters( bool showAllFilesFilter, IEnumerable<FileBrowser.Filter> filters );
74-
void SetFilters( bool showAllFilesFilter, params FileBrowser.Filter[] filters );
75-
76-
bool SetDefaultFilter( string defaultFilter );
77-
78-
// Filtering displayed files/folders programmatically
79-
delegate bool FileSystemEntryFilter( FileSystemEntry entry );
80-
event FileSystemEntryFilter DisplayedEntriesFilter;
81-
82-
// Android runtime permissions
83-
FileBrowser.Permission CheckPermission();
84-
FileBrowser.Permission RequestPermission();
85-
86-
// File manipulation functions that work on all platforms (including Storage Access Framework (SAF) on Android 10+)
87-
// These functions should be called with the paths returned by the FileBrowser functions only
88-
bool FileBrowserHelpers.FileExists( string path );
89-
bool FileBrowserHelpers.DirectoryExists( string path );
90-
bool FileBrowserHelpers.IsDirectory( string path );
91-
bool FileBrowserHelpers.IsPathDescendantOfAnother( string path, string parentFolderPath );
92-
string FileBrowserHelpers.GetDirectoryName( string path );
93-
FileSystemEntry[] FileBrowserHelpers.GetEntriesInDirectory( string path, bool extractOnlyLastSuffixFromExtensions ); // Returns all files and folders in a directory. If you want "File.tar.gz"s extension to be extracted as ".tar.gz" instead of ".gz", set 'extractOnlyLastSuffixFromExtensions' to false
94-
string FileBrowserHelpers.CreateFileInDirectory( string directoryPath, string filename ); // Returns the created file's path
95-
string FileBrowserHelpers.CreateFolderInDirectory( string directoryPath, string folderName ); // Returns the created folder's path
96-
void FileBrowserHelpers.WriteBytesToFile( string targetPath, byte[] bytes );
97-
void FileBrowserHelpers.WriteTextToFile( string targetPath, string text );
98-
void FileBrowserHelpers.AppendBytesToFile( string targetPath, byte[] bytes );
99-
void FileBrowserHelpers.AppendTextToFile( string targetPath, string text );
100-
byte[] FileBrowserHelpers.ReadBytesFromFile( string sourcePath );
101-
string FileBrowserHelpers.ReadTextFromFile( string sourcePath );
102-
void FileBrowserHelpers.CopyFile( string sourcePath, string destinationPath );
103-
void FileBrowserHelpers.CopyDirectory( string sourcePath, string destinationPath );
104-
void FileBrowserHelpers.MoveFile( string sourcePath, string destinationPath );
105-
void FileBrowserHelpers.MoveDirectory( string sourcePath, string destinationPath );
106-
string FileBrowserHelpers.RenameFile( string path, string newName ); // Returns the new path of the file
107-
string FileBrowserHelpers.RenameDirectory( string path, string newName ); // Returns the new path of the directory
108-
void FileBrowserHelpers.DeleteFile( string path );
109-
void FileBrowserHelpers.DeleteDirectory( string path );
110-
string FileBrowserHelpers.GetFilename( string path );
111-
long FileBrowserHelpers.GetFilesize( string path );
112-
DateTime FileBrowserHelpers.GetLastModifiedDate( string path );
3+
Documentation: https://github.com/yasirkula/UnitySimpleFileBrowser
4+
FAQ: https://github.com/yasirkula/UnitySimpleFileBrowser#faq
5+
Example code: https://github.com/yasirkula/UnitySimpleFileBrowser#example-code
6+
E-mail: yasirkula@gmail.com

0 commit comments

Comments
 (0)