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

Commit a5b52c36 authored by Chiao Cheng's avatar Chiao Cheng
Browse files

Stop social update view from stealing focus.

ContactDetailFragmentCarousel was requesting focus to set the initial offset of
the HorizontalScrollView.  This was probably a hacky work around to get the
smoothScrollTo() method to work.

Instead of requesting focus, call scrollTo().  Before scrollTo() did not work
in the enableSwipe() method because HorizontalScrollView "clamp"s the offset
to the size of the width.  And the size of the width was calculated based on
mEnableSwipe flag in the onMeasure() method.  To fix it so scrollTo() works
within enableSwipe(), change the width calculation to also take into account
mCurrentPage which may be initialized to 1 instead of 0.

Old order
+ onMeasure() [mEnabledSwipe = false, width set for a single child]
+ enableSwipe() [mEnabledSwipe = true, width still set for a single child]
+ scrollTo() [page 1, fails because width set for a single child]

New logic
+ onMeasure() [mCurrentPage = 1, width set for 2 childs]
+ enableSwipe()
+ scrollTo() [page 1, suceeds]

Bug: 8157306
Change-Id: I3a693a0b3d43a68d251faea4b5805791f2316aaa
parent 9e4b7978
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment