Details overview image now scales.

b/15394334

Change-Id: I1007b9bbcd9e6f649d2589654aebb879294dea27
diff --git a/v17/leanback/res/layout/lb_details_overview.xml b/v17/leanback/res/layout/lb_details_overview.xml
index 97d1490..f4e7443 100644
--- a/v17/leanback/res/layout/lb_details_overview.xml
+++ b/v17/leanback/res/layout/lb_details_overview.xml
@@ -21,27 +21,26 @@
     android:layout_height="wrap_content" >
 
     <!-- Background is applied to this inner layout -->
-    <RelativeLayout
+    <LinearLayout
         android:id="@+id/details_overview"
         android:layout_width="match_parent"
         android:layout_height="@dimen/lb_details_overview_height_large"
         android:layout_marginLeft="@dimen/lb_details_overview_margin_left"
         android:layout_marginRight="@dimen/lb_details_overview_margin_right"
         android:layout_marginBottom="@dimen/lb_details_overview_margin_bottom"
+        android:orientation="horizontal"
          >
 
         <ImageView
             android:id="@+id/details_overview_image"
             android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_alignParentLeft="true"
+            android:layout_height="match_parent"
             android:adjustViewBounds="true"
             />
 
         <LinearLayout
             android:layout_width="match_parent"
             android:layout_height="match_parent"
-            android:layout_toRightOf="@id/details_overview_image"
             android:layout_marginBottom="@dimen/lb_details_overview_description_margin_bottom"
             android:layout_marginTop="@dimen/lb_details_overview_description_margin_top"
             android:orientation="vertical" >
@@ -71,6 +70,6 @@
             lb:rowHeight="@dimen/lb_details_overview_actions_height" />
 
         </LinearLayout>
-    </RelativeLayout>
+    </LinearLayout>
 
 </FrameLayout>
diff --git a/v17/leanback/src/android/support/v17/leanback/widget/DetailsOverviewRowPresenter.java b/v17/leanback/src/android/support/v17/leanback/widget/DetailsOverviewRowPresenter.java
index f0a9483..5509075 100644
--- a/v17/leanback/src/android/support/v17/leanback/widget/DetailsOverviewRowPresenter.java
+++ b/v17/leanback/src/android/support/v17/leanback/widget/DetailsOverviewRowPresenter.java
@@ -215,22 +215,26 @@
             mDetailsPresenter.onCreateViewHolder(vh.mDetailsDescriptionFrame);
         vh.mDetailsDescriptionFrame.addView(vh.mDetailsDescriptionViewHolder.view);
 
-        initDetailsOverview(v.findViewById(R.id.details_overview));
+        initDetailsOverview(vh);
 
         return vh;
     }
 
-    private void initDetailsOverview(View view) {
+    private void initDetailsOverview(ViewHolder vh) {
         int resId = mIsStyleLarge ? R.dimen.lb_details_overview_height_large :
             R.dimen.lb_details_overview_height_small;
 
-        ViewGroup.LayoutParams lp = view.getLayoutParams();
-        lp.height = view.getResources().getDimensionPixelSize(resId);
-        view.setLayoutParams(lp);
+        View overview = vh.view.findViewById(R.id.details_overview);
+        ViewGroup.LayoutParams lp = overview.getLayoutParams();
+        lp.height = overview.getResources().getDimensionPixelSize(resId);
+        overview.setLayoutParams(lp);
 
-        view.setBackgroundColor(mBackgroundColorSet ?
-                mBackgroundColor : getDefaultBackgroundColor(view.getContext()));
+        overview.setBackgroundColor(mBackgroundColorSet ?
+                mBackgroundColor : getDefaultBackgroundColor(overview.getContext()));
 
+        // Max width to make a square
+        ImageView image = (ImageView) vh.view.findViewById(R.id.details_overview_image);
+        image.setMaxWidth(lp.height);
     }
 
     @Override