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


Java SwipeRefreshLayout.setEnabled方法代碼示例

本文整理匯總了Java中android.support.v4.widget.SwipeRefreshLayout.setEnabled方法的典型用法代碼示例。如果您正苦於以下問題:Java SwipeRefreshLayout.setEnabled方法的具體用法?Java SwipeRefreshLayout.setEnabled怎麽用?Java SwipeRefreshLayout.setEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.v4.widget.SwipeRefreshLayout的用法示例。


在下文中一共展示了SwipeRefreshLayout.setEnabled方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreateView

import android.support.v4.widget.SwipeRefreshLayout; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = super.onCreateView(inflater, container, savedInstanceState);
    getActivity().setTitle(getString(R.string.frag_notif_title));
    if (mListener != null) {
        mListener.checkNavigationDrawerItem(R.id.nav_notif);
    }
    FloatingActionButton fab = (FloatingActionButton) getActivity().findViewById(R.id.fab);
    fab.hide();
    SwipeRefreshLayout srl = (SwipeRefreshLayout) getActivity().findViewById(R.id.swipe_container);
    srl.setEnabled(false);

    IntentFilter filter = new IntentFilter();
    filter.addAction(MainActivity.ACTION_MAIN_SERVICE_BOUND);
    filter.addAction(MainService.ACTION_UPDATE_TOPOLOGY_FINISHED);
    LocalBroadcastManager bm = LocalBroadcastManager.getInstance(view.getContext());
    bm.registerReceiver(mBroadcastReceiver, filter);
    return view;
}
 
開發者ID:gbl08ma,項目名稱:underlx,代碼行數:20,代碼來源:NotifPreferenceFragment.java

示例2: initView

import android.support.v4.widget.SwipeRefreshLayout; //導入方法依賴的package包/類
private void initView() {
    mRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe);
    mRefreshLayout.setEnabled(false);
    mLoadingLayout = (LoadingLayout) findViewById(R.id.loading_layout);
    mRecyclerView = (RecyclerView) findViewById(R.id.list);

    mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
    mAdapter = new RetryActivity.RecyclerAdapter();
    mRecyclerView.setAdapter(mAdapter);


    mEmptyBtn = (Button) findViewById(R.id.empty_btn);
    mRetryBtn = (Button) findViewById(R.id.retry_btn);
    mCustomBtn1 = (Button) findViewById(R.id.custom1);
    mCustomBtn2 = (Button) findViewById(R.id.custom2);

    mRetryBtn.setVisibility(View.GONE);
    mEmptyBtn.setVisibility(View.GONE);
    mCustomBtn1.setVisibility(View.GONE);
    mCustomBtn2.setVisibility(View.GONE);

    mLoadingLayout.setOnRetryLoadListener(this);
}
 
開發者ID:xiong-it,項目名稱:LoadingLayout,代碼行數:24,代碼來源:RetryActivity.java

示例3: initView

import android.support.v4.widget.SwipeRefreshLayout; //導入方法依賴的package包/類
private void initView(ViewGroup root) {
    mRecyclerView = (RecyclerView) root.findViewById(R.id.test_recycler);
    mSwipeRefreshLayout = (SwipeRefreshLayout) root.findViewById(R.id.refresh_layout);
    mSwipeRefreshLayout.setEnabled(getArguments().getBoolean(REFRESH_SUPPORT));
    mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false));
    mRecyclerView.setItemAnimator(new DefaultItemAnimator());
    mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            new Handler().postDelayed(new Runnable() {
                @Override
                public void run() {
                    mSwipeRefreshLayout.setRefreshing(false);
                }
            }, 2000);
        }
    });
}
 
開發者ID:Learzhu,項目名稱:UcMainPagerDemo-master,代碼行數:19,代碼來源:TestFragment.java

示例4: onCreate

