package com.example.finzora;

import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

public class HomeActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // Criar layout SIMPLES programaticamente
        TextView textView = new TextView(this);
        textView.setText("Bem-vindo ao Finzora!");
        textView.setTextSize(24);
        textView.setPadding(50, 100, 50, 50);

        Button logoutBtn = new Button(this);
        logoutBtn.setText("LOGOUT");
        logoutBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(HomeActivity.this, "Logout realizado", Toast.LENGTH_SHORT).show();
                finish(); // Volta para MainActivity
            }
        });

        androidx.appcompat.widget.LinearLayoutCompat layout = new androidx.appcompat.widget.LinearLayoutCompat(this);
        layout.setOrientation(androidx.appcompat.widget.LinearLayoutCompat.VERTICAL);
        layout.setGravity(android.view.Gravity.CENTER);
        layout.addView(textView);
        layout.addView(logoutBtn);

        setContentView(layout);

        Toast.makeText(this, "Home Activity carregada!", Toast.LENGTH_SHORT).show();
    }
}
