|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectandroid.content.Context
android.content.ContextWrapper
android.view.ContextThemeWrapper
android.app.Activity
org.android.activityminer.app.util.SharedPreferenceChangeAwareActivity
org.android.activityminer.app.util.ServiceBasedActivity
public abstract class ServiceBasedActivity
Base class for Android activities using a service connection
| Field Summary | |
|---|---|
private TaskFinishedEventBroadcastReceiver |
backgroundServiceTaskFinishedEventReceiver
Broadcast receiver for task finished events in the background service |
private ProgressBroadcastReceiver |
backgroundServiceTaskProgressReceiver
Broadcast receiver for progress in the background service |
private BackgroundServiceConnectionHolder |
connectionHolder
The background service connection holder |
private ProgressDialog |
progressDialog
The progress dialog for a running task in the background service |
private IBackgroundService |
service
The background service reference |
| Fields inherited from class android.app.Activity |
|---|
DEFAULT_KEYS_DIALER, DEFAULT_KEYS_DISABLE, DEFAULT_KEYS_SEARCH_GLOBAL, DEFAULT_KEYS_SEARCH_LOCAL, DEFAULT_KEYS_SHORTCUT, FOCUSED_STATE_SET, RESULT_CANCELED, RESULT_FIRST_USER, RESULT_OK |
| Fields inherited from interface android.content.ComponentCallbacks2 |
|---|
TRIM_MEMORY_BACKGROUND, TRIM_MEMORY_COMPLETE, TRIM_MEMORY_MODERATE, TRIM_MEMORY_RUNNING_CRITICAL, TRIM_MEMORY_RUNNING_LOW, TRIM_MEMORY_RUNNING_MODERATE, TRIM_MEMORY_UI_HIDDEN |
| Constructor Summary | |
|---|---|
ServiceBasedActivity()
Constructor |
|
| Method Summary | |
|---|---|
private static String |
formatTaskFinishedEventResult(Context context,
TaskFinishedEvent event)
Method to create a formatted result text of a task finished event |
protected IBackgroundService |
getService()
Getter for the service |
protected ServiceState |
getServiceState()
Getter for the service state |
protected void |
handleTaskFinishedEvent(TaskFinishedEvent taskFinishedEvent)
Handler for task finished events |
protected boolean |
isServiceAvailable()
Test method for service availability |
void |
onAboutToDisconnect(IBackgroundService service)
|
protected void |
onBackgroundTaskProgress(CharSequence title,
CharSequence message,
int maximum,
int progress)
Does update the progress for a running task in the background service |
void |
onBindingFailed()
|
void |
onConnectionEstablished(IBackgroundService service)
|
void |
onConnectionLost()
|
protected void |
onCreate(Bundle savedInstanceState)
|
protected void |
onDefaultTaskFinishedEvent(TaskFinishedEvent event)
Default handler for task finished events |
private void |
onEvaluationFinishedEvent(TaskFinishedEvent event)
Handler for a evaluation task finished event |
private void |
onEvaluationResult(TaskFinishedEvent event)
Handler for a new evaluation result from background service |
protected void |
onNewIntent(Intent intent)
|
protected void |
onPause()
|
protected void |
onResume()
|
protected abstract void |
onServiceFinishedCurrentTask(TaskFinishedEvent event)
Handler for finished service tasks |
void |
onServiceUnavailable()
|
protected void |
safeUnregisterReceiver(BroadcastReceiver receiver)
Safe method to unregister receivers |
private void |
setService(IBackgroundService service)
Setter for the service |
protected void |
showServiceTaskFinishedResult(TaskFinishedEvent event)
Does display the result from a task finished event received from the service |
protected void |
startBackgroundServiceProgressObservation()
Method to start the background service progress observation |
protected void |
stopBackgroundServiceProgressObservation()
Method to stop the background service progress observation |
| Methods inherited from class android.view.ContextThemeWrapper |
|---|
applyOverrideConfiguration, attachBaseContext, getResources, getTheme, setTheme |
| Methods inherited from class android.content.Context |
|---|
getString, getString, getText, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, registerComponentCallbacks, unregisterComponentCallbacks |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private final BackgroundServiceConnectionHolder connectionHolder
private IBackgroundService service
private ProgressDialog progressDialog
private ProgressBroadcastReceiver backgroundServiceTaskProgressReceiver
private final TaskFinishedEventBroadcastReceiver backgroundServiceTaskFinishedEventReceiver
| Constructor Detail |
|---|
public ServiceBasedActivity()
| Method Detail |
|---|
protected final void onBackgroundTaskProgress(CharSequence title,
CharSequence message,
int maximum,
int progress)
title - the task titlemessage - the messagemaximum - the
maximumprogress - the progressprotected final void startBackgroundServiceProgressObservation()
protected final void stopBackgroundServiceProgressObservation()
protected final boolean isServiceAvailable()
protected final ServiceState getServiceState()
private final void setService(IBackgroundService service)
service - the service to setprotected final IBackgroundService getService()
protected void onCreate(Bundle savedInstanceState)
onCreate in class SharedPreferenceChangeAwareActivityprotected void onResume()
onResume in class Activityprotected void handleTaskFinishedEvent(TaskFinishedEvent taskFinishedEvent)
taskFinishedEvent - the task finished eventprotected final void onNewIntent(Intent intent)
onNewIntent in class Activityprotected void onPause()
onPause in class Activity
private static final String formatTaskFinishedEventResult(Context context,
TaskFinishedEvent event)
context - the contextevent - the task finished event
protected final void showServiceTaskFinishedResult(TaskFinishedEvent event)
event - the task finished eventprotected abstract void onServiceFinishedCurrentTask(TaskFinishedEvent event)
event - the task finished eventprivate final void onEvaluationFinishedEvent(TaskFinishedEvent event)
event - the eventprivate final void onEvaluationResult(TaskFinishedEvent event)
event - the task finished eventprotected void onDefaultTaskFinishedEvent(TaskFinishedEvent event)
event - the eventpublic void onConnectionEstablished(IBackgroundService service)
onConnectionEstablished in interface GenericServiceConnectionHolder.ServiceConnectionEventReceiver<IBackgroundService>public void onAboutToDisconnect(IBackgroundService service)
onAboutToDisconnect in interface GenericServiceConnectionHolder.ServiceConnectionEventReceiver<IBackgroundService>protected final void safeUnregisterReceiver(BroadcastReceiver receiver)
receiver - the receiver to unregisterpublic void onConnectionLost()
onConnectionLost in interface GenericServiceConnectionHolder.ServiceConnectionEventReceiver<IBackgroundService>public final void onBindingFailed()
onBindingFailed in interface GenericServiceConnectionHolder.ServiceConnectionEventReceiver<IBackgroundService>public final void onServiceUnavailable()
onServiceUnavailable in interface GenericServiceConnectionHolder.ServiceConnectionEventReceiver<IBackgroundService>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||