-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove "Tap to Refresh" For Short List #63
base: master
Are you sure you want to change the base?
Conversation
I removed the "Tap to Refresh" functionality. Instead the Text View is removed from the view when not being used and shown again when needed. Also, fixed an issue where the lastMotionY was not being reset in resetHeader() which was causing the menu to be "jumpy" when swiping near the bottom.
Thank you very much 💃 |
When the list has few items, the pulltorefresh shows a little space. With this change the space is not being shown anymore.
Removed paddintTop and paddingBottom from relative layout. Thanks @angel9484!
Hi, |
@LaSprezz Can you please provide some code samples of what you are doing? I currently use this in a couple Production applications and have no issues. |
@DavidTPate Thanks for your quick feedback. My listView (@ style containing a background image) : <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/generic"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<com.markupartist.android.widget.PullToRefreshListView
android:id="@+id/listview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout> I then use another .xml to format each line of my list, but I don't think that matter. Then on my Activity (extends SherlockActivity) I just do : listview = (ListView) findViewById(R.id.listview);
// pull-to-refresh
((PullToRefreshListView) listview)
.setOnRefreshListener(new OnRefreshListener() {
@ Override
public void onRefresh() {
// Do work to refresh the list here.
new RefreshDataTask().execute();
}
}); Then I pass my datas through a custom adapter. Sorry if anything sounds dumb, I may have missed something somewhere... |
Well, welcome to GitHub! A couple notes, I'd definitely take a look at the "GitHub Flavored Markdown" to learn some of the tags and such. For example, using an accent (`) three times above and below code will create a code block, like so: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/generic"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<com.markupartist.android.widget.PullToRefreshListView
android:id="@+id/listview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout> listview = (ListView) findViewById(R.id.listview);
// pull-to-refresh
((PullToRefreshListView) listview)
.setOnRefreshListener(new OnRefreshListener() {
@ Override
public void onRefresh() {
// Do work to refresh the list here.
new RefreshDataTask().execute();
}
}); |
@LaSprezz From the looks of it what you are doing is correct and should work without issue. Does your list have at least one item in it? I would also suggest modifying your Java code slightly so you aren't having to cast once more to PullToRefreshListView, so it would like the following: listview = (PullToRefreshListView) findViewById(R.id.listview);
listview.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh() {
// Do work to refresh the list here.
new RefreshDataTask().execute();
}
}); Which version of the project are you using? Are you using the one from my branch or the main project? How many items does your list have? Can you post a screenshot of what you are seeing? |
@DavidTPate Thanks for the insights. I'll take notes and modify. I use the master branch and tried to substitute the 2 files that can be found on top on this discussion (your modifications, if my understanding's right). |
I would suggest grabbing all of the files from my branch https://github.com/DavidTPate/android-pulltorefresh-1 and giving it a quick try. |
@DavidTPate Sorry for the late feedback, I was working on the migration from ABS to ActionBarCompat. |
Glad to help! |
it works, thanks! |
Here's my fix to the "Tap to Refresh" removal. It's not using any of the odd adding of views to make it longer or anything like that, instead it simply manipulates the visibility of the header as needed and also includes a bug fix for scrolling where it was "jumpy".
This addresses #40, #24, #51, #59, and #61.