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,32 +1,41 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.design.widget.CoordinatorLayout
xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" xmlns:tools="http://schemas.android.com/tools"
android:layout_height="wrap_content" xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" tools:context="eu.kanade.tachiyomi.ui.manga.MangaActivity"
tools:context="eu.kanade.tachiyomi.ui.manga.MangaActivity"> android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout <LinearLayout
android:id="@+id/appbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/toolbar"/> <android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
<android.support.design.widget.TabLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/tabs"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content">
android:theme="@style/Theme.ActionBar.Tab.Filled"
app:tabIndicatorColor="@android:color/white" />
</android.support.design.widget.AppBarLayout> <include layout="@layout/toolbar"/>
<android.support.v4.view.ViewPager <android.support.design.widget.TabLayout
android:id="@+id/view_pager" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="0px" android:id="@+id/tabs"
android:layout_weight="1"/> android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/Theme.ActionBar.Tab.Filled"
app:tabIndicatorColor="@android:color/white" />
</LinearLayout> </android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="1"/>
</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
android:layout_width="match_parent" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"> android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<include layout="@layout/toolbar"/> <LinearLayout
<FrameLayout
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"
android:orientation="vertical">
</FrameLayout> <android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</LinearLayout> <include layout="@layout/toolbar"/>
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="@+id/settings_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
</FrameLayout>
</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>