Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
shubham1g5 committed Dec 26, 2024
1 parent 1e8dfd3 commit 32d554e
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
3 changes: 3 additions & 0 deletions app/src/org/commcare/tasks/EntityLoaderHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ import org.commcare.suite.model.EntityDatum
import org.javarosa.core.model.condition.EvaluationContext
import org.javarosa.core.model.instance.TreeReference

/**
* Helper class to load entities for an entity screen
*/
class EntityLoaderHelper(
detail: Detail,
sessionDatum: EntityDatum?,
Expand Down
2 changes: 1 addition & 1 deletion app/src/org/commcare/tasks/EntityLoaderListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public interface EntityLoaderListener {
void attachLoader(EntityLoaderTask task);

void deliverLoadResult(List<Entity<TreeReference>> entities, List<TreeReference> references,
NodeEntityFactory factory, int focusTargetIndex);
NodeEntityFactory factory, int focusTargetIndex);

void deliverLoadError(Exception e);

Expand Down
10 changes: 6 additions & 4 deletions app/src/org/commcare/tasks/EntityLoaderTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
* @author ctsims
*/
public class EntityLoaderTask
extends ManagedAsyncTask<TreeReference, Integer, Pair<List<Entity<TreeReference>>, List<TreeReference>>> implements
extends
ManagedAsyncTask<TreeReference, Integer, Pair<List<Entity<TreeReference>>, List<TreeReference>>> implements
EntityLoadingProgressListener {

private final static Object lock = new Object();
Expand All @@ -34,12 +35,13 @@ public class EntityLoaderTask

/**
* Creates a new instance
* @param detail detail we want to load
*
* @param detail detail we want to load
* @param entityDatum entity datum corresponding to the entity list, null for entity detail screens
* @param evalCtx evaluation context
* @param evalCtx evaluation context
*/
public EntityLoaderTask(Detail detail, @Nullable EntityDatum entityDatum, EvaluationContext evalCtx) {
entityLoaderHelper = new EntityLoaderHelper(detail, entityDatum , evalCtx);
entityLoaderHelper = new EntityLoaderHelper(detail, entityDatum, evalCtx);
}

@Override
Expand Down
6 changes: 4 additions & 2 deletions app/src/org/commcare/tasks/PrimeEntityCache.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import androidx.work.Worker
import androidx.work.WorkerParameters
import org.javarosa.core.services.Logger

class PrimeEntityCache(appContext: Context, workerParams: WorkerParameters)
: Worker(appContext, workerParams) {
/**
* Android Worker to prime cache for entity screens
*/
class PrimeEntityCache(appContext: Context, workerParams: WorkerParameters) : Worker(appContext, workerParams) {

override fun doWork(): Result {
try {
Expand Down
3 changes: 3 additions & 0 deletions app/src/org/commcare/tasks/PrimeEntityCacheHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ import org.javarosa.xpath.XPathException
class PrimeEntityCacheHelper private constructor() : Cancellable {

private var entityLoaderHelper: EntityLoaderHelper? = null

@Volatile
private var inProgress = false

@Volatile
private var currentDatumInProgress: String? = null
private var listener: EntityLoadingProgressListener? = null
Expand Down Expand Up @@ -171,6 +173,7 @@ class PrimeEntityCacheHelper private constructor() : Cancellable {
entityLoaderHelper!!.cacheEntities(entities)
entities
}

else -> entityLoaderHelper!!.cacheEntities(entityDatum.nodeset).first
}
_cachedEntitiesState.value = cachedEntities
Expand Down

0 comments on commit 32d554e

Please sign in to comment.