Search in sources :

Example 1 with Subscribe

use of com.squareup.otto.Subscribe in project cw-omnibus by commonsguy.

the class ScheduledService method onDeadEvent.

@Subscribe
public void onDeadEvent(DeadEvent braiiiiiiinz) {
    RandomEvent original = (RandomEvent) braiiiiiiinz.event;
    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(original.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(com.squareup.otto.Subscribe)

Example 2 with Subscribe

use of com.squareup.otto.Subscribe in project WeexErosFramework by bmfe.

the class LightlyWebSocketAdapter method onEvent.

@Subscribe
public void onEvent(Intent intent) {
    if (WXConstant.ACTION_WEEX_REFRESH.equals(intent.getAction())) {
        // refresh check mediator
        String instanceId = intent.getStringExtra("instanceId");
        if (!TextUtils.isEmpty(instanceId)) {
            DefaultWebSocketAdapter defaultWebSocketAdapter = mAdapters.get(instanceId);
            if (defaultWebSocketAdapter != null) {
                // instance has destroy
                defaultWebSocketAdapter.destroy(BMWSCode.INVALID_INSTANCEID.getCode(), BMWSCode.INVALID_INSTANCEID.getReason());
                mAdapters.remove(instanceId);
            }
        }
    }
}
Also used : DefaultWebSocketAdapter(com.benmu.framework.adapter.ws.DefaultWebSocketAdapter) Subscribe(com.squareup.otto.Subscribe)

Example 3 with Subscribe

use of com.squareup.otto.Subscribe in project zype-android by zype.

the class VideosActivity method handleRetrieveVideo.

// //////////
// Subscriptions
// 
@Subscribe
public void handleRetrieveVideo(RetrieveVideoEvent event) {
    List<VideoData> result = event.getEventData().getModelData().getVideoData();
    Pagination pagination = event.getEventData().getModelData().getPagination();
    if (result != null) {
        Logger.d("handleRetrieveVideo(): size=" + result.size());
        if (result.size() > 0) {
            if (mVideoList == null || pagination.getCurrent() == 1) {
                mVideoList = new ArrayList<>(result);
            } else {
                mVideoList.addAll(result);
            }
            if (Pagination.hasNextPage(pagination)) {
                loadVideosFromPlaylist(Pagination.getNextPage(pagination));
            } else {
                int videosAdded = DataHelper.insertVideos(this.getContentResolver(), mVideoList);
                Logger.d("handleRetrieveVideo(): added " + videosAdded + " videos");
                DataHelper.addVideosToPlaylist(this.getContentResolver(), mVideoList, playlistId);
                DataHelper.clearPlaylistVideo(this.getContentResolver(), playlistId);
                int itemsInsertedPlaylistVideo = DataHelper.insertPlaylistVideo(this.getContentResolver(), mVideoList, playlistId, 0);
                Logger.d("handleRetrieveVideo(): PlaylistVideo inserted=" + itemsInsertedPlaylistVideo);
            // if (videosAdded > 0) {
            // startLoadCursors();
            // }
            }
        }
    }
}
Also used : Pagination(com.zype.android.webapi.model.video.Pagination) VideoData(com.zype.android.webapi.model.video.VideoData) ConsumerFavoriteVideoData(com.zype.android.webapi.model.consumers.ConsumerFavoriteVideoData) Subscribe(com.squareup.otto.Subscribe)

Example 4 with Subscribe

use of com.squareup.otto.Subscribe in project zype-android by zype.

the class LoginActivity method handleAccessTokenInfo.

@Subscribe
public void handleAccessTokenInfo(AccessTokenInfoEvent event) {
    Logger.d("handleAccessTokenInfo");
    showProgress(false);
    TokenInfo data = event.getEventData().getModelData();
    SettingsProvider.getInstance().saveAccessTokenApplication(data.getApplicationData());
    SettingsProvider.getInstance().saveAccessTokenCreatedAt(data.getCreatedAt());
    SettingsProvider.getInstance().saveAccessTokenExpiration(data.getExpiresInSeconds());
    SettingsProvider.getInstance().saveAccessTokenResourceOwnerId(data.getResourceOwnerId());
    SettingsProvider.getInstance().saveAccessTokenScopes(data.getScopes());
    ConsumerParamsBuilder builder = new ConsumerParamsBuilder().addAccessToken();
    getApi().executeRequest(WebApiManager.Request.CONSUMER_GET, builder.build());
}
Also used : ConsumerParamsBuilder(com.zype.android.webapi.builder.ConsumerParamsBuilder) TokenInfo(com.zype.android.webapi.model.auth.TokenInfo) Subscribe(com.squareup.otto.Subscribe)

Example 5 with Subscribe

use of com.squareup.otto.Subscribe in project zype-android by zype.

the class MyLibraryFragment method handleRetrieveVideo.

@Subscribe
public void handleRetrieveVideo(RetrieveVideoEvent event) {
    Logger.d("handleRetrieveVideo(): size=" + event.getEventData().getModelData().getVideoData().size());
    Video data = event.getEventData().getModelData();
    if (data.getVideoData().size() > 0) {
        for (VideoData item : data.getVideoData()) {
            if (videoEntitlements.containsKey(item.getId())) {
                List<VideoData> videos = new ArrayList<>();
                videos.add(item);
                DataHelper.insertVideos(getActivity().getContentResolver(), videos);
                VideoEntitlementData entitlementData = videoEntitlements.get(item.getId());
                if (entitlementData != null) {
                    VideoHelper.setEntitlement(getActivity().getContentResolver(), item.getId(), true, entitlementData.updatedAt);
                }
            }
        }
    }
}
Also used : Video(com.zype.android.webapi.model.video.Video) ConsumerFavoriteVideo(com.zype.android.webapi.model.consumers.ConsumerFavoriteVideo) VideoData(com.zype.android.webapi.model.video.VideoData) ConsumerFavoriteVideoData(com.zype.android.webapi.model.consumers.ConsumerFavoriteVideoData) ArrayList(java.util.ArrayList) VideoEntitlementData(com.zype.android.webapi.model.entitlements.VideoEntitlementData) Subscribe(com.squareup.otto.Subscribe)

Aggregations

Subscribe (com.squareup.otto.Subscribe)86 Test (org.junit.Test)28 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)27 RawTodoList (com.armueller.fluxytodo.data.RawTodoList)13 ArrayList (java.util.ArrayList)12 TodoAction (com.armueller.fluxytodo.actions.TodoAction)9 VideoData (com.zype.android.webapi.model.video.VideoData)8 DataBundle (com.armueller.fluxytodo.actions.DataBundle)7 File (com.zype.android.webapi.model.player.File)7 Intent (android.content.Intent)6 FilteredTodoList (com.armueller.fluxytodo.data.FilteredTodoList)6 ConsumerFavoriteVideoData (com.zype.android.webapi.model.consumers.ConsumerFavoriteVideoData)6 Bundle (android.os.Bundle)5 Video (com.zype.android.Db.Entity.Video)5 Consumer (com.zype.android.webapi.model.consumers.Consumer)5 IOException (java.io.IOException)5 Context (android.content.Context)4 ConnectivityManager (android.net.ConnectivityManager)4 NetworkInfo (android.net.NetworkInfo)4 Dialog (android.app.Dialog)3