diff --git a/org.fox.ttrss/build.gradle b/org.fox.ttrss/build.gradle index dd635f19..08bd180b 100644 --- a/org.fox.ttrss/build.gradle +++ b/org.fox.ttrss/build.gradle @@ -6,7 +6,7 @@ android { defaultConfig { applicationId "org.fox.ttrss" - minSdkVersion 16 + minSdkVersion 15 targetSdkVersion 21 } diff --git a/org.fox.ttrss/src/main/AndroidManifest.xml b/org.fox.ttrss/src/main/AndroidManifest.xml index c6eed360..60e444ae 100644 --- a/org.fox.ttrss/src/main/AndroidManifest.xml +++ b/org.fox.ttrss/src/main/AndroidManifest.xml @@ -5,7 +5,7 @@ android:versionName="1.86" > diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java index 541ed28c..da8624b6 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java @@ -156,9 +156,7 @@ public class ArticleFragment extends Fragment { //m_fsviewShown = savedInstanceState.getBoolean("fsviewShown"); } - boolean useTitleWebView = m_prefs.getBoolean("article_compat_view", false); - - View view = inflater.inflate(useTitleWebView ? R.layout.article_fragment_compat : R.layout.article_fragment, container, false); + View view = inflater.inflate(R.layout.article_fragment, container, false); /* if (m_fsviewShown) { view.findViewById(R.id.article_fullscreen_video).setVisibility(View.VISIBLE); @@ -311,7 +309,7 @@ public class ArticleFragment extends Fragment { boolean acceleratedWebview = true; // prevent flicker in ics - if (!m_prefs.getBoolean("webview_hardware_accel", true) || useTitleWebView) { + if (!m_prefs.getBoolean("webview_hardware_accel", true)) { if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) { m_web.setLayerType(View.LAYER_TYPE_SOFTWARE, null); acceleratedWebview = false; @@ -373,10 +371,6 @@ public class ArticleFragment extends Fragment { "" + "" + articleContent; - if (useTitleWebView) { - content += "

 

 

 

 

"; - } - if (m_article.attachments != null && m_article.attachments.size() != 0) { String flatContent = articleContent.replaceAll("[\r\n]", ""); boolean hasImages = flatContent.matches(".*?+].*?"); diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineArticleFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineArticleFragment.java index 3b2064d7..2fb2dc78 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineArticleFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineArticleFragment.java @@ -121,9 +121,7 @@ public class OfflineArticleFragment extends Fragment { m_articleId = savedInstanceState.getInt("articleId"); } - boolean useTitleWebView = m_prefs.getBoolean("article_compat_view", false); - - View view = inflater.inflate(useTitleWebView ? R.layout.article_fragment_compat : R.layout.article_fragment, container, false); + View view = inflater.inflate(R.layout.article_fragment, container, false); m_cursor = m_activity.getReadableDb().query("articles LEFT JOIN feeds ON (feed_id = feeds."+BaseColumns._ID+")", new String[] { "articles.*", "feeds.title AS feed_title" }, "articles." + BaseColumns._ID + "=?", @@ -134,35 +132,33 @@ public class OfflineArticleFragment extends Fragment { if (m_cursor.isFirst()) { final String link = m_cursor.getString(m_cursor.getColumnIndex("link")); - if (!useTitleWebView) { - View scrollView = view.findViewById(R.id.article_scrollview); - View fab = view.findViewById(R.id.article_fab); + View scrollView = view.findViewById(R.id.article_scrollview); + View fab = view.findViewById(R.id.article_fab); - if (scrollView != null && fab != null) { - if (m_prefs.getBoolean("enable_article_fab", true)) { - scrollView.setOnTouchListener(new ShowHideOnScroll(fab)); + if (scrollView != null && fab != null) { + if (m_prefs.getBoolean("enable_article_fab", true)) { + scrollView.setOnTouchListener(new ShowHideOnScroll(fab)); - fab.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View view) { - try { - URL url = new URL(link.trim()); - String uri = new URI(url.getProtocol(), url.getUserInfo(), url.getHost(), - url.getPort(), url.getPath(), url.getQuery(), url.getRef()).toString(); - Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri)); - startActivity(intent); - } catch (Exception e) { - e.printStackTrace(); - m_activity.toast(R.string.error_other_error); - } + fab.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View view) { + try { + URL url = new URL(link.trim()); + String uri = new URI(url.getProtocol(), url.getUserInfo(), url.getHost(), + url.getPort(), url.getPath(), url.getQuery(), url.getRef()).toString(); + Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri)); + startActivity(intent); + } catch (Exception e) { + e.printStackTrace(); + m_activity.toast(R.string.error_other_error); } - }); - } else { - fab.setVisibility(View.GONE); - } + } + }); + } else { + fab.setVisibility(View.GONE); } - } - + } + int articleFontSize = Integer.parseInt(m_prefs.getString("article_font_size_sp", "16")); int articleSmallFontSize = Math.max(10, Math.min(18, articleFontSize - 2)); @@ -243,7 +239,7 @@ public class OfflineArticleFragment extends Fragment { }); // prevent flicker in ics - if (!m_prefs.getBoolean("webview_hardware_accel", true) || useTitleWebView) { + if (!m_prefs.getBoolean("webview_hardware_accel", true)) { if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) { web.setLayerType(View.LAYER_TYPE_SOFTWARE, null); } @@ -321,10 +317,6 @@ public class OfflineArticleFragment extends Fragment { "" + "" + articleContent; - if (useTitleWebView) { - content += "

 

 

 

 

"; - } - content += ""; try { diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/util/TitleWebView.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/util/TitleWebView.java deleted file mode 100644 index 4d97918e..00000000 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/util/TitleWebView.java +++ /dev/null @@ -1,91 +0,0 @@ -package org.fox.ttrss.util; - -// http://www.techques.com/question/1-9718245/Webview-in-Scrollview - -import android.content.Context; -import android.graphics.Canvas; -import android.util.AttributeSet; -import android.view.MotionEvent; -import android.view.View; -import android.webkit.WebView; - -public class TitleWebView extends WebView{ - - public TitleWebView(Context context, AttributeSet attrs){ - super(context, attrs); - } - - private int titleHeight; - - @Override - protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec){ - super.onMeasure(widthMeasureSpec, heightMeasureSpec); - // determine height of title bar - View title = getChildAt(0); - titleHeight = title==null ? 0 : title.getMeasuredHeight(); - } - - @Override - public boolean onInterceptTouchEvent(MotionEvent ev){ - return true; // don't pass our touch events to children (title bar), we send these in dispatchTouchEvent - } - - private boolean touchInTitleBar; - @Override - public boolean dispatchTouchEvent(MotionEvent me){ - - boolean wasInTitle = false; - switch(me.getActionMasked()){ - case MotionEvent.ACTION_DOWN: - touchInTitleBar = (me.getY() <= visibleTitleHeight()); - break; - - case MotionEvent.ACTION_UP: - case MotionEvent.ACTION_CANCEL: - wasInTitle = touchInTitleBar; - touchInTitleBar = false; - break; - } - if(touchInTitleBar || wasInTitle) { - View title = getChildAt(0); - if(title!=null) { - // this touch belongs to title bar, dispatch it here - me.offsetLocation(0, getScrollY()); - return title.dispatchTouchEvent(me); - } - } - // this is our touch, offset and process - me.offsetLocation(0, -titleHeight); - return super.dispatchTouchEvent(me); - } - - /** - * @return visible height of title (may return negative values) - */ - private int visibleTitleHeight(){ - return titleHeight-getScrollY(); - } - - @Override - protected void onScrollChanged(int l, int t, int oldl, int oldt){ - super.onScrollChanged(l, t, oldl, oldt); - View title = getChildAt(0); - if(title!=null) // undo horizontal scroll, so that title scrolls only vertically - title.offsetLeftAndRight(l - title.getLeft()); - } - - @Override - protected void onDraw(Canvas c){ - - c.save(); - int tH = visibleTitleHeight(); - if(tH>0) { - // clip so that it doesn't clear background under title bar - int sx = getScrollX(), sy = getScrollY(); - c.clipRect(sx, sy+tH, sx+getWidth(), sy+getHeight()); - } - c.translate(0, titleHeight); - super.onDraw(c); - c.restore(); - } - } diff --git a/org.fox.ttrss/src/main/res/layout/article_fragment_compat.xml b/org.fox.ttrss/src/main/res/layout/article_fragment_compat.xml deleted file mode 100644 index 1a9c74ed..00000000 --- a/org.fox.ttrss/src/main/res/layout/article_fragment_compat.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/org.fox.ttrss/src/main/res/xml/preferences.xml b/org.fox.ttrss/src/main/res/xml/preferences.xml index 290a08e2..d37cef41 100644 --- a/org.fox.ttrss/src/main/res/xml/preferences.xml +++ b/org.fox.ttrss/src/main/res/xml/preferences.xml @@ -173,11 +173,6 @@ android:title="@string/offline_image_cache_enabled" /> -