From 083339f60e3d4d53b7c14fff84d1017689c4202b Mon Sep 17 00:00:00 2001 From: mvp76 <mikael.von.pfaler@gmail.com> Date: Wed, 1 Mar 2017 12:08:52 +0100 Subject: [PATCH] No need for custom attribute From what I know, actionBarTheme and actionBarPopupTheme will do the job. --- app/src/main/res/layout/repo_list_activity.xml | 4 +++- app/src/main/res/layout/repodetails.xml | 7 ++++--- app/src/main/res/values/styles.xml | 12 ++++-------- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/app/src/main/res/layout/repo_list_activity.xml b/app/src/main/res/layout/repo_list_activity.xml index 13e43e525..472461097 100644 --- a/app/src/main/res/layout/repo_list_activity.xml +++ b/app/src/main/res/layout/repo_list_activity.xml @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" + xmlns:app="http://schemas.android.com/apk/res-auto" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> @@ -10,7 +11,8 @@ android:title="@string/menu_manage" android:layout_width="match_parent" android:layout_height="wrap_content" - android:theme="?attr/toolbar_theme"/> + app:theme="?attr/actionBarTheme" + app:popupTheme="?attr/actionBarPopupTheme" /> <ListView android:id="@+id/list" diff --git a/app/src/main/res/layout/repodetails.xml b/app/src/main/res/layout/repodetails.xml index 9e0e87e95..8c3711c81 100644 --- a/app/src/main/res/layout/repodetails.xml +++ b/app/src/main/res/layout/repodetails.xml @@ -1,8 +1,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" android:layout_width="match_parent" android:layout_height="match_parent" + xmlns:app="http://schemas.android.com/apk/res-auto" android:orientation="vertical"> <android.support.v7.widget.Toolbar @@ -10,7 +10,8 @@ android:title="@string/repo_details" android:layout_width="match_parent" android:layout_height="wrap_content" - android:theme="?attr/toolbar_theme" /> + app:theme="?attr/actionBarTheme" + app:popupTheme="?attr/actionBarPopupTheme" /> <ScrollView android:layout_width="match_parent" diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index b952d1340..5db92e500 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -10,6 +10,8 @@ <item name="android:textColorLink">@color/fdroid_green</item> <item name="alertDialogTheme">@style/AlertDialogThemeDark</item> <item name="android:textViewStyle">@style/TextViewStyle</item> + <item name="actionBarTheme">@style/AppThemeLight.Toolbar</item> + <item name="actionBarPopupTheme">@style/AppThemeLight.Toolbar</item> </style> <style name="AppBaseThemeLight" parent="Theme.AppCompat.Light.NoActionBar"> @@ -21,7 +23,8 @@ <item name="android:textColorLink">@color/fdroid_green</item> <item name="alertDialogTheme">@style/AlertDialogThemeLight</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 name="AppThemeDark" parent="AppBaseThemeDark"> @@ -63,13 +66,6 @@ <item name="windowNoTitle">true</item> </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"> <item name="android:background">@color/fdroid_blue</item> </style>