Skip to content

Commit 40ca6ea

Browse files
separate out api lib
Signed-off-by: Arnav Gupta <[email protected]>
1 parent a196371 commit 40ca6ea

File tree

15 files changed

+303
-39
lines changed

15 files changed

+303
-39
lines changed

.idea/inspectionProfiles/Project_Default.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/markdown-navigator.xml

+78
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/markdown-navigator/profiles_settings.xml

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

+3-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle

+17-6
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,38 @@ ext.ankoVersion = '0.10.5'
2828
dependencies {
2929
implementation fileTree(dir: 'libs', include: ['*.jar'])
3030
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
31+
implementation 'com.google.android.material:material:1.0.0-rc02'
32+
33+
// Android Support
3134
implementation 'androidx.appcompat:appcompat:1.0.0-rc02'
3235
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
33-
implementation 'com.google.android.material:material:1.0.0-rc02'
3436
implementation 'androidx.legacy:legacy-support-v4:1.0.0-rc02'
37+
38+
// 3rd party libs
3539
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
3640
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
3741
implementation 'com.squareup.picasso:picasso:2.71828'
42+
implementation 'de.hdodenhof:circleimageview:2.2.0'
43+
implementation 'com.github.ar-android:AndroidSvgLoader:1.0.1'
44+
implementation 'com.ethanhua:skeleton:1.1.1'
45+
implementation 'io.supercharge:shimmerlayout:2.1.0'
46+
47+
// Test Deps
3848
testImplementation 'junit:junit:4.12'
3949
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
4050
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
4151

42-
def anko = ['sdk15', 'sdk15-listeners', 'support-v4', 'design', 'appcompat-v7', 'recyclerview-v7', 'percent', 'cardview-v7']
52+
def anko = [
53+
'commons',
54+
// 'sdk15', 'sdk15-listeners',
55+
// 'support-v4', 'appcompat-v7',
56+
// 'design', 'recyclerview-v7', 'percent', 'cardview-v7'
57+
]
4358

4459
anko.each { name ->
4560
implementation "org.jetbrains.anko:anko-$name:$ankoVersion"
4661
}
4762

48-
implementation 'de.hdodenhof:circleimageview:2.2.0'
49-
implementation 'com.github.ar-android:AndroidSvgLoader:1.0.1'
50-
implementation 'com.ethanhua:skeleton:1.1.1'
51-
implementation 'io.supercharge:shimmerlayout:2.1.0'
5263

5364

5465
}
Original file line numberDiff line numberDiff line change
@@ -1,23 +1 @@
11
package com.codingblocks.cbonlineapp.API
2-
3-
import retrofit2.Retrofit
4-
import retrofit2.converter.gson.GsonConverterFactory
5-
6-
7-
object Client {
8-
9-
val retrofitAuth = Retrofit.Builder()
10-
.baseUrl("https://account.codingblocks.com/apiAuth/users/")
11-
.addConverterFactory(GsonConverterFactory.create())
12-
.build()
13-
14-
val apiAuth = retrofitAuth.create(JsonPlaceholderApi::class.java)
15-
16-
val retrofit = Retrofit.Builder()
17-
.baseUrl("https://api-online.cb.lk/api/v2/")
18-
.addConverterFactory(GsonConverterFactory.create())
19-
.build()
20-
21-
val api = retrofit.create(JsonPlaceholderApi::class.java)
22-
23-
}

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ buildscript {
99
dependencies {
1010
classpath 'com.android.tools.build:gradle:3.2.0-rc03'
1111
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
12+
classpath 'com.android.tools.build.jetifier:jetifier-processor:1.0.0-alpha10'
1213

1314
// NOTE: Do not place your application dependencies here; they belong
1415
// in the individual module build.gradle files
1516
}
1617
}
17-
1818
allprojects {
1919
repositories {
2020
google()

onlineapi/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

onlineapi/build.gradle

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apply plugin: 'java-library'
2+
apply plugin: 'kotlin'
3+
4+
dependencies {
5+
implementation fileTree(dir: 'libs', include: ['*.jar'])
6+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
7+
8+
// 3rd party libs
9+
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
10+
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
11+
12+
}
13+
14+
sourceCompatibility = "7"
15+
targetCompatibility = "7"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.codingblocks.onlineapi
2+
3+
4+
import com.codingblocks.onlineapi.api.AuthApi
5+
import com.codingblocks.onlineapi.api.OnlineApi
6+
import retrofit2.Retrofit
7+
import retrofit2.converter.gson.GsonConverterFactory
8+
9+
10+
object Client {
11+
12+
val retrofitAuth = Retrofit.Builder()
13+
.baseUrl("https://account.codingblocks.com/apiAuth/users/")
14+
.addConverterFactory(GsonConverterFactory.create())
15+
.build()
16+
17+
val apiAuth = retrofitAuth.create(AuthApi::class.java)
18+
19+
val retrofit = Retrofit.Builder()
20+
.baseUrl("https://api-online.cb.lk/api/v2/")
21+
.addConverterFactory(GsonConverterFactory.create())
22+
.build()
23+
24+
val api = retrofit.create(OnlineApi::class.java)
25+
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.codingblocks.onlineapi.api
2+
3+
import com.codingblocks.onlineapi.models.User
4+
import retrofit2.Call
5+
import retrofit2.http.GET
6+
import retrofit2.http.Header
7+
import retrofit2.http.Path
8+
9+
interface AuthApi {
10+
@GET("me")
11+
fun getMe(@Header("Authorization") authorization: String): Call<User>
12+
13+
@GET("{id}")
14+
fun getUser(@Header("Authorization") authorization: String, @Path("id") id: Int): Call<User>
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.codingblocks.onlineapi.api
2+
3+
import com.codingblocks.onlineapi.models.CourseModel
4+
import retrofit2.Call
5+
import retrofit2.http.GET
6+
import retrofit2.http.Query
7+
8+
interface OnlineApi {
9+
10+
interface JsonPlaceholderApi {
11+
12+
@GET("courses")
13+
fun getRecommendedCourses(
14+
@Query("exclude") query: String = "ratings",
15+
@Query("filter[recommended]") recommended: String = "true",
16+
@Query("filter[unlisted]") unlisted: String = "false",
17+
@Query("include") include: String = "instructors,runs",
18+
@Query("sort") sort: String = "difficulty"): Call<CourseModel>
19+
}
20+
21+
}

0 commit comments

Comments
 (0)