package com.youra.qlicker.Fragments;

import android.os.Bundle;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import androidx.fragment.app.ListFragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.youra.qlicker.R;

public class ForgetPswrdMsgFragment extends Fragment {

    private ImageView img_back;
    private TextView back_login;

    public ForgetPswrdMsgFragment() {
        // 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_forget_pswrd_msg, container, false);

        img_back = (ImageView) view.findViewById(R.id.img_back);
        back_login = (TextView) view.findViewById(R.id.btn_back_login);

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

                getActivity().onBackPressed();
            }
        });

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

                Fragment savedFragment =   getActivity()
                        .getSupportFragmentManager().findFragmentByTag("login_fragmnet");

                FragmentTransaction transaction =  getActivity().getSupportFragmentManager().beginTransaction();
                if (savedFragment != null) {
                    transaction.replace(R.id.frame, savedFragment);
                }else {
                    transaction.replace(R.id.frame, new LoginFragment());
                }
                transaction.commit();

            }
        });

        return view;
    }
}