forked from nhaarman/ListViewAnimations
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
729 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
example/src/main/java/com/haarman/listviewanimations/StickyListHeadersActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package com.haarman.listviewanimations; | ||
|
||
import android.app.Activity; | ||
import android.os.Bundle; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.TextView; | ||
|
||
import com.nhaarman.listviewanimations.ArrayAdapter; | ||
import com.nhaarman.listviewanimations.swinginadapters.prepared.AlphaInAnimationAdapter; | ||
import com.nhaarman.listviewanimations.util.StickyListHeadersAdapterDecorator; | ||
import com.nhaarman.listviewanimations.util.StickyListHeadersListViewWrapper; | ||
|
||
import se.emilsjolander.stickylistheaders.StickyListHeadersAdapter; | ||
import se.emilsjolander.stickylistheaders.StickyListHeadersListView; | ||
|
||
public class StickyListHeadersActivity extends Activity { | ||
|
||
private StickyListHeadersListView mListView; | ||
|
||
@Override | ||
protected void onCreate(final Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
mListView = new StickyListHeadersListView(this); | ||
setContentView(mListView); | ||
MyAdapter integers = new MyAdapter(); | ||
for (int i = 0; i < 100; i++) { | ||
integers.add(i); | ||
} | ||
|
||
AlphaInAnimationAdapter animationAdapter = new AlphaInAnimationAdapter(integers); | ||
StickyListHeadersAdapterDecorator stickyListHeadersAdapterDecorator = new StickyListHeadersAdapterDecorator(animationAdapter); | ||
stickyListHeadersAdapterDecorator.setListViewWrapper(new StickyListHeadersListViewWrapper(mListView)); | ||
mListView.setAdapter(stickyListHeadersAdapterDecorator); | ||
} | ||
|
||
|
||
private class MyAdapter extends ArrayAdapter<Integer> implements StickyListHeadersAdapter { | ||
|
||
@Override | ||
public View getHeaderView(final int i, final View view, final ViewGroup viewGroup) { | ||
TextView tv = new TextView(StickyListHeadersActivity.this); | ||
tv.setText("Header"); | ||
return tv; | ||
} | ||
|
||
@Override | ||
public long getHeaderId(final int i) { | ||
return i; | ||
} | ||
|
||
@Override | ||
public View getView(final int position, final View convertView, final ViewGroup parent) { | ||
TextView tv = new TextView(StickyListHeadersActivity.this); | ||
tv.setText("Position: " + position); | ||
return tv; | ||
} | ||
} | ||
} |
Oops, something went wrong.