Open lshiuber opened 8 years ago
:+1: Nice work Lin! Nice to see you get all the stories completed. A few notes after checking out the code:
match_parent
instead of fill_parent
as fill_parent
is the old way of specifying the height / width.activity_home.xml
you don't need to specify all the alignment constraints as long as you've set the layout_width and layout_height to match_parent
.Hopefully this first day has given you a better sense of working with RelativeLayout which is a very flexible layout system, probably one of the most powerful responsive-first layout systems available across web and mobile platforms. Tomorrow we'll be connecting to the actual Instagram API and navigating between activities.
We've captured the most common issues with today's stories below. Read through this point-by-point to determine how you could improve your submission.
tvCaption
(tv
indicates this is a TextView
).sp
for font sizes and dp
for margin + padding and any other positioning. You should also use wrap_content
and match_parent
for width / height whenever possible. Check out this stackoverflow answer for more detail about these units. Avoid using px
or pt
in Android apps.RecyclerView
is that it recycles views (as it’s name suggests). This means that as you scroll down the list, you no longer are creating new views, but are re-using the ones that were created earlier. This introduces a common gotcha where if you don’t explicitly set certain properties for a view, it will inherit the previously set property from an earlier item in the list. This can show up in today’s assignment with the caption. If an earlier post doesn’t have a caption and your adapter sets that TextView's
visibility to View.GONE
, you want to ensure you set that same TextView's
visibility to View.VISIBLE
for any posts that come later that do have a caption.TextView
to format the username / caption with different colors / typeface by using a ForegroundColorSpan and a TypefaceSpan.id
(which is also an int). Hence, you don’t get compile time errors when you accidentally pass in an id
when the api expects an actual RGBA value. In the case of the ForegroundColorSpan
, we need to pass in the actual RGBA value to the constructor. This stackoverflow post captures how to do this.com.codepath.instagram.helpers.SimpleVerticalSpaceItemDecoration
to make it easier to set an ItemDecoration.lineSpacingMultiplier="1.2"
.TextView
supports adding an image right next to your text. In this case, you’ll want to use DrawableLeft and you can even set a DrawablePadding to add space between the image and the text.If you have any particular questions about the assignment in general or on any of the feedback, feel free to reply here or or email us support@codepath.com.
P.S. Can you also make sure to list the user stories that you've completed as outline in the submitting assignments guide?
Thanks!
Addressed comments.
/cc @codepathreview @codepath