-
Couldn't load subscription status.
- Fork 46
feat: improve Vshare WebView with intent URL support and status bar padding #155
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
…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>
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 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) { |
Copilot
AI
Oct 17, 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 resolveActivity() call with flags=0 is deprecated in API level 30+. Use PackageManager.ResolveInfo flags or PackageManager.MATCH_DEFAULT_ONLY for better compatibility.
| 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) { |
Copilot
AI
Oct 17, 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 resolveActivity() call with flags=0 is deprecated in API level 30+. Use PackageManager.ResolveInfo flags or PackageManager.MATCH_DEFAULT_ONLY for better compatibility.
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>
Summary
This PR enhances the Vshare WebView with two important UX improvements:
1. Intent URL Support
intent://URLs (e.g., Google Play Store links from ulpb.app)intent://- Android intent URLs with multiple fallback mechanismsmarket://- Google Play Store direct linksmailto:,tel:, etc.)2. Status Bar Padding
android:fitsSystemWindows="true"to WebViewTechnical Details
Files Modified:
VshareWebActivity.java: AddedhandleUrlLoading()method with comprehensive URL scheme detection and handlingactivity_vshare_web.xml: AddedfitsSystemWindowsattribute to WebViewKey Implementation:
Intent.parseUri()Testing
Screenshots
Please refer to the issue screenshots for the problems this PR addresses.
🤖 Generated with Claude Code