|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
de.unikassel.android.sdcframework.util.AbstractWorkerThread
org.android.activityminer.app.util.ObservableWorkerThreadWithProgressNotification
public abstract class ObservableWorkerThreadWithProgressNotification
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
Thread.State, Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
private Context |
applicationContext
The application context. |
private android.support.v4.app.NotificationCompat.Builder |
builder
The notification builder |
private String |
extraMaxProgress
The intent max progress extra. |
private String |
extraMessage
The intent message extra. |
private String |
extraProgress
The intent progress extra. |
private String |
extraTitle
The intent title extra. |
private long |
lastProgressNotificationTs
The time stamp of the last notification |
private AtomicInteger |
maxProgress
The maximum progress. |
private NotificationManager |
notificationManager
The notification manager |
private ObservableEventSource<TaskFinishedEvent> |
observableEventSource
The observable event source for delegation. |
private AtomicInteger |
progress
The progress counter. |
private static long |
PROGRESS_NOTIFICATION_INTERVALL
Interval in milliseconds between two progress notifications |
private String |
progressMessage
Field to store the last progress message change |
private String |
taskTitle
The thread task title (description) for notification and result information |
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
ObservableWorkerThreadWithProgressNotification(Context context,
CharSequence progressTitle,
Class<? extends Activity> intentReceiver)
Constructor |
Method Summary | |
---|---|
void |
broadcastProgress()
Method to broadcast the progress |
private void |
broadcastResult(TaskFinishedEvent taskFinishedEvent)
Method to broadcast the result |
protected void |
doCleanUp()
|
Context |
getApplicationContext()
Getter for the application context |
abstract String |
getErrorNotificationMsg()
Getter for the error notification message |
String |
getFinalResult()
Getter for the final result message |
int |
getMaxProgress()
Getter for the maximum progress |
Notification |
getNotification()
Getter for the notification |
abstract int |
getNotificationId()
Getter for the notification identifier |
private String |
getProgressMessage()
Getter for the progress message |
abstract String |
getResultNotificationMsg()
Getter for the result notification message |
String |
getTaskTitle()
Getter for the task title |
boolean |
hasObservers()
|
abstract boolean |
hasSucceeded()
Test method for success in case of termination |
void |
incrementAndNotifyProgress()
Progress increment and notification |
void |
incrementAndNotifyProgress(String message)
Progress increment and notification |
void |
notify(TaskFinishedEvent data)
|
protected void |
notifyProgress(String message)
Progress notification |
void |
notifyProgress(String message,
int progress)
Progress notification |
void |
registerEventObserver(EventObserver<? extends TaskFinishedEvent> observer)
|
void |
removeAllObservers()
|
void |
setMaxProgress(int maxProgress)
Setter for the maximum progress |
private void |
setProgressMessage(String progressMessage)
Setter for the progress message |
void |
unregisterEventObserver(EventObserver<? extends TaskFinishedEvent> observer)
|
Methods inherited from class de.unikassel.android.sdcframework.util.AbstractWorkerThread |
---|
doTerminate, doWork, hasTerminated, isLogging, isWorking, logMessage, run, setLogging, start, startWork, stopWork |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final long PROGRESS_NOTIFICATION_INTERVALL
private final NotificationManager notificationManager
private final AtomicInteger maxProgress
private final AtomicInteger progress
private final ObservableEventSource<TaskFinishedEvent> observableEventSource
private final Context applicationContext
private final String taskTitle
private String progressMessage
private long lastProgressNotificationTs
private final android.support.v4.app.NotificationCompat.Builder builder
private final String extraTitle
private final String extraMessage
private final String extraProgress
private final String extraMaxProgress
Constructor Detail |
---|
public ObservableWorkerThreadWithProgressNotification(Context context, CharSequence progressTitle, Class<? extends Activity> intentReceiver)
context
- the application contextprogressTitle
- the progress notification titleintentReceiver
- the intent receiver classMethod Detail |
---|
private final String getProgressMessage()
private final void setProgressMessage(String progressMessage)
progressMessage
- the progress message to setpublic final Context getApplicationContext()
public final Notification getNotification()
public final int getMaxProgress()
public final void setMaxProgress(int maxProgress)
maxProgress
- the maximum progress to setpublic final void broadcastProgress()
private final void broadcastResult(TaskFinishedEvent taskFinishedEvent)
taskFinishedEvent
- the result to progressprotected final void notifyProgress(String message)
message
- the progress textpublic final void incrementAndNotifyProgress(String message)
message
- the progress textpublic final void incrementAndNotifyProgress()
public final void notifyProgress(String message, int progress)
message
- the progress textprogress
- the updated progresspublic abstract String getErrorNotificationMsg()
public abstract String getResultNotificationMsg()
public abstract int getNotificationId()
public abstract boolean hasSucceeded()
protected void doCleanUp()
doCleanUp
in class AbstractWorkerThread
public final void registerEventObserver(EventObserver<? extends TaskFinishedEvent> observer)
registerEventObserver
in interface ObserverRegistration<TaskFinishedEvent>
public final void unregisterEventObserver(EventObserver<? extends TaskFinishedEvent> observer)
unregisterEventObserver
in interface ObserverRegistration<TaskFinishedEvent>
public final void removeAllObservers()
removeAllObservers
in interface ObserverRegistration<TaskFinishedEvent>
public final void notify(TaskFinishedEvent data)
notify
in interface ObservableEventSource<TaskFinishedEvent>
public final boolean hasObservers()
hasObservers
in interface ObservableEventSource<TaskFinishedEvent>
public final String getFinalResult()
public final String getTaskTitle()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |