|
||||||||||
| 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.recording.AbstractRecordingActivity<T>
org.android.activityminer.app.recording.GenericRecordingActivityForSensorObservations<T>
T - the enumeration type for the dimensionspublic abstract class GenericRecordingActivityForSensorObservations<T extends Enum<T> & Dimensions>
The generic activity for sensor data recording.
| Nested Class Summary | |
|---|---|
private class |
GenericRecordingActivityForSensorObservations.CountDownTask
Asynchronous task for the start count down. |
private class |
GenericRecordingActivityForSensorObservations.SaveTask
The save task. |
private class |
GenericRecordingActivityForSensorObservations.SaveTimerTask
The save timer task. |
private class |
GenericRecordingActivityForSensorObservations.StopTask
The automatic stop task. |
| Field Summary | |
|---|---|
private Button |
addLabel
the button to add new labels. |
private TextView |
countDownField
The text view for the count down. |
private AsyncTask<Void,Integer,Void> |
countDownTask
The count-down task |
private int |
countDownTime
The delay before recording is started and a count-down is displayed |
private AtomicLong |
countOfObservations
The count of continuous observations |
private String |
currentRecordingLabel
The label for continuous recordings |
private Queue<SensorObservationCutout<T,Double>> |
cutoutQueue
Queue to store cut-outs in until saving is allowed |
private AtomicLong |
delayInTheEnd
The final delay on milliseconds for the storage of recordings. |
private DeviceManager |
deviceManager
The device manager. |
private boolean |
doNotifyRecordingResult
Flag for recording result notification |
private AtomicLong |
duration
The duration of all recordings |
private EditText |
editLabel
The text field to edit new labels. |
private Runnable |
errorEventTask
The error event task to be executed by the handler. |
private AtomicLong |
estimatedDuration
The estimated duration for automatic stopss |
private Handler |
handler
handler for error event updates notified by an asynchronous thread event. |
private AtomicBoolean |
isCountDownActive
The count-down is active flag. |
private List<String> |
labels
The cached labels. |
private String |
lastError
Last error. |
private AtomicLong |
lastErrorTime
The last error event time |
private LabelAdapter |
listAdapter
The list adapter. |
private ListView |
listViewForLabels
The list view with the labels. |
private int |
NOTIFICATION
the notification identifier |
private MenuItem |
recordingConfigMenuItem
The recording option menu entry. |
private GenericRecordingActivityForSensorObservations.SaveTask |
saveThread
The save task |
private GenericRecordingActivityForSensorObservations.SaveTimerTask |
saveTimerTask
The save timer task |
private ObservableSensorScanner<T,Double> |
scanner
The observable sensor observation source (scanner). |
private int |
selectedLabelPos
The list view with the labels. |
private AtomicLong |
sequenceId
The sequence identifier of the continuous recording session |
private GenericRecordingActivityForSensorObservations.StopTask |
stopTask
The task to stop recording automatically. |
| 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 | |
|---|---|
GenericRecordingActivityForSensorObservations()
Constructor |
|
| Method Summary | |
|---|---|
protected void |
addLabel(String activityLabel)
Does add the text in the edit field as new label to the list. |
protected abstract ObservableSensorScanner<T,Double> |
createScannerInstance(long sampleRate)
Getter for the observable sensor scanner instance |
void |
doSaveCutOut(SensorObservationCutout<T,Double> cutOut)
Handler for the save timer task |
protected void |
doStartRecording()
Method to start recording. |
protected AsyncTask<Void,Integer,Void> |
getCountDownTask()
Getter for the countDownTask |
protected int |
getCountDownTime()
Getter for the countDownTime |
protected String |
getCurrentRecordingLabel()
Getter for the current recording label |
protected long |
getCutOutSize()
Getter for the cut-out window size in milliseconds |
protected int |
getDelayInTheEnd()
Does calculate the delay in the end in milliseconds to determine the time range to remove from a cut-out due to invalid observations in the end. |
DeviceManager |
getDeviceManager(long sampleRate)
Getter for the device manager |
protected String |
getLabel()
Getter for the recording label |
long |
getRemainingTimeForMinRecordingLength()
Getter for the remaining time until the mininimal recording length requirement is fulfilled |
private void |
handleRemainingCutOuts(long latestObservationTs)
Handler for the remaining tasks after a user has stopped recording |
protected void |
notifyNotEnoughSamplesTaken()
Does notify for not enough samples taken |
protected void |
notifyRecordingResult(long cntObservations,
long duration)
Does notify about the recording result |
protected boolean |
onAboutToStartRecording()
Call-back method for recording start preparation. |
void |
onBackPressed()
|
void |
onConfigurationChanged(Configuration newConfig)
|
void |
onCountDownTimeChange(long countDownTime)
The handler for count-down time parameter changes. |
protected void |
onCreate(Bundle savedInstanceState)
|
boolean |
onCreateOptionsMenu(Menu menu)
|
protected void |
onDestroy()
|
void |
onEvent(ObservableEventSource<? extends SampleGapErrorEvent> eventSource,
SampleGapErrorEvent observedEvent)
|
void |
onLocationDataUsageFlagChange(boolean locationDataUsageFlag)
The handler for changes of location data usage flag |
void |
onMaximumRecordingTimeChange(int maximumRecordingTime)
The handler for maximum recording time parameter changes. |
protected void |
onNewCutOut(SensorObservationCutout<T,Double> cutOut)
Event handler for new extracted sensor observation cut-outs |
boolean |
onOptionsItemSelected(MenuItem item)
|
protected ObservableSensorScanner<T,Double> |
onPrepare()
Call-back method for load preparation. |
protected void |
onRecordingStopped(boolean wasStoppedByUser,
long stopTime)
Call-back method for recording stopped post processing. |
protected void |
onResume()
|
protected void |
setCountDownTask(AsyncTask<Void,Integer,Void> countDownTask)
Setter for the countDownTask |
protected void |
setCountDownTime(int countDownTime)
Setter for the countDownTime |
protected void |
setCurrentRecordingLabel(String currentRecordingLabel)
Setter for the current recording label |
protected boolean |
testForSelectedLabel()
Test for a selected activity label |
protected void |
updateOptionMenu()
Method to update the option menu enabled state. |
void |
updateSelection()
Does update the selection state in the label list. |
| Methods inherited from class org.android.activityminer.app.recording.AbstractRecordingActivity |
|---|
doStopRecording, enableRecordingButton, getActualObservationTime, getLastCutout, getMinRecordingTime, getSampleRate, isInterestedInLimitViolations, isRecording, isRecordingButtonEnabled, onDefaultRecordingTimeChange, onPause, postDelayed, removeCallbacks, setMinRecordingTime, startRecording |
| 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 int NOTIFICATION
private ObservableSensorScanner<T extends Enum<T> & Dimensions,Double> scanner
private EditText editLabel
private Button addLabel
private ListView listViewForLabels
private final List<String> labels
private int selectedLabelPos
private LabelAdapter listAdapter
private TextView countDownField
private MenuItem recordingConfigMenuItem
private int countDownTime
private AsyncTask<Void,Integer,Void> countDownTask
private boolean doNotifyRecordingResult
private final Queue<SensorObservationCutout<T extends Enum<T> & Dimensions,Double>> cutoutQueue
private String currentRecordingLabel
private final AtomicLong delayInTheEnd
private final AtomicLong sequenceId
private final AtomicLong countOfObservations
private final AtomicLong duration
private final AtomicLong estimatedDuration
private final GenericRecordingActivityForSensorObservations.SaveTimerTask saveTimerTask
private GenericRecordingActivityForSensorObservations.SaveTask saveThread
private DeviceManager deviceManager
private GenericRecordingActivityForSensorObservations.StopTask stopTask
private String lastError
private final AtomicLong lastErrorTime
private final Handler handler
private final Runnable errorEventTask
private final AtomicBoolean isCountDownActive
| Constructor Detail |
|---|
public GenericRecordingActivityForSensorObservations()
| Method Detail |
|---|
public final DeviceManager getDeviceManager(long sampleRate)
sampleRate - the sample rate
protected void setCountDownTask(AsyncTask<Void,Integer,Void> countDownTask)
countDownTask - the countDownTask to setprotected AsyncTask<Void,Integer,Void> getCountDownTask()
protected final void setCountDownTime(int countDownTime)
countDownTime - the countDownTime to setprotected final int getCountDownTime()
protected void setCurrentRecordingLabel(String currentRecordingLabel)
currentRecordingLabel - the current recording label to setprotected String getCurrentRecordingLabel()
protected void onCreate(Bundle savedInstanceState)
onCreate in class AbstractRecordingActivity<T extends Enum<T> & Dimensions>protected void onDestroy()
onDestroy in class AbstractRecordingActivity<T extends Enum<T> & Dimensions>public void onBackPressed()
onBackPressed in class AbstractRecordingActivity<T extends Enum<T> & Dimensions>public final boolean onCreateOptionsMenu(Menu menu)
onCreateOptionsMenu in class Activityprotected final void updateOptionMenu()
public final boolean onOptionsItemSelected(MenuItem item)
onOptionsItemSelected in class Activityprotected ObservableSensorScanner<T,Double> onPrepare()
AbstractRecordingActivity
onPrepare in class AbstractRecordingActivity<T extends Enum<T> & Dimensions>public void onConfigurationChanged(Configuration newConfig)
onConfigurationChanged in interface ComponentCallbacksonConfigurationChanged in class AbstractRecordingActivity<T extends Enum<T> & Dimensions>protected abstract ObservableSensorScanner<T,Double> createScannerInstance(long sampleRate)
sampleRate - the sample rate
public final void updateSelection()
protected final void onResume()
onResume in class Activityprotected final void doStartRecording()
AbstractRecordingActivity
doStartRecording in class AbstractRecordingActivity<T extends Enum<T> & Dimensions>protected boolean onAboutToStartRecording()
AbstractRecordingActivity
onAboutToStartRecording in class AbstractRecordingActivity<T extends Enum<T> & Dimensions>AbstractRecordingActivity.startRecording() Method by your own as soon as you
are ready.protected final int getDelayInTheEnd()
protected void onRecordingStopped(boolean wasStoppedByUser,
long stopTime)
AbstractRecordingActivity
onRecordingStopped in class AbstractRecordingActivity<T extends Enum<T> & Dimensions>wasStoppedByUser - flag is recording was stopped manually by the userstopTime - the time the recording was stopped in millisecondsprotected void notifyNotEnoughSamplesTaken()
protected void notifyRecordingResult(long cntObservations,
long duration)
cntObservations - the observation countduration - the recording durationprotected final String getLabel()
protected final void addLabel(String activityLabel)
activityLabel - the new activity labelprotected final boolean testForSelectedLabel()
public final void onCountDownTimeChange(long countDownTime)
SharedPreferenceChangeObserver
onCountDownTimeChange in interface SharedPreferenceChangeObserveronCountDownTimeChange in class SharedPreferenceChangeAwareActivitycountDownTime - the new count-down time sizepublic final void onLocationDataUsageFlagChange(boolean locationDataUsageFlag)
SharedPreferenceChangeObserver
onLocationDataUsageFlagChange in interface SharedPreferenceChangeObserveronLocationDataUsageFlagChange in class SharedPreferenceChangeAwareActivitylocationDataUsageFlag - the new location data usage flagprotected final long getCutOutSize()
AbstractRecordingActivity
getCutOutSize in class AbstractRecordingActivity<T extends Enum<T> & Dimensions>protected final void onNewCutOut(SensorObservationCutout<T,Double> cutOut)
AbstractRecordingActivity
onNewCutOut in class AbstractRecordingActivity<T extends Enum<T> & Dimensions>cutOut - the new cut-outpublic final void doSaveCutOut(SensorObservationCutout<T,Double> cutOut)
cutOut - the cut-out to saveprivate final void handleRemainingCutOuts(long latestObservationTs)
latestObservationTs - the time when recording was stopped by the user minus the delay
offsetpublic long getRemainingTimeForMinRecordingLength()
AbstractRecordingActivity
getRemainingTimeForMinRecordingLength in class AbstractRecordingActivity<T extends Enum<T> & Dimensions>public void onMaximumRecordingTimeChange(int maximumRecordingTime)
SharedPreferenceChangeObserver
onMaximumRecordingTimeChange in interface SharedPreferenceChangeObserveronMaximumRecordingTimeChange in class SharedPreferenceChangeAwareActivitymaximumRecordingTime - the new default maximum time in seconds
public void onEvent(ObservableEventSource<? extends SampleGapErrorEvent> eventSource,
SampleGapErrorEvent observedEvent)
onEvent in interface EventObserver<SampleGapErrorEvent>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||