Skip to content

Conversation

@graycreate
Copy link
Member

Summary

This PR enhances the Vshare WebView with two important UX improvements:

1. Intent URL Support

  • Fixed handling of intent:// URLs (e.g., Google Play Store links from ulpb.app)
  • Added comprehensive URL scheme handling for:
    • intent:// - Android intent URLs with multiple fallback mechanisms
    • market:// - Google Play Store direct links
    • Other app-specific schemes (mailto:, tel:, etc.)
  • Implements graceful fallback when target apps are not installed
  • Displays user-friendly error messages when links cannot be opened

2. Status Bar Padding

  • Added android:fitsSystemWindows="true" to WebView
  • Prevents content from being hidden under the status bar in edge-to-edge mode
  • Ensures proper display of page header and content

Technical Details

Files Modified:

  • VshareWebActivity.java: Added handleUrlLoading() method with comprehensive URL scheme detection and handling
  • activity_vshare_web.xml: Added fitsSystemWindows attribute to WebView

Key Implementation:

  • Detects and parses intent:// URLs using Intent.parseUri()
  • Checks for installed apps before attempting to open intents
  • Provides multiple fallback strategies (browser_fallback_url, market links, web URLs)
  • Proper error handling with logging and user notifications

Testing

  • Built and installed on connected device (SM-G9810)
  • Ready for manual testing of:
    • Clicking Google Play Store links from web pages
    • Opening various app-specific URLs
    • Verifying proper status bar padding

Screenshots

Please refer to the issue screenshots for the problems this PR addresses.

🤖 Generated with Claude Code

…adding

This commit addresses two UX issues in the Vshare WebView:

1. **Intent URL Support**: Fixed handling of intent:// URLs (e.g., Google Play Store links)
   - Added handleUrlLoading() method to intercept and process special URL schemes
   - Supports intent://, market://, and other app-specific schemes (mailto:, tel:, etc.)
   - Includes fallback mechanisms for better user experience
   - Displays appropriate error messages when apps are not available

2. **Status Bar Padding**: Added paddingTop to prevent content from being hidden
   - Added android:fitsSystemWindows="true" to WebView
   - Ensures content is properly displayed below the status bar in edge-to-edge mode

Changes made:
- VshareWebActivity.java: Added URL scheme handling logic with comprehensive fallback support
- activity_vshare_web.xml: Added fitsSystemWindows attribute to WebView

🤖 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 03:15
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 enhances the Vshare WebView with improved URL handling and UI layout fixes. It adds comprehensive support for intent URLs (like Google Play Store links) and fixes status bar padding issues.

  • Added intelligent URL scheme handling for intent://, market://, and other app-specific URLs
  • Implemented graceful fallbacks when target apps are not installed
  • Fixed WebView layout to properly handle status bar padding

Reviewed Changes

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

File Description
activity_vshare_web.xml Added fitsSystemWindows attribute to prevent content hiding under status bar
VshareWebActivity.java Added comprehensive URL handling method with intent parsing and fallback mechanisms

Intent intent = Intent.parseUri(url, Intent.URI_INTENT_SCHEME);

// Check if there's an app that can handle this intent
if (getPackageManager().resolveActivity(intent, 0) != null) {
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.

The resolveActivity() call with flags=0 is deprecated in API level 30+. Use PackageManager.ResolveInfo flags or PackageManager.MATCH_DEFAULT_ONLY for better compatibility.

Copilot uses AI. Check for mistakes.
Intent marketIntent = new Intent(Intent.ACTION_VIEW,
Uri.parse("market://details?id=" + packageName));
marketIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if (getPackageManager().resolveActivity(marketIntent, 0) != null) {
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.

The resolveActivity() call with flags=0 is deprecated in API level 30+. Use PackageManager.ResolveInfo flags or PackageManager.MATCH_DEFAULT_ONLY for better compatibility.

Copilot uses AI. Check for mistakes.
graycreate and others added 7 commits October 17, 2025 11:18
The previous approach using static paddingTop in XML didn't work because
the activity uses SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN for edge-to-edge layout.

This commit fixes the issue by:
1. Using OnApplyWindowInsetsListener to dynamically get the status bar height
2. Programmatically applying it as padding to the WebView
3. Including fallback for older API levels using resource identifier

This ensures content is properly displayed below the status bar on all
devices and screen configurations.

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit refactors VshareWebActivity to inherit from BaseActivity
instead of AppCompatActivity, providing better integration with the
app's architecture.

Benefits:
1. Automatic theme handling via reloadMode() - activity recreates on theme change
2. EventBus integration for day/night mode events
3. Consistent edge-to-edge layout handling
4. Access to base lifecycle management and utilities
5. Disabled slide-back gesture for fullscreen WebView experience

Changes:
- Extended BaseActivity<BaseContract.IPresenter>
- Implemented attachLayoutRes() to provide layout
- Implemented reloadMode() for theme switching support
- Overridden supportSlideBack() to disable swipe-back
- Moved initialization logic from onCreate() to init()
- Removed manual ButterKnife binding (handled by BaseActivity)

The WebView functionality remains unchanged, including:
- Intent URL handling for external apps
- WindowInsets-based status bar padding
- Theme-aware content loading

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

Co-Authored-By: Claude <noreply@anthropic.com>
Override attachToolbar() to return null, which tells BaseActivity
not to create a toolbar for this activity. This provides a true
fullscreen WebView experience without any app chrome.

Implementation follows the existing pattern used in TwoStepLoginActivity
and other fullscreen activities in the codebase.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Added android:fitsSystemWindows="true" to the WebView in the layout XML
to work in conjunction with the programmatic WindowInsets handling.

This ensures the WebView content is not obscured by the status bar,
providing proper spacing at the top of the page.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Simplified the status bar spacing approach:
- Added android:layout_marginTop="30dp" to WebView in XML layout
- Removed WindowInsets listener code (was not working reliably)
- Removed getStatusBarHeight() helper method (no longer needed)

This provides a simpler, more predictable way to prevent content
from being obscured by the status bar, using a fixed margin at the top.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Changed from static layout_marginTop to programmatically setting the
margin based on the actual status bar height.

Changes:
- Removed android:layout_marginTop from XML layout
- Added applyStatusBarMargin() method to set margin programmatically
- Added getStatusBarHeight() to retrieve actual status bar height
- Applied margin in init() after ButterKnife binds the views

This ensures the WebView properly adapts to different devices and
screen configurations, providing consistent spacing below the status bar.

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

Co-Authored-By: Claude <noreply@anthropic.com>
@graycreate graycreate merged commit 10dfdb9 into main Oct 17, 2025
5 checks passed
@graycreate graycreate deleted the feature/vshare-webview-improvements branch October 17, 2025 04:22
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