Revert "switch to nestedscrollview provided by v4 support library"

This reverts commit b28fef66e8.
This commit is contained in:
Andrew Dolgov 2015-12-17 18:57:19 +03:00
parent d7f4c96701
commit 78d35a02e4
5 changed files with 68 additions and 25 deletions

View File

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.fox.ttrss"
android:versionCode="397"
android:versionName="1.165" >
android:versionCode="380"
android:versionName="1.152" >
<uses-sdk
android:minSdkVersion="16"
android:minSdkVersion="15"
android:targetSdkVersion="23" />
<uses-permission android:name="android.permission.INTERNET" />
@ -254,7 +254,6 @@
<activity
android:name=".ArticleImagesPagerActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="Article Images" >
</activity>
<activity

View File

@ -8,7 +8,6 @@ import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
import android.support.v4.widget.NestedScrollView;
import android.support.v7.app.ActionBar;
import android.text.Html;
import android.util.Log;
@ -27,13 +26,14 @@ import android.webkit.WebView.HitTestResult;
import android.webkit.WebViewClient;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ScrollView;
import android.widget.TextView;
import com.shamanland.fab.ShowHideOnScroll;
import org.fox.ttrss.types.Article;
import org.fox.ttrss.types.Attachment;
import org.fox.ttrss.util.NoChildFocusScrollView;
import org.fox.ttrss.util.NotifyingScrollView;
import java.net.MalformedURLException;
import java.net.URL;
@ -192,15 +192,15 @@ public class ArticleFragment extends Fragment {
return view;
}
NoChildFocusScrollView scrollView = (NoChildFocusScrollView) view.findViewById(R.id.article_scrollview);
NotifyingScrollView scrollView = (NotifyingScrollView) view.findViewById(R.id.article_scrollview);
m_fab = view.findViewById(R.id.article_fab);
if (scrollView != null && m_activity.isSmallScreen()) {
view.findViewById(R.id.article_heading_spacer).setVisibility(View.VISIBLE);
scrollView.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() {
scrollView.setOnScrollChangedListener(new NotifyingScrollView.OnScrollChangedListener() {
@Override
public void onScrollChange(NestedScrollView who, int l, int t, int oldl, int oldt) {
public void onScrollChanged(ScrollView who, int l, int t, int oldl, int oldt) {
ActionBar ab = m_activity.getSupportActionBar();
if (t >= oldt && t >= ab.getHeight()) {

View File

@ -9,7 +9,6 @@ import android.os.Bundle;
import android.preference.PreferenceManager;
import android.provider.BaseColumns;
import android.support.v4.app.Fragment;
import android.support.v4.widget.NestedScrollView;
import android.support.v7.app.ActionBar;
import android.util.Log;
import android.util.TypedValue;
@ -25,13 +24,14 @@ import android.webkit.WebView;
import android.webkit.WebView.HitTestResult;
import android.webkit.WebViewClient;
import android.widget.ImageView;
import android.widget.ScrollView;
import android.widget.TextView;
import com.shamanland.fab.ShowHideOnScroll;
import org.fox.ttrss.R;
import org.fox.ttrss.util.ImageCacheService;
import org.fox.ttrss.util.NoChildFocusScrollView;
import org.fox.ttrss.util.NotifyingScrollView;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
@ -134,25 +134,25 @@ public class OfflineArticleFragment extends Fragment {
if (m_cursor.isFirst()) {
final String link = m_cursor.getString(m_cursor.getColumnIndex("link"));
NoChildFocusScrollView scrollView = (NoChildFocusScrollView) view.findViewById(R.id.article_scrollview);
NotifyingScrollView scrollView = (NotifyingScrollView) view.findViewById(R.id.article_scrollview);
View fab = view.findViewById(R.id.article_fab);
if (scrollView != null && m_activity.isSmallScreen()) {
view.findViewById(R.id.article_heading_spacer).setVisibility(View.VISIBLE);
scrollView.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() {
@Override
public void onScrollChange(NestedScrollView who, int l, int t, int oldl, int oldt) {
ActionBar ab = m_activity.getSupportActionBar();
scrollView.setOnScrollChangedListener(new NotifyingScrollView.OnScrollChangedListener() {
@Override
public void onScrollChanged(ScrollView who, int l, int t, int oldl, int oldt) {
ActionBar ab = m_activity.getSupportActionBar();
if (t >= oldt && t >= ab.getHeight()) {
ab.hide();
} else if (t <= ab.getHeight() || oldt - t >= 10) {
ab.show();
}
if (t >= oldt && t >= ab.getHeight()) {
ab.hide();
} else if (t <= ab.getHeight() || oldt - t >= 10) {
ab.show();
}
}
});
}
});
}
if (scrollView != null && fab != null) {

View File

@ -1,13 +1,12 @@
package org.fox.ttrss.util;
import android.content.Context;
import android.support.v4.widget.NestedScrollView;
import android.util.AttributeSet;
import android.view.View;
import android.webkit.WebView;
import android.widget.ScrollView;
public class NoChildFocusScrollView extends NestedScrollView {
public class NoChildFocusScrollView extends NotifyingScrollView {
public NoChildFocusScrollView(Context context) {
super(context);

View File

@ -0,0 +1,45 @@
package org.fox.ttrss.util;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.ScrollView;
/**
* @author Cyril Mottier
*/
public class NotifyingScrollView extends ScrollView {
/**
* @author Cyril Mottier
*/
public interface OnScrollChangedListener {
void onScrollChanged(ScrollView who, int l, int t, int oldl, int oldt);
}
private OnScrollChangedListener mOnScrollChangedListener;
public NotifyingScrollView(Context context) {
super(context);
}
public NotifyingScrollView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public NotifyingScrollView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
protected void onScrollChanged(int l, int t, int oldl, int oldt) {
super.onScrollChanged(l, t, oldl, oldt);
if (mOnScrollChangedListener != null) {
mOnScrollChangedListener.onScrollChanged(this, l, t, oldl, oldt);
}
}
public void setOnScrollChangedListener(OnScrollChangedListener listener) {
mOnScrollChangedListener = listener;
}
}