set small screen mode based on loaded layout, instead of relying on

XLARGE screen size
This commit is contained in:
Andrew Dolgov 2012-09-01 23:51:38 +04:00
parent ee1a8f9a23
commit 43463ed572
3 changed files with 10 additions and 5 deletions

View File

@ -21,9 +21,14 @@ public class CommonActivity extends FragmentActivity {
private SQLiteDatabase m_readableDb; private SQLiteDatabase m_readableDb;
private SQLiteDatabase m_writableDb; private SQLiteDatabase m_writableDb;
private boolean m_smallScreenMode; private boolean m_smallScreenMode = true;
private boolean m_compatMode = false; private boolean m_compatMode = false;
protected void setSmallScreen(boolean smallScreen) {
Log.d(TAG, "m_smallScreenMode=" + smallScreen);
m_smallScreenMode = smallScreen;
}
private void initDatabase() { private void initDatabase() {
DatabaseHelper dh = new DatabaseHelper(getApplicationContext()); DatabaseHelper dh = new DatabaseHelper(getApplicationContext());
@ -54,10 +59,6 @@ public class CommonActivity extends FragmentActivity {
m_compatMode = android.os.Build.VERSION.SDK_INT <= 10; 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); Log.d(TAG, "m_compatMode=" + m_compatMode);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);

View File

@ -643,6 +643,8 @@ public class MainActivity extends CommonActivity implements OnlineServices {
m_enableCats = m_prefs.getBoolean("enable_cats", false); m_enableCats = m_prefs.getBoolean("enable_cats", false);
setContentView(R.layout.main); setContentView(R.layout.main);
setSmallScreen(findViewById(R.id.headlines_fragment) == null);
IntentFilter filter = new IntentFilter(); IntentFilter filter = new IntentFilter();
filter.addAction(OfflineDownloadService.INTENT_ACTION_SUCCESS); filter.addAction(OfflineDownloadService.INTENT_ACTION_SUCCESS);

View File

@ -289,6 +289,8 @@ public class OfflineActivity extends CommonActivity implements
m_enableCats = m_prefs.getBoolean("enable_cats", false); m_enableCats = m_prefs.getBoolean("enable_cats", false);
setContentView(R.layout.main); setContentView(R.layout.main);
setSmallScreen(findViewById(R.id.headlines_fragment) == null);
if (!isCompatMode()) { if (!isCompatMode()) {
if (!isSmallScreen()) { if (!isSmallScreen()) {