package com.naijab.nextzytimeline.base;

import android.content.Context;
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.view.inputmethod.InputMethodManager;
import android.widget.Toast;

import com.naijab.nextzytimeline.base.exception.NotSetLayoutException;

public abstract class BaseFragment extends Fragment{

    @SuppressWarnings("unchecked")
    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (savedInstanceState == null) {
        } else {
            onRestoreInstanceState(savedInstanceState);
        }
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        int layoutResId = getLayoutView();
        if (getLayoutView() == 0) {
            throw new NotSetLayoutException();
        }
        return inflater.inflate(layoutResId, container, false);
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        bindView(view);
        setupInstance();
        setupView();
        if (savedInstanceState == null) {
            initialize();
        }
    }

    public void onRestoreInstanceState(Bundle savedInstanceState) {
    }

    public abstract int getLayoutView();

    public abstract void bindView(View view);

    public abstract void setupInstance();

    public abstract void setupView();

    public abstract void initialize();

    public void hideKeyboard(){
        View view = this.getActivity().getCurrentFocus();
        if (view != null) {
            InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
        }
    }

    public void showToast(String message){
        Toast.makeText(getActivity(), "" + message, Toast.LENGTH_SHORT).show();
    }
}

@@ -1417,24 +1417,85 @@
 itialize();%0A
+        %7Delse %7B%0A            restoreView(savedInstanceState);%0A
         %7D%0A  
@@ -1781,24 +1781,88 @@
 tialize();%0A%0A
+    public void restoreView(Bundle savedInstanceState) %7B%0A    %7D%0A%0A
     public v

Add restore view