Here are the examples of the java api @com.squareup.otto.Subscribe taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
104 Examples
19
Source : PostViewActivity.java
with MIT License
from TryGhost
with MIT License
from TryGhost
@Subscribe
public void onPostSyncedEvent(PostSyncedEvent event) {
if (event.post != null && event.post.getId().equals(mPost.getId())) {
// Use the synced post, as the server could have modified it (e.g., if the slug clashes).
// Since syncing happens *asynchronously* (relative to the time the SavePostEvent was
// fired), using unsafeUpdatePost() WILL overwrite the user's edits! So, update the
// existing post with whatever properties *could* have been updated by the server *and*
// are NOT user-modifiable. The change will automatically propagate to the editor and
// other fragments because they share the object reference directly.
mPost.setSlug(event.post.getSlug());
if (mbPreviewPost) {
mHandler.removeCallbacks(mSaveTimeoutRunnable);
startBrowserActivity(PostUtils.getPostUrl(mPost));
if (mProgressDialog != null) {
mProgressDialog.dismiss();
}
mbPreviewPost = false;
}
}
}
19
Source : PostViewActivity.java
with MIT License
from TryGhost
with MIT License
from TryGhost
@Subscribe
public void onPostDeletedEvent(PostDeletedEvent event) {
setResult(RESULT_CODE_DELETED);
finish();
}
19
Source : PostViewActivity.java
with MIT License
from TryGhost
with MIT License
from TryGhost
@Subscribe
public void onPostReplacedEvent(PostReplacedEvent event) {
// FIXME check which post changed before blindly replacedigning to mPost!
unsafeUpdatePost(event.newPost);
}
19
Source : PostEditFragment.java
with MIT License
from TryGhost
with MIT License
from TryGhost
@Subscribe
public void onFileUploadedEvent(FileUploadedEvent event) {
// the activity could have been destroyed and re-created
if (mUploadProgress != null) {
mUploadProgress.dismiss();
mUploadProgress = null;
}
// the activity could have been destroyed and re-created
if (mImageUploadDoneAction != null) {
mImageUploadDoneAction.call(event.relativeUrl);
mImageUploadDoneAction = null;
}
mMarkdownEditSelectionState = null;
KeyboardUtils.focusAndShowKeyboard(mActivity, mPostEditView);
}
19
Source : NetworkService.java
with MIT License
from TryGhost
with MIT License
from TryGhost
@Subscribe
public void onLoadGhostVersionEvent(LoadGhostVersionEvent event) {
if (mAuthToken == null) {
// can't do much, not logged in
return;
}
final String UNKNOWN_VERSION = "Unknown";
if (!event.forceNetworkCall) {
RealmQuery<ConfigurationParam> query = mRealm.where(ConfigurationParam.clreplaced).equalTo("key", "version", Case.INSENSITIVE);
if (query.count() > 0) {
getBus().post(new GhostVersionLoadedEvent(query.findFirst().getValue()));
return;
}
}
mApi.getVersion(mAuthToken.getAuthHeader()).enqueue(new Callback<JsonObject>() {
@Override
public void onResponse(@NonNull Call<JsonObject> call, @NonNull Response<JsonObject> response) {
if (response.isSuccessful()) {
try {
String ghostVersion = response.body().get("configuration").getAsJsonArray().get(0).getAsJsonObject().get("version").getreplacedtring();
getBus().post(new GhostVersionLoadedEvent(ghostVersion));
} catch (Exception e) {
getBus().post(new GhostVersionLoadedEvent(UNKNOWN_VERSION));
}
} else {
getBus().post(new GhostVersionLoadedEvent(UNKNOWN_VERSION));
}
}
@Override
public void onFailure(@NonNull Call<JsonObject> call, @NonNull Throwable error) {
// error in transport layer, or lower
getBus().post(new GhostVersionLoadedEvent(UNKNOWN_VERSION));
}
});
}
19
Source : NetworkService.java
with MIT License
from TryGhost
with MIT License
from TryGhost
@Subscribe
public void onLoadUserEvent(final LoadUserEvent event) {
if (event.loadCachedData || !event.forceNetworkCall) {
RealmResults<User> users = mRealm.where(User.clreplaced).findAll();
if (users.size() > 0) {
getBus().post(new UserLoadedEvent(users.first()));
refreshSucceeded(event);
return;
}
// else no users found in db, force a network call!
}
mApi.getCurrentUser(mAuthToken.getAuthHeader(), loadEtag(ETag.TYPE_CURRENT_USER)).enqueue(new Callback<UserList>() {
@Override
public void onResponse(@NonNull Call<UserList> call, @NonNull Response<UserList> response) {
if (response.isSuccessful()) {
UserList userList = response.body();
storeEtag(response.headers(), ETag.TYPE_CURRENT_USER);
createOrUpdateModel(userList.users);
getBus().post(new UserLoadedEvent(userList.users.get(0)));
// download all posts again to enforce role-based permissions for this user
removeEtag(ETag.TYPE_ALL_POSTS);
getBus().post(new SyncPostsEvent(false));
refreshSucceeded(event);
} else {
// fallback to cached data
RealmResults<User> users = mRealm.where(User.clreplaced).findAll();
if (users.size() > 0) {
getBus().post(new UserLoadedEvent(users.first()));
}
if (NetworkUtils.isNotModified(response)) {
refreshSucceeded(event);
} else if (NetworkUtils.isUnauthorized(response)) {
// defer the event and try to re-authorize
refreshAccessToken(event);
} else {
ApiFailure<UserList> apiFailure = new ApiFailure<>(response);
getBus().post(new ApiErrorEvent(apiFailure));
refreshFailed(event, apiFailure);
}
}
}
@Override
public void onFailure(@NonNull Call<UserList> call, @NonNull Throwable error) {
// error in transport layer, or lower
ApiFailure apiFailure = new ApiFailure<>(error);
getBus().post(new ApiErrorEvent(apiFailure));
refreshFailed(event, apiFailure);
}
});
}
19
Source : NetworkService.java
with MIT License
from TryGhost
with MIT License
from TryGhost
@Subscribe
public void onLoadBlogSettingsEvent(final LoadBlogSettingsEvent event) {
if (event.loadCachedData || !event.forceNetworkCall) {
RealmResults<Setting> settings = mRealm.where(Setting.clreplaced).findAll();
if (settings.size() > 0) {
getBus().post(new BlogSettingsLoadedEvent(settings));
refreshSucceeded(event);
return;
}
// no settings found in db, force a network call!
}
mApi.getSettings(mAuthToken.getAuthHeader(), loadEtag(ETag.TYPE_BLOG_SETTINGS)).enqueue(new Callback<SettingsList>() {
@Override
public void onResponse(@NonNull Call<SettingsList> call, @NonNull Response<SettingsList> response) {
if (response.isSuccessful()) {
SettingsList settingsList = response.body();
storeEtag(response.headers(), ETag.TYPE_BLOG_SETTINGS);
createOrUpdateModel(settingsList.settings);
// TODO this is dead code; permalink setting was removed in Ghost 2.0
// see https://github.com/TryGhost/Ghost/pull/9768/files
savePermalinkFormat(settingsList.settings);
getBus().post(new BlogSettingsLoadedEvent(settingsList.settings));
refreshSucceeded(event);
} else {
// fallback to cached data
RealmResults<Setting> settings = mRealm.where(Setting.clreplaced).findAll();
if (settings.size() > 0) {
getBus().post(new BlogSettingsLoadedEvent(settings));
}
if (NetworkUtils.isNotModified(response)) {
refreshSucceeded(event);
} else if (NetworkUtils.isUnauthorized(response)) {
// defer the event and try to re-authorize
refreshAccessToken(event);
} else {
ApiFailure<SettingsList> apiFailure = new ApiFailure<>(response);
getBus().post(new ApiErrorEvent(apiFailure));
refreshFailed(event, apiFailure);
}
}
}
@Override
public void onFailure(@NonNull Call<SettingsList> call, @NonNull Throwable error) {
// error in transport layer, or lower
ApiFailure<SettingsList> apiFailure = new ApiFailure<>(error);
getBus().post(new ApiErrorEvent(apiFailure));
refreshFailed(event, apiFailure);
}
});
}
19
Source : NotificationFragment.java
with MIT License
from jianliaoim
with MIT License
from jianliaoim
@Subscribe
public void oneNetworkEvent(NetworkEvent event) {
switch(event.state) {
case NetworkEvent.STATE_CONNECTED:
// presenter.initNotifications(false);
break;
}
}
19
Source : MatchActivity.java
with MIT License
from bridgefy
with MIT License
from bridgefy
// answer automatically if the current device is an Android Things device
@Subscribe
public void respondMoveIfThingsDevice(String incomingMatchId) {
if (matchId != null && matchId.equals(incomingMatchId) && // player.getNick().equals("Nexus 5X")) {
BridgefyListener.isThingsDevice((getApplicationContext()))) {
if (!matchStopped) {
int[][] board = makeRandomMove();
resetBoard(board);
sendMove(board);
}
}
}
19
Source : MomentsFragment.java
with Apache License 2.0
from aliyun
with Apache License 2.0
from aliyun
@Subscribe
public void onGetMoments(OnGetMomentsEvent event) {
if (event.moments == null) {
callLoad(LOAD_DEFER_LONG);
}
}
19
Source : MainActivity.java
with Apache License 2.0
from aliyun
with Apache License 2.0
from aliyun
@Subscribe
public void onFinishActoinMode(OnFinishActionModeEvent event) {
actionMode.finish();
}
19
Source : MainActivity.java
with Apache License 2.0
from aliyun
with Apache License 2.0
from aliyun
@Subscribe
public void onUploadStateChange(OnUploadStateChangedEvent event) {
handler.post(new Runnable() {
@Override
public void run() {
fillUploadCard();
}
});
}
19
Source : MainActivity.java
with Apache License 2.0
from aliyun
with Apache License 2.0
from aliyun
@Subscribe
public void onGetQuota(OnGetQuotaEvent event) {
if (event.quota != null) {
double used = event.quota.usedQuota / (1024.0 * 1024.0 * 1024.0);
double total = event.quota.totalQuota / (1024.0 * 1024.0 * 1024.0);
String parten = "#.##";
DecimalFormat decimal = new DecimalFormat(parten);
String usedStr = decimal.format(used);
String totalStr = decimal.format(total);
String quota = String.valueOf(usedStr) + "G/" + String.valueOf(totalStr) + "G";
tvQuota.setText(quota);
}
}
19
Source : MainActivity.java
with Apache License 2.0
from aliyun
with Apache License 2.0
from aliyun
@Subscribe
public void onStartActionMode(OnStartActionModeEvent event) {
startActionMode();
}
19
Source : MainActivity.java
with Apache License 2.0
from aliyun
with Apache License 2.0
from aliyun
@Subscribe
public void onLogout(OnLogoutEvent event) {
if (event.isInvalid) {
Log.d(TAG, "InvalidSecurityToken.Expired");
if (MyApplication.isPresLogin) {
} else {
cleanAndCallLogin();
}
}
}
19
Source : CategoryFragment.java
with Apache License 2.0
from aliyun
with Apache License 2.0
from aliyun
@Subscribe
public void onGetCategory(OnGetCategoriesEvent event) {
loadData();
}
19
Source : AssistantFragment.java
with Apache License 2.0
from aliyun
with Apache License 2.0
from aliyun
@Subscribe
public void onGetTags(OnGetTagsEvent event) {
myHandler.removeMessages(CALL_LOAD_1);
myHandler.sendMessageDelayed(myHandler.obtainMessage(CALL_LOAD_1), LOAD_DEFER_MEDIUM);
}
19
Source : PhotosAdapter.java
with Apache License 2.0
from aliyun
with Apache License 2.0
from aliyun
@Subscribe
public void onStartActionMode(OnStartActionModeEvent event) {
}
18
Source : PostViewActivity.java
with MIT License
from TryGhost
with MIT License
from TryGhost
@Subscribe
public void onPostSavedEvent(PostSavedEvent event) {
// since saving happens synchronously (from the time the SavePostEvent was fired), updating
// the post editor is also safe - it won't overwrite the user's edits
if (mPost.getId().equals(event.post.getId())) {
unsafeUpdatePost(event.post);
}
}
18
Source : PostListActivity.java
with MIT License
from TryGhost
with MIT License
from TryGhost
@Subscribe
public void onPostCreatedEvent(PostCreatedEvent event) {
Intent intent = new Intent(PostListActivity.this, PostViewActivity.clreplaced);
intent.putExtra(BundleKeys.POST, event.newPost);
intent.putExtra(BundleKeys.START_EDITING, true);
startActivityForResult(intent, REQUEST_CODE_VIEW_POST);
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
// setup the next Activity to fade-in, since we just finished the circular reveal
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
}
}
18
Source : PostListActivity.java
with MIT License
from TryGhost
with MIT License
from TryGhost
@Subscribe
public void onBlogSettingsLoadedEvent(BlogSettingsLoadedEvent event) {
String blogreplacedle = getString(R.string.app_name);
for (Setting setting : event.settings) {
if (setting.getKey().equals("replacedle")) {
blogreplacedle = setting.getValue();
}
}
mBlogreplacedleView.setText(blogreplacedle);
}
18
Source : PostListActivity.java
with MIT License
from TryGhost
with MIT License
from TryGhost
@Subscribe
public void onUserLoadedEvent(UserLoadedEvent event) {
if (event.user.getProfileImage() != null) {
if (event.user.getProfileImage().isEmpty()) {
return;
}
String blogUrl = AccountManager.getActiveBlogUrl();
String imageUrl = makePicreplacedoUrl(blogUrl, event.user.getProfileImage());
getPicreplacedo().load(imageUrl).transform(new BorderedCircleTransformation()).fit().into(mUserImageView);
} else {
// As of Ghost v2.13.1 (possibly earlier), profile image is null if not set
Log.w(TAG, "user image is null!");
}
}
18
Source : PostEditFragment.java
with MIT License
from TryGhost
with MIT License
from TryGhost
@Subscribe
public void onFileUploadErrorEvent(FileUploadErrorEvent event) {
if (event.apiFailure.error != null) {
Log.exception(new FileUploadFailedException(event.apiFailure.error));
} else if (event.apiFailure.response != null) {
try {
String responseStr = event.apiFailure.response.errorBody().string();
Log.exception(new FileUploadFailedException(responseStr));
} catch (IOException e) {
Log.exception(new Exception("Error while recording file upload exception, " + "see previous exception for details", e));
}
}
Toast.makeText(mActivity, R.string.image_upload_failed, Toast.LENGTH_SHORT).show();
// the activity could have been destroyed and re-created
if (mUploadProgress != null) {
mUploadProgress.dismiss();
mUploadProgress = null;
}
mImageUploadDoneAction = null;
mMarkdownEditSelectionState = null;
}
18
Source : NetworkService.java
with MIT License
from TryGhost
with MIT License
from TryGhost
@Subscribe
public void onLoadTagsEvent(LoadTagsEvent event) {
RealmResults<Tag> tags = mRealm.where(Tag.clreplaced).findAllSorted("name");
List<Tag> tagsCopy = new ArrayList<>(tags.size());
for (Tag tag : tags) {
tagsCopy.add(new Tag(tag.getName()));
}
getBus().post(new TagsLoadedEvent(tagsCopy));
}
18
Source : NetworkService.java
with MIT License
from TryGhost
with MIT License
from TryGhost
@Subscribe
public void onForceCancelRefreshEvent(ForceCancelRefreshEvent event) {
// sometimes (rarely) the DataRefreshedEvent is not sent because an ApiCallEvent
// doesn't get cleared from the queue, this is to guard against that
if (!mRefreshEventsQueue.isEmpty()) {
mRefreshEventsQueue.clear();
// clear last error if any
mRefreshError = null;
}
}
18
Source : NetworkService.java
with MIT License
from TryGhost
with MIT License
from TryGhost
@Subscribe
public void onLoadPostsEvent(final LoadPostsEvent event) {
if (event.loadCachedData || !event.forceNetworkCall) {
List<Post> posts = getPostsSorted();
// if there are no posts, there could be 2 cases:
// 1. there are actually no posts
// 2. we just haven't fetched any posts from the server yet (Realm returns an empty list in this case too)
if (posts.size() > 0) {
getBus().post(new PostsLoadedEvent(posts, POSTS_FETCH_LIMIT));
refreshSucceeded(event);
return;
}
}
RealmResults<User> users = mRealm.where(User.clreplaced).findAll();
if (users.size() == 0) {
return;
}
User user = users.first();
// Retrofit skips parameters with null values
String authorFilter = null;
if (user.isOnlyAuthorOrContributor()) {
authorFilter = "author:" + user.getSlug();
}
final Call<PostList> postListCall = mApi.getPosts(mAuthToken.getAuthHeader(), loadEtag(ETag.TYPE_ALL_POSTS), authorFilter, POSTS_FETCH_LIMIT);
postListCall.enqueue(new Callback<PostList>() {
@Override
public void onResponse(@NonNull Call<PostList> call, @NonNull Response<PostList> response) {
if (response.isSuccessful()) {
PostList postList = response.body();
storeEtag(response.headers(), ETag.TYPE_ALL_POSTS);
// delete local copies of posts that are no longer within the POSTS_FETCH_LIMIT
// FIXME if there are any locally-edited posts at this point that were pushed
// FIXME beyond POSTS_FETCH_LIMIT, their local copies will also be deleted!
Iterable<Post> deletedPosts = Observable.fromIterable(mRealm.where(Post.clreplaced).findAll()).filter(cached -> !postList.contains(cached.getId())).blockingIterable();
deleteModels(deletedPosts);
// skip edited posts because they've not yet been uploaded
RealmResults<Post> localOnlyEdits = mRealm.where(Post.clreplaced).in("pendingActions.type", new String[] { PendingAction.EDIT_LOCAL, PendingAction.EDIT }).findAll();
for (int i = postList.getPosts().size() - 1; i >= 0; --i) {
for (int j = 0; j < localOnlyEdits.size(); ++j) {
if (postList.getPosts().get(i).getId().equals(localOnlyEdits.get(j).getId())) {
postList.getPosts().remove(i);
}
}
}
// make sure drafts have a publishedAt of FAR_FUTURE so they're sorted to the top
Observable.fromIterable(postList.getPosts()).filter(post -> post.getPublishedAt() == null).forEach(post -> post.setPublishedAt(DateTimeUtils.FAR_FUTURE));
// now create / update received posts
// TODO use Realm#insertOrUpdate() for faster insertion here: https://realm.io/news/realm-java-1.1.0/
createOrUpdateModel(postList.getPosts());
getBus().post(new PostsLoadedEvent(getPostsSorted(), POSTS_FETCH_LIMIT));
refreshSucceeded(event);
} else {
// fallback to cached data
getBus().post(new PostsLoadedEvent(getPostsSorted(), POSTS_FETCH_LIMIT));
if (NetworkUtils.isNotModified(response)) {
refreshSucceeded(event);
} else if (NetworkUtils.isUnauthorized(response)) {
// defer the event and try to re-authorize
refreshAccessToken(event);
} else {
ApiFailure<PostList> apiFailure = new ApiFailure<>(response);
getBus().post(new ApiErrorEvent(apiFailure));
refreshFailed(event, apiFailure);
}
}
}
@Override
public void onFailure(@NonNull Call<PostList> call, @NonNull Throwable error) {
// error in transport layer, or lower
ApiFailure<PostList> apiFailure = new ApiFailure<>(error);
getBus().post(new ApiErrorEvent(apiFailure));
refreshFailed(event, apiFailure);
}
});
}
18
Source : NetworkService.java
with MIT License
from TryGhost
with MIT License
from TryGhost
@Subscribe
public void onCreatePostEvent(final CreatePostEvent event) {
Log.i(TAG, "[onCreatePostEvent] creating new post");
Post newPost = new Post();
newPost.setMobiledoc(GhostApiUtils.INSTANCE.initializeMobiledoc());
newPost.addPendingAction(PendingAction.CREATE);
newPost.setId(getTempUniqueId(Post.clreplaced));
// save the local post to db
createOrUpdateModel(newPost);
getBus().post(new PostCreatedEvent(newPost));
getBus().post(new SyncPostsEvent(false));
}
18
Source : NetworkService.java
with MIT License
from TryGhost
with MIT License
from TryGhost
@Subscribe
public void onDeletePostEvent(DeletePostEvent event) {
String postId = event.post.getId();
Log.i(TAG, "[onDeletePostEvent] post id = %s", postId);
Post realmPost = mRealm.where(Post.clreplaced).equalTo("id", postId).findFirst();
if (realmPost == null) {
RuntimeException e = new IllegalArgumentException("Trying to delete post with non-existent id = " + postId);
Log.exception(e);
} else if (realmPost.hasPendingAction(PendingAction.CREATE)) {
deleteModel(realmPost);
getBus().post(new PostDeletedEvent(postId));
} else {
// don't delete locally until the remote copy is deleted
clearAndSetPendingActionOnPost(realmPost, PendingAction.DELETE);
getBus().post(new PostDeletedEvent(postId));
// DON'T trigger a sync here, because it is automatically triggered by the post list anyway
// triggering it twice causes crashes due to invalid Realm objects (deleted twice)
// getBus().post(new SyncPostsEvent(false));
}
}
18
Source : AnalyticsService.java
with MIT License
from TryGhost
with MIT License
from TryGhost
@Subscribe
public void onLoginErrorEvent(LoginErrorEvent event) {
logLogin(event.blogUrl, false);
}
18
Source : AnalyticsService.java
with MIT License
from TryGhost
with MIT License
from TryGhost
@Subscribe
public void onLoginDoneEvent(LoginDoneEvent event) {
logLogin(event.blogUrl, true);
// user just logged in, now's a good time to check this
getBus().post(new LoadGhostVersionEvent(true));
}
18
Source : AnalyticsService.java
with MIT License
from TryGhost
with MIT License
from TryGhost
@Subscribe
public void onFileUploadedEvent(FileUploadedEvent event) {
logPostAction("Image uploaded", null);
}
18
Source : AnalyticsService.java
with MIT License
from TryGhost
with MIT License
from TryGhost
@Subscribe
public void onGhostVersionLoadedEvent(GhostVersionLoadedEvent event) {
logGhostVersion(event.version);
}
18
Source : MainActivityFragment.java
with Apache License 2.0
from SysdataSpA
with Apache License 2.0
from SysdataSpA
@Subscribe
public void onConsumePippo(final UIEvent UIEvent) {
Toast.makeText(getActivity(), "received UIEvent", Toast.LENGTH_SHORT).show();
}
18
Source : TopicSettingActivity.java
with MIT License
from jianliaoim
with MIT License
from jianliaoim
@Subscribe
public void onUpdateMemberEvent(UpdateMemberEvent event) {
if (event.member != null) {
invalidateOptionsMenu();
mAdapter.update(event.member);
}
}
18
Source : LocalContactsActivity.java
with MIT License
from jianliaoim
with MIT License
from jianliaoim
@Subscribe
public void onNewInvitationEvent(NewInvitationEvent event) {
presenter.getContacts();
}
18
Source : ChooseTeamActivity.java
with MIT License
from jianliaoim
with MIT License
from jianliaoim
@Subscribe
public void onUpdateUserEvent(UpdateUserEvent event) {
User user = BizLogic.getUserInfo();
renderUserInfo(user);
}
18
Source : MainActivity.java
with MIT License
from henrymorgen
with MIT License
from henrymorgen
@Subscribe
public void setContent(BusData data) {
Log.i("wangshu", "Subscribe");
tv_message.setText(data.getMessage());
}
18
Source : MainActivity.java
with MIT License
from bridgefy
with MIT License
from bridgefy
@Subscribe
public static void onMoveReceived(Move move) {
// Add the Move to our corresponding match
playersAdapter.addMove(move);
}
18
Source : GenericMaterialListView.java
with Apache License 2.0
from arcus-smart-home
with Apache License 2.0
from arcus-smart-home
@Subscribe
public void onNotifyDataSetChanged(DataSetChangedEvent event) {
getAdapter().notifyDataSetChanged();
}
18
Source : TagsFragment.java
with Apache License 2.0
from aliyun
with Apache License 2.0
from aliyun
@Subscribe
public void onGetTags(OnGetTagsEvent event) {
loadData();
}
18
Source : PhotosFragment.java
with Apache License 2.0
from aliyun
with Apache License 2.0
from aliyun
@Subscribe
public void onGetPhotos(final OnGetPhotosEvent event) {
if (what == ContentType.PHOTO.ordinal()) {
callLoad(LOAD_DEFER_LONG);
}
}
18
Source : MomentsFragment.java
with Apache License 2.0
from aliyun
with Apache License 2.0
from aliyun
@Subscribe
public void onGetMomentsPhotos(OnGetMomentsPhotosEvent event) {
if (what == ContentType.MOMENT_PHOTO.ordinal()) {
callLoad(LOAD_DEFER_LONG);
}
}
18
Source : MomentsFragment.java
with Apache License 2.0
from aliyun
with Apache License 2.0
from aliyun
@Subscribe
public void onSearch(final OnSearchEvent event) {
if (what == ContentType.SEARCH_PHOTO.ordinal()) {
callLoad(LOAD_DEFER_MEDIUM);
}
}
18
Source : FacesFragment.java
with Apache License 2.0
from aliyun
with Apache License 2.0
from aliyun
@Subscribe
public void onGetFaces(OnGetFacesEvent event) {
loadData();
}
18
Source : AssistantFragment.java
with Apache License 2.0
from aliyun
with Apache License 2.0
from aliyun
@Subscribe
public void onGetFaces(OnGetFacesEvent event) {
myHandler.removeMessages(CALL_LOAD_0);
myHandler.sendMessageDelayed(myHandler.obtainMessage(CALL_LOAD_0), LOAD_DEFER_MEDIUM);
}
18
Source : AlbumsFragment.java
with Apache License 2.0
from aliyun
with Apache License 2.0
from aliyun
@Subscribe
public void onGetAlbums(final OnGetAlbumsEvent event) {
if (what == ContentType.ALBUM_PHOTO.ordinal()) {
callLoad(LOAD_DEFER_LONG);
}
}
18
Source : AlbumsFragment.java
with Apache License 2.0
from aliyun
with Apache License 2.0
from aliyun
@Subscribe
public void onCreateAlbumEvent(OnCreateAlbumEvent event) {
final EditText editText = new EditText(getContext());
AlertDialog.Builder inputDialog = new AlertDialog.Builder(getContext());
inputDialog.setreplacedle(getString(R.string.action_create_album)).setView(editText);
inputDialog.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
AlbumsController.getInstance().createAlbum(editText.getText().toString());
}
}).setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
}).show();
}
18
Source : PhotosController.java
with Apache License 2.0
from aliyun
with Apache License 2.0
from aliyun
@Subscribe
public void onGetMoments(OnGetMomentsEvent event) {
if (event.moments != null) {
updateMomentsPhotos(event.moments);
}
}
18
Source : PhotosAdapter.java
with Apache License 2.0
from aliyun
with Apache License 2.0
from aliyun
@Subscribe
public void onFinishActoinMode(OnFinishActionModeEvent event) {
finishActionMode();
}
17
Source : PostListActivity.java
with MIT License
from TryGhost
with MIT License
from TryGhost
@Subscribe
public void onLogoutStatusEvent(LogoutStatusEvent event) {
if (!event.succeeded && event.hasPendingActions) {
final AlertDialog alertDialog = new AlertDialog.Builder(this).setMessage(getString(R.string.unsynced_changes_msg)).setPositiveButton(R.string.dont_logout, (dialog, which) -> {
dialog.dismiss();
}).setNegativeButton(R.string.logout, (dialog, which) -> {
dialog.dismiss();
getBus().post(new LogoutEvent(AccountManager.getActiveBlogUrl(), true));
}).create();
alertDialog.show();
} else {
finish();
Intent logoutIntent = new Intent(this, LoginActivity.clreplaced);
startActivity(logoutIntent);
}
}
See More Examples