@@ -14,16 +14,19 @@ class DeweyLayoutManager extends LinearLayoutManager {
1414 public DeweyLayoutManager (Context context , int uniformCellWidth ) {
1515 super (context );
1616 this .uniformCellWidth = uniformCellWidth ;
17+ updateUniformCellWidth ();
1718 }
1819
1920 public DeweyLayoutManager (Context context , int orientation , boolean reverseLayout , int uniformCellWidth ) {
2021 super (context , orientation , reverseLayout );
2122 this .uniformCellWidth = uniformCellWidth ;
23+ updateUniformCellWidth ();
2224 }
2325
2426 public DeweyLayoutManager (Context context , AttributeSet attrs , int defStyleAttr , int defStyleRes , int uniformCellWidth ) {
2527 super (context , attrs , defStyleAttr , defStyleRes );
2628 this .uniformCellWidth = uniformCellWidth ;
29+ updateUniformCellWidth ();
2730 }
2831
2932 @ Override
@@ -34,6 +37,8 @@ public void onMeasure ( RecyclerView.Recycler recycler, RecyclerView.State state
3437 }
3538
3639 super .onMeasure (recycler , state , widthSpec , heightSpec );
40+
41+ updateUniformCellWidth ();
3742 }
3843
3944 protected int measureFirstChildHeight (RecyclerView .Recycler recycler ) {
@@ -100,5 +105,6 @@ protected void updateUniformCellWidth() {
100105
101106 public void setUniformCellWidth (int uniformCellWidth ) {
102107 this .uniformCellWidth = uniformCellWidth ;
108+ updateUniformCellWidth ();
103109 }
104110}
0 commit comments