Skip to content

Conversation

@graycreate
Copy link
Member

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:

    • Extra Large: 20dp → 24dp (+20%)
    • Large: 18dp → 20dp (+11%)
    • Medium: 16dp → 17dp
    • Small: 14dp → 15dp
  • 🌙 Improved dark mode contrast:

    • Body text opacity: #E6FFFFFF → #F2FFFFFF
    • Hint text color: #B3B3B3 → #CCCCCC
  • 🔧 Dynamic font scaling implementation:

    • Added getTitleSize() and getSubTextSize() methods to FontSizeUtil
    • Applied dynamic sizing to all list modules (News, DailyHot, TopicStar, SpecialCare)
    • All text elements now respect user font size preferences
  • 📐 Fixed layout overlapping issues:

    • Title now positioned below time/comment text instead of avatar
    • Added 8dp margin between elements to prevent overlap
    • Enhanced line spacing (1.3x multiplier) for better readability

Test Plan

  • Build and test on Pixel 8 device
  • Verify font size changes in Settings → Font Size
  • Test all font size options (小, 中, 大, 特大)
  • Confirm no text overlapping in list items
  • Test in both light and dark modes

Screenshots

Font sizes are now properly scaled and text no longer overlaps in list items.

Fixes #39

🤖 Generated with Claude Code

- 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>
Copilot AI review requested due to automatic review settings September 20, 2025 11:38
Copy link

Copilot AI left a 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)

Comment on lines 29 to 67
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);
}
Copy link

Copilot AI Sep 20, 2025

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.

Copilot uses AI. Check for mistakes.
style="@style/TopicTitle"
android:layout_below="@id/avatar_img"
android:layout_below="@id/time_tv"
android:layout_marginTop="8dp"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2dp

<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>
Copy link
Member Author

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
@graycreate graycreate requested a review from Copilot September 20, 2025 12:40
Copy link

Copilot AI left a 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.

Comment on lines +94 to 97
public void onStop() {
super.onStop();
Bus.unRegister(this);
}
Copy link

Copilot AI Sep 20, 2025

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.

Copilot uses AI. Check for mistakes.
Comment on lines 118 to 122
float scalingRatio = FontSizeUtil.getScalingRatio();
if (Math.abs(scalingRatio - 1.0f) < 0.01f) {
// No scaling needed for default size
return;
}
Copy link

Copilot AI Sep 20, 2025

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.

Copilot uses AI. Check for mistakes.
Comment on lines 320 to 321
if (menuView != null && menuView instanceof RecyclerView) {
RecyclerView recyclerView = (RecyclerView) menuView;
Copy link

Copilot AI Sep 20, 2025

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.

Suggested change
if (menuView != null && menuView instanceof RecyclerView) {
RecyclerView recyclerView = (RecyclerView) menuView;
if (menuView instanceof RecyclerView recyclerView) {

Copilot uses AI. Check for mistakes.
Comment on lines 77 to 82
case "小":
return 0.875f; // 87.5% of default
case "大":
return 1.25f; // 125% of default
case "特大":
return 1.5f; // 150% of default
Copy link

Copilot AI Sep 20, 2025

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.

Copilot uses AI. Check for mistakes.
}

// Add scroll listener to apply scaling to new items
listView.setOnScrollListener(new android.widget.AbsListView.OnScrollListener() {
Copy link

Copilot AI Sep 20, 2025

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.

Copilot uses AI. Check for mistakes.
- 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
@graycreate graycreate merged commit 0cba533 into main Sep 20, 2025
5 checks passed
@graycreate graycreate deleted the fix/issue-39-font-size-improvements branch September 20, 2025 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

文字大小调整问题

2 participants