Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TIMOB-5819: Android: Percentage-based views need to be re-drawn on device rotation #575

Merged
merged 3 commits into from
Oct 25, 2011
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import java.util.Comparator;
import java.util.TreeSet;

import org.appcelerator.titanium.TiActivity;
import org.appcelerator.titanium.TiApplication;
import org.appcelerator.titanium.TiC;
import org.appcelerator.titanium.TiDimension;
import org.appcelerator.titanium.util.Log;
Expand Down Expand Up @@ -334,9 +336,14 @@ protected void onLayout(boolean changed, int l, int t, int r, int b)
(TiCompositeLayout.LayoutParams) child.getLayoutParams();
if (child.getVisibility() != View.GONE) {
// Dimension is required from Measure. Positioning is determined here.
int childMeasuredWidth = child.getMeasuredWidth();
int childMeasuredHeight = child.getMeasuredHeight();

// Use the height and width from params if we can. When we switch orientation the child returns the
// value from the previous orientation instead of the current one
int childMeasuredWidth = params.optionWidth != null ? params.optionWidth.getAsPixels(this) : child
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this also account for width: "auto" ?

.getMeasuredWidth();
int childMeasuredHeight = params.optionHeight != null ? params.optionHeight.getAsPixels(this) : child
.getMeasuredHeight();

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the measure pass happening a second time as well when orientation gets fired? If not, that might the root of the problem..

if (isHorizontalArrangement()) {
if (i == 0) {
horizontalLayoutCurrentLeft = left;
Expand Down