package com.youra.qlicker.Fragments;

import android.content.Intent;
import android.os.Bundle;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.TextView;

import com.youra.qlicker.Acitvitys.EER.EERStartActivity;
import com.youra.qlicker.Acitvitys.EspacePerso.EPgetEmailActivity;
import com.youra.qlicker.Acitvitys.LoginActivity;
import com.youra.qlicker.R;


public class LoginFragment extends Fragment {

    private TextView btn_creat ,btn_cnx , btn_forgot , btn_anonyme ;
    public EditText edit_login , edit_pswrd ;
    private CheckBox checkBox ;

    public LoginFragment() {
        // Required empty public constructor
    }



    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_login, container, false);

        btn_cnx = (TextView)view.findViewById(R.id.btn_cnx);
        btn_forgot = (TextView)view.findViewById(R.id.btn_forgot);
        btn_anonyme = (TextView)view.findViewById(R.id.btn_anonyme);


        btn_forgot.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {


                FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction();
                Fragment fragment = getActivity().getSupportFragmentManager().findFragmentByTag("forgotPswrd");

                if (fragment != null){
                    ft.replace(R.id.frame, fragment   );
                }else {
                    ft.replace(R.id.frame, new ForgotPswrdFragment() , "forgotPswrd" );
                }
                ft.addToBackStack(null);
                ft.commit();
            }
        });

        btn_anonyme.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(getContext() , EPgetEmailActivity.class);
                startActivity( intent );

            }
        });


        return view;
    }
}