If you think the Android project Reader listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
/**
* Flym//fromwww.java2s.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 com.carlrice.reader.fragment;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.carlrice.reader.view.SwipeRefreshLayout;
publicabstractclass 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;
}
abstractpublic View inflateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState);
@Override
publicvoid 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
*/publicvoid showSwipeProgress() {
mRefreshLayout.setRefreshing(true);
}
/**
* It shows the SwipeRefreshLayout progress
*/publicvoid hideSwipeProgress() {
mRefreshLayout.setRefreshing(false);
}
/**
* Enables swipe gesture
*/publicvoid enableSwipe() {
mRefreshLayout.setEnabled(true);
}
/**
* Disables swipe gesture. It prevents manual gestures but keeps the option tu show
* refreshing programatically.
*/publicvoid disableSwipe() {
mRefreshLayout.setEnabled(false);
}
/**
* Get the refreshing status
*/publicboolean isRefreshing() {
return mRefreshLayout.isRefreshing();
}
}