Skip to content

Commit

Permalink
Merge branch 'release/2.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
prof18 committed Dec 22, 2018
2 parents 72bdede + b795c35 commit 774394c
Show file tree
Hide file tree
Showing 98 changed files with 1,923 additions and 619 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
.DS_Store

# Built application files
*.apk
*.ap_
*.json

# Files for the Dalvik VM
*.dex
Expand Down
66 changes: 60 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
![API](https://img.shields.io/badge/API-15%2B-brightgreen.svg?style=flat)

## Important Notice
Versions 1.4 and 1.4.1 have been deleted due to a critical dependency error. Please forgive me and update to version 1.4.4
Versions 1.4 and 1.4.1 have been deleted due to a critical dependency error. Please forgive me and update to the latest version available.

## About

Expand All @@ -27,18 +27,70 @@ This is an Android library to parse a RSS Feed. You can retrive the following in
The library is uploaded in jCenter, so you can easily add the dependency:
```Gradle
dependencies {
compile 'com.prof.rssparser:rssparser:1.4.4'
compile 'com.prof.rssparser:rssparser:2.0.0'
}
```
#### Use:

Starting from the version 2.x, the library has been completely rewritten using Kotlin and the coroutines. However, The compatibility with Java has been maintained and the same code of the versions 1.x can be used.

If you are using Kotlin you need to [launch](https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/launch.html) the coroutine that retrieves the articles.

```Kotlin
import com.prof.rssparser.Article
import com.prof.rssparser.Parser

//url of RSS feed
private val url = "https://www.androidauthority.com/feed"

coroutineScope.launch(Dispatchers.Main) {
try {
val parser = Parser()
val articleList = parser.getArticles(url)
// The list contains all article's data. For example you can use it for your adapter.
} catch (e: Exception) {
// Handle the exception
}
}
```
You can give a look to the full kotlin sample by clicking [here](https://github.com/prof18/RSS-Parser/tree/master/samplekotlin)

If you are still using Java, the code is very similar to the older versions of the library:

```Java
import com.prof.rssparser.Article;
import com.prof.rssparser.OnTaskCompleted;
import com.prof.rssparser.Parser;

Parser parser = new Parser();
parser.onFinish(new OnTaskCompleted() {

//what to do when the parsing is done
@Override
public void onTaskCompleted(List<Article> list) {
// The list contains all article's data. For example you can use it for your adapter.
}

//what to do in case of error
@Override
public void onError(Exception e) {
// Handle the exception
}
});
parser.execute(urlString);
```
The full Java sample is available [here](https://github.com/prof18/RSS-Parser/tree/master/samplejava)

##### Version 1.4.4 and below:


```Java
import com.prof.rssparser.Article;
import com.prof.rssparser.Parser;

//url of RSS feed
String urlString = "http://www.androidcentral.com/feed";
Parser parser = new Parser();
parser.execute(urlString);
parser.onFinish(new Parser.OnTaskCompleted() {

@Override
Expand All @@ -52,18 +104,20 @@ parser.onFinish(new Parser.OnTaskCompleted() {
//what to do in case of error
}
});
parser.execute(urlString);
```
## Sample app
I wrote a simple app that shows articles from Android Authority. If in the article's content there isn't a image, a placeholder will be load.
I wrote a simple app that shows articles from Android Authority. If in the article's content there isn't an image, a placeholder will be loaded.

<img src="https://github.com/prof18/RSS-Parser/blob/master/Screen.png" width="30%" height="30%">

You can browse the code <a href="https://github.com/prof18/RSS-Parser/tree/master/app"> in this repo.</a>
The sample is written both in Kotlin and Java. You can browse the Kotlin code [here](https://github.com/prof18/RSS-Parser/tree/master/samplekotlin) and the Java code [here](https://github.com/prof18/RSS-Parser/tree/master/samplejava)
You can also download the <a href="https://github.com/prof18/RSS-Parser/blob/master/RSS%20Parser.apk"> apk file</a> to try it!

Please use the issues tracker only to report issues. If you have any kind of question you can ask it on [the blog post on my website](http://www.marcogomiero.com/blog/rss-parser-library)
Please use the issues tracker only to report issues. If you have any kind of question you can ask it on [the blog post that I wrote](https://medium.com/@marcogomiero/how-to-easily-handle-rss-feeds-on-android-with-rss-parser-8acc98e8926f)

## Changelog
- 22 December 2018 - Rewrote library with Kotlin - Version 2.0.0
- 8 December 2018 - Include thrown exception in onError() callback (PR #22) - Version 1.4.5
- 7 Semptember 2018 - Add more sources for the featured image. Removed unused resources and improved the parsing of the image. Fixed dependency errors. - Version 1.4.4
- 14 December 2017 - Little fixes on Error Management - Version 1.3.1
Expand Down
Binary file removed RSS Parser.apk
Binary file not shown.
32 changes: 0 additions & 32 deletions app/build.gradle

This file was deleted.

17 changes: 0 additions & 17 deletions app/proguard-rules.pro

This file was deleted.

This file was deleted.

Binary file removed app/src/main/res/mipmap-hdpi/ic_launcher.png
Binary file not shown.
Binary file removed app/src/main/res/mipmap-mdpi/ic_launcher.png
Binary file not shown.
Binary file removed app/src/main/res/mipmap-xhdpi/ic_launcher.png
Binary file not shown.
Binary file removed app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Binary file not shown.
Binary file removed app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Binary file not shown.
6 changes: 0 additions & 6 deletions app/src/main/res/values-w820dp/dimens.xml

This file was deleted.

15 changes: 0 additions & 15 deletions app/src/test/java/com/prof/rssparser/example/ExampleUnitTest.java

This file was deleted.

12 changes: 8 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.3.11'
repositories {
jcenter()
google()
maven {
url 'https://maven.google.com/'
name 'Google'
}
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"


// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -21,11 +25,11 @@ buildscript {

allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
jcenter()
}
}

Expand Down
4 changes: 3 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# org.gradle.parallel=true
android.enableJetifier=true
android.useAndroidX=true
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sat May 05 13:17:56 CEST 2018
#Sat Dec 08 17:59:48 CET 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
15 changes: 11 additions & 4 deletions rssparser/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'


android {
compileSdkVersion 27
compileSdkVersion 28

defaultConfig {
minSdkVersion 14
targetSdkVersion 27
versionCode 9
versionName "1.4.5"
targetSdkVersion 28
versionCode 20000
versionName "2.0.0"
}

buildTypes {
Expand All @@ -21,8 +22,14 @@ android {

dependencies {
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.1.0'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.1.0"
}


apply from: 'publish.gradle'
repositories {
mavenCentral()
}

2 changes: 1 addition & 1 deletion rssparser/publish.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'

version '1.4.5'
version '2.0.0'
group 'com.prof.rssparser'

publishing {
Expand Down
Loading

0 comments on commit 774394c

Please sign in to comment.