Back to project page Flym.
The source code is released under:
GNU General Public License
If you think the Android project Flym listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
/** * Flym/*from w ww .j av a 2 s. com*/ * * Copyright (c) 2012-2013 Frederic Julian * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package net.fred.feedex.fragment; import android.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import net.fred.feedex.view.SwipeRefreshLayout; public abstract class SwipeRefreshFragment extends Fragment implements SwipeRefreshLayout.OnRefreshListener { private SwipeRefreshLayout mRefreshLayout; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mRefreshLayout = new SwipeRefreshLayout(inflater.getContext()); inflateView(inflater, mRefreshLayout, savedInstanceState); return mRefreshLayout; } abstract public View inflateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState); @Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mRefreshLayout.setColorScheme(android.R.color.holo_blue_bright, android.R.color.holo_blue_dark, android.R.color.holo_blue_bright, android.R.color.holo_blue_dark); mRefreshLayout.setOnRefreshListener(this); } /** * It shows the SwipeRefreshLayout progress */ public void showSwipeProgress() { mRefreshLayout.setRefreshing(true); } /** * It shows the SwipeRefreshLayout progress */ public void hideSwipeProgress() { mRefreshLayout.setRefreshing(false); } /** * Enables swipe gesture */ public void enableSwipe() { mRefreshLayout.setEnabled(true); } /** * Disables swipe gesture. It prevents manual gestures but keeps the option tu show * refreshing programatically. */ public void disableSwipe() { mRefreshLayout.setEnabled(false); } /** * Get the refreshing status */ public boolean isRefreshing() { return mRefreshLayout.isRefreshing(); } }