diff --git a/src/org/fox/ttrss/HeadlinesFragment.java b/src/org/fox/ttrss/HeadlinesFragment.java index cb6effec..64254e4f 100644 --- a/src/org/fox/ttrss/HeadlinesFragment.java +++ b/src/org/fox/ttrss/HeadlinesFragment.java @@ -145,7 +145,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, //list.setEmptyView(view.findViewById(R.id.no_headlines)); registerForContextMenu(list); - if (m_onlineServices.isSmallScreen()) + if (m_onlineServices.isSmallScreen() || m_onlineServices.getOrientation() % 2 != 0) view.findViewById(R.id.headlines_fragment).setPadding(0, 0, 0, 0); Log.d(TAG, "onCreateView, feed=" + m_feed); diff --git a/src/org/fox/ttrss/MainActivity.java b/src/org/fox/ttrss/MainActivity.java index 9760deb0..e8b8adc4 100644 --- a/src/org/fox/ttrss/MainActivity.java +++ b/src/org/fox/ttrss/MainActivity.java @@ -444,6 +444,11 @@ public class MainActivity extends FragmentActivity implements OnlineServices { return m_smallScreenMode; } + @Override + public int getOrientation() { + return getWindowManager().getDefaultDisplay().getOrientation(); + } + @Override public void onCreate(Bundle savedInstanceState) { initDatabase(); @@ -509,10 +514,8 @@ public class MainActivity extends FragmentActivity implements OnlineServices { if (!m_compatMode) { - if (!m_smallScreenMode) { - int orientation = getWindowManager().getDefaultDisplay().getOrientation(); - - findViewById(R.id.feeds_fragment).setVisibility(m_selectedArticle != null && orientation % 2 != 0 ? View.GONE : View.VISIBLE); + if (!m_smallScreenMode) { + findViewById(R.id.feeds_fragment).setVisibility(m_selectedArticle != null && getOrientation() % 2 != 0 ? View.GONE : View.VISIBLE); findViewById(R.id.article_fragment).setVisibility(m_selectedArticle != null ? View.VISIBLE : View.GONE); } @@ -1730,13 +1733,11 @@ public class MainActivity extends FragmentActivity implements OnlineServices { ft.hide(getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES)); ft.add(R.id.fragment_container, frag, FRAG_ARTICLE); } else { - int orientation = getWindowManager().getDefaultDisplay().getOrientation(); - - findViewById(R.id.feeds_fragment).setVisibility(orientation % 2 != 0 ? View.GONE : View.VISIBLE); + findViewById(R.id.feeds_fragment).setVisibility(getOrientation() % 2 != 0 ? View.GONE : View.VISIBLE); findViewById(R.id.article_fragment).setVisibility(View.VISIBLE); ft.replace(R.id.article_fragment, frag, FRAG_ARTICLE); - if (orientation % 2 == 0) refresh(); + if (getOrientation() % 2 == 0) refresh(); } ft.commit(); } diff --git a/src/org/fox/ttrss/OnlineServices.java b/src/org/fox/ttrss/OnlineServices.java index 7b3916da..8040e871 100644 --- a/src/org/fox/ttrss/OnlineServices.java +++ b/src/org/fox/ttrss/OnlineServices.java @@ -28,6 +28,7 @@ public interface OnlineServices { public boolean getUnreadOnly(); public int getApiLevel(); public void setSelectedArticle(Article article); + public int getOrientation(); public void copyToClipboard(String str); } diff --git a/src/org/fox/ttrss/offline/OfflineActivity.java b/src/org/fox/ttrss/offline/OfflineActivity.java index 62c6d08e..3164b493 100644 --- a/src/org/fox/ttrss/offline/OfflineActivity.java +++ b/src/org/fox/ttrss/offline/OfflineActivity.java @@ -149,9 +149,7 @@ public class OfflineActivity extends FragmentActivity implements if (!m_compatMode) { if (!m_smallScreenMode) { - int orientation = getWindowManager().getDefaultDisplay().getOrientation(); - - findViewById(R.id.feeds_fragment).setVisibility(m_selectedArticleId != 0 && orientation % 2 != 0 ? View.GONE : View.VISIBLE); + findViewById(R.id.feeds_fragment).setVisibility(m_selectedArticleId != 0 && getOrientation() % 2 != 0 ? View.GONE : View.VISIBLE); findViewById(R.id.article_fragment).setVisibility(m_selectedArticleId != 0 ? View.VISIBLE : View.GONE); } @@ -1300,4 +1298,9 @@ public class OfflineActivity extends FragmentActivity implements public boolean activeFeedIsCat() { return m_activeFeedIsCat; } + + @Override + public int getOrientation() { + return getWindowManager().getDefaultDisplay().getOrientation(); + } } \ No newline at end of file diff --git a/src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java b/src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java index 6dc9b94d..67d17939 100644 --- a/src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java +++ b/src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java @@ -149,7 +149,7 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis list.setEmptyView(view.findViewById(R.id.no_headlines)); registerForContextMenu(list); - if (m_offlineServices.isSmallScreen()) + if (m_offlineServices.isSmallScreen() || m_offlineServices.getOrientation() % 2 != 0) view.findViewById(R.id.headlines_fragment).setPadding(0, 0, 0, 0); getActivity().setProgressBarIndeterminateVisibility(false); diff --git a/src/org/fox/ttrss/offline/OfflineServices.java b/src/org/fox/ttrss/offline/OfflineServices.java index 993fb250..76a8a308 100644 --- a/src/org/fox/ttrss/offline/OfflineServices.java +++ b/src/org/fox/ttrss/offline/OfflineServices.java @@ -18,4 +18,5 @@ public interface OfflineServices { public boolean isSmallScreen(); public void setSelectedArticleId(int articleId); public boolean activeFeedIsCat(); + public int getOrientation(); }