hide actionbar when scrolling headlines on small devices

do not enable ACRA on debug builds
This commit is contained in:
Andrew Dolgov 2015-05-11 11:18:27 +03:00
parent 873c0c2cdc
commit 6a834e1486
8 changed files with 50 additions and 7 deletions

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.fox.ttrss" package="org.fox.ttrss"
android:versionCode="326" android:versionCode="327"
android:versionName="1.100" > android:versionName="1.101" >
<uses-sdk <uses-sdk
android:minSdkVersion="15" android:minSdkVersion="15"

View File

@ -221,6 +221,11 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe
m_list = (ListView)view.findViewById(R.id.feeds); m_list = (ListView)view.findViewById(R.id.feeds);
m_adapter = new FeedCategoryListAdapter(getActivity(), R.layout.feeds_row, (ArrayList<FeedCategory>)m_cats); 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 // TODO: better check
if (m_activity.findViewById(R.id.headlines_drawer) != null) { if (m_activity.findViewById(R.id.headlines_drawer) != null) {
try { try {

View File

@ -83,6 +83,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
public void onDrawerOpened(View drawerView) { public void onDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView); super.onDrawerOpened(drawerView);
getSupportActionBar().show();
invalidateOptionsMenu(); invalidateOptionsMenu();
} }

View File

@ -287,6 +287,11 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
m_list = (ListView)view.findViewById(R.id.feeds); 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) { if (m_enableParentBtn) {
View layout = inflater.inflate(R.layout.feeds_goback, m_list, false); View layout = inflater.inflate(R.layout.feeds_goback, m_list, false);

View File

@ -30,7 +30,10 @@ public class GlobalState extends Application {
@Override @Override
public final void onCreate() { public final void onCreate() {
super.onCreate(); super.onCreate();
if (!BuildConfig.DEBUG) {
ACRA.init(this); ACRA.init(this);
}
m_singleton = this; m_singleton = this;
} }

View File

@ -97,6 +97,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
private SwipeRefreshLayout m_swipeLayout; private SwipeRefreshLayout m_swipeLayout;
private int m_maxImageSize = 0; private int m_maxImageSize = 0;
private boolean m_compactLayoutMode = false; private boolean m_compactLayoutMode = false;
private int m_listPreviousVisibleItem;
public ArticleList getSelectedArticles() { public ArticleList getSelectedArticles() {
ArticleList tmp = new ArticleList(); ArticleList tmp = new ArticleList();
@ -369,6 +370,11 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
list.addFooterView(layout, null, false); 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); m_adapter = new ArticleListAdapter(getActivity(), R.layout.headlines_row, (ArrayList<Article>)m_articles);
list.setAdapter(m_adapter); list.setAdapter(m_adapter);
@ -1315,15 +1321,31 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
refresh(true); refresh(true);
} }
if (m_prefs.getBoolean("headlines_mark_read_scroll", false) && firstVisibleItem > 0 && !m_autoCatchupDisabled) { if (m_prefs.getBoolean("headlines_mark_read_scroll", false) && firstVisibleItem > (m_activity.isSmallScreen() ? 1 : 0) && !m_autoCatchupDisabled) {
Article a = m_articles.get(firstVisibleItem - 1); Article a = (Article) view.getItemAtPosition(firstVisibleItem - 1);
if (a != null && a.unread) { if (a != null && a.unread) {
Log.d(TAG, "title=" + a.title);
a.unread = false; a.unread = false;
m_readArticles.add(a); m_readArticles.add(a);
m_feed.unread--; 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 @Override

View File

@ -1,7 +1,6 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent">
android:fitsSystemWindows="true">
<android.support.v4.widget.DrawerLayout <android.support.v4.widget.DrawerLayout
android:id="@+id/headlines_drawer" android:id="@+id/headlines_drawer"

View File

@ -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>