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

Commit bad60788 authored by Behnam Heydarshahi's avatar Behnam Heydarshahi
Browse files

Bugfix: dnd icon overlapping media volume icon

Instead of having a separate dnd icon on volume slider, the volume icon
now changes into dnd when dnd mode switches on.

Flag: NONE
Bug: b/244441820
Test: atest VolumeDialogImplTest
Change-Id: Idda50a1041438d94a73a41a249feb302eaa26857
parent dc3b2bd4
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -79,7 +79,4 @@
            android:tint="@color/accent_tint_color_selector"
            android:soundEffectsEnabled="false" />
    </LinearLayout>

    <include layout="@layout/volume_dnd_icon"/>

</FrameLayout>
+0 −6
Original line number Diff line number Diff line
@@ -70,12 +70,6 @@
                    android:tint="?android:attr/textColorPrimary"
                    android:layout_gravity="center"
                    android:soundEffectsEnabled="false" />

                <include layout="@layout/volume_dnd_icon"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginRight="@dimen/volume_dialog_stream_padding"
                    android:layout_marginTop="6dp"/>
            </FrameLayout>

            <LinearLayout
+0 −6
Original line number Diff line number Diff line
@@ -69,12 +69,6 @@
                    android:tint="?android:attr/textColorPrimary"
                    android:layout_gravity="center"
                    android:soundEffectsEnabled="false" />

                <include layout="@layout/volume_dnd_icon"
                         android:layout_width="match_parent"
                         android:layout_height="wrap_content"
                         android:layout_marginRight="@dimen/volume_dialog_stream_padding"
                         android:layout_marginTop="6dp"/>
            </FrameLayout>

            <LinearLayout
+0 −1
Original line number Diff line number Diff line
@@ -62,7 +62,6 @@
                android:background="@null"
                android:layoutDirection="ltr"
                android:rotation="270" />
            <include layout="@layout/volume_dnd_icon"/>
        </FrameLayout>

        <com.android.keyguard.AlphaOptimizedImageButton
+5 −23
Original line number Diff line number Diff line
@@ -99,7 +99,6 @@ import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.animation.DecelerateInterpolator;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
@@ -256,7 +255,6 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
    private CaptionsToggleImageButton mODICaptionsIcon;
    private View mSettingsView;
    private ImageButton mSettingsIcon;
    private FrameLayout mZenIcon;
    private final List<VolumeRow> mRows = new ArrayList<>();
    private ConfigurableTexts mConfigurableTexts;
    private final SparseBooleanArray mDynamic = new SparseBooleanArray();
@@ -633,7 +631,6 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
        mRinger = mDialog.findViewById(R.id.ringer);
        if (mRinger != null) {
            mRingerIcon = mRinger.findViewById(R.id.ringer_icon);
            mZenIcon = mRinger.findViewById(R.id.dnd_icon);
        }

        mSelectedRingerIcon = mDialog.findViewById(R.id.volume_new_ringer_active_icon);
@@ -847,7 +844,6 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
        if (stream == STREAM_ACCESSIBILITY) {
            row.header.setFilters(new InputFilter[] {new InputFilter.LengthFilter(13)});
        }
        row.dndIcon = row.view.findViewById(R.id.dnd_icon);
        row.slider = row.view.findViewById(R.id.volume_row_slider);
        row.slider.setOnSeekBarChangeListener(new VolumeSeekBarChangeListener(row));
        row.number = row.view.findViewById(R.id.volume_number);
@@ -1790,28 +1786,14 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
        }
    }

    /**
     * Toggles enable state of views in a VolumeRow (not including seekbar or icon)
     * Hides/shows zen icon
     * @param enable whether to enable volume row views and hide dnd icon
     */
    private void enableVolumeRowViewsH(VolumeRow row, boolean enable) {
        boolean showDndIcon = !enable;
        row.dndIcon.setVisibility(showDndIcon ? VISIBLE : GONE);
    }

    /**
     * Toggles enable state of footer/ringer views
     * Hides/shows zen icon
     * @param enable whether to enable ringer views and hide dnd icon
     * @param enable whether to enable ringer views
     */
    private void enableRingerViewsH(boolean enable) {
        if (mRingerIcon != null) {
            mRingerIcon.setEnabled(enable);
        }
        if (mZenIcon != null) {
            mZenIcon.setVisibility(enable ? GONE : VISIBLE);
        }
    }

    private void trimObsoleteH() {
@@ -1937,9 +1919,11 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
        // update icon
        final boolean iconEnabled = (mAutomute || ss.muteSupported) && !zenMuted;
        final int iconRes;
        if (isRingVibrate) {
        if (zenMuted) {
            iconRes = com.android.internal.R.drawable.ic_qs_dnd;
        } else if (isRingVibrate) {
            iconRes = R.drawable.ic_volume_ringer_vibrate;
        } else if (isRingSilent || zenMuted) {
        } else if (isRingSilent) {
            iconRes = row.iconMuteRes;
        } else if (ss.routedToBluetooth) {
            if (isVoiceCallStream) {
@@ -2011,7 +1995,6 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
        if (zenMuted) {
            row.tracking = false;
        }
        enableVolumeRowViewsH(row, !zenMuted);

        // update slider
        final boolean enableSlider = !zenMuted;
@@ -2582,7 +2565,6 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
        private ObjectAnimator anim;  // slider progress animation for non-touch-related updates
        private int animTargetProgress;
        private int lastAudibleLevel = 1;
        private FrameLayout dndIcon;

        void setIcon(int iconRes, Resources.Theme theme) {
            if (icon != null) {
Loading