Correct the position of the marker for audio adjustment.

Root cause: Miss one the layout padding condition for computing the position of the marker.
Solution: add the layout padding condition into.

Bug: 196980036
Test: make RunSettingsRoboTests ROBOTEST_FILTER=BalanceSeekBarTest ROBOTEST_FILTER=BalanceSeekBarPreferenceTest
Change-Id: Id0c6ebbc981d9ef41e7956ffff1fc5b9d4c0e787
This commit is contained in:
Peter_Liang
2021-08-18 16:16:19 +08:00
committed by PETER LIANG
parent e9f836a004
commit ba297dc396

View File

@@ -17,6 +17,7 @@
package com.android.settings.accessibility;
import static android.view.HapticFeedbackConstants.CLOCK_TICK;
import static com.android.settings.Utils.isNightMode;
import android.content.Context;
@@ -154,7 +155,7 @@ public class BalanceSeekBar extends SeekBar {
// Draw a vertical line at 50% that represents centred balance
int seekBarCenter = (canvas.getHeight() - getPaddingBottom()) / 2;
canvas.save();
canvas.translate((canvas.getWidth() - mCenterMarkerRect.right) / 2,
canvas.translate((canvas.getWidth() - mCenterMarkerRect.right - getPaddingEnd()) / 2,
seekBarCenter - (mCenterMarkerRect.bottom / 2));
canvas.drawRect(mCenterMarkerRect, mCenterMarkerPaint);
canvas.restore();