Skip to content
This repository has been archived by the owner on Aug 18, 2021. It is now read-only.

Commit

Permalink
Release v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
amirisback committed Mar 17, 2020
1 parent 90a0737 commit 98d125a
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 8 deletions.
91 changes: 88 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,43 @@ Simple code and reusable data
https://newsapi.org/

# Function Main From This Project
// Switch For Using Chuck Interceptor
fun usingChuckInterceptor(context: Context)

// Get Top Headline
fun getTopHeadline(
q: String?,
sources: String?,
category: String?,
country: String?,
pageSize: Int?,
page: Int?,
callback: NewsResultCallback<ArticleResponse>
)

// Get Everythings
fun getEverythings(
q: String?,
from: String?,
to: String?,
qInTitle: String?,
sources: String?,
domains: String?,
excludeDomains: String?,
language: String?,
sortBy: String?,
pageSize: Int?,
page: Int?,
callback: NewsResultCallback<ArticleResponse>
)

// Get Sources
fun getSources(
language: String,
country: String,
category: String,
callback: NewsResultCallback<SourceResponse>
)

# Android Library Version (build.gradle)
- ext.kotlin_version = '1.3.70'
Expand All @@ -29,14 +66,62 @@ https://newsapi.org/
# Version Release
This Is Latest Release

$version_release = Still on development
$version_release = 1.0.0

What's New??

* Development *
* Fetching All Function on News Api *

# How To Use This Project
- Release soon
<h3>Step 1. Add the JitPack repository to your build file</h3>

Add it in your root build.gradle at the end of repositories:

allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}


<h3>Step 2. Add the dependency</h3>

dependencies {
// library consumable code news api
implementation 'com.github.amirisback:consumable-code-news-api:$version_release'
}

<h3>Step 3. Declaration ConsumeNewsApi</h3>

val consumeNewsApi = ConsumeNewsApi(NewsUrl.NEWS_API_KEY) // Your API_KEY
consumeNewsApi.usingChuckInterceptor(this) // Using Chuck Interceptor
consumeNewsApi.getTopHeadline( // Adding Base Parameter on main function
null,
null,
null,
"id",
null,
null,
object : NewsResultCallback<ArticleResponse> {
override fun getResultData(data: ArticleResponse) {
// Your Ui or data
}

override fun failedResult(statusCode: Int, errorMessage: String?) {
// Your failed to do
}

override fun onShowProgress() {
// Your Progress Show
}

override fun onHideProgress() {
// Your Progress Hide
}

})


# Colaborator
Very open to anyone, I'll write your name under this, please contribute by sending an email to me
Expand Down
18 changes: 13 additions & 5 deletions app/src/main/java/com/frogobox/newsapi/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class MainActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)

val consumeNewsApi = ConsumeNewsApi(NewsUrl.NEWS_API_KEY)
val consumeNewsApi = ConsumeNewsApi(NewsUrl.NEWS_API_KEY) // Your API_KEY
consumeNewsApi.usingChuckInterceptor(this)
consumeNewsApi.getTopHeadline(
null,
Expand All @@ -23,13 +23,21 @@ class MainActivity : AppCompatActivity() {
null,
null,
object : NewsResultCallback<ArticleResponse> {
override fun getResultData(data: ArticleResponse) {}
override fun getResultData(data: ArticleResponse) {
// Your Ui or data
}

override fun failedResult(statusCode: Int, errorMessage: String?) {}
override fun failedResult(statusCode: Int, errorMessage: String?) {
// Your failed to do
}

override fun onShowProgress() {}
override fun onShowProgress() {
// Your Progress Show
}

override fun onHideProgress() {}
override fun onHideProgress() {
// Your Progress Hide
}

})

Expand Down

0 comments on commit 98d125a

Please sign in to comment.