- 
                Notifications
    You must be signed in to change notification settings 
- Fork 46
fix: improve font size and layout for better accessibility (#39) #131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Increase font sizes: extra large (24dp), large (20dp), medium (17dp), small (15dp) - Improve dark mode text contrast with better opacity values - Add dynamic font size scaling to all list modules (News, DailyHot, TopicStar, SpecialCare) - Fix layout overlapping issue by repositioning title below time/comment elements - Add proper spacing between UI elements - Enhance line spacing for better readability Fixes #39 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR improves accessibility by increasing font sizes across all settings and implementing dynamic font scaling throughout the application. The changes address user feedback about text being too small even with "extra large" font settings.
- Increased all font size dimensions by 7-20% to improve readability
- Added dynamic font scaling methods and applied them to all list modules
- Fixed layout overlapping issues by repositioning title elements and adding proper margins
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description | 
|---|---|
| app/src/main/res/values/dimens.xml | Increased font size dimensions across all settings (small to extra large) | 
| app/src/main/res/values/styles.xml | Added line spacing multiplier for better text readability | 
| app/src/main/res/values-night/colors.xml | Improved dark mode text contrast with higher opacity colors | 
| app/src/main/res/layout/common_list_item.xml | Fixed layout positioning to prevent text overlapping | 
| app/src/main/java/me/ghui/v2er/util/FontSizeUtil.java | Added new methods for dynamic title and subtitle font sizing | 
| app/src/main/java/me/ghui/v2er/injector/module/*.java | Applied dynamic font scaling to all list modules (News, DailyHot, TopicStar, SpecialCare) | 
| public static float getTitleSize() { | ||
| String size = Pref.read(R.string.pref_key_fontsize); | ||
| int id; | ||
| switch (size) { | ||
| case "小": | ||
| id = R.dimen.smallTextSize; | ||
| break; | ||
| case "大": | ||
| id = R.dimen.largeTextSize; | ||
| break; | ||
| case "特大": | ||
| id = R.dimen.extralargeTextSize; | ||
| break; | ||
| case "中": | ||
| default: | ||
| id = R.dimen.mediumTextSize; | ||
| } | ||
| return App.get().getResources().getDimension(id); | ||
| } | ||
|  | ||
| public static float getSubTextSize() { | ||
| String size = Pref.read(R.string.pref_key_fontsize); | ||
| int id; | ||
| switch (size) { | ||
| case "小": | ||
| id = R.dimen.microTextSize; | ||
| break; | ||
| case "大": | ||
| id = R.dimen.mediumTextSize; | ||
| break; | ||
| case "特大": | ||
| id = R.dimen.largeTextSize; | ||
| break; | ||
| case "中": | ||
| default: | ||
| id = R.dimen.smallTextSize; | ||
| } | ||
| return App.get().getResources().getDimension(id); | ||
| } | 
    
      
    
      Copilot
AI
    
    
    
      Sep 20, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The getTitleSize() and getSubTextSize() methods contain duplicated logic for reading preferences and switch statement structure. Consider extracting a common helper method that takes a mapping of size strings to dimension resources to reduce code duplication.
| style="@style/TopicTitle" | ||
| android:layout_below="@id/avatar_img" | ||
| android:layout_below="@id/time_tv" | ||
| android:layout_marginTop="8dp" | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2dp
        
          
                app/src/main/res/values/styles.xml
              
                Outdated
          
        
      | <item name="android:textSize">@dimen/mediumTextSize</item> | ||
| <item name="android:textStyle">normal</item> | ||
| <item name="android:paddingTop">6dp</item> | ||
| <item name="android:lineSpacingMultiplier">1.3</item> | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1.1
- Add dynamic font sizing to UserHome module (topics and replies) - Add dynamic font sizing to NodeTopic module - Add dynamic font sizing to Search module results - Ensure all list views now properly scale with font size preference - Dark mode text contrast already improved in previous commit
- Created ViewHolderFontHelper to centralize font size application logic - Added scaling ratio support in FontSizeUtil (0.875x to 1.5x) - Refactored all modules to use the new helper, removing duplicate code - Simplified font size application with reusable helper methods - Support for scaling any TextView based on user preference This provides a much cleaner and maintainable solution for font size management.
- Add font sizing to Message/Notification pages (MsgModule) - Add font sizing to Node navigation pages (NodesNavModule) - Add font sizing to Navigation drawer menu items and header - Add scaling support to NavNodesWrapper for node tags - Settings page uses system preferences (already scaled) All UI components now properly respond to font size preferences.
- Fix sliding menu applying scaling multiple times on each open - Use tags to track already scaled views to prevent re-scaling - Save original text size to avoid cumulative scaling - Add font scaling support to PreferenceFragment settings page - Apply scaling to ListView items with scroll listener This ensures font scaling is only applied once per view and works correctly across all UI components including settings.
- Settings page now updates immediately when font size preference changes - Subscribe to TextSizeChangeEvent using EventBus - Clear all scaling tags before applying new font size - Reset text to original size before reapplying scaling - No need to exit and re-enter settings to see changes Users can now see font size changes instantly in the settings page itself.
- Restore original text size BEFORE clearing tags - Add small delay between clearing and reapplying scaling - This ensures text size can both increase and decrease properly Both enlarging and reducing font size now work correctly in real-time.
- Apply dynamic font sizing to filter menu tab items - Tab titles now scale according to user font size preference - Uses getTitleSize() for consistent sizing with other UI elements Filter menu now properly responds to font size settings.
- Refactor FontSizeUtil to reduce code duplication by extracting common helper method - Change layout margin from 8dp to 2dp as requested - Adjust line spacing multiplier from 1.3 to 1.1 for better readability Addresses feedback from Copilot and @graycreate in PR #131
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 20 out of 20 changed files in this pull request and generated 5 comments.
| public void onStop() { | ||
| super.onStop(); | ||
| Bus.unRegister(this); | ||
| } | 
    
      
    
      Copilot
AI
    
    
    
      Sep 20, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Bus.unRegister() call in onStop() doesn't match the corresponding Bus.register() call in onStart(). This creates an asymmetric lifecycle that could lead to memory leaks or missed events if the fragment is stopped but not destroyed.
| float scalingRatio = FontSizeUtil.getScalingRatio(); | ||
| if (Math.abs(scalingRatio - 1.0f) < 0.01f) { | ||
| // No scaling needed for default size | ||
| return; | ||
| } | 
    
      
    
      Copilot
AI
    
    
    
      Sep 20, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The magic number 0.01f should be extracted to a named constant. Consider defining private static final float SCALING_THRESHOLD = 0.01f for better maintainability and clarity.
| if (menuView != null && menuView instanceof RecyclerView) { | ||
| RecyclerView recyclerView = (RecyclerView) menuView; | 
    
      
    
      Copilot
AI
    
    
    
      Sep 20, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use instanceof with pattern matching for cleaner code: if (menuView instanceof RecyclerView recyclerView) instead of casting on the next line.
| if (menuView != null && menuView instanceof RecyclerView) { | |
| RecyclerView recyclerView = (RecyclerView) menuView; | |
| if (menuView instanceof RecyclerView recyclerView) { | 
| case "小": | ||
| return 0.875f; // 87.5% of default | ||
| case "大": | ||
| return 1.25f; // 125% of default | ||
| case "特大": | ||
| return 1.5f; // 150% of default | 
    
      
    
      Copilot
AI
    
    
    
      Sep 20, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The scaling ratios should be extracted to named constants for better maintainability. Consider defining private static final float SMALL_SCALE = 0.875f; etc.
| } | ||
|  | ||
| // Add scroll listener to apply scaling to new items | ||
| listView.setOnScrollListener(new android.widget.AbsListView.OnScrollListener() { | 
    
      
    
      Copilot
AI
    
    
    
      Sep 20, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The scroll listener is created and set every time applyFontScalingToPreferences() is called, potentially creating multiple listeners. Consider checking if a listener is already set or removing the previous one to avoid performance issues.
- Extract magic number 0.01f to SCALING_THRESHOLD constant in SettingFragment - Extract scaling ratios to named constants in FontSizeUtil for better maintainability - Fix potential duplicate scroll listeners by checking if already set - Simplify instanceof check in MainActivity (remove unnecessary null check) - Add field to track scroll listener to prevent duplicates Addresses all code quality feedback from Copilot in PR #131
Summary
This PR addresses the font size adjustment issues reported in #39, where text was too small even with "extra large" font settings.
Changes
📏 Increased font sizes across all settings:
🌙 Improved dark mode contrast:
🔧 Dynamic font scaling implementation:
getTitleSize()andgetSubTextSize()methods to FontSizeUtil📐 Fixed layout overlapping issues:
Test Plan
Screenshots
Font sizes are now properly scaled and text no longer overlaps in list items.
Fixes #39
🤖 Generated with Claude Code