package com.test.contraintlayoutdemo;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

/**
 * Created by systemx on 18/8/17.
 */

public class FragmentTest extends Fragment
{
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState)
    {
        return inflater.inflate(R.layout.fragment_test,container,false);
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState)
    {
        super.onViewCreated(view, savedInstanceState);


        Button btnOpenDialog = getView().findViewById(R.id.fragment_test_btn_open_dialog_fragment);
        btnOpenDialog.setOnClickListener(new View.OnClickListener(){

            @Override
            public void onClick(View view)
            {
                TestDialogFragment dialogFragment = new TestDialogFragment();
                dialogFragment.setTargetFragment(FragmentTest.this,12345);
                dialogFragment.show(getChildFragmentManager(),"DialogFramgnet");
            }
        });
    }
}
