本文整理汇总了Java中com.handmark.pulltorefresh.library.PullToRefreshListView.setOnLastItemVisibleListener方法的典型用法代码示例。如果您正苦于以下问题:Java PullToRefreshListView.setOnLastItemVisibleListener方法的具体用法?Java PullToRefreshListView.setOnLastItemVisibleListener怎么用?Java PullToRefreshListView.setOnLastItemVisibleListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.handmark.pulltorefresh.library.PullToRefreshListView
的用法示例。
在下文中一共展示了PullToRefreshListView.setOnLastItemVisibleListener方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initView
import com.handmark.pulltorefresh.library.PullToRefreshListView; //导入方法依赖的package包/类
public void initView(View rootView) {
rootView.findViewById(R.id.back).setVisibility(View.GONE);
tvTitle = (TextView) rootView.findViewById(R.id.title);
tvTitle.setText("资讯中心");
emptyView = rootView.findViewById(R.id.empty);
newsList = (PullToRefreshListView) rootView.findViewById(R.id.newslist);
newsList.setOnItemClickListener(this);
newsList.setMode(Mode.BOTH);
newsList.setScrollingWhileRefreshingEnabled(false);
newsList.setOnRefreshListener(this);
newsList.setOnLastItemVisibleListener(this);
newsList.setEmptyView(emptyView);
}
示例2: initViews
import com.handmark.pulltorefresh.library.PullToRefreshListView; //导入方法依赖的package包/类
protected void initViews(View view) {
mErrorLayout = (EmptyLayout) view.findViewById(R.id.error_layout);
mErrorLayout.setOnLayoutClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mCurrentPage = 0;
mState = STATE_REFRESH;
mErrorLayout.setErrorType(EmptyLayout.NETWORK_LOADING);
requestData(true);
}
});
mListView = (PullToRefreshListView) view.findViewById(R.id.listview);
mListView.setOnItemClickListener(this);
mListView.setOnRefreshListener(this);
mListView.setOnLastItemVisibleListener(this);
if (mAdapter != null) {
mListView.setAdapter(mAdapter);
mErrorLayout.setErrorType(EmptyLayout.HIDE_LAYOUT);
} else {
mAdapter = getListAdapter();
// mListView.setRefreshing();
mListView.setAdapter(mAdapter);
if (requestDataIfViewCreated()) {
mCurrentPage = 0;
mState = STATE_REFRESH;
mErrorLayout.setErrorType(EmptyLayout.NETWORK_LOADING);
requestData(false);
} else {
mErrorLayout.setErrorType(EmptyLayout.HIDE_LAYOUT);
}
}
if (mStoreEmptyState != -1) {
mErrorLayout.setErrorType(mStoreEmptyState);
}
}
示例3: initViews
import com.handmark.pulltorefresh.library.PullToRefreshListView; //导入方法依赖的package包/类
private void initViews(View view) {
mScrollLayout = (ScrollLayout) view.findViewById(R.id.scrolllayout);
mScrollLayout.setIsScroll(false);
mEmptyView = (EmptyLayout) view.findViewById(R.id.error_layout);
mLvCatalog = (ListView) view.findViewById(R.id.lv_catalog);
mLvCatalog.setOnItemClickListener(mCatalogOnItemClick);
mLvTag = (ListView) view.findViewById(R.id.lv_tag);
mLvTag.setOnItemClickListener(mTagOnItemClick);
mLvSoftware = (PullToRefreshListView) view
.findViewById(R.id.lv_software);
mLvSoftware.setOnRefreshListener(this);
mLvSoftware.setOnLastItemVisibleListener(this);
mLvSoftware.setOnItemClickListener(this);
if (mCatalogAdapter == null) {
mCatalogAdapter = new SoftwareCatalogAdapter();
sendRequestCatalogData(mCatalogHandler);
}
mLvCatalog.setAdapter(mCatalogAdapter);
if (mTagAdapter == null) {
mTagAdapter = new SoftwareCatalogAdapter();
}
mLvTag.setAdapter(mTagAdapter);
if (mSoftwareAdapter == null) {
mSoftwareAdapter = new SoftwareAdapter();
}
mLvSoftware.setAdapter(mSoftwareAdapter);
}
示例4: initList
import com.handmark.pulltorefresh.library.PullToRefreshListView; //导入方法依赖的package包/类
private void initList() {
mPtr = (PullToRefreshListView)findViewById(R.id.list);
mPtr.setOnRefreshListener(new OnRefreshListener<ListView>() {
@Override
public void onRefresh(PullToRefreshBase<ListView> refreshView) {
if(!isloading){
pageIndex = 1;
requestData(pageIndex,true);
}
}
});
mPtr.setOnLastItemVisibleListener(new OnLastItemVisibleListener() {
@Override
public void onLastItemVisible() {
if(hasNextPage){
if(!isloading){
requestData(++pageIndex,false);
}
} else{
mFootview.findViewById(R.id.list_footview_progress).setVisibility(View.GONE);
((TextView)mFootview.findViewById(R.id.list_footview_text)).setText(R.string.no_more);
}
}
});
mList = mPtr.getRefreshableView();
mLoadingBar = (ProgressBar) findViewById(R.id.loading);
mTimeOutText = (TextView) findViewById(R.id.time_out_text);
mTimeOutText.setText(R.string.time_out);
mTimeOutText.setOnClickListener(this);
mFootview = LayoutInflater.from(this).inflate(R.layout.list_footerview, mList, false);
mList.setVisibility(View.INVISIBLE);
mList.addFooterView(mFootview);
mFootview.setClickable(false);
mList.setFooterDividersEnabled(false);
mList.setOnItemClickListener(this);
mAdapter = new MentionsAdapter(this, contentList, data, commentIdList);
mList.setAdapter(mAdapter);
}
示例5: onCreate
import com.handmark.pulltorefresh.library.PullToRefreshListView; //导入方法依赖的package包/类
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_ptr_list);
mPullRefreshListView = (PullToRefreshListView) findViewById(R.id.pull_refresh_list);
// Set a listener to be invoked when the list should be refreshed.
mPullRefreshListView.setOnRefreshListener(new OnRefreshListener<ListView>() {
@Override
public void onRefresh(PullToRefreshBase<ListView> refreshView) {
String label = DateUtils.formatDateTime(getApplicationContext(), System.currentTimeMillis(),
DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_ABBREV_ALL);
// Update the LastUpdatedLabel
refreshView.getLoadingLayoutProxy().setLastUpdatedLabel(label);
// Do work to refresh the list here.
new GetDataTask().execute();
}
});
// Add an end-of-list listener
mPullRefreshListView.setOnLastItemVisibleListener(new OnLastItemVisibleListener() {
@Override
public void onLastItemVisible() {
Toast.makeText(PullToRefreshListActivity.this, "End of List!", Toast.LENGTH_SHORT).show();
}
});
ListView actualListView = mPullRefreshListView.getRefreshableView();
// Need to use the Actual ListView when registering for Context Menu
registerForContextMenu(actualListView);
mListItems = new LinkedList<String>();
mListItems.addAll(Arrays.asList(mStrings));
mAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mListItems);
/**
* Add Sound Event Listener
*/
SoundPullEventListener<ListView> soundListener = new SoundPullEventListener<ListView>(this);
soundListener.addSoundEvent(State.PULL_TO_REFRESH, R.raw.pull_event);
soundListener.addSoundEvent(State.RESET, R.raw.reset_sound);
soundListener.addSoundEvent(State.REFRESHING, R.raw.refreshing_sound);
mPullRefreshListView.setOnPullEventListener(soundListener);
// You can also just use setListAdapter(mAdapter) or
// mPullRefreshListView.setAdapter(mAdapter)
actualListView.setAdapter(mAdapter);
}
示例6: initList
import com.handmark.pulltorefresh.library.PullToRefreshListView; //导入方法依赖的package包/类
private void initList() {
mPtr = (PullToRefreshListView) findViewById(R.id.list);
mPtr.setOnRefreshListener(new OnRefreshListener<ListView>() {
@Override
public void onRefresh(PullToRefreshBase<ListView> refreshView) {
if(!isloading){
pageIndex = 1;
requestData(pageIndex, true);
}
}
});
mPtr.setOnLastItemVisibleListener(new OnLastItemVisibleListener() {
@Override
public void onLastItemVisible() {
if(hasNextPage){
if(!isloading){
requestData(++pageIndex,false);
}
} else{
mFootview.findViewById(R.id.list_footview_progress).setVisibility(View.GONE);
((TextView)mFootview.findViewById(R.id.list_footview_text)).setText(R.string.no_more);
}
}
});
mList = mPtr.getRefreshableView();
mLoadingBar = (ProgressBar) findViewById(R.id.time_progress);
mTimeOutText = (TextView) findViewById(R.id.time_out_text);
mTimeOutText.setOnClickListener(this);
mList.setHeaderDividersEnabled(false);
mFootview = LayoutInflater.from(this).inflate(R.layout.list_footerview, mList, false);
mList.setVisibility(View.INVISIBLE);
mList.addFooterView(mFootview);
mList.setFooterDividersEnabled(false);
mList.setOnItemClickListener(this);
mList.setOnItemLongClickListener(this);
mList.setOnTouchListener(new OnTouchListener() {
private int mMotionY;
public boolean onTouch(View v, MotionEvent event) {
if(isInputShow) return false;
int y = (int) event.getY();
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
mMotionY = y;
break;
case MotionEvent.ACTION_MOVE:
int delta = y - mMotionY;
if (Math.abs(delta) < 100)
break;
if (delta > 0) {
showBar();
} else {
hideBar();
}
mMotionY = y;
break;
}
return false;
}
});
mAdapter = new CommentsAdapter(this, data, commentIdList);
mList.setAdapter(mAdapter);
}
示例7: onCreateView
import com.handmark.pulltorefresh.library.PullToRefreshListView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
this.inflater = inflater;
View rootView = inflater.inflate(R.layout.fragment_main_dummy, container, false);
list = (PullToRefreshListView) rootView.findViewById(R.id.list);
timeOut = rootView.findViewById(R.id.time_out_text);
loadding = rootView.findViewById(R.id.loading);
footView = inflater.inflate(R.layout.list_footerview, list.getRefreshableView(),false);
list.getRefreshableView().addFooterView(footView, null, false);
loadingLayout = list.getLoadingLayoutProxy(true, false);
list.setOnRefreshListener(new OnRefreshListener<ListView>() {
@Override
public void onRefresh(PullToRefreshBase<ListView> refreshView) {
// Do work to refresh the list here.
if(BuildConfig.DEBUG)
Log.d(TAG, String.format("[%d] on refresh ",section));
isLoading = true;
String label = DateUtils.formatDateTime(getActivity() != null ? getActivity() : AcApp.context(),
System.currentTimeMillis(),
DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_ABBREV_ALL);
loadingLayout.setLastUpdatedLabel(label);
loadData(true,false);
}
});
list.setOnLastItemVisibleListener(new OnLastItemVisibleListener() {
@Override
public void onLastItemVisible() {
if(!isLoading){
if(hasNextPage()){
if(BuildConfig.DEBUG)
Log.d(TAG, String.format("[%d] 加载下一页, mode=%d",section,listMode));
loadData(false,false);
}else{
timeOut.setVisibility(View.GONE);
TextView text = (TextView) footView.findViewById(R.id.list_footview_text);
text.setText(R.string.no_more);
footView.findViewById(R.id.list_footview_progress).setVisibility(View.GONE);
footView.setOnClickListener(null);
}
}
}
});
list.setOnItemClickListener(this);
return rootView;
}
示例8: onCreate
import com.handmark.pulltorefresh.library.PullToRefreshListView; //导入方法依赖的package包/类
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_ptr_list);
mPullRefreshListView = (PullToRefreshListView) findViewById(R.id.pull_refresh_list);
// Set a listener to be invoked when the list should be refreshed.
mPullRefreshListView
.setOnRefreshListener(new OnRefreshListener<ListView>() {
@Override
public void onRefresh(
PullToRefreshBase<ListView> refreshView) {
String label = DateUtils.formatDateTime(
getApplicationContext(),
System.currentTimeMillis(),
DateUtils.FORMAT_SHOW_TIME
| DateUtils.FORMAT_SHOW_DATE
| DateUtils.FORMAT_ABBREV_ALL);
// Update the LastUpdatedLabel
refreshView.getLoadingLayoutProxy()
.setLastUpdatedLabel(label);
// Do work to refresh the list here.
new GetDataTask().execute();
}
});
// Add an end-of-list listener
mPullRefreshListView
.setOnLastItemVisibleListener(new OnLastItemVisibleListener() {
@Override
public void onLastItemVisible() {
Toast.makeText(MainActivity.this, "End of List!",
Toast.LENGTH_SHORT).show();
}
});
ListView actualListView = mPullRefreshListView.getRefreshableView();
// Need to use the Actual ListView when registering for Context Menu
registerForContextMenu(actualListView);
mListItems = new LinkedList<String>();
mListItems.addAll(Arrays.asList(mStrings));
mAdapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, mListItems);
// You can also just use setListAdapter(mAdapter) or
// mPullRefreshListView.setAdapter(mAdapter)
actualListView.setAdapter(mAdapter);
}
示例9: onCreate
import com.handmark.pulltorefresh.library.PullToRefreshListView; //导入方法依赖的package包/类
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_ptr_list);
mPullRefreshListView = (PullToRefreshListView) findViewById(R.id.pull_refresh_list);
// Set a listener to be invoked when the list should be refreshed.
mPullRefreshListView.setOnRefreshListener(new OnRefreshListener<ListView>() {
// ひっぱりきって指をはなしたとき?
@Override
public void onRefresh(PullToRefreshBase<ListView> refreshView) {
String label = DateUtils.formatDateTime(getApplicationContext(),
System.currentTimeMillis(),
DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE
| DateUtils.FORMAT_ABBREV_ALL);
// Update the LastUpdatedLabel
refreshView.getLoadingLayoutProxy().setLastUpdatedLabel(label);
// Do work to refresh the list here.
new GetDataTask().execute();
}
});
/**
* customize
*/
mPullRefreshListView.setMode(Mode.BOTH);
// LoadingLayoutに関してカスタマイズ(主に文言)
ILoadingLayout iLoadingLayout = mPullRefreshListView.getLoadingLayoutProxy(true, true);
iLoadingLayout.setLastUpdatedLabel("");
iLoadingLayout.setReleaseLabel("離してください、更新します");
iLoadingLayout.setPullLabel("さらに下に引いて下さい");
iLoadingLayout.setRefreshingLabel("更新中です");
// Add an end-of-list listener
mPullRefreshListView.setOnLastItemVisibleListener(new OnLastItemVisibleListener() {
@Override
public void onLastItemVisible() {
Toast.makeText(PullToRefreshCustomActivity.this, "End of List!", Toast.LENGTH_SHORT)
.show();
}
});
/**
* リスト表示
*/
mIemsList = new LinkedList<String>();
mIemsList.addAll(Arrays.asList(INITIAL_LIST));
mAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mIemsList);
ListView actualListView = mPullRefreshListView.getRefreshableView();
actualListView.setAdapter(mAdapter);
}