Search in sources :

Example 1 with Subscribe

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);
}
Also used : ListRowPresenter(android.support.v17.leanback.widget.ListRowPresenter) ArrayObjectAdapter(android.support.v17.leanback.widget.ArrayObjectAdapter) HeaderItem(android.support.v17.leanback.widget.HeaderItem) ListRow(android.support.v17.leanback.widget.ListRow) Subscribe(org.greenrobot.eventbus.Subscribe)

Example 2 with Subscribe

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());
}
Also used : NotificationManager(android.app.NotificationManager) NotificationCompat(android.support.v4.app.NotificationCompat) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) RandomEvent(com.commonsware.android.parcelable.marshall.RandomEvent) Subscribe(org.greenrobot.eventbus.Subscribe)

Example 3 with Subscribe

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();
}
Also used : Intent(android.content.Intent) Subscribe(org.greenrobot.eventbus.Subscribe)

Example 4 with Subscribe

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());
}
Also used : NotificationManager(android.app.NotificationManager) NotificationCompat(android.support.v4.app.NotificationCompat) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) Subscribe(org.greenrobot.eventbus.Subscribe)

Example 5 with Subscribe

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());
    }
}
Also used : NotificationManagerCompat(android.support.v4.app.NotificationManagerCompat) Subscribe(org.greenrobot.eventbus.Subscribe)

Aggregations

Subscribe (org.greenrobot.eventbus.Subscribe)164 Intent (android.content.Intent)20 Bundle (android.os.Bundle)11 EventBus (org.greenrobot.eventbus.EventBus)10 ThreadMode (org.greenrobot.eventbus.ThreadMode)10 View (android.view.View)9 Poi (io.jawg.osmcontributor.model.entities.Poi)9 PoiType (io.jawg.osmcontributor.model.entities.PoiType)9 ArrayList (java.util.ArrayList)9 Context (android.content.Context)8 Handler (android.os.Handler)8 ViewGroup (android.view.ViewGroup)8 FeedItem (de.danoeh.antennapod.model.feed.FeedItem)8 SuppressLint (android.annotation.SuppressLint)6 LayoutInflater (android.view.LayoutInflater)6 MenuItem (android.view.MenuItem)6 DownloaderUpdate (de.danoeh.antennapod.core.event.DownloaderUpdate)6 AndroidSchedulers (io.reactivex.android.schedulers.AndroidSchedulers)6 Disposable (io.reactivex.disposables.Disposable)6 Schedulers (io.reactivex.schedulers.Schedulers)6