Tweak initialization order of LinearLayout's dividers

In ag/969570 we've unified the treatment of divider logic
in LinearLayout. However, setDividerDrawable logic that was
calling setWillNotDraw added condition that the divider
position is not NONE. That made the initial flow effectively
not calling setWillNotDraw(false).

Changing the order to call setDividerDrawable() at the end
invokes the right logic.

Test:  adb shell am instrument -e class 'android.widget.cts.LinearLayoutTest'  -w 'android.widget.cts/android.support.test.runner.AndroidJUnitRunner'
Bug: 37698004
Change-Id: I8d95770b9f48277c402708fbc5279ba2ec56719f
This commit is contained in:
Kirill Grouchnikov
2017-04-26 17:45:28 -04:00
parent 1c661d1943
commit 3218a4e4f5

View File

@@ -235,9 +235,9 @@ public class LinearLayout extends ViewGroup {
mUseLargestChild = a.getBoolean(R.styleable.LinearLayout_measureWithLargestChild, false);
setDividerDrawable(a.getDrawable(R.styleable.LinearLayout_divider));
mShowDividers = a.getInt(R.styleable.LinearLayout_showDividers, SHOW_DIVIDER_NONE);
mDividerPadding = a.getDimensionPixelSize(R.styleable.LinearLayout_dividerPadding, 0);
setDividerDrawable(a.getDrawable(R.styleable.LinearLayout_divider));
final int version = context.getApplicationInfo().targetSdkVersion;
mAllowInconsistentMeasurement = version <= Build.VERSION_CODES.M;