本文整理匯總了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);
}