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

Commit 40b48b6d authored by Andre Le's avatar Andre Le
Browse files

Remove media_route_control_frame in media_route_controller_dialog

This UI is never used in the code (always stay hidden with no support).
This is legacy code and can be removed.

Also remove some other unused functions and variables.

Test: manual, open Quick Settings, click on Cast tile and check dialog
Bug: 395947047
Flag: NONE clean up legacy code

Change-Id: I7f4e409a471ea552454972568b54e0016cf0a153
parent 0c328ec2
Loading
Loading
Loading
Loading
+3 −46
Original line number Original line Diff line number Diff line
@@ -32,7 +32,6 @@ import android.os.Bundle;
import android.util.TypedValue;
import android.util.TypedValue;
import android.view.KeyEvent;
import android.view.KeyEvent;
import android.view.View;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.LinearLayout;
import android.widget.SeekBar;
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 int[] mMediaRouteOnState = { R.attr.state_activated, R.attr.state_enabled };
    private Drawable mCurrentIconDrawable;
    private Drawable mCurrentIconDrawable;


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


    private View mControlView;
    private boolean mAttachedToWindow;
    private boolean mAttachedToWindow;


    public MediaRouteControllerDialog(Context context, int theme) {
    public MediaRouteControllerDialog(Context context, int theme) {
@@ -80,33 +77,6 @@ public class MediaRouteControllerDialog extends AlertDialog {
        mRoute = mRouter.getSelectedRoute();
        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
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    protected void onCreate(Bundle savedInstanceState) {
        setTitle(mRoute.getName());
        setTitle(mRoute.getName());
@@ -169,17 +139,7 @@ public class MediaRouteControllerDialog extends AlertDialog {
        });
        });


        mMediaRouteButtonDrawable = obtainMediaRouteButtonDrawable();
        mMediaRouteButtonDrawable = obtainMediaRouteButtonDrawable();
        if (update()) {
        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);
            }
        }
    }
    }


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


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


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


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


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


    private final class MediaRouterCallback extends MediaRouter.SimpleCallback {
    private final class MediaRouterCallback extends MediaRouter.SimpleCallback {
+0 −6
Original line number Original line Diff line number Diff line
@@ -41,11 +41,5 @@
                     android:layout_marginLeft="8dp"
                     android:layout_marginLeft="8dp"
                     android:layout_marginRight="8dp" />
                     android:layout_marginRight="8dp" />
        </LinearLayout>
        </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>
    </LinearLayout>
</ScrollView>
</ScrollView>
+0 −1
Original line number Original line Diff line number Diff line
@@ -1743,7 +1743,6 @@
  <java-symbol type="id" name="media_route_list" />
  <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_layout" />
  <java-symbol type="id" name="media_route_volume_slider" />
  <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_extended_settings_button" />
  <java-symbol type="id" name="media_route_progress_bar" />
  <java-symbol type="id" name="media_route_progress_bar" />
  <java-symbol type="string" name="media_route_chooser_title" />
  <java-symbol type="string" name="media_route_chooser_title" />