fix smallscreenmode being enabled in portrait
This commit is contained in:
parent
084b059577
commit
2e5bccb942
@ -25,7 +25,7 @@
|
|||||||
<item android:id="@+id/show_all_articles"
|
<item android:id="@+id/show_all_articles"
|
||||||
android:icon="@android:drawable/ic_menu_agenda"
|
android:icon="@android:drawable/ic_menu_agenda"
|
||||||
android:title="@string/show_all_articles"
|
android:title="@string/show_all_articles"
|
||||||
android:showAsAction="ifRoom|withText"/>
|
android:showAsAction=""/>
|
||||||
|
|
||||||
<item android:id="@+id/update_feeds"
|
<item android:id="@+id/update_feeds"
|
||||||
android:icon="@android:drawable/ic_menu_rotate"
|
android:icon="@android:drawable/ic_menu_rotate"
|
||||||
|
@ -110,18 +110,23 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
|
|||||||
m_canLoadMore = savedInstanceState.getBoolean("canLoadMore");
|
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;
|
m_smallScreenMode = false;
|
||||||
|
|
||||||
setContentView(R.layout.main);
|
setContentView(R.layout.main);
|
||||||
} else {
|
} else {
|
||||||
m_smallScreenMode = true;
|
m_smallScreenMode = true;
|
||||||
|
|
||||||
setContentView(R.layout.main_small);
|
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) {
|
if (android.os.Build.VERSION.SDK_INT > 10) {
|
||||||
LayoutTransition transitioner = new LayoutTransition();
|
LayoutTransition transitioner = new LayoutTransition();
|
||||||
|
Loading…
Reference in New Issue
Block a user