Refactor file handling to use URIs and ContentResolver; fix bugs.#1
Draft
rothariger wants to merge 1 commit intomasterfrom
Draft
Refactor file handling to use URIs and ContentResolver; fix bugs.#1rothariger wants to merge 1 commit intomasterfrom
rothariger wants to merge 1 commit intomasterfrom
Conversation
Major changes include: - MainActivity, EditorFragment, FileUtils: Overhauled file opening, saving, and URI handling. Removed reliance on `getRealPathFromURI` and direct file paths for URI-based resources. Operations now consistently use URIs with ContentResolver. - EditorFragment: Implemented `onSaveInstanceState` to preserve content and URI across configuration changes. Updated to use display names and URIs passed from MainActivity. Improved error feedback for JSON parsing and file save operations. Added view caching. - FileUtils: Removed `getRealPathFromURI`. Added `getDisplayNameFromUri`. Refactored preference saving to `AddUriToPrefs`, storing display names and URI strings. Improved I/O methods to use Context correctly and provide better error reporting/return values. - MainActivity: Updated permission requests for READ_EXTERNAL_STORAGE, aligned with modern Android (API 30+). Improved handling of permission denial and permanently denied states. Streamlined `moveToEditor` logic. - Cleanup: Removed dead code and unused variables in MainActivity and EditorFragment. Standardized Context usage. Conceptual review for FileListFragment outlined the need to use stored URI strings (parsed to Uri objects) for re-opening files. Overall, these changes significantly improve the application's robustness, error handling, and adherence to modern Android practices for file management.
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.
Major changes include:
getRealPathFromURIand direct file paths for URI-based resources. Operations now consistently use URIs with ContentResolver.onSaveInstanceStateto preserve content and URI across configuration changes. Updated to use display names and URIs passed from MainActivity. Improved error feedback for JSON parsing and file save operations. Added view caching.getRealPathFromURI. AddedgetDisplayNameFromUri. Refactored preference saving toAddUriToPrefs, storing display names and URI strings. Improved I/O methods to use Context correctly and provide better error reporting/return values.moveToEditorlogic.Conceptual review for FileListFragment outlined the need to use stored URI strings (parsed to Uri objects) for re-opening files. Overall, these changes significantly improve the application's robustness, error handling, and adherence to modern Android practices for file management.