Skip to content

Commit ff6ec3d

Browse files
committed
Fixed errors
Made abstract functions public
1 parent 6606cf1 commit ff6ec3d

File tree

6 files changed

+151
-30
lines changed

6 files changed

+151
-30
lines changed

app/build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ android {
1919
}
2020

2121
dependencies {
22-
implementation fileTree(dir: 'libs', include: ['*.jar'])
22+
implementation fileTree(include: ['*.jar'], dir: 'libs')
2323
implementation 'com.android.support:appcompat-v7:28.0.0'
2424
testImplementation 'junit:junit:4.12'
2525
androidTestImplementation 'com.android.support.test:runner:1.0.2'
2626
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
27+
implementation 'com.android.volley:volley:1.1.1'
28+
implementation project(':drfapi')
2729
}

drfapi/bintray_script

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
group = publishedGroupId
2+
version = libraryVersion
3+
4+
install {
5+
repositories.mavenInstaller {
6+
pom.project {
7+
packaging 'aar'
8+
groupId publishedGroupId
9+
artifactId artifact
10+
11+
name libraryName
12+
description libraryDescription
13+
url siteUrl
14+
15+
licenses {
16+
license {
17+
name licenseName
18+
url licenseUrl
19+
}
20+
}
21+
developers {
22+
developer {
23+
id developerId
24+
name developerName
25+
email developerEmail
26+
}
27+
}
28+
scm {
29+
connection gitUrl
30+
developerConnection gitUrl
31+
url siteUrl
32+
}
33+
}
34+
}
35+
}
36+
37+
task sourcesJar(type: Jar) {
38+
classifier = 'sources'
39+
from android.sourceSets.main.java.srcDirs
40+
}
41+
42+
task javadoc(type: Javadoc) {
43+
source = android.sourceSets.main.java.srcDirs
44+
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
45+
}
46+
47+
task javadocJar(type: Jar, dependsOn: javadoc) {
48+
classifier = 'javadoc'
49+
from javadoc.destinationDir
50+
}
51+
52+
artifacts {
53+
archives javadocJar
54+
archives sourcesJar
55+
}
56+
57+
Properties properties = new Properties()
58+
properties.load(project.rootProject.file('local.properties').newDataInputStream())
59+
60+
bintray {
61+
user = properties.getProperty("bintray.user")
62+
key = properties.getProperty("bintray.apikey")
63+
64+
configurations = ['archives']
65+
pkg {
66+
repo = bintrayRepo
67+
name = bintrayName
68+
desc = libraryDescription
69+
websiteUrl = siteUrl
70+
vcsUrl = gitUrl
71+
licenses = allLicenses
72+
dryRun = false
73+
publish = true
74+
override = false
75+
publicDownloadNumbers = true
76+
version {
77+
desc = libraryDescription
78+
}
79+
}
80+
}

drfapi/build.gradle

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
apply plugin: 'com.android.library'
1+
plugins {
2+
id "com.android.library"
3+
id "com.github.dcendents.android-maven" version "2.1"
4+
id "com.jfrog.bintray" version "1.8.4"
5+
}
26

