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 Normal file → Executable file
View File

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

View File

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

View File

@ -6,7 +6,6 @@ import android.os.Bundle;
import org.acra.ACRA;
import org.acra.ReportingInteractionMode;
import org.acra.annotation.ReportsCrashes;
import org.fox.ttrss.types.Feed;
@ReportsCrashes(formKey = "", mode = ReportingInteractionMode.DIALOG,
excludeMatchingSharedPreferencesKeys = {"password"},
resDialogText = R.string.crash_dialog_text,
@ -15,7 +14,7 @@ public class GlobalState extends Application {
private static GlobalState m_singleton;
//public ArticleList m_loadedArticles = new ArticleList();
public Feed m_activeFeed;
//public Feed m_activeFeed;
//public Article m_activeArticle;
public int m_selectedArticleId;
public String m_sessionId;
@ -38,7 +37,7 @@ public class GlobalState extends Application {
out.setClassLoader(getClass().getClassLoader());
//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.putString("gs:sessionId", m_sessionId);
out.putInt("gs:apiLevel", m_apiLevel);
@ -54,7 +53,7 @@ public class GlobalState extends Application {
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_sessionId = in.getString("gs:sessionId");
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);
return view;
return view;
}
@Override
@ -385,15 +385,23 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
if (m_activeArticle != null) {
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) {
refresh(false);
GlobalState.getInstance().m_activeFeed = m_feed;
}
} else {
notifyUpdated();
}
} */
m_activity.invalidateOptionsMenu();
}
@ -440,9 +448,9 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
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;
}
} */
// new stuff may appear on top, scroll back to show it
if (!append) {

View File

@ -1,7 +1,6 @@
package org.fox.ttrss.util;
import android.content.Context;
import android.util.Log;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
@ -9,7 +8,6 @@ import com.google.gson.JsonElement;
import com.google.gson.reflect.TypeToken;
import org.fox.ttrss.ApiRequest;
import org.fox.ttrss.GlobalState;
import org.fox.ttrss.OnlineActivity;
import org.fox.ttrss.types.Article;
import org.fox.ttrss.types.ArticleList;
@ -42,10 +40,10 @@ public class HeadlinesRequest extends ApiRequest {
try {
// 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.");
return;
}
} */
JsonArray content = result.getAsJsonArray();
if (content != null) {