|
||||||||||
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>
T
- the enumeration type for the dimensionspublic abstract class AbstractRecordingActivity<T extends Enum<T> & Dimensions>
Abstract base class for sensor data recording activities.
Nested Class Summary | |
---|---|
private class |
AbstractRecordingActivity.ButtonUpdateTask
The button update task. |
Field Summary | |
---|---|
private AbstractRecordingActivity.ButtonUpdateTask |
buttonUpdateTask
The button update task ( does alter text if minimum count is reached ). |
private GenericObservableCutoutCreator<T,Double> |
cutoutCreator
The cut-out creator. |
private EventObserver<SensorObservationCutout<T,Double>> |
cutoutObserver
The observer for the created time series data cut-out. |
private Handler |
handler
The handler to post runnable tasks |
private AtomicBoolean |
isRecording
Activity flag for recording. |
private AtomicLong |
minRecordingTime
The minimum recording time. |
private Button |
recordingBtn
The button to toggle recording. |
private ProgressBar |
recordingProgress
The progress bar. |
private AtomicLong |
sampleRate
The sample rate. |
private ObservableSensorScanner<T,Double> |
sensorScanner
The observable sensor scanner. |
private PowerManager.WakeLock |
wakeLock
The wake lock for active recording state. |
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 | |
---|---|
AbstractRecordingActivity()
Constructor |
Method Summary | |
---|---|
private void |
deactivateSamplingChain()
Method to deactivate recording components and disconnect any observers. |
protected void |
doStartRecording()
Method to start recording. |
protected long |
doStopRecording(boolean doNotify,
boolean wasStoppedByUser,
long stopTime)
Method to stop recording. |
protected void |
enableRecordingButton(boolean enabled)
Setter for the enabled state of the recording button. |
protected long |
getActualObservationTime()
Getter for the actual observation time |
protected abstract long |
getCutOutSize()
Getter for the cut-out window size in milliseconds |
protected SensorObservationCutout<T,Double> |
getLastCutout()
Method to access the current not completed cut-out. |
protected long |
getMinRecordingTime()
Getter for the minimum recording time in milliseconds |
long |
getRemainingTimeForMinRecordingLength()
Getter for the remaining time until the mininimal recording length requirement is fulfilled |
protected long |
getSampleRate()
Getter for the sample rate |
boolean |
isInterestedInLimitViolations()
Method to test if limit violations should be notified. |
boolean |
isRecording()
Getter for the recording state |
protected boolean |
isRecordingButtonEnabled()
|
protected boolean |
onAboutToStartRecording()
Call-back method for recording start preparation. |
void |
onBackPressed()
|
void |
onConfigurationChanged(Configuration newConfig)
|
protected void |
onCreate(Bundle savedInstanceState)
|
void |
onDefaultRecordingTimeChange(long minimumRecordingTime)
The handler for default recording time parameter changes. |
protected void |
onDestroy()
|
protected abstract void |
onNewCutOut(SensorObservationCutout<T,Double> cutOut)
Event handler for new extracted sensor observation cut-outs |
protected void |
onPause()
|
protected abstract ObservableSensorScanner<T,Double> |
onPrepare()
Call-back method for load preparation. |
protected abstract void |
onRecordingStopped(boolean wasStoppedByUser,
long stopTime)
Call-back method for recording stopped post processing. |
protected boolean |
postDelayed(Runnable r,
long delayMillis)
Does post a runnable task to the internal handler. |
private void |
prepare()
Preparation in case of creation or orientation changes. |
protected void |
removeCallbacks(Runnable r)
Remove any pending posts of a runnable from the handlers queue. |
protected void |
setMinRecordingTime(long minRecordingTime)
Setter for the minimum recording time in milliseconds ( which is limited by the maximum recording time ) |
protected void |
startRecording()
Does start the recording. |
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 PowerManager.WakeLock wakeLock
private final AtomicLong sampleRate
private final AtomicLong minRecordingTime
private final AtomicBoolean isRecording
private ProgressBar recordingProgress
private Button recordingBtn
private GenericObservableCutoutCreator<T extends Enum<T> & Dimensions,Double> cutoutCreator
private ObservableSensorScanner<T extends Enum<T> & Dimensions,Double> sensorScanner
private final EventObserver<SensorObservationCutout<T extends Enum<T> & Dimensions,Double>> cutoutObserver
private AbstractRecordingActivity.ButtonUpdateTask buttonUpdateTask
private Handler handler
Constructor Detail |
---|
public AbstractRecordingActivity()
Method Detail |
---|
protected final SensorObservationCutout<T,Double> getLastCutout()
protected final long getSampleRate()
public final boolean isRecording()
protected final long getActualObservationTime()
protected void setMinRecordingTime(long minRecordingTime)
minRecordingTime
- the minimum recording time to setprotected long getMinRecordingTime()
protected void onCreate(Bundle savedInstanceState)
onCreate
in class SharedPreferenceChangeAwareActivity
protected abstract long getCutOutSize()
public void onConfigurationChanged(Configuration newConfig)
onConfigurationChanged
in interface ComponentCallbacks
onConfigurationChanged
in class Activity
protected final void enableRecordingButton(boolean enabled)
enabled
- enabled stateprotected final boolean isRecordingButtonEnabled()
private final void prepare()
protected abstract ObservableSensorScanner<T,Double> onPrepare()
protected void onPause()
onPause
in class Activity
public void onBackPressed()
onBackPressed
in class Activity
protected void onDestroy()
onDestroy
in class SharedPreferenceChangeAwareActivity
protected void doStartRecording()
protected final void startRecording()
protected boolean onAboutToStartRecording()
startRecording()
Method by your own as soon as you
are ready.protected long doStopRecording(boolean doNotify, boolean wasStoppedByUser, long stopTime)
doNotify
- if true, the onRecordingStopped(boolean, long)
method is
calledwasStoppedByUser
- flag is recording was stopped manually by the userstopTime
- the stop time
protected abstract void onRecordingStopped(boolean wasStoppedByUser, long stopTime)
wasStoppedByUser
- flag is recording was stopped manually by the userstopTime
- the time the recording was stopped in millisecondsprivate final void deactivateSamplingChain()
public final boolean isInterestedInLimitViolations()
SharedPreferenceChangeNotificationReceiver
isInterestedInLimitViolations
in interface SharedPreferenceChangeNotificationReceiver
isInterestedInLimitViolations
in class SharedPreferenceChangeAwareActivity
public long getRemainingTimeForMinRecordingLength()
public void onDefaultRecordingTimeChange(long minimumRecordingTime)
SharedPreferenceChangeObserver
onDefaultRecordingTimeChange
in interface SharedPreferenceChangeObserver
onDefaultRecordingTimeChange
in class SharedPreferenceChangeAwareActivity
minimumRecordingTime
- the new default recording time in secondsprotected final boolean postDelayed(Runnable r, long delayMillis)
r
- the runnable to post delayeddelayMillis
- the delay in milliseconds
protected final void removeCallbacks(Runnable r)
r
- the runnableprotected abstract void onNewCutOut(SensorObservationCutout<T,Double> cutOut)
cutOut
- the new cut-out
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |