Skip to content

Commit

Permalink
Support for per-recipient muting, blocking, and ringtones.
Browse files Browse the repository at this point in the history
Fixes #757
Fixes #354
Fixes #222
Closes #1815
Closes #3378

// FREEBIE
  • Loading branch information
moxie0 committed Jun 11, 2015
1 parent cb3cf77 commit 40af2a8
Show file tree
Hide file tree
Showing 80 changed files with 1,842 additions and 305 deletions.
8 changes: 8 additions & 0 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,14 @@
</intent-filter>
</activity>

<activity android:name=".RecipientPreferenceActivity"
android:theme="@style/TextSecure.LightNoActionBar"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>

<activity android:name=".BlockedContactsActivity"
android:theme="@style/TextSecure.LightTheme"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>

<activity android:name="com.soundcloud.android.crop.CropImageActivity" />

<service android:enabled="true" android:name=".service.ApplicationMigrationService"/>
Expand Down
Binary file added res/drawable-hdpi/ic_block_grey600_18dp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-hdpi/ic_block_white_18dp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-hdpi/ic_volume_off_grey600_18dp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-hdpi/ic_volume_off_white_18dp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-mdpi/ic_block_grey600_18dp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-mdpi/ic_block_white_18dp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-mdpi/ic_volume_off_grey600_18dp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-mdpi/ic_volume_off_white_18dp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-xhdpi/ic_block_grey600_18dp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-xhdpi/ic_block_white_18dp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-xhdpi/ic_volume_off_grey600_18dp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-xhdpi/ic_volume_off_white_18dp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-xxhdpi/ic_block_grey600_18dp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-xxhdpi/ic_block_white_18dp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-xxhdpi/ic_volume_off_grey600_18dp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-xxhdpi/ic_volume_off_white_18dp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-xxxhdpi/ic_block_grey600_18dp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-xxxhdpi/ic_block_white_18dp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-xxxhdpi/ic_volume_off_grey600_18dp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-xxxhdpi/ic_volume_off_white_18dp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions res/layout/blocked_contact_list_item.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>

<org.thoughtcrime.securesms.preferences.BlockedContactListItem
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:paddingRight="25dip">

<org.thoughtcrime.securesms.components.AvatarImageView
android:id="@+id/contact_photo_image"
android:layout_width="@dimen/contact_selection_photo_size"
android:layout_height="@dimen/contact_selection_photo_size"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:cropToPadding="true"
android:scaleType="centerCrop"
android:contentDescription="@string/SingleContactSelectionActivity_contact_photo" />

<TextView android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_marginLeft="14dip"
android:checkMark="?android:attr/listChoiceIndicatorMultiple"
android:singleLine="true"
android:ellipsize="marquee"
android:layout_toRightOf="@id/contact_photo_image"
android:gravity="center_vertical|left"
android:textAppearance="?android:attr/textAppearanceMedium" />

</org.thoughtcrime.securesms.preferences.BlockedContactListItem>
23 changes: 23 additions & 0 deletions res/layout/blocked_contacts_fragment.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="16dip"
android:paddingRight="16dip">

<ListView android:id="@id/android:list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:drawSelectorOnTop="false"/>

<TextView android:id="@id/android:empty"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center|center_vertical"
android:gravity="center|center_vertical"
android:textSize="20sp"
android:text="@string/blocked_contacts_fragment__no_blocked_contacts"/>

</LinearLayout>
7 changes: 7 additions & 0 deletions res/layout/conversation_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,13 @@

</LinearLayout>

<Button android:id="@+id/unblock_button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="20dp"
android:text="Unblock"
android:visibility="gone"/>

<TextView android:id="@+id/space_left"
android:paddingLeft="5dip"
android:layout_width="fill_parent"
Expand Down
4 changes: 2 additions & 2 deletions res/layout/conversation_list_item_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
android:layout_marginTop="3dp"
android:layout_marginBottom="3dp"
android:cropToPadding="true"
android:visibility="gone"
tools:src="@drawable/ic_contact_picture"
android:contentDescription="@string/conversation_list_item_view__contact_photo_image"
android:layout_marginRight="10dp"
Expand Down Expand Up @@ -50,7 +49,8 @@
android:textColor="?attr/conversation_list_item_contact_color"
android:singleLine="true"
tools:text="Jules Bonnot"
android:ellipsize="marquee" />
android:ellipsize="end"
android:drawablePadding="5dp"/>

<ImageView android:id="@+id/error"
android:layout_marginLeft="3dip"
Expand Down
29 changes: 29 additions & 0 deletions res/layout/conversation_title_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<org.thoughtcrime.securesms.ConversationTitleView
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:gravity="center_vertical">

