Skip to content

Commit

Permalink
[Fix] Work around AppCompat divider bug for good; Fixes dividers in
Browse files Browse the repository at this point in the history
DialogWhenLarge on tablet.
  • Loading branch information
zhanghai committed Mar 31, 2018
1 parent 4050685 commit 393f7c1
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 8 deletions.
13 changes: 13 additions & 0 deletions app/src/main/res/drawable/list_divider_dark.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>

<!--
~ Copyright (c) 2018 Zhang Hai <Dreaming.in.Code.ZH@Gmail.com>
~ All Rights Reserved.
-->

<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#1fffffff" />
<size
android:height="1dp"
android:width="1dp" />
</shape>
13 changes: 13 additions & 0 deletions app/src/main/res/drawable/list_divider_light.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>

<!--
~ Copyright (c) 2018 Zhang Hai <Dreaming.in.Code.ZH@Gmail.com>
~ All Rights Reserved.
-->

<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#1f000000" />
<size
android:height="1dp"
android:width="1dp" />
</shape>
20 changes: 12 additions & 8 deletions app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
<!-- Fixes. -->
<item name="actionBarTheme">@style/ThemeOverlay.Douya.Dark.ActionBar</item>
<item name="actionBarPopupTheme">@style/ThemeOverlay.Douya.Light</item>
<item name="android:listDivider">@drawable/list_divider_light</item>

<item name="colorPrimary">@color/douya_primary</item>
<item name="colorPrimaryDark">@color/douya_primary_dark</item>
Expand All @@ -91,6 +92,7 @@

<!-- Fixes. -->
<item name="actionBarTheme">@style/ThemeOverlay.Douya.Dark.ActionBar</item>
<item name="android:listDivider">@drawable/list_divider_dark</item>

<item name="colorAccent">@color/douya_accent</item>

Expand All @@ -107,10 +109,9 @@

<!-- Fixes. -->
<item name="actionMenuTextAppearance">@style/TextAppearance.Douya.Widget.ActionBar.Menu</item>
<item name="android:textColorLink">?colorAccent</item>
<!-- NOTE: The following two framework attributes are v11. Anyway. -->
<item name="dividerHorizontal">?android:dividerHorizontal</item>
<item name="dividerVertical">?android:dividerVertical</item>
<item name="android:textColorLink">?colorAccent</item>
<item name="toolbarStyle">@style/Widget.Douya.Toolbar</item>
<item name="toolbarNavigationButtonStyle">@style/Widget.Douya.Toolbar.Button.Navigation</item>
</style>
Expand All @@ -124,10 +125,9 @@

<!-- Fixes. -->
<item name="actionMenuTextAppearance">@style/TextAppearance.Douya.Widget.ActionBar.Menu</item>
<item name="android:textColorLink">?colorAccent</item>
<!-- NOTE: The following two framework attributes are v11. Anyway. -->
<item name="dividerHorizontal">?android:dividerHorizontal</item>
<item name="dividerVertical">?android:dividerVertical</item>
<item name="android:textColorLink">?colorAccent</item>
<item name="toolbarStyle">@style/Widget.Douya.Toolbar</item>
<item name="toolbarNavigationButtonStyle">@style/Widget.Douya.Toolbar.Button.Navigation</item>
</style>
Expand Down Expand Up @@ -164,6 +164,8 @@
<!-- Fixes. -->
<item name="actionBarTheme">@style/ThemeOverlay.Douya.Dark.ActionBar</item>
<item name="actionBarPopupTheme">@style/ThemeOverlay.Douya.Light</item>
<item name="android:dividerHorizontal">@drawable/list_divider_light</item>
<item name="android:dividerVertical">@drawable/list_divider_light</item>

<item name="colorPrimary">@color/douya_primary</item>
<item name="colorPrimaryDark">@color/douya_primary_dark</item>
Expand All @@ -177,6 +179,8 @@

<!-- Fixes. -->
<item name="actionBarTheme">@style/ThemeOverlay.Douya.ActionBar</item>
<item name="android:dividerHorizontal">@drawable/list_divider_light</item>
<item name="android:dividerVertical">@drawable/list_divider_light</item>

<item name="colorAccent">@color/douya_accent</item>

Expand All @@ -188,6 +192,8 @@

<!-- Fixes. -->
<item name="actionBarTheme">@style/ThemeOverlay.Douya.Dark.ActionBar</item>
<item name="android:dividerHorizontal">@drawable/list_divider_dark</item>
<item name="android:dividerVertical">@drawable/list_divider_dark</item>

<item name="colorAccent">@color/douya_accent</item>

Expand All @@ -204,10 +210,9 @@

<!-- Fixes. -->
<item name="actionMenuTextAppearance">@style/TextAppearance.Douya.Widget.ActionBar.Menu</item>
<item name="android:textColorLink">?colorAccent</item>
<!-- NOTE: The following two framework attributes are v11. Anyway. -->
<item name="dividerHorizontal">?android:dividerHorizontal</item>
<item name="dividerVertical">?android:dividerVertical</item>
<item name="android:textColorLink">?colorAccent</item>
<item name="toolbarStyle">@style/Widget.Douya.Toolbar</item>
<item name="toolbarNavigationButtonStyle">@style/Widget.Douya.Toolbar.Button.Navigation</item>
</style>
Expand All @@ -221,10 +226,9 @@

<!-- Fixes. -->
<item name="actionMenuTextAppearance">@style/TextAppearance.Douya.Widget.ActionBar.Menu</item>
<item name="android:textColorLink">?colorAccent</item>
<!-- NOTE: The following two framework attributes are v11. Anyway. -->
<item name="dividerHorizontal">?android:dividerHorizontal</item>
<item name="dividerVertical">?android:dividerVertical</item>
<item name="android:textColorLink">?colorAccent</item>
<item name="toolbarStyle">@style/Widget.Douya.Toolbar</item>
<item name="toolbarNavigationButtonStyle">@style/Widget.Douya.Toolbar.Button.Navigation</item>
</style>
Expand Down

0 comments on commit 393f7c1

Please sign in to comment.