// Path: lifecyclebinder-lib/src/main/java/it/codingjam/lifecyclebinder/LifeCycleBinder.java
// public class LifeCycleBinder {
//     public static void bind(Fragment fragment) {
//         bind(fragment, fragment.getChildFragmentManager());
//     }
// 
//     public static void bind(FragmentActivity activity) {
//         bind(activity, activity.getSupportFragmentManager());
//     }
// 
//     public static <T extends Fragment> void bind(T fragment, Class<?> objectBinderClass) {
//         bind(fragment.getChildFragmentManager(), objectBinderClass);
//     }
// 
//     public static <T extends FragmentActivity> void bind(T activity, Class<?> objectBinderClass) {
//         bind(activity.getSupportFragmentManager(), objectBinderClass);
//     }
// 
//     private static <T> void bind(T obj, FragmentManager fragmentManager) {
//         LifeCycleBinderFragment<T> fragment = LifeCycleBinderFragment.get(fragmentManager);
//         if (fragment == null) {
//             Class<?> c = ReflectionUtils.getObjectBinderClass(obj);
//             fragment = LifeCycleBinderFragment.createAndAdd(fragmentManager, c);
//         }
//         fragment.invokeOnCreate();
//     }
// 
//     private static <T> void bind(FragmentManager fragmentManager, Class<?> objectBinderClass) {
//         LifeCycleBinderFragment<T> fragment = LifeCycleBinderFragment.get(fragmentManager);
//         if (fragment == null) {
//             fragment = LifeCycleBinderFragment.createAndAdd(fragmentManager, objectBinderClass);
//         }
//         fragment.invokeOnCreate();
//     }
// 
//     public static void startActivityForResult(FragmentActivity activity, Intent intent, int requestCode) {
//         LifeCycleBinderFragment.get(activity.getSupportFragmentManager()).startActivityForResult(intent, requestCode);
//     }
// 
//     public static void startActivityForResult(Fragment fragment, Intent intent, int requestCode) {
//         LifeCycleBinderFragment.get(fragment.getChildFragmentManager()).startActivityForResult(intent, requestCode);
//     }
// }


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import it.codingjam.lifecyclebinder.BindLifeCycle;
import it.codingjam.lifecyclebinder.LifeCycleBinder;
/*
 *   Copyright 2016 Fabio Collini.
 *
 *  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 it.codingjam.lifecyclebinder.demo;



public class MainActivity extends AppCompatActivity {

    @BindLifeCycle ActivityLogger activityLogger = new ActivityLogger();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
// Path: lifecyclebinder-lib/src/main/java/it/codingjam/lifecyclebinder/LifeCycleBinder.java
// public class LifeCycleBinder {
//     public static void bind(Fragment fragment) {
//         bind(fragment, fragment.getChildFragmentManager());
//     }
// 
//     public static void bind(FragmentActivity activity) {
//         bind(activity, activity.getSupportFragmentManager());
//     }
// 
//     public static <T extends Fragment> void bind(T fragment, Class<?> objectBinderClass) {
//         bind(fragment.getChildFragmentManager(), objectBinderClass);
//     }
// 
//     public static <T extends FragmentActivity> void bind(T activity, Class<?> objectBinderClass) {
//         bind(activity.getSupportFragmentManager(), objectBinderClass);
//     }
// 
//     private static <T> void bind(T obj, FragmentManager fragmentManager) {
//         LifeCycleBinderFragment<T> fragment = LifeCycleBinderFragment.get(fragmentManager);
//         if (fragment == null) {
//             Class<?> c = ReflectionUtils.getObjectBinderClass(obj);
//             fragment = LifeCycleBinderFragment.createAndAdd(fragmentManager, c);
//         }
//         fragment.invokeOnCreate();
//     }
// 
//     private static <T> void bind(FragmentManager fragmentManager, Class<?> objectBinderClass) {
//         LifeCycleBinderFragment<T> fragment = LifeCycleBinderFragment.get(fragmentManager);
//         if (fragment == null) {
//             fragment = LifeCycleBinderFragment.createAndAdd(fragmentManager, objectBinderClass);
//         }
//         fragment.invokeOnCreate();
//     }
// 
//     public static void startActivityForResult(FragmentActivity activity, Intent intent, int requestCode) {
//         LifeCycleBinderFragment.get(activity.getSupportFragmentManager()).startActivityForResult(intent, requestCode);
//     }
// 
//     public static void startActivityForResult(Fragment fragment, Intent intent, int requestCode) {
//         LifeCycleBinderFragment.get(fragment.getChildFragmentManager()).startActivityForResult(intent, requestCode);
//     }
// }


// Path: lifecyclebinder-demo-fragments/src/main/java/it/codingjam/lifecyclebinder/demo/MainActivity.java
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import it.codingjam.lifecyclebinder.BindLifeCycle;
import it.codingjam.lifecyclebinder.LifeCycleBinder;

/*
 *   Copyright 2016 Fabio Collini.
 *
 *  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 it.codingjam.lifecyclebinder.demo;



public class MainActivity extends AppCompatActivity {

    @BindLifeCycle ActivityLogger activityLogger = new ActivityLogger();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        LifeCycleBinder.bind(this);