ILifecycle, Contextpublic class Fraction extends AbilityContext implements ILifecycle
A Fraction can be placed in a container (an Ability)
as a part of its UI and cannot be used independently. The lifecycle state of a Fraction
depends on its container. If the container is destroyed, all fractions in it will also be destroyed.
You can use the Fraction to define a variety of layouts to enrich the user
interface of your application.
SystemCapability.Aafwk#ABILITYCONTEXT_IGNORE_SECURITY, CONTEXT_INCLUDE_CODE, CONTEXT_RESOUCE_ONLY, CONTEXT_RESTRICTED, MODE_APPEND, MODE_PRIVATE| 构造器 | 说明 |
|---|---|
Fraction() |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
Component |
getComponent() |
Obtains the component of this
Fraction. |
FractionAbility |
getFractionAbility() |
Obtains the ability for this
Fraction. |
Lifecycle |
getLifecycle() |
|
protected void |
onActive() |
Called when the
Fraction enters the ACTIVE state. |
protected void |
onBackground() |
Called when the
Fraction enters the background. |
protected Component |
onComponentAttached(LayoutScatter scatter,
ComponentContainer container,
Intent intent) |
Called when the component of the
Fraction is attached to a specified container. |
protected void |
onComponentDetach() |
Called when the component of the
Fraction is detached from the container. |
protected void |
onForeground(Intent intent) |
Called when the
Fraction enters the foreground. |
protected void |
onInactive() |
Called when the
Fraction enters the INACTIVE state. |
protected void |
onStart(Intent intent) |
Called when the
Fraction is started. |
protected void |
onStop() |
Called when the
Fraction is stopped. |
attachBaseContext, canRequestPermission, compelVerifyCallerPermission, compelVerifyCallerUriPermission, compelVerifyPermission, compelVerifyPermission, compelVerifyUriPermission, compelVerifyUriPermission, compelVerifyUriPermission, connectAbility, createBundleContext, createParallelTaskDispatcher, createSerialTaskDispatcher, deleteFile, disconnectAbility, displayUnlockMissionMessage, getAbilityInfo, getAbilityManager, getAbilityPackageContext, getApplicationContext, getApplicationInfo, getAppType, getBundleCodePath, getBundleManager, getBundleName, getBundleResourcePath, getCacheDir, getCaller, getCallingAbility, getCallingBundle, getClassloader, getCodeCacheDir, getColor, getColorMode, getContext, getDatabaseDir, getDataDir, getDir, getDisplayOrientation, getDistributedDir, getElementName, getExternalCacheDir, getExternalCacheDirs, getExternalFilesDir, getExternalFilesDirs, getExternalMediaDirs, getFilesDir, getGlobalTaskDispatcher, getHapModuleInfo, getIntArray, getLastStoredDataWhenConfigChanged, getLocalClassName, getMainTaskDispatcher, getNoBackupFilesDir, getPattern, getPreferencesDir, getProcessInfo, getProcessName, getResourceManager, getResourceManager, getString, getString, getStringArray, getTheme, getThemeId, getUITaskDispatcher, init, isCredentialEncryptedStorage, isDeviceEncryptedStorage, isUpdatingConfigurations, lockMission, printDrawnCompleted, requestPermissionsFromUser, restart, setColorMode, setDisplayOrientation, setPattern, setShowOnLockScreen, setTheme, setTransitionAnimation, setWakeUpScreen, startAbilities, startAbility, startAbility, startAbility, stopAbility, switchToCredentialEncryptedStorageContext, switchToDeviceEncryptedStorageContext, terminateAbility, terminateAbility, terminateAbilityResult, unlockMission, verifyCallingOrSelfPermission, verifyCallingPermission, verifyPermission, verifySelfPermissionpublic final Lifecycle getLifecycle()
getLifecycle 在接口中 ILifecycleLifecycle object.protected Component onComponentAttached(LayoutScatter scatter, ComponentContainer container, Intent intent)
Fraction is attached to a specified container.scatter - Indicates the LayoutScatter instance used to
draw a custom component.container - Indicates the ComponentContainer instance to
be attached to the Fraction.intent - Indicates the information carried when the Fraction is attached.protected void onStart(Intent intent)
Fraction is started.intent - Indicates the information carried when the Fraction is started.protected void onActive()
Fraction enters the ACTIVE state. You can perform operations
on a Fraction in this state.protected void onInactive()
Fraction enters the INACTIVE state.protected void onForeground(Intent intent)
Fraction enters the foreground.intent - Indicates the information carried when the Fraction is put in the foreground.protected void onBackground()
Fraction enters the background.protected void onStop()
Fraction is stopped.protected void onComponentDetach()
Fraction is detached from the container.public FractionAbility getFractionAbility()
Fraction.public Component getComponent()
Fraction.Fraction.