diff options
author | Andrew Dolgov <[email protected]> | 2015-05-11 11:18:27 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2015-05-11 11:18:27 +0300 |
commit | 6a834e148657d20e115010d1510cd09b171ff510 (patch) | |
tree | 1ba2752c580d131d4c4ea8ac129caa201474e793 /org.fox.ttrss | |
parent | 873c0c2cdc11792a5327308d6b6b062b2a94d2a2 (diff) |
hide actionbar when scrolling headlines on small devices
do not enable ACRA on debug builds
Diffstat (limited to 'org.fox.ttrss')
8 files changed, 50 insertions, 7 deletions
diff --git a/org.fox.ttrss/src/main/AndroidManifest.xml b/org.fox.ttrss/src/main/AndroidManifest.xml index d569cf72..9b4995d4 100755 --- a/org.fox.ttrss/src/main/AndroidManifest.xml +++ b/org.fox.ttrss/src/main/AndroidManifest.xml @@ -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="326" - android:versionName="1.100" > + android:versionCode="327" + android:versionName="1.101" > <uses-sdk android:minSdkVersion="15" diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedCategoriesFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedCategoriesFragment.java index eb97e66a..eb89e480 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedCategoriesFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedCategoriesFragment.java @@ -221,6 +221,11 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe m_list = (ListView)view.findViewById(R.id.feeds); m_adapter = new FeedCategoryListAdapter(getActivity(), R.layout.feeds_row, (ArrayList<FeedCategory>)m_cats); + if (m_activity.isSmallScreen()) { + View layout = inflater.inflate(R.layout.headlines_heading_spacer, m_list, false); + m_list.addHeaderView(layout); + } + // TODO: better check if (m_activity.findViewById(R.id.headlines_drawer) != null) { try { diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsActivity.java index 8b3251c8..a10c6045 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsActivity.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsActivity.java @@ -83,6 +83,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); + getSupportActionBar().show(); invalidateOptionsMenu(); } diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsFragment.java index 3ca1ce6e..b7f0bee6 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsFragment.java @@ -287,6 +287,11 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh m_list = (ListView)view.findViewById(R.id.feeds); + if (m_activity.isSmallScreen()) { + View layout = inflater.inflate(R.layout.headlines_heading_spacer, m_list, false); + m_list.addHeaderView(layout); + } + if (m_enableParentBtn) { View layout = inflater.inflate(R.layout.feeds_goback, m_list, false); diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/GlobalState.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/GlobalState.java index 7de77b69..0fc4decc 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/GlobalState.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/GlobalState.java @@ -30,7 +30,10 @@ public class GlobalState extends Application { @Override public final void onCreate() { super.onCreate(); - ACRA.init(this); + + if (!BuildConfig.DEBUG) { + ACRA.init(this); + } m_singleton = this; } diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesFragment.java index a7868b0e..eaa9dfca 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesFragment.java @@ -97,6 +97,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, private SwipeRefreshLayout m_swipeLayout; private int m_maxImageSize = 0; private boolean m_compactLayoutMode = false; + private int m_listPreviousVisibleItem; public ArticleList getSelectedArticles() { ArticleList tmp = new ArticleList(); @@ -369,6 +370,11 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, list.addFooterView(layout, null, false); } + if (m_activity.isSmallScreen()) { + View layout = inflater.inflate(R.layout.headlines_heading_spacer, list, false); + list.addHeaderView(layout); + } + m_adapter = new ArticleListAdapter(getActivity(), R.layout.headlines_row, (ArrayList<Article>)m_articles); list.setAdapter(m_adapter); @@ -1315,15 +1321,31 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, refresh(true); } - if (m_prefs.getBoolean("headlines_mark_read_scroll", false) && firstVisibleItem > 0 && !m_autoCatchupDisabled) { - Article a = m_articles.get(firstVisibleItem - 1); + if (m_prefs.getBoolean("headlines_mark_read_scroll", false) && firstVisibleItem > (m_activity.isSmallScreen() ? 1 : 0) && !m_autoCatchupDisabled) { + Article a = (Article) view.getItemAtPosition(firstVisibleItem - 1); if (a != null && a.unread) { + Log.d(TAG, "title=" + a.title); + a.unread = false; m_readArticles.add(a); m_feed.unread--; } } + + if (m_activity.isSmallScreen()) { + if (m_adapter.getCount() > 0) { + if (firstVisibleItem > m_listPreviousVisibleItem) { + m_activity.getSupportActionBar().hide(); + } else if (firstVisibleItem < m_listPreviousVisibleItem) { + m_activity.getSupportActionBar().show(); + } + } else { + m_activity.getSupportActionBar().show(); + } + + m_listPreviousVisibleItem = firstVisibleItem; + } } @Override diff --git a/org.fox.ttrss/src/main/res/layout/headlines.xml b/org.fox.ttrss/src/main/res/layout/headlines.xml index 226928d4..f1865cd3 100755 --- a/org.fox.ttrss/src/main/res/layout/headlines.xml +++ b/org.fox.ttrss/src/main/res/layout/headlines.xml @@ -1,7 +1,6 @@ <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" - android:layout_height="fill_parent" - android:fitsSystemWindows="true"> + android:layout_height="fill_parent"> <android.support.v4.widget.DrawerLayout android:id="@+id/headlines_drawer" diff --git a/org.fox.ttrss/src/main/res/layout/headlines_heading_spacer.xml b/org.fox.ttrss/src/main/res/layout/headlines_heading_spacer.xml new file mode 100644 index 00000000..73aa09e0 --- /dev/null +++ b/org.fox.ttrss/src/main/res/layout/headlines_heading_spacer.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> + +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/headlines_heading_spacer" + android:layout_width="fill_parent" + android:layout_height="?android:attr/actionBarSize"> + +</FrameLayout>
\ No newline at end of file |