@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.
|
protected void |
dismissDialog(int id) |
protected android.view.View |
findViewById(int id)
Checks to ensure that the
contentView has been set |
protected void |
finish() |
protected void |
finishAffinity() |
protected void |
finishAndRemoveTask() |
protected android.content.ComponentName |
getCallingActivity() |
android.view.View |
getContentView() |
protected android.view.View |
getCurrentFocus() |
int |
getDefaultKeymode() |
android.app.Dialog |
getDialogById(int dialogId) |
protected java.lang.Object |
getLastNonConfigurationInstance() |
java.lang.Integer |
getLastShownDialogId() |
protected android.view.LayoutInflater |
getLayoutInflater() |
java.util.List<android.database.Cursor> |
getManagedCursors() |
protected 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.
|
protected android.app.Activity |
getParent() |
int |
getPendingTransitionEnterAnimationResourceId() |
int |
getPendingTransitionExitAnimationResourceId() |
protected int |
getRequestedOrientation() |
int |
getResultCode() |
android.content.Intent |
getResultIntent() |
protected int |
getTaskId() |
protected int |
getVolumeControlStream() |
protected 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()
Deprecated.
Use
Activity.isFinishing() instead. |
boolean |
isLockTask()
Deprecated.
Use
ActivityManager.getLockTaskModeState() instead. |
protected boolean |
isTaskRoot() |
protected void |
onBackPressed() |
protected boolean |
onCreateOptionsMenu(android.view.Menu menu) |
protected void |
overridePendingTransition(int enterAnim,
int exitAnim) |
ShadowActivity.IntentForResult |
peekNextStartedActivityForResult()
Returns the most recent
Intent started by Activity.startActivityForResult(Intent, int) without consuming it. |
void |
receiveResult(android.content.Intent requestIntent,
int resultCode,
android.content.Intent resultIntent) |
protected void |
recreate() |
protected void |
removeDialog(int id) |
protected void |
requestPermissions(java.lang.String[] permissions,
int requestCode) |
void |
resetIsFinishing() |
protected void |
runOnUiThread(java.lang.Runnable action) |
void |
setApplication(android.app.Application application) |
void |
setCallingActivity(android.content.ComponentName activityName) |
void |
setCurrentFocus(android.view.View view) |
protected 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)
|
protected void |
setRequestedOrientation(int requestedOrientation) |
protected void |
setResult(int resultCode) |
protected void |
setResult(int resultCode,
android.content.Intent data) |
protected void |
setVolumeControlStream(int streamType) |
void |
setWindow(android.view.Window window) |
protected void |
showDialog(int id) |
protected boolean |
showDialog(int id,
android.os.Bundle bundle) |
protected void |
startLockTask()
Starts a lock task.
|
protected void |
startManagingCursor(android.database.Cursor c) |
protected void |
stopLockTask()
Stops a lock task.
|
protected void |
stopManagingCursor(android.database.Cursor c) |
callGetThemeResId
clearNextStartedActivities, clearStartedServices, denyPermissions, getBroadcastIntents, getNextStartedActivity, getNextStartedService, getNextStoppedService, grantPermissions, peekNextStartedActivity, peekNextStartedService, removeSystemService
@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 protected android.content.ComponentName getCallingActivity()
@Implementation protected void setDefaultKeyMode(int keyMode)
public int getDefaultKeymode()
@Implementation protected final void setResult(int resultCode)
@Implementation protected final void setResult(int resultCode, android.content.Intent data)
@Implementation protected android.view.LayoutInflater getLayoutInflater()
@Implementation protected android.view.MenuInflater getMenuInflater()
@Implementation protected 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 protected 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 protected void onBackPressed()
@Implementation protected void finish()
@Implementation(minSdk=21) protected void finishAndRemoveTask()
@Implementation(minSdk=16) protected void finishAffinity()
public void resetIsFinishing()
@Deprecated public boolean isFinishing()
Activity.isFinishing()
instead.Returns whether finish()
was called.
@Implementation protected 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 protected void runOnUiThread(java.lang.Runnable action)
@Implementation protected void setRequestedOrientation(int requestedOrientation)
@Implementation protected int getRequestedOrientation()
@Implementation protected 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 Activity.startActivityForResult(Intent, int)
without consuming it.
Intent
, wrapped in an ShadowActivity.IntentForResult
object@Implementation protected java.lang.Object getLastNonConfigurationInstance()
public void setLastNonConfigurationInstance(java.lang.Object lastNonConfigurationInstance)
public void setCurrentFocus(android.view.View view)
view
- View to focus.@Implementation protected android.view.View getCurrentFocus()
public int getPendingTransitionEnterAnimationResourceId()
public int getPendingTransitionExitAnimationResourceId()
@Implementation protected 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 protected final void showDialog(int id)
@Implementation protected final void dismissDialog(int id)
@Implementation protected final void removeDialog(int id)
@Implementation protected final boolean showDialog(int id, android.os.Bundle bundle)
public void setIsTaskRoot(boolean isRoot)
@Implementation protected final boolean isTaskRoot()
public java.lang.Integer getLastShownDialogId()
Activity.showDialog(int, Bundle)
or Activity.showDialog(int)
public boolean hasCancelledPendingTransitions()
@Implementation protected void overridePendingTransition(int enterAnim, int exitAnim)
public android.app.Dialog getDialogById(int dialogId)
@Implementation protected void recreate()
@Implementation protected void startManagingCursor(android.database.Cursor c)
@Implementation protected void stopManagingCursor(android.database.Cursor c)
public java.util.List<android.database.Cursor> getManagedCursors()
@Implementation protected final void setVolumeControlStream(int streamType)
@Implementation protected final int getVolumeControlStream()
@Implementation(minSdk=23) protected final void requestPermissions(java.lang.String[] permissions, int requestCode)
@Implementation(minSdk=21) protected void startLockTask()
Starts a lock task.
The status of the lock task can be verified using isLockTask
method. Otherwise this implementation has no effect.
@Implementation(minSdk=21) protected void stopLockTask()
Stops a lock task.
The status of the lock task can be verified using isLockTask
method. Otherwise this implementation has no effect.
@Deprecated public boolean isLockTask()
ActivityManager.getLockTaskModeState()
instead.Returns if the activity is in the lock task mode.