Merge "Use the linear layout for media control views instead of the list view" into mnc-ub-dev
diff --git a/v7/mediarouter/res/values/strings.xml b/v7/mediarouter/res/values/strings.xml
index 268715b..b989ad6 100644
--- a/v7/mediarouter/res/values/strings.xml
+++ b/v7/mediarouter/res/values/strings.xml
@@ -52,6 +52,9 @@
     <!-- Accessibility description for the group collapse button that hides group members of a selected group. [CHAR LIMIT=NONE] -->
     <string name="mr_controller_collapse_group">Group collapse</string>
 
+    <!-- Placeholder text to show when no media have been selected on the connected route. [CHAR LIMIT=50] -->
+    <string name="mr_controller_no_media_selected">No media selected</string>
+
     <!-- Placeholder text to show when no title/description have been found for a given song/video. [CHAR LIMIT=50] -->
     <string name="mr_controller_no_info_available">No info available</string>
 
diff --git a/v7/mediarouter/src/android/support/v7/app/MediaRouteControllerDialog.java b/v7/mediarouter/src/android/support/v7/app/MediaRouteControllerDialog.java
index ceedbf2..d78af8f 100644
--- a/v7/mediarouter/src/android/support/v7/app/MediaRouteControllerDialog.java
+++ b/v7/mediarouter/src/android/support/v7/app/MediaRouteControllerDialog.java
@@ -399,10 +399,10 @@
         int dialogWidth = getWindow().getAttributes().width - mDialogPaddingVertical;
         if (originalWidth >= originalHeight) {
             // For landscape art, fit width to dialog width.
-            return dialogWidth * originalHeight / originalWidth;
+            return (int) ((float) dialogWidth * originalHeight / originalWidth + 0.5f);
         }
         // For portrait art, fit height to 16:9 ratio case's height.
-        return dialogWidth * 9 / 16;
+        return (int) ((float) dialogWidth * 9 / 16 + 0.5f);
     }
 
     private final class MediaRouterCallback extends MediaRouter.Callback {
@@ -599,7 +599,10 @@
                         // The user is currently casting screen.
                         mTitleView.setText(R.string.mr_controller_casting_screen);
                     } else {
-                        mTitleView.setText(R.string.mr_controller_no_info_available);
+                        mTitleView.setText((mState == null
+                                || mState.getState() == PlaybackStateCompat.STATE_NONE)
+                                        ? R.string.mr_controller_no_media_selected
+                                        : R.string.mr_controller_no_info_available);
                     }
                     mTitleView.setEnabled(false);
                     mTitleView.setVisibility(View.VISIBLE);