@@ -87,6 +87,7 @@ public abstract class MaterialScrollBar<T> extends RelativeLayout {
87
87
88
88
//Misc
89
89
private OnLayoutChangeListener indicatorLayoutListener ;
90
+ private Runnable onSetup ;
90
91
91
92
92
93
//CHAPTER I - INITIAL SETUP
@@ -102,6 +103,11 @@ public abstract class MaterialScrollBar<T> extends RelativeLayout {
102
103
103
104
setRightToLeft (Utils .isRightToLeft (context )); //Detects and applies the Right-To-Left status of the app
104
105
106
+ onSetup = new Runnable () {
107
+ @ Override
108
+ public void run () {}
109
+ };
110
+
105
111
generalSetup ();
106
112
}
107
113
@@ -120,6 +126,15 @@ public abstract class MaterialScrollBar<T> extends RelativeLayout {
120
126
addView (setUpHandle (context , a .getBoolean (R .styleable .MaterialScrollBar_msb_lightOnTouch , true ))); //Adds the handle
121
127
122
128
setRightToLeft (Utils .isRightToLeft (context )); //Detects and applies the Right-To-Left status of the app
129
+
130
+ onSetup = new Runnable () {
131
+ @ Override
132
+ public void run () {
133
+ implementPreferences ();
134
+ }
135
+ };
136
+
137
+ implementFlavourPreferences (a );
123
138
}
124
139
125
140
//Unpacks XML attributes and ensures that no mandatory attributes are missing, then applies them.
@@ -190,7 +205,6 @@ void implementPreferences(){
190
205
if (a .hasValue (R .styleable .MaterialScrollBar_msb_rightToLeft )){
191
206
setRightToLeft (a .getBoolean (R .styleable .MaterialScrollBar_msb_rightToLeft , false ));
192
207
}
193
- implementFlavourPreferences (a );
194
208
}
195
209
196
210
public T setRecyclerView (RecyclerView rv ){
@@ -227,7 +241,7 @@ private void generalSetup(){
227
241
228
242
checkCustomScrolling ();
229
243
230
- implementPreferences ();
244
+ onSetup . run ();
231
245
232
246
a .recycle ();
233
247
0 commit comments