add some animations

article: load webview contents in a runnable
This commit is contained in:
Andrew Dolgov 2015-02-11 14:59:15 +03:00
parent 2349845298
commit 0264b2d30f
6 changed files with 327 additions and 313 deletions

1
org.fox.ttrss/build.gradle Normal file → Executable file
View File

@ -34,4 +34,5 @@ dependencies {
compile 'com.android.support:appcompat-v7:21.0.3' compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.shamanland:fab:0.0.5' compile 'com.shamanland:fab:0.0.5'
compile 'ch.acra:acra:4.5.0' compile 'ch.acra:acra:4.5.0'
compile 'com.ToxicBakery.viewpager.transforms:view-pager-transforms:1.1.0@aar'
} }

View File

@ -86,6 +86,7 @@
<orderEntry type="library" exported="" name="cardview-v7-21.0.0" level="project" /> <orderEntry type="library" exported="" name="cardview-v7-21.0.0" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-21.0.3" level="project" /> <orderEntry type="library" exported="" name="appcompat-v7-21.0.3" level="project" />
<orderEntry type="library" exported="" name="jsoup-1.6.1" level="project" /> <orderEntry type="library" exported="" name="jsoup-1.6.1" level="project" />
<orderEntry type="library" exported="" name="view-pager-transforms-1.1.0" level="project" />
<orderEntry type="library" exported="" name="library-2.4.1" level="project" /> <orderEntry type="library" exported="" name="library-2.4.1" level="project" />
<orderEntry type="library" exported="" name="gson-2.3" level="project" /> <orderEntry type="library" exported="" name="gson-2.3" level="project" />
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" /> <orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />

2
org.fox.ttrss/src/main/AndroidManifest.xml Normal file → Executable file
View File

@ -1,7 +1,7 @@
<?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="299" android:versionCode="300"
android:versionName="1.87" > android:versionName="1.87" >
<uses-sdk <uses-sdk

View File

