/**
 * Appcelerator Titanium Mobile
 * Copyright (c) 2009-2012 by Appcelerator, Inc. All Rights Reserved.
 * Licensed under the terms of the Apache Public License
 * Please see the LICENSE included with this distribution for details.
 */
package org.appcelerator.titanium;

import android.content.Intent;
import android.os.Bundle;
import org.appcelerator.kroll.KrollDict;
import org.appcelerator.titanium.proxy.IntentProxy;

public class TiActivity extends TiBaseActivity
{

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		Intent intent = getIntent();
		if (intent == null) {
			return;
		}
	}

	@Override
	protected void onDestroy()
	{
		fireOnDestroy();
		super.onDestroy();
	}

	@Override
	protected void onResume()
	{
		TiRootActivity rootActivity = getTiApp().getRootActivity();
		if (rootActivity != null) {
			Intent rootIntent = rootActivity.getIntent();

			// merge root intent extras
			if (rootIntent != null) {
				Intent intent = getIntent();
				if (intent.getComponent().getClassName().equals(TiActivity.class.getName())) {
					intent.putExtras(rootIntent);
					setIntent(intent);

					// fire 'newintent'
					IntentProxy intentProxy = new IntentProxy(intent);
					KrollDict data = new KrollDict();
					data.put(TiC.PROPERTY_INTENT, intentProxy);
					rootActivity.getActivityProxy().fireSyncEvent(TiC.EVENT_NEW_INTENT, data);
				}
			}
		}
		super.onResume();
		if (getTiApp().isRestartPending()) {
			return;
		}
	}

	@Override
	protected void onPause()
	{
		super.onPause();

		if (getTiApp().isRestartPending()) {
			return;
		}
	}

}

@@ -466,16 +466,39 @@
 tivity%0A%7B
+%0A%09Intent intent = null;
 %0A%0A%09@Over
@@ -1001,23 +1001,43 @@
 ) %7B%0A%09%09%09%09
-I
+if (i
 ntent 
+== null) %7B%0A%09%09%09%09%09
 intent =
@@ -1046,24 +1046,30 @@
 etIntent();%0A
+%09%09%09%09%7D%0A
 %09%09%09%09if (inte
@@ -1140,25 +1140,72 @@
 ())) %7B%0A%09%09%09%09%09
-i
+Intent newIntent = new Intent(intent);%0A%09%09%09%09%09newI
 ntent.putExt
@@ -1232,25 +1232,28 @@
 %09%09setIntent(
-i
+newI
 ntent);%0A%0A%09%09%09
@@ -1321,17 +1321,20 @@
 ntProxy(
-i
+newI
 ntent);%0A
@@ -1656,30 +1656,280 @@
 e();%0A%0A%09%09
-if (getTiApp()
+TiApplication tiApp = getTiApp();%0A%09%09TiRootActivity rootActivity = tiApp.getRootActivity();%0A%09%09if (rootActivity != null) %7B%0A%09%09%09Intent rootIntent = rootActivity.getIntent();%0A%09%09%09if (rootIntent != null) %7B%0A%09%09%09%09rootIntent.replaceExtras((Bundle) null);%0A%09%09%09%7D%0A%09%09%7D%0A%09%09if (tiApp
 .isResta

Fix intent after suspend