From df0c03abd8c30e70bcb5b79167f0919faefad0bf Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 7 Feb 2015 16:35:44 +0300 Subject: add fix for sidebar not showing/hiding properly on tablets because of activity not being recreated on orientation change (this is needed to restore webview/fsview state) --- .../main/java/org/fox/ttrss/HeadlinesActivity.java | 16 ++++++++- .../src/main/res/layout-sw600dp-port/headlines.xml | 36 ------------------- .../res/layout-sw600dp-port/headlines_articles.xml | 41 ++++++++++++++++++++++ .../res/layout-sw700dp-port/headlines_articles.xml | 36 ------------------- 4 files changed, 56 insertions(+), 73 deletions(-) delete mode 100644 org.fox.ttrss/src/main/res/layout-sw600dp-port/headlines.xml create mode 100644 org.fox.ttrss/src/main/res/layout-sw600dp-port/headlines_articles.xml delete mode 100644 org.fox.ttrss/src/main/res/layout-sw700dp-port/headlines_articles.xml (limited to 'org.fox.ttrss') diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesActivity.java index 4773535d..eef2fa08 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesActivity.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesActivity.java @@ -3,6 +3,7 @@ package org.fox.ttrss; import android.annotation.SuppressLint; import android.content.Intent; import android.content.SharedPreferences; +import android.content.res.Configuration; import android.os.Bundle; import android.os.Handler; import android.preference.PreferenceManager; @@ -39,6 +40,10 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL GlobalState.getInstance().load(savedInstanceState); + if (isPortrait() && !isSmallScreen()) { + findViewById(R.id.headlines_fragment).setVisibility(View.GONE); + } + if (savedInstanceState == null) { Intent i = getIntent(); @@ -99,6 +104,15 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL } } + @Override + public void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + + if (!isSmallScreen()) { + findViewById(R.id.headlines_fragment).setVisibility(isPortrait() ? View.GONE : View.VISIBLE); + } + } + @Override protected void refresh() { super.refresh(); @@ -223,7 +237,7 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL } public void showSidebar(boolean show) { - if (!isSmallScreen()) { + if (!isSmallScreen() && !isPortrait()) { findViewById(R.id.headlines_fragment).setVisibility(show ? View.VISIBLE : View.GONE); invalidateOptionsMenu(); } diff --git a/org.fox.ttrss/src/main/res/layout-sw600dp-port/headlines.xml b/org.fox.ttrss/src/main/res/layout-sw600dp-port/headlines.xml deleted file mode 100644 index 01737c68..00000000 --- a/org.fox.ttrss/src/main/res/layout-sw600dp-port/headlines.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/org.fox.ttrss/src/main/res/layout-sw600dp-port/headlines_articles.xml b/org.fox.ttrss/src/main/res/layout-sw600dp-port/headlines_articles.xml new file mode 100644 index 00000000..f4ff2c59 --- /dev/null +++ b/org.fox.ttrss/src/main/res/layout-sw600dp-port/headlines_articles.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/org.fox.ttrss/src/main/res/layout-sw700dp-port/headlines_articles.xml b/org.fox.ttrss/src/main/res/layout-sw700dp-port/headlines_articles.xml deleted file mode 100644 index 7ed80c18..00000000 --- a/org.fox.ttrss/src/main/res/layout-sw700dp-port/headlines_articles.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file -- cgit v1.2.3