(Android) Added a system directories creation state to the splash screen

This commit is contained in:
Leon Styhre 2024-01-06 12:55:29 +01:00
parent 6bad84a27a
commit c2201da47a
3 changed files with 16 additions and 2 deletions

View file

@ -903,6 +903,7 @@ int main(int argc, char* argv[])
} }
LOG(LogDebug) << "Android internal directory: " << AndroidVariables::sInternalDataDirectory; LOG(LogDebug) << "Android internal directory: " << AndroidVariables::sInternalDataDirectory;
LOG(LogDebug) << "Android external directory: " << AndroidVariables::sExternalDataDirectory; LOG(LogDebug) << "Android external directory: " << AndroidVariables::sExternalDataDirectory;
{ {
std::string buildIdentifier {PROGRAM_VERSION_STRING}; std::string buildIdentifier {PROGRAM_VERSION_STRING};
buildIdentifier.append(" (r") buildIdentifier.append(" (r")
@ -920,8 +921,12 @@ int main(int argc, char* argv[])
} }
} }
} }
if (Utils::Platform::Android::getCreateSystemDirectories())
if (Utils::Platform::Android::getCreateSystemDirectories()) {
if (Settings::getInstance()->getBool("SplashScreen"))
window->renderSplashScreen(Window::SplashScreenState::DIR_CREATION, 0.0f);
SystemData::createSystemDirectories(); SystemData::createSystemDirectories();
}
#endif #endif
#if defined(APPLICATION_UPDATER) #if defined(APPLICATION_UPDATER)

View file

@ -146,6 +146,8 @@ bool Window::init()
mDefaultFonts.at(1)->buildTextCache("Reloading...", 0.0f, 0.0f, 0x777777FF)); mDefaultFonts.at(1)->buildTextCache("Reloading...", 0.0f, 0.0f, 0x777777FF));
mSplashTextResourceCopy = std::unique_ptr<TextCache>( mSplashTextResourceCopy = std::unique_ptr<TextCache>(
mDefaultFonts.at(1)->buildTextCache("Copying resources...", 0.0f, 0.0f, 0x777777FF)); mDefaultFonts.at(1)->buildTextCache("Copying resources...", 0.0f, 0.0f, 0x777777FF));
mSplashTextDirCreation = std::unique_ptr<TextCache>(mDefaultFonts.at(1)->buildTextCache(
"Creating system directories...", 0.0f, 0.0f, 0x777777FF));
mSplashTextPositions.x = mSplashTextPositions.x =
(mRenderer->getScreenWidth() - mSplashTextScanning->metrics.size.x) / 2.0f; (mRenderer->getScreenWidth() - mSplashTextScanning->metrics.size.x) / 2.0f;
@ -703,6 +705,9 @@ void Window::renderSplashScreen(SplashScreenState state, float progress)
else if (state == SplashScreenState::RESOURCE_COPY) { else if (state == SplashScreenState::RESOURCE_COPY) {
textPosX = (mRenderer->getScreenWidth() - mSplashTextResourceCopy->metrics.size.x) / 2.0f; textPosX = (mRenderer->getScreenWidth() - mSplashTextResourceCopy->metrics.size.x) / 2.0f;
} }
else if (state == SplashScreenState::DIR_CREATION) {
textPosX = (mRenderer->getScreenWidth() - mSplashTextDirCreation->metrics.size.x) / 2.0f;
}
trans = glm::translate(trans, glm::round(glm::vec3 {textPosX, textPosY, 0.0f})); trans = glm::translate(trans, glm::round(glm::vec3 {textPosX, textPosY, 0.0f}));
mRenderer->setMatrix(trans); mRenderer->setMatrix(trans);
@ -715,6 +720,8 @@ void Window::renderSplashScreen(SplashScreenState state, float progress)
mDefaultFonts.at(1)->renderTextCache(mSplashTextReloading.get()); mDefaultFonts.at(1)->renderTextCache(mSplashTextReloading.get());
else if (state == SplashScreenState::RESOURCE_COPY) else if (state == SplashScreenState::RESOURCE_COPY)
mDefaultFonts.at(1)->renderTextCache(mSplashTextResourceCopy.get()); mDefaultFonts.at(1)->renderTextCache(mSplashTextResourceCopy.get());
else if (state == SplashScreenState::DIR_CREATION)
mDefaultFonts.at(1)->renderTextCache(mSplashTextDirCreation.get());
mRenderer->swapBuffers(); mRenderer->swapBuffers();
} }

View file

@ -110,7 +110,8 @@ public:
SCANNING, SCANNING,
POPULATING, POPULATING,
RELOADING, RELOADING,
RESOURCE_COPY RESOURCE_COPY,
DIR_CREATION
}; };
void renderSplashScreen(SplashScreenState state, float progress); void renderSplashScreen(SplashScreenState state, float progress);
@ -191,6 +192,7 @@ private:
std::unique_ptr<TextCache> mSplashTextPopulating; std::unique_ptr<TextCache> mSplashTextPopulating;
std::unique_ptr<TextCache> mSplashTextReloading; std::unique_ptr<TextCache> mSplashTextReloading;
std::unique_ptr<TextCache> mSplashTextResourceCopy; std::unique_ptr<TextCache> mSplashTextResourceCopy;
std::unique_ptr<TextCache> mSplashTextDirCreation;
glm::vec4 mSplashTextPositions; glm::vec4 mSplashTextPositions;
std::vector<ProgressBarRectangle> mProgressBarRectangles; std::vector<ProgressBarRectangle> mProgressBarRectangles;