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.Operation
- Field Summary- Fields inherited from class com.iizix.prop.PropCnr- EMPTY, EMPTY_CLASSES, EMPTY_CNRS, EXTENDS_FRAMEWORK_ERROR_ID, nameTable- Fields 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_2- Fields inherited from interface com.iizix.device.flash.IFlashlight- DEFAULT_IMPL- Fields inherited from interface com.iizix.prop.IGProp- EQC_ERROR_IGNORE_ALL, EQC_ERROR_IGNORE_REFERENCES, EQC_IGNORE_ARRAY, EQC_IGNORE_VOLATILE_OR_EDITOR, EQC_PRIVATE, EQC_SAVE_FILE, EXT_CONTAINER_EXTENDS, EXT_CONTAINER_EXTENDS_VALID, EXT_EXTENDED, EXT_FINAL, EXT_OVERRIDES, EXT_OVERRIDES_FINAL_ERR, EXT_PRIVATE
- Constructor SummaryConstructors
- Method SummaryModifier and TypeMethodDescription- boolean- addListener- (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 flashlight- switchOn(double).- booleanVerifies if the flashlight has been verified as available by a previous call to- getAsyncState().- 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 to- false.- protected voidCalled when a property is disposed of by delete/remove in a container, or by the dispose method.- void- onRemoteEvent- (RemoteEvent event) Called when a remote property event should be processed by this property.- boolean- removeListener- (IFlashlightListener listener) Removes a listener from the flashlight.- boolean- setIntensity- (double intensity) Gets the current flashlight intensity, initially set to 1.0, but also set at the last flashlight- switchOn(double).- booleanSwitches off the flashlight.- boolean- switchOn- (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, isSibling, 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, virtualize- Methods inherited from class com.iizix.prop.GProp- addPropError, addPropListener, convertPropError, dispose, equals, equals, equalsErrors, equalsObj, equalsPropValue, equalValues, extendsClone, 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, 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, warning- Methods inherited from class java.lang.Object- getClass, hashCode, notify, notifyAll, wait, wait, wait- Methods inherited from interface com.iizix.device.flash.IFlashlight- switchOn- Methods 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, 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, warning- Methods inherited from interface com.iizix.prop.IPropCnr- canRequestFocus, canRequestFocus, couldRequestFocusIfVirtualized, couldRequestFocusIfVirtualized
- Constructor Details- Flashpublic Flash()Creates the flashlight properties without a name.
- FlashCreates the flashlight properties with a name.- Parameters:
- atom- The atom name.
 
 
- Method Details- onPropDisposeprotected 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 class- PropCnr
 
- cloneClones the properties.
- onRemoteEventCalled when a remote property event should be processed by this property.- Specified by:
- onRemoteEventin interface- IGProp<GProp<?>[]>
- Overrides:
- onRemoteEventin class- GProp<GProp<?>[]>
- Parameters:
- event- The remote event.
 
- isSupportedpublic boolean isSupported()Verifies if the flashlight is supported for the client session.- Specified by:
- isSupportedin interface- IFlashlight
- 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.
 
- isIntensitySupportedpublic boolean isIntensitySupported()Checks if the flashlight supports intensity levels.- Specified by:
- isIntensitySupportedin interface- IFlashlight
- Returns:
- trueif intensity is supported, currently only iOS using iiziRun,- falseotherwise.
 
- getClientSessionGets the client session associated with this flashlight instance.- Specified by:
- getClientSessionin interface- IFlashlight
- 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.
 
- addListenerAdds a listener to the flashlight that receives notifications of the flashlight state and return code of operations.- Specified by:
- addListenerin interface- IFlashlight
- Parameters:
- listener- The listener instance for notifications.
- Returns:
- truefor success,- falseif- listeneris already registered.
 
- removeListenerRemoves a listener from the flashlight. When the last listener is removed, the flashlight will automatically be switched off (using- IFlashlight.Operation.SWITCH_OFF, not- IFlashlight.Operation.AUTO_SWITCH_OFF). This is also valid when the client session is disposed of, but then with the operation- IFlashlight.Operation.AUTO_SWITCH_OFF.- Specified by:
- removeListenerin interface- IFlashlight
- Parameters:
- listener- The listener instance for notifications.
- Returns:
- truefor success,- falseif- listeneris not registered.
 
- getAsyncStatepublic 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 interface- IFlashlight
- Returns:
- trueif flashlight will be switched on,- falseif the flashlight is not supported, not available, or client is disposed of.
- See Also:
 
- isAvailablepublic boolean isAvailable()Verifies if the flashlight has been verified as available by a previous call to- getAsyncState().- Specified by:
- isAvailablein interface- IFlashlight
- 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 using- getAsyncState().
 
- isSwitchedOnpublic boolean isSwitchedOn()Gets the flashlight switched on state, initially set to- false.- Specified by:
- isSwitchedOnin interface- IFlashlight
- 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.
 
- getIntensitypublic double getIntensity()Gets the current flashlight intensity, initially set to 1.0, but also set at the last flashlight- switchOn(double).- Specified by:
- getIntensityin interface- IFlashlight
- Returns:
- The intensity with a value range of 0.0 to 1.0, only working for iOS.
 
- setIntensityGets the current flashlight intensity, initially set to 1.0, but also set at the last flashlight- switchOn(double).- Specified by:
- setIntensityin interface- IFlashlight
- Returns:
- trueif changed,- falsefor no change.
- Throws:
- IllegalArgumentException- If the- intensityis not in the range of 0.0 to 1.0.
 
- switchOnSwitches 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 interface- IFlashlight
- Returns:
- trueif the operation is going to issue a later callback using the function registered using- addListener(IFlashlightListener), or- falseif the flashlight is not present or the client session is disposed of.
- Throws:
- IllegalArgumentException- If the- intensityis not in the range of 0.0 to 1.0.
 
- switchOffpublic boolean switchOff()Switches off the flashlight.- Specified by:
- switchOffin interface- IFlashlight
- Returns:
- trueif the operation is going to issue a later callback using the function registered using- addListener(IFlashlightListener), or- falseif the flashlight is not present or the client session is disposed of.