Skip to content

Conversation

@graycreate
Copy link
Member

Summary

Replaced the custom horizontal ProgressBar with BaseActivity's standard circular loading indicator to maintain UI consistency across the app.

Changes

  • Removed custom ProgressBar from XML layout (top 3dp horizontal bar)
  • Removed WebChromeClient and progress tracking code
  • Use BaseActivity methods: showLoading() / hideLoading()
  • Simplified code by removing unnecessary progress tracking logic

Benefits

  • Consistent loading UX matching other activities (like TopicActivity)
  • Uses the app's standard 55dp circular ProgressBar centered on screen
  • Cleaner code with less custom UI management

Testing

  • Built and installed on device
  • Verified loading indicator appears when navigating to Vshare page
  • Loading indicator properly disappears when page finishes loading

🤖 Generated with Claude Code

Replaced custom horizontal ProgressBar with BaseActivity's standard
circular loading indicator to maintain UI consistency across the app.

Changes:
- Removed custom ProgressBar from XML layout
- Removed @BindView for mProgressBar
- Removed WebChromeClient (no longer needed for progress tracking)
- Use showLoading() in onPageStarted()
- Use hideLoading() in onPageFinished()

This provides a cleaner, more consistent loading experience that
matches other activities like TopicActivity, using the app's standard
55dp circular ProgressBar centered on screen.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings October 17, 2025 04:30
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

Refactors VshareWebActivity to rely on BaseActivity's built-in loading indicator instead of a custom horizontal ProgressBar for consistent UI.

  • Removes the XML-defined horizontal ProgressBar and related binding/imports.
  • Replaces explicit progress tracking via WebChromeClient with showLoading/hideLoading calls in WebViewClient.
  • Simplifies loading logic by eliminating progress updates and relying on lifecycle callbacks.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
app/src/main/res/layout/activity_vshare_web.xml Removes custom horizontal ProgressBar view to defer loading UI to BaseActivity.
app/src/main/java/me/ghui/v2er/module/vshare/VshareWebActivity.java Eliminates ProgressBar handling and WebChromeClient, adds showLoading/hideLoading calls in page start/finish callbacks.

Comment on lines 152 to 156
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
mProgressBar.setVisibility(View.VISIBLE);
showLoading();
}

@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
hideLoading();
Copy link

Copilot AI Oct 17, 2025

Choose a reason for hiding this comment

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

[nitpick] Loading indicator is only dismissed in onPageFinished; if a load fails (e.g., network error or SSL error) before completion, user may be left with a persistent spinner. Consider overriding onReceivedError and onReceivedHttpError to call hideLoading(), e.g.: override onReceivedError(...){ hideLoading(); } override onReceivedHttpError(...){ hideLoading(); } to ensure the indicator is cleared on failure paths.

Copilot uses AI. Check for mistakes.
graycreate and others added 5 commits October 17, 2025 12:31
Fixed the issue where WebView would briefly show white background
before the page finishes loading in dark mode.

Changes:
1. Set WebView background color to match theme before loading
   - Dark mode: #1a1a1a (dark gray)
   - Light mode: white
2. Enable FORCE_DARK on Android Q+ when in dark mode
   - Automatically applies dark styling to web content
   - Provides immediate dark appearance

This ensures a consistent visual experience from the moment the
WebView starts loading, eliminating the jarring white flash that
previously occurred in dark mode.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Changed approach to completely eliminate white flash in dark mode:
- Set WebView to INVISIBLE before loading
- Apply theme via JavaScript when page finishes loading
- Show WebView after 100ms delay to ensure JS executes
- Hide loading indicator when WebView becomes visible

This ensures users only see the WebView after the correct theme
has been fully applied, completely eliminating the white flash
that occurred during page load in dark mode.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
…d increasing delay

- Set WebView visibility to invisible in XML layout to prevent initial white flash
- Increase delay from 100ms to 300ms to ensure theme JavaScript executes properly
- This eliminates the white screen gap during page load in dark mode

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Address GitHub Copilot review feedback by adding error handling callbacks
to dismiss the loading indicator when page load fails.

Changes:
- Add onReceivedError() override to hide loading on network/SSL errors
- Add onReceivedHttpError() override to hide loading on HTTP errors
- Both callbacks also hide the theme overlay to restore UI state

This prevents the loading spinner from persisting indefinitely when
WebView encounters errors during page load.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Apply navigation bar height as bottom margin to prevent content from
being hidden under the navigation bar in fullscreen WebView.

Changes:
- Import Utils to access getNavigationBarHeight()
- Update applyStatusBarMargin() to also apply bottom margin
- Use Utils.getNavigationBarHeight() for bottom margin calculation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@graycreate graycreate merged commit bf2a069 into main Oct 17, 2025
4 checks passed
@graycreate graycreate deleted the feature/vshare-use-base-progressbar branch October 17, 2025 05:33
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