You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+64-59Lines changed: 64 additions & 59 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,29 +22,31 @@ This documentation guides you on how to integrate and use the `FileTree` library
22
22
23
23
**4. Customizing Icons**
24
24
25
-
**5. Asynchronous File System**
25
+
**5. AttributeSet**
26
26
27
-
**6. Example (Android View-Based)**
27
+
**6. Asynchronous File System**
28
28
29
-
**7. Frequently Asked Questions (FAQ)**
29
+
**7. Example (Android View-Based)**
30
30
31
31
**8. License.**
32
32
33
33
## 1. Introduction
34
34
35
-
The `FileTree` library provides a robust and modular way to manage and display file trees within your IDEs and code editors. It offers the following key features:
35
+
The `FileTree` library offers a comprehensive and modular solution for managing and displaying file trees within IDEs and code editors. It is designed to provide the following key features:
36
36
37
-
-**Hierarchical File Tree Representation:**Presents files and folders in a hierarchical tree structure.
37
+
-**Hierarchical File Tree Representation:**Displays files and folders in an organized hierarchical tree structure.
38
38
39
-
-**Hover-Navigated Directory**: Highlights directories as users navigate through them by clicking. This feature enhances user experience by visually indicating the current directory and providing a clear, interactive method for exploring the directory tree.
39
+
-**Hover-Navigated Directory:** Highlights directories as users navigate through them with clicks. This feature enhances user experience by visually indicating the current directory, offering a clear and interactive method for exploring the directory tree.
40
40
41
-
-**Lazy Loading:**Optimizes loading time by only loading child nodes when expanded.
41
+
-**Lazy Loading:**Improves loading time by loading child nodes only when they are expanded.
42
42
43
-
-**Asynchronous File System:**Performs file functions like expanding, collapsing, loading files in `FileTree`, etc. in the background thread to avoid blocking the Main UI Thread.
43
+
-**Asynchronous File System:**Executes file operations like expanding, collapsing, and loading files in the `FileTree` on a background thread, preventing the Main UI Thread from being blocked.
44
44
45
-
-**Customizable Icons:**Allows you to set custom icons for files and folders.
45
+
-**Customizable Icons:**Enables the use of custom icons for files and folders.
46
46
47
-
-**Flexibility:** Integrates seamlessly with various IDE UI frameworks (Android Views, Swing, SWT, Jetpack Compose).
47
+
-**Concurrent FileMap:** Maintains a record of recently accessed files and directories, facilitating quick access to previously expanded files and directories.
48
+
49
+
-**RecyclerItemView:** Utilizes the built-in RecycledViewPool of RecyclerView to reuse old views, reducing memory usage by avoiding the creation of new views.
48
50
49
51
### Overview
50
52
@@ -72,37 +74,19 @@ The specific instructions for adding a dependency will depend on your IDE and bu
72
74
73
75
### 2.2. Initialization and Loading
74
76
75
-
**1. Create an Instance:** Instantiate a `FileTree` object, providing the root directory:
76
-
77
-
```kotlin
78
-
val fileTree =FileTree(this, "/storage/emulated/0")
79
-
```
80
-
81
-
**2. Load the FileTree:** Call the `loadFileTree()` method to load the initial file tree structure. This will load the root directory and its immediate children:
77
+
**1. Initialize:** Instantiate a `FileTree` object, providing the root directory:
This step involves integrating the `FileTree`library with your IDE's UI framework. The specific implementation will vary depending on your chosen UI framework. Below are common frameworks with basic examples:
84
+
This step involves integrating the `FileTree` Library within your project, here's a basic example using Android Views:
89
85
90
86
-**Android View-Based (Android/Kotlin/Java):** Define `FileTreeView` in your Layout (XML) to display your `FileTree` data.
|**recyclerItemViewCount**| Defines the maximum number of items the RecyclerView can hold in its recycled view pool. | 200 |`app:recyclerItemViewCount`| Integer |
188
+
|**recyclerItemViewEnabled**| Enables or disables the use of a recycled view pool for the RecyclerView. | true |`app:recyclerItemViewEnabled`| Boolean |
189
+
|**itemViewCacheSize**| Sets the maximum size for the view cache in the RecyclerView. | 100 |`app:itemViewCacheSize`| Integer |
190
+
|**itemViewCachingEnabled**| Enables or disables caching of item views in the RecyclerView. | true |`app:itemViewCachingEnabled`| Boolean |
191
+
|**fileMapMaxSize**| Specifies the maximum number of entries in the file map, which caches recently accessed files and directories. | 150 |`app:fileMapMaxSize`| Integer |
192
+
|**fileMapEnabled**| Enables or disables the file map functionality. | true |`app:fileMapEnabled`| Boolean |
193
+
|**fileTreeAnimation**| Sets the animation style for expanding and collapsing the file tree. | 4 |`app:fileTreeAnimation`| Integer |
194
+
|**fileTreeAnimationEnabled**| Enables or disables animations for the file tree. | true |`app:fileTreeAnimationEnabled`| Boolean |
195
+
196
+
### Usage Example
197
+
198
+
To configure these attributes in your XML layout file, use the following syntax:
199
+
200
+
```xml
201
+
<com.zyron.filetree.widget.FileTreeView
202
+
android:layout_width="match_parent"
203
+
android:layout_height="match_parent"
204
+
app:recyclerItemViewCount="250"
205
+
app:recyclerItemViewEnabled="true"
206
+
app:itemViewCacheSize="120"
207
+
app:itemViewCachingEnabled="true"
208
+
app:fileMapMaxSize="180"
209
+
app:fileMapEnabled="true"
210
+
app:fileTreeAnimation="FallDown"
211
+
app:fileTreeAnimationEnabled="false"/>
212
+
```
213
+
Adjust these values according to your application's needs to optimize performance and user experience.
214
+
215
+
## 6. Asynchronous File System
193
216
194
217
The `FileTree` library typically uses a built-in asynchronous system powered by Kotlin Coroutines to perform core file functions such as expanding, collapsing and loading files in `FileTree` on the background thread. This ensures that the UI thread remains responsive while the functions are executed.
195
218
196
-
## 6. Example (Android view-based)
219
+
## 7. Example (Android view-based)
197
220
198
221
Here's a basic example of using the `FileTree` library with Android views:
199
222
@@ -234,24 +257,6 @@ class MainActivity : AppCompatActivity() {
234
257
}
235
258
```
236
259
237
-
## 7. Frequently Asked Questions (FAQ)
238
-
239
-
**Q:** How do I get the selected file or folder in the file tree?
240
-
241
-
**A:** Use the event listener for node selection to retrieve the selected node. The selected node will likely represent the FileTreeNode object that you can use to access the underlying File object.
242
-
243
-
**Q:** How do I refresh the file tree after making changes to the file system?
244
-
245
-
**A:** Use the `loadFileTree()` method to reload the tree structure. If you only need to update a portion of the tree, you can refresh specific nodes or sections.
246
-
247
-
**Q:** Can I customize the appearance of the file tree?
248
-
249
-
**A:** Yes, you can customize the appearance by using custom renderers (Swing, SWT) or composables (Jetpack Compose) to control the display of nodes.
250
-
251
-
**Q:** Can I use the `FileTree` library for other purposes besides IDEs and Code Editors?
252
-
253
-
**A:** Yes, the library can be adapted for other applications that require file tree management, such as file explorers or project management tools.
254
-
255
260
## 8. License
256
261
```
257
262
Copyright 2024 Zyron Official.
@@ -267,4 +272,4 @@ distributed under the License is distributed on an "AS IS" BASIS,
267
272
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
268
273
See the License for the specific language governing permissions and
0 commit comments