Conversation
…ance - Simplified getFileName method by extracting content query logic into a separate function. - Enhanced error handling using runCatching for safer resource management. - Streamlined getFileSize and getInputStream methods. - Optimized text processing in TextUtils by consolidating regex patterns and improving whitespace handling. - Refactored chapter title extraction and cleaning logic for better clarity and maintainability. - Improved paragraph formatting and merging logic to handle edge cases more effectively.
… Pattern with Regex in TextUtils
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.
This pull request introduces significant improvements to error handling, code structure, and content parsing logic across the application. The most notable changes include a comprehensive refactor of the HTML parsing logic for better manga/novel detection, systematic replacement of try/catch blocks with Kotlin’s
runCatchingfor more concise error handling, and modularization of utility functions for improved readability and maintainability.Error Handling Improvements:
runCatchingin repository methods and throughoutMainActivity, leading to more concise and idiomatic Kotlin error handling. (BaseRepository.kt,MainActivity.kt,ExploreRepository.kt,LibraryRepository.kt) [1] [2] [3] [4]HTML Parsing and Content Extraction Enhancements:
HtmlParserto modularize and clarify the logic for cleaning documents, parsing images and paragraphs, filtering out ads and irrelevant content, and merging paragraphs. Improved manga/novel detection logic to better distinguish between image-heavy and text-heavy content. (HtmlParser.kt) [1] [2]HtmlParser.kt)Code Structure and Readability:
filterSources,mapFileTypeToContentType,buildMemoryCache,buildDiskCache) for improved maintainability. (ExploreRepository.kt,MainActivity.kt,EasyReaderApplication.kt) [1] [2] [3]Unitreturn types for clarity and consistency. (MainActivity.kt,LibraryRepository.kt) [1] [2]Image Loader Configuration:
EasyReaderApplicationby moving cache configuration into dedicated helper methods, improving clarity and flexibility. (EasyReaderApplication.kt)Permissions and File Handling:
MainActivity, using helper methods and more robust logic for determining permissions and supported file types. (MainActivity.kt)These changes collectively improve the app’s robustness, readability, and maintainability, while also enhancing its ability to accurately parse and display both manga and novel content.