// Path: lib/src/main/java/com/razerdp/github/lib/utils/ActivityUtil.java
// public class ActivityUtil {
// 
//     /**
//      * 检查activity是否存活
//      */
//     public static boolean isAlive(Activity act) {
//         if (act == null) return false;
//         return !act.isFinishing() && !act.isDestroyed();
//     }
// }


import android.os.Bundle;
import android.text.TextUtils;
import com.razerdp.github.lib.utils.ActivityUtil;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
package com.razerdp.github.lib.helper;




/**
 * Created by 大灯泡 on 2019/8/1.
 * <p>
 * fragment注入工具
 */
public class FragmentInjectHelper {

    @Nullable
    public  static <F extends Fragment> F inject(@NonNull FragmentActivity target,
                                                @NonNull Class<F> fragClass) {
        return inject(target, fragClass, null);
    }

    @Nullable
    public static <F extends Fragment> F inject(@NonNull FragmentActivity target,
                                                @NonNull Class<F> fragClass,
                                                @Nullable Bundle arguments) {
        return inject(target, fragClass, arguments, fragClass.getName());
    }

    @Nullable
    public static <F extends Fragment> F inject(@NonNull FragmentActivity target,
                                                @NonNull Class<F> fragClass,
                                                @Nullable Bundle arguments,
                                                @Nullable String tag) {
// Path: lib/src/main/java/com/razerdp/github/lib/utils/ActivityUtil.java
// public class ActivityUtil {
// 
//     /**
//      * 检查activity是否存活
//      */
//     public static boolean isAlive(Activity act) {
//         if (act == null) return false;
//         return !act.isFinishing() && !act.isDestroyed();
//     }
// }


// Path: lib/src/main/java/com/razerdp/github/lib/helper/FragmentInjectHelper.java
import android.os.Bundle;
import android.text.TextUtils;
import com.razerdp.github.lib.utils.ActivityUtil;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;

package com.razerdp.github.lib.helper;




/**
 * Created by 大灯泡 on 2019/8/1.
 * <p>
 * fragment注入工具
 */
public class FragmentInjectHelper {

    @Nullable
    public  static <F extends Fragment> F inject(@NonNull FragmentActivity target,
                                                @NonNull Class<F> fragClass) {
        return inject(target, fragClass, null);
    }

    @Nullable
    public static <F extends Fragment> F inject(@NonNull FragmentActivity target,
                                                @NonNull Class<F> fragClass,
                                                @Nullable Bundle arguments) {
        return inject(target, fragClass, arguments, fragClass.getName());
    }

    @Nullable
    public static <F extends Fragment> F inject(@NonNull FragmentActivity target,
                                                @NonNull Class<F> fragClass,
                                                @Nullable Bundle arguments,
                                                @Nullable String tag) {
        if (!ActivityUtil.isAlive(target)) return null;