package com.example.testdemo

import android.app.Activity
import android.os.Bundle
import android.view.Gravity
import android.widget.LinearLayout
import android.widget.TextView
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge

class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        enableEdgeToEdge()
        super.onCreate(savedInstanceState)

        val message = com.example.testdemo.appInfo()

        val root = LinearLayout(this).apply {
            orientation = LinearLayout.VERTICAL
            gravity = Gravity.CENTER
            setPadding(24, 24, 24, 24)
        }

        val msgView = TextView(this).apply {
            text = message
            textSize = 24f
        }

        val resultAdd = com.example.arith.Arith.add(7, 3)
        val resultSub = com.example.arith.Arith.sub(7, 3)

        val addView = TextView(this).apply {
            text = "Add is ${resultAdd}, Sub is ${resultSub}"
            textSize = 24f
        }

        root.addView(msgView)
        root.addView(addView)

        setContentView(root)
    }
}