Skip to content

Instantly share code, notes, and snippets.

@LeonidIvankin
Created July 10, 2022 07:02
Show Gist options
  • Save LeonidIvankin/b4ea2806486dc441ff8004d2acae49b5 to your computer and use it in GitHub Desktop.
Save LeonidIvankin/b4ea2806486dc441ff8004d2acae49b5 to your computer and use it in GitHub Desktop.
package com.leonidivankin.draftandroid.articles.refactoring
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.ComposeView
import androidx.compose.ui.unit.dp
import com.leonidivankin.draftandroid.R
class LegacyActivityInternal : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
title = "LegacyActivity, internal"
setContentView(R.layout.external_part)
findViewById<ComposeView>(R.id.composeViewInternalPart).setContent {
InternalPart()
}
}
}
@Composable
private fun InternalPart() {
Box(
Modifier
.fillMaxSize()
.background(color = Color(0xFF4CAF50))
.padding(32.dp)
) {
Box(
Modifier
.fillMaxSize()
.background(color = Color(0xFFFF9800))
.padding(32.dp)
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment