OtavioXavier / Acompanhador-de-leitura

1 stars 0 forks source link

Creating simple home screen items #1

Open DevGuijas opened 1 week ago

DevGuijas commented 1 week ago

The initial objective is to create a bottom bar and a side bar so that both are working correctly and without conflicts.

DevGuijas commented 1 week ago

Additions made - 11/15/2024

I created a "basic and modern" Splash Screen for the application. Screenshot_SplashScreen

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:

DevGuijas commented 1 week ago

Minor changes:

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:

demons