Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -256,22 +256,46 @@ private int getChildIndex(View view) {
}

private void setChildRadii(int newChildren, int newChild) {

// If same values are passed, just return. No need to update anything
if (children == newChildren && child == newChild)
return;

// Set the new values
children = newChildren;
child = newChild;


// is Left-To-Right language
final boolean isLTR;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) {
isLTR = (TextUtils.getLayoutDirectionFromLocale(getContext().getResources().getConfiguration().locale) == LAYOUT_DIRECTION_LTR);
}
else {
isLTR = true;
}
// if there is only one child provide the default radio button
if (children == 1) {
radii = rDefault;
} else if (child == 0) { //left or top
radii = (getOrientation() == LinearLayout.HORIZONTAL) ? rLeft : rTop;
if(getOrientation() == LinearLayout.HORIZONTAL) {
if(isLTR)
radii = rLeft;
else
radii = rRight;
}
else {
radii = rTop;
}
} else if (child == children - 1) { //right or bottom
radii = (getOrientation() == LinearLayout.HORIZONTAL) ? rRight : rBot;
if(getOrientation() == LinearLayout.HORIZONTAL) {
if(isLTR)
radii = rRight;
else
radii = rLeft;
}
else {
radii = rBot;
}
} else { //middle
radii = rMiddle;
}
Expand Down