Skip to content

Commit

Permalink
Fixed item heights on featured page.
Browse files Browse the repository at this point in the history
  • Loading branch information
nessup committed Oct 29, 2013
1 parent 40a75af commit 470495a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public View getView(final int i, View view, ViewGroup parentViewGroup) {
view = inflater.inflate(R.layout.video_row, parentViewGroup, false);
videoRow = VideoRow.newInstance(view);
videoRow.playButtonVisible = true;
videoRow.thumbnailHeight = getResources().getDimensionPixelSize(R.dimen.featured_thumbnail_height);
view.setTag(videoRow);

view.setOnClickListener(new View.OnClickListener() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ public class VideoRow {
public boolean playButtonVisible;
public float titleFontSize;
public float subtitleFontSize;
public int thumbnailHeight;

public ImageView thumbnailView;
public TextView titleView;
public ImageButton playButton;
public ImageView durationIcon;
Expand All @@ -36,6 +38,7 @@ public static VideoRow newInstance(View view) {
}

private void findViews(View parentView) {
thumbnailView = (ImageView) parentView.findViewById(R.id.imageView);
titleView = (TextView) parentView.findViewById(R.id.title);
playButton = (ImageButton) parentView.findViewById(R.id.playButton);
durationIcon = (ImageView) parentView.findViewById(R.id.durationIcon);
Expand All @@ -47,6 +50,11 @@ private void findViews(View parentView) {
}

public void configureWithVideo(Video video) {
// Video thumbnail
if (thumbnailHeight > 0) {
thumbnailView.getLayoutParams().height = thumbnailHeight;
}

// Title
titleView.setText(video.getTitle());
if (titleFontSize > 0) {
Expand Down
4 changes: 3 additions & 1 deletion Workoutathome/src/main/res/layout/video_row.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
<RelativeLayout
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:layout_margin="10dp"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
>

<TextView
Expand Down
1 change: 1 addition & 0 deletions Workoutathome/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="small_title">16sp</dimen>
<dimen name="small_subtitle">14sp</dimen>
<dimen name="featured_thumbnail_height">200dp</dimen>

</resources>

0 comments on commit 470495a

Please sign in to comment.