本文整理汇总了Java中android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener类的典型用法代码示例。如果您正苦于以下问题:Java OnRefreshListener类的具体用法?Java OnRefreshListener怎么用?Java OnRefreshListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OnRefreshListener类属于android.support.v4.widget.SwipeRefreshLayout包,在下文中一共展示了OnRefreshListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDefaultRefreshLisn
import android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener; //导入依赖的package包/类
private OnRefreshListener getDefaultRefreshLisn() {
return () -> {
if (DeviceUtil.isNetworkDisable()) {
hideSwipeRefresh();
showToast(R.string.toast_common_no_network);
} else {
mSortIndex = mPageIndex;
mPageIndex = PAGE_START_INDEX;
stopLoadMore();
startRefresh();
}
};
}
示例2: getRefreshLisn
import android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener; //导入依赖的package包/类
private OnRefreshListener getRefreshLisn() {
return () -> {
if (DeviceUtil.isNetworkDisable()) {
getBaseView().hideSwipeRefresh();
getBaseView().showToast(R.string.toast_common_no_network);
} else {
mSortIndex = mPageIndex;
setPageIndex(PAGE_START_INDEX);
getBaseView().setRefreshMode(SWIPE);
launch(getObjectRequest(getParams()), REFRESH_ONLY);// refresh only, don't cache
}
};
}
示例3: setRefreshLayoutListener
import android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener; //导入依赖的package包/类
protected void setRefreshLayoutListener() {
swipeRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh() {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
if (!isRoaming) {
loadMoreLocalMessage();
} else {
loadMoreRoamingMessages();
}
}
}, 600);
}
});
}
示例4: getDefaultRefreshLisn
import android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener; //导入依赖的package包/类
private OnRefreshListener getDefaultRefreshLisn() {
return () -> {
if (DeviceUtil.isNetworkDisable()) {
hideSwipeRefresh();
showToast(R.string.toast_common_no_network);
} else {
mSortIndex = mPageIndex;
setRefreshMode(RefreshMode.SWIPE);
setPageIndex(PAGE_START_INDEX);
execute(RequestMode.REFRESH_ONLY);// refresh only, don't cache
}
};
}
示例5: initWidgets
import android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener; //导入依赖的package包/类
@Override
protected void initWidgets() {
mRefreshLayout = findViewById(ResFinder.getId("umeng_comm_swipe_layout"));
mRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh() {
mPresenter.loadDataFromServer();
}
});
mRefreshLayout.setOnLoadListener(new OnLoadListener() {
@Override
public void onLoad() {
mPresenter.loadMoreData();
}
});
// 添加footer
mRefreshLayout.setDefaultFooterView();
mListView = findViewById(ResFinder.getId("umeng_comm_notify_listview"));
mAdapter = new NotifyAdapter(getActivity());
mListView.setAdapter(mAdapter);
}
示例6: setListeners
import android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener; //导入依赖的package包/类
protected void setListeners() {
refreshButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
initPage();
}
});
swipeLayout.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh() {
initPage();
swipeLayout.setRefreshing(false);
}
});
listView.setOnScrollListener(this);
}
示例7: init
import android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener; //导入依赖的package包/类
private void init() {
// TODO Auto-generated method stub
listView = (ListView) findViewById(R.id.lv_deviceList);
listView.setEmptyView(findViewById(R.id.pb_empty));
swagLayout = (SwipeRefreshLayout) findViewById(R.id.swagLayout);
swagLayout.setVisibility(View.VISIBLE);
swagLayout.setOnRefreshListener(new OnRefreshListener() {
@SuppressWarnings("deprecation")
@SuppressLint("NewApi")
@Override
public void onRefresh() {
// TODO Auto-generated method stub
mBleDeviceListAdapter.clear();
mBluetoothAdapter.startLeScan(mLeScanCallback);
swagLayout.setRefreshing(false);
}
});
mBleDeviceListAdapter = new BleDeviceListAdapter(this);
listView.setAdapter(mBleDeviceListAdapter);
setListItemListener();
}
示例8: initView
import android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener; //导入依赖的package包/类
private void initView() {
pubBtn = (FloatingActionButton) mView.findViewById(R.id.find_list_floatButton);
recyclerView = (RecyclerView) mView.findViewById(R.id.find_list_recyclerView);
swipeRefreshLayout = (SwipeRefreshLayout) mView.findViewById(R.id.find_list_swipeRefreshLayout);
init();
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity());
recyclerView.setLayoutManager(linearLayoutManager);
recyclerView.setItemAnimator(new DefaultItemAnimator());
loadData();
swipeRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh() {
}
});
pubBtn.setColor(getResources().getColor(R.color.statusbar_bg));
pubBtn.setOnClickListener(this);
recyclerView.setOnTouchListener(new ShowHideOnScroll(pubBtn));
}
示例9: initPull2Load
import android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener; //导入依赖的package包/类
/**
* Make the refresh-tool: pull-to-reload.
*/
private void initPull2Load() {
mBinding.contentSrl.setColorSchemeResources(R.color.green_1, R.color.green_2, R.color.green_3, R.color.green_4);
mBinding.contentSrl.setProgressViewEndTarget(true, mActionBarHeight * 2);
mBinding.contentSrl.setProgressViewOffset(false, 0, mActionBarHeight * 2);
mBinding.contentSrl.setRefreshing(true);
mBinding.contentSrl.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh() {
//Reload all data.
mIsBottom = false;
mPage = 1;
mLoadingArchive = false;
mBinding.getEntriesAdapter().getData().clear();
Snackbar.make(mBinding.coordinatorLayout, R.string.lbl_reload, Snackbar.LENGTH_SHORT).show();
getArchive();
}
});
}
示例10: onActivityCreated
import android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener; //导入依赖的package包/类
/**
* The onActivityCreated() is called after the onCreateView() method when activity is created.
* Get the api level from the session api level denotes the api versions of the android device
*/
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
apiLevel = AndroidLibrary.getInstance().getSession().getInt("api_level", 0);
lvcomplaint = (ListView) getActivity().findViewById(R.id.user_complaint_list);
//refresh list operations
mSwipeRefreshLayout=(SwipeRefreshLayout)getActivity().findViewById(R.id.swiperefresh);
mSwipeRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh() {
// TODO Auto-generated method stub
refreshComplaints();
}
});
mSwipeRefreshLayout.setColorSchemeResources(R.color.progressblue, R.color.progressorange, R.color.progressred);
}
示例11: onResume
import android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener; //导入依赖的package包/类
@Override
public void onResume() {
super.onResume();
swipeLayout = (SwipeRefreshLayout) getActivity().findViewById(
R.id.swipe_container);
swipeLayout
.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
// TODO Auto-generated method stub
handler.post(refreshing);
new UpdateEvents().execute();
swipeLayout.setRefreshing(false);
}
});
swipeLayout.setColorScheme(android.R.color.holo_blue_bright,
android.R.color.holo_green_light,
android.R.color.holo_orange_light,
android.R.color.holo_red_light);
}
示例12: initialView
import android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener; //导入依赖的package包/类
@SuppressLint("InlinedApi")
private void initialView(final Context context, ViewGroup rootView)
{
RelativeLayout todayToDoViewLayout = (RelativeLayout)mInflater.inflate(R.layout.todo_base_view, rootView, false);
final SwipeRefreshLayout swipeRefreshLayout = (SwipeRefreshLayout)todayToDoViewLayout.findViewById(R.id.swipe_container);
swipeRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh() {
// TODO Auto-generated method stub
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
swipeRefreshLayout.setRefreshing(false);
}
}, 5000);
}
});
swipeRefreshLayout.setColorScheme(android.R.color.holo_blue_bright,
android.R.color.holo_green_light, android.R.color.holo_orange_light, android.R.color.holo_red_light);
mToDoListBaseView = (ListView)todayToDoViewLayout.findViewById(R.id.list_view);
this.addView(todayToDoViewLayout);
}
示例13: initSwipeLayout
import android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener; //导入依赖的package包/类
/**
* Init SwipeRefreshLayout in the activity. A {@link #swipeLayout} is filled with object.
*
* @param listener called on refresh swipe
*/
protected void initSwipeLayout(OnRefreshListener listener) {
swipeLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_container);
if (swipeLayout != null) {
swipeLayout.setOnRefreshListener(listener);
swipeLayout.setColorSchemeResources(android.R.color.holo_red_light, R.color.apptheme_colorPrimary, android.R.color.holo_orange_light, R.color.apptheme_colorPrimary);
}
swipeLayout2 = (SwipeRefreshLayout) findViewById(R.id.swipe_container_2);
if (swipeLayout2 != null) {
swipeLayout2.setOnRefreshListener(listener);
swipeLayout2.setColorSchemeResources(android.R.color.holo_red_light, R.color.apptheme_colorPrimary, android.R.color.holo_orange_light, R.color.apptheme_colorPrimary);
}
initialProgressBar = findViewById(R.id.initial_progress);
}
示例14: initView
import android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener; //导入依赖的package包/类
@Override
public void initView(View view) {
super.initView(view);
mList.setDivider(null);
mList.setSelector(android.R.color.transparent);
mList.addHeaderView(initHeaderView());
mList.addFooterView(initFooterView());
mSwiperefreshlayout.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh() {
if (mState == STATE_REFRESH) {
return;
} else {
// 设置顶部正在刷新
setSwipeRefreshLoadingState(mSwiperefreshlayout);
/* !!! 设置耗时操作 !!! */
initCommitLayout();
}
}
});
mSwiperefreshlayout.setColorSchemeResources(
R.color.swiperefresh_color1, R.color.swiperefresh_color2,
R.color.swiperefresh_color3, R.color.swiperefresh_color4);
initListData();
initCommitLayout();
}
示例15: initView
import android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener; //导入依赖的package包/类
private void initView() {
errorLayout.setOnLayoutClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
requestData(true);
}
});
listview.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
Bundle args = new Bundle();
args.putInt(TeamDiaryFragment.TEAMID_KEY, teamId);
args.putSerializable(TeamDiaryFragment.DIARYDETAIL_KEY, datas
.getList().get(position));
UIHelper.showDiaryDetail(cxt, args);
}
});
pullHeadView.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh() {
if (BaseFragment.mState == BaseFragment.STATE_REFRESH) {
return;
} else {
errorLayout.setErrorMessage("本周无人提交周报");
// // 设置顶部正在刷新
// setSwipeRefreshLoadingState(pullHeadView);
requestData(false);
}
}
});
pullHeadView.setColorSchemeResources(R.color.swiperefresh_color1,
R.color.swiperefresh_color2, R.color.swiperefresh_color3,
R.color.swiperefresh_color4);
}