Search in sources :

Example 11 with ConversationChannelWrapper

use of android.service.notification.ConversationChannelWrapper in project android_packages_apps_Settings by omnirom.

the class ConversationListPreferenceControllerTest method testCompareSpans.

@Test
public void testCompareSpans() {
    ConversationChannelWrapper one = new ConversationChannelWrapper();
    String text1 = "one one";
    SpannableStringBuilder builder1 = new SpannableStringBuilder(text1);
    Object first1 = new SubscriptSpan();
    builder1.setSpan(first1, 2, 4, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    ShortcutInfo s1 = new ShortcutInfo.Builder(mContext, "one").setShortLabel(builder1).build();
    one.setShortcutInfo(s1);
    ConversationChannelWrapper two = new ConversationChannelWrapper();
    String text2 = "two two";
    SpannableStringBuilder builder2 = new SpannableStringBuilder(text2);
    Object first2 = new SubscriptSpan();
    builder2.setSpan(first2, 2, 4, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    ShortcutInfo s2 = new ShortcutInfo.Builder(mContext, "two").setShortLabel(builder2).build();
    two.setShortcutInfo(s2);
    assertThat(mController.mConversationComparator.compare(one, two)).isLessThan(0);
}
Also used : ShortcutInfo(android.content.pm.ShortcutInfo) ConversationChannelWrapper(android.service.notification.ConversationChannelWrapper) SpannableStringBuilder(android.text.SpannableStringBuilder) SubscriptSpan(android.text.style.SubscriptSpan) SpannableStringBuilder(android.text.SpannableStringBuilder) Test(org.junit.Test)

Example 12 with ConversationChannelWrapper

use of android.service.notification.ConversationChannelWrapper in project android_packages_apps_Settings by omnirom.

the class BubblePreferenceControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    ShadowApplication shadowApplication = ShadowApplication.getInstance();
    shadowApplication.setSystemService(Context.NOTIFICATION_SERVICE, mNm);
    shadowApplication.setSystemService(Context.USER_SERVICE, mUm);
    mContext = RuntimeEnvironment.application;
    when(mFragmentManager.beginTransaction()).thenReturn(mock(FragmentTransaction.class));
    mController = spy(new BubblePreferenceController(mContext, mFragmentManager, mBackend, false, /* isAppPage */
    mListener));
    mAppPageController = spy(new BubblePreferenceController(mContext, mFragmentManager, mBackend, true, /* isAppPage */
    mListener));
    List<ConversationChannelWrapper> convos = new ArrayList<>();
    convos.add(mock(ConversationChannelWrapper.class));
    when(mBackend.getConversations(anyString(), anyInt())).thenReturn(new ParceledListSlice<>(convos));
}
Also used : FragmentTransaction(androidx.fragment.app.FragmentTransaction) ConversationChannelWrapper(android.service.notification.ConversationChannelWrapper) ArrayList(java.util.ArrayList) ShadowApplication(org.robolectric.shadows.ShadowApplication) Before(org.junit.Before)

Aggregations

ConversationChannelWrapper (android.service.notification.ConversationChannelWrapper)12 NotificationChannel (android.app.NotificationChannel)9 Test (org.junit.Test)9 ShortcutInfo (android.content.pm.ShortcutInfo)7 ArrayList (java.util.ArrayList)4 PreferenceCategory (androidx.preference.PreferenceCategory)3 AppBubbleListPreferenceController (com.android.settings.notification.AppBubbleListPreferenceController)2 Before (org.junit.Before)2 ShadowApplication (org.robolectric.shadows.ShadowApplication)2 Intent (android.content.Intent)1 Bundle (android.os.Bundle)1 SpannableStringBuilder (android.text.SpannableStringBuilder)1 SubscriptSpan (android.text.style.SubscriptSpan)1 FragmentTransaction (androidx.fragment.app.FragmentTransaction)1 PreferenceManager (androidx.preference.PreferenceManager)1 PreferenceScreen (androidx.preference.PreferenceScreen)1 NotificationBackend (com.android.settings.notification.NotificationBackend)1