set minimum sdk level to 15

remove legacy article layout
This commit is contained in:
Andrew Dolgov 2015-02-09 23:05:44 +03:00
parent 61ead264fb
commit 4d8709652e
7 changed files with 29 additions and 218 deletions

View File

@ -6,7 +6,7 @@ android {
defaultConfig {
applicationId "org.fox.ttrss"
minSdkVersion 16
minSdkVersion 15
targetSdkVersion 21
}

View File

@ -5,7 +5,7 @@
android:versionName="1.86" >
<uses-sdk
android:minSdkVersion="16"
android:minSdkVersion="15"
android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.INTERNET" />

View File

@ -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 {
"</head>" +
"<body>" + articleContent;
if (useTitleWebView) {
content += "<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>";
}
if (m_article.attachments != null && m_article.attachments.size() != 0) {
String flatContent = articleContent.replaceAll("[\r\n]", "");
boolean hasImages = flatContent.matches(".*?<img[^>+].*?");

View File

@ -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 {
"</head>" +
"<body>" + articleContent;
if (useTitleWebView) {
content += "<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>";
}
content += "</body></html>";
try {

View File

@ -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();
}
}

View File

@ -1,79 +0,0 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/article_fragment"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="?articleBackground"
android:orientation="vertical"
android:padding="5sp" >
<org.fox.ttrss.util.TitleWebView
android:id="@+id/article_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<LinearLayout
android:id="@+id/article_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0"
android:orientation="vertical"
android:paddingBottom="2dp" >
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingBottom="4dp"
android:text="My simple headline"
android:textColor="?linkColor"
android:textSize="18sp" />
<TextView
android:id="@+id/comments"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right"
android:text="24 comments"
android:fontFamily="sans-serif-light"
android:textColor="?linkColor"
android:textSize="12sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="4dp"
android:layout_weight="1" >
<TextView
android:id="@+id/tags"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:ellipsize="end"
android:singleLine="true"
android:text="Example Feed"
android:fontFamily="sans-serif-light"
android:textColor="?headlineSecondaryTextColor"
android:textSize="12sp" />
<TextView
android:id="@+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:gravity="right"
android:text="Jan 01, 12:00"
android:fontFamily="sans-serif-light"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?headlineSecondaryTextColor"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
</org.fox.ttrss.util.TitleWebView>
</LinearLayout>

View File

@ -173,11 +173,6 @@
android:title="@string/offline_image_cache_enabled" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/debugging" >
<CheckBoxPreference
android:defaultValue="false"
android:key="article_compat_view"
android:title="@string/prefs_compatible_article_layout"
android:summary="@string/prefs_compatible_layout_summary" />
<CheckBoxPreference
android:defaultValue="true"
android:key="webview_hardware_accel"