@ -8,6 +8,7 @@ import android.graphics.Typeface;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.text.Html; import android.text.Html;
@ -149,339 +150,346 @@ public class ArticleFragment extends Fragment {
@SuppressLint("NewApi") @SuppressLint("NewApi")
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, final Bundle savedInstanceState) {
if (savedInstanceState != null) { if (savedInstanceState != null) {
m_article = savedInstanceState.getParcelable("article"); m_article = savedInstanceState.getParcelable("article");
//m_fsviewShown = savedInstanceState.getBoolean("fsviewShown"); //m_fsviewShown = savedInstanceState.getBoolean("fsviewShown");
} }
View view = inflater.inflate(R.layout.article_fragment, container, false); final View view = inflater.inflate(R.layout.article_fragment, container, false);
/* if (m_fsviewShown) { /* if (m_fsviewShown) {
view.findViewById(R.id.article_fullscreen_video).setVisibility(View.VISIBLE); view.findViewById(R.id.article_fullscreen_video).setVisibility(View.VISIBLE);
view.findViewById(R.id.article_scrollview).setVisibility(View.INVISIBLE); view.findViewById(R.id.article_scrollview).setVisibility(View.INVISIBLE);
} */ } */
if (m_article != null) { m_contentView = view.findViewById(R.id.article_scrollview);
m_customViewContainer = (FrameLayout) view.findViewById(R.id.article_fullscreen_video);
m_contentView = view.findViewById(R.id.article_scrollview); View scrollView = view.findViewById(R.id.article_scrollview);
m_customViewContainer = (FrameLayout) view.findViewById(R.id.article_fullscreen_video); m_fab = view.findViewById(R.id.article_fab);
View scrollView = view.findViewById(R.id.article_scrollview); if (scrollView != null && m_fab != null) {
m_fab = view.findViewById(R.id.article_fab); if (m_prefs.getBoolean("enable_article_fab", true)) {
scrollView.setOnTouchListener(new ShowHideOnScroll(m_fab));
if (scrollView != null && m_fab != null) { m_fab.setOnClickListener(new OnClickListener() {
if (m_prefs.getBoolean("enable_article_fab", true)) { @Override
scrollView.setOnTouchListener(new ShowHideOnScroll(m_fab)); public void onClick(View view) {
try {
m_fab.setOnClickListener(new OnClickListener() { URL url = new URL(m_article.link.trim());
@Override String uri = new URI(url.getProtocol(), url.getUserInfo(), url.getHost(),
public void onClick(View view) { url.getPort(), url.getPath(), url.getQuery(), url.getRef()).toString();
try { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
URL url = new URL(m_article.link.trim()); startActivity(intent);
String uri = new URI(url.getProtocol(), url.getUserInfo(), url.getHost(), } catch (Exception e) {
url.getPort(), url.getPath(), url.getQuery(), url.getRef()).toString(); e.printStackTrace();
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri)); m_activity.toast(R.string.error_other_error);
startActivity(intent);
} catch (Exception e) {
e.printStackTrace();
m_activity.toast(R.string.error_other_error);
}
}
});
} else {
m_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));
TextView title = (TextView)view.findViewById(R.id.title);
if (title != null) {
if (m_prefs.getBoolean("enable_condensed_fonts", false)) {
Typeface tf = TypefaceCache.get(m_activity, "sans-serif-condensed", Typeface.NORMAL);
if (tf != null && !tf.equals(title.getTypeface())) {
title.setTypeface(tf);
}
title.setTextSize(TypedValue.COMPLEX_UNIT_SP, Math.min(21, articleFontSize + 5));
} else {
title.setTextSize(TypedValue.COMPLEX_UNIT_SP, Math.min(21, articleFontSize + 3));
}
String titleStr;
if (m_article.title.length() > 200)
titleStr = m_article.title.substring(0, 200) + "...";
else
titleStr = m_article.title;
title.setText(Html.fromHtml(titleStr));
//title.setPaintFlags(title.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
title.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
try {
URL url = new URL(m_article.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);
}
}
});
registerForContextMenu(title);
}
TextView comments = (TextView)view.findViewById(R.id.comments);
if (comments != null) {
if (m_activity.getApiLevel() >= 4 && m_article.comments_count > 0) {
comments.setTextSize(TypedValue.COMPLEX_UNIT_SP, articleSmallFontSize);
String commentsTitle = getResources().getQuantityString(R.plurals.article_comments, m_article.comments_count, m_article.comments_count);
comments.setText(commentsTitle);
//comments.setPaintFlags(title.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
comments.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
try {
URL url = new URL((m_article.comments_link != null && m_article.comments_link.length() > 0) ?
m_article.comments_link : m_article.link);
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 {
comments.setVisibility(View.GONE);
}
}
TextView note = (TextView)view.findViewById(R.id.note);
if (note != null) {
if (m_article.note != null && !"".equals(m_article.note)) {
note.setTextSize(TypedValue.COMPLEX_UNIT_SP, articleSmallFontSize);
note.setText(m_article.note);
} else {
note.setVisibility(View.GONE);
}
}
m_web = (WebView)view.findViewById(R.id.article_content);
if (m_web != null) {
m_web.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
HitTestResult result = ((WebView)v).getHitTestResult();
if (result != null && (result.getType() == HitTestResult.IMAGE_TYPE || result.getType() == HitTestResult.SRC_IMAGE_ANCHOR_TYPE)) {
registerForContextMenu(m_web);
m_activity.openContextMenu(m_web);
unregisterForContextMenu(m_web);
return true;
} else {
return false;
}
}
});
boolean acceleratedWebview = true;
// prevent flicker in ics
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;
}
}
String content;
String cssOverride = "";
WebSettings ws = m_web.getSettings();
ws.setSupportZoom(false);
TypedValue tvBackground = new TypedValue();
getActivity().getTheme().resolveAttribute(R.attr.articleBackground, tvBackground, true);
String backgroundHexColor = String.format("#%06X", (0xFFFFFF & tvBackground.data));
cssOverride = "body { background : "+ backgroundHexColor+"; }";
TypedValue tvTextColor = new TypedValue();
getActivity().getTheme().resolveAttribute(R.attr.articleTextColor, tvTextColor, true);
String textColor = String.format("#%06X", (0xFFFFFF & tvTextColor.data));
cssOverride += "body { color : "+textColor+"; }";
TypedValue tvLinkColor = new TypedValue();
getActivity().getTheme().resolveAttribute(R.attr.linkColor, tvLinkColor, true);
String linkHexColor = String.format("#%06X", (0xFFFFFF & tvLinkColor.data));
cssOverride += " a:link {color: "+linkHexColor+";} a:visited { color: "+linkHexColor+";}";
String articleContent = m_article.content != null ? m_article.content : "";
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
ws.setJavaScriptEnabled(true);
m_chromeClient = new FSVideoChromeClient(view);
m_web.setWebChromeClient(m_chromeClient);
}
if (m_prefs.getBoolean("justify_article_text", true)) {
cssOverride += "body { text-align : justify; } ";
}
ws.setDefaultFontSize(articleFontSize);
content =
"<html>" +
"<head>" +
"<meta content=\"text/html; charset=utf-8\" http-equiv=\"content-type\">" +
"<meta name=\"viewport\" content=\"width=device-width, user-scalable=no\" />" +
"<style type=\"text/css\">" +
"body { padding : 0px; margin : 0px; line-height : 130%; }" +
"img, video, iframe { max-width : 100%; width : auto; height : auto; }" +
" table { width : 100%; }" +
cssOverride +
"</style>" +
"</head>" +
"<body>" + articleContent;
if (m_article.attachments != null && m_article.attachments.size() != 0) {
String flatContent = articleContent.replaceAll("[\r\n]", "");
boolean hasImages = flatContent.matches(".*?<img[^>+].*?");
for (Attachment a : m_article.attachments) {
if (a.content_type != null && a.content_url != null) {
try {
if (a.content_type.indexOf("image") != -1 &&
(!hasImages || m_article.always_display_attachments)) {
URL url = new URL(a.content_url.trim());
String strUrl = url.toString().trim();
content += "<p><img src=\"" + strUrl.replace("\"", "\\\"") + "\"></p>";
}
} catch (MalformedURLException e) {
//
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
content += "</body></html>";
try {
String baseUrl = null;
try {
URL url = new URL(m_article.link);
baseUrl = url.getProtocol() + "://" + url.getHost();
} catch (MalformedURLException e) {
//
}
if (savedInstanceState == null || !acceleratedWebview) {
m_web.loadDataWithBaseURL(baseUrl, content, "text/html", "utf-8", null);
} else {
WebBackForwardList rc = m_web.restoreState(savedInstanceState);
if (rc == null) {
// restore failed...
m_web.loadDataWithBaseURL(baseUrl, content, "text/html", "utf-8", null);
} }
} }
});
} else {
m_fab.setVisibility(View.GONE);
}
}
} catch (RuntimeException e) { final int articleFontSize = Integer.parseInt(m_prefs.getString("article_font_size_sp", "16"));
e.printStackTrace(); final int articleSmallFontSize = Math.max(10, Math.min(18, articleFontSize - 2));
}
TextView title = (TextView)view.findViewById(R.id.title);
if (title != null) {
if (m_prefs.getBoolean("enable_condensed_fonts", false)) {
Typeface tf = TypefaceCache.get(m_activity, "sans-serif-condensed", Typeface.NORMAL);
if (tf != null && !tf.equals(title.getTypeface())) {
title.setTypeface(tf);
}
title.setTextSize(TypedValue.COMPLEX_UNIT_SP, Math.min(21, articleFontSize + 5));
} else {
title.setTextSize(TypedValue.COMPLEX_UNIT_SP, Math.min(21, articleFontSize + 3));
}
String titleStr;
if (m_article.title.length() > 200)
titleStr = m_article.title.substring(0, 200) + "...";
else
titleStr = m_article.title;
title.setText(Html.fromHtml(titleStr));
//title.setPaintFlags(title.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
title.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
try {
URL url = new URL(m_article.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);
}
}
});
registerForContextMenu(title);
}
TextView comments = (TextView)view.findViewById(R.id.comments);
if (comments != null) {
if (m_activity.getApiLevel() >= 4 && m_article.comments_count > 0) {
comments.setTextSize(TypedValue.COMPLEX_UNIT_SP, articleSmallFontSize);
String commentsTitle = getResources().getQuantityString(R.plurals.article_comments, m_article.comments_count, m_article.comments_count);
comments.setText(commentsTitle);
//comments.setPaintFlags(title.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
comments.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
try {
URL url = new URL((m_article.comments_link != null && m_article.comments_link.length() > 0) ?
m_article.comments_link : m_article.link);
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 {
comments.setVisibility(View.GONE);
}
}
TextView note = (TextView)view.findViewById(R.id.note);
if (note != null) {
if (m_article.note != null && !"".equals(m_article.note)) {
note.setTextSize(TypedValue.COMPLEX_UNIT_SP, articleSmallFontSize);
note.setText(m_article.note);
} else {
note.setVisibility(View.GONE);
}
}
m_web = (WebView)view.findViewById(R.id.article_content);
TextView dv = (TextView)view.findViewById(R.id.date);
if (dv != null) {
dv.setTextSize(TypedValue.COMPLEX_UNIT_SP, articleSmallFontSize);
Date d = new Date(m_article.updated * 1000L);
DateFormat df = new SimpleDateFormat("MMM dd, HH:mm");
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);
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) {
tagv.setTextSize(TypedValue.COMPLEX_UNIT_SP, articleSmallFontSize);
if (m_article.feed_title != null) {
String fTitle = m_article.feed_title;
if (!hasAuthor && m_article.author != null && m_article.author.length() > 0) {
fTitle += " (" + getString(R.string.author_formatted, m_article.author) + ")";
}
tagv.setText(fTitle);
} else if (m_article.tags != null) {
String tagsStr = "";
for (String tag : m_article.tags)
tagsStr += tag + ", ";
tagsStr = tagsStr.replaceAll(", $", "");
tagv.setText(tagsStr);
} else {
tagv.setVisibility(View.GONE);
}
}
if (m_article != null) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
if (m_web != null) {
m_web.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
HitTestResult result = ((WebView)v).getHitTestResult();
if (result != null && (result.getType() == HitTestResult.IMAGE_TYPE || result.getType() == HitTestResult.SRC_IMAGE_ANCHOR_TYPE)) {
registerForContextMenu(m_web);
m_activity.openContextMenu(m_web);
unregisterForContextMenu(m_web);
return true;
} else {
return false;
}
}
});
boolean acceleratedWebview = true;
// prevent flicker in ics
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;
}
}
String content;
String cssOverride = "";
WebSettings ws = m_web.getSettings();
ws.setSupportZoom(false);
TypedValue tvBackground = new TypedValue();
getActivity().getTheme().resolveAttribute(R.attr.articleBackground, tvBackground, true);
String backgroundHexColor = String.format("#%06X", (0xFFFFFF & tvBackground.data));
cssOverride = "body { background : "+ backgroundHexColor+"; }";
TypedValue tvTextColor = new TypedValue();
getActivity().getTheme().resolveAttribute(R.attr.articleTextColor, tvTextColor, true);
String textColor = String.format("#%06X", (0xFFFFFF & tvTextColor.data));
cssOverride += "body { color : "+textColor+"; }";
TypedValue tvLinkColor = new TypedValue();
getActivity().getTheme().resolveAttribute(R.attr.linkColor, tvLinkColor, true);
String linkHexColor = String.format("#%06X", (0xFFFFFF & tvLinkColor.data));
cssOverride += " a:link {color: "+linkHexColor+";} a:visited { color: "+linkHexColor+";}";
String articleContent = m_article.content != null ? m_article.content : "";
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
ws.setJavaScriptEnabled(true);
m_chromeClient = new FSVideoChromeClient(view);
m_web.setWebChromeClient(m_chromeClient);
}
if (m_prefs.getBoolean("justify_article_text", true)) {
cssOverride += "body { text-align : justify; } ";
}
ws.setDefaultFontSize(articleFontSize);
content =
"<html>" +
"<head>" +
"<meta content=\"text/html; charset=utf-8\" http-equiv=\"content-type\">" +
"<meta name=\"viewport\" content=\"width=device-width, user-scalable=no\" />" +
"<style type=\"text/css\">" +
"body { padding : 0px; margin : 0px; line-height : 130%; }" +
"img, video, iframe { max-width : 100%; width : auto; height : auto; }" +
" table { width : 100%; }" +
cssOverride +
"</style>" +
"</head>" +
"<body>" + articleContent;
if (m_article.attachments != null && m_article.attachments.size() != 0) {
String flatContent = articleContent.replaceAll("[\r\n]", "");
boolean hasImages = flatContent.matches(".*?<img[^>+].*?");
for (Attachment a : m_article.attachments) {
if (a.content_type != null && a.content_url != null) {
try {
if (a.content_type.indexOf("image") != -1 &&
(!hasImages || m_article.always_display_attachments)) {
URL url = new URL(a.content_url.trim());
String strUrl = url.toString().trim();
content += "<p><img src=\"" + strUrl.replace("\"", "\\\"") + "\"></p>";
}
} catch (MalformedURLException e) {
//
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
content += "</body></html>";
try {
String baseUrl = null;
try {
URL url = new URL(m_article.link);
baseUrl = url.getProtocol() + "://" + url.getHost();
} catch (MalformedURLException e) {
//
}
if (savedInstanceState == null || !acceleratedWebview) {
m_web.loadDataWithBaseURL(baseUrl, content, "text/html", "utf-8", null);
} else {
WebBackForwardList rc = m_web.restoreState(savedInstanceState);
if (rc == null) {
// restore failed...
m_web.loadDataWithBaseURL(baseUrl, content, "text/html", "utf-8", null);
}
}
} catch (RuntimeException e) {
e.printStackTrace();
}
// if (m_activity.isSmallScreen()) // if (m_activity.isSmallScreen())
// web.setOnTouchListener(m_gestureListener); // web.setOnTouchListener(m_gestureListener);
m_web.setVisibility(View.VISIBLE); m_web.setVisibility(View.VISIBLE);
} }
TextView dv = (TextView)view.findViewById(R.id.date); }
}, 100);
if (dv != null) { }
dv.setTextSize(TypedValue.COMPLEX_UNIT_SP, articleSmallFontSize);
Date d = new Date(m_article.updated * 1000L);
DateFormat df = new SimpleDateFormat("MMM dd, HH:mm");
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);
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) {
tagv.setTextSize(TypedValue.COMPLEX_UNIT_SP, articleSmallFontSize);
if (m_article.feed_title != null) {
String fTitle = m_article.feed_title;
if (!hasAuthor && m_article.author != null && m_article.author.length() > 0) {
fTitle += " (" + getString(R.string.author_formatted, m_article.author) + ")";
}
tagv.setText(fTitle);
} else if (m_article.tags != null) {
String tagsStr = "";
for (String tag : m_article.tags)
tagsStr += tag + ", ";
tagsStr = tagsStr.replaceAll(", $", "");
tagv.setText(tagsStr);
} else {
tagv.setVisibility(View.GONE);
}
}
}
return view; return view;
} }

