Theme Support

1) Broke out the UI elements of the major Activites into stylable
   attributes.

2) Created a 'light' and 'dark' theme for the newly stylable attrs.

3) Touched up some of the UI spacing.

4) Implemented dynamic theme switching support.
This commit is contained in:
Moxie Marlinspike
2013-06-21 11:56:59 -07:00
parent 2ffc70a95b
commit 5263ac1f1a
62 changed files with 443 additions and 156 deletions

View File

@@ -6,6 +6,16 @@
<item>@string/preferences__hours</item>
</string-array>
<string-array name="pref_theme_entries">
<item>@string/preferences__light_theme</item>
<item>@string/preferences__dark_theme</item>
</string-array>
<string-array name="pref_theme_values" translatable="false">
<item>light</item>
<item>dark</item>
</string-array>
<string-array name="pref_led_color_entries">
<item>@string/preferences__green</item>
<item>@string/preferences__red</item>

19
res/values/attrs.xml Normal file
View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<attr name="conversation_list_item_background_selected" format="reference"/>
<attr name="conversation_list_item_background_read" format="reference"/>
<attr name="conversation_list_item_background_unread" format="reference"/>
<attr name="conversation_list_item_count_color" format="reference|color"/>
<attr name="conversation_background" format="reference|color"/>
<attr name="conversation_card_background" format="reference|color"/>
<attr name="conversation_text_primary_color" format="reference|color"/>
<attr name="conversation_text_secondary_color" format="reference|color"/>
<attr name="conversation_avatar_divet_right" format="reference"/>
<attr name="conversation_avatar_divet_left" format="reference"/>
<attr name="conversation_editor_background" format="reference|color"/>
<attr name="conversation_editor_text_color" format="reference|color"/>
<attr name="conversation_send_button" format="reference"/>
<attr name="conversation_send_secure_button" format="reference"/>
<attr name="conversation_delivered_indicator" format="reference"/>
</resources>

View File

@@ -1,8 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<drawable name="white_background">#ffffffff</drawable>
<drawable name="text_color_black">#ff000000</drawable>
<color name="unread_bgcolor">#ffffffff</color>
<color name="read_bgcolor">#ffeeeeee</color>
<color name="white">#ffffffff</color>
<color name="black">#ff000000</color>
<color name="conversation_list_item_background_read_light">#ffeeeeee</color>
<color name="conversation_list_item_background_unread_light">#ffffffff</color>
<color name="conversation_list_item_background_read_dark">#ff000000</color>
<color name="conversation_list_item_background_unread_dark">#ff333333</color>
</resources>

View File

@@ -457,7 +457,8 @@
<string name="preferences__conversation_length_limit">Conversation length limit</string>
<string name="preferences__trim_all_threads_now">Trim all threads now</string>
<string name="preferences__scan_through_all_conversation_threads_and_enforce_conversation_length_limits">Scan through all conversation threads and enforce conversation length limits</string>
<string name="preferences__light_theme">Light Theme</string>
<string name="preferences__dark_theme">Dark Theme</string>
<!-- **************************************** -->
<!-- menus -->
@@ -527,6 +528,8 @@
<!-- verify_keys -->
<string name="verify_keys__menu_verified">Verified</string>
<string name="preferences__appearance">Appearance</string>
<string name="preferences__theme">Theme</string>
<!-- EOF -->
</resources>

41
res/values/themes.xml Normal file
View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="TextSecure.LightTheme" parent="@style/Theme.Sherlock.Light.DarkActionBar">
<item name="conversation_list_item_background_read">@drawable/conversation_list_item_background_read_light</item>
<item name="conversation_list_item_background_unread">@drawable/conversation_list_item_background_unread_light</item>
<item name="conversation_list_item_background_selected">@drawable/list_selected_holo_light</item>
<item name="conversation_list_item_count_color">#66333333</item>
<item name="conversation_card_background">#ffdddddd</item>
<item name="conversation_background">@color/white</item>
<item name="conversation_text_primary_color">@color/abs__primary_text_holo_light</item>
<item name="conversation_text_secondary_color">#ffcccccc</item>
<item name="conversation_avatar_divet_right">@drawable/divet_right_light</item>
<item name="conversation_avatar_divet_left">@drawable/divet_left_light</item>
<item name="conversation_editor_background">#eeeeee</item>
<item name="conversation_editor_text_color">@color/edit_text_light_theme</item>
<item name="conversation_send_button">@drawable/ic_send_holo_light</item>
<item name="conversation_send_secure_button">@drawable/ic_send_encrypted_holo_light</item>
<item name="conversation_delivered_indicator">@drawable/ic_sms_mms_delivered_light</item>
</style>
<style name="TextSecure.DarkTheme" parent="@style/Theme.Sherlock">
<item name="conversation_list_item_background_read">@drawable/conversation_list_item_background_read_dark</item>
<item name="conversation_list_item_background_unread">@drawable/conversation_list_item_background_unread_dark</item>
<item name="conversation_list_item_background_selected">@drawable/list_selected_holo_dark</item>
<item name="conversation_list_item_count_color">#66dddddd</item>
<item name="conversation_card_background">#ffdddddd</item>
<item name="conversation_background">@color/black</item>
<item name="conversation_text_primary_color">@color/abs__primary_text_holo_dark</item>
<item name="conversation_text_secondary_color">#ffcccccc</item>
<item name="conversation_avatar_divet_right">@drawable/divet_right_dark</item>
<item name="conversation_avatar_divet_left">@drawable/divet_left_dark</item>
<item name="conversation_editor_background">@color/black</item>
<item name="conversation_editor_text_color">@color/edit_text_dark_theme</item>
<item name="conversation_send_button">@drawable/ic_send_holo_dark</item>
<item name="conversation_send_secure_button">@drawable/ic_send_holo_dark_encrypted</item>
<item name="conversation_delivered_indicator">@drawable/ic_sms_mms_delivered_dark</item>
</style>
</resources>