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());
}
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();
}
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());
}
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);
}
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;
}
}
Aggregations