Skip to content

Commit

Permalink
Fix status bar text and icons color in light mode (fixes #1963) (#1965)
Browse files Browse the repository at this point in the history
closes #1963

PS: This one has been kinda ugly to spot, ngl. I didn't expect that we
were modifying the welcome activity status bar color programmatically
instead of just with an XML theme ...
  • Loading branch information
Bnyro authored Aug 18, 2023
1 parent a7bfd72 commit a088701
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,6 @@ protected void onCreate(Bundle savedInstanceState) {
return;
}

// Make notification bar transparent (API level 21+)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
}

// Show first start welcome wizard UI.
setContentView(R.layout.activity_first_start);
mViewPager = (ViewPager) findViewById(R.id.view_pager);
Expand All @@ -119,9 +113,6 @@ public boolean onTouch(View v, MotionEvent event) {
addBottomDots();
setActiveBottomDot(0);

// Make notification bar transparent
changeStatusBarColor();

mViewPagerAdapter = new ViewPagerAdapter();
mViewPager.setAdapter(mViewPagerAdapter);
mViewPager.addOnPageChangeListener(mViewPagerPageChangeListener);
Expand Down Expand Up @@ -288,17 +279,6 @@ public void onPageScrollStateChanged(int arg0) {
}
};

/**
* Making notification bar transparent
*/
private void changeStatusBarColor() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(Color.TRANSPARENT);
}
}

/**
* View pager adapter
*/
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-night/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<resources xmlns:tools="http://schemas.android.com/tools">

<style name="Theme.Syncthing" parent="Theme.Syncthing.Base">
<item name="android:windowLightStatusBar" tools:targetApi="m">false</item>
<item name="android:windowLightNavigationBar" tools:ignore="NewApi">false</item>
</style>

Expand Down
5 changes: 4 additions & 1 deletion app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@

<item name="android:statusBarColor" tools:targetApi="m">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</item>

<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:windowIsTranslucent">false</item>
</style>

<style name="Theme.Syncthing" parent="Theme.Syncthing.Base">
<item name="android:windowLightStatusBar" tools:targetApi="m">false</item>
<item name="android:windowLightStatusBar" tools:targetApi="m">true</item>
<item name="android:windowLightNavigationBar" tools:ignore="NewApi">true</item>
</style>

Expand Down

0 comments on commit a088701

Please sign in to comment.