woozzu / indexablelistview Goto Github PK
View Code? Open in Web Editor NEWiPhone like fast scroll ListView on Android
iPhone like fast scroll ListView on Android
I used You libs ,listView add headView ,but I cont get headView onclick .
I think In IndexScroller dispach headView fouce.
First of all, I'm not the guy who found this issue.
I'm the author of Android UI Patterns, an Android app collects all Android UI samples into 1 app ^^. You can download it here: https://market.android.com/details?id=com.groidify.uipatterns
Your IndexableListView was also included in this app (in homescreen > Listview > IndexableListView).
Hi!
I'm having trouble accessing My onclicklistrner when using your listview.
In fact, your ontouchlistener almost totally overide the onclick...
Could you please check and help us to fix it?
Thanks.
When the soft copy is expanded the index scroller seems to become conjusted, is there any way that I could hide the index scroller when the keyboard is expanded?
Hi woozzu,
I tried your code and it looks outstanding!
I'd really want to apply this in my final year project.
However, i need to put the listview in fragment.
Any idea of how to do that?
Thanks before!
I change adapter of listview, and a don't need IndexScroller on each.
How to disable or hide IndexScroller.
i've tired to setFastScrollEnabled, but only get NullPointerException
i tried to implement in gridview but it seems not working..i cant see indexer in right side. can you help me how to implement in gridview with base adapter..
I am using IndexableRecyclerView in my project : https://github.com/Ali-Rezaei/Contacts
I want to set Margin for my recyclerView at runtime :
@Override
public void onNestedPreScroll(CoordinatorLayout coordinatorLayout,
View child, View target, int dx, int dy,
int[] consumed, int type) {
View v = target.findViewById(R.id.recyclerView);
MarginLayoutParams params = (MarginLayoutParams) v.getLayoutParams();
if (dy > 0 && mScrollTrigger != DIRECTION_UP) {
mScrollTrigger = DIRECTION_UP;
restartAnimator(child, getTargetHideValue(coordinatorLayout, child));
params.setMargins(0,0,0,0);
} else if (dy < 0 && mScrollTrigger != DIRECTION_DOWN) {
mScrollTrigger = DIRECTION_DOWN;
restartAnimator(child, 0f);
params.setMargins(0,0,0, 150);
}
v.setLayoutParams(params);
}
This line params.setMargins(0,0,0, 150); (setting bottom margin) cause to disappear alphabet bar in my IndexableRecyclerView.
But when I set margin in xml : android:layout_marginBottom="48dp", it works as expected.
What could be the reason and how to fix it?
Hi,
Can you please let me guide how can i implement the indexer in such a way that numbers should be placed in the end instead of top?
not working for dynamic data in listview. as ur only calculating indexes which are available when ur setting the adapter.
The problem is that since my items are clickable, the click on the index doesn't work. The letters on the index are clickable only during list scrolling!
If i stop scrolling, when i click on letters (before the disappearing of the index) it triggers the click on the list items, instead of the click on the index letters.
I did changed extension of ContentAdapter to MyAdapter, that is a class that extends ArrayAdapter.
Here is my activity:
public class FindByname extends Activity {
private Database db = new Database(this);
private IndexableListView mListView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.indexable);
SQLiteDatabase dbR = db.getReadableDatabase();
ArrayList<User> list = new ArrayList<User>();
list = createFullList(dbR);
ContentAdapter adapter = new ContentAdapter(this, R.layout.user_list_row, list);
mListView = (IndexableListView) findViewById(R.id.listview);
mListView.setAdapter(adapter);
mListView.setFastScrollEnabled(true);
}
private ArrayList<User> createFullList(SQLiteDatabase rw) {
ArrayList<User> list = new ArrayList<User>();
Cursor result = rw.rawQuery("SELECT _id, title, phone, city, category FROM users ORDER BY title ASC", null);
while (result.moveToNext()) {
list.add(new User(result.getString(0), result.getString(1), result.getString(2), result.getString(3), result.getString(4)));
}
result.close();
return list;
}
private class ContentAdapter extends MyAdapter implements SectionIndexer {
private String mSections = "#ABCDEFGHIJKLMNOPQRSTUVWXYZ";
public ContentAdapter(Context context, int textViewResourceId, List<User> objects) {
super(context, textViewResourceId, objects);
}
@Override
public int getPositionForSection(int section) {
// If there is no item for current section, previous section will be selected
for (int i = section; i >= 0; i--) {
for (int j = 0; j < getCount(); j++) {
if (i == 0) {
// For numeric section
for (int k = 0; k <= 9; k++) {
if (StringMatcher.match(String.valueOf(getItem(j).getNome_user().charAt(0)), String.valueOf(k)))
return j;
}
} else {
if (StringMatcher.match(String.valueOf(getItem(j).getNome_user().charAt(0)), String.valueOf(mSections.charAt(i))))
return j;
}
}
}
return 0;
}
@Override
public int getSectionForPosition(int position) {
return 0;
}
@Override
public Object[] getSections() {
String[] sections = new String[mSections.length()];
for (int i = 0; i < mSections.length(); i++)
sections[i] = String.valueOf(mSections.charAt(i));
return sections;
}
}
}
And here is MyAdapter:
public class MyAdapter extends ArrayAdapter<User> {
private Context context;
private int layoutid;
private List<User> data;
public MyAdapter(Context context, int textViewResourceId, List<User> objects) {
super(context, textViewResourceId, objects);
this.context = context;
this.layoutid = textViewResourceId;
data = objects;
}
public int getCount() {
return data.size();
}
@Override
public User getItem(int position) {
return data.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
public View getView(final int position, View convertView, ViewGroup parent) {
View row = convertView;
UserHolder holder = null;
if (row == null) {
LayoutInflater inflater = ((Activity)context).getLayoutInflater();
row = inflater.inflate(layoutid, parent, false);
holder = new UserHolder();
holder.name = (TextView) row.findViewById(R.id.nameUser);
holder.city = (TextView) row.findViewById(R.id.cityUser);
holder.rating = (RatingBar) row.findViewById(R.id.ratingUser);
holder.distance = (TextView) row.findViewById(id.distanceKm);
holder.category = (TextView) row.findViewById(R.id.catUser);
row.setTag(holder);
} else {
holder = (UserHolder)row.getTag();
}
User user = data.get(position);
holder.name.setText(user.getNome_user());
holder.city.setText(user.getComune());
holder.rating.setRating(user.getVoto());
holder.distance.setText(user.getDistanza());
holder.category.setText(user.getCategory());
LayerDrawable stars = (LayerDrawable) holder.rating.getProgressDrawable();
stars.getDrawable(2).setColorFilter(Color.rgb(255, 215, 0), android.graphics.PorterDuff.Mode.SRC_ATOP);
row.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
User merc = getItem(position);
Intent intent = new Intent(context, ViewUser.class);
intent.putExtra("id", merc.getId());
context.startActivity(intent);
}
});
return row;
}
static class UserHolder {
TextView name;
TextView city;
RatingBar rating;
TextView distance;
TextView category;
}
}
What could be the problem?
Sorry for my english
Hello.
Thanks for your excellent library.
But when i am going to implement this to my Listview, i am getting nullpointerexception.
java.lang.NullPointerException
at android.view.GLES20Canvas.drawRoundRect(GLES20Canvas.java:1222)
at com.hagoole.handofgod.widget.IndexScroller.draw(IndexScroller.java:75)
at com.hagoole.handofgod.widget.IndexableListView.draw(IndexableListView.java:70)
at android.view.View.getDisplayList(View.java:13448)
at android.view.View.getDisplayList(View.java:13490)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3088)
at android.view.View.getDisplayList(View.java:13386)
at android.view.View.getDisplayList(View.java:13490)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3088)
at android.view.View.getDisplayList(View.java:13386)
at android.view.View.getDisplayList(View.java:13490)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3088)
at android.view.View.getDisplayList(View.java:13386)
at android.view.View.getDisplayList(View.java:13490)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3088)
at android.view.View.getDisplayList(View.java:13386)
at android.view.View.getDisplayList(View.java:13490)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3088)
at android.view.View.getDisplayList(View.java:13386)
at android.view.View.getDisplayList(View.java:13490)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3088)
at android.view.View.getDisplayList(View.java:13386)
at android.view.View.getDisplayList(View.java:13490)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3088)
at android.view.View.getDisplayList(View.java:13386)
at android.view.View.getDisplayList(View.java:13490)
at android.view.HardwareRenderer$GlRenderer.buildDisplayList(HardwareRenderer.java:1570)
at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:1449)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:2415)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2287)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1910)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1013)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5736)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
at android.view.Choreographer.doCallbacks(Choreographer.java:574)
at android.view.Choreographer.doFrame(Choreographer.java:544)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5068)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:608)
at dalvik.system.NativeStart.main(Native Method)
Anyone help me.
Thanks.
The Default scrollview and indexable scroll is not showing at same time in android 5.0.1 , though its working fine till 4.4.4.
I have set android:fadeScrollbars="false" even though its not working properly on Lollipop...
Hi,
Everything works well, Thanks for the library. But Once i used addHeaderView(View) and added a header to my list view, i cannot see the index on right side. Can u please help me on this?
Alphabet filter shrinks to search result (list view area) which looks awkward. Is there any option to hide the alphabet scroller while search?
Can you please provide the same indexer for Grid View as well ?
I would like to use this library but there is no license. Could you add one ? Thanks !
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.