<TextView android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="end"
android:drawablePadding="5dp"
android:gravity="center_vertical"
android:layout_gravity="center_vertical"
style="@style/TextSecure.TitleTextStyle"/>

<TextView android:id="@+id/subtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="end"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
style="@style/TextSecure.SubtitleTextStyle"/>

</org.thoughtcrime.securesms.ConversationTitleView>
58 changes: 58 additions & 0 deletions res/layout/recipient_preference_activity.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_height="130dp"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:theme="@style/TextSecure.LightActionBar">

<RelativeLayout android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:gravity="center_vertical">

<org.thoughtcrime.securesms.components.AvatarImageView
android:id="@+id/avatar"
android:foreground="@drawable/contact_photo_background"
android:layout_width="50dp"
android:layout_height="50dp"
android:cropToPadding="true"
android:layout_marginLeft="0dp"
android:layout_alignParentLeft="true"/>

<TextView android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
style="@style/TextSecure.TitleTextStyle"
android:layout_toRightOf="@id/avatar"
android:layout_marginLeft="10dip"/>

<TextView android:id="@+id/blocked_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/avatar"
android:layout_below="@id/name"
android:layout_alignLeft="@id/name"
android:text="@string/recipient_preference_activity__blocked"
android:textSize="12sp"
android:textStyle="bold"
android:textColor="?recipient_preference_blocked"
android:textAllCaps="true" />


</RelativeLayout>


</android.support.v7.widget.Toolbar>

<FrameLayout android:id="@+id/preference_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
5 changes: 5 additions & 0 deletions res/menu/conversation_muted.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:title="@string/conversation_muted__unmute"
android:id="@+id/menu_unmute_notifications" />
</menu>
7 changes: 7 additions & 0 deletions res/menu/conversation_unmuted.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">

<item android:title="@string/conversation_unmuted__mute_notifications"
android:id="@+id/menu_mute_notifications" />

</menu>
19 changes: 19 additions & 0 deletions res/values/arrays.xml
Original file line number Diff line number Diff line change
Expand Up @@ -171,4 +171,23 @@
<item>@string/arrays__use_custom</item>
</string-array>

<string-array name="mute_durations">
<item>@string/arrays__mute_for_one_hour</item>
<item>@string/arrays__mute_for_two_hours</item>
<item>@string/arrays__mute_for_one_day</item>
<item>@string/arrays__mute_for_seven_days</item>
</string-array>

<string-array name="recipient_vibrate_entries">
<item>@string/arrays__settings_default</item>
<item>@string/arrays__enabled</item>
<item>@string/arrays__disabled</item>
</string-array>

<string-array name="recipient_vibrate_values">
<item>0</item>
<item>1</item>
<item>2</item>
</string-array>

</resources>
2 changes: 2 additions & 0 deletions res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,6 @@

<attr name="group_members_dialog_icon" format="reference"/>
<attr name="lockscreen_watermark" format="reference" />

<attr name="recipient_preference_blocked" format="color"/>
</resources>
49 changes: 49 additions & 0 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@
<string name="AttachmentTypeSelectorAdapter_audio">Audio</string>
<string name="AttachmentTypeSelectorAdapter_contact">Contact info</string>

<!-- BlockedContactsActivity -->
<string name="BlockedContactsActivity_blocked_contacts">Blocked contacts</string>

<!-- ConfirmIdentityDialog -->
<string name="ConfirmIdentityDialog_the_signature_on_this_key_exchange_is_different">The
identifying key material for %1$s has changed. This could either mean that someone is trying to
Expand Down Expand Up @@ -118,6 +121,9 @@
<string name="ConversationActivity_mms_not_supported_title">MMS not supported</string>
<string name="ConversationActivity_mms_not_supported_message">This message cannot be sent since your carrier doesn\'t support MMS.</string>
<string name="ConversationActivity_specify_recipient">Please choose a contact</string>
<string name="ConversationActivity_unblock_question">Unblock?</string>
<string name="ConversationActivity_are_you_sure_you_want_to_unblock_this_contact">Are you sure you want to unblock this contact?</string>
<string name="ConversationActivity_unblock">Unblock</string>

<!-- ConversationFragment -->
<string name="ConversationFragment_message_details">Message details</string>
Expand Down Expand Up @@ -294,6 +300,14 @@
<string name="RatingManager_no_thanks">No thanks</string>
<string name="RatingManager_later">Later</string>

<!-- RecipientPreferencesActivity -->
<string name="RecipientPreferenceActivity_block_this_contact_question">Block this contact?</string>
<string name="RecipientPreferenceActivity_you_will_no_longer_see_messages_from_this_user">You will no longer see messages sent from this user.</string>
<string name="RecipientPreferenceActivity_block">Block</string>
<string name="RecipientPreferenceActivity_unblock_this_contact_question">Unblock this contact?</string>
<string name="RecipientPreferenceActivity_are_you_sure_you_want_to_unblock_this_contact">Are you sure you want to unblock this contact?</string>
<string name="RecipientPreferenceActivity_unblock">Unblock</string>

