Skip to content

Commit

Permalink
refactor(android): remove deprecated Ti.Android.Activity events
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Removes the create, destroy, pause, restart, resume, start, and stop events on Ti.Android.Activity (use callback properties)
  • Loading branch information
sgtcoolguy committed Dec 16, 2019
1 parent f618aeb commit 0221467
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,6 @@ public void onChanged(TiActivitySafeAreaMonitor monitor)
}
if (activityProxy != null) {
dispatchCallback(TiC.PROPERTY_ON_CREATE, null);
activityProxy.fireEvent(TiC.EVENT_CREATE, null);
}
synchronized (lifecycleListeners.synchronizedList())
{
Expand Down Expand Up @@ -1303,10 +1302,6 @@ protected void onPause()
releaseDialogs(false);
}

if (activityProxy != null) {
activityProxy.fireEvent(TiC.EVENT_PAUSE, null);
}

synchronized (lifecycleListeners.synchronizedList())
{
for (OnLifecycleEvent listener : lifecycleListeners.nonNull()) {
Expand Down Expand Up @@ -1344,10 +1339,6 @@ protected void onResume()
tiApp.setCurrentActivity(this, this);
TiApplication.updateActivityTransitionState(false);

if (activityProxy != null) {
activityProxy.fireEvent(TiC.EVENT_RESUME, null);
}

synchronized (lifecycleListeners.synchronizedList())
{
for (OnLifecycleEvent listener : lifecycleListeners.nonNull()) {
Expand Down Expand Up @@ -1386,20 +1377,6 @@ protected void onStart()

updateTitle();

if (activityProxy != null) {
// we only want to set the current activity for good in the resume state but we need it right now.
// save off the existing current activity, set ourselves to be the new current activity temporarily
// so we don't run into problems when we give the proxy the event
TiApplication tiApp = getTiApp();
Activity tempCurrentActivity = tiApp.getCurrentActivity();
tiApp.setCurrentActivity(this, this);

activityProxy.fireEvent(TiC.EVENT_START, null);

// set the current activity back to what it was originally
tiApp.setCurrentActivity(this, tempCurrentActivity);
}

synchronized (lifecycleListeners.synchronizedList())
{
for (OnLifecycleEvent listener : lifecycleListeners.nonNull()) {
Expand All @@ -1426,10 +1403,6 @@ protected void onStop()

Log.d(TAG, "Activity " + this + " onStop", Log.DEBUG_MODE);

if (activityProxy != null) {
activityProxy.fireEvent(TiC.EVENT_STOP, null);
}

synchronized (lifecycleListeners.synchronizedList())
{
for (OnLifecycleEvent listener : lifecycleListeners.nonNull()) {
Expand All @@ -1455,20 +1428,6 @@ protected void onRestart()
super.onRestart();

Log.d(TAG, "Activity " + this + " onRestart", Log.DEBUG_MODE);

if (activityProxy != null) {
// we only want to set the current activity for good in the resume state but we need it right now.
// save off the existing current activity, set ourselves to be the new current activity temporarily
// so we don't run into problems when we give the proxy the event
TiApplication tiApp = getTiApp();
Activity tempCurrentActivity = tiApp.getCurrentActivity();
tiApp.setCurrentActivity(this, this);

activityProxy.fireEvent(TiC.EVENT_RESTART, null);

// set the current activity back to what it was originally
tiApp.setCurrentActivity(this, tempCurrentActivity);
}
}

@Override
Expand Down Expand Up @@ -1644,9 +1603,6 @@ protected void onRestoreInstanceState(Bundle savedInstanceState)
protected void fireOnDestroy()
{
if (!onDestroyFired) {
if (activityProxy != null) {
activityProxy.fireEvent(TiC.EVENT_DESTROY, null);
}
onDestroyFired = true;
}
}
Expand Down
10 changes: 0 additions & 10 deletions android/titanium/src/java/org/appcelerator/titanium/TiC.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,6 @@ public class TiC
*/
public static final String EVENT_COMPLETE = "complete";

/**
* @module.api
*/
public static final String EVENT_CREATE = "create";

/**
* @module.api
*/
Expand Down Expand Up @@ -544,11 +539,6 @@ public class TiC
*/
public static final String EVENT_REGION_CHANGED = "regionchanged";

/**
* @module.api
*/
public static final String EVENT_RESTART = "restart";

/**
* @module.api
*/
Expand Down

0 comments on commit 0221467

Please sign in to comment.