37
android {
48
compileSdkVersion 28
59

6-
7-
810
defaultConfig {
911
minSdkVersion 14
1012
targetSdkVersion 28
1113
versionCode 1
12-
versionName "1.0"
14+
versionName "0.1b"
1315

1416
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
1517

@@ -25,11 +27,36 @@ android {
2527
}
2628

2729
dependencies {
28-
implementation fileTree(dir: 'libs', include: ['*.jar'])
29-
30-
implementation 'com.android.volley:volley:1.1.1'
30+
implementation fileTree(include: ['*.jar'], dir: 'libs')
3131
implementation 'com.android.support:appcompat-v7:28.0.0'
3232
testImplementation 'junit:junit:4.12'
33+
implementation 'com.android.volley:volley:1.1.1'
3334
androidTestImplementation 'com.android.support.test:runner:1.0.2'
3435
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
3536
}
37+
38+
ext {
39+
bintrayRepo = 'Django-REST-Framework'
40+
bintrayName = 'DRFAPI'
41+
42+
publishedGroupId = 'com.civilmachines.drfapi'
43+
libraryName = 'Django REST Framework API'
44+
artifact = 'drfapi'
45+
46+
libraryDescription = 'DRFAPI or Django REST Framework API provides a collection of classes that allow easy integration of REST APIs build on Django REST Framework or similar standards. It contains Request classes, Error Handlers and other utility Java classes for easy integration of Android with DRF based back end.'
47+
48+
siteUrl = 'https://github.com/101Loop/drf-android/'
49+
gitUrl = 'https://github.com/101Loop/drf-android.git'
50+
51+
libraryVersion = '0.0.1'
52+
53+
developerId = 'iamhssingh'
54+
developerName = 'Himanshu Shankar'
55+
developerEmail = '[email protected]'
56+
57+
licenseName = 'The Apache Software License, Version 2.0'
58+
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
59+
allLicenses = ["Apache-2.0"]
60+
}
61+
62+
apply from: 'bintray_script'

drfapi/src/main/java/com/civilmachines/drfapi/DjangoErrorListener.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,31 +31,31 @@
3131

3232
public abstract class DjangoErrorListener implements Response.ErrorListener {
3333

34-
abstract void onNetworkError(String response);
35-
abstract void onAuthFailureError(String response);
36-
abstract void onTimeoutError(String response);
37-
abstract void onNoConnectionError(String response);
38-
abstract void onParseError(String response);
34+
public abstract void onNetworkError(String response);
35+
public abstract void onAuthFailureError(String response);
36+
public abstract void onTimeoutError(String response);
37+
public abstract void onNoConnectionError(String response);
38+
public abstract void onParseError(String response);
3939

40-
abstract void onMethodNotAllowedError(String message);
41-
abstract void onNotFoundError(String message);
40+
public abstract void onMethodNotAllowedError(String message);
41+
public abstract void onNotFoundError(String message);
4242

43-
abstract void onBadRequestError(String message);
44-
abstract void onBadRequestError(JSONObject response);
43+
public abstract void onBadRequestError(String message);
44+
public abstract void onBadRequestError(JSONObject response);
4545

46-
abstract void onForbiddenError(String message);
46+
public abstract void onForbiddenError(String message);
4747

48-
abstract void onUnprocessableEntityError(String message);
49-
abstract void onUnprocessableEntityError(JSONObject response);
48+
public abstract void onUnprocessableEntityError(String message);
49+
public abstract void onUnprocessableEntityError(JSONObject response);
5050

51-
abstract void onUnsupportedMediaTypeError(String message);
51+
public abstract void onUnsupportedMediaTypeError(String message);
5252

53-
abstract void onNonJsonError(String response);
54-
abstract void onDefaultJsonError(JSONObject response);
55-
abstract void onDefaultHTMLError(String response);
53+
public abstract void onNonJsonError(String response);
54+
public abstract void onDefaultJsonError(JSONObject response);
55+
public abstract void onDefaultHTMLError(String response);
5656

57-
abstract void onServerError(String response);
58-
abstract void onDefaultError(String response);
57+
public abstract void onServerError(String response);
58+
public abstract void onDefaultError(String response);
5959

6060
/**
6161
* Parses the error based on StatusCode

drfapi/src/main/java/com/civilmachines/drfapi/DjangoJSONArrayResponseRequest.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,15 @@ public DjangoJSONArrayResponseRequest(int method,
7070
}
7171

7272
/**
73-
* Constructor which defaults to <code>GET</code> if <code>jsonRequest</code> is
74-
* <code>null</code>, <code>POST</code> otherwise.
73+
* Constructor without method. Decides method on the basis of jsonRequest body
7574
*
75+
* @param url API Endpoint
76+
* @param jsonRequest body
77+
* @param listener response listener
78+
* @param errorListener error listener (must implement {@link DjangoErrorListener}
79+
* @param context context for accessing SharedPreference
80+
*
81+
* @author Himanshu Shankar (https://himanshus.com)
7682
*/
7783
public DjangoJSONArrayResponseRequest(String url,
7884
@Nullable JSONObject jsonRequest,

drfapi/src/main/java/com/civilmachines/drfapi/DjangoJSONObjectRequest.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,15 @@ public DjangoJSONObjectRequest(int method,
6969
}
7070

7171
/**
72-
* Constructor which defaults to <code>GET</code> if <code>jsonRequest</code> is
73-
* <code>null</code>, <code>POST</code> otherwise.
72+
* Constructor without method. Decides method on the basis of jsonRequest body
7473
*
74+
* @param url API Endpoint
75+
* @param jsonRequest body
76+
* @param listener response listener
77+
* @param errorListener error listener (must implement {@link DjangoErrorListener}
78+
* @param context context for accessing SharedPreference
79+
*
80+
* @author Himanshu Shankar (https://himanshus.com)
7581
*/
7682
public DjangoJSONObjectRequest(String url,
7783
@Nullable JSONObject jsonRequest,

0 commit comments

Comments
 (0)