<!-- RegistrationActivity -->
<string name="RegistrationActivity_connect_with_textsecure">Connect With TextSecure</string>
<string name="RegistrationActivity_select_your_country">Select your country</string>
Expand Down Expand Up @@ -465,9 +479,15 @@
<!-- ContactSelectionListFragment-->
<string name="ContactSelectionlistFragment_select_for">Select for</string>

<!-- blocked_contacts_fragment -->
<string name="blocked_contacts_fragment__no_blocked_contacts">No blocked contacts...</string>

<!-- contact_selection_recent_activity -->
<string name="contact_selection_recent_activity__no_recent_calls">No recent calls.</string>

<!-- conversation_title_view -->
<string name="conversation_title_view__conversation_muted">Conversation muted</string>

<!-- conversation_activity -->
<string name="conversation_activity__type_message_push">Send TextSecure message</string>
<string name="conversation_activity__type_message_sms_insecure">Send unsecured SMS</string>
Expand Down Expand Up @@ -563,6 +583,16 @@
<string name="prompt_mms_activity__textsecure_requires_mms_settings_to_deliver_media_and_group_messages">TextSecure requires MMS settings to deliver media and group messages through your wireless carrier. Your device does not make this information available, which is occasionally true for locked devices and other restrictive configurations.</string>
<string name="prompt_mms_activity__to_send_media_and_group_messages_click_ok">To send media and group messages, click \'OK\' and complete the requested settings. The MMS settings for your carrier can generally be located by searching for \'your carrier APN\'. You will only need to do this once.</string>

<!-- recipient_preferences_activity -->
<string name="recipient_preference_activity__blocked">BLOCKED</string>

<!-- recipient_preferences -->
<string name="recipient_preferences__mute_conversation">Mute conversation</string>
<string name="recipient_preferences__disable_notifications_for_this_conversation">Disable notifications for this conversation</string>
<string name="recipient_preferences__ringtone">Ringtone</string>
<string name="recipient_preferences__vibrate">Vibrate</string>
<string name="recipient_preferences__block">Block</string>

<!-- registration_activity -->
<string name="registration_activity__textsecure_can_use_instant_messages_to_avoid_sms_charges_when_communicating_with_other_textsecure_users">
Verify your phone number to connect with TextSecure.
Expand Down Expand Up @@ -684,6 +714,15 @@
<string name="arrays__use_default">Use default</string>
<string name="arrays__use_custom">Use custom</string>

<string name="arrays__mute_for_one_hour">Mute for 1 hour</string>
<string name="arrays__mute_for_two_hours">Mute for 2 hours</string>
<string name="arrays__mute_for_one_day">Mute for 1 day</string>
<string name="arrays__mute_for_seven_days">Mute for 7 days</string>

<string name="arrays__settings_default">Settings default</string>
<string name="arrays__enabled">Enabled</string>
<string name="arrays__disabled">Disabled</string>

<!-- plurals.xml -->
<plurals name="hours_ago">
<item quantity="one">%d hour</item>
Expand Down Expand Up @@ -787,6 +826,8 @@
<string name="preferences__submit_debug_log">Submit debug log</string>
<string name="preferences__support_wifi_calling">\'WiFi Calling\' compatibility mode</string>
<string name="preferences__enable_if_your_device_supports_sms_mms_delivery_over_wifi">Enable if your device uses SMS/MMS delivery over WiFi (only enable when \'WiFi Calling\' is enabled on your device)</string>
<string name="preferences__privacy">Privacy</string>
<string name="preferences_app_protection__blocked_contacts">Blocked contacts</string>

<!-- **************************************** -->
<!-- menus -->
Expand Down Expand Up @@ -844,6 +885,12 @@
<string name="conversation_secure_verified__menu_verify_identity">Verify identity</string>
<string name="conversation_secure_verified__menu_abort_secure_session">End secure session</string>

<!-- conversation_muted -->
<string name="conversation_muted__unmute">Unmute</string>

<!-- conversation_unmuted -->
<string name="conversation_unmuted__mute_notifications">Mute notifications</string>

<!-- conversation -->
<string name="conversation__menu_add_attachment">Add attachment</string>
<string name="conversation__menu_update_group">Update group</string>
Expand Down Expand Up @@ -900,6 +947,8 @@

<!-- transport_selection_list_item -->
<string name="transport_selection_list_item__transport_icon">Transport icon</string>
<string name="MuteDialog_mute_notifications">Mute notifications</string>


<!-- EOF -->

Expand Down
Loading

0 comments on commit 40af2a8

Please sign in to comment.