Android Article Viewer Offline
https://www.viralandroid.com/2020/05/article-viewer-offline.html
Android Library to View an Article Offline
Getting Started
Follow one of these steps to import Article-Viewer into your project:
Gradle
compile 'com.jeffg.articleviewer:article-viewer:1.3.2'
Maven
<dependency>
<groupId>com.jeffg.articleviewer</groupId>
<artifactId>article-viewer</artifactId>
<version>1.3.2</version>
<type>pom</type>
</dependency>
Ivy
<dependency org='com.jeffg.articleviewer' name='article-viewer' rev='1.3.2'>
<artifact name='article-viewer' ext='pom' ></artifact>
</dependency>
Implementing into your project
Use the Builder to create a html string
ArticleHtml articleHtml = new ArticleHtml(this);
articleHtml.setBuilder(new ArticleContent.Builder()
.setImageBitmap(bitmap, 100)
.setTitle("Title")
.setSource("Source")
.setContent("Content")
.build());
String html = articleHtml.getHtml();
Insert the html into the webview
webview.loadDataWithBaseURL("", html, "text/html", "UTF-8", "");
Result
All Builder() Commands
.setImageBitmap(Bitmap bitmap, int quality)
.setImageDrawable(Drawable drawable, int quality)
.setBackgroundColor(int color)
.setFont(String font)
.setTitle(String title)
.setTitleTextSize(int px)
.setTitleTextAlign(String textAlign)
.setTitleTextColor(int color)
.setSource(String source)
.setSourceTextSize(int px)
.setSourceTextAlign(String textAlign)
.setSourceTextColor(int color)
.setContent(String content)
.setContentTextSize(int px)
.setContentTextAlign(String textAlign)
.setContentTextColor(int color)
.build()
Download complete project source code from GitHub