summaryrefslogtreecommitdiff
path: root/Source/Android/app/src/main/java
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2022-09-27 18:20:22 +0200
committerJosJuice <josjuice@gmail.com>2022-09-27 18:47:54 +0200
commitf857fa652905a78fac852bf3917878bfb21416b3 (patch)
treeb9d25714c4c0afd0a96cee1c2c29c13f6780609c /Source/Android/app/src/main/java
parent199d2be9390f64da76131c0d0c64ea550c5bd012 (diff)
Android: Add s prefix to static variables in GameFileCacheManager
Diffstat (limited to 'Source/Android/app/src/main/java')
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/GameFileCacheManager.java82
1 files changed, 41 insertions, 41 deletions
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/GameFileCacheManager.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/GameFileCacheManager.java
index f53e3de56f..ad5f225374 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/GameFileCacheManager.java
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/GameFileCacheManager.java
@@ -23,14 +23,14 @@ import java.util.concurrent.Executors;
*/
public final class GameFileCacheManager
{
- private static GameFileCache gameFileCache = null;
- private static final MutableLiveData<GameFile[]> gameFiles =
+ private static GameFileCache sGameFileCache = null;
+ private static final MutableLiveData<GameFile[]> sGameFiles =
new MutableLiveData<>(new GameFile[]{});
- private static boolean runRescanAfterLoad = false;
+ private static boolean sRunRescanAfterLoad = false;
- private static final ExecutorService executor = Executors.newFixedThreadPool(1);
- private static final MutableLiveData<Boolean> loadInProgress = new MutableLiveData<>(false);
- private static final MutableLiveData<Boolean> rescanInProgress = new MutableLiveData<>(false);
+ private static final ExecutorService sExecutor = Executors.newFixedThreadPool(1);
+ private static final MutableLiveData<Boolean> sLoadInProgress = new MutableLiveData<>(false);
+ private static final MutableLiveData<Boolean> sRescanInProgress = new MutableLiveData<>(false);
private GameFileCacheManager()
{
@@ -38,12 +38,12 @@ public final class GameFileCacheManager
public static LiveData<GameFile[]> getGameFiles()
{
- return gameFiles;
+ return sGameFiles;
}
public static List<GameFile> getGameFilesForPlatform(Platform platform)
{
- GameFile[] allGames = gameFiles.getValue();
+ GameFile[] allGames = sGameFiles.getValue();
ArrayList<GameFile> platformGames = new ArrayList<>();
for (GameFile game : allGames)
{
@@ -57,7 +57,7 @@ public final class GameFileCacheManager
public static GameFile getGameFileByGameId(String gameId)
{
- GameFile[] allGames = gameFiles.getValue();
+ GameFile[] allGames = sGameFiles.getValue();
for (GameFile game : allGames)
{
if (game.getGameId().equals(gameId))
@@ -72,7 +72,7 @@ public final class GameFileCacheManager
{
GameFile matchWithoutRevision = null;
- GameFile[] allGames = gameFiles.getValue();
+ GameFile[] allGames = sGameFiles.getValue();
for (GameFile otherGame : allGames)
{
if (game.getGameId().equals(otherGame.getGameId()) &&
@@ -102,7 +102,7 @@ public final class GameFileCacheManager
*/
public static LiveData<Boolean> isLoading()
{
- return loadInProgress;
+ return sLoadInProgress;
}
/**
@@ -110,12 +110,12 @@ public final class GameFileCacheManager
*/
public static LiveData<Boolean> isRescanning()
{
- return rescanInProgress;
+ return sRescanInProgress;
}
public static boolean isLoadingOrRescanning()
{
- return loadInProgress.getValue() || rescanInProgress.getValue();
+ return sLoadInProgress.getValue() || sRescanInProgress.getValue();
}
/**
@@ -125,11 +125,11 @@ public final class GameFileCacheManager
*/
public static void startLoad(Context context)
{
- if (!loadInProgress.getValue())
+ if (!sLoadInProgress.getValue())
{
- loadInProgress.setValue(true);
+ sLoadInProgress.setValue(true);
new AfterDirectoryInitializationRunner().runWithoutLifecycle(
- () -> executor.execute(GameFileCacheManager::load));
+ () -> sExecutor.execute(GameFileCacheManager::load));
}
}
@@ -141,11 +141,11 @@ public final class GameFileCacheManager
*/
public static void startRescan(Context context)
{
- if (!rescanInProgress.getValue())
+ if (!sRescanInProgress.getValue())
{
- rescanInProgress.setValue(true);
+ sRescanInProgress.setValue(true);
new AfterDirectoryInitializationRunner().runWithoutLifecycle(
- () -> executor.execute(GameFileCacheManager::rescan));
+ () -> sExecutor.execute(GameFileCacheManager::rescan));
}
}
@@ -153,8 +153,8 @@ public final class GameFileCacheManager
{
// Common case: The game is in the cache, so just grab it from there.
// (Actually, addOrGet already checks for this case, but we want to avoid calling it if possible
- // because onHandleIntent may hold a lock on gameFileCache for extended periods of time.)
- GameFile[] allGames = gameFiles.getValue();
+ // because onHandleIntent may hold a lock on sGameFileCache for extended periods of time.)
+ GameFile[] allGames = sGameFiles.getValue();
for (GameFile game : allGames)
{
if (game.getPath().equals(gamePath))
@@ -165,9 +165,9 @@ public final class GameFileCacheManager
// Unusual case: The game wasn't found in the cache.
// Scan the game and add it to the cache so that we can return it.
- synchronized (gameFileCache)
+ synchronized (sGameFileCache)
{
- return gameFileCache.addOrGet(gamePath);
+ return sGameFileCache.addOrGet(gamePath);
}
}
@@ -178,30 +178,30 @@ public final class GameFileCacheManager
*/
private static void load()
{
- if (gameFileCache == null)
+ if (sGameFileCache == null)
{
GameFileCache temp = new GameFileCache();
synchronized (temp)
{
- gameFileCache = temp;
- gameFileCache.load();
- if (gameFileCache.getSize() != 0)
+ sGameFileCache = temp;
+ sGameFileCache.load();
+ if (sGameFileCache.getSize() != 0)
{
updateGameFileArray();
}
}
}
- if (runRescanAfterLoad)
+ if (sRunRescanAfterLoad)
{
- rescanInProgress.postValue(true);
+ sRescanInProgress.postValue(true);
}
- loadInProgress.postValue(false);
+ sLoadInProgress.postValue(false);
- if (runRescanAfterLoad)
+ if (sRunRescanAfterLoad)
{
- runRescanAfterLoad = false;
+ sRunRescanAfterLoad = false;
rescan();
}
}
@@ -214,25 +214,25 @@ public final class GameFileCacheManager
*/
private static void rescan()
{
- if (gameFileCache == null)
+ if (sGameFileCache == null)
{
- runRescanAfterLoad = true;
+ sRunRescanAfterLoad = true;
}
else
{
String[] gamePaths = GameFileCache.getAllGamePaths();
boolean changed;
- synchronized (gameFileCache)
+ synchronized (sGameFileCache)
{
- changed = gameFileCache.update(gamePaths);
+ changed = sGameFileCache.update(gamePaths);
}
if (changed)
{
updateGameFileArray();
}
- boolean additionalMetadataChanged = gameFileCache.updateAdditionalMetadata();
+ boolean additionalMetadataChanged = sGameFileCache.updateAdditionalMetadata();
if (additionalMetadataChanged)
{
updateGameFileArray();
@@ -240,17 +240,17 @@ public final class GameFileCacheManager
if (changed || additionalMetadataChanged)
{
- gameFileCache.save();
+ sGameFileCache.save();
}
}
- rescanInProgress.postValue(false);
+ sRescanInProgress.postValue(false);
}
private static void updateGameFileArray()
{
- GameFile[] gameFilesTemp = gameFileCache.getAllGames();
+ GameFile[] gameFilesTemp = sGameFileCache.getAllGames();
Arrays.sort(gameFilesTemp, (lhs, rhs) -> lhs.getTitle().compareToIgnoreCase(rhs.getTitle()));
- gameFiles.postValue(gameFilesTemp);
+ sGameFiles.postValue(gameFilesTemp);
}
}