Skip to content

Commit c7012ba

Browse files
committed
Minor updates
- Added reset support to uploads - Some bugfixes - Updated lib versions
1 parent cfeccf6 commit c7012ba

10 files changed

Lines changed: 36 additions & 16 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ you it is possible to disable that.
2020
}
2121
2222
dependencies {
23-
compile 'com.projectplace.android:syncmanager:1.1.0'
23+
compile 'com.projectplace.android:syncmanager:1.1.1'
2424
}
2525
```
2626

build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ buildscript {
77
google()
88
}
99
dependencies {
10-
classpath 'com.android.tools.build:gradle:3.4.2'
10+
classpath 'com.android.tools.build:gradle:4.1.1'
1111

1212
// NOTE: Do not place your application dependencies here; they belong
1313
// in the individual module build.gradle files
@@ -17,5 +17,6 @@ buildscript {
1717
allprojects {
1818
repositories {
1919
jcenter()
20+
google()
2021
}
2122
}

gradle.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,6 @@
1515
# When configured, Gradle will run in incubating parallel mode.
1616
# This option should only be used with decoupled projects. More details, visit
1717
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18-
# org.gradle.parallel=true
18+
# org.gradle.parallel=true
19+
android.enableJetifier=true
20+
android.useAndroidX=true

sample/build.gradle

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
apply plugin: 'com.android.application'
22

33
android {
4-
compileSdkVersion 25
4+
compileSdkVersion 29
55
buildToolsVersion "25.0.3"
66

77
defaultConfig {
88
applicationId "com.projectplace.android.syncmanager.sample"
9-
minSdkVersion 11
10-
targetSdkVersion 25
9+
minSdkVersion 16
10+
targetSdkVersion 29
1111
versionCode 1
1212
versionName "1.0"
1313
}
@@ -20,10 +20,10 @@ android {
2020
}
2121

2222
dependencies {
23-
compile fileTree(include: ['*.jar'], dir: 'libs')
24-
testCompile 'junit:junit:4.12'
25-
compile 'com.android.support:appcompat-v7:25.3.1'
26-
compile 'com.squareup.retrofit:retrofit:1.9.0'
27-
compile 'joda-time:joda-time:2.3'
28-
compile project(':syncmanager')
23+
implementation fileTree(include: ['*.jar'], dir: 'libs')
24+
testImplementation 'junit:junit:4.12'
25+
implementation 'androidx.appcompat:appcompat:1.2.0'
26+
implementation 'com.squareup.retrofit:retrofit:1.9.0'
27+
implementation 'joda-time:joda-time:2.10.1'
28+
implementation project(':syncmanager')
2929
}

sample/src/main/java/com/projectplace/android/syncmanager/sample/MainActivity.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
package com.projectplace.android.syncmanager.sample;
1818

1919
import android.os.Bundle;
20+
21+
import androidx.annotation.NonNull;
2022
import androidx.appcompat.app.AppCompatActivity;
2123
import android.view.View;
2224
import android.widget.TextView;
@@ -134,6 +136,10 @@ public void onUploadDone(SyncUpload syncUpload) {
134136
renderText();
135137
}
136138

139+
@Override
140+
public void onSyncAborted(@NonNull SyncObject syncObject) {
141+
}
142+
137143
private void renderText() {
138144
String accessToken = MySharedPreferences.getInstance().getAccessToken();
139145
mAccessToken.setText(accessToken != null ? accessToken : "null");

syncmanager/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ repositories {
1212
}
1313

1414
android {
15-
compileSdkVersion 27
15+
compileSdkVersion 29
1616
buildToolsVersion '28.0.3'
1717

1818
defaultConfig {
1919
minSdkVersion 16
20-
targetSdkVersion 27
20+
targetSdkVersion 29
2121
versionCode 1
2222
versionName "1.0"
2323
}
@@ -31,7 +31,7 @@ android {
3131

3232
dependencies {
3333
implementation fileTree(dir: 'libs', include: ['*.jar'])
34-
implementation 'androidx.annotation:annotation:1.0.0'
34+
implementation 'androidx.annotation:annotation:1.1.0'
3535
androidTestImplementation 'junit:junit:4.12'
3636
}
3737

syncmanager/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
BIN_TRAY_NAME = AndroidSyncManager
2-
LIB_VERSION = 1.1.1
2+
LIB_VERSION = 1.1.2
33
LIB_GROUP_ID = com.projectplace.android
44

55
# The artifact name should be the same as the library module name

syncmanager/src/main/java/com/projectplace/android/syncmanager/SyncManager.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ protected void onPostExecute(Void aVoid) {
336336
}
337337
if (syncUpload.getSyncListener() != null) {
338338
syncUpload.getSyncListener().onUploadDone(syncUpload);
339+
syncUpload.setSyncListener(null);
339340
}
340341
}
341342
}.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
@@ -410,6 +411,7 @@ protected void onPostExecute(Void isDone) {
410411
}
411412
if (syncFetch.getSyncListener() != null) {
412413
syncFetch.getSyncListener().onFetchDone(syncFetch);
414+
syncFetch.setSyncListener(null);
413415
}
414416
}
415417
}.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
@@ -435,6 +437,7 @@ public void onSyncAborted(@NonNull SyncObject syncObject) {
435437
}
436438
if (syncObject.getSyncListener() != null) {
437439
syncObject.getSyncListener().onSyncAborted(syncObject);
440+
syncObject.setSyncListener(null);
438441
}
439442
}
440443

syncmanager/src/main/java/com/projectplace/android/syncmanager/SyncObject.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ void setManagerSyncListener(@NonNull SyncListener listener) {
8080

8181
void reset() {
8282
mError = null;
83+
mErrorMessage = null;
8384
mFailed = false;
8485
mStarted = false;
8586
mListenerCalled = false;
@@ -140,6 +141,8 @@ public void run() {
140141
}
141142

142143
private void syncDone() {
144+
if (mManagerSyncListener == null) return;
145+
143146
if (this instanceof SyncFetch) {
144147
mManagerSyncListener.onFetchDone((SyncFetch) this);
145148
} else {

syncmanager/src/main/java/com/projectplace/android/syncmanager/SyncUpload.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ public SyncUpload() {
2828
setIsBackgroundSync(false);
2929
}
3030

31+
public void reset() {
32+
super.reset();
33+
mUploadSucceeded = false;
34+
}
35+
3136
/**
3237
* An extra prepare runnable can be added to the sync object to be able to run prepare operations outside the sync
3338
* object. This will be called directly after the sync object has been added to the sync manager.

0 commit comments

Comments
 (0)