java.lang.Object | ||||||
↳ | android.content.Context | |||||
↳ | android.content.ContextWrapper | |||||
↳ | android.view.ContextThemeWrapper | |||||
↳ | android.app.Activity | |||||
↳ | sofia.app.Screen | |||||
↳ | sofia.app.ShapeScreen |
Known Direct Subclasses |
ShapeScreen
is a subclass of screen that provides a built-in
ShapeView and convenience methods for manipulating shapes directly
in the screen class instead of having to call getShapeView()
for
every operation.
When you subclass ShapeScreen
, by default it will create a new
ShapeView
that occupies the entire width and height of the screen.
If this is not what you want (for example, if you want to have a
ShapeView
alongside other widgets but still retain the convenience
of methods like add(Shape)
directly on the screen), then place an
instance of ShapeView
in your layout file with the ID
shapeView
. Then the ShapeScreen
will use that view for all
of its other methods instead of creating its own.
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.app.Activity
| |||||||||||
From class
android.content.Context
|
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.app.Activity
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
ShapeScreen() |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void |
add(Shape shape)
Adds a shape to the screen.
| ||||||||||
void |
clear()
Removes all shapes currently on the screen.
| ||||||||||
boolean |
doInitializeAfterLayout()
Determines whether the user's | ||||||||||
void |
enableRotateGestures()
Turn on detection of rotation gestures on the ShapeView.
| ||||||||||
void |
enableScaleGestures()
Turn on detection of scale (pinch) gestures on the ShapeView.
| ||||||||||
CoordinateSystem | getCoordinateSystem() | ||||||||||
PointF |
getGravity()
Gets the gravity of the physical world represented by this shape screen.
| ||||||||||
float |
getHeight()
Return the height of your view.
| ||||||||||
ShapeField | getShapeField() | ||||||||||
ShapeView |
getShapeView()
Gets the ShapeView that holds all of the shapes on this screen.
| ||||||||||
ShapeFilter<Shape> | getShapes() | ||||||||||
float |
getWidth()
Return the width of the your view.
| ||||||||||
void |
remove(Shape shape)
Removes a shape from the screen.
| ||||||||||
void |
setBackgroundColor(Color color)
Sets the background color of the screen's ShapeView.
| ||||||||||
void |
setGravity(float xGravity, float yGravity)
Sets the gravity of the physical world represented by this shape screen.
| ||||||||||
void |
setGravity(PointF gravity)
Sets the gravity of the physical world represented by this shape screen.
| ||||||||||
void | setShapeField(ShapeField newField) |
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void |
afterLayoutInflated(boolean inflated)
This method is called after an attempted was made to inflate the
screen's layout.
| ||||||||||
ShapeView |
createShapeView(ShapeScreen parent)
This factory method is used to create the ShapeView
that will be contained by this screen.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
sofia.app.Screen
| |||||||||||
From class
android.app.Activity
| |||||||||||
From class
android.view.ContextThemeWrapper
| |||||||||||
From class
android.content.ContextWrapper
| |||||||||||
From class
android.content.Context
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
android.content.ComponentCallbacks
| |||||||||||
From interface
android.view.KeyEvent.Callback
| |||||||||||
From interface
android.view.LayoutInflater.Factory
| |||||||||||
From interface
android.view.View.OnCreateContextMenuListener
| |||||||||||
From interface
android.view.Window.Callback
| |||||||||||
From interface
sofia.app.ScreenMethods
|
Adds a shape to the screen.
shape | The shape to add to the screen. |
---|
Removes all shapes currently on the screen.
Determines whether the user's initialize()
method should be
postponed until layout of the views has already occurred.
In most cases, the default behavior of false is preferred, which will
cause initialize()
to be called during the activity's
onCreate(Bundle)
method, where the view hierarchy of the
activity can be created. But some specialized subclasses of
Screen
, like ShapeScreen, postpone the call to
initialize()
until later, after its ShapeView
has
already been laid out, so that users can access the width and height of
the view in order lay out shapes using that information in calculations.
initialize()
should be postponed until the
screen's views are already laid out, or false to call it immediately
in onCreate(Bundle)
Turn on detection of rotation gestures on the ShapeView.
Turn on detection of scale (pinch) gestures on the ShapeView.
Gets the gravity of the physical world represented by this shape screen.
PointF
object whose x and y components are the
horizontal and vertical acceleration due to gravity (in units/sec^2)
of the physical world represented by this shape screen
Return the height of your view.
Gets the ShapeView that holds all of the shapes on this screen.
Return the width of the your view.
Removes a shape from the screen.
shape | The shape to remove from the screen. |
---|
Sets the background color of the screen's ShapeView. Note that if you provide your own layout where the ShapeView only occupies a portion of the screen, this method will only affect the ShapeView portion and not the entire screen.
color | the desired background color |
---|
Sets the gravity of the physical world represented by this shape screen.
xGravity | the horizontal acceleration due to gravity (in units/sec^2) |
---|---|
yGravity | the vertical acceleration due to gravity (in units/sec^2) |
Sets the gravity of the physical world represented by this shape screen.
gravity | a PointF whose x and y components are the
horizontal and vertical acceleration due to gravity (in units/sec^2)
of the physical world represented by this shape screen
|
---|
This method is called after an attempted was made to inflate the
screen's layout. Most users will not need to call or override this
method; it is provided for Sofia's own subclasses of Screen
to
support custom behavior depending on whether a user layout was provided
or not.
This factory method is used to create the ShapeView that will be contained by this screen. It is provided for subclass extensibility, in case a subclass of ShapeScreen wants to use a more specialized ShapeView instance.
parent | The screen that will contain the view (e.g., "this") |
---|