various offline-related fixes

This commit is contained in:
Andrew Dolgov 2015-12-09 11:57:35 +03:00
parent d5daa01f61
commit 16a30626a4
4 changed files with 30 additions and 41 deletions

View File

@ -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="396"
android:versionName="1.164" >
android:versionCode="397"
android:versionName="1.165" >
<uses-sdk
android:minSdkVersion="16"

View File

@ -2,7 +2,6 @@ package org.fox.ttrss;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Build;
@ -37,7 +36,6 @@ import org.fox.ttrss.types.Attachment;
import org.fox.ttrss.util.NoChildFocusScrollView;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
@ -329,21 +327,6 @@ public class ArticleFragment extends Fragment {
dv.setText(df.format(d));
}
TextView author = (TextView)view.findViewById(R.id.author);
boolean hasAuthor = false;
if (author != null) {
author.setTextSize(TypedValue.COMPLEX_UNIT_SP, m_articleSmallFontSize);
if (m_article.author != null && m_article.author.length() > 0) {
author.setText(getString(R.string.author_formatted, m_article.author));
} else {
author.setVisibility(View.GONE);
}
hasAuthor = true;
}
TextView tagv = (TextView)view.findViewById(R.id.tags);
if (tagv != null) {
@ -352,7 +335,7 @@ public class ArticleFragment extends Fragment {
if (m_article.feed_title != null) {
String fTitle = m_article.feed_title;
if (!hasAuthor && m_article.author != null && m_article.author.length() > 0) {
if (m_article.author != null && m_article.author.length() > 0) {
fTitle += " (" + getString(R.string.author_formatted, m_article.author) + ")";
}

View File

@ -2,7 +2,6 @@ package org.fox.ttrss.offline;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.net.Uri;
@ -26,7 +25,6 @@ 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;
@ -199,7 +197,7 @@ public class OfflineArticleFragment extends Fragment {
title.setText(titleStr);
//title.setPaintFlags(title.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
title.setOnClickListener(new OnClickListener() {
title.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
try {
@ -386,22 +384,6 @@ public class OfflineArticleFragment extends Fragment {
dv.setText(df.format(d));
}
TextView author = (TextView)view.findViewById(R.id.author);
boolean hasAuthor = false;
if (author != null) {
author.setTextSize(TypedValue.COMPLEX_UNIT_SP, articleSmallFontSize);
int authorIndex = m_cursor.getColumnIndex("author");
if (authorIndex >= 0)
author.setText(m_cursor.getString(authorIndex));
else
author.setVisibility(View.GONE);
hasAuthor = true;
}
TextView tagv = (TextView)view.findViewById(R.id.tags);
if (tagv != null) {
@ -414,8 +396,12 @@ public class OfflineArticleFragment extends Fragment {
int authorIndex = m_cursor.getColumnIndex("author");
if (!hasAuthor && authorIndex >= 0) {
fTitle += " (" + getString(R.string.author_formatted, m_cursor.getString(authorIndex)) + ")";
if (authorIndex >= 0) {
String authorStr = m_cursor.getString(authorIndex);
if (authorStr != null && authorStr.length() > 0) {
fTitle += " (" + getString(R.string.author_formatted, m_cursor.getString(authorIndex)) + ")";
}
}
tagv.setText(fTitle);

View File

@ -413,6 +413,7 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
public ImageView textImage;
public ImageView textChecked;
public ImageView flavorVideoKindView;
public View flavorImageOverflow;
public View headlineHeader;
}
@ -534,6 +535,7 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
holder.textChecked = (ImageView) v.findViewById(R.id.text_checked);
holder.flavorVideoKindView = (ImageView) v.findViewById(R.id.flavor_video_kind);
holder.headlineHeader = v.findViewById(R.id.headline_header);
holder.flavorImageOverflow = v.findViewById(R.id.flavor_image_overflow);
v.setTag(holder);
@ -721,8 +723,26 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
holder.flavorImageLoadingBar.setVisibility(View.GONE);
holder.flavorImageView.setVisibility(View.GONE);
holder.flavorVideoKindView.setVisibility(View.GONE);
holder.flavorImageOverflow.setVisibility(View.GONE);
holder.headlineHeader.setBackgroundDrawable(null);
// this is needed if our flavor image goes behind base listview element
holder.headlineHeader.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
m_listener.onArticleSelected(articleId);
}
});
holder.headlineHeader.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
m_activity.openContextMenu(v);
return true;
}
});
}
if (holder.menuButtonView != null) {