Skip to content

Commit

Permalink
feat(android): expose base context (#13390)
Browse files Browse the repository at this point in the history
* feat(android): expose base context

* onDestoy -> null

* move to TiBaseActivity
  • Loading branch information
m1ga committed Apr 13, 2022
1 parent a1c83d8 commit 5618220
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public abstract class TiBaseActivity extends AppCompatActivity implements TiActi
private Intent launchIntent = null;
private TiActionBarStyleHandler actionBarStyleHandler;
private TiActivitySafeAreaMonitor safeAreaMonitor;

private Context baseContext;
/**
* Callback to be invoked when the TiBaseActivity.onRequestPermissionsResult() has been called,
* providing the results of a requestPermissions() call. Instances of this interface are to
Expand Down Expand Up @@ -631,6 +631,7 @@ public void setContentView(View view, LayoutParams params)
@Override
protected void attachBaseContext(Context newBase)
{
baseContext = newBase;
super.attachBaseContext(TiLocaleManager.getLocalizedContext(newBase));
}

Expand Down Expand Up @@ -1618,6 +1619,10 @@ protected void onDestroy()
activityProxy = null;
}

if (baseContext != null) {
baseContext = null;
}

// Remove this activity from the app-wide Titanium UI stack.
TiApplication.removeFromActivityStack(this);

Expand Down Expand Up @@ -1851,4 +1856,9 @@ public void removeCustomInsetsProvider(TiInsetsProvider provider)
this.safeAreaMonitor.removeInsetsProvider(provider);
}
}

public Context getBaseContext()
{
return baseContext;
}
}

0 comments on commit 5618220

Please sign in to comment.