Messaging: Implement per conversation channels. Update API level to 28.
* Get rid of in-app settings for notifications, replaced by channels features * Remove all the notification plumbing and dead code Test: m, manual Signed-off-by: Luca Stefani <luca.stefani.ge1@gmail.com> Signed-off-by: Joey <joey@lineageos.org> Signed-off-by: Danny Baumann <dannybaumann@web.de> Signed-off-by: Arne Coucheron <arco68@gmail.com> Signed-off-by: Lyubo <lyubodzhamov@gmail.com> Change-Id: Idb39ca32751d40b3376934775d2119dd6cc7e297
This commit is contained in:
@@ -30,7 +30,6 @@ import android.view.View;
|
||||
import com.android.messaging.R;
|
||||
import com.android.messaging.datamodel.action.DeleteConversationAction;
|
||||
import com.android.messaging.datamodel.action.UpdateConversationArchiveStatusAction;
|
||||
import com.android.messaging.datamodel.action.UpdateConversationOptionsAction;
|
||||
import com.android.messaging.datamodel.action.UpdateDestinationBlockedAction;
|
||||
import com.android.messaging.datamodel.data.ConversationListData;
|
||||
import com.android.messaging.datamodel.data.ConversationListItemData;
|
||||
@@ -190,23 +189,6 @@ public abstract class AbstractConversationListActivity extends BugleActionBarAc
|
||||
exitMultiSelectState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActionBarNotification(final Iterable<SelectedConversation> conversations,
|
||||
final boolean isNotificationOn) {
|
||||
for (final SelectedConversation conversation : conversations) {
|
||||
UpdateConversationOptionsAction.enableConversationNotifications(
|
||||
conversation.conversationId, isNotificationOn);
|
||||
}
|
||||
|
||||
final int textId = isNotificationOn ?
|
||||
R.string.notification_on_toast_message : R.string.notification_off_toast_message;
|
||||
final String message = getResources().getString(textId, 1);
|
||||
UiUtils.showSnackBar(this, findViewById(android.R.id.list), message,
|
||||
null /* undoRunnable */,
|
||||
SnackBar.Action.SNACK_BAR_UNDO, mConversationListFragment.getSnackBarInteractions());
|
||||
exitMultiSelectState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActionBarAddContact(final SelectedConversation conversation) {
|
||||
final Uri avatarUri;
|
||||
|
||||
@@ -127,7 +127,6 @@ public class ConversationListItemView extends FrameLayout implements OnClickList
|
||||
private TextView mTimestampTextView;
|
||||
private ContactIconView mContactIconView;
|
||||
private ImageView mContactCheckmarkView;
|
||||
private ImageView mNotificationBellView;
|
||||
private ImageView mFailedStatusIconView;
|
||||
private ImageView mCrossSwipeArchiveLeftImageView;
|
||||
private ImageView mCrossSwipeArchiveRightImageView;
|
||||
@@ -153,7 +152,6 @@ public class ConversationListItemView extends FrameLayout implements OnClickList
|
||||
mTimestampTextView = (TextView) findViewById(R.id.conversation_timestamp);
|
||||
mContactIconView = (ContactIconView) findViewById(R.id.conversation_icon);
|
||||
mContactCheckmarkView = (ImageView) findViewById(R.id.conversation_checkmark);
|
||||
mNotificationBellView = (ImageView) findViewById(R.id.conversation_notification_bell);
|
||||
mFailedStatusIconView = (ImageView) findViewById(R.id.conversation_failed_status_icon);
|
||||
mCrossSwipeArchiveLeftImageView = (ImageView) findViewById(R.id.crossSwipeArchiveIconLeft);
|
||||
mCrossSwipeArchiveRightImageView =
|
||||
@@ -503,9 +501,6 @@ public class ConversationListItemView extends FrameLayout implements OnClickList
|
||||
mAudioAttachmentView.setOnLongClickListener(this);
|
||||
mAudioAttachmentView.setVisibility(audioPreviewVisiblity);
|
||||
|
||||
final int notificationBellVisiblity = mData.getNotificationEnabled() ? GONE : VISIBLE;
|
||||
mNotificationBellView.setVisibility(notificationBellVisiblity);
|
||||
|
||||
if (PrefsUtils.isSwipeRightToDeleteEnabled()) {
|
||||
mCrossSwipeArchiveLeftImageView.setImageDrawable(getResources()
|
||||
.getDrawable(R.drawable.ic_delete_small_dark));
|
||||
|
||||
@@ -37,8 +37,6 @@ public class MultiSelectActionModeCallback implements Callback {
|
||||
void onActionBarDelete(Collection<SelectedConversation> conversations);
|
||||
void onActionBarArchive(Iterable<SelectedConversation> conversations,
|
||||
boolean isToArchive);
|
||||
void onActionBarNotification(Iterable<SelectedConversation> conversations,
|
||||
boolean isNotificationOn);
|
||||
void onActionBarAddContact(final SelectedConversation conversation);
|
||||
void onActionBarBlock(final SelectedConversation conversation);
|
||||
void onActionBarHome();
|
||||
@@ -52,7 +50,6 @@ public class MultiSelectActionModeCallback implements Callback {
|
||||
public final CharSequence participantLookupKey;
|
||||
public final boolean isGroup;
|
||||
public final boolean isArchived;
|
||||
public final boolean notificationEnabled;
|
||||
public SelectedConversation(ConversationListItemData data) {
|
||||
conversationId = data.getConversationId();
|
||||
timestamp = data.getTimestamp();
|
||||
@@ -61,7 +58,6 @@ public class MultiSelectActionModeCallback implements Callback {
|
||||
participantLookupKey = data.getParticipantLookupKey();
|
||||
isGroup = data.getIsGroup();
|
||||
isArchived = data.getIsArchived();
|
||||
notificationEnabled = data.getNotificationEnabled();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,8 +68,6 @@ public class MultiSelectActionModeCallback implements Callback {
|
||||
private MenuItem mUnarchiveMenuItem;
|
||||
private MenuItem mAddContactMenuItem;
|
||||
private MenuItem mBlockMenuItem;
|
||||
private MenuItem mNotificationOnMenuItem;
|
||||
private MenuItem mNotificationOffMenuItem;
|
||||
private boolean mHasInflated;
|
||||
|
||||
public MultiSelectActionModeCallback(final Listener listener) {
|
||||
@@ -89,8 +83,6 @@ public class MultiSelectActionModeCallback implements Callback {
|
||||
mUnarchiveMenuItem = menu.findItem(R.id.action_unarchive);
|
||||
mAddContactMenuItem = menu.findItem(R.id.action_add_contact);
|
||||
mBlockMenuItem = menu.findItem(R.id.action_block);
|
||||
mNotificationOffMenuItem = menu.findItem(R.id.action_notification_off);
|
||||
mNotificationOnMenuItem = menu.findItem(R.id.action_notification_on);
|
||||
mHasInflated = true;
|
||||
updateActionIconsVisiblity();
|
||||
return true;
|
||||
@@ -113,12 +105,6 @@ public class MultiSelectActionModeCallback implements Callback {
|
||||
case R.id.action_unarchive:
|
||||
mListener.onActionBarArchive(mSelectedConversations.values(), false);
|
||||
return true;
|
||||
case R.id.action_notification_off:
|
||||
mListener.onActionBarNotification(mSelectedConversations.values(), false);
|
||||
return true;
|
||||
case R.id.action_notification_on:
|
||||
mListener.onActionBarNotification(mSelectedConversations.values(), true);
|
||||
return true;
|
||||
case R.id.action_add_contact:
|
||||
Assert.isTrue(mSelectedConversations.size() == 1);
|
||||
mListener.onActionBarAddContact(mSelectedConversations.valueAt(0));
|
||||
@@ -186,16 +172,8 @@ public class MultiSelectActionModeCallback implements Callback {
|
||||
|
||||
boolean hasCurrentlyArchived = false;
|
||||
boolean hasCurrentlyUnarchived = false;
|
||||
boolean hasCurrentlyOnNotification = false;
|
||||
boolean hasCurrentlyOffNotification = false;
|
||||
final Iterable<SelectedConversation> conversations = mSelectedConversations.values();
|
||||
for (final SelectedConversation conversation : conversations) {
|
||||
if (conversation.notificationEnabled) {
|
||||
hasCurrentlyOnNotification = true;
|
||||
} else {
|
||||
hasCurrentlyOffNotification = true;
|
||||
}
|
||||
|
||||
if (conversation.isArchived) {
|
||||
hasCurrentlyArchived = true;
|
||||
} else {
|
||||
@@ -203,15 +181,10 @@ public class MultiSelectActionModeCallback implements Callback {
|
||||
}
|
||||
|
||||
// If we found at least one of each example we don't need to keep looping.
|
||||
if (hasCurrentlyOffNotification && hasCurrentlyOnNotification &&
|
||||
hasCurrentlyArchived && hasCurrentlyUnarchived) {
|
||||
if (hasCurrentlyArchived && hasCurrentlyUnarchived) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
// If we have notification off conversations we show on button, if we have notification on
|
||||
// conversation we show off button. We can show both if we have a mixture.
|
||||
mNotificationOffMenuItem.setVisible(hasCurrentlyOnNotification);
|
||||
mNotificationOnMenuItem.setVisible(hasCurrentlyOffNotification);
|
||||
|
||||
mArchiveMenuItem.setVisible(hasCurrentlyUnarchived);
|
||||
mUnarchiveMenuItem.setVisible(hasCurrentlyArchived);
|
||||
|
||||
Reference in New Issue
Block a user