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"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.fox.ttrss"
android:versionCode="114"
android:versionName="0.8.13" >
android:versionCode="115"
android:versionName="0.8.14" >
<uses-sdk
android:minSdkVersion="8"

View File

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

View File

@ -38,6 +38,9 @@ public class GlobalState extends Application {
out.putParcelable("gs:activeFeed", m_activeFeed);
out.putParcelable("gs:activeArticle", m_activeArticle);
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) {
@ -51,6 +54,9 @@ public class GlobalState extends Application {
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");
m_canUseProgress = in.getBoolean("gs:canUseProgress");
m_selectedArticleId = in.getInt("gs:selectedArticleId");
}
}

View File

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