fix smallscreenmode being enabled in portrait

This commit is contained in:
Andrew Dolgov 2011-11-26 18:04:54 +03:00
parent 084b059577
commit 2e5bccb942
2 changed files with 10 additions and 5 deletions

View File

@ -25,7 +25,7 @@
<item android:id="@+id/show_all_articles"
android:icon="@android:drawable/ic_menu_agenda"
android:title="@string/show_all_articles"
android:showAsAction="ifRoom|withText"/>
android:showAsAction=""/>
<item android:id="@+id/update_feeds"
android:icon="@android:drawable/ic_menu_rotate"

View File

@ -110,18 +110,23 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
m_canLoadMore = savedInstanceState.getBoolean("canLoadMore");
}
Display display = getWindowManager().getDefaultDisplay();
Display display = getWindowManager().getDefaultDisplay();
int orientation = display.getOrientation();
int minWidth = orientation == 0 ? 1024 : 600;
int minHeight = orientation == 0 ? 600 : 1024;
if (display.getWidth() > 1000 && display.getHeight() >= 600) {
if (display.getWidth() > minWidth && display.getHeight() >= minHeight) {
m_smallScreenMode = false;
setContentView(R.layout.main);
} else {
m_smallScreenMode = true;
setContentView(R.layout.main_small);
}
Log.d(TAG, "m_smallScreenMode=" + m_smallScreenMode);
Log.d(TAG, "orientation=" + display.getOrientation());
if (android.os.Build.VERSION.SDK_INT > 10) {
LayoutTransition transitioner = new LayoutTransition();