// Path: adal-utils/src/main/java/com/massivedisaster/adal/utils/KeyboardUtils.java
// public final class KeyboardUtils {
// 
//     private static final int HIDE_SOFT_INPUT_FLAGS_NONE = 0;
// 
//     /**
//      * Private constructor to avoid user implement as a single instance instead of a Singleton
//      */
//     private KeyboardUtils() {
// 
//     }
// 
//     /**
//      * Show the keyboard
//      *
//      * @param context  the context
//      */
//     private static void show(Context context) {
//         InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
//         imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, HIDE_SOFT_INPUT_FLAGS_NONE);
//     }
// 
//     /**
//      * Hide keyboard
//      *
//      * @param activity the visible activity
//      */
//     public static void hide(Activity activity) {
//         internalHide(activity, activity.getCurrentFocus());
//     }
// 
//     /**
//      * Hide keyboard
//      *
//      * @param activity the visible activity
//      * @param view     view to get getWindowToken
//      */
//     public static void hide(Activity activity, View view) {
//         internalHide(activity, view);
//     }
// 
//     /**
//      *
//      *
//      * @param activity  context to retrieve system services
//      * @param view      view to get getWindowToken
//      */
//     private static void internalHide(Activity activity, View view) {
//         if (view != null) {
//             InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
//             imm.hideSoftInputFromWindow(view.getWindowToken(), HIDE_SOFT_INPUT_FLAGS_NONE);
//         }
//     }
// }


import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import com.massivedisaster.adal.utils.KeyboardUtils;
import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.IdRes;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
    protected <T extends View> T findViewByIdOnActivity(@IdRes int viewId) {
        Activity activity = getActivity();
        if (activity == null) {
            return null;
        }
        return (T) activity.findViewById(viewId);
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = null;

        if (layoutToInflate() != INVALID_RESOURCE_ID) {
            view = inflater.inflate(layoutToInflate(), container, false);
            mView = view;
        }

        restoreInstanceState(savedInstanceState);

        if (getArguments() != null) {
            getFromBundle(getArguments());
        }

        doOnCreated();
        return view;
    }

    @Override
    public void onPause() {
// Path: adal-utils/src/main/java/com/massivedisaster/adal/utils/KeyboardUtils.java
// public final class KeyboardUtils {
// 
//     private static final int HIDE_SOFT_INPUT_FLAGS_NONE = 0;
// 
//     /**
//      * Private constructor to avoid user implement as a single instance instead of a Singleton
//      */
//     private KeyboardUtils() {
// 
//     }
// 
//     /**
//      * Show the keyboard
//      *
//      * @param context  the context
//      */
//     private static void show(Context context) {
//         InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
//         imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, HIDE_SOFT_INPUT_FLAGS_NONE);
//     }
// 
//     /**
//      * Hide keyboard
//      *
//      * @param activity the visible activity
//      */
//     public static void hide(Activity activity) {
//         internalHide(activity, activity.getCurrentFocus());
//     }
// 
//     /**
//      * Hide keyboard
//      *
//      * @param activity the visible activity
//      * @param view     view to get getWindowToken
//      */
//     public static void hide(Activity activity, View view) {
//         internalHide(activity, view);
//     }
// 
//     /**
//      *
//      *
//      * @param activity  context to retrieve system services
//      * @param view      view to get getWindowToken
//      */
//     private static void internalHide(Activity activity, View view) {
//         if (view != null) {
//             InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
//             imm.hideSoftInputFromWindow(view.getWindowToken(), HIDE_SOFT_INPUT_FLAGS_NONE);
//         }
//     }
// }


// Path: adal-fragments/src/main/java/com/massivedisaster/adal/fragment/BaseFragment.java
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import com.massivedisaster.adal.utils.KeyboardUtils;
import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.IdRes;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;

    protected <T extends View> T findViewByIdOnActivity(@IdRes int viewId) {
        Activity activity = getActivity();
        if (activity == null) {
            return null;
        }
        return (T) activity.findViewById(viewId);
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = null;

        if (layoutToInflate() != INVALID_RESOURCE_ID) {
            view = inflater.inflate(layoutToInflate(), container, false);
            mView = view;
        }

        restoreInstanceState(savedInstanceState);

        if (getArguments() != null) {
            getFromBundle(getArguments());
        }

        doOnCreated();
        return view;
    }

    @Override
    public void onPause() {
        KeyboardUtils.hide(getActivity(), getView());