diff options
author | Tomasz Kramkowski <tomasz@kramkow.ski> | 2023-04-21 23:50:38 +0100 |
---|---|---|
committer | Tomasz Kramkowski <tomasz@kramkow.ski> | 2023-04-21 23:50:38 +0100 |
commit | 16a36c812fabda812ecf3aaa7f12fa6f44c66b2e (patch) | |
tree | ccae60abf8301ae451cfa1f21c33b8a62d5306cf /MainActivity.kt | |
parent | db091bfd1db36ab66340ccad2eb7b6393a0aa3da (diff) | |
download | android-jetpack-compose-redo-master.tar.gz android-jetpack-compose-redo-master.tar.xz android-jetpack-compose-redo-master.zip |
Diffstat (limited to 'MainActivity.kt')
-rw-r--r-- | MainActivity.kt | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/MainActivity.kt b/MainActivity.kt index b11b0fc..5441527 100644 --- a/MainActivity.kt +++ b/MainActivity.kt @@ -1,25 +1,32 @@ package ski.kramkow.paste -import android.app.Activity import android.os.Bundle -//import java.net.HttpURLConnection; -//import java.net.URL; -//import java.io.OutputStream; +import androidx.activity.ComponentActivity +import androidx.activity.compose.setContent +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.material.MaterialTheme +import androidx.compose.material.Surface +import androidx.compose.material.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier -class MainActivity : Activity() { +class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - setContentView(R.layout.activity_main) - - //URL url = new URL("http://192.168.1.32:8000"); - //HttpURLConnection con = (HttpURLConnection)url.openConnection(); - //con.setRequestMethod("POST"); - //con.setRequestProperty("Content-Type", "text/plain"); - //con.setDoOutput(true); - //String data = "This is a test\n"; - //try(OutputStream os = con.getOutputStream()) { - //byte[] block = data.getBytes("utf-8"); - //os.write(block, 0, block.length); - //} + setContent { + PasteTheme { + Surface( + modifier = Modifier.fillMaxSize(), + color = MaterialTheme.colors.background + ) { + Greeting("World") + } + } + } } } + +@Composable +fun Greeting(name: String) { + Text(text = "Hello $name!") +} |