Skip to content

Instantly share code, notes, and snippets.

class HomeActivity : AppCompatActivity() {
private lateinit var binding: ActivityHomeBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityHomeBinding.inflate(layoutInflater)
setContentView(binding.root)
}
class LockscreenActivity : AppCompatActivity() {
private lateinit var binding: ActivityLockscreenBinding
override fun onCreate(savedInstanceState: Bundle?) {
showWhenLockedAndTurnScreenOn()
super.onCreate(savedInstanceState)
binding = ActivityLockscreenBinding.inflate(layoutInflater)
setContentView(binding.root)
<activity
android:name=".presentation.LockscreenActivity"
android:launchMode="singleTop"
android:showOnLockScreen="true" />
private fun createNotification(): Notification {
val contentIntent = Intent(context, HomeActivity::class.java)
val contentPendingIntent = PendingIntent.getActivity(context, 0, contentIntent, 0)
val fullScreenIntent = Intent(context, LockscreenActivity::class.java)
val fullScreenPendingIntent = PendingIntent.getActivity(context, 0, fullScreenIntent, 0)
return NotificationCompat.Builder(context, CHANNEL_ID)
.setSmallIcon(R.drawable.notifications_active_black_24)
.setColor(ResourcesCompat.getColor(context.resources, R.color.purple_200, null))
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
exitTransition = MaterialFadeThrough()
reenterTransition = MaterialFadeThrough()
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enterTransition = MaterialFadeThrough()
returnTransition = MaterialFadeThrough()
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
postponeEnterTransition()
view.doOnPreDraw { startPostponedEnterTransition() }
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enterTransition = MaterialFade()
returnTransition = MaterialFade()
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
exitTransition = MaterialSharedAxis(MaterialSharedAxis.Z, true)
reenterTransition = MaterialSharedAxis(MaterialSharedAxis.Z, false)
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enterTransition = MaterialSharedAxis(MaterialSharedAxis.Z, true)
returnTransition = MaterialSharedAxis(MaterialSharedAxis.Z, false)
}