User-selectable contact colors.

// FREEBIE
This commit is contained in:
Moxie Marlinspike
2015-06-24 13:17:58 -07:00
parent fb9f16ad29
commit 296796eb54
11 changed files with 423 additions and 4 deletions

View File

@@ -0,0 +1,24 @@
<!--
Copyright 2013 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/color_grid_item_size"
android:layout_height="@dimen/color_grid_item_size">
<ImageView
android:id="@+id/color_view"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="center"
android:scaleType="fitXY" />
</FrameLayout>

View File

@@ -0,0 +1,21 @@
<!--
Copyright 2013 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<android.support.v7.widget.GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/color_grid"
android:padding="16dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:orientation="horizontal"
app:columnCount="5"/>

View File

@@ -190,4 +190,24 @@
<item>2</item>
</string-array>
<string-array name="default_color_choice_values" translatable="false">
<item>#ffE57373</item>
<item>#ffF06292</item>
<item>#ffBA68C8</item>
<item>#ff9575CD</item>
<item>#ff7986CB</item>
<item>#ff64B5F6</item>
<item>#ff4FC3F7</item>
<item>#ff4DD0E1</item>
<item>#FF4DB6AC</item>
<item>#FF81C784</item>
<item>#FFAED581</item>
<item>#FFDCE775</item>
<item>#FFFFD54F</item>
<item>#FFFFB74D</item>
<item>#FFFF8A65</item>
<item>#FFA1887F</item>
<item>#FF90A4AE</item>
</string-array>
</resources>

View File

@@ -135,4 +135,11 @@
<attr name="lockscreen_watermark" format="reference" />
<attr name="recipient_preference_blocked" format="color"/>
<declare-styleable name="ColorPreference">
<attr name="itemLayout" format="reference" />
<attr name="choices" format="reference" />
<attr name="numColumns" format="integer" />
</declare-styleable>
</resources>

View File

@@ -24,4 +24,7 @@
<integer name="media_overview_cols">3</integer>
<dimen name="message_details_table_row_pad">10dp</dimen>
<dimen name="color_grid_extra_padding">32dp</dimen>
<dimen name="color_grid_item_size">48dp</dimen>
</resources>

View File

@@ -618,6 +618,8 @@
<string name="recipient_preferences__ringtone">Ringtone</string>
<string name="recipient_preferences__vibrate">Vibrate</string>
<string name="recipient_preferences__block">Block</string>
<string name="recipient_preferences__color">Color</string>
<string name="recipient_preferences__color_for_this_contact">Color for this contact</string>
<!-- registration_activity -->
<string name="registration_activity__textsecure_can_use_instant_messages_to_avoid_sms_charges_when_communicating_with_other_textsecure_users">

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<org.thoughtcrime.securesms.components.SwitchPreferenceCompat
android:key="pref_key_recipient_mute"
android:title="@string/recipient_preferences__mute_conversation"
@@ -24,6 +25,17 @@
android:defaultValue="0"
android:persistent="false"/>
<org.thoughtcrime.securesms.preferences.ColorPreference
android:key="pref_key_recipient_color"
android:title="@string/recipient_preferences__color"
android:summary="@string/recipient_preferences__color_for_this_contact"
android:defaultValue="@android:color/black"
android:negativeButtonText="@null"
android:positiveButtonText="@null"
android:persistent="false"
app:numColumns="5" />
<Preference android:key="pref_key_recipient_block"
android:title="@string/recipient_preferences__block" />