use of android.widget.RemoteViews in project android_frameworks_base by ResurrectionRemix.
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 ResurrectionRemix.
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 ResurrectionRemix.
the class TestAppWidgetProvider method onReceive.
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
Log.d(TAG, "intent=" + intent);
if (AppWidgetManager.ACTION_APPWIDGET_ENABLED.equals(action)) {
Log.d(TAG, "ENABLED");
} else if (AppWidgetManager.ACTION_APPWIDGET_DISABLED.equals(action)) {
Log.d(TAG, "DISABLED");
} else if (AppWidgetManager.ACTION_APPWIDGET_UPDATE.equals(action)) {
if (true)
return;
Log.d(TAG, "UPDATE");
Bundle extras = intent.getExtras();
int[] appWidgetIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_IDS);
AppWidgetManager gm = AppWidgetManager.getInstance(context);
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.test_appwidget);
views.setTextViewText(R.id.oh_hai_text, "hai: " + SystemClock.elapsedRealtime());
if (false) {
gm.updateAppWidget(appWidgetIds, views);
} else {
gm.updateAppWidget(new ComponentName("com.android.tests.appwidgetprovider", "com.android.tests.appwidgetprovider.TestAppWidgetProvider"), views);
}
}
}
use of android.widget.RemoteViews in project android_frameworks_base by ResurrectionRemix.
the class NotificationChildrenContainer method recreateNotificationHeader.
public void recreateNotificationHeader(OnClickListener listener, StatusBarNotification notification) {
final Notification.Builder builder = Notification.Builder.recoverBuilder(getContext(), mNotificationParent.getStatusBarNotification().getNotification());
final RemoteViews header = builder.makeNotificationHeader();
if (mNotificationHeader == null) {
mNotificationHeader = (NotificationHeaderView) header.apply(getContext(), this);
final View expandButton = mNotificationHeader.findViewById(com.android.internal.R.id.expand_button);
expandButton.setVisibility(VISIBLE);
mNotificationHeader.setOnClickListener(listener);
mNotificationHeaderWrapper = NotificationViewWrapper.wrap(getContext(), mNotificationHeader, mNotificationParent);
addView(mNotificationHeader, 0);
invalidate();
} else {
header.reapply(getContext(), mNotificationHeader);
mNotificationHeaderWrapper.notifyContentUpdated(notification);
}
updateChildrenHeaderAppearance();
}
use of android.widget.RemoteViews in project android_frameworks_base by ResurrectionRemix.
the class BaseStatusBar method updatePublicContentView.
protected void updatePublicContentView(Entry entry, StatusBarNotification sbn) {
final RemoteViews publicContentView = entry.cachedPublicContentView;
View inflatedView = entry.getPublicContentView();
if (entry.autoRedacted && publicContentView != null && inflatedView != null) {
final boolean disabledByPolicy = !adminAllowsUnredactedNotifications(entry.notification.getUserId());
String notificationHiddenText = mContext.getString(disabledByPolicy ? com.android.internal.R.string.notification_hidden_by_policy_text : com.android.internal.R.string.notification_hidden_text);
TextView titleView = (TextView) inflatedView.findViewById(android.R.id.title);
if (titleView != null && !titleView.getText().toString().equals(notificationHiddenText)) {
publicContentView.setTextViewText(android.R.id.title, notificationHiddenText);
publicContentView.reapply(sbn.getPackageContext(mContext), inflatedView, mOnClickHandler);
entry.row.onNotificationUpdated(entry);
}
}
}
Aggregations