// Path: crate-sample/src/main/java/me/oriley/cratesample/activities/BaseActivity.java
// @SuppressWarnings("unused")
// public abstract class BaseActivity extends AppCompatActivity {
// 
//     @NonNull
//     protected FragmentHelper mFragmentHelper;
// 
//     private boolean mIgnoreTouch;
// 
//     @CallSuper
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         mFragmentHelper = new FragmentHelper(this, R.id.fragment, R.anim.fade_in, R.anim.fade_out, R.anim.fade_in,
//                 R.anim.fade_out);
//     }
// 
//     @Override
//     public void onContentChanged() {
//         super.onContentChanged();
//         ButterKnife.bind(this);
//     }
// 
//     public void onFragmentAnimationComplete() {
//         // Override if necessary
//     }
// 
//     @Override
//     protected void onDestroy() {
//         super.onDestroy();
//         //noinspection ConstantConditions
//         mFragmentHelper = null;
//     }
// 
//     @CallSuper
//     @Override
//     public boolean dispatchTouchEvent(@NonNull MotionEvent ev) {
//         return mIgnoreTouch || super.dispatchTouchEvent(ev);
//     }
// 
//     public final void setIgnoreTouch(boolean ignoreTouch) {
//         mIgnoreTouch = ignoreTouch;
//     }
// 
// }


import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.CallSuper;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import butterknife.ButterKnife;
import butterknife.Unbinder;
import me.oriley.cratesample.activities.BaseActivity;
/*
 * Copyright (C) 2016 Kane O'Riley
 *
 * Licensed under the Apache License, Version 2.0 (the "License")
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package me.oriley.cratesample.fragments;


public abstract class BaseFragment extends Fragment {

    @Nullable
    private Unbinder mUnbinder;

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        mUnbinder = ButterKnife.bind(this, view);
    }

    @Override
    @CallSuper
    public void onDestroyView() {
        if (mUnbinder != null) {
            mUnbinder.unbind();
            mUnbinder = null;
        }
        super.onDestroyView();
    }

    @Nullable
    protected BaseActivity getBaseActivity() {
        Activity activity = getActivity();
        if (activity instanceof BaseActivity) {
// Path: crate-sample/src/main/java/me/oriley/cratesample/activities/BaseActivity.java
// @SuppressWarnings("unused")
// public abstract class BaseActivity extends AppCompatActivity {
// 
//     @NonNull
//     protected FragmentHelper mFragmentHelper;
// 
//     private boolean mIgnoreTouch;
// 
//     @CallSuper
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         mFragmentHelper = new FragmentHelper(this, R.id.fragment, R.anim.fade_in, R.anim.fade_out, R.anim.fade_in,
//                 R.anim.fade_out);
//     }
// 
//     @Override
//     public void onContentChanged() {
//         super.onContentChanged();
//         ButterKnife.bind(this);
//     }
// 
//     public void onFragmentAnimationComplete() {
//         // Override if necessary
//     }
// 
//     @Override
//     protected void onDestroy() {
//         super.onDestroy();
//         //noinspection ConstantConditions
//         mFragmentHelper = null;
//     }
// 
//     @CallSuper
//     @Override
//     public boolean dispatchTouchEvent(@NonNull MotionEvent ev) {
//         return mIgnoreTouch || super.dispatchTouchEvent(ev);
//     }
// 
//     public final void setIgnoreTouch(boolean ignoreTouch) {
//         mIgnoreTouch = ignoreTouch;
//     }
// 
// }


// Path: crate-sample/src/main/java/me/oriley/cratesample/fragments/BaseFragment.java
import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.CallSuper;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import butterknife.ButterKnife;
import butterknife.Unbinder;
import me.oriley.cratesample.activities.BaseActivity;

/*
 * Copyright (C) 2016 Kane O'Riley
 *
 * Licensed under the Apache License, Version 2.0 (the "License")
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package me.oriley.cratesample.fragments;


public abstract class BaseFragment extends Fragment {

    @Nullable
    private Unbinder mUnbinder;

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        mUnbinder = ButterKnife.bind(this, view);
    }

    @Override
    @CallSuper
    public void onDestroyView() {
        if (mUnbinder != null) {
            mUnbinder.unbind();
            mUnbinder = null;
        }
        super.onDestroyView();
    }

    @Nullable
    protected BaseActivity getBaseActivity() {
        Activity activity = getActivity();
        if (activity instanceof BaseActivity) {
            return (BaseActivity) activity;