]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/blobdiff - app/src/main/res/layout/guide_coordinatorlayout_dark.xml
Create a dark theme for `GuideActivity`.
[PrivacyBrowserAndroid.git] / app / src / main / res / layout / guide_coordinatorlayout_dark.xml
diff --git a/app/src/main/res/layout/guide_coordinatorlayout_dark.xml b/app/src/main/res/layout/guide_coordinatorlayout_dark.xml
new file mode 100644 (file)
index 0000000..2bb50ad
--- /dev/null
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+  Copyright © 2016-2017 Soren Stoutner <soren@stoutner.com>.
+
+  This file is part of Privacy Browser <https://www.stoutner.com/privacy-browser>.
+
+  Privacy Browser is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  Privacy Browser is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with Privacy Browser.  If not, see <http://www.gnu.org/licenses/>. -->
+
+<!-- android:fitsSystemWindows="true" moves the AppBar below the status bar.
+  When it is specified the theme should include <item name="android:windowTranslucentStatus">true</item>
+  to make the status bar a transparent, darkened overlay. -->
+<android.support.design.widget.CoordinatorLayout
+    android:id="@+id/guide_coordinatorlayout"
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_height="match_parent"
+    android:layout_width="match_parent"
+    android:fitsSystemWindows="true" >
+
+    <!-- The `LinearLayout` with `orientation="vertical"` moves the `ViewPager` below the `AppBarLayout`. -->
+    <LinearLayout
+        android:layout_height="match_parent"
+        android:layout_width="match_parent"
+        android:orientation="vertical" >
+
+        <!-- We need to set `android:background="?attr/colorPrimaryDark"` here or any space to the right of the `TabLayout` on large devices will be black. -->
+        <android.support.design.widget.AppBarLayout
+            android:id="@+id/guide_appbarlayout"
+            android:layout_height="wrap_content"
+            android:layout_width="match_parent"
+            android:background="?attr/colorPrimaryDark" >
+
+            <!-- `android:theme="@style/PrivacyBrowserAppBarDark"` makes the text and icons in the `AppBar` gray. -->
+            <android.support.v7.widget.Toolbar
+                android:id="@+id/guide_toolbar"
+                android:layout_height="wrap_content"
+                android:layout_width="match_parent"
+                android:background="?attr/colorPrimaryDark"
+                android:theme="@style/PrivacyBrowserAppBarDark" />
+
+            <!-- For some reason `tabIndicatorColor` does not pull from the style unless specified explicitly here. -->
+            <android.support.design.widget.TabLayout
+                android:id="@+id/guide_tablayout"
+                xmlns:android.support.design="http://schemas.android.com/apk/res-auto"
+                android:layout_height="wrap_content"
+                android:layout_width="match_parent"
+                android.support.design:tabMode="scrollable"
+                android.support.design:tabIndicatorColor="?attr/tabIndicatorColor"
+                android:theme="@style/PrivacyBrowserTabLayoutDark" />
+        </android.support.design.widget.AppBarLayout>
+
+        <!-- `android:layout_weight="1"` makes `about_viewpager` fill the rest of the screen. -->
+        <android.support.v4.view.ViewPager
+            android:id="@+id/guide_viewpager"
+            android:layout_width="match_parent"
+            android:layout_height="0dp"
+            android:layout_weight="1" />
+    </LinearLayout>
+</android.support.design.widget.CoordinatorLayout>
\ No newline at end of file