Office Hours — Today, November 17

Thursday, November 15

Nov 17
3:50 PM
Mark M.
has entered the room
Mark M.
turned on guest access
4:10 PM
Aaron
has entered the room
Mark M.
hello, Aaron!
how can I help you today?
Aaron
hey Mark, no list of questions today, but I would like to get your feedback on a couple things I've added, to see if there's a better way to do them
Mark M.
OK
4:15 PM
Aaron
first, I animated an animation to the refresh button in my toolbar, and did this by giving it an ImageView actionViewClass in XML, and then getting ahold of that view and using an objectAnimator on it:
I did it this way because I could NOT find a way to grab the view that the icon is normally inflated into, when it is specified as an icon in XML. As far as I can tell, the API does not offer any way to do that
Mark M.
correct
Aaron
but as a consequence, I have to handle clicks on the button with a listener that operates outside the normal menu affordances, which seems not great
is there a better option than the way I have it now?
Mark M.
you mean, besides not having the animation? not really
Aaron
OK
Mark M.
the action bar isn't really designed for that
if you switch to Toolbar, you have a bit more flexibility
Aaron
do you have an alternate suggestion for how to indicate work is happening, when the button is clicked? IOW do you see a problem with animating that icon from a UX standpoint? I wanted to indicate work is happening after it's clicked
also, since I am extending AppCompatActivity, isn't that a Toolbar by default? pretty sure that's what it's called in the Layout Inspector
4:20 PM
Mark M.
possibly, but I don't think you have access to it, unless you put the Toolbar in your layout yourself and use setSupportActionBar()
or, just use the Toolbar directly and don't bother with action bar support
I don't have a problem with showing refresh feedback in general
and if you want to do so in an action bar, your solution is about the best that you have
particularly for your app, pull-to-refresh is probably a more popular pattern
and the pull-to-refresh libraries usually have a loading state as part of their support, from what I've seen
Aaron
I have that too, but I had included the regular button as an accessible alternative
Mark M.
so, you have pull-to-refresh? can you tell it to show its loading state manually?
if so, I'd do that, so you have consistency, and then perhaps move the refresh option into the overflow menu
Aaron
it's a SwipeRefreshLayout - maybe - I haven't actually looked into it
that seems reasonable
4:25 PM
Aaron
anyway, this is not too important, mainly was just wanting to know about the animation implementation. I'll look at the Toolbar a bit and decide
Mark M.
with Toolbar, you can add arbitrary child views
and you manage those no different than you would any other widget in your UI
if nothing else, it makes what you are doing perhaps feel less odd
Aaron
OK, that makes sense
thanks,
Mark M.
alternatively, wrap your existing stuff in an ActionProvider
another way to make what you're doing feel less odd
Aaron
OK, interesting, not familiar with that, I will read up on it
the other thing I wanted to ask about is also UX related, I have gotten some conflicting opinions from other people I've discussed with, just wanted to get your take,
I implemented a splash screen (that is "reactive" and clears itself when data has finished loading, so it doesn't add any unnecessary delay): https://www.youtube.com/watch?v=MPdLVd4zL40
the goal with this was to mask the normal blank white screen and empty RecyclerView when the app first loads, and also provide a hint that work is happening
4:30 PM
Aaron
it's fairly smooth except for a bit of jank right as the activity trasnsitions, but rather than performance, just more interested to know your take on that from a UX standpoint
Mark M.
having some sort of loading state: good
having it be a separate activity/fragment: less good
Aaron
for example, some people think that showing the skeleton RecyclerView actually helps to indicate work happening, and provides a less jarring transition
hmm, I see
Mark M.
a typical approach is to have an "empty view" that you show on the same screen that has your list
Aaron
I read several different articles about splash screens and all of them did it with a separate activity
I see
Mark M.
in your case, it's technically more of a "loading view" than an "empty view", but the principle still holds
so, have your LAUNCHER drive straight to the initial real screen
in the layout, have your animated image along with the RecyclerView, with the RecyclerView visibility set to INVISIBLE or GONE
when you get your data, either just toggle the visibilities or run an animation
4:35 PM
Aaron
roger that, it hadn't really occurred to me to do it that way, but seems better
Mark M.
some apps/screens need three things: a loading state, the normal state, and an empty state (if there is no data to show)
in your case, other than connectivity errors or Reddit having a *really* bad day, the empty state shouldn't happen, I think
Aaron
I need to reread those articles and try to understand why they were all suggesting a separate activity, I didn't really question it at the time but now that you have suggested doing it with just toggling views, I am not sure why they'd do it otherwise
Mark M.
in some cases, where the user goes is not known until after the data is loaded, in which case you need something to show first
Aaron
yeah that makes sense.
OK, that's all I've got, very helpful, thanks a lot!
4:40 PM
Mark M.
and if the loading state is some crazy complicated thing (e.g., playback of a video baked into the app), you might put that in a separate activity/fragment just from a code maintenance standpoint
Aaron
OK
waiting in case you are still typing
Mark M.
no, sorry, I'm done
Aaron
alright, thanks
have a good weekend!
Mark M.
you too!
Aaron
has left the room
5:00 PM
Mark M.
turned off guest access

Thursday, November 15

 

Office Hours

People in this transcript

  • Aaron
  • Mark Murphy