import android.support.v4.widget.SwipeRefreshLayout; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sunny_run);
    usernameText = (TextInputLayout) findViewById(R.id.sunny_run_username_edit_text);
    listTopText = (TextView) findViewById(R.id.sun_list_top_text);
    loginButton = (Button) findViewById(R.id.sunny_run_login_button);
    refreshLayout = (SwipeRefreshLayout) findViewById(R.id.sunny_refresh);
    loginLayout = (LinearLayout) findViewById(R.id.sunny_run_login_layout);
    setToolbar(R.id.sunny_run_toolbar, true);
    refreshLayout.setEnabled(false);

    initRecyclerView();
    checkLogin();

    loginButton.setOnClickListener(v -> {
        //收回輸入法
        InputMethodManager imm = (InputMethodManager)
                getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(refreshLayout.getWindowToken(), 0);
        if (checkInput()) {
            prefs.put("sunny_run_username", usernameText.getEditText().getText().toString());
            getData();
        }
    });
}
 
開發者ID:SailFlorve,項目名稱:RunHDU,代碼行數:27,代碼來源:SunnyRunActivity.java

示例5: onCreateView

import android.support.v4.widget.SwipeRefreshLayout; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.lcim_conversation_list_fragment, container, false);

    refreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.fragment_conversation_srl_pullrefresh);
    recyclerView = (RecyclerView) view.findViewById(R.id.fragment_conversation_srl_view);

    refreshLayout.setEnabled(false);
    layoutManager = new LinearLayoutManager(getActivity());
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.addItemDecoration(new LCIMDividerItemDecoration(getActivity()));
    itemAdapter = new LCIMCommonListAdapter<AVIMConversation>(LCIMConversationItemHolder.class);
    recyclerView.setAdapter(itemAdapter);
    EventBus.getDefault().register(this);
    updateConversationList();




    return view;
}
 
開發者ID:linsir6,項目名稱:TripBuyer,代碼行數:22,代碼來源:LCIMConversationListFragment.java

示例6: onCreateView

import android.support.v4.widget.SwipeRefreshLayout; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_events, container, false);
    vSwipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipeContainer);
    vSwipeRefreshLayout.setOnRefreshListener(this);
    vSwipeRefreshLayout.setColorSchemeColors(getResources().getColor(R.color.primary));
    vSwipeRefreshLayout.setEnabled(true);

    vRecyclerView = (RecyclerView) view.findViewById(R.id.cardList);
    vRecyclerView.setHasFixedSize(false);
    final LinearLayoutManager llm = new LinearLayoutManager(getActivity());
    llm.setOrientation(LinearLayoutManager.VERTICAL);
    vRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
        @Override
        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
            super.onScrolled(recyclerView, dx, dy);
            // So the user didn't accidentally refresh on pulling up
            vSwipeRefreshLayout.setEnabled(llm.findFirstCompletelyVisibleItemPosition() == 0 || (llm.findFirstVisibleItemPosition() == 0 && llm.findFirstCompletelyVisibleItemPosition() == -1));
        }
    });
    vRecyclerView.setLayoutManager(llm);
    return view;
}
 
開發者ID:gregoreesmaa,項目名稱:minu-poska-android,代碼行數:24,代碼來源:EventsFragment.java

示例7: initView

import android.support.v4.widget.SwipeRefreshLayout; //導入方法依賴的package包/類
private void initView(ViewGroup root) {
    mRecyclerView = (RecyclerView) root.findViewById(R.id.test_recycler);
    mSwipeRefreshLayout = (SwipeRefreshLayout) root.findViewById(R.id.refresh_layout);
    mSwipeRefreshLayout.setEnabled(getArguments().getBoolean(REFRESH_SUPPORT));
    mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false));
    mRecyclerView.setItemAnimator(new DefaultItemAnimator());
    mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            new Handler().postDelayed(new Runnable() {
                @Override
                public void run() {
                    mSwipeRefreshLayout.setRefreshing(false);
                    Toast.makeText(mContext, "刷新完成", Toast.LENGTH_SHORT).show();
                }
            }, 2000);
        }
    });
}
 
開發者ID:zuoni1018,項目名稱:CoordinatorLayoutExample-master,代碼行數:20,代碼來源:TestFragment.java

示例8: initView

import android.support.v4.widget.SwipeRefreshLayout; //導入方法依賴的package包/類
public CoreRecyclerView initView(Context context) {
    View view = LayoutInflater.from(context).inflate(
            R.layout.layout_recyclerview, null);
    view.setLayoutParams(new LinearLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));
    addView(view);
    mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipeLayout);
    mSwipeRefreshLayout.setEnabled(false);
    mRecyclerView = (RecyclerView) findViewById(R.id.rv_list);
    return this;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:13,代碼來源:CoreRecyclerView.java

