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

Commit 9b06af9f authored by StevenHarperUK's avatar StevenHarperUK
Browse files

Bugfix : Expanded volume overlay

If you switch to the Expanded volume overlay
(Settings > Sound > Volume panel)
from any of the other settings that are not expanded
then the Expanded overlay appears collapsed.

The only way to make it appear expanded is to restart the framework
or
In the Expandable view - expand the volumes - then immediately change.

This patch fixes this and also has a slight improvement in the
case where a user selects the same choice they have already.

Change-Id: I9264ce62e239f497e0a2924c6769f066f196ebeb
parent d628aa06
Loading
Loading
Loading
Loading
+15 −7
Original line number Diff line number Diff line
@@ -101,7 +101,7 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie
    private boolean mRingIsSilent;
    private boolean mShowCombinedVolumes;
    private boolean mVoiceCapable;
    private int mCurrentOverlayStyle;
    private int mCurrentOverlayStyle = -1;

    /** Dialog containing all the sliders */
    private final Dialog mDialog;
@@ -250,16 +250,16 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie
        mVoiceCapable = context.getResources().getBoolean(R.bool.config_voice_capable);

        // get the users preference
        mCurrentOverlayStyle = Settings.System.getInt(context.getContentResolver(),Settings.System.MODE_VOLUME_OVERLAY, Settings.System.VOLUME_OVERLAY_SINGLE);
        int choosenStyle = Settings.System.getInt(context.getContentResolver(),Settings.System.MODE_VOLUME_OVERLAY, Settings.System.VOLUME_OVERLAY_SINGLE);
        // by default -1 is expected - deal with choosing the right default
        if (mCurrentOverlayStyle == -1) {
        if (choosenStyle == -1) {
            if (mVoiceCapable) {
                mCurrentOverlayStyle = Settings.System.VOLUME_OVERLAY_SINGLE;
                choosenStyle = Settings.System.VOLUME_OVERLAY_SINGLE;
            } else {
                mCurrentOverlayStyle = Settings.System.VOLUME_OVERLAY_EXPANDABLE;
                choosenStyle = Settings.System.VOLUME_OVERLAY_EXPANDABLE;
            }
        }
        changeOverlayStyle(mCurrentOverlayStyle);
        changeOverlayStyle(choosenStyle);
        mMoreButton.setOnClickListener(this);

        listenToRingerModeAndConfigChanges();
@@ -287,6 +287,8 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie

    private void changeOverlayStyle(int newStyle) {
        Log.i("VolumePanel", "changeOverlayStyle : " + newStyle);
        // Don't change to the same style
        if (newStyle == mCurrentOverlayStyle) return;
        switch (newStyle) {
            case Settings.System.VOLUME_OVERLAY_SINGLE :
                mMoreButton.setVisibility(View.GONE);
@@ -403,8 +405,10 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie
        final int count = mSliderGroup.getChildCount();

        for (int i = 0; i < count; i++) {
            if (mSliderGroup.getChildAt(i).getVisibility() != View.VISIBLE) {
                mSliderGroup.getChildAt(i).setVisibility(View.VISIBLE);
            }
        }
        mMoreButton.setVisibility(View.GONE);
        mDivider.setVisibility(View.GONE);
    }
@@ -585,6 +589,10 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie
            if (mShowCombinedVolumes && mCurrentOverlayStyle != Settings.System.VOLUME_OVERLAY_EXPANDED) {
                collapse();
            }
            // If just changed the style and we need to expand
            if (mCurrentOverlayStyle == Settings.System.VOLUME_OVERLAY_EXPANDED) {
                expand();
            }
            mDialog.show();
        }