properly detect portrait orientation
move to ICS style of naming resources for various dpi bump version
This commit is contained in:
parent
77352728e7
commit
b826481001
@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.fox.ttrss"
|
||||
android:versionCode="87"
|
||||
android:versionName="0.6.11" >
|
||||
android:versionCode="88"
|
||||
android:versionName="0.6.12" >
|
||||
|
||||
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="11" />
|
||||
|
||||
|
@ -7,6 +7,7 @@ import android.database.sqlite.SQLiteDatabase;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.util.Log;
|
||||
import android.view.Display;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class CommonActivity extends FragmentActivity {
|
||||
@ -70,8 +71,13 @@ public class CommonActivity extends FragmentActivity {
|
||||
return m_compatMode;
|
||||
}
|
||||
|
||||
public int getOrientation() {
|
||||
return getWindowManager().getDefaultDisplay().getOrientation();
|
||||
public boolean isPortrait() {
|
||||
Display display = getWindowManager().getDefaultDisplay();
|
||||
|
||||
int width = display.getWidth();
|
||||
int height = display.getHeight();
|
||||
|
||||
return width < height;
|
||||
}
|
||||
|
||||
public void copyToClipboard(String str) {
|
||||
|
@ -146,7 +146,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
||||
//list.setEmptyView(view.findViewById(R.id.no_headlines));
|
||||
registerForContextMenu(list);
|
||||
|
||||
if (m_onlineServices.isSmallScreen() || m_onlineServices.getOrientation() % 2 != 0)
|
||||
if (m_onlineServices.isSmallScreen() || m_onlineServices.isPortrait())
|
||||
view.findViewById(R.id.headlines_fragment).setPadding(0, 0, 0, 0);
|
||||
|
||||
Log.d(TAG, "onCreateView, feed=" + m_feed);
|
||||
|
@ -660,7 +660,7 @@ public class MainActivity extends CommonActivity implements OnlineServices {
|
||||
if (!isCompatMode()) {
|
||||
|
||||
if (!isSmallScreen()) {
|
||||
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 && isPortrait() ? View.GONE : View.VISIBLE);
|
||||
findViewById(R.id.article_fragment).setVisibility(m_selectedArticle != null ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
@ -1414,7 +1414,7 @@ public class MainActivity extends CommonActivity implements OnlineServices {
|
||||
|
||||
m_navigationAdapter.clear();
|
||||
|
||||
if (m_activeCategory != null || (m_activeFeed != null && (isSmallScreen() || getOrientation() % 2 != 0))) {
|
||||
if (m_activeCategory != null || (m_activeFeed != null && (isSmallScreen() || isPortrait()))) {
|
||||
getActionBar().setDisplayShowTitleEnabled(false);
|
||||
getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
|
||||
|
||||
@ -1862,11 +1862,11 @@ public class MainActivity extends CommonActivity implements OnlineServices {
|
||||
ft.hide(getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES));
|
||||
ft.add(R.id.fragment_container, frag, FRAG_ARTICLE);
|
||||
} else {
|
||||
findViewById(R.id.feeds_fragment).setVisibility(getOrientation() % 2 != 0 ? View.GONE : View.VISIBLE);
|
||||
findViewById(R.id.feeds_fragment).setVisibility(isPortrait() ? View.GONE : View.VISIBLE);
|
||||
findViewById(R.id.article_fragment).setVisibility(View.VISIBLE);
|
||||
ft.replace(R.id.article_fragment, frag, FRAG_ARTICLE);
|
||||
|
||||
if (getOrientation() % 2 == 0) refresh();
|
||||
if (!isPortrait()) refresh();
|
||||
}
|
||||
ft.commit();
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ public interface OnlineServices {
|
||||
public boolean isSmallScreen();
|
||||
public boolean getUnreadOnly();
|
||||
public int getApiLevel();
|
||||
public int getOrientation();
|
||||
public boolean isPortrait();
|
||||
|
||||
public void copyToClipboard(String str);
|
||||
}
|
||||
|
@ -292,7 +292,7 @@ public class OfflineActivity extends CommonActivity implements
|
||||
|
||||
if (!isCompatMode()) {
|
||||
if (!isSmallScreen()) {
|
||||
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 && isPortrait() ? View.GONE : View.VISIBLE);
|
||||
findViewById(R.id.article_fragment).setVisibility(m_selectedArticleId != 0 ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
@ -1397,7 +1397,7 @@ public class OfflineActivity extends CommonActivity implements
|
||||
ft.hide(getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES));
|
||||
ft.add(R.id.fragment_container, frag, FRAG_ARTICLE);
|
||||
} else {
|
||||
findViewById(R.id.feeds_fragment).setVisibility(getOrientation() % 2 != 0 ? View.GONE : View.VISIBLE);
|
||||
findViewById(R.id.feeds_fragment).setVisibility(isPortrait() ? View.GONE : View.VISIBLE);
|
||||
findViewById(R.id.article_fragment).setVisibility(View.VISIBLE);
|
||||
ft.replace(R.id.article_fragment, frag, FRAG_ARTICLE);
|
||||
|
||||
@ -1445,7 +1445,7 @@ public class OfflineActivity extends CommonActivity implements
|
||||
|
||||
m_navigationAdapter.clear();
|
||||
|
||||
if (m_activeCatId != -1 || (m_activeFeedId != 0 && (isSmallScreen() || getOrientation() % 2 != 0))) {
|
||||
if (m_activeCatId != -1 || (m_activeFeedId != 0 && (isSmallScreen() || isPortrait()))) {
|
||||
getActionBar().setDisplayShowTitleEnabled(false);
|
||||
getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
|
||||
|
||||
|
@ -150,7 +150,7 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
|
||||
list.setEmptyView(view.findViewById(R.id.no_headlines));
|
||||
registerForContextMenu(list);
|
||||
|
||||
if (m_offlineServices.isSmallScreen() || m_offlineServices.getOrientation() % 2 != 0)
|
||||
if (m_offlineServices.isSmallScreen() || m_offlineServices.isPortrait())
|
||||
view.findViewById(R.id.headlines_fragment).setPadding(0, 0, 0, 0);
|
||||
|
||||
getActivity().setProgressBarIndeterminateVisibility(false);
|
||||
|
@ -18,5 +18,5 @@ public interface OfflineServices {
|
||||
public boolean isSmallScreen();
|
||||
public void setSelectedArticleId(int articleId);
|
||||
public boolean activeFeedIsCat();
|
||||
public int getOrientation();
|
||||
public boolean isPortrait();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user