Commit 10dfdb9
feat: improve Vshare WebView with intent URL support and status bar padding (#155)
* feat: improve Vshare WebView with intent URL support and status bar padding
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>
* fix: use explicit paddingTop for WebView status bar spacing
* fix: properly handle status bar padding using WindowInsets
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>
* refactor: make VshareWebActivity extend BaseActivity
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>
* feat: hide toolbar in VshareWebActivity for fullscreen experience
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>
* fix: add fitsSystemWindows to WebView to properly handle status bar
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>
* fix: use layout_marginTop instead of WindowInsets for WebView spacing
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>
* refactor: dynamically set WebView top margin based on status bar height
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>
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent f0d1619 commit 10dfdb9
File tree
1 file changed
+156
-17
lines changed1 file changed
+156
-17
lines changedLines changed: 156 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| 8 | + | |
7 | 9 | | |
| 10 | + | |
8 | 11 | | |
| 12 | + | |
| 13 | + | |
9 | 14 | | |
10 | 15 | | |
11 | 16 | | |
12 | 17 | | |
13 | 18 | | |
14 | 19 | | |
| 20 | + | |
15 | 21 | | |
16 | | - | |
| 22 | + | |
17 | 23 | | |
18 | 24 | | |
19 | | - | |
20 | 25 | | |
| 26 | + | |
| 27 | + | |
21 | 28 | | |
| 29 | + | |
22 | 30 | | |
23 | 31 | | |
24 | 32 | | |
25 | 33 | | |
26 | 34 | | |
27 | | - | |
| 35 | + | |
28 | 36 | | |
| 37 | + | |
29 | 38 | | |
30 | 39 | | |
31 | 40 | | |
| |||
40 | 49 | | |
41 | 50 | | |
42 | 51 | | |
43 | | - | |
44 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
45 | 55 | | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
50 | 62 | | |
51 | | - | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
52 | 80 | | |
53 | | - | |
54 | | - | |
| 81 | + | |
55 | 82 | | |
56 | 83 | | |
57 | 84 | | |
| |||
64 | 91 | | |
65 | 92 | | |
66 | 93 | | |
67 | | - | |
68 | | - | |
| 94 | + | |
| 95 | + | |
69 | 96 | | |
70 | 97 | | |
71 | 98 | | |
| |||
114 | 141 | | |
115 | 142 | | |
116 | 143 | | |
117 | | - | |
118 | | - | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
119 | 150 | | |
120 | 151 | | |
121 | 152 | | |
| |||
149 | 180 | | |
150 | 181 | | |
151 | 182 | | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
152 | 291 | | |
153 | 292 | | |
154 | 293 | | |
| |||
170 | 309 | | |
171 | 310 | | |
172 | 311 | | |
173 | | - | |
| 312 | + | |
0 commit comments