Skip to content

Commit

Permalink
Merge pull request #4479 from hieupham007/timob-13870-3_1_X
Browse files Browse the repository at this point in the history
timob-13870: add weight factor into date picker layout.
  • Loading branch information
pingwang2011 committed Jul 24, 2013
2 parents 3bb836f + 45ccb6a commit bad846c
Showing 1 changed file with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.appcelerator.titanium.view.TiUIView;

import android.app.Activity;
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;

public class TiUIDateSpinner extends TiUIView
Expand Down Expand Up @@ -89,24 +90,28 @@ protected void onLayout(boolean changed, int left, int top, int right, int botto
}
};
layout.setOrientation(LinearLayout.HORIZONTAL);

if (proxy.hasProperty("dayBeforeMonth")) {
// TODO dayBeforeMonth = TiConvert.toBoolean(proxy.getProperties(), "dayBeforeMonth");
}

if (dayBeforeMonth) {
layout.addView(dayWheel);
layout.addView(monthWheel);
addViewToPicker(dayWheel, layout);
addViewToPicker(monthWheel, layout);
} else {
layout.addView(monthWheel);
layout.addView(dayWheel);
addViewToPicker(monthWheel, layout);
addViewToPicker(dayWheel, layout);
}

layout.addView(yearWheel);
addViewToPicker(yearWheel, layout);
setNativeView(layout);

}

private void addViewToPicker(WheelView v, LinearLayout layout) {
layout.addView(v, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, (float) .33));
}

@Override
public void processProperties(KrollDict d) {
super.processProperties(d);
Expand Down

0 comments on commit bad846c

Please sign in to comment.