package edu.brynmawr.ple2;

import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.Gravity;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;

public class SecondActivity extends AppCompatActivity {

    public static final int SECOND_ACTIVITY_ID = 45312;
    private LinearLayout mainLayout;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mainLayout = new LinearLayout(this);
        mainLayout.setId(SECOND_ACTIVITY_ID);
        mainLayout.setLayoutParams(new ViewGroup.LayoutParams(getResources().getDisplayMetrics().widthPixels, getResources().getDisplayMetrics().heightPixels));
        mainLayout.setOrientation(LinearLayout.VERTICAL);
        setContentView(mainLayout);
    }

    @Override
    public void onStart() {
        super.onStart();
        String value = getIntent().getStringExtra("username");
        String pass_val = getIntent().getStringExtra("password");
        ActionBar actionBar = ((AppCompatActivity)this).getSupportActionBar();
        actionBar.hide();
        {
            TextView tv = new TextView(this);
            tv.setText(this.getClass().getName());
            tv.setBackgroundColor(Color.BLACK);
            tv.setTypeface(null, Typeface.BOLD);
            tv.setTextColor(Color.WHITE);
            tv.setGravity(Gravity.START | Gravity.CENTER_VERTICAL);
            mainLayout.addView(tv, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, (int)(52*getResources().getDisplayMetrics().density)));
        }

        {
            TextView tv = new TextView(this);
            tv.setText(value);
            tv.setGravity(Gravity.CENTER);
            mainLayout.addView(tv, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0,1));
        }
        {
            TextView tv = new TextView(this);
            tv.setText(pass_val);
            tv.setGravity(Gravity.CENTER);
            mainLayout.addView(tv, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0,1));
        }

    }
}
