Skip to content

Commit 3563aee

Browse files
authored
Merge pull request #73 from Hamza417/patch-1
Update IndexFastScrollRecyclerView.java
2 parents 1b69de2 + a605907 commit 3563aee

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

alphabetsindexfastscrollrecycler/src/main/java/in/myinnos/alphabetsindexfastscrollrecycler/IndexFastScrollRecyclerView.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,10 @@ public IndexFastScrollRecyclerView(Context context, AttributeSet attrs, int defS
6767

6868

6969
private void init(Context context, AttributeSet attrs) {
70-
mScroller = new IndexFastScrollRecyclerSection(context, this);
71-
70+
7271
if (attrs != null) {
73-
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.IndexFastScrollRecyclerView, 0, 0);
74-
75-
if (typedArray != null) {
72+
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.IndexFastScrollRecyclerView);
73+
7674
try {
7775
setIndexTextSize = typedArray.getInt(R.styleable.IndexFastScrollRecyclerView_setIndexTextSize, setIndexTextSize);
7876
mIndexbarWidth = typedArray.getFloat(R.styleable.IndexFastScrollRecyclerView_setIndexbarWidth, mIndexbarWidth);
@@ -130,7 +128,9 @@ private void init(Context context, AttributeSet attrs) {
130128
} finally {
131129
typedArray.recycle();
132130
}
133-
}
131+
132+
// This line here is neccesary else the attributes won't be updated if a value is passed from XML
133+
mScroller = new IndexFastScrollRecyclerSection(context, this);
134134
}
135135
}
136136

@@ -403,4 +403,4 @@ public void setIndexBarHighLightTextVisibility(boolean shown) {
403403
public void updateSections() {
404404
mScroller.updateSections();
405405
}
406-
}
406+
}

0 commit comments

Comments
 (0)