-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Async media: adding publishing Snackbars to MySiteFragment #6425
Async media: adding publishing Snackbars to MySiteFragment #6425
Conversation
…PostListFragment and MySiteFragment
Looks great! 👍 |
} | ||
|
||
public static void showSnackbar(Activity activity, int messageRes, int buttonTitleRes, View.OnClickListener onClickListener) { | ||
Snackbar.make(activity.findViewById(R.id.coordinator), messageRes, Snackbar.LENGTH_LONG) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UploadUtils
knowing about the coordinator layout ID seems weird - how about we pass in the View
to the static methods as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(This also applies to the second showSnackbar()
method below.)
|
||
public static void showSnackbar(Activity activity, String text) { | ||
Snackbar.make(activity.findViewById(R.id.coordinator), | ||
text, Snackbar.LENGTH_LONG).show(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we're doing this, let's make this one consistent and use the Snackbar.make()
method that accepts a resource ID instead of a String
(like the showSnackbar()
above this one is using).
} | ||
} | ||
|
||
public static void showSnackbar(Activity activity, int messageRes, int buttonTitleRes, View.OnClickListener onClickListener) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two showSnackbar()
methods can be private, I think it makes to hide them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line and several others exceed 120 chars.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed in e37d98b
…d added some CR to keep 120 chars width down
ready for another round @aforcier 🙇 |
public void onPostUploaded(PostStore.OnPostUploaded event) { | ||
final PostModel post = event.post; | ||
SiteModel site = getSelectedSite(); | ||
if (isAdded() && event.post != null && event.post.getLocalSiteId() == site.getId()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getSelectedSite()
is @Nullable
, so we need to null check before calling site.getId()
in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops good catch - did that check and also moved isAdded()
check a bit up here 28a9d58
…s added, then checked for site != null to avoid NPE
Looks good @mzorz! |
Extends the functionality implemented in #6233 to the Main screen (My sites) where the floating edit button also appears.
To test: follow the instructions in all cases in #6233
cc @aforcier