package com.hh.arome.common.scan.idcard.lifecycle;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;

import com.hh.arome.utlis.log.AppLogUtils;

/**
 * Created by L470 on 2020/7/20.
 */
public class SupportManagerFragment extends Fragment {

    // 必须有一个无参数的构造函数
    public SupportManagerFragment() {
        // 默认构造函数
    }

    //    private ActivityFragmentLifeCycle lifeCycle;
    private LifeCycleListener lifeCycle;

    public SupportManagerFragment(@NonNull LifeCycleListener lifeCycle) {
        this.lifeCycle = lifeCycle;
    }

    public void addListener(@NonNull LifeCycleListener listener) {
        this.lifeCycle = listener;
    }

    LifeCycleListener getLifeCycle() {
        return lifeCycle;
    }


    @Override
    public void onResume() {
        super.onResume();
        AppLogUtils.i("SupportManagerFragment--onResume");
        if (lifeCycle != null) {
            lifeCycle.onResume();
        }
    }

    @Override
    public void onPause() {
        super.onPause();
        AppLogUtils.i("SupportManagerFragment--onPause");
        if (lifeCycle != null) {
            lifeCycle.onPause();
        }
    }

    @Override
    public void onStop() {
        super.onStop();
        AppLogUtils.i("SupportManagerFragment--onStop");
        if (lifeCycle != null) {
            lifeCycle.onStop();
        }
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        AppLogUtils.i("SupportManagerFragment--onDestroy");
        if (lifeCycle != null) {
            lifeCycle.onDestroy();
        }
    }


}
