(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 external directory: " << AndroidVariables::sExternalDataDirectory;
{
std::string buildIdentifier {PROGRAM_VERSION_STRING};
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();
}
#endif
#if defined(APPLICATION_UPDATER)

View file

@ -146,6 +146,8 @@ bool Window::init()
mDefaultFonts.at(1)->buildTextCache("Reloading...", 0.0f, 0.0f, 0x777777FF));
mSplashTextResourceCopy = std::unique_ptr<TextCache>(
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 =
(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) {
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}));
mRenderer->setMatrix(trans);
@ -715,6 +720,8 @@ void Window::renderSplashScreen(SplashScreenState state, float progress)
mDefaultFonts.at(1)->renderTextCache(mSplashTextReloading.get());
else if (state == SplashScreenState::RESOURCE_COPY)
mDefaultFonts.at(1)->renderTextCache(mSplashTextResourceCopy.get());
else if (state == SplashScreenState::DIR_CREATION)
mDefaultFonts.at(1)->renderTextCache(mSplashTextDirCreation.get());
mRenderer->swapBuffers();
}

View file

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