Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added synchronized blocks to prevent thread collisions.
* Updated build dependencies.
  • Loading branch information
audaciouscode committed Mar 30, 2017
1 parent 834411e commit 35aead2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
16 changes: 8 additions & 8 deletions build.gradle
Expand Up @@ -45,14 +45,14 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
// testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:recyclerview-v7:25.2.0'
compile 'com.android.support:cardview-v7:25.2.0'
compile 'com.google.android.gms:play-services-location:10.2.0'
compile 'com.google.android.gms:play-services-maps:10.2.0'
compile 'com.google.android.gms:play-services-nearby:10.2.0'
compile 'com.google.android.gms:play-services-places:10.2.0'
compile 'com.google.android.gms:play-services-awareness:10.2.0'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.google.android.gms:play-services-location:10.2.1'
compile 'com.google.android.gms:play-services-maps:10.2.1'
compile 'com.google.android.gms:play-services-nearby:10.2.1'
compile 'com.google.android.gms:play-services-places:10.2.1'
compile 'com.google.android.gms:play-services-awareness:10.2.1'
compile 'com.google.maps.android:android-maps-utils:0.4'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
compile 'commons-io:commons-io:2.4'
Expand Down
Expand Up @@ -250,8 +250,10 @@ public void notifyGeneratorUpdated(String identifier, long timestamp, Bundle bun
public void notifyGeneratorUpdated(String identifier, Bundle bundle) {
long timestamp = System.currentTimeMillis();

for (GeneratorUpdatedListener listener : this.mGeneratorUpdatedListeners) {
listener.onGeneratorUpdated(identifier, timestamp, bundle);
synchronized(this.mGeneratorUpdatedListeners) {
for (GeneratorUpdatedListener listener : this.mGeneratorUpdatedListeners) {
listener.onGeneratorUpdated(identifier, timestamp, bundle);
}
}
}

Expand All @@ -273,11 +275,15 @@ private void setContext(Context context) {
}

public void addNewGeneratorUpdatedListener(Generators.GeneratorUpdatedListener listener) {
this.mGeneratorUpdatedListeners.add(listener);
synchronized(this.mGeneratorUpdatedListeners) {
this.mGeneratorUpdatedListeners.add(listener);
}
}

public void removeGeneratorUpdatedListener(Generators.GeneratorUpdatedListener listener) {
this.mGeneratorUpdatedListeners.remove(listener);
synchronized(this.mGeneratorUpdatedListeners) {
this.mGeneratorUpdatedListeners.remove(listener);
}
}

public interface GeneratorUpdatedListener {
Expand Down

0 comments on commit 35aead2

Please sign in to comment.