adjust headlines left padding in vertical mode on tablets
add getOrientation()
This commit is contained in:
parent
fafdd4120a
commit
fbb131fa0c
@ -145,7 +145,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
//list.setEmptyView(view.findViewById(R.id.no_headlines));
|
//list.setEmptyView(view.findViewById(R.id.no_headlines));
|
||||||
registerForContextMenu(list);
|
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);
|
view.findViewById(R.id.headlines_fragment).setPadding(0, 0, 0, 0);
|
||||||
|
|
||||||
Log.d(TAG, "onCreateView, feed=" + m_feed);
|
Log.d(TAG, "onCreateView, feed=" + m_feed);
|
||||||
|
@ -444,6 +444,11 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
|
|||||||
return m_smallScreenMode;
|
return m_smallScreenMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getOrientation() {
|
||||||
|
return getWindowManager().getDefaultDisplay().getOrientation();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
initDatabase();
|
initDatabase();
|
||||||
@ -509,10 +514,8 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
|
|||||||
|
|
||||||
if (!m_compatMode) {
|
if (!m_compatMode) {
|
||||||
|
|
||||||
if (!m_smallScreenMode) {
|
if (!m_smallScreenMode) {
|
||||||
int orientation = getWindowManager().getDefaultDisplay().getOrientation();
|
findViewById(R.id.feeds_fragment).setVisibility(m_selectedArticle != null && getOrientation() % 2 != 0 ? View.GONE : View.VISIBLE);
|
||||||
|
|
||||||
findViewById(R.id.feeds_fragment).setVisibility(m_selectedArticle != null && orientation % 2 != 0 ? View.GONE : View.VISIBLE);
|
|
||||||
findViewById(R.id.article_fragment).setVisibility(m_selectedArticle != null ? View.VISIBLE : View.GONE);
|
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.hide(getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES));
|
||||||
ft.add(R.id.fragment_container, frag, FRAG_ARTICLE);
|
ft.add(R.id.fragment_container, frag, FRAG_ARTICLE);
|
||||||
} else {
|
} else {
|
||||||
int orientation = getWindowManager().getDefaultDisplay().getOrientation();
|
findViewById(R.id.feeds_fragment).setVisibility(getOrientation() % 2 != 0 ? View.GONE : View.VISIBLE);
|
||||||
|
|
||||||
findViewById(R.id.feeds_fragment).setVisibility(orientation % 2 != 0 ? View.GONE : View.VISIBLE);
|
|
||||||
findViewById(R.id.article_fragment).setVisibility(View.VISIBLE);
|
findViewById(R.id.article_fragment).setVisibility(View.VISIBLE);
|
||||||
ft.replace(R.id.article_fragment, frag, FRAG_ARTICLE);
|
ft.replace(R.id.article_fragment, frag, FRAG_ARTICLE);
|
||||||
|
|
||||||
if (orientation % 2 == 0) refresh();
|
if (getOrientation() % 2 == 0) refresh();
|
||||||
}
|
}
|
||||||
ft.commit();
|
ft.commit();
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ public interface OnlineServices {
|
|||||||
public boolean getUnreadOnly();
|
public boolean getUnreadOnly();
|
||||||
public int getApiLevel();
|
public int getApiLevel();
|
||||||
public void setSelectedArticle(Article article);
|
public void setSelectedArticle(Article article);
|
||||||
|
public int getOrientation();
|
||||||
|
|
||||||
public void copyToClipboard(String str);
|
public void copyToClipboard(String str);
|
||||||
}
|
}
|
||||||
|
@ -149,9 +149,7 @@ public class OfflineActivity extends FragmentActivity implements
|
|||||||
|
|
||||||
if (!m_compatMode) {
|
if (!m_compatMode) {
|
||||||
if (!m_smallScreenMode) {
|
if (!m_smallScreenMode) {
|
||||||
int orientation = getWindowManager().getDefaultDisplay().getOrientation();
|
findViewById(R.id.feeds_fragment).setVisibility(m_selectedArticleId != 0 && getOrientation() % 2 != 0 ? View.GONE : View.VISIBLE);
|
||||||
|
|
||||||
findViewById(R.id.feeds_fragment).setVisibility(m_selectedArticleId != 0 && orientation % 2 != 0 ? View.GONE : View.VISIBLE);
|
|
||||||
findViewById(R.id.article_fragment).setVisibility(m_selectedArticleId != 0 ? View.VISIBLE : View.GONE);
|
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() {
|
public boolean activeFeedIsCat() {
|
||||||
return m_activeFeedIsCat;
|
return m_activeFeedIsCat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getOrientation() {
|
||||||
|
return getWindowManager().getDefaultDisplay().getOrientation();
|
||||||
|
}
|
||||||
}
|
}
|
@ -149,7 +149,7 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
|
|||||||
list.setEmptyView(view.findViewById(R.id.no_headlines));
|
list.setEmptyView(view.findViewById(R.id.no_headlines));
|
||||||
registerForContextMenu(list);
|
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);
|
view.findViewById(R.id.headlines_fragment).setPadding(0, 0, 0, 0);
|
||||||
|
|
||||||
getActivity().setProgressBarIndeterminateVisibility(false);
|
getActivity().setProgressBarIndeterminateVisibility(false);
|
||||||
|
@ -18,4 +18,5 @@ public interface OfflineServices {
|
|||||||
public boolean isSmallScreen();
|
public boolean isSmallScreen();
|
||||||
public void setSelectedArticleId(int articleId);
|
public void setSelectedArticleId(int articleId);
|
||||||
public boolean activeFeedIsCat();
|
public boolean activeFeedIsCat();
|
||||||
|
public int getOrientation();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user