Package com.iizix.prop
Class Flash
- All Implemented Interfaces:
IFlashlight,EventListener,IGProp<GProp<?>[]>,IPropCnr,Cloneable
This Flashlight or torch property is a container that holds information about client devices flashlight availability, state and intensity. The flashlight is only present with the iiziRun Cordova hybrid client. The intensity is currently only working with iOS.
- Author:
- Christopher Mindus
Nested Class Summary
Nested classes/interfaces inherited from interface com.iizix.device.flash.IFlashlight
IFlashlight.OperationField Summary
Fields inherited from class com.iizix.prop.PropCnr
EMPTY, EMPTY_CLASSES, EMPTY_CNRS, EXTENDS_FRAMEWORK_ERROR_IDFields inherited from class com.iizix.prop.GProp
GPDEBUG, PROP_ATTR_STRING_EDITOR_PROP, PROP_ATTR_STRING_ERRORED_NAME, PROP_ATTR_STRING_EXTENDS, PROP_ATTR_STRING_EXTENDS_FINAL, PROP_ATTR_STRING_EXTENDS_PRIVATE, PROP_ATTR_STRING_NULLABLE, PROP_ATTR_STRING_PRIVATE, PROP_ATTR_STRING_PRIVATE_CHANGE_EVENT, PROP_ATTR_STRING_READ_ONLY, PROP_USER_1, PROP_USER_2Fields inherited from interface com.iizix.device.flash.IFlashlight
DEFAULT_IMPLFields inherited from interface com.iizix.prop.IGProp
EQC_ERROR_IGNORE_ALL, EQC_ERROR_IGNORE_REFERENCES, EQC_IGNORE_ARRAY, EQC_IGNORE_VOLATILE_OR_EDITOR, EQC_INCLUDE_PRIVATE, EQC_SAVE_FILE, EXT_CONTAINER_EXTENDS, EXT_CONTAINER_EXTENDS_VALID, EXT_EXTENDED, EXT_FINAL, EXT_OVERRIDES, EXT_OVERRIDES_FINAL_ERR, EXT_PRIVATEConstructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptionbooleanaddListener(IFlashlightListener listener) Adds a listener to the flashlight that receives notifications of the flashlight state and return code of operations.clone()Clones the properties.booleanGets the current availability and state of the flashlight, if successful, it will cause the registered listener(s) to be invoked asynchronously.Gets the client session associated with this flashlight instance.doubleGets the current flashlight intensity, initially set to 1.0, but also set at the last flashlightswitchOn(double).booleanVerifies if the flashlight has been verified as available by a previous call togetAsyncState().booleanChecks if the flashlight supports intensity levels.booleanVerifies if the flashlight is supported for the client session.booleanGets the flashlight switched on state, initially set tofalse.protected voidCalled when a property is disposed of by delete/remove in a container, or by the dispose method.voidonRemoteEvent(RemoteEvent event) Called when a remote property event should be processed by this property.booleanremoveListener(IFlashlightListener listener) Removes a listener from the flashlight.booleansetIntensity(double intensity) Gets the current flashlight intensity, initially set to 1.0, but also set at the last flashlightswitchOn(double).booleanSwitches off the flashlight.booleanswitchOn(double intensity) Switches on the flashlight with the requested intensity, a value between 0.0 (darkest) and 1.0 (brightest).Methods inherited from class com.iizix.prop.PropCnr
__transferChildProps, addPredefinedProps, addProp, addProp, addProp2, addProp2, appendPropValue, canRequestFocus, completeVirtualize, containsProp, containsProp, convertLoadedProp, couldRequestFocusIfVirtualized, createCopyOfAtom, createUniqueAtom, createUniqueAtom, createUniqueAtom, createVSReference, doPropEqualsArrayValues, enablePropCommunication, enablePropHashMap, equalsTree, equalsTree, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getBool, getBool, getBool, getBool, getChildPropError, getChildPropError, getChildPropErrorSeverity, getChildPropErrorSeverity, getErrorsProp, getExtendsContainer, getExtendsError, getExtendsName, getExtendsOverride, getExtendsPossibleClasses, getFirstProp, getFirstProp, getFocusEngine, getInt, getInt, getInt, getInt, getLong, getLong, getLong, getLong, getNumber, getNumber, getNumber, getNumber, getPossibleChildren, getPredefinedProps, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getPropBaseReference, getPropCnr, getPropCount, getPropCount, getPropIndex, getPropIndex, getPropIndexes, getProps, getProps, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue0, getRetargetedVerifyContainer, getString, getString, getString, getString, getValueClasses, getVSReference, hasFocus, hasSendData, initializeElement, initializeExtendsFramework, initializeProp, initializeValue, initPropCnr, insertProp, insertProp2, isChild, isExtendsOverriden, isExtendsPropertyValid, isExtendsRoot, isPropAddRemoveAllowed, isPropCommunicating, isPropExtended, list, list, logPropNotFound, maybeAddProp, onInsertProp, onPropRemoved, onPropTreeInitialized, onReferenceEvent, onVirtualContainerCreated, onVirtualizationCompleted, paramString, prepare, removeAllProps, removeAllProps2, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, reorderProps, replaceProps, requestFocus, requestFocus, requestFocusEx, requestFocusEx, resolveReferences, resolveRuntimeReferences, setBool, setBool, setBool, setBool, setCreateRequiredProp, setExtendsName, setExtendsOverride, setInt, setInt, setInt, setLong, setLong, setLong, setLong, setNumber, setNumber, setNumber, setNumber, setProp, setProp, setProp, setProp2, setProp2, setPropValue, setPropValue, setPropValue, setPropValue, setPropValue, setPropValue, setString, setString, setString, setString, shouldCreateProps, shouldSerializeToXML, toElementString, toNativeValue0, usePropHashMap, usesPropIndex, validateChildPropInValue, validateClassInstances, validatePropType, validatePropValue, verify, verifyInternalUseOnly, verifyTree, virtualizeMethods inherited from class com.iizix.prop.GProp
addPropError, addPropListener, appendProp, convertPropError, dispose, equals, equals, equalsErrors, equalsObj, equalsPropValue, equalValues, finalize, fine, fine, finer, finer, finest, finest, fromElementString, getAliasName, getAppSessionGyro, getAppWorker, getAtomPath, getAttribute, getChildReferencePropName, getClientSessionGyro, getClientWorker, getConstraints, getEnvironment, getErroredPropItems, getErroredProps, getErrorsProp, getExtendsRootContainer, getFullPropName, getFullPropName, getFullPropNameDebug, getFullPropNameDebug, getListeners, getModuleFolder, getModuleFolder, getParent, getParent, getProjectName, getPropAtom, getPropError, getPropError, getPropErroredName, getPropErrorSeverity, getPropExtendsFlags, getPropFromPath, getPropFromPath, getPropFromReference, getPropFromReference, getPropIndex, getPropName, getPropPath, getPropPath, getPropReferenceTarget, getPropRootPropMgr, getPropTreeErrorSeverity, getPropValue, getPropValue, getPropValueObject, getReferencePropName, getReferencePropNameNoAssert, getRelativePropName, getRootFromName, getRootName, getRootParent, getRootParentNoAssert, getTreeLock, hasChanged, hasCircularReferencesError, hasPrivateChangeEventProp, hasPropError, hasPropTreeError, info, info, initializeGElement, initializeGProp, isDisposed, isPropChildOf, isPropClientCreated, isPropCreateRequired, isPropExtended, isPropExtendsFinal, isPropExtendsPrivate, isPropExtendsPrivateInRoot, isPropExtendsPrivateInRoot, isPropFile, isPropFolder, isPropForEditor, isPropNullable, isPropPrivate, isPropPrivateAtCreation, isPropReadOnly, isPropReferenceTreeValid, isPropRoot, isPropRootLoading, isPropRootTreeModificationsAllowed, isPropUSER, isPropValueTreeLockNeeded, isPropVirtualized, isPropVirtualizing, isPropVolatile, isPropVolatileOrEditorOnly, isProxied, isSibling, list, list, list, mapAliasToReference, mapAliasToReference, mapReferenceToAlias, mapReferenceToAlias, mapReferenceToProjectRelative, modifyPropValue, moveProp, moveProp, moveProp, onEvent, onEventSelf, onPrepare, onPropInvalidateCache, onPropParentChanged, onPropValueSet, paramString, paramValue, post, post, removePropError, removePropListener, removePropUSER, renameProp, renameProp2, resetChangedTree, setChanged, setConstraints, setConstraints, setParent, setPrivateChangeEventProp, setPrivateCreateRequiredProp, setPropError, setPropErroredName, setPropExtended, setPropExtendsFinal, setPropExtendsPrivate, setPropForEditor, setPropNullable, setPropPrivate, setPropReadOnly, setPropUSER, setPropValue, setPropValue, setPropValue, setPropValueIncognito, setPropVolatile, severe, severe, severe, shouldSerializeToXML, throwIfReadOnly, toNativeValue, toString, toString, triggerRemoteEvent, triggerRemoteEvent, validateProp, warning, warning, warningMethods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.iizix.device.flash.IFlashlight
switchOnMethods inherited from interface com.iizix.prop.IGProp
addPropError, addPropListener, dispose, equals, fine, fine, finer, finer, finest, finest, fromElementString, getAppSessionGyro, getAtomPath, getClientSessionGyro, getConstraints, getEnvironment, getErroredPropItems, getErroredProps, getErrorsProp, getExtendsRootContainer, getFullPropName, getFullPropNameDebug, getModuleFolder, getModuleFolder, getParent, getParent, getPropAtom, getPropError, getPropError, getPropErrorSeverity, getPropExtendsFlags, getPropFromPath, getPropFromReference, getPropIndex, getPropName, getPropPath, getPropPath, getPropRootPropMgr, getPropTreeErrorSeverity, getPropValue, getPropValue, getReferencePropName, getRelativePropName, getRootParent, getTreeLock, hasChanged, hasCircularReferencesError, hasPrivateChangeEventProp, hasPropError, hasPropTreeError, info, info, initializeGElement, initializeGProp, isDisposed, isPropChildOf, isPropClientCreated, isPropCreateRequired, isPropExtended, isPropExtendsFinal, isPropExtendsPrivate, isPropExtendsPrivateInRoot, isPropExtendsPrivateInRoot, isPropFile, isPropFolder, isPropNullable, isPropPrivate, isPropReadOnly, isPropReferenceTreeValid, isPropRoot, isPropVirtualized, isSibling, list, list, list, mapAliasToReference, mapReferenceToAlias, mapReferenceToProjectRelative, moveProp, moveProp, moveProp, onEvent, onEventSelf, removePropError, removePropListener, renameProp, setChanged, setConstraints, setConstraints, setParent, setPrivateChangeEventProp, setPropError, setPropExtendsFinal, setPropExtendsPrivate, setPropNullable, setPropPrivate, setPropReadOnly, setPropValue, setPropValue, severe, severe, severe, toNativeValue, triggerRemoteEvent, triggerRemoteEvent, validateProp, warning, warning, warningMethods inherited from interface com.iizix.prop.IPropCnr
canRequestFocus, canRequestFocus, couldRequestFocusIfVirtualized, couldRequestFocusIfVirtualized
Constructor Details
Flash
public Flash()Creates the flashlight properties without a name.Flash
Creates the flashlight properties with a name.- Parameters:
atom- The atom name.
Method Details
onPropDispose
protected void onPropDispose()Called when a property is disposed of by delete/remove in a container, or by the dispose method.The Property Container clears the structure of unsent communication requests to clear memory.
This call is done just at the end of the delete/remove routine in the container, without synchronization.
During this call, whatever components that e.g. the client needs to disposed of is done.
Subclasses needing to perform some intelligent operations upon deletion should do it by overloading this method and always call the
super.onPropDispose()method.- Overrides:
onPropDisposein classPropCnr
clone
Clones the properties.onRemoteEvent
Called when a remote property event should be processed by this property.- Specified by:
onRemoteEventin interfaceIGProp<GProp<?>[]>- Overrides:
onRemoteEventin classGProp<GProp<?>[]>- Parameters:
event- The remote event.
isSupported
public boolean isSupported()Verifies if the flashlight is supported for the client session.- Specified by:
isSupportedin interfaceIFlashlight- Returns:
- The flashlight support flag. If
trueit only means that the flashlight could potentially be controlled programmatically, not that the user has allowed or enabled access to it.
isIntensitySupported
public boolean isIntensitySupported()Checks if the flashlight supports intensity levels.- Specified by:
isIntensitySupportedin interfaceIFlashlight- Returns:
trueif intensity is supported, currently only iOS using iiziRun,falseotherwise.
getClientSession
Gets the client session associated with this flashlight instance.- Specified by:
getClientSessionin interfaceIFlashlight- Returns:
- The client session, or
nullif it is disposed of already. Please note that the client session might be returned as non-null but that it is currently in dispose operation.
addListener
Adds a listener to the flashlight that receives notifications of the flashlight state and return code of operations.- Specified by:
addListenerin interfaceIFlashlight- Parameters:
listener- The listener instance for notifications.- Returns:
truefor success,falseiflisteneris already registered.
removeListener
Removes a listener from the flashlight. When the last listener is removed, the flashlight will automatically be switched off (usingIFlashlight.Operation.SWITCH_OFF, notIFlashlight.Operation.AUTO_SWITCH_OFF). This is also valid when the client session is disposed of, but then with the operationIFlashlight.Operation.AUTO_SWITCH_OFF.- Specified by:
removeListenerin interfaceIFlashlight- Parameters:
listener- The listener instance for notifications.- Returns:
truefor success,falseiflisteneris not registered.
getAsyncState
public boolean getAsyncState()Gets the current availability and state of the flashlight, if successful, it will cause the registered listener(s) to be invoked asynchronously. The first time this method is invoked for a client session and the iiziRun instance, the user may be asked to allow programmatic operational control of the flashlight. Please note that the flashlight is generally "connected" to the camera, so some devices may use the front camera rather than the back. The user might also be asked to allow camera operational control (instead of just the flashlight).- Specified by:
getAsyncStatein interfaceIFlashlight- Returns:
trueif flashlight will be switched on,falseif the flashlight is not supported, not available, or client is disposed of.- See Also:
isAvailable
public boolean isAvailable()Verifies if the flashlight has been verified as available by a previous call togetAsyncState().- Specified by:
isAvailablein interfaceIFlashlight- Returns:
trueif the flashlight has been made available for programmatic use,falseif such a request has been denied by the user or not requested before usinggetAsyncState().
isSwitchedOn
public boolean isSwitchedOn()Gets the flashlight switched on state, initially set tofalse.- Specified by:
isSwitchedOnin interfaceIFlashlight- Returns:
- The flashlight switched on state. Please note that this value may not be accurate if
getAsyncState()not yet has invoked its listeners, or thatgetAsyncState()not has been called.
getIntensity
public double getIntensity()Gets the current flashlight intensity, initially set to 1.0, but also set at the last flashlightswitchOn(double).- Specified by:
getIntensityin interfaceIFlashlight- Returns:
- The intensity with a value range of 0.0 to 1.0, only working for iOS.
setIntensity
Gets the current flashlight intensity, initially set to 1.0, but also set at the last flashlightswitchOn(double).- Specified by:
setIntensityin interfaceIFlashlight- Returns:
trueif changed,falsefor no change.- Throws:
IllegalArgumentException- If theintensityis not in the range of 0.0 to 1.0.
switchOn
Switches on the flashlight with the requested intensity, a value between 0.0 (darkest) and 1.0 (brightest). The value is only processed for iOS.- Specified by:
switchOnin interfaceIFlashlight- Returns:
trueif the operation is going to issue a later callback using the function registered usingaddListener(IFlashlightListener), orfalseif the flashlight is not present or the client session is disposed of.- Throws:
IllegalArgumentException- If theintensityis not in the range of 0.0 to 1.0.
switchOff
public boolean switchOff()Switches off the flashlight.- Specified by:
switchOffin interfaceIFlashlight- Returns:
trueif the operation is going to issue a later callback using the function registered usingaddListener(IFlashlightListener), orfalseif the flashlight is not present or the client session is disposed of.