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());
}
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);
}
}
}
}
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();
// }
}
}
}
}
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());
}
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);
}
}
}
}
}
Aggregations