No need for custom attribute

From what I know, actionBarTheme and actionBarPopupTheme will do the
job.
This commit is contained in:
mvp76 2017-03-01 12:08:52 +01:00 committed by Peter Serwylo
parent a814792594
commit 083339f60e
3 changed files with 11 additions and 12 deletions

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout 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"
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
@ -10,7 +11,8 @@
android:title="@string/menu_manage" android:title="@string/menu_manage"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:theme="?attr/toolbar_theme"/> app:theme="?attr/actionBarTheme"
app:popupTheme="?attr/actionBarPopupTheme" />
<ListView <ListView
android:id="@+id/list" android:id="@+id/list"

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"> android:orientation="vertical">
<android.support.v7.widget.Toolbar <android.support.v7.widget.Toolbar
@ -10,7 +10,8 @@
android:title="@string/repo_details" android:title="@string/repo_details"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:theme="?attr/toolbar_theme" /> app:theme="?attr/actionBarTheme"
app:popupTheme="?attr/actionBarPopupTheme" />
<ScrollView <ScrollView
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -10,6 +10,8 @@
<item name="android:textColorLink">@color/fdroid_green</item> <item name="android:textColorLink">@color/fdroid_green</item>
<item name="alertDialogTheme">@style/AlertDialogThemeDark</item> <item name="alertDialogTheme">@style/AlertDialogThemeDark</item>
<item name="android:textViewStyle">@style/TextViewStyle</item> <item name="android:textViewStyle">@style/TextViewStyle</item>
<item name="actionBarTheme">@style/AppThemeLight.Toolbar</item>
<item name="actionBarPopupTheme">@style/AppThemeLight.Toolbar</item>
</style> </style>
<style name="AppBaseThemeLight" parent="Theme.AppCompat.Light.NoActionBar"> <style name="AppBaseThemeLight" parent="Theme.AppCompat.Light.NoActionBar">
@ -21,7 +23,8 @@
<item name="android:textColorLink">@color/fdroid_green</item> <item name="android:textColorLink">@color/fdroid_green</item>
<item name="alertDialogTheme">@style/AlertDialogThemeLight</item> <item name="alertDialogTheme">@style/AlertDialogThemeLight</item>
<item name="android:textViewStyle">@style/TextViewStyle</item> <item name="android:textViewStyle">@style/TextViewStyle</item>
<item name="toolbar_theme">@style/AppThemeLight.Toolbar</item> <item name="actionBarTheme">@style/AppThemeLight.Toolbar</item>
<item name="actionBarPopupTheme">@style/AppThemeLight.Toolbar</item>
</style> </style>
<style name="AppThemeDark" parent="AppBaseThemeDark"> <style name="AppThemeDark" parent="AppBaseThemeDark">
@ -63,13 +66,6 @@
<item name="windowNoTitle">true</item> <item name="windowNoTitle">true</item>
</style> </style>
<!--
We need to support either light or dark coloured toolbars. Most tutorials online about styling
the Toolbar widget revolve around one style only, which is not conditioned on the current theme.
See http://stackoverflow.com/a/32789928/2391921 for this solution.
-->
<attr name="toolbar_theme" format="reference" />
<style name="AppThemeLight.Toolbar" parent="ThemeOverlay.AppCompat.Dark.ActionBar"> <style name="AppThemeLight.Toolbar" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
<item name="android:background">@color/fdroid_blue</item> <item name="android:background">@color/fdroid_blue</item>
</style> </style>