@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) |
static class |
ShadowActivity.PermissionsRequest
Class to hold a permissions request, including its request code.
|
Modifier and Type | Field and Description |
---|---|
protected Activity |
realActivity |
Constructor and Description |
---|
ShadowActivity() |
Modifier and Type | Method and Description |
---|---|
void |
callAttach(Intent intent) |
void |
callAttach(Intent intent,
Object lastNonConfigurationInstances) |
void |
callOnActivityResult(int requestCode,
int resultCode,
Intent resultData)
For internal use only.
|
boolean |
clickMenuItem(int menuItemResId)
Perform a click on a menu item.
|
protected void |
dismissDialog(int id) |
protected View |
findViewById(int id)
Checks to ensure that the
contentView has been set |
protected void |
finish() |
protected void |
finishAffinity() |
protected void |
finishAndRemoveTask() |
protected ComponentName |
getCallingActivity() |
View |
getContentView() |
protected View |
getCurrentFocus() |
int |
getDefaultKeymode() |
Dialog |
getDialogById(int dialogId) |
protected Object |
getLastNonConfigurationInstance() |
ShadowActivity.PermissionsRequest |
getLastRequestedPermission()
Gets the last permission request submitted to this activity.
|
Integer |
getLastShownDialogId() |
protected LayoutInflater |
getLayoutInflater() |
List<Cursor> |
getManagedCursors() |
protected MenuInflater |
getMenuInflater() |
ShadowActivity.IntentForResult |
getNextStartedActivityForResult()
Consumes and returns the next
Intent on the started activities for results stack. |
Menu |
getOptionsMenu()
Return the options menu.
|
protected Activity |
getParent() |
int |
getPendingTransitionEnterAnimationResourceId() |
int |
getPendingTransitionExitAnimationResourceId() |
protected int |
getRequestedOrientation() |
int |
getResultCode() |
Intent |
getResultIntent() |
protected int |
getTaskId() |
protected int |
getVolumeControlStream() |
protected 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(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(Intent requestIntent,
int resultCode,
Intent resultIntent) |
protected void |
recreate() |
protected void |
removeDialog(int id) |
protected void |
requestPermissions(String[] permissions,
int requestCode) |
void |
resetIsFinishing() |
protected void |
runOnUiThread(Runnable action) |
void |
setApplication(Application application) |
void |
setCallingActivity(ComponentName activityName) |
void |
setCurrentFocus(View view) |
protected void |
setDefaultKeyMode(int keyMode) |
void |
setIsTaskRoot(boolean isRoot) |
void |
setLastNonConfigurationInstance(Object lastNonConfigurationInstance)
Deprecated.
|
void |
setParent(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,
Intent data) |
protected void |
setVolumeControlStream(int streamType) |
void |
setWindow(Window window) |
protected void |
showDialog(int id) |
protected boolean |
showDialog(int id,
Bundle bundle) |
protected void |
startLockTask()
Starts a lock task.
|
protected void |
startManagingCursor(Cursor c) |
protected void |
stopLockTask()
Stops a lock task.
|
protected void |
stopManagingCursor(Cursor c) |
callGetThemeResId
clearNextStartedActivities, clearStartedServices, denyPermissions, denyPermissions, getBroadcastIntents, getNextStartedActivity, getNextStartedService, getNextStoppedService, grantPermissions, grantPermissions, peekNextStartedActivity, peekNextStartedService, removeSystemService
@RealObject protected Activity realActivity
public void setApplication(Application application)
public void callAttach(Intent intent)
public void setCallingActivity(ComponentName activityName)
@Implementation protected 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, Intent data)
@Implementation protected LayoutInflater getLayoutInflater()
@Implementation protected MenuInflater getMenuInflater()
@Implementation protected View findViewById(int id)
Checks to ensure that thecontentView
has been set
id
- ID of the view to findRuntimeException
- if the contentView
has not been called first@Implementation protected final Activity getParent()
@HiddenApi @Implementation public void setParent(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 Window getWindow()
Constructs a new Window (a com.android.internal.policy.impl.PhoneWindow
) if no window has previously been set.
public void setWindow(Window window)
@Implementation protected void runOnUiThread(Runnable action)
@Implementation protected void setRequestedOrientation(int requestedOrientation)
@Implementation protected int getRequestedOrientation()
@Implementation protected int getTaskId()
public View getContentView()
contentView
set by one of the setContentView()
methodspublic int getResultCode()
resultCode
set by one of the setResult()
methodspublic 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 Object getLastNonConfigurationInstance()
@Deprecated public void setLastNonConfigurationInstance(Object lastNonConfigurationInstance)
ActivityController.recreate()
.public void setCurrentFocus(View view)
view
- View to focus.@Implementation protected View getCurrentFocus()
public int getPendingTransitionEnterAnimationResourceId()
public int getPendingTransitionExitAnimationResourceId()
@Implementation protected boolean onCreateOptionsMenu(Menu menu)
public 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 callOnActivityResult(int requestCode, int resultCode, Intent resultData)
For internal use only. Not for public use.
@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, Bundle bundle)
public void setIsTaskRoot(boolean isRoot)
@Implementation protected final boolean isTaskRoot()
public Integer getLastShownDialogId()
Activity.showDialog(int, Bundle)
or Activity.showDialog(int)
public boolean hasCancelledPendingTransitions()
@Implementation protected void overridePendingTransition(int enterAnim, int exitAnim)
public Dialog getDialogById(int dialogId)
@Implementation protected void recreate()
@Implementation protected void startManagingCursor(Cursor c)
@Implementation protected void stopManagingCursor(Cursor c)
@Implementation protected final void setVolumeControlStream(int streamType)
@Implementation protected final int getVolumeControlStream()
@Implementation(minSdk=23) protected final void requestPermissions(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.
public ShadowActivity.PermissionsRequest getLastRequestedPermission()
Gets the last permission request submitted to this activity.