ShadowActivityGroup
@Implements(android.app.Activity.class) public class ShadowActivity extends ShadowContextThemeWrapper
Modifier and Type | Class | 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.IntentSenderRequest |
Class to holds details of a startIntentSenderForResult request.
|
static class |
ShadowActivity.PermissionsRequest |
Class to hold a permissions request, including its request code.
|
Modifier and Type | Field | Description |
---|---|---|
protected Activity |
realActivity |
Constructor | Description |
---|---|
ShadowActivity() |
Modifier and Type | Method | Description |
---|---|---|
<T extends Activity> |
attachController(ActivityController controller) |
For internal use only.
|
void |
callAttach(Intent intent) |
|
void |
callAttach(Intent intent,
Object lastNonConfigurationInstances) |
|
void |
callOnActivityResult(int requestCode,
int resultCode,
Intent resultData) |
Deprecated.
|
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() |
|
protected String |
getCallingPackage() |
|
View |
getContentView() |
|
protected View |
getCurrentFocus() |
|
int |
getDefaultKeymode() |
|
Dialog |
getDialogById(int dialogId) |
|
ShadowActivity.IntentSenderRequest |
getLastIntentSenderRequest() |
Gets the last startIntentSenderForResult request made to this activity.
|
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() |
|
boolean |
getReportFullyDrawn() |
|
protected int |
getRequestedOrientation() |
|
int |
getResultCode() |
|
Intent |
getResultIntent() |
|
protected int |
getTaskId() |
|
protected int |
getVolumeControlStream() |
|
protected Window |
getWindow() |
Constructs a new Window (a
PhoneWindow ) if no window
has previously been set. |
boolean |
hasCancelledPendingTransitions() |
|
void |
internalCallDispatchActivityResult(String who,
int requestCode,
int resultCode,
Intent data) |
For internal use only.
|
boolean |
isFinishing() |
Deprecated.
Use
Activity.isFinishing() instead. |
protected boolean |
isInMultiWindowMode() |
|
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 |
reportFullyDrawn() |
|
protected void |
requestPermissions(String[] permissions,
int requestCode) |
|
void |
resetIsFinishing() |
|
protected void |
runOnUiThread(Runnable action) |
|
void |
setApplication(Application application) |
|
void |
setCallingActivity(ComponentName activityName) |
|
void |
setCallingPackage(String packageName) |
|
void |
setCurrentFocus(View view) |
|
protected void |
setDefaultKeyMode(int keyMode) |
|
void |
setInMultiWindowMode(boolean value) |
Changes state of
isInMultiWindowMode() method. |
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) |
|
void |
setThrowIntentSenderException(boolean throwIntentSenderException) |
Sets if startIntentSenderForRequestCode will throw an IntentSender.SendIntentException.
|
protected void |
setVolumeControlStream(int streamType) |
|
void |
setWindow(Window window) |
|
protected void |
showDialog(int id) |
|
protected boolean |
showDialog(int id,
Bundle bundle) |
|
void |
startIntentSenderForResult(IntentSender intentSender,
int requestCode,
Intent fillInIntent,
int flagsMask,
int flagsValues,
int extraFlags,
Bundle options) |
|
protected void |
startLockTask() |
Starts a lock task.
|
protected void |
startManagingCursor(Cursor c) |
|
protected void |
stopLockTask() |
Stops a lock task.
|
protected void |
stopManagingCursor(Cursor c) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
callGetThemeResId
clearBroadcastIntents, clearNextStartedActivities, clearStartedServices, denyPermissions, denyPermissions, getBroadcastIntents, getBroadcastIntentsForUser, 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()
public void setCallingPackage(String packageName)
@Implementation protected String getCallingPackage()
@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)
contentView
has been setid
- 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)
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.finish()
was called.@Implementation protected Window getWindow()
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()
@Implementation public void startIntentSenderForResult(IntentSender intentSender, int requestCode, @Nullable Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags, Bundle options) throws IntentSender.SendIntentException
IntentSender.SendIntentException
@Implementation(minSdk=19) protected void reportFullyDrawn()
public boolean getReportFullyDrawn()
ReportFullyDrawn()
methods has been called.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()
Intent
on the
started activities for results stack.getNextStartedActivityForResult
in class ShadowContextWrapper
Intent
for an activity, wrapped in
an ShadowActivity.IntentForResult
objectpublic ShadowActivity.IntentForResult peekNextStartedActivityForResult()
Intent
started by
Activity.startActivityForResult(Intent, int)
without consuming it.peekNextStartedActivityForResult
in class ShadowContextWrapper
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()
public boolean clickMenuItem(int menuItemResId)
menuItemResId
- Menu item resource ID.@Deprecated public void callOnActivityResult(int requestCode, int resultCode, Intent resultData)
public void internalCallDispatchActivityResult(String who, int requestCode, int resultCode, Intent data)
public <T extends Activity> void attachController(ActivityController controller)
public void setThrowIntentSenderException(boolean throwIntentSenderException)
@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()
The status of the lock task can be verified using isLockTask()
method. Otherwise this
implementation has no effect.
@Implementation(minSdk=21) protected void stopLockTask()
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.public void setInMultiWindowMode(boolean value)
isInMultiWindowMode()
method.@Implementation(minSdk=24) protected boolean isInMultiWindowMode()
public ShadowActivity.IntentSenderRequest getLastIntentSenderRequest()
public ShadowActivity.PermissionsRequest getLastRequestedPermission()