当前位置: 首页>>代码示例>>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;未经允许,请勿转载。