1 package expo.modules.devlauncher.splashscreen
2 
3 import android.annotation.SuppressLint
4 import android.content.Context
5 import android.graphics.Color
6 import android.util.TypedValue
7 import android.widget.ImageView
8 import android.widget.LinearLayout
9 import android.widget.RelativeLayout
10 import expo.modules.devlauncher.R
11 
12 @SuppressLint("ViewConstructor")
13 class DevLauncherSplashScreen(
14   context: Context,
15 ) : RelativeLayout(context) {
16   init {
17     setBackgroundColor(Color.WHITE)
18 
19     val imageWidthDPI = 85f
20     val imageWidthPixels = TypedValue.applyDimension(
21       TypedValue.COMPLEX_UNIT_DIP,
22       imageWidthDPI,
23       context.resources.displayMetrics
24     )
25 
26     val imageView = ImageView(context)
27     imageView.setImageResource(R.drawable._expodevclientcomponents_assets_logoicon)
28     imageView.layoutParams = LayoutParams(
29       imageWidthPixels.toInt(),
30       LinearLayout.LayoutParams.WRAP_CONTENT,
<lambda>null31     ).apply {
32       addRule(CENTER_IN_PARENT, TRUE)
33     }
34     addView(imageView)
35   }
36 }
37