Search in sources :

Example 61 with RemoteViews

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());
}
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 62 with RemoteViews

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());
}
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 63 with RemoteViews

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);
        }
    }
}
Also used : RemoteViews(android.widget.RemoteViews) Bundle(android.os.Bundle) AppWidgetManager(android.appwidget.AppWidgetManager) ComponentName(android.content.ComponentName)

Example 64 with RemoteViews

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();
}
Also used : RemoteViews(android.widget.RemoteViews) View(android.view.View) HybridNotificationView(com.android.systemui.statusbar.notification.HybridNotificationView) TextView(android.widget.TextView) NotificationPanelView(com.android.systemui.statusbar.phone.NotificationPanelView) NotificationHeaderView(android.view.NotificationHeaderView) Notification(android.app.Notification) StatusBarNotification(android.service.notification.StatusBarNotification)

Example 65 with RemoteViews

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);
        }
    }
}
Also used : RemoteViews(android.widget.RemoteViews) TextView(android.widget.TextView) GestureAnywhereView(com.android.systemui.chaos.lab.gestureanywhere.GestureAnywhereView) ImageView(android.widget.ImageView) NotificationPanelView(com.android.systemui.statusbar.phone.NotificationPanelView) View(android.view.View) RemoteInputView(com.android.systemui.statusbar.policy.RemoteInputView) TextView(android.widget.TextView) NavigationBarView(com.android.systemui.statusbar.phone.NavigationBarView)

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