Open kaewka opened 9 years ago
:+1: Great work, good job getting all stories done. 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.ImageView
, it has it’s own set of properties that mirror the ImageView
properties.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.
Please review @codepathreview and @codepath