@Implements(value=android.app.Activity.class) public class ShadowActivity extends ShadowContextThemeWrapper
Modifier and Type | Class and Description |
---|---|
static class |
ShadowActivity.IntentForResult
Container object to hold an Intent, together with the requestCode used in a call to
Activity.startActivityForResult(Intent, int) |
Modifier and Type | Field and Description |
---|---|
protected android.app.Activity |
realActivity |
Constructor and Description |
---|
ShadowActivity() |
Modifier and Type | Method and Description |
---|---|
void |
callAttach(android.content.Intent intent) |
boolean |
clickMenuItem(int menuItemResId)
Perform a click on a menu item.
|
void |
dismissDialog(int id) |
android.view.View |
findViewById(int id)
Checks to ensure that the
contentView has been set |
void |
finish() |
void |
finishAffinity() |
void |
finishAndRemoveTask() |
android.content.ComponentName |
getCallingActivity() |
android.view.View |
getContentView() |
android.view.View |
getCurrentFocus() |
int |
getDefaultKeymode() |
android.app.Dialog |
getDialogById(int dialogId) |
java.lang.Object |
getLastNonConfigurationInstance() |
java.lang.Integer |
getLastShownDialogId() |
android.view.LayoutInflater |
getLayoutInflater() |
java.util.List<android.database.Cursor> |
getManagedCursors() |
android.view.MenuInflater |
getMenuInflater() |
ShadowActivity.IntentForResult |
getNextStartedActivityForResult()
Consumes and returns the next
Intent on the started activities for results stack. |
android.view.Menu |
getOptionsMenu()
Return the options menu.
|
android.app.Activity |
getParent() |
int |
getPendingTransitionEnterAnimationResourceId() |
int |
getPendingTransitionExitAnimationResourceId() |
int |
getRequestedOrientation() |
int |
getResultCode() |
android.content.Intent |
getResultIntent() |
int |
getTaskId() |
int |
getVolumeControlStream() |
android.view.Window |
getWindow()
Constructs a new Window (a
com.android.internal.policy.impl.PhoneWindow ) if no window has previously been set. |
boolean |
hasCancelledPendingTransitions() |
boolean |
isFinishing() |
boolean |
isTaskRoot() |
void |
onBackPressed() |
boolean |
onCreateOptionsMenu(android.view.Menu menu) |
void |
overridePendingTransition(int enterAnim,
int exitAnim) |
ShadowActivity.IntentForResult |
peekNextStartedActivityForResult()
Returns the most recent
Intent started by #startActivityForResult(Intent, int) without consuming it. |
void |
receiveResult(android.content.Intent requestIntent,
int resultCode,
android.content.Intent resultIntent) |
void |
recreate() |
void |
removeDialog(int id) |
void |
requestPermissions(java.lang.String[] permissions,
int requestCode) |
void |
resetIsFinishing() |
void |
runOnUiThread(java.lang.Runnable action) |
void |
setApplication(android.app.Application application) |
void |
setCallingActivity(android.content.ComponentName activityName) |
void |
setCurrentFocus(android.view.View view) |
void |
setDefaultKeyMode(int keyMode) |
void |
setIsTaskRoot(boolean isRoot) |
void |
setLastNonConfigurationInstance(java.lang.Object lastNonConfigurationInstance) |
void |
setParent(android.app.Activity parent)
Allow setting of Parent fragmentActivity (for unit testing purposes only)
|
void |
setRequestedOrientation(int requestedOrientation) |
void |
setResult(int resultCode) |
void |
setResult(int resultCode,
android.content.Intent data) |
void |
setVolumeControlStream(int streamType) |
void |
setWindow(android.view.Window window) |
void |
showDialog(int id) |
boolean |
showDialog(int id,
android.os.Bundle bundle) |
void |
startManagingCursor(android.database.Cursor c) |
void |
stopManagingCursor(android.database.Cursor c) |
callGetThemeResId
clearStartedServices, denyPermissions, getBroadcastIntents, getNextStartedActivity, getNextStartedService, getNextStoppedService, grantPermissions, peekNextStartedActivity, peekNextStartedService
@RealObject protected android.app.Activity realActivity
public void setApplication(android.app.Application application)
public void callAttach(android.content.Intent intent)
public void setCallingActivity(android.content.ComponentName activityName)
@Implementation public android.content.ComponentName getCallingActivity()
@Implementation public void setDefaultKeyMode(int keyMode)
public int getDefaultKeymode()
@Implementation public final void setResult(int resultCode)
@Implementation public final void setResult(int resultCode, android.content.Intent data)
@Implementation public android.view.LayoutInflater getLayoutInflater()
@Implementation public android.view.MenuInflater getMenuInflater()
@Implementation public android.view.View findViewById(int id)
Checks to ensure that thecontentView
has been set
id
- ID of the view to findjava.lang.RuntimeException
- if the contentView
has not been called first@Implementation public final android.app.Activity getParent()
@HiddenApi @Implementation public void setParent(android.app.Activity parent)
Allow setting of Parent fragmentActivity (for unit testing purposes only)
parent
- Parent fragmentActivity to set on this fragmentActivity@Implementation public void onBackPressed()
@Implementation public void finish()
@Implementation(minSdk=21) public void finishAndRemoveTask()
@Implementation(minSdk=16) public void finishAffinity()
public void resetIsFinishing()
@Implementation public boolean isFinishing()
finish()
was called@Implementation public android.view.Window getWindow()
Constructs a new Window (a com.android.internal.policy.impl.PhoneWindow
) if no window has previously been set.
public void setWindow(android.view.Window window)
@Implementation public void runOnUiThread(java.lang.Runnable action)
@Implementation public void setRequestedOrientation(int requestedOrientation)
@Implementation public int getRequestedOrientation()
@Implementation public int getTaskId()
public android.view.View getContentView()
contentView
set by one of the setContentView()
methodspublic int getResultCode()
resultCode
set by one of the setResult()
methodspublic android.content.Intent getResultIntent()
Intent
set by setResult(int, android.content.Intent)
public ShadowActivity.IntentForResult getNextStartedActivityForResult()
Consumes and returns the next Intent
on the started activities for results stack.
Intent
for an activity, wrapped in an ShadowActivity.IntentForResult
objectpublic ShadowActivity.IntentForResult peekNextStartedActivityForResult()
Returns the most recent Intent
started by #startActivityForResult(Intent, int)
without consuming it.
Intent
, wrapped in an ShadowActivity.IntentForResult
object@Implementation public java.lang.Object getLastNonConfigurationInstance()
public void setLastNonConfigurationInstance(java.lang.Object lastNonConfigurationInstance)
public void setCurrentFocus(android.view.View view)
view
- View to focus.@Implementation public android.view.View getCurrentFocus()
public int getPendingTransitionEnterAnimationResourceId()
public int getPendingTransitionExitAnimationResourceId()
@Implementation public boolean onCreateOptionsMenu(android.view.Menu menu)
public android.view.Menu getOptionsMenu()
Return the options menu.
public boolean clickMenuItem(int menuItemResId)
Perform a click on a menu item.
menuItemResId
- Menu item resource ID.public void receiveResult(android.content.Intent requestIntent, int resultCode, android.content.Intent resultIntent)
@Implementation public final void showDialog(int id)
@Implementation public final void dismissDialog(int id)
@Implementation public final void removeDialog(int id)
@Implementation public final boolean showDialog(int id, android.os.Bundle bundle)
public void setIsTaskRoot(boolean isRoot)
@Implementation public final boolean isTaskRoot()
public java.lang.Integer getLastShownDialogId()
Activity.showDialog(int, Bundle)
or Activity.showDialog(int)
public boolean hasCancelledPendingTransitions()
@Implementation public void overridePendingTransition(int enterAnim, int exitAnim)
public android.app.Dialog getDialogById(int dialogId)
@Implementation public void recreate()
@Implementation public void startManagingCursor(android.database.Cursor c)
@Implementation public void stopManagingCursor(android.database.Cursor c)
public java.util.List<android.database.Cursor> getManagedCursors()
@Implementation public final void setVolumeControlStream(int streamType)
@Implementation public final int getVolumeControlStream()
@Implementation(minSdk=23) public final void requestPermissions(java.lang.String[] permissions, int requestCode)