remove pulltorefresh library, switch to swiperefreshlayout
This commit is contained in:
parent
09d124fd40
commit
ddb85d210a
@ -13,4 +13,3 @@ android.library.reference.1=..\\Android-ViewPagerIndicator\\library
|
||||
android.library.reference.2=..\\tasker-locale-api
|
||||
android.library.reference.3=..\\appcompat
|
||||
android.library.reference.4=..\\SlidingMenu\\library
|
||||
android.library.reference.5=../pulltorefresh-actionbarcompat
|
||||
|
@ -18,13 +18,19 @@
|
||||
</TextView>
|
||||
</LinearLayout>
|
||||
|
||||
<ListView
|
||||
android:id="@+id/feeds"
|
||||
android:layoutAnimation="@anim/layout_feeds"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
</ListView>
|
||||
<android.support.v4.widget.SwipeRefreshLayout
|
||||
android:id="@+id/feeds_swipe_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<ListView
|
||||
android:id="@+id/feeds"
|
||||
android:layoutAnimation="@anim/layout_feeds"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
</ListView>
|
||||
</android.support.v4.widget.SwipeRefreshLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/no_feeds"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -18,12 +18,18 @@
|
||||
</TextView>
|
||||
</LinearLayout>
|
||||
|
||||
<ListView
|
||||
android:id="@+id/feeds"
|
||||
android:layoutAnimation="@anim/layout_feeds"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
</ListView>
|
||||
<android.support.v4.widget.SwipeRefreshLayout
|
||||
android:id="@+id/feeds_swipe_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<ListView
|
||||
android:id="@+id/feeds"
|
||||
android:layoutAnimation="@anim/layout_feeds"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
</ListView>
|
||||
</android.support.v4.widget.SwipeRefreshLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/no_feeds"
|
||||
|
@ -4,15 +4,21 @@
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<ListView
|
||||
android:id="@+id/headlines"
|
||||
android:layout_width="match_parent"
|
||||
android:layoutAnimation="@anim/layout_headline"
|
||||
android:dividerHeight="0dp"
|
||||
android:divider="@null"
|
||||
android:paddingTop="3dp"
|
||||
android:layout_height="match_parent" >
|
||||
</ListView>
|
||||
<android.support.v4.widget.SwipeRefreshLayout
|
||||
android:id="@+id/headlines_swipe_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<ListView
|
||||
android:id="@+id/headlines"
|
||||
android:layout_width="match_parent"
|
||||
android:layoutAnimation="@anim/layout_headline"
|
||||
android:dividerHeight="0dp"
|
||||
android:divider="@null"
|
||||
android:paddingTop="3dp"
|
||||
android:layout_height="match_parent" >
|
||||
</ListView>
|
||||
</android.support.v4.widget.SwipeRefreshLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/loading_container"
|
||||
|
@ -146,7 +146,7 @@ public class ArticlePager extends Fragment {
|
||||
m_activity.setLoadingStatus(R.string.blank, true);
|
||||
|
||||
m_activity.setProgressBarVisibility(true);
|
||||
m_activity.m_pullToRefreshAttacher.setRefreshing(true);
|
||||
//m_activity.m_pullToRefreshAttacher.setRefreshing(true);
|
||||
|
||||
if (!m_feed.equals(GlobalState.getInstance().m_activeFeed)) {
|
||||
append = false;
|
||||
@ -163,7 +163,7 @@ public class ArticlePager extends Fragment {
|
||||
if (isDetached()) return;
|
||||
|
||||
m_activity.setProgressBarVisibility(false);
|
||||
m_activity.m_pullToRefreshAttacher.setRefreshComplete();
|
||||
//m_activity.m_pullToRefreshAttacher.setRefreshComplete();
|
||||
|
||||
super.onPostExecute(result);
|
||||
|
||||
|
@ -8,6 +8,7 @@ import android.database.sqlite.SQLiteDatabase;
|
||||
import android.graphics.Point;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.util.Log;
|
||||
import android.view.Display;
|
||||
@ -206,4 +207,5 @@ public class CommonActivity extends ActionBarActivity {
|
||||
return display.getWidth();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -11,8 +11,6 @@ import org.fox.ttrss.types.Feed;
|
||||
import org.fox.ttrss.types.FeedCategory;
|
||||
import org.fox.ttrss.types.FeedCategoryList;
|
||||
|
||||
import uk.co.senab.actionbarpulltorefresh.library.PullToRefreshAttacher.OnRefreshListener;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
@ -24,6 +22,7 @@ import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.util.Log;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.ContextMenu.ContextMenuInfo;
|
||||
@ -46,13 +45,14 @@ import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
public class FeedCategoriesFragment extends Fragment implements OnItemClickListener, OnSharedPreferenceChangeListener, OnRefreshListener {
|
||||
public class FeedCategoriesFragment extends Fragment implements OnItemClickListener, OnSharedPreferenceChangeListener {
|
||||
private final String TAG = this.getClass().getSimpleName();
|
||||
private SharedPreferences m_prefs;
|
||||
private FeedCategoryListAdapter m_adapter;
|
||||
private FeedCategoryList m_cats = new FeedCategoryList();
|
||||
private FeedCategory m_selectedCat;
|
||||
private FeedsActivity m_activity;
|
||||
private SwipeRefreshLayout m_swipeLayout;
|
||||
|
||||
@SuppressLint("DefaultLocale")
|
||||
class CatUnreadComparator implements Comparator<FeedCategory> {
|
||||
@ -212,13 +212,30 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe
|
||||
|
||||
View view = inflater.inflate(R.layout.cats_fragment, container, false);
|
||||
|
||||
m_swipeLayout = (SwipeRefreshLayout) view.findViewById(R.id.feeds_swipe_container);
|
||||
|
||||
m_swipeLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
refresh(false);
|
||||
}
|
||||
});
|
||||
|
||||
if (!m_activity.isCompatMode()) {
|
||||
m_swipeLayout.setColorScheme(android.R.color.holo_green_dark,
|
||||
android.R.color.holo_red_dark,
|
||||
android.R.color.holo_blue_dark,
|
||||
android.R.color.holo_orange_dark);
|
||||
}
|
||||
|
||||
|
||||
ListView list = (ListView)view.findViewById(R.id.feeds);
|
||||
m_adapter = new FeedCategoryListAdapter(getActivity(), R.layout.feeds_row, (ArrayList<FeedCategory>)m_cats);
|
||||
list.setAdapter(m_adapter);
|
||||
list.setOnItemClickListener(this);
|
||||
registerForContextMenu(list);
|
||||
|
||||
m_activity.m_pullToRefreshAttacher.addRefreshableView(list, this);
|
||||
//m_activity.m_pullToRefreshAttacher.addRefreshableView(list, this);
|
||||
|
||||
return view;
|
||||
}
|
||||
@ -265,6 +282,8 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe
|
||||
} */
|
||||
|
||||
public void refresh(boolean background) {
|
||||
m_swipeLayout.setRefreshing(true);
|
||||
|
||||
CatsRequest req = new CatsRequest(getActivity().getApplicationContext());
|
||||
|
||||
final String sessionId = m_activity.getSessionId();
|
||||
@ -306,7 +325,7 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe
|
||||
if (isDetached()) return;
|
||||
|
||||
m_activity.setProgressBarVisibility(false);
|
||||
m_activity.m_pullToRefreshAttacher.setRefreshComplete();
|
||||
m_swipeLayout.setRefreshing(false);
|
||||
|
||||
if (getView() != null) {
|
||||
ListView list = (ListView)getView().findViewById(R.id.feeds);
|
||||
@ -521,8 +540,8 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe
|
||||
return m_selectedCat;
|
||||
}
|
||||
|
||||
@Override
|
||||
/* @Override
|
||||
public void onRefreshStarted(View view) {
|
||||
refresh(false);
|
||||
}
|
||||
} */
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
||||
lr.execute(map);
|
||||
}
|
||||
|
||||
m_pullToRefreshAttacher.setRefreshing(true);
|
||||
//m_pullToRefreshAttacher.setRefreshing(true);
|
||||
|
||||
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
|
||||
|
||||
@ -226,7 +226,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
||||
|
||||
public void onFeedSelected(Feed feed) {
|
||||
GlobalState.getInstance().m_loadedArticles.clear();
|
||||
m_pullToRefreshAttacher.setRefreshing(true);
|
||||
//m_pullToRefreshAttacher.setRefreshing(true);
|
||||
|
||||
FragmentTransaction ft = getSupportFragmentManager()
|
||||
.beginTransaction();
|
||||
@ -288,7 +288,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
||||
public void onCatSelected(FeedCategory cat, boolean openAsFeed) {
|
||||
FeedCategoriesFragment fc = (FeedCategoriesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_CATS);
|
||||
|
||||
m_pullToRefreshAttacher.setRefreshing(true);
|
||||
//m_pullToRefreshAttacher.setRefreshing(true);
|
||||
|
||||
if (!openAsFeed) {
|
||||
|
||||
@ -358,7 +358,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
||||
refresh();
|
||||
return true;
|
||||
case R.id.update_feeds:
|
||||
m_pullToRefreshAttacher.setRefreshing(true);
|
||||
//m_pullToRefreshAttacher.setRefreshing(true);
|
||||
refresh();
|
||||
return true;
|
||||
default:
|
||||
|
@ -17,8 +17,6 @@ import org.fox.ttrss.types.Feed;
|
||||
import org.fox.ttrss.types.FeedCategory;
|
||||
import org.fox.ttrss.types.FeedList;
|
||||
|
||||
import uk.co.senab.actionbarpulltorefresh.library.PullToRefreshAttacher.OnRefreshListener;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
@ -36,6 +34,7 @@ import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
import android.view.ContextMenu;
|
||||
@ -59,7 +58,7 @@ import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
public class FeedsFragment extends Fragment implements OnItemClickListener, OnSharedPreferenceChangeListener, OnRefreshListener {
|
||||
public class FeedsFragment extends Fragment implements OnItemClickListener, OnSharedPreferenceChangeListener {
|
||||
private final String TAG = this.getClass().getSimpleName();
|
||||
private SharedPreferences m_prefs;
|
||||
private FeedListAdapter m_adapter;
|
||||
@ -70,6 +69,7 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
|
||||
private static final String ICON_PATH = "/icons/";
|
||||
private boolean m_enableFeedIcons;
|
||||
private boolean m_feedIconsChecked = false;
|
||||
private SwipeRefreshLayout m_swipeLayout;
|
||||
|
||||
public void initialize(FeedCategory cat) {
|
||||
m_activeCategory = cat;
|
||||
@ -277,6 +277,22 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
|
||||
|
||||
View view = inflater.inflate(R.layout.feeds_fragment, container, false);
|
||||
|
||||
m_swipeLayout = (SwipeRefreshLayout) view.findViewById(R.id.feeds_swipe_container);
|
||||
|
||||
m_swipeLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
refresh(false);
|
||||
}
|
||||
});
|
||||
|
||||
if (!m_activity.isCompatMode()) {
|
||||
m_swipeLayout.setColorScheme(android.R.color.holo_green_dark,
|
||||
android.R.color.holo_red_dark,
|
||||
android.R.color.holo_blue_dark,
|
||||
android.R.color.holo_orange_dark);
|
||||
}
|
||||
|
||||
ListView list = (ListView)view.findViewById(R.id.feeds);
|
||||
m_adapter = new FeedListAdapter(getActivity(), R.layout.feeds_row, (ArrayList<Feed>)m_feeds);
|
||||
list.setAdapter(m_adapter);
|
||||
@ -287,9 +303,8 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
|
||||
|
||||
m_enableFeedIcons = m_prefs.getBoolean("download_feed_icons", false);
|
||||
|
||||
Log.d(TAG, "mpTRA=" + m_activity.m_pullToRefreshAttacher);
|
||||
|
||||
m_activity.m_pullToRefreshAttacher.addRefreshableView(list, this);
|
||||
//Log.d(TAG, "mpTRA=" + m_activity.m_pullToRefreshAttacher);
|
||||
//m_activity.m_pullToRefreshAttacher.addRefreshableView(list, this);
|
||||
|
||||
return view;
|
||||
}
|
||||
@ -365,6 +380,8 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
|
||||
public void refresh(boolean background) {
|
||||
//FeedCategory cat = m_onlineServices.getActiveCategory();
|
||||
|
||||
m_swipeLayout.setRefreshing(true);
|
||||
|
||||
final int catId = (m_activeCategory != null) ? m_activeCategory.id : -4;
|
||||
|
||||
final String sessionId = m_activity.getSessionId();
|
||||
@ -484,8 +501,9 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
|
||||
}
|
||||
|
||||
m_activity.setProgressBarVisibility(false);
|
||||
m_activity.m_pullToRefreshAttacher.setRefreshComplete();
|
||||
|
||||
//m_activity.m_pullToRefreshAttacher.setRefreshComplete();
|
||||
m_swipeLayout.setRefreshing(false);
|
||||
|
||||
if (result != null) {
|
||||
try {
|
||||
JsonArray content = result.getAsJsonArray();
|
||||
@ -782,9 +800,9 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
/* @Override
|
||||
public void onRefreshStarted(View view) {
|
||||
refresh(false);
|
||||
}
|
||||
} */
|
||||
|
||||
}
|
||||
|
@ -14,8 +14,6 @@ import org.fox.ttrss.util.HeadlinesRequest;
|
||||
import org.fox.ttrss.util.TypefaceCache;
|
||||
import org.jsoup.Jsoup;
|
||||
|
||||
import uk.co.senab.actionbarpulltorefresh.library.PullToRefreshAttacher.OnRefreshListener;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@ -29,6 +27,7 @@ import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.text.Html;
|
||||
import android.text.Html.ImageGetter;
|
||||
import android.util.Log;
|
||||
@ -53,7 +52,7 @@ import android.widget.TextView;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
|
||||
public class HeadlinesFragment extends Fragment implements OnItemClickListener, OnScrollListener, OnRefreshListener {
|
||||
public class HeadlinesFragment extends Fragment implements OnItemClickListener, OnScrollListener {
|
||||
public static enum ArticlesSelection { ALL, NONE, UNREAD };
|
||||
|
||||
public static final int HEADLINES_REQUEST_SIZE = 30;
|
||||
@ -75,6 +74,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
||||
private ArticleList m_readArticles = new ArticleList();
|
||||
private HeadlinesEventListener m_listener;
|
||||
private OnlineActivity m_activity;
|
||||
private SwipeRefreshLayout m_swipeLayout;
|
||||
|
||||
private ImageGetter m_dummyGetter = new ImageGetter() {
|
||||
|
||||
@ -290,6 +290,23 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
||||
|
||||
View view = inflater.inflate(R.layout.headlines_fragment, container, false);
|
||||
|
||||
m_swipeLayout = (SwipeRefreshLayout) view.findViewById(R.id.headlines_swipe_container);
|
||||
|
||||
m_swipeLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
refresh(false);
|
||||
}
|
||||
});
|
||||
|
||||
if (!m_activity.isCompatMode()) {
|
||||
m_swipeLayout.setColorScheme(android.R.color.holo_green_dark,
|
||||
android.R.color.holo_red_dark,
|
||||
android.R.color.holo_blue_dark,
|
||||
android.R.color.holo_orange_dark);
|
||||
}
|
||||
|
||||
|
||||
ListView list = (ListView)view.findViewById(R.id.headlines);
|
||||
m_adapter = new ArticleListAdapter(getActivity(), R.layout.headlines_row, (ArrayList<Article>)m_articles);
|
||||
|
||||
@ -318,7 +335,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
||||
//list.setEmptyView(view.findViewById(R.id.no_headlines));
|
||||
registerForContextMenu(list);
|
||||
|
||||
m_activity.m_pullToRefreshAttacher.addRefreshableView(list, this);
|
||||
//m_activity.m_pullToRefreshAttacher.addRefreshableView(list, this);
|
||||
|
||||
//if (m_activity.isSmallScreen())
|
||||
//view.findViewById(R.id.headlines_fragment).setPadding(0, 0, 0, 0);
|
||||
@ -387,6 +404,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
||||
if (m_activity != null && m_feed != null) {
|
||||
m_refreshInProgress = true;
|
||||
|
||||
m_swipeLayout.setRefreshing(true);
|
||||
m_activity.setProgressBarVisibility(true);
|
||||
|
||||
if (!m_feed.equals(GlobalState.getInstance().m_activeFeed)) {
|
||||
@ -434,8 +452,8 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
||||
super.onPostExecute(result);
|
||||
|
||||
if (isAdded()) {
|
||||
m_activity.m_pullToRefreshAttacher.setRefreshComplete();
|
||||
}
|
||||
m_swipeLayout.setRefreshing(false);
|
||||
}
|
||||
|
||||
if (result != null) {
|
||||
m_refreshInProgress = false;
|
||||
@ -986,10 +1004,10 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
||||
return m_feed;
|
||||
}
|
||||
|
||||
@Override
|
||||
/* @Override
|
||||
public void onRefreshStarted(View view) {
|
||||
refresh(false);
|
||||
}
|
||||
} */
|
||||
|
||||
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ import org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Document;
|
||||
import org.jsoup.select.Elements;
|
||||
|
||||
import uk.co.senab.actionbarpulltorefresh.extras.actionbarcompat.*;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
@ -53,7 +52,6 @@ import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
|
||||
public class OnlineActivity extends CommonActivity {
|
||||
private final String TAG = this.getClass().getSimpleName();
|
||||
|
||||
@ -69,7 +67,7 @@ public class OnlineActivity extends CommonActivity {
|
||||
|
||||
private String m_lastImageHitTestUrl;
|
||||
|
||||
protected PullToRefreshAttacher m_pullToRefreshAttacher;
|
||||
//protected PullToRefreshAttacher m_pullToRefreshAttacher;
|
||||
|
||||
protected abstract class OnLoginFinishedListener {
|
||||
public abstract void OnLoginSuccess();
|
||||
@ -173,7 +171,7 @@ public class OnlineActivity extends CommonActivity {
|
||||
|
||||
setContentView(R.layout.login);
|
||||
|
||||
m_pullToRefreshAttacher = PullToRefreshAttacher.get(this);
|
||||
//m_pullToRefreshAttacher = PullToRefreshAttacher.get(this);
|
||||
|
||||
if (isOffline) {
|
||||
switchOfflineSuccess();
|
||||
@ -1036,7 +1034,7 @@ public class OnlineActivity extends CommonActivity {
|
||||
return true;
|
||||
case R.id.update_headlines:
|
||||
if (hf != null) {
|
||||
m_pullToRefreshAttacher.setRefreshing(true);
|
||||
//m_pullToRefreshAttacher.setRefreshing(true);
|
||||
hf.refresh(false);
|
||||
}
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user