Add "Tap to learn more" to message bubbles for timer changes

This commit is contained in:
Torsten Grote
2021-01-14 10:17:53 -03:00
committed by akwizgran
parent d821696c6a
commit f6ccf885e6
6 changed files with 27 additions and 10 deletions

View File

@@ -400,10 +400,7 @@ public class ConversationActivity extends BriarActivity
return true;
case R.id.action_conversation_settings:
if (contactId == null) return false;
ConversationSettingsDialog dialog =
ConversationSettingsDialog.newInstance(contactId);
dialog.show(getSupportFragmentManager(),
ConversationSettingsDialog.TAG);
onAutoDeleteTimerNoticeClicked();
return true;
case R.id.action_delete_all_messages:
askToDeleteAllMessages();
@@ -1043,6 +1040,14 @@ public class ConversationActivity extends BriarActivity
ActivityCompat.startActivity(this, i, options.toBundle());
}
@Override
public void onAutoDeleteTimerNoticeClicked() {
ConversationSettingsDialog dialog =
ConversationSettingsDialog.newInstance(contactId);
dialog.show(getSupportFragmentManager(),
ConversationSettingsDialog.TAG);
}
@DatabaseExecutor
private void respondToIntroductionRequest(SessionId sessionId,
boolean accept) throws DbException {

View File

@@ -81,20 +81,23 @@ abstract class ConversationItemViewHolder extends ViewHolder {
Context ctx = itemView.getContext();
topNotice.setVisibility(VISIBLE);
boolean enabled = item.getAutoDeleteTimer() != NO_AUTO_DELETE_TIMER;
String tapToLearnMore = ctx.getString(R.string.tap_to_learn_more);
String text;
if (item.isIncoming()) {
String name = item.getContactName().getValue();
int strRes = enabled ?
R.string.auto_delete_msg_contact_enabled :
R.string.auto_delete_msg_contact_disabled;
text = ctx.getString(strRes, name);
text = ctx.getString(strRes, name, tapToLearnMore);
} else {
int strRes = enabled ?
R.string.auto_delete_msg_you_enabled :
R.string.auto_delete_msg_you_disabled;
text = ctx.getString(strRes);
text = ctx.getString(strRes, tapToLearnMore);
}
topNotice.setText(text);
topNotice.setOnClickListener(
v -> listener.onAutoDeleteTimerNoticeClicked());
} else {
topNotice.setVisibility(GONE);
}

View File

@@ -18,4 +18,6 @@ interface ConversationListener {
void onAttachmentClicked(View view, ConversationMessageItem messageItem,
AttachmentItem attachmentItem);
void onAutoDeleteTimerNoticeClicked();
}

View File

@@ -14,6 +14,7 @@
android:background="@drawable/notice_in"
android:elevation="@dimen/message_bubble_elevation"
android:paddingBottom="@dimen/message_bubble_padding_top"
android:textIsSelectable="false"
android:visibility="gone"
tools:text="@string/auto_delete_msg_contact_enabled"
tools:visibility="visible" />

View File

@@ -15,6 +15,7 @@
android:elevation="@dimen/message_bubble_elevation"
android:paddingBottom="@dimen/message_bubble_padding_top"
android:textColor="@color/private_message_date_inverse"
android:textIsSelectable="false"
android:visibility="gone"
tools:showIn="@layout/list_item_conversation_msg_out"
tools:text="@string/auto_delete_msg_you_enabled"

View File

@@ -167,10 +167,15 @@
<string name="set_contact_alias">Change contact name</string>
<string name="set_contact_alias_hint">Contact name</string>
<string name="menu_item_disappearing_messages">Disappearing messages</string>
<string name="auto_delete_msg_you_enabled">Your messages will disappear after 7 days.</string>
<string name="auto_delete_msg_you_disabled">Your messages will not disappear.</string>
<string name="auto_delete_msg_contact_enabled">%1$s\'s messages will disappear after 7 days.</string>
<string name="auto_delete_msg_contact_disabled">%1$s\'s messages will not disappear.</string>
<!-- The placeholder at the end will add "Tap to learn more." -->
<string name="auto_delete_msg_you_enabled">Your messages will disappear after 7 days. %1$s</string>
<!-- The placeholder at the end will add "Tap to learn more." -->
<string name="auto_delete_msg_you_disabled">Your messages will not disappear. %1$s</string>
<!-- The second placeholder at the end will add "Tap to learn more." -->
<string name="auto_delete_msg_contact_enabled">%1$s\'s messages will disappear after 7 days. %2$s</string>
<!-- The second placeholder at the end will add "Tap to learn more." -->
<string name="auto_delete_msg_contact_disabled">%1$s\'s messages will not disappear. %2$s</string>
<string name="tap_to_learn_more">Tap to learn more.</string>
<string name="delete_all_messages">Delete all messages</string>
<string name="dialog_title_delete_all_messages">Confirm Message Deletion</string>
<string name="dialog_message_delete_all_messages">Are you sure that you want to delete all messages?</string>