// Path: app/src/main/java/com/sscience/stopapp/util/WeakHandler.java
// public class WeakHandler extends Handler {
// 
//     public interface IHandler {
//         void handleMessage(Message msg);
//     }
// 
//     private WeakReference<IHandler> wf;
// 
//     public WeakHandler(IHandler handler) {
//         this.wf = new WeakReference<>(handler);
//     }
// 
//     @Override
//     public void handleMessage(Message msg) {
//         super.handleMessage(msg);
//         IHandler handler = wf.get();
//         if (handler != null) {
//             handler.handleMessage(msg);
//         }
//     }
// }


import android.os.Bundle;
import android.os.Message;
import android.support.annotation.Nullable;
import android.support.design.widget.Snackbar;
import android.support.v4.app.Fragment;
import android.support.v4.widget.SwipeRefreshLayout;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.sscience.stopapp.R;
import com.sscience.stopapp.util.WeakHandler;
package com.sscience.stopapp.base;



/**
 * @author SScience
 * @description
 * @email chentushen.science@gmail.com
 * @data 2017/1/5
 */

public abstract class BaseFragment extends Fragment implements WeakHandler.IHandler, SwipeRefreshLayout.OnRefreshListener {

    protected boolean isVisible;
    private boolean isFirst = false;
    public WeakHandler mWeakHandler;
    private SwipeRefreshLayout mSwipeRefreshLayout;

    protected abstract int getContentLayout();

    protected abstract void doCreateView(View view);

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(getContentLayout(), container, false);
        doCreateView(view);
        isFirst = true;
// Path: app/src/main/java/com/sscience/stopapp/util/WeakHandler.java
// public class WeakHandler extends Handler {
// 
//     public interface IHandler {
//         void handleMessage(Message msg);
//     }
// 
//     private WeakReference<IHandler> wf;
// 
//     public WeakHandler(IHandler handler) {
//         this.wf = new WeakReference<>(handler);
//     }
// 
//     @Override
//     public void handleMessage(Message msg) {
//         super.handleMessage(msg);
//         IHandler handler = wf.get();
//         if (handler != null) {
//             handler.handleMessage(msg);
//         }
//     }
// }


// Path: app/src/main/java/com/sscience/stopapp/base/BaseFragment.java
import android.os.Bundle;
import android.os.Message;
import android.support.annotation.Nullable;
import android.support.design.widget.Snackbar;
import android.support.v4.app.Fragment;
import android.support.v4.widget.SwipeRefreshLayout;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.sscience.stopapp.R;
import com.sscience.stopapp.util.WeakHandler;

package com.sscience.stopapp.base;



/**
 * @author SScience
 * @description
 * @email chentushen.science@gmail.com
 * @data 2017/1/5
 */

public abstract class BaseFragment extends Fragment implements WeakHandler.IHandler, SwipeRefreshLayout.OnRefreshListener {

    protected boolean isVisible;
    private boolean isFirst = false;
    public WeakHandler mWeakHandler;
    private SwipeRefreshLayout mSwipeRefreshLayout;

    protected abstract int getContentLayout();

    protected abstract void doCreateView(View view);

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(getContentLayout(), container, false);
        doCreateView(view);
        isFirst = true;
        mWeakHandler = new WeakHandler(this);