From 43463ed572d43a97b557a16588ea5edc5dc3eb5c Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 1 Sep 2012 23:51:38 +0400 Subject: [PATCH] set small screen mode based on loaded layout, instead of relying on XLARGE screen size --- src/org/fox/ttrss/CommonActivity.java | 11 ++++++----- src/org/fox/ttrss/MainActivity.java | 2 ++ src/org/fox/ttrss/offline/OfflineActivity.java | 2 ++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/org/fox/ttrss/CommonActivity.java b/src/org/fox/ttrss/CommonActivity.java index 57de0cf3..e39115da 100644 --- a/src/org/fox/ttrss/CommonActivity.java +++ b/src/org/fox/ttrss/CommonActivity.java @@ -21,9 +21,14 @@ public class CommonActivity extends FragmentActivity { private SQLiteDatabase m_readableDb; private SQLiteDatabase m_writableDb; - private boolean m_smallScreenMode; + private boolean m_smallScreenMode = true; private boolean m_compatMode = false; + protected void setSmallScreen(boolean smallScreen) { + Log.d(TAG, "m_smallScreenMode=" + smallScreen); + m_smallScreenMode = smallScreen; + } + private void initDatabase() { DatabaseHelper dh = new DatabaseHelper(getApplicationContext()); @@ -54,10 +59,6 @@ public class CommonActivity extends FragmentActivity { m_compatMode = android.os.Build.VERSION.SDK_INT <= 10; - m_smallScreenMode = m_compatMode || (getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) != - Configuration.SCREENLAYOUT_SIZE_XLARGE; - - Log.d(TAG, "m_smallScreenMode=" + m_smallScreenMode); Log.d(TAG, "m_compatMode=" + m_compatMode); super.onCreate(savedInstanceState); diff --git a/src/org/fox/ttrss/MainActivity.java b/src/org/fox/ttrss/MainActivity.java index bb8620af..ce49b77a 100644 --- a/src/org/fox/ttrss/MainActivity.java +++ b/src/org/fox/ttrss/MainActivity.java @@ -643,6 +643,8 @@ public class MainActivity extends CommonActivity implements OnlineServices { m_enableCats = m_prefs.getBoolean("enable_cats", false); setContentView(R.layout.main); + + setSmallScreen(findViewById(R.id.headlines_fragment) == null); IntentFilter filter = new IntentFilter(); filter.addAction(OfflineDownloadService.INTENT_ACTION_SUCCESS); diff --git a/src/org/fox/ttrss/offline/OfflineActivity.java b/src/org/fox/ttrss/offline/OfflineActivity.java index c26c4904..49864a7c 100644 --- a/src/org/fox/ttrss/offline/OfflineActivity.java +++ b/src/org/fox/ttrss/offline/OfflineActivity.java @@ -289,6 +289,8 @@ public class OfflineActivity extends CommonActivity implements m_enableCats = m_prefs.getBoolean("enable_cats", false); setContentView(R.layout.main); + + setSmallScreen(findViewById(R.id.headlines_fragment) == null); if (!isCompatMode()) { if (!isSmallScreen()) {