Skip to content

Commit f46417c

Browse files
graycreateclaude
andcommitted
refactor: Simplify VshareWebActivity by reusing app theme system
- Use NoneSlideBackableTheme instead of GalleryTheme for proper theme inheritance - Remove manual SystemUI configuration code (now handled by theme) - Add proper edge-to-edge display with LAYOUT_FULLSCREEN and LAYOUT_HIDE_NAVIGATION flags - Fix layout background to use transparent color compatible with NoneSlideBackableTheme - Set status bar icon color dynamically based on dark/light theme Benefits: - Reduces code duplication by leveraging existing theme infrastructure - Automatic theme switching support (follows app's day/night mode) - Consistent UI behavior with MainActivity - Simpler and more maintainable code 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 6c7dc8f commit f46417c

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
<activity
150150
android:name=".module.vshare.VshareWebActivity"
151151
android:exported="false"
152-
android:theme="@style/GalleryTheme"
152+
android:theme="@style/NoneSlideBackableTheme"
153153
android:configChanges="orientation|keyboardHidden|screenSize" />
154154
</application>
155155

app/src/main/java/me/ghui/v2er/module/vshare/VshareWebActivity.java

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
import android.graphics.Bitmap;
77
import android.os.Bundle;
88
import android.view.View;
9-
import android.view.Window;
10-
import android.view.WindowManager;
119
import android.webkit.WebChromeClient;
1210
import android.webkit.WebResourceRequest;
1311
import android.webkit.WebSettings;
@@ -45,16 +43,27 @@ public static void open(Context context) {
4543
protected void onCreate(Bundle savedInstanceState) {
4644
super.onCreate(savedInstanceState);
4745

48-
// Request fullscreen mode
49-
requestWindowFeature(Window.FEATURE_NO_TITLE);
50-
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
51-
WindowManager.LayoutParams.FLAG_FULLSCREEN);
52-
5346
// Hide action bar if present
5447
if (getSupportActionBar() != null) {
5548
getSupportActionBar().hide();
5649
}
5750

51+
// Set SystemUI flags to match MainActivity's edge-to-edge behavior
52+
View decorView = getWindow().getDecorView();
53+
int systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
54+
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
55+
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
56+
57+
// Set status bar icon color based on theme
58+
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
59+
if (!DarkModelUtils.isDarkMode()) {
60+
// Light mode: use dark status bar icons
61+
systemUiVisibility |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
62+
}
63+
}
64+
65+
decorView.setSystemUiVisibility(systemUiVisibility);
66+
5867
setContentView(R.layout.activity_vshare_web);
5968
ButterKnife.bind(this);
6069

app/src/main/res/layout/activity_vshare_web.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
33
android:layout_width="match_parent"
44
android:layout_height="match_parent"
5-
android:background="?attr/page_bg_color">
5+
android:background="@android:color/transparent">
66

77
<WebView
88
android:id="@+id/webview"

0 commit comments

Comments
 (0)