@file:Suppress("HardCodedStringLiteral")

package eu.gaudian.translator

import android.content.Intent
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.material3.Text
import androidx.compose.ui.res.stringResource
import eu.gaudian.translator.utils.Log

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

        val intent = intent
        val action = intent.action
        val type = intent.type

        if (Intent.ACTION_SEND == action && type == "text/plain") {
            val sharedText = intent.getStringExtra(Intent.EXTRA_TEXT)
            if (sharedText != null) {
                Log.d("EditActivity", "Received text: $sharedText")
                setContent {
                    Text(stringResource(R.string.editing_text, sharedText))

                }
            } else {
                Log.e("EditActivity", getString(R.string.no_text_received))
                setContent {
                    Text(stringResource(R.string.error_no_text_to_edit))
                }
            }
        } else {
            Log.d("EditActivity", "Not launched with ACTION_SEND")
            setContent {
                Text(stringResource(R.string.not_launched_with_text_to_edit))
            }
        }

    }


}