示例9: initializeRecyclerView

import android.support.v4.widget.SwipeRefreshLayout; //導入方法依賴的package包/類
@SuppressWarnings({"ConstantConditions", "NullableProblems"})
private void initializeRecyclerView(Bundle savedInstanceState) {
	// Initialize Adapter and RecyclerView
	// ExampleAdapter makes use of stableIds, I strongly suggest to implement 'item.hashCode()'
	mAdapter = new FlexibleAdapter<>(DatabaseService.getInstance().getDatabaseList(), getActivity());
	mRecyclerView = (RecyclerView) getView().findViewById(R.id.recycler_view);
	// Customize the speed of the smooth scroll.
	// NOTE: Every time you change this value you MUST recreate the LayoutManager instance
	// and to assign it again to the RecyclerView!
	TopSnappedSmoothScroller.MILLISECONDS_PER_INCH = 33f;
	mRecyclerView.setLayoutManager(createNewStaggeredGridLayoutManager());
	// This value is restored to 100f (default) right here, because it is used in the
	// constructor by Android. If we don't change it now, others LayoutManager will be
	// impacted too by the above modification!
	TopSnappedSmoothScroller.MILLISECONDS_PER_INCH = 100f;

	mRecyclerView.setAdapter(mAdapter);
	mRecyclerView.setHasFixedSize(true); //Size of RV will not change
	// NOTE: Use default item animator 'canReuseUpdatedViewHolder()' will return true if
	// a Payload is provided. FlexibleAdapter is actually sending Payloads onItemChange.
	mRecyclerView.setItemAnimator(new DefaultItemAnimator());

	// Experimenting NEW features (v5.0.0)
	mAdapter.setDisplayHeadersAtStartUp(true) //Show Headers at startUp!
			.setNotifyMoveOfFilteredItems(true)
			.setPermanentDelete(true) //Default=true
			.setOnlyEntryAnimation(true);

	SwipeRefreshLayout swipeRefreshLayout = (SwipeRefreshLayout) getView().findViewById(R.id.swipeRefreshLayout);
	swipeRefreshLayout.setEnabled(true);
	mListener.onFragmentChange(swipeRefreshLayout, mRecyclerView, SelectableAdapter.MODE_IDLE);

	// Add 1 Scrollable Header
	mAdapter.addScrollableHeader(new ScrollableUseCaseItem(
			getString(R.string.staggered_use_case_title),
			getString(R.string.staggered_use_case_description)));
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:38,代碼來源:FragmentStaggeredLayout.java

示例10: initializeRecyclerView

import android.support.v4.widget.SwipeRefreshLayout; //導入方法依賴的package包/類
@SuppressWarnings({"ConstantConditions", "NullableProblems"})
private void initializeRecyclerView(Bundle savedInstanceState) {
	mAdapter = new ExampleAdapter(DatabaseService.getInstance().getDatabaseList(), getActivity());
	// Experimenting NEW features (v5.0.0)
	mAdapter.expandItemsAtStartUp()
			.setAutoCollapseOnExpand(false)
			.setAutoScrollOnExpand(true)
			.setOnlyEntryAnimation(false)
			.setAnimationEntryStep(true) //In Overall, watch the effect at initial loading when Grid Layout is set
			.setAnimationOnScrolling(DatabaseConfiguration.animateOnScrolling)
			.setAnimationOnReverseScrolling(true)
			.setAnimationInterpolator(new DecelerateInterpolator())
			.setAnimationDuration(300L);
	mRecyclerView = (RecyclerView) getView().findViewById(R.id.recycler_view);
	mRecyclerView.setLayoutManager(createNewLinearLayoutManager());
	mRecyclerView.setAdapter(mAdapter);
	//mRecyclerView.setHasFixedSize(true); //Size of RV will not change

	// NOTE: Custom item animators inherit 'canReuseUpdatedViewHolder()' from Default Item
	// Animator. It will return true if a Payload is provided. FlexibleAdapter is actually
	// sending Payloads onItemChange notifications.
	mRecyclerView.setItemAnimator(new FlexibleItemAnimator());
	initializeSpinnerItemAnimators();
	initializeSpinnerScrollAnimators();

	// Experimenting NEW features (v5.0.0)
	mAdapter.setSwipeEnabled(true)
			.getItemTouchHelperCallback()
			.setSwipeFlags(ItemTouchHelper.RIGHT); //Enable swipe

	SwipeRefreshLayout swipeRefreshLayout = (SwipeRefreshLayout) getView().findViewById(R.id.swipeRefreshLayout);
	swipeRefreshLayout.setEnabled(false);
	mListener.onFragmentChange(swipeRefreshLayout, mRecyclerView, SelectableAdapter.MODE_IDLE);

	// Add 1 Scrollable Header
	mAdapter.addScrollableHeader(new ScrollableUseCaseItem(
			getString(R.string.animator_use_case_title),
			getString(R.string.animator_use_case_description)));
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:40,代碼來源:FragmentAnimators.java

示例11: initializeRecyclerView

import android.support.v4.widget.SwipeRefreshLayout; //導入方法依賴的package包/類
@SuppressWarnings({"ConstantConditions", "NullableProblems"})
private void initializeRecyclerView(Bundle savedInstanceState) {
	// Initialize Adapter and RecyclerView
	// ExampleAdapter makes use of stableIds, I strongly suggest to implement 'item.hashCode()'
	mAdapter = new ExampleAdapter(DatabaseService.getInstance().getDatabaseList(), getActivity());

	mRecyclerView = (RecyclerView) getView().findViewById(R.id.recycler_view);
	mRecyclerView.setLayoutManager(createNewLinearLayoutManager());
	mRecyclerView.setAdapter(mAdapter);
	mRecyclerView.setHasFixedSize(true); //Size of RV will not change
	// NOTE: Use default item animator 'canReuseUpdatedViewHolder()' will return true if
	// a Payload is provided. FlexibleAdapter is actually sending Payloads onItemChange.
	mRecyclerView.setItemAnimator(new DefaultItemAnimator());

	// Add FastScroll to the RecyclerView, after the Adapter has been attached the RecyclerView!!!
	mAdapter.setFastScroller((FastScroller) getView().findViewById(R.id.fast_scroller),
			Utils.getColorAccent(getActivity()), (MainActivity) getActivity());
	mAdapter.setDisplayHeadersAtStartUp(true)
			.setStickyHeaders(true)
			.setOnlyEntryAnimation(true);

	SwipeRefreshLayout swipeRefreshLayout = (SwipeRefreshLayout) getView().findViewById(R.id.swipeRefreshLayout);
	swipeRefreshLayout.setEnabled(true);
	mListener.onFragmentChange(swipeRefreshLayout, mRecyclerView, SelectableAdapter.MODE_IDLE);

	// Add 1 Scrollable Header
	mAdapter.addScrollableHeader(new ScrollableUseCaseItem(
			getString(R.string.model_holders_use_case_title),
			getString(R.string.model_holders_use_case_description)));
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:31,代碼來源:FragmentHolderSections.java

示例12: initializeRecyclerView

import android.support.v4.widget.SwipeRefreshLayout; //導入方法依賴的package包/類
@SuppressWarnings({"unchecked", "ConstantConditions"})
private void initializeRecyclerView() {
	// Initialize Adapter and RecyclerView
	// true = it makes use of stableIds, I strongly suggest to implement 'item.hashCode()'
	mAdapter = new FlexibleAdapter<>(DatabaseService.getInstance().getDatabaseList(), getActivity(), true);
	mAdapter.addListener(getActivity())
			// Experimenting NEW features (v5.0.0)
			.setAnimationOnScrolling(true)
			.setAnimationOnReverseScrolling(true);
	mRecyclerView = (RecyclerView) getView().findViewById(R.id.recycler_view);
	mRecyclerView.setLayoutManager(createNewLinearLayoutManager());
	mRecyclerView.setAdapter(mAdapter);
	mRecyclerView.setHasFixedSize(true); //Size of RV will not change
	// NOTE: Use default item animator 'canReuseUpdatedViewHolder()' will return true if
	// a Payload is provided. FlexibleAdapter is actually sending Payloads onItemChange.
	mRecyclerView.setItemAnimator(new DefaultItemAnimator());
	// Custom divider item decorator with 24dpi as empty space between sections
	mRecyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), 0, 24));

	mAdapter.setDisplayHeadersAtStartUp(true) //Show Headers at startUp!
			.setStickyHeaders(true) //Make headers sticky
			// Endless scroll with 1 item threshold
			.setEndlessScrollListener(this, new ProgressItem())
			.setEndlessScrollThreshold(1); //Default=1

	SwipeRefreshLayout swipeRefreshLayout = (SwipeRefreshLayout) getView().findViewById(R.id.swipeRefreshLayout);
	swipeRefreshLayout.setEnabled(true);
	mListener.onFragmentChange(swipeRefreshLayout, mRecyclerView, SelectableAdapter.MODE_IDLE);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:30,代碼來源:FragmentInstagramHeaders.java

示例13: onCreateView

import android.support.v4.widget.SwipeRefreshLayout; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = super.onCreateView(inflater, container, savedInstanceState);
    getActivity().setTitle(getString(R.string.frag_settings_title));
    if (mListener != null) {
        mListener.checkNavigationDrawerItem(R.id.nav_settings);
    }
    FloatingActionButton fab = (FloatingActionButton) getActivity().findViewById(R.id.fab);
    fab.hide();
    SwipeRefreshLayout srl = (SwipeRefreshLayout) getActivity().findViewById(R.id.swipe_container);
    srl.setEnabled(false);
    return view;
}
 
