Skip to content

Commit

Permalink
修复夜间模式设置selecter错误导致部分手机崩溃问题
Browse files Browse the repository at this point in the history
  • Loading branch information
maning committed Sep 5, 2016
1 parent 0c0d97b commit 23a9fb3
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 15 deletions.
4 changes: 2 additions & 2 deletions app/src/main/res/drawable/item_selecter.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

<item android:state_pressed="true" android:drawable="?item_bg_pressed"/>
<item android:drawable="?item_bg"/>
<item android:state_pressed="true" android:drawable="@color/item_selecter_pressed_color"/>
<item android:drawable="@color/item_bg"/>

</selector>
7 changes: 7 additions & 0 deletions app/src/main/res/drawable/item_selecter_night.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

<item android:state_pressed="true" android:drawable="@color/item_selecter_pressed_color_night"/>
<item android:drawable="@color/item_bg_night"/>

</selector>
4 changes: 2 additions & 2 deletions app/src/main/res/drawable/item_setting_selecter.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

<item android:state_pressed="true" android:drawable="?item_bg_pressed"/>
<item android:drawable="?item_setting_bg"/>
<item android:state_pressed="true" android:drawable="@color/item_selecter_pressed_color"/>
<item android:drawable="@color/item_setting_bg"/>

</selector>
7 changes: 7 additions & 0 deletions app/src/main/res/drawable/item_setting_selecter_night.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

<item android:state_pressed="true" android:drawable="@color/item_selecter_pressed_color_night"/>
<item android:drawable="@color/item_setting_bg_night"/>

</selector>
7 changes: 4 additions & 3 deletions app/src/main/res/layout/activity_setting.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
android:id="@+id/item_clean_cache"
android:layout_width="match_parent"
android:layout_height="44dp"
android:background="@drawable/item_setting_selecter"
android:background="?item_setting_bg"
app:setting_red_dot="false"
app:setting_right_text="0M"
app:setting_title="图片缓存" />
Expand All @@ -114,7 +114,8 @@
android:id="@+id/item_feedback"
android:layout_width="match_parent"
android:layout_height="44dp"
android:background="@drawable/item_setting_selecter"
android:visibility="visible"
android:background="?item_setting_bg"
app:setting_red_dot="true"
app:setting_title="意见反馈" />

Expand All @@ -130,7 +131,7 @@
android:id="@+id/item_app_update"
android:layout_width="match_parent"
android:layout_height="44dp"
android:background="@drawable/item_setting_selecter"
android:background="?item_setting_bg"
app:setting_red_dot="true"
app:setting_title="版本更新" />

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/item_time.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
android:id="@+id/tv_time"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/item_selecter"
android:background="?item_bg"
android:paddingBottom="12dp"
android:paddingLeft="20dp"
android:paddingTop="12dp"
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
<attr name="toolbar_line_color" format="reference|color" />
<attr name="item_bg" format="reference|color" />
<attr name="item_setting_bg" format="reference|color" />
<attr name="item_bg_pressed" format="reference|color" />
<attr name="lineColor" format="reference" />
<attr name="setting_text_color" format="reference|color" />
<attr name="setting_small_text_color" format="reference|color" />
Expand Down
10 changes: 4 additions & 6 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@
<item name="android:windowBackground">@color/main_color</item>
<item name="app_background">@color/backgroundColor</item>
<item name="lineColor">@color/lineColor</item>
<item name="item_bg">@color/item_bg</item>
<item name="item_setting_bg">@color/item_setting_bg</item>
<item name="item_bg_pressed">@color/item_selecter_pressed_color</item>
<item name="item_bg">@drawable/item_selecter</item>
<item name="item_setting_bg">@drawable/item_setting_selecter</item>
<item name="setting_text_color">@color/gank_text2_color</item>
<item name="setting_small_text_color">@color/gank_text3_color</item>
<item name="app_toolbar_bg">@color/main_color</item>
Expand Down Expand Up @@ -86,9 +85,8 @@
<item name="android:windowBackground">@color/main_color_night</item>
<item name="app_background">@color/backgroundColor_night</item>
<item name="lineColor">@color/lineColor_night</item>
<item name="item_bg">@color/item_bg_night</item>
<item name="item_setting_bg">@color/item_setting_bg_night</item>
<item name="item_bg_pressed">@color/item_selecter_pressed_color_night</item>
<item name="item_bg">@drawable/item_selecter_night</item>
<item name="item_setting_bg">@drawable/item_setting_selecter_night</item>
<item name="setting_text_color">@color/gank_text2_color_night</item>
<item name="setting_small_text_color">@color/gank_text3_color_night</item>
<item name="app_toolbar_bg">@color/main_color_night</item>
Expand Down

0 comments on commit 23a9fb3

Please sign in to comment.