java.lang.Object | |||||
↳ | android.content.Context | ||||
↳ | android.content.ContextWrapper | ||||
↳ | android.view.ContextThemeWrapper | ||||
↳ | android.app.Activity | ||||
↳ | sofia.app.Screen |
Known Direct Subclasses |
Known Indirect Subclasses |
The Screen
class represents a single screen in an Android
application. A Screen
is a subclass of Android's notion of an
Activity
, which manages a user interface and acts as a "controller"
for the events that occur in that GUI.
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.app.Activity
| |||||||||||
From class
android.content.Context
|
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.app.Activity
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Screen()
Do not directly create instances of the
Screen class; They are
created for you by the operating system. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void |
finish(Object result)
Call this method when the current screen is finished and should be
closed.
| ||||||||||
LayoutInflater | getLayoutInflater() | ||||||||||
ScreenMixin |
getScreenMixin()
Not intended to be called by users; this method is public as an
implementation detail.
| ||||||||||
Object |
getSystemService(String service)
This method is overridden to replace the default Android layout inflater
with one that supports Sofia's enhancements.
| ||||||||||
void |
initialize()
Called when the screen has been created and is about to be displayed on
the device.
| ||||||||||
void |
log(String message)
Prints an informational message to the system log, tagged with the
"User Log" tag so that it can be easily identified in the LogCat view.
| ||||||||||
boolean | onCreateOptionsMenu(Menu menu) | ||||||||||
boolean | onMenuItemSelected(int featureId, MenuItem item) | ||||||||||
void |
presentActivity(Intent intent, String returnMethod)
Starts the activity with the specified intent.
| ||||||||||
void |
presentScreen(Class<? extends Activity> screenClass, Object... args)
Starts the activity represented by the specified
Screen subclass
and slides it into view. | ||||||||||
void |
showAlertDialog(String title, String message)
Displays an alert dialog and waits for the user to dismiss it.
| ||||||||||
boolean |
showConfirmationDialog(String title, String message)
Displays a confirmation dialog and waits for the user to select an
option.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void |
afterInitialize()
Called once the screen has been created and made visible.
| ||||||||||
void |
afterLayoutInflated(boolean inflated)
This method is called after an attempted was made to inflate the
screen's layout.
| ||||||||||
void |
beforeInitialize()
Called before
initialize() during the screen creation process. | ||||||||||
boolean |
doInitializeAfterLayout()
Determines whether the user's | ||||||||||
void |
onActivityResult(int requestCode, int resultCode, Intent data)
Called when a sub-activity returns yielding a result.
| ||||||||||
void |
onCreate(Bundle savedInstanceState)
Called when the activity is created.
| ||||||||||
void | onDestroy() | ||||||||||
void | onPause() | ||||||||||
void | onResume() | ||||||||||
void | onSaveInstanceState(Bundle bundle) | ||||||||||
void | onStop() |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
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
|
Do not directly create instances of the Screen
class; They are
created for you by the operating system.
Call this method when the current screen is finished and should be closed. The specified value will be passed back to the previous screen and returned from the #presentScreen(Class, Object...) call that originally presented this screen.
result | the value to pass back to the previous screen |
---|
Not intended to be called by users; this method is public as an implementation detail.
This method is overridden to replace the default Android layout inflater with one that supports Sofia's enhancements.
Called when the screen has been created and is about to be displayed on the device.
Prints an informational message to the system log, tagged with the "User Log" tag so that it can be easily identified in the LogCat view.
message | the message to log |
---|
Starts the activity with the specified intent. This method will not return until the new activity is dismissed by the user.
intent | an Intent that describes the activity to start |
---|---|
returnMethod | the name of the method to call when the activity returns |
Starts the activity represented by the specified Screen
subclass
and slides it into view. This method returns immediately even as the
screen is being presented, but at that point a new screen has taken
over the user's attention and the old one might be discarded from memory
at any time. Therefore, users should typically not do any important
computation after calling this method.
screenClass | the subclass of Screen that will be displayed |
---|---|
args | the arguments to be sent to the new screen's
initialize method
|
Displays an alert dialog and waits for the user to dismiss it.
title | the title to display in the dialog |
---|---|
message | the message to display in the dialog |
Displays a confirmation dialog and waits for the user to select an option.
title | the title to display in the dialog |
---|---|
message | the message to display in the dialog |
Called once the screen has been created and made visible. Most users
will not need to override this method; it is provided so that Sofia's
own Screen
subclasses can do additional initialization after the
user's own initialize()
method has executed, if necessary.
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.
Called before initialize()
during the screen creation process.
Most users typically will not need to override this method; it is
intended for Sofia's own subclasses of Screen so that they can
provide additional functionality before initialize()
, and then
users can override initialize()
without being required to call
the superclass implementation.
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)
Called when a sub-activity returns yielding a result. Subclasses can override this method if they want to handle sub-activities in the traditional way, but they must call the superclass implementation in order to make sure that Sofia's built-in methods and choosers work correctly.
Called when the activity is created.
savedInstanceState | instance data previously saved by this activity |
---|