public class PhoneWindow extends Window implements MenuBuilder.Callback
todo: need to pull the generic functionality out into a base class in android.widget.
Modifier and Type | Class and Description |
---|---|
static class |
PhoneWindow.PhoneWindowMenuCallback
Simple implementation of MenuBuilder.Callback that:
Opens a submenu when selected.
|
Window.Callback, Window.OnFrameMetricsAvailableListener, Window.OnRestrictedCaptionAreaChangedListener, Window.OnWindowDismissedCallback, Window.WindowControllerCallback
DECOR_CAPTION_SHADE_AUTO, DECOR_CAPTION_SHADE_DARK, DECOR_CAPTION_SHADE_LIGHT, DEFAULT_FEATURES, FEATURE_ACTION_BAR, FEATURE_ACTION_BAR_OVERLAY, FEATURE_ACTION_MODE_OVERLAY, FEATURE_ACTIVITY_TRANSITIONS, FEATURE_CONTENT_TRANSITIONS, FEATURE_CONTEXT_MENU, FEATURE_CUSTOM_TITLE, FEATURE_INDETERMINATE_PROGRESS, FEATURE_LEFT_ICON, FEATURE_MAX, FEATURE_NO_TITLE, FEATURE_OPTIONS_PANEL, FEATURE_PROGRESS, FEATURE_RIGHT_ICON, FEATURE_SWIPE_TO_DISMISS, ID_ANDROID_CONTENT, NAVIGATION_BAR_BACKGROUND_TRANSITION_NAME, PROGRESS_END, PROGRESS_INDETERMINATE_OFF, PROGRESS_INDETERMINATE_ON, PROGRESS_SECONDARY_END, PROGRESS_SECONDARY_START, PROGRESS_START, PROGRESS_VISIBILITY_OFF, PROGRESS_VISIBILITY_ON, STATUS_BAR_BACKGROUND_TRANSITION_NAME
Constructor and Description |
---|
PhoneWindow(Context context) |
PhoneWindow(Context context,
Window preservedWindow)
Constructor for main window of an activity.
|
Modifier and Type | Method and Description |
---|---|
void |
addContentView(View view,
ViewGroup.LayoutParams params)
Variation on
Window.setContentView(View, android.view.ViewGroup.LayoutParams)
to add an additional content view to the screen. |
void |
alwaysReadCloseOnTouchAttr() |
void |
clearContentView()
Remove the view that was used as the screen content.
|
void |
closeAllPanels() |
void |
closePanel(int featureId) |
void |
closePanel(com.android.internal.policy.PhoneWindow.PanelFeatureState st,
boolean doCallback)
Closes the given panel.
|
protected void |
dispatchWindowAttributesChanged(WindowManager.LayoutParams attrs) |
com.android.internal.policy.PhoneWindow.PanelFeatureState |
findMenuPanel(Menu menu) |
protected DecorView |
generateDecor(int featureId) |
protected ViewGroup |
generateLayout(DecorView decor) |
boolean |
getAllowEnterTransitionOverlap()
Returns how the transition set in
Window.setEnterTransition(android.transition.Transition) overlaps with the exit
transition of the calling Activity. |
boolean |
getAllowReturnTransitionOverlap()
Returns how the transition set in
Window.setExitTransition(android.transition.Transition) overlaps with the exit
transition of the called Activity when reentering after if finishes. |
Scene |
getContentScene()
Retrieve the
Scene representing this window's current content. |
View |
getCurrentFocus()
Return the view in this Window that currently has focus, or null if
there are none.
|
View |
getDecorView()
Retrieve the top-level window decor view (containing the standard
window frame/decorations and the client's content inside of that), which
can be added as a window to the window manager.
|
float |
getElevation()
Gets the window elevation.
|
Transition |
getEnterTransition()
Returns the transition used to move Views into the initial scene.
|
Transition |
getExitTransition()
Returns the Transition that will be used to move Views out of the scene when starting a
new Activity.
|
LayoutInflater |
getLayoutInflater()
Return a LayoutInflater instance that can be used to inflate XML view layout
resources for use in this Window.
|
MediaController |
getMediaController()
Gets the
MediaController that was previously set. |
int |
getNavigationBarColor() |
Transition |
getReenterTransition()
Returns the Transition that will be used to move Views in to the scene when returning from
a previously-started Activity.
|
Transition |
getReturnTransition()
Returns he Transition that will be used to move Views out of the scene when the Window is
preparing to close, for example after a call to
Activity.finishAfterTransition() . |
Transition |
getSharedElementEnterTransition()
Returns the Transition that will be used for shared elements transferred into the content
Scene.
|
Transition |
getSharedElementExitTransition()
Returns the Transition to use for shared elements in the launching Window prior
to transferring to the launched Activity's Window.
|
Transition |
getSharedElementReenterTransition()
Returns the Transition that will be used for shared elements reentering from a started
Activity after it has returned the shared element to it start location.
|
Transition |
getSharedElementReturnTransition()
Returns the Transition that will be used for shared elements transferred back to a
calling Activity.
|
boolean |
getSharedElementsUseOverlay()
Returns
true when shared elements should use an Overlay during
shared element transitions or false when they should animate as
part of the normal View hierarchy. |
int |
getStatusBarColor() |
long |
getTransitionBackgroundFadeDuration()
Returns the duration, in milliseconds, of the window background fade
when transitioning into or away from an Activity when called with an Activity Transition.
|
TransitionManager |
getTransitionManager()
Retrieve the
TransitionManager responsible for for default transitions
in this window. |
int |
getVolumeControlStream() |
protected boolean |
initializePanelContent(com.android.internal.policy.PhoneWindow.PanelFeatureState st)
Initializes the panel associated with the panel feature state.
|
protected boolean |
initializePanelDecor(com.android.internal.policy.PhoneWindow.PanelFeatureState st)
Perform initial setup of a panel.
|
protected boolean |
initializePanelMenu(com.android.internal.policy.PhoneWindow.PanelFeatureState st)
Initializes the menu associated with the given panel feature state.
|
void |
injectInputEvent(InputEvent event)
Inject an event to window locally.
|
void |
invalidatePanelMenu(int featureId) |
boolean |
isFloating()
Return whether this window is being displayed with a floating style
(based on the
android.R.attr#windowIsFloating attribute in
the style/theme). |
boolean |
isShortcutKey(int keyCode,
KeyEvent event)
Is a keypress one of the defined shortcut keys for this window.
|
boolean |
isTranslucent() |
protected void |
onActive() |
void |
onConfigurationChanged(Configuration newConfig)
Should be called when the configuration is changed.
|
protected void |
onDrawableChanged(int featureId,
Drawable drawable,
int alpha)
Called when a Drawable feature changes, for the window to update its
graphics.
|
protected void |
onIntChanged(int featureId,
int value)
Called when an int feature changes, for the window to update its
graphics.
|
protected boolean |
onKeyDown(int featureId,
int keyCode,
KeyEvent event)
A key was pressed down and not handled by anything else in the window.
|
boolean |
onKeyDownPanel(int featureId,
KeyEvent event)
Called when the panel key is pushed down.
|
protected boolean |
onKeyUp(int featureId,
int keyCode,
KeyEvent event)
A key was released and not handled by anything else in the window.
|
void |
onKeyUpPanel(int featureId,
KeyEvent event)
Called when the panel key is released.
|
boolean |
onMenuItemSelected(MenuBuilder menu,
MenuItem item)
Called when a menu item is selected.
|
void |
onMenuModeChange(MenuBuilder menu)
Called when the mode of the menu changes (for example, from icon to expanded).
|
void |
onMultiWindowModeChanged()
Called when the activity changes from fullscreen mode to multi-window mode and visa-versa.
|
void |
openPanel(int featureId,
KeyEvent event) |
View |
peekDecorView()
Retrieve the current decor view, but only if it has already been created;
otherwise returns null.
|
boolean |
performContextMenuIdentifierAction(int id,
int flags) |
boolean |
performPanelIdentifierAction(int featureId,
int id,
int flags) |
boolean |
performPanelShortcut(int featureId,
int keyCode,
KeyEvent event,
int flags) |
boolean |
preparePanel(com.android.internal.policy.PhoneWindow.PanelFeatureState st,
KeyEvent event)
Prepares the panel to either be opened or chorded.
|
void |
reportActivityRelaunched()
Called when the activity just relaunched.
|
boolean |
requestFeature(int featureId)
Enable extended screen features.
|
void |
restoreHierarchyState(Bundle savedInstanceState) |
Bundle |
saveHierarchyState() |
static void |
sendCloseSystemWindows(Context context,
String reason) |
void |
setAllowEnterTransitionOverlap(boolean allow)
Controls how the transition set in
Window.setEnterTransition(android.transition.Transition) overlaps with the exit
transition of the calling Activity. |
void |
setAllowReturnTransitionOverlap(boolean allowExitTransitionOverlap)
Controls how the transition set in
Window.setExitTransition(android.transition.Transition) overlaps with the exit
transition of the called Activity when reentering after if finishes. |
void |
setAttributes(WindowManager.LayoutParams params)
Specify custom window attributes.
|
void |
setBackgroundDrawable(Drawable drawable)
Change the background of this window to a custom Drawable.
|
void |
setChildDrawable(int featureId,
Drawable drawable) |
void |
setChildInt(int featureId,
int value) |
void |
setClipToOutline(boolean clipToOutline)
Sets whether window content should be clipped to the outline of the
window background.
|
void |
setContainer(Window container)
Set the container for this window.
|
void |
setContentView(int layoutResID)
Convenience for
Window.setContentView(View, android.view.ViewGroup.LayoutParams)
to set the screen content from a layout resource. |
void |
setContentView(View view)
Convenience for
Window.setContentView(View, android.view.ViewGroup.LayoutParams)
set the screen content to an explicit view. |
void |
setContentView(View view,
ViewGroup.LayoutParams params)
Set the screen content to an explicit view.
|
void |
setDecorCaptionShade(int decorCaptionShade)
Set what color should the caption controls be.
|
void |
setDefaultIcon(int resId)
Set the default icon for this window.
|
void |
setDefaultLogo(int resId)
Set the default logo for this window.
|
protected void |
setDefaultWindowFormat(int format)
Set the default format of window, as per the PixelFormat types.
|
void |
setElevation(float elevation)
Sets the window elevation.
|
void |
setEnterTransition(Transition enterTransition)
Sets the Transition that will be used to move Views into the initial scene.
|
void |
setExitTransition(Transition exitTransition)
Sets the Transition that will be used to move Views out of the scene when starting a
new Activity.
|
protected void |
setFeatureDefaultDrawable(int featureId,
Drawable drawable) |
void |
setFeatureDrawable(int featureId,
Drawable drawable)
Set an explicit Drawable value for feature of this window.
|
void |
setFeatureDrawableAlpha(int featureId,
int alpha)
Set a custom alpha value for the given drawable feature, controlling how
much the background is visible through it.
|
void |
setFeatureDrawableResource(int featureId,
int resId)
Set the value for a drawable feature of this window, from a resource
identifier.
|
void |
setFeatureDrawableUri(int featureId,
Uri uri)
Set the value for a drawable feature of this window, from a URI.
|
void |
setFeatureInt(int featureId,
int value)
Set the integer value for a feature.
|
void |
setIcon(int resId)
Set the primary icon for this window.
|
void |
setIsStartingWindow(boolean isStartingWindow) |
void |
setLocalFocus(boolean hasFocus,
boolean inTouchMode)
Set focus locally.
|
void |
setLogo(int resId)
Set the logo for this window.
|
void |
setMediaController(MediaController controller)
Sets a
MediaController to send media keys and volume changes to. |
void |
setNavigationBarColor(int color)
Sets the color of the navigation bar to .
|
void |
setReenterTransition(Transition transition)
Sets the Transition that will be used to move Views in to the scene when returning from
a previously-started Activity.
|
void |
setResizingCaptionDrawable(Drawable drawable)
Set the drawable that is drawn underneath the caption during the resizing.
|
void |
setReturnTransition(Transition transition)
Sets the Transition that will be used to move Views out of the scene when the Window is
preparing to close, for example after a call to
Activity.finishAfterTransition() . |
void |
setSharedElementEnterTransition(Transition sharedElementEnterTransition)
Sets the Transition that will be used for shared elements transferred into the content
Scene.
|
void |
setSharedElementExitTransition(Transition sharedElementExitTransition)
Sets the Transition that will be used for shared elements after starting a new Activity
before the shared elements are transferred to the called Activity.
|
void |
setSharedElementReenterTransition(Transition transition)
Sets the Transition that will be used for shared elements reentering from a started
Activity after it has returned the shared element to it start location.
|
void |
setSharedElementReturnTransition(Transition transition)
Sets the Transition that will be used for shared elements transferred back to a
calling Activity.
|
void |
setSharedElementsUseOverlay(boolean sharedElementsUseOverlay)
Sets whether or not shared elements should use an Overlay during shared element transitions.
|
void |
setStatusBarColor(int color)
Sets the color of the status bar to
color . |
void |
setTheme(int resid) |
void |
setTitle(CharSequence title) |
void |
setTitle(CharSequence title,
boolean updateAccessibilityTitle) |
void |
setTitleColor(int textColor)
Deprecated.
|
void |
setTransitionBackgroundFadeDuration(long fadeDurationMillis)
Sets the duration, in milliseconds, of the window background fade
when transitioning into or away from an Activity when called with an Activity Transition.
|
void |
setTransitionManager(TransitionManager tm)
Set the
TransitionManager to use for default transitions in this window. |
void |
setUiOptions(int uiOptions)
Set extra options that will influence the UI for this window.
|
void |
setUiOptions(int uiOptions,
int mask)
Set extra options that will influence the UI for this window.
|
void |
setVolumeControlStream(int streamType) |
boolean |
superDispatchGenericMotionEvent(MotionEvent event)
Used by custom windows, such as Dialog, to pass the generic motion event
further down the view hierarchy.
|
boolean |
superDispatchKeyEvent(KeyEvent event)
Used by custom windows, such as Dialog, to pass the key press event
further down the view hierarchy.
|
boolean |
superDispatchKeyShortcutEvent(KeyEvent event)
Used by custom windows, such as Dialog, to pass the key shortcut press event
further down the view hierarchy.
|
boolean |
superDispatchTouchEvent(MotionEvent event)
Used by custom windows, such as Dialog, to pass the touch screen event
further down the view hierarchy.
|
boolean |
superDispatchTrackballEvent(MotionEvent event)
Used by custom windows, such as Dialog, to pass the trackball event
further down the view hierarchy.
|
void |
takeInputQueue(InputQueue.Callback callback)
Take ownership of this window's InputQueue.
|
void |
takeKeyEvents(boolean get)
Request that key events come to this activity.
|
void |
takeSurface(SurfaceHolder.Callback2 callback)
Take ownership of this window's surface.
|
void |
togglePanel(int featureId,
KeyEvent event) |
protected void |
updateDrawable(int featureId,
boolean fromActive)
Update the state of a drawable feature.
|
addFlags, addOnFrameMetricsAvailableListener, addPrivateFlags, clearFlags, destroy, dispatchOnWindowDismissed, findViewById, getAttributes, getCallback, getContainer, getContext, getDefaultFeatures, getFeatures, getForcedWindowFlags, getLocalFeatures, getWindowControllerCallback, getWindowManager, getWindowStyle, hasChildren, hasFeature, hasSoftInputMode, haveDimAmount, isActive, isDestroyed, isOverlayWithDecorCaptionEnabled, makeActive, notifyRestrictedCaptionAreaCallback, removeFeature, removeOnFrameMetricsAvailableListener, setBackgroundDrawableResource, setCallback, setCloseOnTouchOutside, setCloseOnTouchOutsideIfNotSet, setDimAmount, setDisableWallpaperTouchEvents, setFlags, setFormat, setGravity, setLayout, setNeedsMenuKey, setOnWindowDismissedCallback, setOverlayWithDecorCaptionEnabled, setRestrictedCaptionAreaListener, setSoftInputMode, setSustainedPerformanceMode, setType, setWindowAnimations, setWindowControllerCallback, setWindowManager, setWindowManager, shouldCloseOnTouch
public PhoneWindow(Context context)
public final void setContainer(Window container)
Window
setContainer
in class Window
container
- The desired containing Window.public boolean requestFeature(int featureId)
Window
Window.FEATURE_CUSTOM_TITLE
.requestFeature
in class Window
featureId
- The desired features, defined as constants by Window.public void setUiOptions(int uiOptions)
Window
setUiOptions
in class Window
uiOptions
- Flags specifying extra options for this window.public void setUiOptions(int uiOptions, int mask)
Window
setUiOptions
in class Window
uiOptions
- Flags specifying extra options for this window.mask
- Flags specifying which options should be modified. Others will remain unchanged.public TransitionManager getTransitionManager()
Window
TransitionManager
responsible for for default transitions
in this window. Requires Window.FEATURE_CONTENT_TRANSITIONS
.
This method will return non-null after content has been initialized (e.g. by using
Window.setContentView(int)
) if Window.FEATURE_CONTENT_TRANSITIONS
has been granted.
getTransitionManager
in class Window
public void setTransitionManager(TransitionManager tm)
Window
TransitionManager
to use for default transitions in this window.
Requires Window.FEATURE_CONTENT_TRANSITIONS
.setTransitionManager
in class Window
tm
- The TransitionManager to use for scene changes.public Scene getContentScene()
Window
Scene
representing this window's current content.
Requires Window.FEATURE_CONTENT_TRANSITIONS
.
This method will return null if the current content is not represented by a Scene.
getContentScene
in class Window
public void setContentView(int layoutResID)
Window
Window.setContentView(View, android.view.ViewGroup.LayoutParams)
to set the screen content from a layout resource. The resource will be
inflated, adding all top-level views to the screen.setContentView
in class Window
layoutResID
- Resource ID to be inflated.Window.setContentView(View, android.view.ViewGroup.LayoutParams)
public void setContentView(View view)
Window
Window.setContentView(View, android.view.ViewGroup.LayoutParams)
set the screen content to an explicit view. This view is placed
directly into the screen's view hierarchy. It can itself be a complex
view hierarhcy.setContentView
in class Window
view
- The desired content to display.Window.setContentView(View, android.view.ViewGroup.LayoutParams)
public void setContentView(View view, ViewGroup.LayoutParams params)
Window
Note that calling this function "locks in" various characteristics
of the window that can not, from this point forward, be changed: the
features that have been requested with Window.requestFeature(int)
,
and certain window flags as described in Window.setFlags(int, int)
.
If Window.FEATURE_CONTENT_TRANSITIONS
is set, the window's
TransitionManager will be used to animate content from the current
content View to view.
setContentView
in class Window
view
- The desired content to display.params
- Layout parameters for the view.Window.getTransitionManager()
,
Window.setTransitionManager(android.transition.TransitionManager)
public void addContentView(View view, ViewGroup.LayoutParams params)
Window
Window.setContentView(View, android.view.ViewGroup.LayoutParams)
to add an additional content view to the screen. Added after any existing
ones in the screen -- existing views are NOT removed.addContentView
in class Window
view
- The desired content to display.params
- Layout parameters for the view.public void clearContentView()
Window
clearContentView
in class Window
public View getCurrentFocus()
Window
getCurrentFocus
in class Window
public void takeSurface(SurfaceHolder.Callback2 callback)
Window
takeSurface
in class Window
public void takeInputQueue(InputQueue.Callback callback)
Window
takeInputQueue
in class Window
public boolean isFloating()
Window
android.R.attr#windowIsFloating
attribute in
the style/theme).isFloating
in class Window
public boolean isTranslucent()
public LayoutInflater getLayoutInflater()
getLayoutInflater
in class Window
public void setTitle(CharSequence title)
public void setTitle(CharSequence title, boolean updateAccessibilityTitle)
@Deprecated public void setTitleColor(int textColor)
setTitleColor
in class Window
public final boolean preparePanel(com.android.internal.policy.PhoneWindow.PanelFeatureState st, KeyEvent event)
st
- The panel state to prepare.event
- The event that triggered the preparing of the panel.public void onConfigurationChanged(Configuration newConfig)
Window
onConfigurationChanged
in class Window
newConfig
- The new configuration.public void onMultiWindowModeChanged()
Window
onMultiWindowModeChanged
in class Window
public void reportActivityRelaunched()
Window
reportActivityRelaunched
in class Window
public final void openPanel(int featureId, KeyEvent event)
public final void closePanel(int featureId)
closePanel
in class Window
public final void closePanel(com.android.internal.policy.PhoneWindow.PanelFeatureState st, boolean doCallback)
st
- The panel to be closed.doCallback
- Whether to notify the callback that the panel was
closed. If the panel is in the process of re-opening or
opening another panel (e.g., menu opening a sub menu), the
callback should not happen and this variable should be false.
In addition, this method internally will only perform the
callback if the panel is open.public final void togglePanel(int featureId, KeyEvent event)
togglePanel
in class Window
public void invalidatePanelMenu(int featureId)
invalidatePanelMenu
in class Window
public final boolean onKeyDownPanel(int featureId, KeyEvent event)
featureId
- The feature ID of the relevant panel (defaults to FEATURE_OPTIONS_PANEL}.event
- The key event.public final void onKeyUpPanel(int featureId, KeyEvent event)
featureId
- The feature ID of the relevant panel (defaults to FEATURE_OPTIONS_PANEL}.event
- The key event.public final void closeAllPanels()
closeAllPanels
in class Window
public boolean performPanelShortcut(int featureId, int keyCode, KeyEvent event, int flags)
performPanelShortcut
in class Window
public boolean performPanelIdentifierAction(int featureId, int id, int flags)
performPanelIdentifierAction
in class Window
public com.android.internal.policy.PhoneWindow.PanelFeatureState findMenuPanel(Menu menu)
public boolean onMenuItemSelected(MenuBuilder menu, MenuItem item)
MenuBuilder.Callback
onMenuItemSelected
in interface MenuBuilder.Callback
menu
- The menu that is the parent of the itemitem
- The menu item that is selectedpublic void onMenuModeChange(MenuBuilder menu)
MenuBuilder.Callback
onMenuModeChange
in interface MenuBuilder.Callback
menu
- the menu that has changed modesprotected boolean initializePanelMenu(com.android.internal.policy.PhoneWindow.PanelFeatureState st)
st
- The panel whose menu is being initialized.protected boolean initializePanelDecor(com.android.internal.policy.PhoneWindow.PanelFeatureState st)
st
- The panel being initialized.protected boolean initializePanelContent(com.android.internal.policy.PhoneWindow.PanelFeatureState st)
st
- The panel state being initialized.public boolean performContextMenuIdentifierAction(int id, int flags)
performContextMenuIdentifierAction
in class Window
public final void setElevation(float elevation)
Window
Changes to this property take effect immediately and will cause the window surface to be recreated. This is an expensive operation and as a result, this property should not be animated.
setElevation
in class Window
elevation
- The window elevation.View.setElevation(float)
,
android.R.styleable#Window_windowElevation
public float getElevation()
Window
getElevation
in class Window
public final void setClipToOutline(boolean clipToOutline)
Window
setClipToOutline
in class Window
clipToOutline
- Whether window content should be clipped to the
outline of the window background.View.setClipToOutline(boolean)
,
android.R.styleable#Window_windowClipToOutline
public final void setBackgroundDrawable(Drawable drawable)
Window
setBackgroundDrawable
in class Window
drawable
- The new Drawable to use for this window's background.public final void setFeatureDrawableResource(int featureId, int resId)
Window
setFeatureDrawableResource
in class Window
featureId
- The desired drawable feature to change, defined as a
constant by Window.resId
- Resource identifier of the desired image.Resources.getDrawable(int)
public final void setFeatureDrawableUri(int featureId, Uri uri)
Window
The only URI currently supported is "content:", specifying an image in a content provider.
setFeatureDrawableUri
in class Window
featureId
- The desired drawable feature to change. Features are
constants defined by Window.uri
- The desired URI.ImageView.setImageURI(android.net.Uri)
public final void setFeatureDrawable(int featureId, Drawable drawable)
Window
setFeatureDrawable
in class Window
featureId
- The desired drawable feature to change. Features are
constants defined by Window.drawable
- A Drawable object to display.public void setFeatureDrawableAlpha(int featureId, int alpha)
Window
setFeatureDrawableAlpha
in class Window
featureId
- The desired drawable feature to change. Features are
constants defined by Window.alpha
- The alpha amount, 0 is completely transparent and 255 is
completely opaque.protected final void setFeatureDefaultDrawable(int featureId, Drawable drawable)
public final void setFeatureInt(int featureId, int value)
Window
Window.FEATURE_PROGRESS
, it should go from
0 to 10000. At 10000 the progress is complete and the indicator hidden.setFeatureInt
in class Window
featureId
- The desired feature to change. Features are constants
defined by Window.value
- The value for the feature. The interpretation of this
value is feature-specific.protected final void updateDrawable(int featureId, boolean fromActive)
featureId
- The desired drawable feature to change.fromActive
- Always true when called from onActive().onActive()
protected void onDrawableChanged(int featureId, Drawable drawable, int alpha)
featureId
- The feature being changed.drawable
- The new Drawable to show, or null if none.alpha
- The new alpha blending of the Drawable.protected void onIntChanged(int featureId, int value)
featureId
- The feature being changed.value
- The new integer value.public void setIcon(int resId)
Window
public void setDefaultIcon(int resId)
Window
setDefaultIcon
in class Window
public void setLogo(int resId)
Window
icon
but is generally wider and communicates window title information
as well.public void setDefaultLogo(int resId)
Window
setDefaultLogo
in class Window
public void setLocalFocus(boolean hasFocus, boolean inTouchMode)
Window
WindowManager.LayoutParams.FLAG_LOCAL_FOCUS_MODE
flag set already.setLocalFocus
in class Window
hasFocus
- Whether this window has focus or not.inTouchMode
- Whether this window is in touch mode or not.public void injectInputEvent(InputEvent event)
Window
injectInputEvent
in class Window
event
- A key or touch event to inject to this window.public void takeKeyEvents(boolean get)
takeKeyEvents
in class Window
public boolean superDispatchKeyEvent(KeyEvent event)
Window
superDispatchKeyEvent
in class Window
public boolean superDispatchKeyShortcutEvent(KeyEvent event)
Window
superDispatchKeyShortcutEvent
in class Window
public boolean superDispatchTouchEvent(MotionEvent event)
Window
superDispatchTouchEvent
in class Window
public boolean superDispatchTrackballEvent(MotionEvent event)
Window
superDispatchTrackballEvent
in class Window
public boolean superDispatchGenericMotionEvent(MotionEvent event)
Window
superDispatchGenericMotionEvent
in class Window
protected boolean onKeyDown(int featureId, int keyCode, KeyEvent event)
onKeyUp(int, int, android.view.KeyEvent)
,
KeyEvent
protected boolean onKeyUp(int featureId, int keyCode, KeyEvent event)
public final View getDecorView()
Window
Note that calling this function for the first time "locks in"
various window characteristics as described in
Window.setContentView(View, android.view.ViewGroup.LayoutParams)
.
getDecorView
in class Window
public final View peekDecorView()
Window
peekDecorView
in class Window
Window.getDecorView()
public Bundle saveHierarchyState()
saveHierarchyState
in class Window
public void restoreHierarchyState(Bundle savedInstanceState)
restoreHierarchyState
in class Window
protected DecorView generateDecor(int featureId)
public void alwaysReadCloseOnTouchAttr()
alwaysReadCloseOnTouchAttr
in class Window
public final void setChildDrawable(int featureId, Drawable drawable)
setChildDrawable
in class Window
public final void setChildInt(int featureId, int value)
setChildInt
in class Window
public boolean isShortcutKey(int keyCode, KeyEvent event)
Window
isShortcutKey
in class Window
keyCode
- the key code from KeyEvent
to check.event
- the KeyEvent
to use to help check.protected void dispatchWindowAttributesChanged(WindowManager.LayoutParams attrs)
Window
dispatchWindowAttributesChanged
in class Window
public void setVolumeControlStream(int streamType)
setVolumeControlStream
in class Window
Activity.setVolumeControlStream(int)
public int getVolumeControlStream()
getVolumeControlStream
in class Window
Activity.getVolumeControlStream()
public void setMediaController(MediaController controller)
Window
MediaController
to send media keys and volume changes to.
If set, this should be preferred for all media keys and volume requests
sent to this window.setMediaController
in class Window
controller
- The controller for the session which should receive
media keys and volume changes.Activity.setMediaController(android.media.session.MediaController)
public MediaController getMediaController()
Window
MediaController
that was previously set.getMediaController
in class Window
Window.setMediaController(android.media.session.MediaController)
,
Activity.getMediaController()
public void setEnterTransition(Transition enterTransition)
Window
ViewGroup.isTransitionGroup()
return true. Typical Transitions will extend
Visibility
as entering is governed by changing visibility from
View.INVISIBLE
to View.VISIBLE
. If transition
is null,
entering Views will remain unaffected.setEnterTransition
in class Window
enterTransition
- The Transition to use to move Views into the initial Scene.public void setReturnTransition(Transition transition)
Window
Activity.finishAfterTransition()
. The exiting
Views will be those that are regular Views or ViewGroups that have
ViewGroup.isTransitionGroup()
return true. Typical Transitions will extend
Visibility
as entering is governed by changing visibility from
View.VISIBLE
to View.INVISIBLE
. If transition
is null,
entering Views will remain unaffected. If nothing is set, the default will be to
use the same value as set in Window.setEnterTransition(android.transition.Transition)
.setReturnTransition
in class Window
transition
- The Transition to use to move Views out of the Scene when the Window
is preparing to close.public void setExitTransition(Transition exitTransition)
Window
ViewGroup.isTransitionGroup()
return true. Typical Transitions will extend
Visibility
as exiting is governed by changing visibility
from View.VISIBLE
to View.INVISIBLE
. If transition is null, the views will
remain unaffected. Requires Window.FEATURE_ACTIVITY_TRANSITIONS
.setExitTransition
in class Window
exitTransition
- The Transition to use to move Views out of the scene when calling a
new Activity.public void setReenterTransition(Transition transition)
Window
ViewGroup.isTransitionGroup()
return true. Typical Transitions
will extend Visibility
as exiting is governed by changing
visibility from View.VISIBLE
to View.INVISIBLE
. If transition is null,
the views will remain unaffected. If nothing is set, the default will be to use the same
transition as Window.setExitTransition(android.transition.Transition)
.
Requires Window.FEATURE_ACTIVITY_TRANSITIONS
.setReenterTransition
in class Window
transition
- The Transition to use to move Views into the scene when reentering from a
previously-started Activity.public void setSharedElementEnterTransition(Transition sharedElementEnterTransition)
Window
ChangeBounds
. A null
value will cause transferred shared elements to blink to the final position.
Requires Window.FEATURE_ACTIVITY_TRANSITIONS
.setSharedElementEnterTransition
in class Window
sharedElementEnterTransition
- The Transition to use for shared elements transferred into the content
Scene.public void setSharedElementReturnTransition(Transition transition)
Window
ChangeBounds
. A null
value will cause transferred shared elements to blink to the final position.
If no value is set, the default will be to use the same value as
Window.setSharedElementEnterTransition(android.transition.Transition)
.
Requires Window.FEATURE_ACTIVITY_TRANSITIONS
.setSharedElementReturnTransition
in class Window
transition
- The Transition to use for shared elements transferred out of the content
Scene.public void setSharedElementExitTransition(Transition sharedElementExitTransition)
Window
Window.FEATURE_ACTIVITY_TRANSITIONS
.setSharedElementExitTransition
in class Window
sharedElementExitTransition
- The Transition to use for shared elements in the launching Window
prior to transferring to the launched Activity's Window.public void setSharedElementReenterTransition(Transition transition)
Window
Window.setSharedElementExitTransition(android.transition.Transition)
.
Requires Window.FEATURE_ACTIVITY_TRANSITIONS
.setSharedElementReenterTransition
in class Window
transition
- The Transition to use for shared elements in the launching Window
after the shared element has returned to the Window.public Transition getEnterTransition()
Window
ViewGroup.isTransitionGroup()
return true. Typical Transitions will extend
Visibility
as entering is governed by changing visibility from
View.INVISIBLE
to View.VISIBLE
. If transition
is null,
entering Views will remain unaffected. Requires Window.FEATURE_ACTIVITY_TRANSITIONS
.getEnterTransition
in class Window
public Transition getReturnTransition()
Window
Activity.finishAfterTransition()
. The exiting
Views will be those that are regular Views or ViewGroups that have
ViewGroup.isTransitionGroup()
return true. Typical Transitions will extend
Visibility
as entering is governed by changing visibility from
View.VISIBLE
to View.INVISIBLE
.getReturnTransition
in class Window
public Transition getExitTransition()
Window
ViewGroup.isTransitionGroup()
return true. Typical Transitions will extend
Visibility
as exiting is governed by changing visibility
from View.VISIBLE
to View.INVISIBLE
. If transition is null, the views will
remain unaffected. Requires Window.FEATURE_ACTIVITY_TRANSITIONS
.getExitTransition
in class Window
public Transition getReenterTransition()
Window
ViewGroup.isTransitionGroup()
return true. Typical Transitions
will extend Visibility
as exiting is governed by changing
visibility from View.VISIBLE
to View.INVISIBLE
.
Requires Window.FEATURE_ACTIVITY_TRANSITIONS
.getReenterTransition
in class Window
public Transition getSharedElementEnterTransition()
Window
Window.FEATURE_ACTIVITY_TRANSITIONS
.getSharedElementEnterTransition
in class Window
public Transition getSharedElementReturnTransition()
Window
Window.FEATURE_ACTIVITY_TRANSITIONS
.getSharedElementReturnTransition
in class Window
public Transition getSharedElementExitTransition()
Window
Window.FEATURE_ACTIVITY_TRANSITIONS
.getSharedElementExitTransition
in class Window
public Transition getSharedElementReenterTransition()
Window
Window.FEATURE_ACTIVITY_TRANSITIONS
.getSharedElementReenterTransition
in class Window
public void setAllowEnterTransitionOverlap(boolean allow)
Window
Window.setEnterTransition(android.transition.Transition)
overlaps with the exit
transition of the calling Activity. When true, the transition will start as soon as possible.
When false, the transition will wait until the remote exiting transition completes before
starting.setAllowEnterTransitionOverlap
in class Window
allow
- true to start the enter transition when possible or false to
wait until the exiting transition completes.public boolean getAllowEnterTransitionOverlap()
Window
Window.setEnterTransition(android.transition.Transition)
overlaps with the exit
transition of the calling Activity. When true, the transition will start as soon as possible.
When false, the transition will wait until the remote exiting transition completes before
starting.getAllowEnterTransitionOverlap
in class Window
public void setAllowReturnTransitionOverlap(boolean allowExitTransitionOverlap)
Window
Window.setExitTransition(android.transition.Transition)
overlaps with the exit
transition of the called Activity when reentering after if finishes. When true,
the transition will start as soon as possible. When false, the transition will wait
until the called Activity's exiting transition completes before starting.setAllowReturnTransitionOverlap
in class Window
allowExitTransitionOverlap
- true to start the transition when possible or false to wait until the
called Activity's exiting transition completes.public boolean getAllowReturnTransitionOverlap()
Window
Window.setExitTransition(android.transition.Transition)
overlaps with the exit
transition of the called Activity when reentering after if finishes. When true,
the transition will start as soon as possible. When false, the transition will wait
until the called Activity's exiting transition completes before starting.getAllowReturnTransitionOverlap
in class Window
public long getTransitionBackgroundFadeDuration()
Window
When executing the enter transition, the background starts transparent
and fades in. This requires Window.FEATURE_ACTIVITY_TRANSITIONS
. The default is
300 milliseconds.
getTransitionBackgroundFadeDuration
in class Window
Window.getEnterTransition()
public void setTransitionBackgroundFadeDuration(long fadeDurationMillis)
Window
When executing the enter transition, the background starts transparent
and fades in. This requires Window.FEATURE_ACTIVITY_TRANSITIONS
. The default is
300 milliseconds.
setTransitionBackgroundFadeDuration
in class Window
fadeDurationMillis
- The duration of the window background fade to or from opaque
during enter transition.Window.setEnterTransition(android.transition.Transition)
public void setSharedElementsUseOverlay(boolean sharedElementsUseOverlay)
Window
setSharedElementsUseOverlay
in class Window
sharedElementsUseOverlay
- true
indicates that shared elements should
be transitioned with an Overlay or false
to transition within the normal View hierarchy.public boolean getSharedElementsUseOverlay()
Window
true
when shared elements should use an Overlay during
shared element transitions or false
when they should animate as
part of the normal View hierarchy. The default value is true.getSharedElementsUseOverlay
in class Window
true
when shared elements should use an Overlay during
shared element transitions or false
when they should animate as
part of the normal View hierarchy.protected void setDefaultWindowFormat(int format)
Window
setDefaultWindowFormat
in class Window
format
- The new window format (see PixelFormat).Window.setFormat(int)
,
PixelFormat
public int getStatusBarColor()
getStatusBarColor
in class Window
public void setStatusBarColor(int color)
Window
color
.
For this to take effect,
the window must be drawing the system bar backgrounds with
WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
and
WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
must not be set.
If color
is not opaque, consider setting
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
and
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
.
The transitionName for the view background will be "android:status:background".
setStatusBarColor
in class Window
public int getNavigationBarColor()
getNavigationBarColor
in class Window
public void setNavigationBarColor(int color)
Window
WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
and
WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION
must not be set.
If is not opaque, consider setting
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
and
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
.
The transitionName for the view background will be "android:navigation:background".
setNavigationBarColor
in class Window
public void setIsStartingWindow(boolean isStartingWindow)
public void setResizingCaptionDrawable(Drawable drawable)
Window
setResizingCaptionDrawable
in class Window
public void setDecorCaptionShade(int decorCaptionShade)
Window
Window.DECOR_CAPTION_SHADE_DARK
,
Window.DECOR_CAPTION_SHADE_LIGHT
, or Window.DECOR_CAPTION_SHADE_AUTO
.setDecorCaptionShade
in class Window
Window.DECOR_CAPTION_SHADE_DARK
,
Window.DECOR_CAPTION_SHADE_LIGHT
,
Window.DECOR_CAPTION_SHADE_AUTO
public void setAttributes(WindowManager.LayoutParams params)
Window
Window.getAttributes()
; you probably do not want to
blindly create and apply your own, since this will blow away any values
set by the framework that you are not interested in.setAttributes
in class Window
params
- The new window attributes, which will completely override any
current values.