-
Notifications
You must be signed in to change notification settings - Fork 0
/
SplashActivity.java
54 lines (41 loc) · 1.95 KB
/
SplashActivity.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package com.example.demosmslistener;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.constraintlayout.widget.ConstraintLayout;
public class SplashActivity extends AppCompatActivity {
private static final long SPLASH_DELAY = 2000; // Delay in milliseconds
Animation topAnim,bottomAnim;
ImageView logo;
TextView name;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Hide the status bar
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_splash);
topAnim = AnimationUtils.loadAnimation(this, R. anim. top_animation);
bottomAnim = AnimationUtils.loadAnimation(this, R. anim. bottom_animation);
logo=findViewById(R.id.splash_logo);
name=findViewById(R.id.splash_app_name);
logo.setAnimation(topAnim);
name.setAnimation(bottomAnim);
final RelativeLayout splashLayout = findViewById(R.id.splashLayout);
final ConstraintLayout mainLayout = findViewById(R.id.mainLayout);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
// Start MainActivity or navigate to another activity/fragment
Intent intent = new Intent(SplashActivity.this, RegistrationActivity.class);
startActivity(intent);
finish(); // Optional: Close the splash activity so it's not accessible via the back button
}
}, SPLASH_DELAY);
}
}