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

Commit 98d125a

Browse files
committed
Release v1.0.0
1 parent 90a0737 commit 98d125a

File tree

2 files changed

+101
-8
lines changed

2 files changed

+101
-8
lines changed

README.md

Lines changed: 88 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,43 @@ Simple code and reusable data
1818
https://newsapi.org/
1919

2020
# Function Main From This Project
21+
// Switch For Using Chuck Interceptor
22+
fun usingChuckInterceptor(context: Context)
23+
24+
// Get Top Headline
25+
fun getTopHeadline(
26+
q: String?,
27+
sources: String?,
28+
category: String?,
29+
country: String?,
30+
pageSize: Int?,
31+
page: Int?,
32+
callback: NewsResultCallback<ArticleResponse>
33+
)
34+
35+
// Get Everythings
36+
fun getEverythings(
37+
q: String?,
38+
from: String?,
39+
to: String?,
40+
qInTitle: String?,
41+
sources: String?,
42+
domains: String?,
43+
excludeDomains: String?,
44+
language: String?,
45+
sortBy: String?,
46+
pageSize: Int?,
47+
page: Int?,
48+
callback: NewsResultCallback<ArticleResponse>
49+
)
50+
51+
// Get Sources
52+
fun getSources(
53+
language: String,
54+
country: String,
55+
category: String,
56+
callback: NewsResultCallback<SourceResponse>
57+
)
2158

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

32-
$version_release = Still on development
69+
$version_release = 1.0.0
3370

3471
What's New??
3572

36-
* Development *
73+
* Fetching All Function on News Api *
3774

3875
# How To Use This Project
39-
- Release soon
76+
<h3>Step 1. Add the JitPack repository to your build file</h3>
77+
78+
Add it in your root build.gradle at the end of repositories:
79+
80+
allprojects {
81+
repositories {
82+
...
83+
maven { url 'https://jitpack.io' }
84+
}
85+
}
86+
87+
88+
<h3>Step 2. Add the dependency</h3>
89+
90+
dependencies {
91+
// library consumable code news api
92+
implementation 'com.github.amirisback:consumable-code-news-api:$version_release'
93+
}
94+
95+
<h3>Step 3. Declaration ConsumeNewsApi</h3>
96+
97+
val consumeNewsApi = ConsumeNewsApi(NewsUrl.NEWS_API_KEY) // Your API_KEY
98+
consumeNewsApi.usingChuckInterceptor(this) // Using Chuck Interceptor
99+
consumeNewsApi.getTopHeadline( // Adding Base Parameter on main function
100+
null,
101+
null,
102+
null,
103+
"id",
104+
null,
105+
null,
106+
object : NewsResultCallback<ArticleResponse> {
107+
override fun getResultData(data: ArticleResponse) {
108+
// Your Ui or data
109+
}
110+
111+
override fun failedResult(statusCode: Int, errorMessage: String?) {
112+
// Your failed to do
113+
}
114+
115+
override fun onShowProgress() {
116+
// Your Progress Show
117+
}
118+
119+
override fun onHideProgress() {
120+
// Your Progress Hide
121+
}
122+
123+
})
124+
40125

41126
# Colaborator
42127
Very open to anyone, I'll write your name under this, please contribute by sending an email to me

app/src/main/java/com/frogobox/newsapi/MainActivity.kt

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class MainActivity : AppCompatActivity() {
1313
super.onCreate(savedInstanceState)
1414
setContentView(R.layout.activity_main)
1515

16-
val consumeNewsApi = ConsumeNewsApi(NewsUrl.NEWS_API_KEY)
16+
val consumeNewsApi = ConsumeNewsApi(NewsUrl.NEWS_API_KEY) // Your API_KEY
1717
consumeNewsApi.usingChuckInterceptor(this)
1818
consumeNewsApi.getTopHeadline(
1919
null,
@@ -23,13 +23,21 @@ class MainActivity : AppCompatActivity() {
2323
null,
2424
null,
2525
object : NewsResultCallback<ArticleResponse> {
26-
override fun getResultData(data: ArticleResponse) {}
26+
override fun getResultData(data: ArticleResponse) {
27+
// Your Ui or data
28+
}
2729

28-
override fun failedResult(statusCode: Int, errorMessage: String?) {}
30+
override fun failedResult(statusCode: Int, errorMessage: String?) {
31+
// Your failed to do
32+
}
2933

30-
override fun onShowProgress() {}
34+
override fun onShowProgress() {
35+
// Your Progress Show
36+
}
3137

32-
override fun onHideProgress() {}
38+
override fun onHideProgress() {
39+
// Your Progress Hide
40+
}
3341

3442
})
3543

0 commit comments

Comments
 (0)