Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #9529 from JosJuice/android-broadcast-before-metadata
Android: Broadcast update before updating additional metadata
  • Loading branch information
leoetlino committed Mar 4, 2021
2 parents 5efd563 + 873d5f9 commit 19c5a19
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
Expand Up @@ -99,21 +99,15 @@ private static LinkedHashSet<String> getPathSet(boolean removeNonExistentFolders
*
* @return true if the cache was modified
*/
public boolean scanLibrary()
public boolean update()
{
boolean recursiveScan = BooleanSetting.MAIN_RECURSIVE_ISO_PATHS.getBooleanGlobal();

LinkedHashSet<String> folderPathsSet = getPathSet(true);

String[] folderPaths = folderPathsSet.toArray(new String[0]);

boolean cacheChanged = update(folderPaths, recursiveScan);
cacheChanged |= updateAdditionalMetadata();
if (cacheChanged)
{
save();
}
return cacheChanged;
return update(folderPaths, recursiveScan);
}

public native int getSize();
Expand All @@ -122,11 +116,11 @@ public boolean scanLibrary()

public native GameFile addOrGet(String gamePath);

private native boolean update(String[] folderPaths, boolean recursiveScan);
public native boolean update(String[] folderPaths, boolean recursiveScan);

private native boolean updateAdditionalMetadata();
public native boolean updateAdditionalMetadata();

public native boolean load();

private native boolean save();
public native boolean save();
}
Expand Up @@ -177,12 +177,24 @@ protected void onHandleIntent(Intent intent)
{
synchronized (gameFileCache)
{
boolean changed = gameFileCache.scanLibrary();
boolean changed = gameFileCache.update();
if (changed)
{
updateGameFileArray();
sendBroadcast(CACHE_UPDATED);
}

boolean additionalMetadataChanged = gameFileCache.updateAdditionalMetadata();
if (additionalMetadataChanged)
{
updateGameFileArray();
sendBroadcast(CACHE_UPDATED);
}

if (changed || additionalMetadataChanged)
{
gameFileCache.save();
}
}
}

Expand Down

0 comments on commit 19c5a19

Please sign in to comment.