Open DevGuijas opened 1 week ago
I created a "basic and modern" Splash Screen for the application.
Code for Splash Screen functionality:
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
@Override
public void run() {
Intent intent = new Intent(MainActivity.this, LoginScreen.class);
startActivity(intent);
finish();
}
}, 3400);
Toast.makeText(this, getString(R.string.title_toast_splashScreen), Toast.LENGTH_LONG).show();
It is worth mentioning that it was also done:
I created a Splash Screen animation so that it doesn't stay still by default. A progressBar was also implemented.
This is what the Splash Screen class looked like:
ProgressBar progressBar = findViewById(R.id.progressbar_splashscreen);
progressBar.setVisibility(View.INVISIBLE);
new Handler(Looper.getMainLooper()).postDelayed(() -> {
progressBar.setVisibility(View.VISIBLE);
Log.d("SplashScreen", "ProgressBar agora visível");
new Handler(Looper.getMainLooper()).postDelayed(() -> {
startActivity(new Intent(MainActivity.this, LoginScreen.class));
finish();
}, 1700);
}, 1700);
Small explanation: The "StartActivity" that directs the user from the Splash Screen to the login screen is located within the progressBar looper because the progressBar will be loading during the time it is in the delay to switch from the Splash screen to the Login screen.
It is worth mentioning that the delay time for both must be the same, only then will the progressBar appear. As seen here:
The initial objective is to create a bottom bar and a side bar so that both are working correctly and without conflicts.