package com.david.hydroflux

import android.os.Bundle
import android.widget.LinearLayout
import android.widget.TextView
import android.widget.Button
import android.view.Gravity
import android.graphics.Color
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity

class PermissionsRationaleActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        
        val title = TextView(this).apply {
            text = "Health Permission Needed"
            textSize = 24f
            setTextColor(Color.CYAN)
            gravity = Gravity.CENTER
            setPadding(0, 0, 0, 30)
        }

        val message = TextView(this).apply {
            text = "HydroFit needs access to your Steps and Sleep data to populate the activity rings and history charts.\n\nWe do not share this data."
            textSize = 16f
            setTextColor(Color.WHITE)
            gravity = Gravity.CENTER
            setPadding(0, 0, 0, 50)
        }

        val btn = Button(this).apply {
            text = "UNDERSTOOD"
            setBackgroundColor(Color.DKGRAY)
            setTextColor(Color.WHITE)
            setOnClickListener {
                finish() // Close rationale and return to system dialog logic
            }
        }

        val layout = LinearLayout(this).apply {
           orientation = LinearLayout.VERTICAL
           gravity = Gravity.CENTER
           setPadding(50, 50, 50, 50)
           setBackgroundColor(Color.BLACK)
           addView(title)
           addView(message)
           addView(btn)
        }
        
        setContentView(layout)
    }
}
