use of org.greenrobot.eventbus.Subscribe in project cw-omnibus by commonsguy.
the class RosterFragment method onRosterLoaded.
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
public void onRosterLoaded(RosterLoadedEvent event) {
setHeadersState(BrowseFragment.HEADERS_ENABLED);
setTitle(getString(R.string.app_name));
ArrayObjectAdapter rows = new ArrayObjectAdapter(new ListRowPresenter());
PresoRoster roster = PresoRoster.getInstance();
ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(new PresoPresenter());
for (int i = 0; i < roster.getPresoCount(); ++i) {
listRowAdapter.add(roster.getPreso(i));
}
HeaderItem header = new HeaderItem(0, "Presentations");
rows.add(new ListRow(header, listRowAdapter));
setAdapter(rows);
}
use of org.greenrobot.eventbus.Subscribe in project cw-omnibus by commonsguy.
the class ScheduledService method onNoSubscriber.
@Subscribe
public void onNoSubscriber(NoSubscriberEvent event) {
RandomEvent randomEvent = (RandomEvent) event.originalEvent;
NotificationCompat.Builder b = new NotificationCompat.Builder(this);
Intent ui = new Intent(this, EventDemoActivity.class);
b.setAutoCancel(true).setDefaults(Notification.DEFAULT_SOUND).setContentTitle(getString(R.string.notif_title)).setContentText(Integer.toHexString(randomEvent.value)).setSmallIcon(android.R.drawable.stat_notify_more).setTicker(getString(R.string.notif_title)).setContentIntent(PendingIntent.getActivity(this, 0, ui, 0));
NotificationManager mgr = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
mgr.notify(NOTIFY_ID, b.build());
}
use of org.greenrobot.eventbus.Subscribe in project cw-omnibus by commonsguy.
the class RestoreProgressActivity method onCompleted.
@Subscribe(threadMode = ThreadMode.MAIN)
public void onCompleted(RestoreService.RestoreCompletedEvent event) {
startActivity(new Intent(this, MainActivity.class));
finish();
}
use of org.greenrobot.eventbus.Subscribe in project cw-omnibus by commonsguy.
the class ScheduledService method onNoSubscriber.
@Subscribe
public void onNoSubscriber(NoSubscriberEvent event) {
RandomEvent randomEvent = (RandomEvent) event.originalEvent;
NotificationCompat.Builder b = new NotificationCompat.Builder(this);
Intent ui = new Intent(this, EventDemoActivity.class);
b.setAutoCancel(true).setDefaults(Notification.DEFAULT_SOUND).setContentTitle(getString(R.string.notif_title)).setContentText(Integer.toHexString(randomEvent.value)).setSmallIcon(android.R.drawable.stat_notify_more).setTicker(getString(R.string.notif_title)).setContentIntent(PendingIntent.getActivity(this, 0, ui, 0));
NotificationManager mgr = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
mgr.notify(NOTIFY_ID, b.build());
}
use of org.greenrobot.eventbus.Subscribe in project SeriesGuide by UweTrottmann.
the class QuickCheckInActivity method onEvent.
@SuppressWarnings("unused")
@Subscribe
public void onEvent(TraktTask.TraktActionCompleteEvent event) {
if (event.mTraktAction != TraktAction.CHECKIN_EPISODE) {
return;
}
// display status toast about trakt action
event.handle(this);
// dismiss notification on successful check-in
if (event.mWasSuccessful) {
NotificationManagerCompat manager = NotificationManagerCompat.from(getApplicationContext());
manager.cancel(SgApp.NOTIFICATION_EPISODE_ID);
// replicate delete intent
NotificationService.handleDeleteIntent(this, getIntent());
}
}
Aggregations