mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
Android: Refactor MainActivity, add forEachPlatformGamesView
This commit is contained in:
parent
5e4c6d42a1
commit
3a8793f93f
@ -28,6 +28,7 @@ import org.dolphinemu.dolphinemu.features.settings.ui.SettingsActivity;
|
||||
import org.dolphinemu.dolphinemu.services.GameFileCacheService;
|
||||
import org.dolphinemu.dolphinemu.ui.platform.Platform;
|
||||
import org.dolphinemu.dolphinemu.ui.platform.PlatformGamesView;
|
||||
import org.dolphinemu.dolphinemu.utils.Action1;
|
||||
import org.dolphinemu.dolphinemu.utils.AfterDirectoryInitializationRunner;
|
||||
import org.dolphinemu.dolphinemu.utils.DirectoryInitialization;
|
||||
import org.dolphinemu.dolphinemu.utils.FileBrowserHelper;
|
||||
@ -90,7 +91,7 @@ public final class MainActivity extends AppCompatActivity implements MainView
|
||||
|
||||
// In case the user changed a setting that affects how games are displayed,
|
||||
// such as system language, cover downloading...
|
||||
refetchMetadata();
|
||||
forEachPlatformGamesView(PlatformGamesView::refetchMetadata);
|
||||
|
||||
if (sShouldRescanLibrary)
|
||||
{
|
||||
@ -266,26 +267,20 @@ public final class MainActivity extends AppCompatActivity implements MainView
|
||||
return mPresenter.handleOptionSelection(item.getItemId(), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showGames()
|
||||
{
|
||||
for (Platform platform : Platform.values())
|
||||
{
|
||||
PlatformGamesView fragment = getPlatformGamesView(platform);
|
||||
if (fragment != null)
|
||||
{
|
||||
fragment.showGames();
|
||||
}
|
||||
}
|
||||
forEachPlatformGamesView(PlatformGamesView::showGames);
|
||||
}
|
||||
|
||||
private void refetchMetadata()
|
||||
private void forEachPlatformGamesView(Action1<PlatformGamesView> action)
|
||||
{
|
||||
for (Platform platform : Platform.values())
|
||||
{
|
||||
PlatformGamesView fragment = getPlatformGamesView(platform);
|
||||
if (fragment != null)
|
||||
{
|
||||
fragment.refetchMetadata();
|
||||
action.call(fragment);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user