use of android.widget.RemoteViews in project robolectric by robolectric.
the class ShadowContextImplTest method createPackageContextRemoteViews.
@Test
public void createPackageContextRemoteViews() throws Exception {
RemoteViews remoteViews = new RemoteViews(RuntimeEnvironment.application.getPackageName(), R.layout.remote_views);
remoteViews.apply(RuntimeEnvironment.application, new FrameLayout(RuntimeEnvironment.application));
}
use of android.widget.RemoteViews in project cw-omnibus by commonsguy.
the class Downloader method buildForeground.
private NotificationCompat.Builder buildForeground(String filename) {
NotificationCompat.Builder b = new NotificationCompat.Builder(this);
RemoteViews content = new RemoteViews(getPackageName(), R.layout.notif_content);
content.setTextViewText(android.R.id.title, "Downloading: " + filename);
b.setOngoing(true).setContent(content).setSmallIcon(android.R.drawable.stat_sys_download);
return (b);
}
use of android.widget.RemoteViews in project cw-omnibus by commonsguy.
the class Plugin method onReceive.
@Override
public void onReceive(Context ctxt, Intent i) {
if (ACTION_CALL_FOR_PLUGINS.equals(i.getAction())) {
Intent registration = new Intent(ACTION_REGISTER_PLUGIN);
registration.setPackage(HOST_PACKAGE);
registration.putExtra(EXTRA_COMPONENT, new ComponentName(ctxt, getClass()));
ctxt.sendBroadcast(registration);
} else if (ACTION_CALL_FOR_CONTENT.equals(i.getAction())) {
RemoteViews rv = new RemoteViews(ctxt.getPackageName(), R.layout.plugin);
Intent update = new Intent(ACTION_DELIVER_CONTENT);
update.setPackage(HOST_PACKAGE);
update.putExtra(EXTRA_CONTENT, rv);
ctxt.sendBroadcast(update);
}
}
use of android.widget.RemoteViews in project cw-omnibus by commonsguy.
the class LoremViewsFactory method getViewAt.
@Override
public RemoteViews getViewAt(int position) {
RemoteViews row = new RemoteViews(ctxt.getPackageName(), R.layout.row);
row.setTextViewText(android.R.id.text1, items[position]);
Intent i = new Intent();
Bundle extras = new Bundle();
extras.putString(WidgetProvider.EXTRA_WORD, items[position]);
extras.putInt(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
i.putExtras(extras);
row.setOnClickFillInIntent(android.R.id.text1, i);
return (row);
}
use of android.widget.RemoteViews in project cw-omnibus by commonsguy.
the class AppWidget method onAppWidgetOptionsChanged.
@Override
public void onAppWidgetOptionsChanged(Context ctxt, AppWidgetManager mgr, int appWidgetId, Bundle newOptions) {
RemoteViews updateViews = new RemoteViews(ctxt.getPackageName(), R.layout.widget);
String msg = String.format(Locale.getDefault(), "[%d-%d] x [%d-%d]", newOptions.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH), newOptions.getInt(AppWidgetManager.OPTION_APPWIDGET_MAX_WIDTH), newOptions.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT), newOptions.getInt(AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT));
updateViews.setTextViewText(R.id.size, msg);
mgr.updateAppWidget(appWidgetId, updateViews);
}
Aggregations