-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add subfolders count to file manager (#991)
**Background** Current file manager doesn't display subitems count inside folders **Changes** - Add subitems count - Add `ExtendedListingItem` for better scalability - Add `visible` parameter for PlaceholderConnecting so there will be animation when it's loaded **Test plan** - Open sample app - Open folders and see items are loading and each after each without blocking the listing itself
- Loading branch information
1 parent
bcebc1c
commit 895a2f6
Showing
14 changed files
with
223 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...ommonMain/kotlin/com/flipperdevices/filemanager/listing/impl/model/ExtendedListingItem.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.flipperdevices.filemanager.listing.impl.model | ||
|
||
import com.flipperdevices.bridge.connection.feature.storage.api.model.FileType | ||
import com.flipperdevices.bridge.connection.feature.storage.api.model.ListingItem | ||
import okio.Path | ||
|
||
sealed interface ExtendedListingItem { | ||
/** | ||
* Local file-only path | ||
* example: file.txt, item.svg | ||
*/ | ||
val path: Path | ||
|
||
val itemType: FileType | ||
|
||
val itemName: String | ||
get() = path.name | ||
|
||
fun asListingItem() = ListingItem( | ||
fileName = itemName, | ||
fileType = itemType, | ||
size = (this as? File)?.size ?: 0 | ||
) | ||
|
||
/** | ||
* @param path file name path. Not full path | ||
* @param size file size in bytes | ||
*/ | ||
data class File( | ||
override val path: Path, | ||
val size: Long | ||
) : ExtendedListingItem { | ||
override val itemType: FileType = FileType.FILE | ||
} | ||
|
||
/** | ||
* @param path file name path. Not full path | ||
* @param itemsCount amount of items inside | ||
*/ | ||
data class Folder( | ||
override val path: Path, | ||
val itemsCount: Int? = null, | ||
) : ExtendedListingItem { | ||
override val itemType: FileType = FileType.DIR | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.