Merge branch 'lineage-21.0' of https://github.com/LineageOS/android_packages_apps_Messaging into leaf-3.2
Change-Id: I0d5a6fca59538fe25a192c023b7232bede6e18d7
diff --git a/src/com/android/messaging/ui/conversation/ConversationFragment.java b/src/com/android/messaging/ui/conversation/ConversationFragment.java
index 6eb7089..181e878 100644
--- a/src/com/android/messaging/ui/conversation/ConversationFragment.java
+++ b/src/com/android/messaging/ui/conversation/ConversationFragment.java
@@ -819,7 +819,7 @@
return true;
case R.id.action_delete:
- if (isReadyForAction()) {
+ if (isReadyForDeleteAction()) {
new AlertDialog.Builder(getActivity())
.setTitle(getResources().getQuantityString(
R.plurals.delete_conversations_confirmation_dialog_title, 1))
@@ -1073,6 +1073,10 @@
return UiUtils.isReadyForAction();
}
+ public boolean isReadyForDeleteAction() {
+ return UiUtils.isReadyForDeleteAction();
+ }
+
/**
* When there's some condition that prevents an operation, such as sending a message,
* call warnOfMissingActionConditions to put up a snackbar and allow the user to repair
@@ -1142,7 +1146,7 @@
}
void deleteMessage(final String messageId) {
- if (isReadyForAction()) {
+ if (isReadyForDeleteAction()) {
final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity())
.setTitle(R.string.delete_message_confirmation_dialog_title)
.setMessage(R.string.delete_message_confirmation_dialog_text)
@@ -1178,7 +1182,7 @@
}
public void deleteConversation() {
- if (isReadyForAction()) {
+ if (isReadyForDeleteAction()) {
final Context context = getActivity();
mBinding.getData().deleteConversation(mBinding);
closeConversation(mConversationId);
diff --git a/src/com/android/messaging/util/UiUtils.java b/src/com/android/messaging/util/UiUtils.java
index 17c877f..236de32 100644
--- a/src/com/android/messaging/util/UiUtils.java
+++ b/src/com/android/messaging/util/UiUtils.java
@@ -349,6 +349,18 @@
phoneUtils.isDefaultSmsApp();
}
+ /**
+ * Called to check if a message or conversation can be deleted - it needs to be the default
+ * sms app
+ * @return true if all conditions are nominal and we're ready to delete a message
+ */
+ public static boolean isReadyForDeleteAction() {
+ final PhoneUtils phoneUtils = PhoneUtils.getDefault();
+
+ // Is the default sms app?
+ return phoneUtils.isDefaultSmsApp();
+ }
+
/*
* Removes all html markup from the text and replaces links with the the text and a text version
* of the href.