View File

@ -26,6 +26,7 @@ import android.widget.FrameLayout;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import com.ToxicBakery.viewpager.transforms.DepthPageTransformer;
import com.nostra13.universalimageloader.core.DisplayImageOptions; import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader; import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.assist.FailReason; import com.nostra13.universalimageloader.core.assist.FailReason;
@ -295,6 +296,7 @@ public class ArticleImagesPagerActivity extends CommonActivity implements Gestur
ViewPager pager = (ViewPager) findViewById(R.id.article_images_pager); ViewPager pager = (ViewPager) findViewById(R.id.article_images_pager);
pager.setAdapter(m_adapter); pager.setAdapter(m_adapter);
pager.setPageTransformer(true, new DepthPageTransformer());
UnderlinePageIndicator indicator = (UnderlinePageIndicator)findViewById(R.id.article_images_indicator); UnderlinePageIndicator indicator = (UnderlinePageIndicator)findViewById(R.id.article_images_indicator);
indicator.setViewPager(pager); indicator.setViewPager(pager);

View File

@ -16,6 +16,7 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.WindowManager; import android.view.WindowManager;
import com.ToxicBakery.viewpager.transforms.StackTransformer;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import com.viewpagerindicator.UnderlinePageIndicator; import com.viewpagerindicator.UnderlinePageIndicator;
@ -93,6 +94,7 @@ public class ArticlePager extends Fragment {
m_listener.onArticleSelected(m_article, false); m_listener.onArticleSelected(m_article, false);
pager.setAdapter(m_adapter); pager.setAdapter(m_adapter);
pager.setPageTransformer(true, new StackTransformer());
UnderlinePageIndicator indicator = (UnderlinePageIndicator)view.findViewById(R.id.article_titles); UnderlinePageIndicator indicator = (UnderlinePageIndicator)view.findViewById(R.id.article_titles);
indicator.setViewPager(pager); indicator.setViewPager(pager);