|
|||||||||
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
com.drismo.gui.monitor.MonitorActivityTemplate
public abstract class MonitorActivityTemplate
This class is a template for creating a custom quality monitor. The derived class must only specify the layout
in the abstract method setUpLayout()
and control it as wished specified by the abstract method
onQualityUpdate()
.
The rest (i.e. initiation, calibration, etc) is controlled/handled in MonitorActivityTemplate
.
Field Summary | |
---|---|
private static int |
CALIBRATION_DIALOG
|
private CalibrationDialog |
calibrationDialog
|
private MonitorController |
controller
|
private static int |
NOTIFICATION_MONITORING
|
private static java.lang.String |
TAG
|
private android.os.PowerManager.WakeLock |
wl
|
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 class android.content.Context |
---|
ACCESSIBILITY_SERVICE, ACCOUNT_SERVICE, ACTIVITY_SERVICE, ALARM_SERVICE, AUDIO_SERVICE, BIND_AUTO_CREATE, BIND_DEBUG_UNBIND, BIND_NOT_FOREGROUND, CLIPBOARD_SERVICE, CONNECTIVITY_SERVICE, CONTEXT_IGNORE_SECURITY, CONTEXT_INCLUDE_CODE, CONTEXT_RESTRICTED, DEVICE_POLICY_SERVICE, DROPBOX_SERVICE, INPUT_METHOD_SERVICE, KEYGUARD_SERVICE, LAYOUT_INFLATER_SERVICE, LOCATION_SERVICE, MODE_APPEND, MODE_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE, NOTIFICATION_SERVICE, POWER_SERVICE, SEARCH_SERVICE, SENSOR_SERVICE, TELEPHONY_SERVICE, UI_MODE_SERVICE, VIBRATOR_SERVICE, WALLPAPER_SERVICE, WIFI_SERVICE, WINDOW_SERVICE |
Constructor Summary | |
---|---|
MonitorActivityTemplate()
|
Method Summary | |
---|---|
private void |
lockScreenRotation()
Sets screen rotation as fixed to current rotation setting |
void |
onBackPressed()
Stops monitoring when back pressed. |
void |
onCalibrationCompleted()
Sets up the layout of the child class and hides the calibration dialog. |
void |
onCreate(android.os.Bundle savedInstanceState)
Constructs the required layout (depending if we are monitoring or idle) and instantiates the necessary objects. |
android.app.Dialog |
onCreateDialog(int id)
Creates the calibration dialog. |
boolean |
onCreateOptionsMenu(android.view.Menu menu)
Creates the menu to switch custom monitors. |
void |
onOffsetCalculationComplete()
When roll, pitch and offset is calibrated, instruct the driver to go forward. |
boolean |
onOptionsItemSelected(android.view.MenuItem item)
Switches between the different custom monitors, based on the given input. |
protected void |
onPause()
Works as intended, but releases the wake lock. |
abstract void |
onQualityUpdate(int newScore)
This method must be specified in the child class, and should control the layout based on the input parameter. |
protected void |
onResume()
Works as intended, but acquires the wake lock. |
protected void |
prepareQualityMonitor()
Prepares the quality monitor by locking the screen, starting calibration and showing the calibration dialog. |
void |
resetCalibration()
Cancels calibration and resets layout to calibration-layout. |
private void |
setUpCalibrationLayout()
Sets up the calibration preface. |
protected abstract void |
setUpLayout()
This method must be specified in the child class, and should work the same way as the method onCreate() in a normal activity. |
private void |
setUpNotificationIcon()
Sets up the notification icon in the status bar. |
private void |
startQualityMonitoring()
Starts all the processes involving the quality monitoring. |
private void |
stopQualityMonitoring()
Stops all the processes involving the quality monitoring. |
Methods inherited from class android.app.Activity |
---|
addContentView, closeContextMenu, closeOptionsMenu, createPendingResult, dismissDialog, dispatchKeyEvent, dispatchPopulateAccessibilityEvent, dispatchTouchEvent, dispatchTrackballEvent, findViewById, finish, finishActivity, finishActivityFromChild, finishFromChild, getApplication, getCallingActivity, getCallingPackage, getChangingConfigurations, getComponentName, getCurrentFocus, getInstanceCount, getIntent, getLastNonConfigurationInstance, getLayoutInflater, getLocalClassName, getMenuInflater, getParent, getPreferences, getRequestedOrientation, getSystemService, getTaskId, getTitle, getTitleColor, getVolumeControlStream, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, getWindow, getWindowManager, hasWindowFocus, isChild, isFinishing, isTaskRoot, managedQuery, moveTaskToBack, onActivityResult, onApplyThemeResource, onAttachedToWindow, onChildTitleChanged, onConfigurationChanged, onContentChanged, onContextItemSelected, onContextMenuClosed, onCreateContextMenu, onCreateDescription, onCreateDialog, onCreatePanelMenu, onCreatePanelView, onCreateThumbnail, onCreateView, onDestroy, onDetachedFromWindow, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyUp, onLowMemory, onMenuItemSelected, onMenuOpened, onNewIntent, onOptionsMenuClosed, onPanelClosed, onPostCreate, onPostResume, onPrepareDialog, onPrepareDialog, onPrepareOptionsMenu, onPreparePanel, onRestart, onRestoreInstanceState, onRetainNonConfigurationInstance, onSaveInstanceState, onSearchRequested, onStart, onStop, onTitleChanged, onTouchEvent, onTrackballEvent, onUserInteraction, onUserLeaveHint, onWindowAttributesChanged, onWindowFocusChanged, openContextMenu, openOptionsMenu, overridePendingTransition, registerForContextMenu, removeDialog, requestWindowFeature, runOnUiThread, setContentView, setContentView, setContentView, setDefaultKeyMode, setFeatureDrawable, setFeatureDrawableAlpha, setFeatureDrawableResource, setFeatureDrawableUri, setIntent, setPersistent, setProgress, setProgressBarIndeterminate, setProgressBarIndeterminateVisibility, setProgressBarVisibility, setRequestedOrientation, setResult, setResult, setSecondaryProgress, setTitle, setTitle, setTitleColor, setVisible, setVolumeControlStream, showDialog, showDialog, startActivity, startActivityForResult, startActivityFromChild, startActivityIfNeeded, startIntentSender, startIntentSenderForResult, startIntentSenderFromChild, startManagingCursor, startNextMatchingActivity, startSearch, stopManagingCursor, takeKeyEvents, triggerSearch, unregisterForContextMenu |
Methods inherited from class android.view.ContextThemeWrapper |
---|
attachBaseContext, getTheme, setTheme |
Methods inherited from class android.content.ContextWrapper |
---|
bindService, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingPermission, checkCallingUriPermission, checkPermission, checkUriPermission, checkUriPermission, clearWallpaper, createPackageContext, databaseList, deleteDatabase, deleteFile, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, enforceUriPermission, fileList, getApplicationContext, getApplicationInfo, getAssets, getBaseContext, getCacheDir, getClassLoader, getContentResolver, getDatabasePath, getDir, getExternalCacheDir, getExternalFilesDir, getFilesDir, getFileStreamPath, getMainLooper, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getResources, getSharedPreferences, getWallpaper, grantUriPermission, isRestricted, openFileInput, openFileOutput, openOrCreateDatabase, peekWallpaper, registerReceiver, registerReceiver, removeStickyBroadcast, revokeUriPermission, sendBroadcast, sendBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendStickyBroadcast, sendStickyOrderedBroadcast, setWallpaper, setWallpaper, startInstrumentation, startService, stopService, unbindService, unregisterReceiver |
Methods inherited from class android.content.Context |
---|
getString, getString, getText, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final java.lang.String TAG
private static final int NOTIFICATION_MONITORING
private MonitorController controller
private CalibrationDialog calibrationDialog
private static final int CALIBRATION_DIALOG
private android.os.PowerManager.WakeLock wl
Constructor Detail |
---|
public MonitorActivityTemplate()
Method Detail |
---|
public void onCreate(android.os.Bundle savedInstanceState)
onCreate
in class android.app.Activity
savedInstanceState
- Never used. State is handled/controlled by the MonitorController
.MonitorController
private void setUpCalibrationLayout()
private void lockScreenRotation()
protected void prepareQualityMonitor()
public void resetCalibration()
public void onOffsetCalculationComplete()
onOffsetCalculationComplete
in interface CalibrationListener
public void onCalibrationCompleted()
Calibration
is done calibrating, this method is fired.
onCalibrationCompleted
in interface CalibrationListener
private void startQualityMonitoring()
private void setUpNotificationIcon()
private void stopQualityMonitoring()
public void onBackPressed()
onBackPressed
in class android.app.Activity
protected void onResume()
onResume
in class android.app.Activity
protected void onPause()
onPause
in class android.app.Activity
public android.app.Dialog onCreateDialog(int id)
onCreateDialog
in class android.app.Activity
id
- CalibrationDialog id, see CALIBRATION_DIALOG
.
public boolean onCreateOptionsMenu(android.view.Menu menu)
onCreateOptionsMenu
in class android.app.Activity
menu
- Menu to insert into.
public boolean onOptionsItemSelected(android.view.MenuItem item)
onOptionsItemSelected
in class android.app.Activity
item
- The selected monitor to view.
MonitorFactory.getMonitorActivityIntent(android.content.Context, int)
,
PrimitiveMonitor
,
QualityMeterMonitor
,
MapMonitor
protected abstract void setUpLayout()
onCreate()
in a normal activity.
public abstract void onQualityUpdate(int newScore)
onQualityUpdate
in interface QualityListener
newScore
- The new quality score.Quality
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |