Merge pull request #9529 from JosJuice/android-broadcast-before-metadata
Android: Broadcast update before updating additional metadata
This commit is contained in:
commit
19c5a19629
|
@ -99,7 +99,7 @@ public class GameFileCache
|
|||
*
|
||||
* @return true if the cache was modified
|
||||
*/
|
||||
public boolean scanLibrary()
|
||||
public boolean update()
|
||||
{
|
||||
boolean recursiveScan = BooleanSetting.MAIN_RECURSIVE_ISO_PATHS.getBooleanGlobal();
|
||||
|
||||
|
@ -107,13 +107,7 @@ public class GameFileCache
|
|||
|
||||
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();
|
||||
|
@ -122,11 +116,11 @@ public class GameFileCache
|
|||
|
||||
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();
|
||||
}
|
||||
|
|
|
@ -177,12 +177,24 @@ public final class GameFileCacheService extends IntentService
|
|||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue