Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8bd17796 authored by Julia Reynolds's avatar Julia Reynolds Committed by Android (Google) Code Review
Browse files

Merge "Add onDragSuccess to EntryAdapter" into main

parents f8576346 6cefc606
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -363,6 +363,22 @@ class NotificationEntryAdapterTest : SysuiTestCase() {
        assertThat(underTest.isFullScreenCapable).isTrue()
    }

    @Test
    @EnableFlags(NotificationBundleUi.FLAG_NAME)
    fun onDragSuccess() {
        val notification: Notification =
            Notification.Builder(mContext, "")
                .setSmallIcon(R.drawable.ic_person)
                .addAction(mock(Notification.Action::class.java))
                .build()
        val entry = NotificationEntryBuilder().setNotification(notification).build()

        underTest = factory.create(entry) as NotificationEntryAdapter

        underTest.onDragSuccess()
        verify(kosmos.mockNotificationActivityStarter).onDragSuccess(entry)
    }

    @Test
    @EnableFlags(NotificationBundleUi.FLAG_NAME)
    fun onNotificationBubbleIconClicked() {
+15 −7
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.view.View;

import com.android.systemui.DejankUtils;
import com.android.systemui.power.domain.interactor.PowerInteractor;
import com.android.systemui.statusbar.notification.collection.EntryAdapter;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
import com.android.systemui.statusbar.notification.shared.NotificationBundleUi;
@@ -44,12 +45,19 @@ public final class NotificationClicker implements View.OnClickListener {
    private final Optional<Bubbles> mBubblesOptional;
    private final NotificationActivityStarter mNotificationActivityStarter;

    private ExpandableNotificationRow.OnDragSuccessListener mOnDragSuccessListener =
            new ExpandableNotificationRow.OnDragSuccessListener() {
    private ExpandableNotificationRow.OnDragSuccessListener mOnDragSuccessListener
            = new ExpandableNotificationRow.OnDragSuccessListener() {
        @Override
        public void onDragSuccess(NotificationEntry entry) {
            NotificationBundleUi.assertInLegacyMode();
            mNotificationActivityStarter.onDragSuccess(entry);
        }

        @Override
        public void onDragSuccess(EntryAdapter entryAdapter) {
            NotificationBundleUi.isUnexpectedlyInLegacyMode();
            entryAdapter.onDragSuccess();
        }
    };

    private NotificationClicker(
+5 −0
Original line number Diff line number Diff line
@@ -126,6 +126,11 @@ class BundleEntryAdapter(val entry: BundleEntry) : EntryAdapter {
        return false
    }

    override fun onDragSuccess() {
        // do nothing. these should not be draggable
        Log.wtf(TAG, "onDragSuccess() called")
    }

    override fun onNotificationBubbleIconClicked() {
        // do nothing. these cannot be a bubble
        Log.wtf(TAG, "onNotificationBubbleIconClicked() called")
+2 −0
Original line number Diff line number Diff line
@@ -144,6 +144,8 @@ public interface EntryAdapter {
        return false;
    }

    void onDragSuccess();

    /**
     * Process a click on a notification bubble icon
     */
+4 −0
Original line number Diff line number Diff line
@@ -149,6 +149,10 @@ class NotificationEntryAdapter(
        return entry.sbn.notification.fullScreenIntent != null
    }

    override fun onDragSuccess() {
        notificationActivityStarter.onDragSuccess(entry)
    }

    override fun onNotificationBubbleIconClicked() {
        notificationActivityStarter.onNotificationBubbleIconClicked(entry)
    }
Loading