Wednesday, January 22, 2014

NetEase android client trigger pull to refresh


            
Netease client that slide into a new viewpager how to automatically trigger pull to refresh, rather than manually to trigger the drop-down. Now there is a demand to be made like that.
Reply:
When you slide into that new viewPager, this code can call the dropdown ListView refresh ah.
Reply:
cited a floor u010331848 reply:
when you slip into that new viewPager, this code can call the dropdown ListView refresh ah.


My demand is not that page with ListView, need a ScrollView, after I rewrite ScrollView, can pull down to refresh, and how each slide this interface, you can trigger the drop-down refresh animation
Reply:
https://github.com/chrisbanes/Android-PullToRefresh
Reply:
https://github.com/chrisbanes/Android-PullToRefresh have what you want
Reply:
references, 4th Floor freexiaoyu reply:
https://github.com/chrisbanes/Android-PullToRefresh have what you want


This to me, this can be achieved inside the listview I said that, but did not realize srollview
Reply:
I changed a little bit, can be used to add the following code
/ / Call
when entering the pagepublic void update ()
{

mScroller.startScroll (0, 0, 0, 120, 500);
mHeaderView.setState (XListViewHeader.STATE_REFRESHING);
invokeOnScrolling ();
setSelection (0);
invalidate ();
mEnablePullRefresh = false;
mPullRefreshing = true;
}
/ / Data request complete call
public void updateBack ()
{
mScroller.startScroll (0, 0, 0, -120, 500);
mHeaderView.setState (XListViewHeader.STATE_NORMAL);
invokeOnScrolling ();
setSelection (0);
invalidate ();
mEnablePullRefresh = true;
mPullRefreshing = false;
}
Can be tested, and you test to see, I use XListView, the three documents,
Reply:
/ / Here is my analog data requests
public void delayRefresh (final String id)
{

final Handler handler = new Handler ()
{

@ Override
public void handleMessage (Message msg)
{
testData (id);
mXListView.update ();
mXListView.mListViewListener.onRefresh ();
adaf ();
super.handleMessage (msg);
}

};
Timer timer = new Timer ();
TimerTask tt = new TimerTask ()
{

@ Override
public void run ()
{
Message msg = new Message ();
handler.sendMessage (msg);

}
};
timer.schedule (tt, 500);
}

private void adaf ()
{
final Handler handler = new Handler ()
{

@ Override
public void handleMessage (Message msg)
{
mXListView.updateBack ();
super.handleMessage (msg);
}

};
Timer timer = new Timer ();
TimerTask tt = new TimerTask ()
{

@ Override
public void run ()
{
Message msg = new Message ();
handler.sendMessage (msg);

}
};
timer.schedule (tt, 1500);
}

Reply:
I tried this code, but you do not see the drop-down refresh effect where there is no complete demo

No comments:

Post a Comment