Loading core/java/android/app/MediaRouteButton.java +33 −18 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.content.Context; import android.content.ContextWrapper; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.drawable.AnimationDrawable; import android.graphics.drawable.Drawable; import android.media.MediaRouter; import android.media.MediaRouter.RouteGroup; Loading Loading @@ -339,11 +340,9 @@ public class MediaRouteButton extends View { } private void refreshRoute() { if (mAttachedToWindow) { final MediaRouter.RouteInfo route = mRouter.getSelectedRoute(); final boolean isRemote = !route.isDefault() && route.matchesTypes(mRouteTypes); final boolean isConnecting = isRemote && route.isConnecting(); boolean needsRefresh = false; if (mRemoteActive != isRemote) { mRemoteActive = isRemote; Loading @@ -357,10 +356,26 @@ public class MediaRouteButton extends View { if (needsRefresh) { refreshDrawableState(); } if (mAttachedToWindow) { setEnabled(mRouter.isRouteAvailable(mRouteTypes, MediaRouter.AVAILABILITY_FLAG_IGNORE_DEFAULT_ROUTE)); } if (mRemoteIndicator != null && mRemoteIndicator.getCurrent() instanceof AnimationDrawable) { AnimationDrawable curDrawable = (AnimationDrawable) mRemoteIndicator.getCurrent(); if (mAttachedToWindow) { if ((needsRefresh || isConnecting) && !curDrawable.isRunning()) { curDrawable.start(); } } else if (isRemote && !isConnecting) { // When the route is already connected before the view is attached, show the last // frame of the connected animation immediately. if (curDrawable.isRunning()) { curDrawable.stop(); } curDrawable.selectDrawable(curDrawable.getNumberOfFrames() - 1); } } } private final class MediaRouterCallback extends MediaRouter.SimpleCallback { Loading core/java/com/android/internal/app/MediaRouteControllerDialog.java +11 −1 Original line number Diff line number Diff line Loading @@ -72,6 +72,7 @@ public class MediaRouteControllerDialog extends AlertDialog { private boolean mVolumeSliderTouched; private View mControlView; private boolean mAttachedToWindow; public MediaRouteControllerDialog(Context context, int theme) { super(context, theme); Loading Loading @@ -211,6 +212,7 @@ public class MediaRouteControllerDialog extends AlertDialog { @Override public void onAttachedToWindow() { super.onAttachedToWindow(); mAttachedToWindow = true; mRouter.addCallback(0, mCallback, MediaRouter.CALLBACK_FLAG_UNFILTERED_EVENTS); update(); Loading @@ -219,6 +221,7 @@ public class MediaRouteControllerDialog extends AlertDialog { @Override public void onDetachedFromWindow() { mRouter.removeCallback(mCallback); mAttachedToWindow = false; super.onDetachedFromWindow(); } Loading Loading @@ -256,7 +259,14 @@ public class MediaRouteControllerDialog extends AlertDialog { mCurrentIconDrawable = icon; if (icon instanceof AnimationDrawable) { AnimationDrawable animDrawable = (AnimationDrawable) icon; if (!animDrawable.isRunning()) { if (!mAttachedToWindow && !mRoute.isConnecting()) { // When the route is already connected before the view is attached, show the // last frame of the connected animation immediately. if (animDrawable.isRunning()) { animDrawable.stop(); } icon = animDrawable.getFrame(animDrawable.getNumberOfFrames() - 1); } else if (!animDrawable.isRunning()) { animDrawable.start(); } } Loading core/res/res/drawable-hdpi/ic_media_route_connected_dark_00_mtrl.png 0 → 100644 +1.33 KiB Loading image diff... core/res/res/drawable-hdpi/ic_media_route_connected_dark_01_mtrl.png 0 → 100644 +1.34 KiB Loading image diff... core/res/res/drawable-hdpi/ic_media_route_connected_dark_02_mtrl.png 0 → 100644 +1.33 KiB Loading image diff... Loading
core/java/android/app/MediaRouteButton.java +33 −18 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.content.Context; import android.content.ContextWrapper; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.drawable.AnimationDrawable; import android.graphics.drawable.Drawable; import android.media.MediaRouter; import android.media.MediaRouter.RouteGroup; Loading Loading @@ -339,11 +340,9 @@ public class MediaRouteButton extends View { } private void refreshRoute() { if (mAttachedToWindow) { final MediaRouter.RouteInfo route = mRouter.getSelectedRoute(); final boolean isRemote = !route.isDefault() && route.matchesTypes(mRouteTypes); final boolean isConnecting = isRemote && route.isConnecting(); boolean needsRefresh = false; if (mRemoteActive != isRemote) { mRemoteActive = isRemote; Loading @@ -357,10 +356,26 @@ public class MediaRouteButton extends View { if (needsRefresh) { refreshDrawableState(); } if (mAttachedToWindow) { setEnabled(mRouter.isRouteAvailable(mRouteTypes, MediaRouter.AVAILABILITY_FLAG_IGNORE_DEFAULT_ROUTE)); } if (mRemoteIndicator != null && mRemoteIndicator.getCurrent() instanceof AnimationDrawable) { AnimationDrawable curDrawable = (AnimationDrawable) mRemoteIndicator.getCurrent(); if (mAttachedToWindow) { if ((needsRefresh || isConnecting) && !curDrawable.isRunning()) { curDrawable.start(); } } else if (isRemote && !isConnecting) { // When the route is already connected before the view is attached, show the last // frame of the connected animation immediately. if (curDrawable.isRunning()) { curDrawable.stop(); } curDrawable.selectDrawable(curDrawable.getNumberOfFrames() - 1); } } } private final class MediaRouterCallback extends MediaRouter.SimpleCallback { Loading
core/java/com/android/internal/app/MediaRouteControllerDialog.java +11 −1 Original line number Diff line number Diff line Loading @@ -72,6 +72,7 @@ public class MediaRouteControllerDialog extends AlertDialog { private boolean mVolumeSliderTouched; private View mControlView; private boolean mAttachedToWindow; public MediaRouteControllerDialog(Context context, int theme) { super(context, theme); Loading Loading @@ -211,6 +212,7 @@ public class MediaRouteControllerDialog extends AlertDialog { @Override public void onAttachedToWindow() { super.onAttachedToWindow(); mAttachedToWindow = true; mRouter.addCallback(0, mCallback, MediaRouter.CALLBACK_FLAG_UNFILTERED_EVENTS); update(); Loading @@ -219,6 +221,7 @@ public class MediaRouteControllerDialog extends AlertDialog { @Override public void onDetachedFromWindow() { mRouter.removeCallback(mCallback); mAttachedToWindow = false; super.onDetachedFromWindow(); } Loading Loading @@ -256,7 +259,14 @@ public class MediaRouteControllerDialog extends AlertDialog { mCurrentIconDrawable = icon; if (icon instanceof AnimationDrawable) { AnimationDrawable animDrawable = (AnimationDrawable) icon; if (!animDrawable.isRunning()) { if (!mAttachedToWindow && !mRoute.isConnecting()) { // When the route is already connected before the view is attached, show the // last frame of the connected animation immediately. if (animDrawable.isRunning()) { animDrawable.stop(); } icon = animDrawable.getFrame(animDrawable.getNumberOfFrames() - 1); } else if (!animDrawable.isRunning()) { animDrawable.start(); } } Loading
core/res/res/drawable-hdpi/ic_media_route_connected_dark_00_mtrl.png 0 → 100644 +1.33 KiB Loading image diff...
core/res/res/drawable-hdpi/ic_media_route_connected_dark_01_mtrl.png 0 → 100644 +1.34 KiB Loading image diff...
core/res/res/drawable-hdpi/ic_media_route_connected_dark_02_mtrl.png 0 → 100644 +1.33 KiB Loading image diff...