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

@ -644,6 +644,8 @@ public class MainActivity extends CommonActivity implements OnlineServices {
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);
filter.addAction(OfflineUploadService.INTENT_ACTION_SUCCESS); filter.addAction(OfflineUploadService.INTENT_ACTION_SUCCESS);

View File

@ -290,6 +290,8 @@ public class OfflineActivity extends CommonActivity implements
setContentView(R.layout.main); setContentView(R.layout.main);
setSmallScreen(findViewById(R.id.headlines_fragment) == null);
if (!isCompatMode()) { if (!isCompatMode()) {
if (!isSmallScreen()) { if (!isSmallScreen()) {
findViewById(R.id.feeds_fragment).setVisibility(m_selectedArticleId != 0 && isPortrait() ? View.GONE : View.VISIBLE); findViewById(R.id.feeds_fragment).setVisibility(m_selectedArticleId != 0 && isPortrait() ? View.GONE : View.VISIBLE);