Skip to content

Commit 1c42c93

Browse files
committed
Updates
- Gradle to 2.9 - Android Gradle plugin to 1.5.0 - Bridge to 1.7.0
1 parent cabbab0 commit 1c42c93

7 files changed

Lines changed: 23 additions & 40 deletions

File tree

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55
jcenter()
66
}
77
dependencies {
8-
classpath 'com.android.tools.build:gradle:1.3.1'
8+
classpath 'com.android.tools.build:gradle:1.5.0'
99
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
1010
}
1111
}

gradle/wrapper/gradle-wrapper.jar

3.65 KB
Binary file not shown.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Mon Nov 16 09:32:07 CET 2015
1+
#Tue Nov 24 22:16:28 CET 2015
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-2.9-bin.zip

gradlew

Lines changed: 3 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

library/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ android {
2424
dependencies {
2525
compile fileTree(dir: 'libs', include: ['*.jar'])
2626
compile 'com.android.support:support-annotations:23.1.1'
27-
compile 'com.github.afollestad:bridge:1.6.4@aar'
27+
compile 'com.github.afollestad:bridge:1.7.0@aar'
2828
}
2929

3030
// build a jar with source files
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<manifest xmlns:tools="http://schemas.android.com/tools"
22
package="com.proxerme.library">
33

4-
<application tools:ignore="AllowBackup" />
4+
<application tools:ignore="AllowBackup,GoogleAppIndexingWarning" />
55

66
</manifest>

library/src/main/java/com/proxerme/library/connection/ProxerConnection.java

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -97,33 +97,21 @@ public static ConferencesRequest loadConferences(@IntRange(from = 1) int page) {
9797
}
9898

9999
/**
100-
* Cancels all asynchronous started requests of the specified tag.
100+
* Cancels all started requests of the specified tag.
101101
*
102102
* @param tag The {@link ProxerTag} to cancel
103103
* @see ProxerTag
104-
* @see #cancelSync(int)
105104
*/
106105
public static void cancel(@ConnectionTag int tag) {
107-
Bridge.client().cancelAll(tag, false);
108-
}
109-
110-
/**
111-
* Cancels all synchronous started requests of the specified tag.
112-
*
113-
* @param tag The {@link ProxerTag} to cancel
114-
* @see ProxerTag
115-
* @see #cancel(int)
116-
*/
117-
public static void cancelSync(@ConnectionTag int tag) {
118-
Bridge.client().cancelAllSync(tag, false);
106+
Bridge.cancelAll().tag(String.valueOf(tag)).commit();
119107
}
120108

121109
/**
122110
* Does some initialization steps. You *must* call this method somewhere in your lifecycle. A
123111
* good place might be the onCreate method of your main Activity.
124112
*/
125113
public static void init() {
126-
Bridge.client().config().validators(new ResponseValidator() {
114+
Bridge.config().validators(new ResponseValidator() {
127115
@Override
128116
public boolean validate(@NonNull Response response) throws Exception {
129117
JSONObject json = response.asJsonObject();
@@ -163,7 +151,7 @@ public static void cleanup() {
163151
}
164152

165153
parseThreads.clear();
166-
Bridge.cleanup();
154+
Bridge.destroy();
167155
}
168156

169157
/**
@@ -201,11 +189,10 @@ public static abstract class ProxerRequest<T> {
201189
* {@link #execute(ResultCallback)} or
202190
* {@link #executeSynchronized()} method.
203191
*
204-
* @param bridge The Bridge instance to build the request with.
205192
* @return The {@link RequestBuilder} to use for further invocations.
206193
*/
207194
@NonNull
208-
protected abstract RequestBuilder buildRequest(@NonNull Bridge bridge);
195+
protected abstract RequestBuilder buildRequest();
209196

210197
/**
211198
* Returns the {@link ProxerTag} of this request.
@@ -223,7 +210,7 @@ public static abstract class ProxerRequest<T> {
223210
*/
224211
@RequiresPermission(android.Manifest.permission.INTERNET)
225212
public final void execute(@NonNull final ResultCallback<T> callback) {
226-
buildRequest(Bridge.client()).tag(getTag()).request(new Callback() {
213+
buildRequest().tag(getTag()).request(new Callback() {
227214
@Override
228215
public void response(Request request, final Response response, BridgeException exception) {
229216
if (exception == null) {
@@ -279,7 +266,7 @@ public void run() {
279266
@RequiresPermission(android.Manifest.permission.INTERNET)
280267
public final T executeSynchronized() throws ProxerException {
281268
try {
282-
JSONObject result = buildRequest(Bridge.client()).tag(getTag() + 1).asJsonObject();
269+
JSONObject result = buildRequest().tag(getTag() + 1).asJsonObject();
283270

284271
return parse(result);
285272
} catch (JSONException e) {
@@ -312,8 +299,8 @@ public NewsRequest(@IntRange(from = 1) int page) {
312299

313300
@NonNull
314301
@Override
315-
protected RequestBuilder buildRequest(@NonNull Bridge bridge) {
316-
return bridge.get(UrlHolder.getNewsUrl(page));
302+
protected RequestBuilder buildRequest() {
303+
return Bridge.get(UrlHolder.getNewsUrl(page));
317304
}
318305

319306
@ConnectionTag
@@ -341,11 +328,11 @@ public LoginRequest(@NonNull LoginUser user) {
341328

342329
@NonNull
343330
@Override
344-
protected RequestBuilder buildRequest(@NonNull Bridge bridge) {
331+
protected RequestBuilder buildRequest() {
345332
Form loginCredentials = new Form().add(FORM_USERNAME, user.getUsername())
346333
.add(FORM_PASSWORD, user.getPassword());
347334

348-
return bridge.post(UrlHolder.getLoginUrl()).body(loginCredentials);
335+
return Bridge.post(UrlHolder.getLoginUrl()).body(loginCredentials);
349336
}
350337

351338
@ConnectionTag
@@ -370,8 +357,8 @@ public static class LogoutRequest extends ProxerRequest<Void> {
370357

371358
@NonNull
372359
@Override
373-
protected RequestBuilder buildRequest(@NonNull Bridge bridge) {
374-
return bridge.get(UrlHolder.getLogoutUrl());
360+
protected RequestBuilder buildRequest() {
361+
return Bridge.get(UrlHolder.getLogoutUrl());
375362
}
376363

377364
@ConnectionTag
@@ -399,8 +386,8 @@ public ConferencesRequest(@IntRange(from = 1) int page) {
399386

400387
@NonNull
401388
@Override
402-
protected RequestBuilder buildRequest(@NonNull Bridge bridge) {
403-
return bridge.get(UrlHolder.getConferencesUrl(page));
389+
protected RequestBuilder buildRequest() {
390+
return Bridge.get(UrlHolder.getConferencesUrl(page));
404391
}
405392

406393
@Override

0 commit comments

Comments
 (0)