remove globalstate.activefeedid

This commit is contained in:
Andrew Dolgov 2015-02-12 12:09:52 +03:00
parent f46552126a
commit da2428b6da
5 changed files with 25 additions and 20 deletions

2
.idea/gradle.xml generated Normal file → Executable file
View File

@ -3,7 +3,7 @@
<component name="GradleSettings"> <component name="GradleSettings">
<option name="linkedExternalProjectsSettings"> <option name="linkedExternalProjectsSettings">
<GradleProjectSettings> <GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" /> <option name="distributionType" value="LOCAL" />
<option name="externalProjectPath" value="$PROJECT_DIR$" /> <option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="C:\Users\fox\android-studio\gradle\gradle-2.2.1" /> <option name="gradleHome" value="C:\Users\fox\android-studio\gradle\gradle-2.2.1" />
<option name="modules"> <option name="modules">

View File

@ -141,9 +141,9 @@ public class ArticlePager extends Fragment {
@SuppressWarnings({ "serial" }) @SuppressWarnings({ "serial" })
protected void refresh(boolean append) { protected void refresh(boolean append) {
if (!m_feed.equals(GlobalState.getInstance().m_activeFeed)) { /* if (!m_feed.equals(GlobalState.getInstance().m_activeFeed)) {
append = false; append = false;
} } */
HeadlinesRequest req = new HeadlinesRequest(getActivity().getApplicationContext(), m_activity, m_feed, m_articles) { HeadlinesRequest req = new HeadlinesRequest(getActivity().getApplicationContext(), m_activity, m_feed, m_articles) {
@Override @Override
@ -277,10 +277,10 @@ public class ArticlePager extends Fragment {
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
if (m_articles.size() == 0 || !m_feed.equals(GlobalState.getInstance().m_activeFeed)) { /* if (m_articles.size() == 0 || !m_feed.equals(GlobalState.getInstance().m_activeFeed)) {
refresh(false); refresh(false);
GlobalState.getInstance().m_activeFeed = m_feed; GlobalState.getInstance().m_activeFeed = m_feed;
} } */
m_activity.invalidateOptionsMenu(); m_activity.invalidateOptionsMenu();

View File

@ -6,7 +6,6 @@ import android.os.Bundle;
import org.acra.ACRA; import org.acra.ACRA;
import org.acra.ReportingInteractionMode; import org.acra.ReportingInteractionMode;
import org.acra.annotation.ReportsCrashes; import org.acra.annotation.ReportsCrashes;
import org.fox.ttrss.types.Feed;
@ReportsCrashes(formKey = "", mode = ReportingInteractionMode.DIALOG, @ReportsCrashes(formKey = "", mode = ReportingInteractionMode.DIALOG,
excludeMatchingSharedPreferencesKeys = {"password"}, excludeMatchingSharedPreferencesKeys = {"password"},
resDialogText = R.string.crash_dialog_text, resDialogText = R.string.crash_dialog_text,
@ -15,7 +14,7 @@ public class GlobalState extends Application {
private static GlobalState m_singleton; private static GlobalState m_singleton;
//public ArticleList m_loadedArticles = new ArticleList(); //public ArticleList m_loadedArticles = new ArticleList();
public Feed m_activeFeed; //public Feed m_activeFeed;
//public Article m_activeArticle; //public Article m_activeArticle;
public int m_selectedArticleId; public int m_selectedArticleId;
public String m_sessionId; public String m_sessionId;
@ -38,7 +37,7 @@ public class GlobalState extends Application {
out.setClassLoader(getClass().getClassLoader()); out.setClassLoader(getClass().getClassLoader());
//out.putParcelableArrayList("gs:loadedArticles", m_loadedArticles); //out.putParcelableArrayList("gs:loadedArticles", m_loadedArticles);
out.putParcelable("gs:activeFeed", m_activeFeed); //out.putParcelable("gs:activeFeed", m_activeFeed);
//out.putParcelable("gs:activeArticle", m_activeArticle); //out.putParcelable("gs:activeArticle", m_activeArticle);
out.putString("gs:sessionId", m_sessionId); out.putString("gs:sessionId", m_sessionId);
out.putInt("gs:apiLevel", m_apiLevel); out.putInt("gs:apiLevel", m_apiLevel);
@ -54,7 +53,7 @@ public class GlobalState extends Application {
m_loadedArticles.add((Article)p); m_loadedArticles.add((Article)p);
} */ } */
m_activeFeed = (Feed) in.getParcelable("gs:activeFeed"); //m_activeFeed = (Feed) in.getParcelable("gs:activeFeed");
//m_activeArticle = (Article) in.getParcelable("gs:activeArticle"); //m_activeArticle = (Article) in.getParcelable("gs:activeArticle");
m_sessionId = in.getString("gs:sessionId"); m_sessionId = in.getString("gs:sessionId");
m_apiLevel = in.getInt("gs:apiLevel"); m_apiLevel = in.getInt("gs:apiLevel");

View File

@ -369,8 +369,8 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
} }
Log.d(TAG, "onCreateView, feed=" + m_feed); Log.d(TAG, "onCreateView, feed=" + m_feed);
return view; return view;
} }
@Override @Override
@ -385,15 +385,23 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
if (m_activeArticle != null) { if (m_activeArticle != null) {
setActiveArticle(m_activeArticle); setActiveArticle(m_activeArticle);
} }
if (m_articles.size() == 0 || !m_feed.equals(GlobalState.getInstance().m_activeFeed)) { /* if (!(m_activity instanceof HeadlinesActivity)) {
refresh(false);
} */
if (m_articles.size() == 0) {
refresh(false);
}
/* if (m_articles.size() == 0 || !m_feed.equals(GlobalState.getInstance().m_activeFeed)) {
if (m_activity.getSupportFragmentManager().findFragmentByTag(CommonActivity.FRAG_ARTICLE) == null) { if (m_activity.getSupportFragmentManager().findFragmentByTag(CommonActivity.FRAG_ARTICLE) == null) {
refresh(false); refresh(false);
GlobalState.getInstance().m_activeFeed = m_feed; GlobalState.getInstance().m_activeFeed = m_feed;
} }
} else { } else {
notifyUpdated(); notifyUpdated();
} } */
m_activity.invalidateOptionsMenu(); m_activity.invalidateOptionsMenu();
} }
@ -440,9 +448,9 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
if (m_swipeLayout != null) m_swipeLayout.setRefreshing(true); if (m_swipeLayout != null) m_swipeLayout.setRefreshing(true);
if (!m_feed.equals(GlobalState.getInstance().m_activeFeed)) { /* if (!m_feed.equals(GlobalState.getInstance().m_activeFeed)) {
append = false; append = false;
} } */
// new stuff may appear on top, scroll back to show it // new stuff may appear on top, scroll back to show it
if (!append) { if (!append) {

View File

@ -1,7 +1,6 @@
package org.fox.ttrss.util; package org.fox.ttrss.util;
import android.content.Context; import android.content.Context;
import android.util.Log;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.JsonArray; import com.google.gson.JsonArray;
@ -9,7 +8,6 @@ import com.google.gson.JsonElement;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import org.fox.ttrss.ApiRequest; import org.fox.ttrss.ApiRequest;
import org.fox.ttrss.GlobalState;
import org.fox.ttrss.OnlineActivity; import org.fox.ttrss.OnlineActivity;
import org.fox.ttrss.types.Article; import org.fox.ttrss.types.Article;
import org.fox.ttrss.types.ArticleList; import org.fox.ttrss.types.ArticleList;
@ -42,10 +40,10 @@ public class HeadlinesRequest extends ApiRequest {
try { try {
// check if we are returning results for correct feed // check if we are returning results for correct feed
if (GlobalState.getInstance().m_activeFeed != null && !m_feed.equals(GlobalState.getInstance().m_activeFeed)) { /* if (GlobalState.getInstance().m_activeFeed != null && !m_feed.equals(GlobalState.getInstance().m_activeFeed)) {
Log.d(TAG, "received results for wrong feed, bailing out."); Log.d(TAG, "received results for wrong feed, bailing out.");
return; return;
} } */
JsonArray content = result.getAsJsonArray(); JsonArray content = result.getAsJsonArray();
if (content != null) { if (content != null) {