♪ (Jazz music) ♪
I want to show you a demo for the second flipped classroom
where we're going to be doing ListViews and RecyclerViews.
Very exciting stuff because these are -- RecyclerView really is
one of the basic android data structures that we're going to be working with,
and you'll be working with your projects. Super important.
So for this example, I sort of went to the internet
and I found some colors.
This is a very extensive list of colors. (laughs)
And it starts out with always in the same order
with a lot of these dark blues and greens, and color names
like Endeavor, which I don't know if anyone really uses that
as a color name. Tropical Rain Forest, Blue Ribbon.
Science Blue? I don't know.
So you'll notice -- Let's see. So -- Endeavour is above Camerone,
and now Endeavour is down here. So you'll notice that if I click
on any of these -- And this is a ListView --
If I click on any of these, they seemingly sort of disappear.
There's a lot of really dark, a lot of dark colors in the beginning.
Anyway, if we go up to the top, we can see what happens to all these. Oh. Hello?
Oh my god, do I need to restart this thing?
Oh, there we go.
Oh, look. Well, we can actually recognize some of these.
If you notice, when you click, it goes to the top.
It sets the functionality you have to implement.
If you click -- Oh, this is -- This blue is just called Blue.
So Blue is now on top, Dark Blue on top,
Navy Blue on top. This is so dark,
I don't know maybe it's Black, maybe it's something
that's close to Black, but we can't even read it
because in all of these cases, the text is Black.
Okay, so that's the ListView in a ListView functionality.
This flipped classroom has some ListView stuff.
It also has some RecyclerView stuff, and they're both
independent activities, so this is one of the last cases
that we're going to have before we hit fragments,
which are a little bit more convenient way of managing
different screens, but for now, we've got this --
I think it's called the Swap Icon, so I don't exactly know
who it's really intended for,
but I use it to swap between these two views.
And this view is much less monotone.
This is a RecyclerView, and part of what's going on here
is it's got this fancy grid layout, so that's sort of nice,
and then all of the color names are in these boxes,
which is this CardView.
So CardView is a built-in display class, which has some nice borders
and rounded edges, and can give you a little bit of a drop shadow if you want.
So, CardViews are pretty common in RecylerViews.
And here, instead of when you click the -- So, something else happens
when you click the color name. Let's click Blue Violet here
and that became Pickled Bean.
And Havelock Blue. And then it became Portica, which is only
one line and you see everything sort of shifted around.
What's nice about that is you don't have to do any of that work.
That's all the RecyclerView layout.
The layout of the -- It's not the adapter, it's the layout manager.
So anyway, along with all of these names, we have these numbers,
which is the luminance, I believe. Luminance being a sort of
measure of how bright or dark a color is.
And one thing that we do is when the luminance is below 0.3,
we write a color name in white, and when it's above,
we write it in black because that is a high enough contrast
that we can now read all of the color names. So that's sort of useful.
So, I just think this is pretty.
(laughs)
And -- Oh, yeah. What's happening when I click is it's a random --
I believe it's a random swap -- and I believe every time this boots up,
there's a random order.
Not 100% sure though.
But anyway, this is your flip classroom.
You'll be swapping colors and learning the joys
of the difference between Cannon Pink and Vin Rouge in no time.
Thanks.