save more GlobalState stuff

This commit is contained in:
Andrew Dolgov 2012-11-30 20:21:31 +04:00
parent 98c4325d8b
commit 89ee4a84be
4 changed files with 15 additions and 9 deletions

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.fox.ttrss" package="org.fox.ttrss"
android:versionCode="114" android:versionCode="115"
android:versionName="0.8.13" > android:versionName="0.8.14" >
<uses-sdk <uses-sdk
android:minSdkVersion="8" android:minSdkVersion="8"

View File

@ -46,9 +46,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
setSmallScreen(findViewById(R.id.headlines_fragment) == null); setSmallScreen(findViewById(R.id.headlines_fragment) == null);
if (isSmallScreen()) { GlobalState.getInstance().load(savedInstanceState);
GlobalState.getInstance().load(savedInstanceState);
}
Intent intent = getIntent(); Intent intent = getIntent();
@ -250,9 +248,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
public void onSaveInstanceState(Bundle out) { public void onSaveInstanceState(Bundle out) {
super.onSaveInstanceState(out); super.onSaveInstanceState(out);
if (isSmallScreen()) { GlobalState.getInstance().save(out);
GlobalState.getInstance().save(out);
}
} }
@Override @Override

View File

@ -38,6 +38,9 @@ public class GlobalState extends Application {
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.putBoolean("gs:canUseProgress", m_canUseProgress);
out.putInt("gs:selectedArticleId", m_selectedArticleId);
} }
public void load(Bundle in) { public void load(Bundle in) {
@ -51,6 +54,9 @@ public class GlobalState extends Application {
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_canUseProgress = in.getBoolean("gs:canUseProgress");
m_selectedArticleId = in.getInt("gs:selectedArticleId");
} }
} }

View File

@ -44,6 +44,8 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL
} }
setSmallScreen(findViewById(R.id.headlines_fragment) == null); setSmallScreen(findViewById(R.id.headlines_fragment) == null);
GlobalState.getInstance().load(savedInstanceState);
if (isPortrait()) { if (isPortrait()) {
findViewById(R.id.headlines_fragment).setVisibility(View.GONE); findViewById(R.id.headlines_fragment).setVisibility(View.GONE);
@ -114,7 +116,9 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL
@Override @Override
public void onSaveInstanceState(Bundle out) { public void onSaveInstanceState(Bundle out) {
super.onSaveInstanceState(out); super.onSaveInstanceState(out);
GlobalState.getInstance().save(out);
} }
@Override @Override