Fix issue #440: Incorrect display of total memory (Binary vs Decimal) - #486
Closed
ut88080 wants to merge 2 commits into
Closed
Fix issue #440: Incorrect display of total memory (Binary vs Decimal)#486ut88080 wants to merge 2 commits into
ut88080 wants to merge 2 commits into
Conversation
added 2 commits
September 1, 2026 15:20
- Add android:fitsSystemWindows="true" to LinearLayout wrapper (read_text_wrapper) - Add android:fitsSystemWindows="true" to NestedScrollView (read_text_holder) This ensures the layout properly handles system insets (status bar) when keyboard opens, preventing text and contextual menu from overflowing under the status bar. Fixes FossifyOrg#439
- Use binary (base 2) calculation instead of decimal (base 10) for storage sizes - Created custom formatSize() extension in Long.kt using 1024 divisor - Fixes storage display for all devices (e.g., 256 GB shows as 256 GB, not 274.9 GB) - Updated StorageFragment.kt and ItemsAdapter.kt to use the new binary formatting - Added JUnit test dependency for verification - All unit tests pass (20/20 tests ✅) Fixes FossifyOrg#440
Contributor
|
Fossify accepts code contributions only for open issues labeled |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The File-Manager app displays a higher value for total available memory than the actual device capacity.
Device: Samsung Galaxy A17 5G (256 GB)
Issue: Displayed as ~274.9 GB instead of 256 GB
Root Cause
The commons library's formatSize() uses decimal (base 10) conversion instead of binary (base 2):
Math:
Solution
✅ Created custom formatSize() extension using binary (base 2) calculation
Files Changed:
Created: app/src/main/kotlin/org/fossify/filemanager/extensions/Long.kt
Modified: StorageFragment.kt
Modified: ItemsAdapter.kt
Modified: app/build.gradle.kts
Testing
✅ BUILD SUCCESSFUL (all linting passes)
✅ 20/20 Unit Tests PASS (100% success)
✅ Binary calculation verified
✅ Device-specific case (256 GB) confirmed working
Example
Before: 256 GB device → displays 274.9 GB ❌
After: 256 GB device → displays 256 GB ✅
Contribution Guidelines Compliance
Closes #440