Invert if to reduce nesting.
This commit is contained in:
parent
599abfafaa
commit
be1564fe54
|
@ -33,23 +33,23 @@ class FastImageViewModule extends ReactContextBaseJavaModule {
|
||||||
@ReactMethod
|
@ReactMethod
|
||||||
public void preload(final ReadableArray sources) {
|
public void preload(final ReadableArray sources) {
|
||||||
final Activity activity = getCurrentActivity();
|
final Activity activity = getCurrentActivity();
|
||||||
if (activity != null)
|
if (activity == null) return;
|
||||||
activity.runOnUiThread(new Runnable() {
|
activity.runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
for (int i = 0; i < sources.size(); i++) {
|
for (int i = 0; i < sources.size(); i++) {
|
||||||
final ReadableMap source = sources.getMap(i);
|
final ReadableMap source = sources.getMap(i);
|
||||||
final GlideUrl glideUrl = FastImageViewConverter.glideUrl(source);
|
final GlideUrl glideUrl = FastImageViewConverter.glideUrl(source);
|
||||||
final Priority priority = FastImageViewConverter.priority(source);
|
final Priority priority = FastImageViewConverter.priority(source);
|
||||||
Glide
|
Glide
|
||||||
.with(activity.getApplicationContext())
|
.with(activity.getApplicationContext())
|
||||||
.load(glideUrl)
|
.load(glideUrl)
|
||||||
.priority(priority)
|
.priority(priority)
|
||||||
.placeholder(TRANSPARENT_DRAWABLE)
|
.placeholder(TRANSPARENT_DRAWABLE)
|
||||||
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
|
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
|
||||||
.preload();
|
.preload();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue