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

Commit 42d87567 authored by Takayuki Hoshi's avatar Takayuki Hoshi Committed by Android (Google) Code Review
Browse files

Merge "Do not show volume expander when there is no touch feature"

parents 84c5c08e bb0ec555
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.annotation.SuppressLint;
import android.app.Dialog;
import android.app.KeyguardManager;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.graphics.Color;
@@ -559,7 +560,13 @@ public class VolumeDialog {
                : R.drawable.ic_volume_expand_animation;
        if (res == mExpandButtonRes) return;
        mExpandButtonRes = res;
        if (hasTouchFeature()) {
            mExpandButton.setImageResource(res);
        } else {
            // if there is no touch feature, show the volume ringer instead
            mExpandButton.setImageResource(R.drawable.ic_volume_ringer);
            mExpandButton.setBackgroundResource(0);  // remove gray background emphasis
        }
        mExpandButton.setContentDescription(mContext.getString(mExpanded ?
                R.string.accessibility_volume_collapse : R.string.accessibility_volume_expand));
    }
@@ -837,6 +844,11 @@ public class VolumeDialog {
        rescheduleTimeoutH();
    }

    private boolean hasTouchFeature() {
        final PackageManager pm = mContext.getPackageManager();
        return pm.hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN);
    }

    private final VolumeDialogController.Callbacks mControllerCallbackH
            = new VolumeDialogController.Callbacks() {
        @Override