public class TaskStackLayoutAlgorithm extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
TaskStackLayoutAlgorithm.AnchorSide |
static interface |
TaskStackLayoutAlgorithm.Extent |
static class |
TaskStackLayoutAlgorithm.StackState
The various stack/freeform states.
|
static interface |
TaskStackLayoutAlgorithm.TaskStackLayoutAlgorithmCallbacks |
class |
TaskStackLayoutAlgorithm.VisibilityReport |
Modifier and Type | Field and Description |
---|---|
Rect |
mFreeformRect |
Rect |
mStackActionButtonRect |
Rect |
mStackRect |
Rect |
mSystemInsets |
Rect |
mTaskRect |
static float |
OUTLINE_ALPHA_MAX_VALUE |
static float |
OUTLINE_ALPHA_MIN_VALUE |
static int |
STATE_FOCUSED |
static int |
STATE_UNFOCUSED |
Constructor and Description |
---|
TaskStackLayoutAlgorithm(Context context,
TaskStackLayoutAlgorithm.TaskStackLayoutAlgorithmCallbacks cb) |
Modifier and Type | Method and Description |
---|---|
void |
addUnfocusedTaskOverride(Task task,
float stackScroll)
Adds and override task progress for the given task when transitioning from focused to
unfocused state.
|
void |
addUnfocusedTaskOverride(TaskView taskView,
float stackScroll)
Adds and override task progress for the given task when transitioning from focused to
unfocused state.
|
void |
clearUnfocusedTaskOverrides() |
TaskStackLayoutAlgorithm.VisibilityReport |
computeStackVisibilityReport(ArrayList<Task> tasks)
Computes the maximum number of visible tasks and thumbnails when the scroll is at the initial
stack scroll.
|
void |
dump(String prefix,
PrintWriter writer) |
TaskViewTransform |
getBackOfStackTransform()
Returns the TaskViewTransform that would put the task just off the back of the stack.
|
float |
getDeltaPForY(int downY,
int y)
Maps a movement in screen y, relative to , to a movement in along the arc
length of the curve.
|
static int |
getDimensionForDevice(Context ctx,
int phoneResId,
int tabletResId,
int xlargeTabletResId)
Retrieves resources that are constant regardless of the current configuration of the device.
|
static int |
getDimensionForDevice(Context ctx,
int phonePortResId,
int phoneLandResId,
int tabletPortResId,
int tabletLandResId,
int xlargeTabletPortResId,
int xlargeTabletLandResId)
Retrieves resources that are constant regardless of the current configuration of the device.
|
int |
getFocusState()
Gets the focused state.
|
TaskViewTransform |
getFrontOfStackTransform()
Returns the TaskViewTransform that would put the task just off the front of the stack.
|
int |
getInitialFocusState()
Returns the default focus state.
|
TaskStackLayoutAlgorithm.StackState |
getStackState()
Returns the current stack state.
|
void |
getStackTransform(float taskProgress,
float nonOverrideTaskProgress,
float stackScroll,
int focusState,
TaskViewTransform transformOut,
TaskViewTransform frontTransform,
boolean ignoreSingleTaskCase,
boolean forceUpdate)
Update/get the transform.
|
TaskViewTransform |
getStackTransform(Task task,
float stackScroll,
int focusState,
TaskViewTransform transformOut,
TaskViewTransform frontTransform,
boolean forceUpdate,
boolean ignoreTaskOverrides) |
TaskViewTransform |
getStackTransform(Task task,
float stackScroll,
TaskViewTransform transformOut,
TaskViewTransform frontTransform)
Returns the transform for the given task.
|
TaskViewTransform |
getStackTransform(Task task,
float stackScroll,
TaskViewTransform transformOut,
TaskViewTransform frontTransform,
boolean ignoreTaskOverrides) |
TaskViewTransform |
getStackTransformScreenCoordinates(Task task,
float stackScroll,
TaskViewTransform transformOut,
TaskViewTransform frontTransform,
Rect windowOverrideRect)
|
void |
getTaskStackBounds(Rect displayRect,
Rect windowRect,
int topInset,
int leftInset,
int rightInset,
Rect taskStackBounds)
Returns the task stack bounds in the current orientation.
|
Rect |
getUntransformedTaskViewBounds()
Returns the untransformed task view bounds.
|
int |
getYForDeltaP(float downScrollP,
float p)
This is the inverse of
getDeltaPForY(int, int) . |
void |
initialize(Rect displayRect,
Rect windowRect,
Rect taskStackBounds,
TaskStackLayoutAlgorithm.StackState state)
Computes the stack and task rects.
|
boolean |
isInitialized()
Returns whether this stack layout has been initialized.
|
void |
reloadOnConfigurationChange(Context context)
Reloads the layout for the current configuration.
|
void |
reset()
Resets this layout when the stack view is reset.
|
void |
setFocusState(int focusState)
Sets the focused state.
|
boolean |
setSystemInsets(Rect systemInsets)
Sets the system insets.
|
void |
setTaskOverridesForInitialState(TaskStack stack,
boolean ignoreScrollToFront)
Creates task overrides to ensure the initial stack layout if necessary.
|
TaskViewTransform |
transformToScreenCoordinates(TaskViewTransform transformOut,
Rect windowOverrideRect)
Transforms the given to the screen coordinates, overriding the current
window rectangle with if non-null.
|
float |
updateFocusStateOnScroll(float lastTargetStackScroll,
float targetStackScroll,
float lastStackScroll)
Updates this stack when a scroll happens.
|
public static final float OUTLINE_ALPHA_MIN_VALUE
public static final float OUTLINE_ALPHA_MAX_VALUE
public static final int STATE_FOCUSED
public static final int STATE_UNFOCUSED
public Rect mTaskRect
public Rect mFreeformRect
public Rect mStackRect
public Rect mSystemInsets
public Rect mStackActionButtonRect
public TaskStackLayoutAlgorithm(Context context, TaskStackLayoutAlgorithm.TaskStackLayoutAlgorithmCallbacks cb)
public void reloadOnConfigurationChange(Context context)
public void reset()
public boolean setSystemInsets(Rect systemInsets)
public void setFocusState(int focusState)
public int getFocusState()
public void initialize(Rect displayRect, Rect windowRect, Rect taskStackBounds, TaskStackLayoutAlgorithm.StackState state)
public void setTaskOverridesForInitialState(TaskStack stack, boolean ignoreScrollToFront)
public void addUnfocusedTaskOverride(Task task, float stackScroll)
public void addUnfocusedTaskOverride(TaskView taskView, float stackScroll)
public void clearUnfocusedTaskOverrides()
public float updateFocusStateOnScroll(float lastTargetStackScroll, float targetStackScroll, float lastStackScroll)
public int getInitialFocusState()
public TaskViewTransform getBackOfStackTransform()
public TaskViewTransform getFrontOfStackTransform()
public TaskStackLayoutAlgorithm.StackState getStackState()
public boolean isInitialized()
public TaskStackLayoutAlgorithm.VisibilityReport computeStackVisibilityReport(ArrayList<Task> tasks)
public TaskViewTransform getStackTransform(Task task, float stackScroll, TaskViewTransform transformOut, TaskViewTransform frontTransform)
public TaskViewTransform getStackTransform(Task task, float stackScroll, TaskViewTransform transformOut, TaskViewTransform frontTransform, boolean ignoreTaskOverrides)
public TaskViewTransform getStackTransform(Task task, float stackScroll, int focusState, TaskViewTransform transformOut, TaskViewTransform frontTransform, boolean forceUpdate, boolean ignoreTaskOverrides)
public TaskViewTransform getStackTransformScreenCoordinates(Task task, float stackScroll, TaskViewTransform transformOut, TaskViewTransform frontTransform, Rect windowOverrideRect)
public TaskViewTransform transformToScreenCoordinates(TaskViewTransform transformOut, Rect windowOverrideRect)
public void getStackTransform(float taskProgress, float nonOverrideTaskProgress, float stackScroll, int focusState, TaskViewTransform transformOut, TaskViewTransform frontTransform, boolean ignoreSingleTaskCase, boolean forceUpdate)
ignoreSingleTaskCase
- When set, will ensure that the transform computed does not take
into account the special single-task case. This is only used
internally to ensure that we can calculate the transform for any
position in the stack.public Rect getUntransformedTaskViewBounds()
public float getDeltaPForY(int downY, int y)
public int getYForDeltaP(float downScrollP, float p)
getDeltaPForY(int, int)
. Given a movement along the arc length
of the curve, map back to the screen y.public void getTaskStackBounds(Rect displayRect, Rect windowRect, int topInset, int leftInset, int rightInset, Rect taskStackBounds)
public static int getDimensionForDevice(Context ctx, int phoneResId, int tabletResId, int xlargeTabletResId)
public static int getDimensionForDevice(Context ctx, int phonePortResId, int phoneLandResId, int tabletPortResId, int tabletLandResId, int xlargeTabletPortResId, int xlargeTabletLandResId)
public void dump(String prefix, PrintWriter writer)