|
15 | 15 | package org.openmrs.mobile.activities.introduction; |
16 | 16 |
|
17 | 17 | import android.content.Intent; |
| 18 | +import android.graphics.Typeface; |
18 | 19 | import android.os.Bundle; |
19 | 20 | import android.os.Handler; |
20 | 21 | import android.view.WindowManager; |
|
23 | 24 | import android.view.animation.Animation; |
24 | 25 | import android.view.animation.AnimationSet; |
25 | 26 | import android.view.animation.AnimationUtils; |
26 | | -import android.widget.ImageView; |
27 | | -import android.widget.TextView; |
28 | 27 |
|
29 | 28 | import org.openmrs.mobile.R; |
30 | 29 | import org.openmrs.mobile.activities.ACBaseActivity; |
| 30 | +import org.openmrs.mobile.databinding.ActivitySplashBinding; |
31 | 31 |
|
32 | 32 | import static org.openmrs.mobile.utilities.ApplicationConstants.SPLASH_TIMER; |
33 | 33 |
|
34 | 34 | public class SplashActivity extends ACBaseActivity { |
35 | 35 | private Handler mHandler = new Handler(); |
36 | 36 | private Runnable mRunnable; |
| 37 | + private ActivitySplashBinding binding; |
37 | 38 |
|
38 | 39 | @Override |
39 | 40 | protected void onCreate(Bundle savedInstanceState) { |
40 | 41 | super.onCreate(savedInstanceState); |
41 | | - setContentView(R.layout.activity_splash); |
42 | | - TextView name = findViewById(R.id.organization_name); |
43 | | - name.setText(R.string.app_name); |
| 42 | + binding = ActivitySplashBinding.inflate(getLayoutInflater()); |
| 43 | + setContentView(binding.getRoot()); |
| 44 | + |
| 45 | + Typeface typeface = Typeface.createFromAsset(getAssets(), "fonts/Roboto/Montserrat.ttf"); |
| 46 | + |
| 47 | + binding.organizationName.setTypeface(typeface); |
| 48 | + binding.organizationName.setText(R.string.organization_name); |
| 49 | + |
| 50 | + binding.clientName.setTypeface(typeface); |
| 51 | + binding.clientName.setText(R.string.client_name); |
| 52 | + |
44 | 53 | getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); |
45 | 54 | Animation move = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.splash_screen_logo_anim); |
46 | | - ImageView logo = findViewById(R.id.logo); |
| 55 | + |
47 | 56 | AnimationSet set = new AnimationSet(true); |
48 | 57 | Animation fadeIn = new AlphaAnimation(0, 1); |
49 | 58 | fadeIn.setInterpolator(new AccelerateInterpolator()); |
50 | 59 | fadeIn.setDuration(1000); |
51 | 60 | set.addAnimation(fadeIn); |
52 | 61 | set.addAnimation(move); |
53 | | - logo.startAnimation(set); |
| 62 | + binding.logo.startAnimation(set); |
54 | 63 |
|
55 | 64 | mRunnable = () -> { |
56 | 65 | Intent intent = new Intent(SplashActivity.this, IntroActivity.class); |
|
0 commit comments