Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6966b909 authored by Andre Le's avatar Andre Le Committed by Android (Google) Code Review
Browse files

Merge "Remove media_route_control_frame in media_route_controller_dialog" into main

parents 1c2633f9 40b48b6d
Loading
Loading
Loading
Loading
+3 −46
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@ import android.os.Bundle;
import android.util.TypedValue;
import android.view.KeyEvent;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.SeekBar;

@@ -64,12 +63,10 @@ public class MediaRouteControllerDialog extends AlertDialog {
    private int[] mMediaRouteOnState = { R.attr.state_activated, R.attr.state_enabled };
    private Drawable mCurrentIconDrawable;

    private boolean mVolumeControlEnabled = true;
    private LinearLayout mVolumeLayout;
    private SeekBar mVolumeSlider;
    private boolean mVolumeSliderTouched;

    private View mControlView;
    private boolean mAttachedToWindow;

    public MediaRouteControllerDialog(Context context, int theme) {
@@ -80,33 +77,6 @@ public class MediaRouteControllerDialog extends AlertDialog {
        mRoute = mRouter.getSelectedRoute();
    }

    /**
     * Gets the route that this dialog is controlling.
     */
    public MediaRouter.RouteInfo getRoute() {
        return mRoute;
    }

    /**
     * Provides the subclass an opportunity to create a view that will
     * be included within the body of the dialog to offer additional media controls
     * for the currently playing content.
     *
     * @param savedInstanceState The dialog's saved instance state.
     * @return The media control view, or null if none.
     */
    public View onCreateMediaControlView(Bundle savedInstanceState) {
        return null;
    }

    /**
     * Returns whether to enable the volume slider and volume control using the volume keys
     * when the route supports it.
     */
    public boolean isVolumeControlEnabled() {
        return mVolumeControlEnabled;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        setTitle(mRoute.getName());
@@ -169,17 +139,7 @@ public class MediaRouteControllerDialog extends AlertDialog {
        });

        mMediaRouteButtonDrawable = obtainMediaRouteButtonDrawable();
        if (update()) {
            mControlView = onCreateMediaControlView(savedInstanceState);
            FrameLayout controlFrame =
                    customView.findViewById(R.id.media_route_control_frame);
            if (mControlView != null) {
                controlFrame.addView(mControlView);
                controlFrame.setVisibility(View.VISIBLE);
            } else {
                controlFrame.setVisibility(View.GONE);
            }
        }
        update();
    }

    @Override
@@ -218,10 +178,9 @@ public class MediaRouteControllerDialog extends AlertDialog {
        return super.onKeyUp(keyCode, event);
    }

    private boolean update() {
    private void update() {
        if (!mRoute.isSelected() || mRoute.isDefault()) {
            dismiss();
            return false;
        }

        setTitle(mRoute.getName());
@@ -244,7 +203,6 @@ public class MediaRouteControllerDialog extends AlertDialog {
            }
            setIcon(icon);
        }
        return true;
    }

    private Drawable obtainMediaRouteButtonDrawable() {
@@ -287,8 +245,7 @@ public class MediaRouteControllerDialog extends AlertDialog {
    }

    private boolean isVolumeControlAvailable() {
        return mVolumeControlEnabled && mRoute.getVolumeHandling() ==
                MediaRouter.RouteInfo.PLAYBACK_VOLUME_VARIABLE;
        return mRoute.getVolumeHandling() == MediaRouter.RouteInfo.PLAYBACK_VOLUME_VARIABLE;
    }

    private final class MediaRouterCallback extends MediaRouter.SimpleCallback {
+0 −6
Original line number Diff line number Diff line
@@ -41,11 +41,5 @@
                     android:layout_marginLeft="8dp"
                     android:layout_marginRight="8dp" />
        </LinearLayout>

        <!-- Optional content view section. -->
        <FrameLayout android:id="@+id/media_route_control_frame"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:visibility="gone" />
    </LinearLayout>
</ScrollView>
+0 −1
Original line number Diff line number Diff line
@@ -1743,7 +1743,6 @@
  <java-symbol type="id" name="media_route_list" />
  <java-symbol type="id" name="media_route_volume_layout" />
  <java-symbol type="id" name="media_route_volume_slider" />
  <java-symbol type="id" name="media_route_control_frame" />
  <java-symbol type="id" name="media_route_extended_settings_button" />
  <java-symbol type="id" name="media_route_progress_bar" />
  <java-symbol type="string" name="media_route_chooser_title" />