Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

- FIX. #6 Не работает стикер для первой секции

- Используется константа от родителя (-1)
  • Loading branch information...
commit d65b4536e03ca12cebf871150e40e60aba2fc0ea 1 parent 90655cf
nfirex authored
View
2  src/com/wagado/stickysection/StickySectionActivity.java
@@ -55,7 +55,7 @@ private SectionListAdapter createAdapter(BaseAdapter adapter) {
public Object detectSection(Object arg0, Object arg1) {
String title = null;
- if (count % portion == 0 && count > 0) {
+ if (count % portion == 0) {
title = "section for " + Integer.toString(count + 1) + "-" + Integer.toString(count +portion);
}
View
14 src/com/wagado/widget/StickySectionListView.java
@@ -30,8 +30,6 @@
import android.widget.ListView;
public class StickySectionListView extends ListView {
- public static final int NOT_VALUE = -1;
-
protected static final String TAG = "StickySectionListView";
private View mStickerSection;
@@ -64,9 +62,9 @@ public void setAdapter(ListAdapter adapter) {
if (adapter instanceof SectionListAdapter) {
mParent = (ViewGroup) getParent();
mLayoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
- mCurrentSection = 0;
+ mCurrentSection = INVALID_POSITION;
- createSticker(mCurrentSection);
+ createSticker(0);
setOnScrollListener(new StickyScrollListener());
} else {
@@ -122,7 +120,7 @@ public Parcelable onSaveInstanceState() {
* @param position - ������� ��������, ��� �������� ������ ������� ������
*/
protected int getSectionByPosition(int position) {
- int result = NOT_VALUE;
+ int result = INVALID_POSITION;
for (int i: ((SectionListAdapter) getAdapter()).getHeaders().keySet()) {
if (position < i) break;
@@ -141,7 +139,7 @@ protected void createSticker (int position) {
if (mCurrentSection != section) {
mCurrentSection = section;
- if (mCurrentSection == NOT_VALUE) {
+ if (mCurrentSection == INVALID_POSITION) {
mStickerSection = null;
} else {
mStickerSection = getAdapter().getView(mCurrentSection, mStickerSection, null);
@@ -168,7 +166,7 @@ protected void catchNextSection (int position) {
if (isNextSection) {
mNextSectionChild = delta;
} else {
- mNextSectionChild = NOT_VALUE;
+ mNextSectionChild = INVALID_POSITION;
}
}
@@ -176,7 +174,7 @@ protected void catchNextSection (int position) {
* ������ ������ "�������" �� ������� ������� StickySectionListView
*/
protected void calculateStickerMargin () {
- if (mNextSectionChild != NOT_VALUE) {
+ if (mNextSectionChild != INVALID_POSITION) {
final int top = getChildAt(mNextSectionChild).getTop();
final int height = mStickerSection.getHeight();
Please sign in to comment.
Something went wrong with that request. Please try again.