Search in sources :

Example 86 with RemoteViews

use of android.widget.RemoteViews in project android_frameworks_base by crdroidandroid.

the class RemoteViewsTest method clone_clones.

@Test
public void clone_clones() {
    RemoteViews original = new RemoteViews(mPackage, R.layout.remote_views_test);
    RemoteViews clone = original.clone();
    original.setTextViewText(R.id.text, "test");
    View inflated = clone.apply(mContext, mContainer);
    TextView textView = (TextView) inflated.findViewById(R.id.text);
    assertEquals("", textView.getText());
}
Also used : RemoteViews(android.widget.RemoteViews) TextView(android.widget.TextView) ImageView(android.widget.ImageView) TextView(android.widget.TextView) Test(org.junit.Test) SmallTest(android.support.test.filters.SmallTest)

Example 87 with RemoteViews

use of android.widget.RemoteViews in project android_frameworks_base by crdroidandroid.

the class RemoteViewsTest method clone_child_fails.

@Test
public void clone_child_fails() {
    RemoteViews original = new RemoteViews(mPackage, R.layout.remote_views_test);
    RemoteViews child = new RemoteViews(mPackage, R.layout.remote_views_test);
    original.addView(R.id.layout, child);
    exception.expect(IllegalStateException.class);
    RemoteViews clone = child.clone();
}
Also used : RemoteViews(android.widget.RemoteViews) Test(org.junit.Test) SmallTest(android.support.test.filters.SmallTest)

Example 88 with RemoteViews

use of android.widget.RemoteViews in project android_frameworks_base by crdroidandroid.

the class RemoteViewsTest method clone_doesNotCopyBitmap.

@Test
public void clone_doesNotCopyBitmap() {
    RemoteViews original = new RemoteViews(mPackage, R.layout.remote_views_test);
    Bitmap bitmap = Bitmap.createBitmap(10, 10, Bitmap.Config.ARGB_8888);
    original.setImageViewBitmap(R.id.image, bitmap);
    RemoteViews clone = original.clone();
    View inflated = clone.apply(mContext, mContainer);
    Drawable drawable = ((ImageView) inflated.findViewById(R.id.image)).getDrawable();
    assertSame(bitmap, ((BitmapDrawable) drawable).getBitmap());
}
Also used : RemoteViews(android.widget.RemoteViews) Bitmap(android.graphics.Bitmap) BitmapDrawable(android.graphics.drawable.BitmapDrawable) Drawable(android.graphics.drawable.Drawable) ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) TextView(android.widget.TextView) Test(org.junit.Test) SmallTest(android.support.test.filters.SmallTest)

Example 89 with RemoteViews

use of android.widget.RemoteViews in project android_frameworks_base by crdroidandroid.

the class RemoteViewsTest method clone_originalCanStillBeApplied.

@Test
public void clone_originalCanStillBeApplied() {
    RemoteViews original = new RemoteViews(mPackage, R.layout.remote_views_test);
    RemoteViews clone = original.clone();
    clone.apply(mContext, mContainer);
}
Also used : RemoteViews(android.widget.RemoteViews) Test(org.junit.Test) SmallTest(android.support.test.filters.SmallTest)

Example 90 with RemoteViews

use of android.widget.RemoteViews in project android_frameworks_base by crdroidandroid.

the class NotificationListenerService method maybePopulateRemoteViews.

/**
     * Populates remote views for pre-N targeting apps.
     */
private void maybePopulateRemoteViews(Notification notification) {
    if (getContext().getApplicationInfo().targetSdkVersion < Build.VERSION_CODES.N) {
        Builder builder = Builder.recoverBuilder(getContext(), notification);
        // Some styles wrap Notification's contentView, bigContentView and headsUpContentView.
        // First inflate them all, only then set them to avoid recursive wrapping.
        RemoteViews content = builder.createContentView();
        RemoteViews big = builder.createBigContentView();
        RemoteViews headsUp = builder.createHeadsUpContentView();
        notification.contentView = content;
        notification.bigContentView = big;
        notification.headsUpContentView = headsUp;
    }
}
Also used : RemoteViews(android.widget.RemoteViews) Builder(android.app.Notification.Builder)

Aggregations

RemoteViews (android.widget.RemoteViews)217 Intent (android.content.Intent)86 PendingIntent (android.app.PendingIntent)77 TextView (android.widget.TextView)35 Test (org.junit.Test)35 Notification (android.app.Notification)30 SmallTest (android.support.test.filters.SmallTest)30 View (android.view.View)29 ImageView (android.widget.ImageView)28 AppWidgetManager (android.appwidget.AppWidgetManager)26 ComponentName (android.content.ComponentName)24 Bitmap (android.graphics.Bitmap)24 Bundle (android.os.Bundle)16 NavigationBarView (com.android.systemui.statusbar.phone.NavigationBarView)15 RemoteInputView (com.android.systemui.statusbar.policy.RemoteInputView)15 NotificationCompat (android.support.v4.app.NotificationCompat)14 Resources (android.content.res.Resources)12 StatusBarNotification (android.service.notification.StatusBarNotification)12 SharedPreferences (android.content.SharedPreferences)11 NotificationPanelView (com.android.systemui.statusbar.phone.NotificationPanelView)11