time-duration-picker icon indicating copy to clipboard operation
time-duration-picker copied to clipboard

Size not properly calculated in onMeasure

Open javadude opened this issue 6 years ago • 0 comments

TimeDurationPicker.onMeasure doesn't properly set the size of the numPad.

// measure the numPad
// if we have more space available, we can try to grow the num pad
final int numPadWidth = Math.max(minNumPadHeight, displayRowWidth);
final int numPadHeight = Math.max(minNumPadHeight, preferredHeight - displayRowHeight);
numPad.measure(MeasureSpec.makeMeasureSpec(numPadWidth, MeasureSpec.EXACTLY), 
MeasureSpec.makeMeasureSpec(numPadHeight, MeasureSpec.EXACTLY));

For the numPadWidth, I think you want minNumPadWidth instead of minNumPadHeight.

However, using Math.max doesn't work properly on smaller screens. If the available screen height is smaller than the minNumPadHeight, the height you set will be too large (similar for width), and the keyboard gets cut of. For example:

LandscapeNoZeros

killing the zeroes.

I'd put in a pull request, but I don't know if this would kill the expected behavior from other users...

javadude avatar Oct 25 '19 18:10 javadude