// Path: libzilla/src/main/java/ggx/com/libzilla/design/lifecycle/ActivityLifeCycle.java
// public class ActivityLifeCycle implements ActivityLifecycleCallbacks {
// 
//     ILifecycleManager manager;
// 
// 
//     public ActivityLifeCycle() {
//         try {
//             Class<?> clazz=Class.forName("com.ggx.lib.lifecycle.LifecycleManager");
//             manager= (ILifecycleManager) clazz.newInstance();
//         } catch (ClassNotFoundException e) {
//             e.printStackTrace();
//         } catch (InstantiationException e) {
//             e.printStackTrace();
//         } catch (IllegalAccessException e) {
//             e.printStackTrace();
//         }
//     }
// 
//     private ActivityLifecycleCallbacks getLifeCycle(Activity activity){
//         String fullName=activity.getClass().getName();
//         //通过activity的名字获取对应的生命周期注册对象
//         if(manager!=null){
//             return manager.getLifecycle(fullName);
//         }
//         return null;
//     }
// 
//     @Override
//     public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
//         ActivityLifecycleCallbacks callbacks=getLifeCycle(activity);
//         if(callbacks!=null){
//             callbacks.onActivityCreated(activity,savedInstanceState);
//         }
//     }
// 
//     @Override
//     public void onActivityStarted(Activity activity) {
//         ActivityLifecycleCallbacks callbacks=getLifeCycle(activity);
//         if(callbacks!=null){
//             callbacks.onActivityStarted(activity);
//         }
//     }
// 
//     @Override
//     public void onActivityResumed(Activity activity) {
//         ActivityLifecycleCallbacks callbacks=getLifeCycle(activity);
//         if(callbacks!=null){
//             callbacks.onActivityResumed(activity);
//         }
//     }
// 
//     @Override
//     public void onActivityPaused(Activity activity) {
//         ActivityLifecycleCallbacks callbacks=getLifeCycle(activity);
//         if(callbacks!=null){
//             callbacks.onActivityPaused(activity);
//         }
//     }
// 
//     @Override
//     public void onActivityStopped(Activity activity) {
//         ActivityLifecycleCallbacks callbacks=getLifeCycle(activity);
//         if(callbacks!=null){
//             callbacks.onActivityStopped(activity);
//         }
//     }
// 
//     @Override
//     public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
//         ActivityLifecycleCallbacks callbacks=getLifeCycle(activity);
//         if(callbacks!=null){
//             callbacks.onActivitySaveInstanceState(activity,outState);
//         }
//     }
// 
//     @Override
//     public void onActivityDestroyed(Activity activity) {
//         ActivityLifecycleCallbacks callbacks=getLifeCycle(activity);
//         if(callbacks!=null){
//             callbacks.onActivityDestroyed(activity);
//         }
//     }
// }


import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.os.Bundle;
import com.squareup.leakcanary.LeakCanary;
import com.squareup.leakcanary.RefWatcher;
import ggx.com.libzilla.design.lifecycle.ActivityLifeCycle;
package com.zilla.andzilla;




/**
 * Created by jerry.guan on 3/28/2017.
 */

public class AndZillaApplication extends Application{

    public static RefWatcher getRefWatcher(Context context) {
        AndZillaApplication application = (AndZillaApplication) context.getApplicationContext();
        return application.refWatcher;
    }
    private RefWatcher refWatcher;

    @Override
    public void onCreate() {
        super.onCreate();
        refWatcher= LeakCanary.install(this);
// Path: libzilla/src/main/java/ggx/com/libzilla/design/lifecycle/ActivityLifeCycle.java
// public class ActivityLifeCycle implements ActivityLifecycleCallbacks {
// 
//     ILifecycleManager manager;
// 
// 
//     public ActivityLifeCycle() {
//         try {
//             Class<?> clazz=Class.forName("com.ggx.lib.lifecycle.LifecycleManager");
//             manager= (ILifecycleManager) clazz.newInstance();
//         } catch (ClassNotFoundException e) {
//             e.printStackTrace();
//         } catch (InstantiationException e) {
//             e.printStackTrace();
//         } catch (IllegalAccessException e) {
//             e.printStackTrace();
//         }
//     }
// 
//     private ActivityLifecycleCallbacks getLifeCycle(Activity activity){
//         String fullName=activity.getClass().getName();
//         //通过activity的名字获取对应的生命周期注册对象
//         if(manager!=null){
//             return manager.getLifecycle(fullName);
//         }
//         return null;
//     }
// 
//     @Override
//     public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
//         ActivityLifecycleCallbacks callbacks=getLifeCycle(activity);
//         if(callbacks!=null){
//             callbacks.onActivityCreated(activity,savedInstanceState);
//         }
//     }
// 
//     @Override
//     public void onActivityStarted(Activity activity) {
//         ActivityLifecycleCallbacks callbacks=getLifeCycle(activity);
//         if(callbacks!=null){
//             callbacks.onActivityStarted(activity);
//         }
//     }
// 
//     @Override
//     public void onActivityResumed(Activity activity) {
//         ActivityLifecycleCallbacks callbacks=getLifeCycle(activity);
//         if(callbacks!=null){
//             callbacks.onActivityResumed(activity);
//         }
//     }
// 
//     @Override
//     public void onActivityPaused(Activity activity) {
//         ActivityLifecycleCallbacks callbacks=getLifeCycle(activity);
//         if(callbacks!=null){
//             callbacks.onActivityPaused(activity);
//         }
//     }
// 
//     @Override
//     public void onActivityStopped(Activity activity) {
//         ActivityLifecycleCallbacks callbacks=getLifeCycle(activity);
//         if(callbacks!=null){
//             callbacks.onActivityStopped(activity);
//         }
//     }
// 
//     @Override
//     public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
//         ActivityLifecycleCallbacks callbacks=getLifeCycle(activity);
//         if(callbacks!=null){
//             callbacks.onActivitySaveInstanceState(activity,outState);
//         }
//     }
// 
//     @Override
//     public void onActivityDestroyed(Activity activity) {
//         ActivityLifecycleCallbacks callbacks=getLifeCycle(activity);
//         if(callbacks!=null){
//             callbacks.onActivityDestroyed(activity);
//         }
//     }
// }


// Path: app/src/main/java/com/zilla/andzilla/AndZillaApplication.java
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.os.Bundle;
import com.squareup.leakcanary.LeakCanary;
import com.squareup.leakcanary.RefWatcher;
import ggx.com.libzilla.design.lifecycle.ActivityLifeCycle;

package com.zilla.andzilla;




/**
 * Created by jerry.guan on 3/28/2017.
 */

public class AndZillaApplication extends Application{

    public static RefWatcher getRefWatcher(Context context) {
        AndZillaApplication application = (AndZillaApplication) context.getApplicationContext();
        return application.refWatcher;
    }
    private RefWatcher refWatcher;

    @Override
    public void onCreate() {
        super.onCreate();
        refWatcher= LeakCanary.install(this);
        registerActivityLifecycleCallbacks(new ActivityLifeCycle());