Make status bar transparent on API >= 21

This commit is contained in:
len 2016-05-21 15:39:41 +02:00
parent 575eaee1d2
commit 637dda2e22
5 changed files with 67 additions and 45 deletions

View File

@ -1,7 +1,6 @@
package eu.kanade.tachiyomi.ui.main package eu.kanade.tachiyomi.ui.main
import android.content.Intent import android.content.Intent
import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.support.v4.app.Fragment import android.support.v4.app.Fragment
import android.support.v4.view.GravityCompat import android.support.v4.view.GravityCompat
@ -29,17 +28,13 @@ class MainActivity : BaseActivity() {
return return
} }
// Inflate activity_edit_categories.xml. // Inflate activity_main.xml.
setContentView(R.layout.activity_main) setContentView(R.layout.activity_main)
// Handle Toolbar // Handle Toolbar
setupToolbar(toolbar, backNavigation = false) setupToolbar(toolbar, backNavigation = false)
supportActionBar?.setHomeAsUpIndicator(R.drawable.ic_menu_white_24dp) supportActionBar?.setHomeAsUpIndicator(R.drawable.ic_menu_white_24dp)
if (Build.VERSION.SDK_INT >= 21) {
window.statusBarColor = android.R.color.transparent
}
// Set behavior of Navigation drawer // Set behavior of Navigation drawer
nav_view.setNavigationItemSelectedListener { item -> nav_view.setNavigationItemSelectedListener { item ->
// Make information view invisible // Make information view invisible

View File

@ -5,7 +5,8 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:gravity="center"> android:gravity="center"
android:fitsSystemWindows="true">
<include layout="@layout/toolbar"/> <include layout="@layout/toolbar"/>

View File

@ -1,9 +1,16 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context="eu.kanade.tachiyomi.ui.manga.MangaActivity"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:orientation="vertical" android:fitsSystemWindows="true">
tools:context="eu.kanade.tachiyomi.ui.manga.MangaActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.design.widget.AppBarLayout <android.support.design.widget.AppBarLayout
android:id="@+id/appbar" android:id="@+id/appbar"
@ -29,4 +36,6 @@
android:layout_height="0px" android:layout_height="0px"
android:layout_weight="1"/> android:layout_weight="1"/>
</LinearLayout> </LinearLayout>
</android.support.design.widget.CoordinatorLayout>

View File

@ -1,16 +1,33 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include layout="@layout/toolbar"/> <include layout="@layout/toolbar"/>
</android.support.design.widget.AppBarLayout>
<FrameLayout <FrameLayout
android:id="@+id/settings_content" android:id="@+id/settings_content"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
</FrameLayout> </FrameLayout>
</LinearLayout> </LinearLayout>
</android.support.design.widget.CoordinatorLayout>

View File

@ -6,7 +6,7 @@
<style name="Theme.Tachiyomi" parent="Theme.Base"> <style name="Theme.Tachiyomi" parent="Theme.Base">
<!-- Attributes specific for SDK 21 and up --> <!-- Attributes specific for SDK 21 and up -->
<item name="android:windowDrawsSystemBarBackgrounds">true</item> <item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@color/colorPrimaryDark</item> <item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@color/colorPrimaryDark</item> <item name="android:navigationBarColor">@color/colorPrimaryDark</item>
<item name="android:alertDialogTheme">@style/Theme.AlertDialog.Light</item> <item name="android:alertDialogTheme">@style/Theme.AlertDialog.Light</item>
</style> </style>
@ -17,7 +17,7 @@
<style name="Theme.Tachiyomi.Dark" parent="Theme.Base.Dark"> <style name="Theme.Tachiyomi.Dark" parent="Theme.Base.Dark">
<!-- Attributes specific for SDK 21 and up --> <!-- Attributes specific for SDK 21 and up -->
<item name="android:windowDrawsSystemBarBackgrounds">true</item> <item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@color/colorPrimaryDark</item> <item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@color/colorPrimaryDark</item> <item name="android:navigationBarColor">@color/colorPrimaryDark</item>
<item name="android:alertDialogTheme">@style/Theme.AlertDialog.Dark</item> <item name="android:alertDialogTheme">@style/Theme.AlertDialog.Dark</item>
</style> </style>