From 71064b4edcf600ee354ceb6ce62b0608c3df0644 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 26 Jun 2012 09:28:30 +0400 Subject: [PATCH] offline: properly restore views after rotation add workaround against viewpager weirdness after rotation bump version --- AndroidManifest.xml | 4 ++-- src/org/fox/ttrss/MainActivity.java | 4 +++- src/org/fox/ttrss/offline/OfflineActivity.java | 13 +++++++++++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 3c886083..4ce70ecb 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="82" + android:versionName="0.6.6" > diff --git a/src/org/fox/ttrss/MainActivity.java b/src/org/fox/ttrss/MainActivity.java index 3596b0dc..82d905b8 100644 --- a/src/org/fox/ttrss/MainActivity.java +++ b/src/org/fox/ttrss/MainActivity.java @@ -680,8 +680,10 @@ public class MainActivity extends CommonActivity implements OnlineServices { if (isSmallScreen()) { FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); + // temporary workaround against viewpager going a bit crazy when restoring after rotation if (m_selectedArticle != null) { - ft.hide(getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES)); + ft.remove(getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE)); + m_selectedArticle = null; } if (m_activeFeed != null) { diff --git a/src/org/fox/ttrss/offline/OfflineActivity.java b/src/org/fox/ttrss/offline/OfflineActivity.java index acc05852..50c8971f 100644 --- a/src/org/fox/ttrss/offline/OfflineActivity.java +++ b/src/org/fox/ttrss/offline/OfflineActivity.java @@ -311,6 +311,17 @@ public class OfflineActivity extends CommonActivity implements findViewById(R.id.loading_container).setVisibility(View.GONE); + if (isSmallScreen()) { + FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); + + // temporary workaround against viewpager going a bit crazy when restoring after rotation + if (m_selectedArticleId != 0) { + ft.remove(getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE)); + m_selectedArticleId = 0; + } + ft.commit(); + } + if (m_activeFeedId == 0 && !m_activeFeedIsCat) { FragmentTransaction ft = getSupportFragmentManager() .beginTransaction(); @@ -334,6 +345,8 @@ public class OfflineActivity extends CommonActivity implements ft.commit(); } + + } private void switchOnline() {