開發者ID:gbl08ma,項目名稱:underlx,代碼行數:14,代碼來源:GeneralPreferenceFragment.java

示例14: initView

import android.support.v4.widget.SwipeRefreshLayout; //導入方法依賴的package包/類
@Override
    public void initView() {



        linearLayout_title = findViewById(R.id.titleLayout);
        linearLayout_title.setBackVisisble(true);
        linearLayout_title.setBackText(mRootView.getContext().getString(R.string.myself));
        linearLayout_title.setTitleText(mRootView.getContext().getString(R.string.my_device));


        mRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.refresh_layout);
//        mRefreshLayout.setOnRefreshListener(this); // 刷新監聽。
        mRefreshLayout.setEnabled(false);
        mRecyclerView = (SwipeMenuRecyclerView) findViewById(R.id.recycler_view);
        mRecyclerView.setLayoutManager(new LinearLayoutManager(mRootView.getContext()));
        mRecyclerView.addItemDecoration(new DefaultItemDecoration(ContextCompat.getColor(mRootView.getContext(), R.color.divider_color)));
        //點擊item監聽
        mRecyclerView.setSwipeItemClickListener(this);
        mRecyclerView.setSwipeMenuCreator(swipeMenuCreator);
        mRecyclerView.setSwipeMenuItemClickListener(mMenuItemClickListener);
        // 自定義的核心就是DefineLoadMoreView類。
//        DefineLoadMoreView loadMoreView = new DefineLoadMoreView(mRootView.getContext());
//        mRecyclerView.addFooterView(loadMoreView); // 添加為Footer。
//        mRecyclerView.setLoadMoreView(loadMoreView); // 設置LoadMoreView更新監聽。
//        mRecyclerView.setLoadMoreListener(this); // 加載更多的監聽。
        mRecyclerView.setItemAnimator(new DefaultItemAnimator());


    }
 
開發者ID:dufangyu1990,項目名稱:LeCatApp,代碼行數:31,代碼來源:MyDeviceView.java

示例15: setSwipeRefreshLoadedState

import android.support.v4.widget.SwipeRefreshLayout; //導入方法依賴的package包/類
/**
 * 設置頂部加載完畢的狀態
 */
private void setSwipeRefreshLoadedState(
        SwipeRefreshLayout mSwipeRefreshLayout) {
    BaseFragment.mState = BaseFragment.STATE_NOMORE;
    if (mSwipeRefreshLayout != null) {
        mSwipeRefreshLayout.setRefreshing(false);
        mSwipeRefreshLayout.setEnabled(true);
    }
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:12,代碼來源:DiaryPageContentView.java


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