當前位置: 首頁>>代碼示例>>Java>>正文


Java OnRefreshListener類代碼示例

本文整理匯總了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();
            }
        };
    }
 
開發者ID:joy-inc,項目名稱:joy-library,代碼行數:18,代碼來源:BaseHttpLvFragment.java

示例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
            }
        };
    }
 
開發者ID:joy-inc,項目名稱:joy-library,代碼行數:19,代碼來源:BaseHttpRvPresenter.java

示例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);
        }
    });
}
 
開發者ID:funnyzhaov,項目名稱:Tribe,代碼行數:20,代碼來源:EaseChatFragment.java

示例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
            }
        };
    }
 
開發者ID:joy-inc,項目名稱:joy-library,代碼行數:19,代碼來源:BaseHttpRvFragment.java

示例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);
}
 
開發者ID:umeng,項目名稱:umeng_community_android,代碼行數:25,代碼來源:NotificationFragment.java

示例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);
}
 
開發者ID:backtory,項目名稱:neveshtanak-Deprecated-,代碼行數:19,代碼來源:BasicJomleFragment.java

示例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();
}
 
開發者ID:SouthAve,項目名稱:bleTester,代碼行數:23,代碼來源:MainActivity.java

示例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));
}
 
開發者ID:Owater,項目名稱:school_shop,代碼行數:22,代碼來源:FindListFragment.java

示例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();
		}
	});
}
 
開發者ID:XinyueZ,項目名稱:marsTemp,代碼行數:22,代碼來源:MainActivity.java

示例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);
      
  }
 
開發者ID:egovernments,項目名稱:egov-mobile,代碼行數:24,代碼來源:UserComplaintActivity.java

示例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);

}
 
開發者ID:MainMethod1,項目名稱:TrailMix-for-peel-android,代碼行數:24,代碼來源:EventsFragment.java

示例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);
}
 
開發者ID:oldoldb,項目名稱:DouDouToDoList,代碼行數:26,代碼來源:ToDoBaseView.java

示例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);
}
 
開發者ID:Daskiworks,項目名稱:ghwatch,代碼行數:21,代碼來源:ActivityBase.java

示例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();
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:29,代碼來源:TeamDiaryDetailFragment.java

示例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);
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:37,代碼來源:DiaryPageContentView.java


注:本文中的android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。