@quicktvui/ai 1.0.6 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/rules/.clinerules +28 -4
- package/rules/.cursorrules +28 -4
- package/rules/.github/copilot-instructions.md +28 -4
- package/rules/.source/ESADPlayer/package.json +24 -0
- package/rules/.source/ESADPlayer/rollup.config.js +33 -0
- package/rules/.source/ESADPlayer/src/component/ESADPlayerViewComponent.ts +466 -0
- package/rules/.source/ESADPlayer/src/core/ESADType.ts +6 -0
- package/rules/.source/ESADPlayer/src/index.ts +18 -0
- package/rules/.source/ESADPlayer/src/index.vue +963 -0
- package/rules/.source/ESADPlayer/src/typings/shims-vue.d.ts +6 -0
- package/rules/.source/ESADPlayer/tsconfig.json +34 -0
- package/rules/.source/ESAudioPlayer/package.json +23 -0
- package/rules/.source/ESAudioPlayer/rollup.config.js +33 -0
- package/rules/.source/ESAudioPlayer/src/index.ts +10 -0
- package/rules/.source/ESAudioPlayer/src/index.vue +1441 -0
- package/rules/.source/ESAudioPlayer/src/module/ESAudioPlayer.ts +169 -0
- package/rules/.source/ESAudioPlayer/src/module/ESAudioPlayerModule.android.ts +134 -0
- package/rules/.source/ESAudioPlayer/src/module/ESAudioPlayerModule.harmony.ts +139 -0
- package/rules/.source/ESAudioPlayer/src/module/ESAudioPlayerModule.ts +44 -0
- package/rules/.source/ESAudioPlayer/src/typings/shims-vue.d.ts +6 -0
- package/rules/.source/ESAudioPlayer/src/utils/ESAudioPlayerDefinitionUtils.ts +36 -0
- package/rules/.source/ESAudioPlayer/tsconfig.json +34 -0
- package/rules/.source/ESAudioServicePlayer/package.json +23 -0
- package/rules/.source/ESAudioServicePlayer/rollup.config.js +33 -0
- package/rules/.source/ESAudioServicePlayer/src/index.ts +10 -0
- package/rules/.source/ESAudioServicePlayer/src/index.vue +1400 -0
- package/rules/.source/ESAudioServicePlayer/src/module/ESAudioServicePlayer.ts +189 -0
- package/rules/.source/ESAudioServicePlayer/src/module/ESAudioServicePlayerModule.android.ts +155 -0
- package/rules/.source/ESAudioServicePlayer/src/module/ESAudioServicePlayerModule.harmony.ts +163 -0
- package/rules/.source/ESAudioServicePlayer/src/module/ESAudioServicePlayerModule.ts +50 -0
- package/rules/.source/ESAudioServicePlayer/src/typings/shims-vue.d.ts +6 -0
- package/rules/.source/ESAudioServicePlayer/src/utils/ESAudioServicePlayerDefinitionUtils.ts +36 -0
- package/rules/.source/ESAudioServicePlayer/tsconfig.json +34 -0
- package/rules/.source/ESAxios/CHANGELOG.md +1072 -0
- package/rules/.source/ESAxios/LICENSE +7 -0
- package/rules/.source/ESAxios/MIGRATION_GUIDE.md +3 -0
- package/rules/.source/ESAxios/README.md +1673 -0
- package/rules/.source/ESAxios/index.d.cts +549 -0
- package/rules/.source/ESAxios/index.d.ts +766 -0
- package/rules/.source/ESAxios/index.js +43 -0
- package/rules/.source/ESAxios/lib/adapters/README.md +37 -0
- package/rules/.source/ESAxios/lib/adapters/adapters.js +80 -0
- package/rules/.source/ESAxios/lib/adapters/fetch.js +295 -0
- package/rules/.source/ESAxios/lib/axios.js +90 -0
- package/rules/.source/ESAxios/lib/cancel/CancelToken.js +135 -0
- package/rules/.source/ESAxios/lib/cancel/CanceledError.js +31 -0
- package/rules/.source/ESAxios/lib/cancel/isCancel.js +5 -0
- package/rules/.source/ESAxios/lib/core/Axios.js +292 -0
- package/rules/.source/ESAxios/lib/core/AxiosError.js +108 -0
- package/rules/.source/ESAxios/lib/core/AxiosHeaders.js +340 -0
- package/rules/.source/ESAxios/lib/core/InterceptorManager.js +71 -0
- package/rules/.source/ESAxios/lib/core/README.md +8 -0
- package/rules/.source/ESAxios/lib/core/buildFullPath.js +26 -0
- package/rules/.source/ESAxios/lib/core/dispatchRequest.js +81 -0
- package/rules/.source/ESAxios/lib/core/mergeConfig.js +112 -0
- package/rules/.source/ESAxios/lib/core/settle.js +31 -0
- package/rules/.source/ESAxios/lib/core/transformData.js +33 -0
- package/rules/.source/ESAxios/lib/defaults/index.js +182 -0
- package/rules/.source/ESAxios/lib/defaults/transitional.js +7 -0
- package/rules/.source/ESAxios/lib/env/README.md +3 -0
- package/rules/.source/ESAxios/lib/env/classes/FormData.js +2 -0
- package/rules/.source/ESAxios/lib/env/data.js +1 -0
- package/rules/.source/ESAxios/lib/helpers/AxiosTransformStream.js +160 -0
- package/rules/.source/ESAxios/lib/helpers/AxiosURLSearchParams.js +65 -0
- package/rules/.source/ESAxios/lib/helpers/HttpStatusCode.js +71 -0
- package/rules/.source/ESAxios/lib/helpers/README.md +7 -0
- package/rules/.source/ESAxios/lib/helpers/ZlibHeaderTransformStream.js +29 -0
- package/rules/.source/ESAxios/lib/helpers/bind.js +7 -0
- package/rules/.source/ESAxios/lib/helpers/buildURL.js +69 -0
- package/rules/.source/ESAxios/lib/helpers/callbackify.js +18 -0
- package/rules/.source/ESAxios/lib/helpers/combineURLs.js +15 -0
- package/rules/.source/ESAxios/lib/helpers/composeSignals.js +61 -0
- package/rules/.source/ESAxios/lib/helpers/cookies.js +40 -0
- package/rules/.source/ESAxios/lib/helpers/deprecatedMethod.js +31 -0
- package/rules/.source/ESAxios/lib/helpers/formDataToJSON.js +95 -0
- package/rules/.source/ESAxios/lib/helpers/formDataToStream.js +122 -0
- package/rules/.source/ESAxios/lib/helpers/fromDataURI.js +62 -0
- package/rules/.source/ESAxios/lib/helpers/isAbsoluteURL.js +15 -0
- package/rules/.source/ESAxios/lib/helpers/isAxiosError.js +14 -0
- package/rules/.source/ESAxios/lib/helpers/isURLSameOrigin.js +17 -0
- package/rules/.source/ESAxios/lib/helpers/null.js +2 -0
- package/rules/.source/ESAxios/lib/helpers/parseHeaders.js +69 -0
- package/rules/.source/ESAxios/lib/helpers/parseProtocol.js +6 -0
- package/rules/.source/ESAxios/lib/helpers/progressEventReducer.js +51 -0
- package/rules/.source/ESAxios/lib/helpers/readBlob.js +15 -0
- package/rules/.source/ESAxios/lib/helpers/resolveConfig.js +83 -0
- package/rules/.source/ESAxios/lib/helpers/speedometer.js +55 -0
- package/rules/.source/ESAxios/lib/helpers/spread.js +28 -0
- package/rules/.source/ESAxios/lib/helpers/throttle.js +44 -0
- package/rules/.source/ESAxios/lib/helpers/toFormData.js +241 -0
- package/rules/.source/ESAxios/lib/helpers/toURLEncodedForm.js +25 -0
- package/rules/.source/ESAxios/lib/helpers/trackStream.js +89 -0
- package/rules/.source/ESAxios/lib/helpers/validator.js +120 -0
- package/rules/.source/ESAxios/lib/platform/browser/classes/Blob.js +3 -0
- package/rules/.source/ESAxios/lib/platform/browser/classes/FormData.js +3 -0
- package/rules/.source/ESAxios/lib/platform/browser/classes/URLSearchParams.js +6 -0
- package/rules/.source/ESAxios/lib/platform/browser/index.js +13 -0
- package/rules/.source/ESAxios/lib/platform/common/classes/FormData.js +142 -0
- package/rules/.source/ESAxios/lib/platform/common/index.js +7 -0
- package/rules/.source/ESAxios/lib/platform/common/utils.js +54 -0
- package/rules/.source/ESAxios/lib/platform/index.js +7 -0
- package/rules/.source/ESAxios/lib/platform/node/classes/FormData.js +3 -0
- package/rules/.source/ESAxios/lib/platform/node/classes/URLSearchParams.js +4 -0
- package/rules/.source/ESAxios/lib/platform/node/index.js +12 -0
- package/rules/.source/ESAxios/lib/utils.js +820 -0
- package/rules/.source/ESCore/CHANGELOG.md +7 -0
- package/rules/.source/ESCore/package.json +24 -0
- package/rules/.source/ESCore/rollup.config.js +28 -0
- package/rules/.source/ESCore/src/actionbar/ESActionBar.ts +48 -0
- package/rules/.source/ESCore/src/actionbar/ESActionBarModule.android.ts +29 -0
- package/rules/.source/ESCore/src/actionbar/ESActionBarModule.harmony.ts +31 -0
- package/rules/.source/ESCore/src/actionbar/ESActionBarModule.ts +9 -0
- package/rules/.source/ESCore/src/actionbar/index.ts +2 -0
- package/rules/.source/ESCore/src/app/ESAppInfo.ts +12 -0
- package/rules/.source/ESCore/src/app/ESAppInfoList.ts +9 -0
- package/rules/.source/ESCore/src/app/ESAppList.ts +64 -0
- package/rules/.source/ESCore/src/app/ESAppListModule.android.ts +55 -0
- package/rules/.source/ESCore/src/app/ESAppListModule.harmony.ts +57 -0
- package/rules/.source/ESCore/src/app/ESAppListModule.ts +15 -0
- package/rules/.source/ESCore/src/app/index.ts +4 -0
- package/rules/.source/ESCore/src/application/ESAppContext.ts +99 -0
- package/rules/.source/ESCore/src/application/ESAppKeyManager.android.ts +86 -0
- package/rules/.source/ESCore/src/application/ESAppKeyManager.harmony.ts +91 -0
- package/rules/.source/ESCore/src/application/ESAppKeyManager.ts +23 -0
- package/rules/.source/ESCore/src/application/ESAppLifecycleManager.android.ts +199 -0
- package/rules/.source/ESCore/src/application/ESAppLifecycleManager.harmony.ts +197 -0
- package/rules/.source/ESCore/src/application/ESAppLifecycleManager.ts +36 -0
- package/rules/.source/ESCore/src/application/ESAppModuleManager.ts +294 -0
- package/rules/.source/ESCore/src/application/ESAppParams.ts +14 -0
- package/rules/.source/ESCore/src/application/ESApplication.ts +169 -0
- package/rules/.source/ESCore/src/application/index.ts +38 -0
- package/rules/.source/ESCore/src/audio/ESAudio.ts +190 -0
- package/rules/.source/ESCore/src/audio/ESAudioContentType.ts +7 -0
- package/rules/.source/ESCore/src/audio/ESAudioDirection.ts +5 -0
- package/rules/.source/ESCore/src/audio/ESAudioDurationHint.ts +7 -0
- package/rules/.source/ESCore/src/audio/ESAudioManagerFlag.ts +14 -0
- package/rules/.source/ESCore/src/audio/ESAudioModule.android.ts +173 -0
- package/rules/.source/ESCore/src/audio/ESAudioModule.harmony.ts +152 -0
- package/rules/.source/ESCore/src/audio/ESAudioModule.ts +63 -0
- package/rules/.source/ESCore/src/audio/ESAudioStreamType.ts +15 -0
- package/rules/.source/ESCore/src/audio/ESAudioUsage.ts +20 -0
- package/rules/.source/ESCore/src/audio/index.ts +9 -0
- package/rules/.source/ESCore/src/brightness/ESBrightness.ts +69 -0
- package/rules/.source/ESCore/src/brightness/ESBrightnessModule.android.ts +73 -0
- package/rules/.source/ESCore/src/brightness/ESBrightnessModule.harmony.ts +59 -0
- package/rules/.source/ESCore/src/brightness/ESBrightnessModule.ts +15 -0
- package/rules/.source/ESCore/src/brightness/index.ts +2 -0
- package/rules/.source/ESCore/src/broadcast/ESBroadcast.ts +107 -0
- package/rules/.source/ESCore/src/broadcast/ESBroadcastModule.android.ts +42 -0
- package/rules/.source/ESCore/src/broadcast/ESBroadcastModule.harmony.ts +45 -0
- package/rules/.source/ESCore/src/broadcast/ESBroadcastModule.ts +10 -0
- package/rules/.source/ESCore/src/broadcast/ESBroadcastReceiver.ts +5 -0
- package/rules/.source/ESCore/src/broadcast/ESIntent.ts +6 -0
- package/rules/.source/ESCore/src/broadcast/ESIntentDataAuthority.ts +4 -0
- package/rules/.source/ESCore/src/broadcast/ESIntentDataPath.ts +4 -0
- package/rules/.source/ESCore/src/broadcast/ESIntentDataSchemeSpecificPart.ts +4 -0
- package/rules/.source/ESCore/src/broadcast/ESIntentFilter.ts +13 -0
- package/rules/.source/ESCore/src/broadcast/index.ts +8 -0
- package/rules/.source/ESCore/src/core/IESComponent.ts +1 -0
- package/rules/.source/ESCore/src/core/IESManager.ts +7 -0
- package/rules/.source/ESCore/src/core/IESModule.ts +13 -0
- package/rules/.source/ESCore/src/core/NeedToTyped.ts +1 -0
- package/rules/.source/ESCore/src/core/index.ts +4 -0
- package/rules/.source/ESCore/src/database/ESDatabase.ts +63 -0
- package/rules/.source/ESCore/src/database/ESDatabaseModule.android.ts +49 -0
- package/rules/.source/ESCore/src/database/ESDatabaseModule.harmony.ts +46 -0
- package/rules/.source/ESCore/src/database/ESDatabaseModule.ts +23 -0
- package/rules/.source/ESCore/src/database/index.ts +2 -0
- package/rules/.source/ESCore/src/develop/ESDevelop.ts +75 -0
- package/rules/.source/ESCore/src/develop/ESDevelopInfo.ts +9 -0
- package/rules/.source/ESCore/src/develop/ESDevelopModule.android.ts +50 -0
- package/rules/.source/ESCore/src/develop/ESDevelopModule.harmony.ts +52 -0
- package/rules/.source/ESCore/src/develop/ESDevelopModule.ts +14 -0
- package/rules/.source/ESCore/src/develop/index.ts +3 -0
- package/rules/.source/ESCore/src/device/ESDevice.ts +289 -0
- package/rules/.source/ESCore/src/device/ESDeviceInfo.ts +51 -0
- package/rules/.source/ESCore/src/device/ESDeviceModule.android.ts +143 -0
- package/rules/.source/ESCore/src/device/ESDeviceModule.harmony.ts +116 -0
- package/rules/.source/ESCore/src/device/ESDeviceModule.ts +42 -0
- package/rules/.source/ESCore/src/device/index.ts +3 -0
- package/rules/.source/ESCore/src/display/ESDisplay.ts +61 -0
- package/rules/.source/ESCore/src/display/index.ts +2 -0
- package/rules/.source/ESCore/src/download/ESDownload.ts +181 -0
- package/rules/.source/ESCore/src/download/ESDownloadInfo.ts +14 -0
- package/rules/.source/ESCore/src/download/ESDownloadListener.ts +21 -0
- package/rules/.source/ESCore/src/download/ESDownloadModule.android.ts +57 -0
- package/rules/.source/ESCore/src/download/ESDownloadModule.harmony.ts +66 -0
- package/rules/.source/ESCore/src/download/ESDownloadModule.ts +21 -0
- package/rules/.source/ESCore/src/download/ESDownloadParams.ts +4 -0
- package/rules/.source/ESCore/src/download/ESDownloadState.ts +9 -0
- package/rules/.source/ESCore/src/download/ESDownloadStatus.ts +11 -0
- package/rules/.source/ESCore/src/download/index.ts +7 -0
- package/rules/.source/ESCore/src/error/ESError.ts +88 -0
- package/rules/.source/ESCore/src/error/ESErrorListener.ts +9 -0
- package/rules/.source/ESCore/src/error/ErrorOptions.ts +16 -0
- package/rules/.source/ESCore/src/error/index.ts +2 -0
- package/rules/.source/ESCore/src/es/ES.ts +140 -0
- package/rules/.source/ESCore/src/es/ESModule.android.ts +166 -0
- package/rules/.source/ESCore/src/es/ESModule.harmony.ts +167 -0
- package/rules/.source/ESCore/src/es/ESModule.ts +41 -0
- package/rules/.source/ESCore/src/es/ESSDKInfo.ts +17 -0
- package/rules/.source/ESCore/src/es/ESVersion.ts +14 -0
- package/rules/.source/ESCore/src/es/index.ts +4 -0
- package/rules/.source/ESCore/src/eventbus/ESEventBus.ts +135 -0
- package/rules/.source/ESCore/src/eventbus/ESEventBusArg.ts +2 -0
- package/rules/.source/ESCore/src/eventbus/ESEventBusCallback.ts +4 -0
- package/rules/.source/ESCore/src/eventbus/ESEventBusContext.ts +2 -0
- package/rules/.source/ESCore/src/eventbus/ESEventBusEvent.ts +7 -0
- package/rules/.source/ESCore/src/eventbus/index.ts +6 -0
- package/rules/.source/ESCore/src/file/ESFile.ts +381 -0
- package/rules/.source/ESCore/src/file/ESFileModule.android.ts +334 -0
- package/rules/.source/ESCore/src/file/ESFileModule.harmony.ts +343 -0
- package/rules/.source/ESCore/src/file/ESFileModule.ts +101 -0
- package/rules/.source/ESCore/src/file/ESFileStat.ts +19 -0
- package/rules/.source/ESCore/src/file/index.ts +1 -0
- package/rules/.source/ESCore/src/focus/ESFocus.ts +56 -0
- package/rules/.source/ESCore/src/focus/ESFocusModule.android.ts +35 -0
- package/rules/.source/ESCore/src/focus/ESFocusModule.harmony.ts +35 -0
- package/rules/.source/ESCore/src/focus/ESFocusModule.ts +12 -0
- package/rules/.source/ESCore/src/focus/ESFocusable.ts +1 -0
- package/rules/.source/ESCore/src/focus/index.ts +3 -0
- package/rules/.source/ESCore/src/global.d.ts +37 -0
- package/rules/.source/ESCore/src/hlog/ESHLog.ts +276 -0
- package/rules/.source/ESCore/src/hlog/ESHLogModule.ts +130 -0
- package/rules/.source/ESCore/src/hlog/ESLogListener.ts +959 -0
- package/rules/.source/ESCore/src/hlog/LogPluginHelper.ts +44 -0
- package/rules/.source/ESCore/src/hlog/index.ts +6 -0
- package/rules/.source/ESCore/src/hlog/listener/OnInitListenerBase.ts +24 -0
- package/rules/.source/ESCore/src/hlog/listener/OnUploadListenerBase.ts +39 -0
- package/rules/.source/ESCore/src/hlog/listener/RemoveInitListenerBase.ts +17 -0
- package/rules/.source/ESCore/src/hlog/listener/RemoveOldUploadListenerBase.ts +21 -0
- package/rules/.source/ESCore/src/hlog/listener/RemoveUploadListenerBase.ts +29 -0
- package/rules/.source/ESCore/src/hlog/listener/SetInitListenerBase.ts +25 -0
- package/rules/.source/ESCore/src/hlog/listener/SetOldUploadListenerBase.ts +33 -0
- package/rules/.source/ESCore/src/hlog/listener/SetUploadListenerBase.ts +47 -0
- package/rules/.source/ESCore/src/iac/ESIAC.ts +150 -0
- package/rules/.source/ESCore/src/iac/ESIACMessage.ts +5 -0
- package/rules/.source/ESCore/src/iac/ESIACMessageFilter.ts +3 -0
- package/rules/.source/ESCore/src/iac/ESIACModule.android.ts +40 -0
- package/rules/.source/ESCore/src/iac/ESIACModule.harmony.ts +63 -0
- package/rules/.source/ESCore/src/iac/ESIACModule.ts +15 -0
- package/rules/.source/ESCore/src/iac/ESIACReceiver.ts +5 -0
- package/rules/.source/ESCore/src/iac/index.ts +5 -0
- package/rules/.source/ESCore/src/index.ts +92 -0
- package/rules/.source/ESCore/src/key/ESKeyAction.ts +5 -0
- package/rules/.source/ESCore/src/key/ESKeyCode.ts +15 -0
- package/rules/.source/ESCore/src/key/ESKeyEvent.ts +8 -0
- package/rules/.source/ESCore/src/key/index.ts +3 -0
- package/rules/.source/ESCore/src/kv/ESKV.ts +104 -0
- package/rules/.source/ESCore/src/kv/ESKVModule.android.ts +60 -0
- package/rules/.source/ESCore/src/kv/ESKVModule.harmony.ts +80 -0
- package/rules/.source/ESCore/src/kv/ESKVModule.ts +28 -0
- package/rules/.source/ESCore/src/kv/index.ts +2 -0
- package/rules/.source/ESCore/src/local/ESLocalStorage.ts +114 -0
- package/rules/.source/ESCore/src/local/ESLocalStorageModule.android.ts +150 -0
- package/rules/.source/ESCore/src/local/ESLocalStorageModule.harmony.ts +119 -0
- package/rules/.source/ESCore/src/local/ESLocalStorageModule.ts +23 -0
- package/rules/.source/ESCore/src/local/index.ts +2 -0
- package/rules/.source/ESCore/src/location/ESLocation.ts +89 -0
- package/rules/.source/ESCore/src/location/ESLocationInfo.ts +9 -0
- package/rules/.source/ESCore/src/location/ESLocationListener.ts +5 -0
- package/rules/.source/ESCore/src/location/ESLocationModule.android.ts +53 -0
- package/rules/.source/ESCore/src/location/ESLocationModule.harmony.ts +23 -0
- package/rules/.source/ESCore/src/location/ESLocationModule.ts +8 -0
- package/rules/.source/ESCore/src/location/index.ts +4 -0
- package/rules/.source/ESCore/src/log/ESLog.ts +163 -0
- package/rules/.source/ESCore/src/log/ESLogModule.android.ts +51 -0
- package/rules/.source/ESCore/src/log/ESLogModule.harmony.ts +52 -0
- package/rules/.source/ESCore/src/log/ESLogModule.ts +18 -0
- package/rules/.source/ESCore/src/log/index.ts +3 -0
- package/rules/.source/ESCore/src/network/ESNetwork.ts +102 -0
- package/rules/.source/ESCore/src/network/ESNetworkInfo.ts +20 -0
- package/rules/.source/ESCore/src/network/ESNetworkInfoState.ts +8 -0
- package/rules/.source/ESCore/src/network/ESNetworkInfoType.ts +6 -0
- package/rules/.source/ESCore/src/network/ESNetworkListener.ts +5 -0
- package/rules/.source/ESCore/src/network/ESNetworkModule.android.ts +38 -0
- package/rules/.source/ESCore/src/network/ESNetworkModule.harmony.ts +122 -0
- package/rules/.source/ESCore/src/network/ESNetworkModule.ts +13 -0
- package/rules/.source/ESCore/src/network/ESWifiInfo.ts +6 -0
- package/rules/.source/ESCore/src/network/index.ts +9 -0
- package/rules/.source/ESCore/src/page/ESPageParams.ts +14 -0
- package/rules/.source/ESCore/src/page/index.ts +1 -0
- package/rules/.source/ESCore/src/permission/ESPermission.ts +46 -0
- package/rules/.source/ESCore/src/permission/ESPermissionModule.android.ts +33 -0
- package/rules/.source/ESCore/src/permission/ESPermissionModule.harmony.ts +33 -0
- package/rules/.source/ESCore/src/permission/ESPermissionModule.ts +12 -0
- package/rules/.source/ESCore/src/permission/ESRequestPermissionsResult.ts +6 -0
- package/rules/.source/ESCore/src/permission/index.ts +3 -0
- package/rules/.source/ESCore/src/platform/ESPlatform.ts +63 -0
- package/rules/.source/ESCore/src/platform/index.ts +1 -0
- package/rules/.source/ESCore/src/plugin/ESPlugin.ts +152 -0
- package/rules/.source/ESCore/src/plugin/ESPluginModule.android.ts +20 -0
- package/rules/.source/ESCore/src/plugin/ESPluginModule.harmony.ts +24 -0
- package/rules/.source/ESCore/src/plugin/ESPluginModule.ts +9 -0
- package/rules/.source/ESCore/src/plugin/index.ts +3 -0
- package/rules/.source/ESCore/src/power/ESPower.ts +41 -0
- package/rules/.source/ESCore/src/power/ESPowerModule.android.ts +31 -0
- package/rules/.source/ESCore/src/power/ESPowerModule.harmony.ts +33 -0
- package/rules/.source/ESCore/src/power/ESPowerModule.ts +7 -0
- package/rules/.source/ESCore/src/power/index.ts +2 -0
- package/rules/.source/ESCore/src/provider/ESContentProvider.ts +82 -0
- package/rules/.source/ESCore/src/provider/ESContentProviderInfo.ts +8 -0
- package/rules/.source/ESCore/src/provider/ESContentProviderModule.android.ts +62 -0
- package/rules/.source/ESCore/src/provider/ESContentProviderModule.harmony.ts +62 -0
- package/rules/.source/ESCore/src/provider/ESContentProviderModule.ts +29 -0
- package/rules/.source/ESCore/src/provider/ESContentProviderResult.ts +4 -0
- package/rules/.source/ESCore/src/provider/ESContentValues.ts +3 -0
- package/rules/.source/ESCore/src/provider/index.ts +5 -0
- package/rules/.source/ESCore/src/router/ESData.ts +3 -0
- package/rules/.source/ESCore/src/router/ESParams.ts +3 -0
- package/rules/.source/ESCore/src/router/ESRouter.ts +364 -0
- package/rules/.source/ESCore/src/router/ESRouterKeyManager.android.ts +107 -0
- package/rules/.source/ESCore/src/router/ESRouterKeyManager.harmony.ts +205 -0
- package/rules/.source/ESCore/src/router/ESRouterKeyManager.ts +11 -0
- package/rules/.source/ESCore/src/router/ESRouterLifecycleManager.ts +301 -0
- package/rules/.source/ESCore/src/router/ESRouterManager.ts +221 -0
- package/rules/.source/ESCore/src/router/index.ts +9 -0
- package/rules/.source/ESCore/src/runtime/ESRuntime.ts +164 -0
- package/rules/.source/ESCore/src/runtime/ESRuntimeDeviceModule.android.ts +76 -0
- package/rules/.source/ESCore/src/runtime/ESRuntimeDeviceModule.harmony.ts +39 -0
- package/rules/.source/ESCore/src/runtime/ESRuntimeDeviceModule.ts +14 -0
- package/rules/.source/ESCore/src/runtime/ESRuntimeDeviceType.ts +53 -0
- package/rules/.source/ESCore/src/runtime/index.ts +4 -0
- package/rules/.source/ESCore/src/service/ESService.ts +34 -0
- package/rules/.source/ESCore/src/service/ESServiceModule.android.ts +20 -0
- package/rules/.source/ESCore/src/service/ESServiceModule.harmony.ts +19 -0
- package/rules/.source/ESCore/src/service/ESServiceModule.ts +5 -0
- package/rules/.source/ESCore/src/service/index.ts +2 -0
- package/rules/.source/ESCore/src/share/ESShareData.ts +177 -0
- package/rules/.source/ESCore/src/share/ESShareDataModule.android.ts +370 -0
- package/rules/.source/ESCore/src/share/ESShareDataModule.harmony.ts +201 -0
- package/rules/.source/ESCore/src/share/ESShareDataModule.ts +83 -0
- package/rules/.source/ESCore/src/share/ESSharedData.ts +9 -0
- package/rules/.source/ESCore/src/share/ESSharedDataMode.ts +5 -0
- package/rules/.source/ESCore/src/share/ESSharedDataParams.ts +4 -0
- package/rules/.source/ESCore/src/share/ESSharedDataType.ts +9 -0
- package/rules/.source/ESCore/src/share/index.ts +7 -0
- package/rules/.source/ESCore/src/slot/ESSlot.ts +75 -0
- package/rules/.source/ESCore/src/slot/ESSlotEvent.ts +4 -0
- package/rules/.source/ESCore/src/slot/ESSlotEventName.ts +3 -0
- package/rules/.source/ESCore/src/slot/ESSlotParams.ts +14 -0
- package/rules/.source/ESCore/src/slot/index.ts +3 -0
- package/rules/.source/ESCore/src/theme/ESTheme.ts +88 -0
- package/rules/.source/ESCore/src/theme/ESThemeListener.ts +3 -0
- package/rules/.source/ESCore/src/theme/index.ts +3 -0
- package/rules/.source/ESCore/src/toast/ESToast.ts +47 -0
- package/rules/.source/ESCore/src/toast/ESToastModule.android.ts +30 -0
- package/rules/.source/ESCore/src/toast/ESToastModule.harmony.ts +30 -0
- package/rules/.source/ESCore/src/toast/ESToastModule.ts +9 -0
- package/rules/.source/ESCore/src/toast/index.ts +2 -0
- package/rules/.source/ESCore/src/upload/ESUpload.ts +226 -0
- package/rules/.source/ESCore/src/upload/ESUploadInfo.ts +13 -0
- package/rules/.source/ESCore/src/upload/ESUploadListener.ts +21 -0
- package/rules/.source/ESCore/src/upload/ESUploadModule.android.ts +60 -0
- package/rules/.source/ESCore/src/upload/ESUploadModule.harmony.ts +51 -0
- package/rules/.source/ESCore/src/upload/ESUploadModule.ts +19 -0
- package/rules/.source/ESCore/src/upload/ESUploadState.ts +9 -0
- package/rules/.source/ESCore/src/upload/ESUploadStatus.ts +11 -0
- package/rules/.source/ESCore/src/upload/index.ts +6 -0
- package/rules/.source/ESCore/src/usb/ESUsbDevice.ts +112 -0
- package/rules/.source/ESCore/src/usb/ESUsbDeviceInfo.ts +11 -0
- package/rules/.source/ESCore/src/usb/ESUsbDeviceListener.ts +7 -0
- package/rules/.source/ESCore/src/usb/ESUsbDeviceModule.android.ts +62 -0
- package/rules/.source/ESCore/src/usb/ESUsbDeviceModule.harmony.ts +58 -0
- package/rules/.source/ESCore/src/usb/ESUsbDeviceModule.ts +23 -0
- package/rules/.source/ESCore/src/usb/index.ts +4 -0
- package/rules/.source/ESCore/src/useApi.ts +257 -0
- package/rules/.source/ESCore/src/xlog/ESLogUpload.ts +92 -0
- package/rules/.source/ESCore/src/xlog/ESLogUploadInfo.ts +12 -0
- package/rules/.source/ESCore/src/xlog/ESLogUploadListener.ts +7 -0
- package/rules/.source/ESCore/src/xlog/ESXLog.ts +130 -0
- package/rules/.source/ESCore/src/xlog/ESXLogModule.android.ts +74 -0
- package/rules/.source/ESCore/src/xlog/ESXLogModule.harmony.ts +47 -0
- package/rules/.source/ESCore/src/xlog/ESXLogModule.ts +24 -0
- package/rules/.source/ESCore/src/xlog/index.ts +6 -0
- package/rules/.source/ESCore/tsconfig.json +34 -0
- package/rules/.source/ESPlayer/package.json +24 -0
- package/rules/.source/ESPlayer/rollup.config.js +28 -0
- package/rules/.source/ESPlayer/src/cache/ESPlayerCache.ts +14 -0
- package/rules/.source/ESPlayer/src/cache/ESPlayerCacheManager.ts +39 -0
- package/rules/.source/ESPlayer/src/core/ESIPlayer.ts +179 -0
- package/rules/.source/ESPlayer/src/core/ESIPlayerManager.ts +7 -0
- package/rules/.source/ESPlayer/src/core/ESMediaMetadata.ts +8 -0
- package/rules/.source/ESPlayer/src/core/ESMediaSource.ts +13 -0
- package/rules/.source/ESPlayer/src/core/ESMediaSourceList.ts +15 -0
- package/rules/.source/ESPlayer/src/core/ESPlayer.ts +100 -0
- package/rules/.source/ESPlayer/src/core/ESPlayerBufferPercentCallback.ts +3 -0
- package/rules/.source/ESPlayer/src/core/ESPlayerCDNInfo.ts +5 -0
- package/rules/.source/ESPlayer/src/core/ESPlayerCommand.ts +1 -0
- package/rules/.source/ESPlayer/src/core/ESPlayerComponentInfo.ts +7 -0
- package/rules/.source/ESPlayer/src/core/ESPlayerConfiguration.ts +13 -0
- package/rules/.source/ESPlayer/src/core/ESPlayerControlOptions.ts +8 -0
- package/rules/.source/ESPlayer/src/core/ESPlayerDurationCallback.ts +3 -0
- package/rules/.source/ESPlayer/src/core/ESPlayerMediaMeta.ts +48 -0
- package/rules/.source/ESPlayer/src/core/ESPlayerPosition.ts +5 -0
- package/rules/.source/ESPlayer/src/core/ESPlayerProgressCallback.ts +3 -0
- package/rules/.source/ESPlayer/src/core/ESPlayerState.ts +44 -0
- package/rules/.source/ESPlayer/src/core/ESPlayerStatus.ts +10 -0
- package/rules/.source/ESPlayer/src/core/ESPlayerTrackInfo.ts +36 -0
- package/rules/.source/ESPlayer/src/core/ESPlayerTrackType.ts +5 -0
- package/rules/.source/ESPlayer/src/core/M3U8DefinitionInfo.ts +38 -0
- package/rules/.source/ESPlayer/src/decode/ESPlayerDecode.ts +12 -0
- package/rules/.source/ESPlayer/src/decode/ESPlayerDecodeManager.ts +81 -0
- package/rules/.source/ESPlayer/src/definition/ESPlayerDefinition.ts +21 -0
- package/rules/.source/ESPlayer/src/definition/ESPlayerDefinitionManager.ts +93 -0
- package/rules/.source/ESPlayer/src/definition/ESPlayerDefinitionStrategy.ts +12 -0
- package/rules/.source/ESPlayer/src/device/ESPlayerDevice.ts +4 -0
- package/rules/.source/ESPlayer/src/device/ESPlayerDeviceManager.ts +41 -0
- package/rules/.source/ESPlayer/src/device/ESPlayerDeviceType.ts +53 -0
- package/rules/.source/ESPlayer/src/display/ESPlayerDisplay.ts +4 -0
- package/rules/.source/ESPlayer/src/display/ESPlayerDisplayManager.ts +63 -0
- package/rules/.source/ESPlayer/src/error/ESPlayerError.ts +5 -0
- package/rules/.source/ESPlayer/src/error/ESPlayerErrors.ts +8 -0
- package/rules/.source/ESPlayer/src/event/ESPlayerEventDefaultListener.ts +127 -0
- package/rules/.source/ESPlayer/src/event/ESPlayerEventListener.ts +120 -0
- package/rules/.source/ESPlayer/src/event/ESPlayerEventManager.ts +451 -0
- package/rules/.source/ESPlayer/src/index.ts +166 -0
- package/rules/.source/ESPlayer/src/info/ESPlayerInfo.ts +16 -0
- package/rules/.source/ESPlayer/src/injectionSymbols.ts +84 -0
- package/rules/.source/ESPlayer/src/interceptor/ESIPlayerInterceptor.ts +11 -0
- package/rules/.source/ESPlayer/src/interceptor/ESPlayerInterceptError.ts +8 -0
- package/rules/.source/ESPlayer/src/interceptor/ESPlayerInterceptResult.ts +8 -0
- package/rules/.source/ESPlayer/src/interceptor/ESPlayerInterceptorManager.ts +95 -0
- package/rules/.source/ESPlayer/src/interceptor/ESPlayerInterceptorType.ts +17 -0
- package/rules/.source/ESPlayer/src/log/ESPlayerLog.ts +143 -0
- package/rules/.source/ESPlayer/src/log/ESPlayerLogModule.ts +43 -0
- package/rules/.source/ESPlayer/src/mode/ESPlayerPlayMode.ts +8 -0
- package/rules/.source/ESPlayer/src/mode/ESPlayerPlayModeManager.ts +39 -0
- package/rules/.source/ESPlayer/src/option/ESPlayerOption.ts +11 -0
- package/rules/.source/ESPlayer/src/option/ESPlayerOptionType.ts +14 -0
- package/rules/.source/ESPlayer/src/rate/ESPlayerRate.ts +11 -0
- package/rules/.source/ESPlayer/src/rate/ESPlayerRateManager.ts +39 -0
- package/rules/.source/ESPlayer/src/ratio/ESPlayerAspectRatio.ts +9 -0
- package/rules/.source/ESPlayer/src/ratio/ESPlayerAspectRatioManager.ts +39 -0
- package/rules/.source/ESPlayer/src/render/ESPlayerRender.ts +5 -0
- package/rules/.source/ESPlayer/src/render/ESPlayerRenderManager.ts +36 -0
- package/rules/.source/ESPlayer/src/storage/ESPlayerLocalStorageManager.ts +97 -0
- package/rules/.source/ESPlayer/src/storage/ESPlayerLocalStorageModule.android.ts +111 -0
- package/rules/.source/ESPlayer/src/storage/ESPlayerLocalStorageModule.harmony.ts +111 -0
- package/rules/.source/ESPlayer/src/storage/ESPlayerLocalStorageModule.ts +21 -0
- package/rules/.source/ESPlayer/src/type/ESPlayerType.ts +18 -0
- package/rules/.source/ESPlayer/src/type/ESPlayerTypeManager.ts +81 -0
- package/rules/.source/ESPlayer/src/useApi.ts +108 -0
- package/rules/.source/ESPlayer/src/view/ESIPlayerView.ts +120 -0
- package/rules/.source/ESPlayer/src/view/ESPlayerDefaultView.ts +127 -0
- package/rules/.source/ESPlayer/src/view/ESPlayerViewManager.ts +453 -0
- package/rules/.source/ESPlayer/src/volume/ESPlayerVolume.ts +4 -0
- package/rules/.source/ESPlayer/src/volume/ESPlayerVolumeManager.ts +51 -0
- package/rules/.source/ESPlayer/src/window/ESPlayerWindowType.ts +5 -0
- package/rules/.source/ESPlayer/tsconfig.json +34 -0
- package/rules/.source/ESPlayer/yarn.lock +4 -0
- package/rules/.source/ESPlayerManager/package.json +24 -0
- package/rules/.source/ESPlayerManager/rollup.config.js +33 -0
- package/rules/.source/ESPlayerManager/src/core/ESBuiltinADPlayerType.ts +9 -0
- package/rules/.source/ESPlayerManager/src/core/ESBuiltinPlayerType.ts +8 -0
- package/rules/.source/ESPlayerManager/src/core/ESIPlayerManager.ts +71 -0
- package/rules/.source/ESPlayerManager/src/core/ESMediaItem.ts +47 -0
- package/rules/.source/ESPlayerManager/src/core/ESMediaItemList.ts +11 -0
- package/rules/.source/ESPlayerManager/src/core/ESPlayerManager.ts +41 -0
- package/rules/.source/ESPlayerManager/src/core/ESPlayerManagerConfiguration.ts +6 -0
- package/rules/.source/ESPlayerManager/src/core/ESPlayerManagerErrors.ts +6 -0
- package/rules/.source/ESPlayerManager/src/event/ESPlayerManagerEventDefaultListener.ts +154 -0
- package/rules/.source/ESPlayerManager/src/event/ESPlayerManagerEventListener.ts +37 -0
- package/rules/.source/ESPlayerManager/src/event/ESPlayerManagerEventManager.ts +521 -0
- package/rules/.source/ESPlayerManager/src/index.ts +37 -0
- package/rules/.source/ESPlayerManager/src/index.vue +2676 -0
- package/rules/.source/ESPlayerManager/src/injectionSymbols.ts +16 -0
- package/rules/.source/ESPlayerManager/src/mode/ESPlayerManagerPlayModeManager.ts +27 -0
- package/rules/.source/ESPlayerManager/src/typings/shims-vue.d.ts +6 -0
- package/rules/.source/ESPlayerManager/src/useApi.ts +22 -0
- package/rules/.source/ESPlayerManager/src/utils/SparseArray.ts +103 -0
- package/rules/.source/ESPlayerManager/src/view/ESIPlayerManagerDefaultView.ts +167 -0
- package/rules/.source/ESPlayerManager/src/view/ESIPlayerManagerView.ts +44 -0
- package/rules/.source/ESPlayerManager/src/view/ESPlayerManagerViewManager.ts +517 -0
- package/rules/.source/ESPlayerManager/tsconfig.json +34 -0
- package/rules/.source/ESRouter/CHANGELOGG.md +899 -0
- package/rules/.source/ESRouter/SECURITY.md +20 -0
- package/rules/.source/ESRouter/api-extractor.json +49 -0
- package/rules/.source/ESRouter/index.js +7 -0
- package/rules/.source/ESRouter/nightwatch.conf.js +240 -0
- package/rules/.source/ESRouter/package.json +19 -0
- package/rules/.source/ESRouter/rollup.config.mjs +195 -0
- package/rules/.source/ESRouter/src/RouterLink.ts +358 -0
- package/rules/.source/ESRouter/src/RouterView.ts +794 -0
- package/rules/.source/ESRouter/src/SlotView.ts +477 -0
- package/rules/.source/ESRouter/src/config.ts +6 -0
- package/rules/.source/ESRouter/src/devtools.ts +576 -0
- package/rules/.source/ESRouter/src/encoding.ts +147 -0
- package/rules/.source/ESRouter/src/errors.ts +200 -0
- package/rules/.source/ESRouter/src/es/ESNativeRouter.android.ts +100 -0
- package/rules/.source/ESRouter/src/es/ESNativeRouter.harmony.ts +155 -0
- package/rules/.source/ESRouter/src/es/ESNativeRouter.ts +24 -0
- package/rules/.source/ESRouter/src/es/ESNativeRouterLaunchMode.ts +7 -0
- package/rules/.source/ESRouter/src/es/ESNativeRouterSplash.ts +6 -0
- package/rules/.source/ESRouter/src/global.d.ts +15 -0
- package/rules/.source/ESRouter/src/globalExtensions.ts +83 -0
- package/rules/.source/ESRouter/src/history/common.ts +237 -0
- package/rules/.source/ESRouter/src/history/es.ts +278 -0
- package/rules/.source/ESRouter/src/history/hash.ts +46 -0
- package/rules/.source/ESRouter/src/history/html5.ts +354 -0
- package/rules/.source/ESRouter/src/history/index.ts +40 -0
- package/rules/.source/ESRouter/src/history/memory.ts +127 -0
- package/rules/.source/ESRouter/src/index.ts +131 -0
- package/rules/.source/ESRouter/src/injectionSymbols.ts +91 -0
- package/rules/.source/ESRouter/src/location.ts +251 -0
- package/rules/.source/ESRouter/src/log/RouterLog.ts +90 -0
- package/rules/.source/ESRouter/src/log/info.ts +9 -0
- package/rules/.source/ESRouter/src/matcher/index.ts +533 -0
- package/rules/.source/ESRouter/src/matcher/pathMatcher.ts +55 -0
- package/rules/.source/ESRouter/src/matcher/pathParserRanker.ts +369 -0
- package/rules/.source/ESRouter/src/matcher/pathTokenizer.ts +200 -0
- package/rules/.source/ESRouter/src/matcher/types.ts +131 -0
- package/rules/.source/ESRouter/src/navigationGuards.ts +409 -0
- package/rules/.source/ESRouter/src/page/PageRouteView.ts +11 -0
- package/rules/.source/ESRouter/src/page/PageView.ts +12 -0
- package/rules/.source/ESRouter/src/query.ts +149 -0
- package/rules/.source/ESRouter/src/result/RouteResult.ts +11 -0
- package/rules/.source/ESRouter/src/result/RouteResultCallback.ts +5 -0
- package/rules/.source/ESRouter/src/router.ts +1930 -0
- package/rules/.source/ESRouter/src/scrollBehavior.ts +194 -0
- package/rules/.source/ESRouter/src/slot/SlotRootView.ts +11 -0
- package/rules/.source/ESRouter/src/slot/SlotView.ts +11 -0
- package/rules/.source/ESRouter/src/types/index.ts +605 -0
- package/rules/.source/ESRouter/src/types/typeGuards.ts +9 -0
- package/rules/.source/ESRouter/src/types/utils.ts +77 -0
- package/rules/.source/ESRouter/src/useApi.ts +29 -0
- package/rules/.source/ESRouter/src/utils/callbacks.ts +24 -0
- package/rules/.source/ESRouter/src/utils/env.ts +1 -0
- package/rules/.source/ESRouter/src/utils/index.ts +60 -0
- package/rules/.source/ESRouter/src/warning.ts +9 -0
- package/rules/.source/ESRouter/tsconfig.json +37 -0
- package/rules/.source/ESSoundPoolPlayer/package.json +23 -0
- package/rules/.source/ESSoundPoolPlayer/rollup.config.js +33 -0
- package/rules/.source/ESSoundPoolPlayer/src/core/ESSoundPoolContentType.ts +7 -0
- package/rules/.source/ESSoundPoolPlayer/src/core/ESSoundPoolStreamType.ts +15 -0
- package/rules/.source/ESSoundPoolPlayer/src/core/ESSoundPoolUsage.ts +19 -0
- package/rules/.source/ESSoundPoolPlayer/src/index.ts +19 -0
- package/rules/.source/ESSoundPoolPlayer/src/index.vue +1564 -0
- package/rules/.source/ESSoundPoolPlayer/src/module/ESSoundPoolPlayerModul.android.ts +133 -0
- package/rules/.source/ESSoundPoolPlayer/src/module/ESSoundPoolPlayerModul.harmony.ts +119 -0
- package/rules/.source/ESSoundPoolPlayer/src/module/ESSoundPoolPlayerModule.ts +48 -0
- package/rules/.source/ESSoundPoolPlayer/src/typings/shims-vue.d.ts +6 -0
- package/rules/.source/ESSoundPoolPlayer/tsconfig.json +34 -0
- package/rules/.source/ESVideoPlayer/package.json +26 -0
- package/rules/.source/ESVideoPlayer/rollup.config.js +33 -0
- package/rules/.source/ESVideoPlayer/src/component/ESVideoPlayerViewComponent.android.ts +948 -0
- package/rules/.source/ESVideoPlayer/src/component/ESVideoPlayerViewComponent.harmony.ts +763 -0
- package/rules/.source/ESVideoPlayer/src/index.ts +18 -0
- package/rules/.source/ESVideoPlayer/src/index.vue +2003 -0
- package/rules/.source/ESVideoPlayer/src/typings/shims-vue.d.ts +6 -0
- package/rules/.source/ESVideoPlayer/src/utils/ESVideoPlayerDefinitionUtils.ts +36 -0
- package/rules/.source/ESVideoPlayer/tsconfig.json +34 -0
- package/rules/.source/ESVideoPlayer/tsconfig.json.vite +0 -0
- package/rules/.source/ESVideoPlayer/tsconfig.node.json +0 -0
- package/rules/.source/ESVideoPlayer/vite.config.ts +29 -0
- package/rules/.source/ESVue/CHANGELOG.MD +201 -0
- package/rules/.source/ESVue/api-extractor.json +41 -0
- package/rules/.source/ESVue/package.json +42 -0
- package/rules/.source/ESVue/rollup.config.js +40 -0
- package/rules/.source/ESVue/src/built-in-component.ts +650 -0
- package/rules/.source/ESVue/src/config/index.ts +109 -0
- package/rules/.source/ESVue/src/global.d.ts +636 -0
- package/rules/.source/ESVue/src/hooks/lifecycle.ts +248 -0
- package/rules/.source/ESVue/src/index.ts +365 -0
- package/rules/.source/ESVue/src/modules/attrs.ts +24 -0
- package/rules/.source/ESVue/src/modules/class.ts +31 -0
- package/rules/.source/ESVue/src/modules/events.ts +119 -0
- package/rules/.source/ESVue/src/modules/patch-log.ts +39 -0
- package/rules/.source/ESVue/src/modules/style.ts +68 -0
- package/rules/.source/ESVue/src/node-ops.ts +153 -0
- package/rules/.source/ESVue/src/patch-prop.ts +93 -0
- package/rules/.source/ESVue/src/runtime/component/index.ts +83 -0
- package/rules/.source/ESVue/src/runtime/document/hippy-document.ts +56 -0
- package/rules/.source/ESVue/src/runtime/element/hippy-comment-element.ts +21 -0
- package/rules/.source/ESVue/src/runtime/element/hippy-element.ts +1623 -0
- package/rules/.source/ESVue/src/runtime/element/hippy-input-element.ts +75 -0
- package/rules/.source/ESVue/src/runtime/element/hippy-list-element.ts +306 -0
- package/rules/.source/ESVue/src/runtime/event/event-bus.ts +148 -0
- package/rules/.source/ESVue/src/runtime/event/hippy-event-dispatcher.ts +391 -0
- package/rules/.source/ESVue/src/runtime/event/hippy-event-target.ts +191 -0
- package/rules/.source/ESVue/src/runtime/event/hippy-event.ts +317 -0
- package/rules/.source/ESVue/src/runtime/native/index.ts +924 -0
- package/rules/.source/ESVue/src/runtime/node/hippy-node.ts +722 -0
- package/rules/.source/ESVue/src/runtime/node/node-log.ts +39 -0
- package/rules/.source/ESVue/src/runtime/render/index.ts +550 -0
- package/rules/.source/ESVue/src/runtime/style/css-map.ts +100 -0
- package/rules/.source/ESVue/src/runtime/style/css-resolve-auto-style.ts +119 -0
- package/rules/.source/ESVue/src/runtime/style/css-resolve-percent-style.ts +111 -0
- package/rules/.source/ESVue/src/runtime/style/css-resolve-rem-style.ts +45 -0
- package/rules/.source/ESVue/src/runtime/style/css-resolve-scale-style.ts +103 -0
- package/rules/.source/ESVue/src/runtime/style/css-resolve-style.ts +24 -0
- package/rules/.source/ESVue/src/runtime/style/css-resolve-variables.ts +209 -0
- package/rules/.source/ESVue/src/runtime/style/css-resolve-vwvh-style.ts +65 -0
- package/rules/.source/ESVue/src/runtime/style/css-resolve-width-height-style.ts +18 -0
- package/rules/.source/ESVue/src/runtime/style/css-selectors-match.ts +295 -0
- package/rules/.source/ESVue/src/runtime/style/css-selectors.ts +1173 -0
- package/rules/.source/ESVue/src/runtime/style/index.ts +154 -0
- package/rules/.source/ESVue/src/runtime/style/log.ts +39 -0
- package/rules/.source/ESVue/src/runtime/style/parser.ts +291 -0
- package/rules/.source/ESVue/src/runtime/text/hippy-text.ts +41 -0
- package/rules/.source/ESVue/src/runtime/websocket/websocket.ts +282 -0
- package/rules/.source/ESVue/src/types/index.ts +25 -0
- package/rules/.source/ESVue/src/types/native-modules/clip-board-module.ts +24 -0
- package/rules/.source/ESVue/src/types/native-modules/device-event-module.ts +24 -0
- package/rules/.source/ESVue/src/types/native-modules/http.ts +57 -0
- package/rules/.source/ESVue/src/types/native-modules/image-loader-module.ts +27 -0
- package/rules/.source/ESVue/src/types/native-modules/net-info.ts +29 -0
- package/rules/.source/ESVue/src/types/native-modules/network.ts +24 -0
- package/rules/.source/ESVue/src/types/native-modules/test-module.ts +23 -0
- package/rules/.source/ESVue/src/types/native-modules/ui-manager-module.ts +44 -0
- package/rules/.source/ESVue/src/types/native-modules/websocket.ts +49 -0
- package/rules/.source/ESVue/src/types/native-modules.ts +41 -0
- package/rules/.source/ESVue/src/types/native-node.ts +48 -0
- package/rules/.source/ESVue/src/util/event.ts +74 -0
- package/rules/.source/ESVue/src/util/i18n.ts +32 -0
- package/rules/.source/ESVue/src/util/index.ts +418 -0
- package/rules/.source/ESVue/src/util/instance.ts +77 -0
- package/rules/.source/ESVue/src/util/log.ts +39 -0
- package/rules/.source/ESVue/src/util/node.ts +152 -0
- package/rules/.source/ESVue/src/util/rem.ts +54 -0
- package/rules/.source/ESVue/src/util/screen.ts +42 -0
- package/rules/.source/ESVue/tsconfig.json +34 -0
- package/rules/.source/ESVue/tsdoc.json +6 -0
- package/rules/.source/ESVue/yarn.lock +4 -0
- package/rules/.source/ESVueCssLoader/package.json +27 -0
- package/rules/.source/ESVueCssLoader/rollup.config.js +20 -0
- package/rules/.source/ESVueCssLoader/src/index.ts +2 -0
- package/rules/.source/ESVueCssLoader/src/log/log.ts +38 -0
- package/rules/.source/ESVueCssLoader/src/style-parser/color-parser.ts +357 -0
- package/rules/.source/ESVueCssLoader/src/style-parser/css-loader.ts +93 -0
- package/rules/.source/ESVueCssLoader/src/style-parser/css-parser.ts +1123 -0
- package/rules/.source/ESVueCssLoader/src/types.ts +5 -0
- package/rules/.source/ESVueCssLoader/src/utils/utils.ts +59 -0
- package/rules/.source/ESVueCssLoader/tsconfig.json +34 -0
- package/rules/.source/ESVueStyleParser/api-extractor.json +38 -0
- package/rules/.source/ESVueStyleParser/package.json +24 -0
- package/rules/.source/ESVueStyleParser/rollup.config.js +28 -0
- package/rules/.source/ESVueStyleParser/src/index.ts +24 -0
- package/rules/.source/ESVueStyleParser/src/style-parser/android-color-parser.ts +143 -0
- package/rules/.source/ESVueStyleParser/src/style-parser/color-parser.ts +256 -0
- package/rules/.source/ESVueStyleParser/src/style-parser/css-parser.ts +1371 -0
- package/rules/.source/ESVueStyleParser/src/style-parser/named-colors.ts +154 -0
- package/rules/.source/ESVueStyleParser/src/style-parser/utils.ts +55 -0
- package/rules/.source/ESVueStyleParser/src/types.ts +5 -0
- package/rules/.source/ESVueStyleParser/tsconfig.json +34 -0
- package/rules/.source/component/package.json +24 -0
- package/rules/.source/component/rollup.config.js +28 -0
- package/rules/.source/component/src/ESAnimationView/ESAnimationViewComponent.ts +51 -0
- package/rules/.source/component/src/ESAppIconView/ESAppIconViewComponent.ts +46 -0
- package/rules/.source/component/src/ESAppIconView/ESIAppIcon.ts +5 -0
- package/rules/.source/component/src/ESCardView/ESCardContainerViewComponent.ts +127 -0
- package/rules/.source/component/src/ESCardView/ESCardEvent.ts +3 -0
- package/rules/.source/component/src/ESCardView/ESCardViewComponent.ts +54 -0
- package/rules/.source/component/src/ESCardView/ESICard.ts +9 -0
- package/rules/.source/component/src/ESCardView/ESICardContainer.ts +25 -0
- package/rules/.source/component/src/ESChartView/ESBarChartViewComponent.ts +35 -0
- package/rules/.source/component/src/ESChartView/ESIChart.ts +3 -0
- package/rules/.source/component/src/ESChartView/ESLineChartViewComponent.ts +35 -0
- package/rules/.source/component/src/ESDialog/ESDialogComponent.ts +15 -0
- package/rules/.source/component/src/ESFastSwiperSlideView/ESFastSwiperSlideViewComponent.ts +46 -0
- package/rules/.source/component/src/ESFlexView/ESFlexViewComponent.ts +22 -0
- package/rules/.source/component/src/ESGradient/ESGradient.ts +14 -0
- package/rules/.source/component/src/ESGradient/ESGradientOrientation.ts +10 -0
- package/rules/.source/component/src/ESGradient/ESGradientShape.ts +6 -0
- package/rules/.source/component/src/ESGradient/ESGradientType.ts +5 -0
- package/rules/.source/component/src/ESItem/ESItemComponent.ts +40 -0
- package/rules/.source/component/src/ESItemStoreView/ESItemStoreViewComponent.ts +23 -0
- package/rules/.source/component/src/ESLargeListView/ESLargeListViewComponent.ts +136 -0
- package/rules/.source/component/src/ESLoading/ESLoadingViewComponent.ts +16 -0
- package/rules/.source/component/src/ESLoading/ESLoadingViewElement.android.ts +11 -0
- package/rules/.source/component/src/ESLoading/ESLoadingViewElement.harmony.ts +11 -0
- package/rules/.source/component/src/ESLottieView/ESLottieViewComponent.android.ts +29 -0
- package/rules/.source/component/src/ESLottieView/ESLottieViewComponent.harmony.ts +29 -0
- package/rules/.source/component/src/ESMediaSeries/ESIMediaSeries.ts +24 -0
- package/rules/.source/component/src/ESMediaSeries/ESMediaSeries.ts +6 -0
- package/rules/.source/component/src/ESMediaSeries/ESMediaSeriesComponent.ts +142 -0
- package/rules/.source/component/src/ESOrientationSeekBar/ESHorizontalSeekBarViewComponent.ts +1305 -0
- package/rules/.source/component/src/ESOrientationSeekBar/ESIHorizontalSeekBar.ts +255 -0
- package/rules/.source/component/src/ESOrientationSeekBar/ESIVerticalSeekBar.ts +13 -0
- package/rules/.source/component/src/ESOrientationSeekBar/ESVerticalSeekBarViewComponent.ts +1356 -0
- package/rules/.source/component/src/ESPlayMarkView/ESPlayMarkViewComponent.ts +21 -0
- package/rules/.source/component/src/ESPluginView/ESPluginViewComponent.ts +34 -0
- package/rules/.source/component/src/ESProgressBarView/ESProgressBarViewComponent.ts +38 -0
- package/rules/.source/component/src/ESQRCodeView/ESQRCodeViewComponent.ts +11 -0
- package/rules/.source/component/src/ESReplaceChildView/ESReplaceChildViewComponent.ts +151 -0
- package/rules/.source/component/src/ESRippleView/ESRippleViewComponent.ts +45 -0
- package/rules/.source/component/src/ESScrollView/ESIScrollView.ts +7 -0
- package/rules/.source/component/src/ESScrollView/ESScrollViewComponent.ts +49 -0
- package/rules/.source/component/src/ESSeekBarView/ESSeekBarViewElement.android.ts +38 -0
- package/rules/.source/component/src/ESSeekBarView/ESSeekBarViewElement.harmony.ts +38 -0
- package/rules/.source/component/src/ESSurfaceView/ESSurfaceViewComponent.ts +21 -0
- package/rules/.source/component/src/ESSwiftListView/ESSwiftListViewComponent.ts +117 -0
- package/rules/.source/component/src/ESSwiperSlideView/ESSwiperSlideViewComponent.ts +31 -0
- package/rules/.source/component/src/ESSwiperView/ESSwiperViewComponent.ts +82 -0
- package/rules/.source/component/src/ESTVItemView/ESTVItemViewComponent.ts +185 -0
- package/rules/.source/component/src/ESTVListView/ESIListView.ts +184 -0
- package/rules/.source/component/src/ESTVListView/ESListInitPosition.ts +15 -0
- package/rules/.source/component/src/ESTVListView/ESListViewItem.ts +10 -0
- package/rules/.source/component/src/ESTVListView/ESListViewItemDecoration.ts +7 -0
- package/rules/.source/component/src/ESTVListView/ESListViewItemFunctionParams.ts +7 -0
- package/rules/.source/component/src/ESTVListView/ESTVListViewComponent.ts +697 -0
- package/rules/.source/component/src/ESTabsView/ESITab.ts +90 -0
- package/rules/.source/component/src/ESTabsView/ESTab.ts +7 -0
- package/rules/.source/component/src/ESTabsView/ESTabItem.ts +8 -0
- package/rules/.source/component/src/ESTabsView/ESTabsViewComponent.ts +383 -0
- package/rules/.source/component/src/ESTestView/ESITestAView.ts +1 -0
- package/rules/.source/component/src/ESTestView/ESITestGroup.ts +3 -0
- package/rules/.source/component/src/ESTestView/ESITestView.ts +3 -0
- package/rules/.source/component/src/ESTestView/ESTestAViewComponent.ts +34 -0
- package/rules/.source/component/src/ESTestView/ESTestGroupComponent.ts +39 -0
- package/rules/.source/component/src/ESTestView/ESTestViewComponent.ts +51 -0
- package/rules/.source/component/src/ESTextView/ESTextViewComponent.ts +22 -0
- package/rules/.source/component/src/ESTransitionImageView/ESITransitionImage.ts +7 -0
- package/rules/.source/component/src/ESTransitionImageView/ESTransitionImageViewComponent.ts +58 -0
- package/rules/.source/component/src/ESView/ESDirections.ts +7 -0
- package/rules/.source/component/src/ESView/ESIView.ts +6 -0
- package/rules/.source/component/src/ESView/ESViewComponent.ts +24 -0
- package/rules/.source/component/src/ESView/ESViewCoordinate.ts +4 -0
- package/rules/.source/component/src/ESView/ESViewScrollState.ts +5 -0
- package/rules/.source/component/src/ESView/ESViewState.ts +16 -0
- package/rules/.source/component/src/ESView/ESViewStateCallback.ts +5 -0
- package/rules/.source/component/src/ESViewPager/ESIViewPager.ts +8 -0
- package/rules/.source/component/src/ESViewPager/ESPageData.ts +7 -0
- package/rules/.source/component/src/ESViewPager/ESViewPagerComponent.ts +58 -0
- package/rules/.source/component/src/ESWebView/ESWebViewComponent.ts +48 -0
- package/rules/.source/component/src/ESX5WebView/ESX5WebViewElement.android.ts +70 -0
- package/rules/.source/component/src/ESX5WebView/ESX5WebViewElement.harmony.ts +70 -0
- package/rules/.source/component/src/index.ts +180 -0
- package/rules/.source/component/src/tv-div/TVDivComponent.ts +131 -0
- package/rules/.source/component/src/tv-image/TVImageComponent.ts +126 -0
- package/rules/.source/component/src/tv-li/TVLiComponent.ts +10 -0
- package/rules/.source/component/src/tv-swiper/TVSwiperComponent.ts +110 -0
- package/rules/.source/component/src/tv-ul/TVULComponent.ts +82 -0
- package/rules/.source/component/src/typings/index.ts +7 -0
- package/rules/.source/component/src/typings/shims-vue.d.ts +6 -0
- package/rules/.source/component/tsconfig.json +34 -0
- package/rules/.source/hippy/extend_views/CoverFlowHorizontalView.java +203 -0
- package/rules/.source/hippy/extend_views/CoverFlowVerticalView.java +203 -0
- package/rules/.source/hippy/extend_views/CoverFlowViewController.java +195 -0
- package/rules/.source/hippy/extend_views/EngineRootView.java +125 -0
- package/rules/.source/hippy/extend_views/ExtendTag.java +83 -0
- package/rules/.source/hippy/extend_views/FocusSearchHelper.java +124 -0
- package/rules/.source/hippy/extend_views/IRecyclerItemView.java +12 -0
- package/rules/.source/hippy/extend_views/JSEventHandleView.java +5 -0
- package/rules/.source/hippy/extend_views/MarqueeRelayManager.java +133 -0
- package/rules/.source/hippy/extend_views/MarqueeRelayTextView.java +211 -0
- package/rules/.source/hippy/extend_views/ProgressBarView.java +83 -0
- package/rules/.source/hippy/extend_views/ProgressBarViewController.java +145 -0
- package/rules/.source/hippy/extend_views/SeekBarView.java +104 -0
- package/rules/.source/hippy/extend_views/SeekBarViewController.java +218 -0
- package/rules/.source/hippy/extend_views/StateImageView.java +149 -0
- package/rules/.source/hippy/extend_views/StateImageViewController.java +34 -0
- package/rules/.source/hippy/extend_views/TVButtonView.java +314 -0
- package/rules/.source/hippy/extend_views/TVButtonViewController.java +89 -0
- package/rules/.source/hippy/extend_views/TVTextView.java +684 -0
- package/rules/.source/hippy/extend_views/TVViewActor.java +811 -0
- package/rules/.source/hippy/extend_views/TVViewActorHost.java +6 -0
- package/rules/.source/hippy/extend_views/TVViewActor/346/216/245/345/205/245.md +66 -0
- package/rules/.source/hippy/extend_views/TemplateUtil.java +336 -0
- package/rules/.source/hippy/extend_views/TextButtonNode.java +47 -0
- package/rules/.source/hippy/extend_views/TextViewController.java +377 -0
- package/rules/.source/hippy/extend_views/fastlist/CenterFlyInAnimator.java +96 -0
- package/rules/.source/hippy/extend_views/fastlist/ChildOnScreenScroller.java +548 -0
- package/rules/.source/hippy/extend_views/fastlist/ClonedViewTag.java +17 -0
- package/rules/.source/hippy/extend_views/fastlist/EventDeliverer.java +55 -0
- package/rules/.source/hippy/extend_views/fastlist/FastAdapter.java +4683 -0
- package/rules/.source/hippy/extend_views/fastlist/FastAdapterUtil.java +982 -0
- package/rules/.source/hippy/extend_views/fastlist/FastFlexNode.java +48 -0
- package/rules/.source/hippy/extend_views/fastlist/FastFlexView.java +873 -0
- package/rules/.source/hippy/extend_views/fastlist/FastFlexViewController.java +130 -0
- package/rules/.source/hippy/extend_views/fastlist/FastItemNode.java +67 -0
- package/rules/.source/hippy/extend_views/fastlist/FastItemView.java +306 -0
- package/rules/.source/hippy/extend_views/fastlist/FastItemViewController.java +106 -0
- package/rules/.source/hippy/extend_views/fastlist/FastListModule.java +95 -0
- package/rules/.source/hippy/extend_views/fastlist/FastListNode.java +90 -0
- package/rules/.source/hippy/extend_views/fastlist/FastListView.java +2466 -0
- package/rules/.source/hippy/extend_views/fastlist/FastListViewController.java +1038 -0
- package/rules/.source/hippy/extend_views/fastlist/FastListView/346/270/262/346/237/223/346/265/201/347/250/213/345/233/276.graffle +0 -0
- package/rules/.source/hippy/extend_views/fastlist/FastPendingView.java +47 -0
- package/rules/.source/hippy/extend_views/fastlist/ItemDecorations.java +71 -0
- package/rules/.source/hippy/extend_views/fastlist/ItemStoreNode.java +64 -0
- package/rules/.source/hippy/extend_views/fastlist/ItemStoreView.java +13 -0
- package/rules/.source/hippy/extend_views/fastlist/ItemStoreViewController.java +45 -0
- package/rules/.source/hippy/extend_views/fastlist/ListItemHolder.java +7 -0
- package/rules/.source/hippy/extend_views/fastlist/ListViewControlProp.java +41 -0
- package/rules/.source/hippy/extend_views/fastlist/MouseRecycleView.java +509 -0
- package/rules/.source/hippy/extend_views/fastlist/OnFastItemClickListener.java +12 -0
- package/rules/.source/hippy/extend_views/fastlist/OnFastItemFocusChangeListener.java +9 -0
- package/rules/.source/hippy/extend_views/fastlist/OnFastScrollStateChangedListener.java +7 -0
- package/rules/.source/hippy/extend_views/fastlist/PendingListNode.java +18 -0
- package/rules/.source/hippy/extend_views/fastlist/PendingViewController.java +13 -0
- package/rules/.source/hippy/extend_views/fastlist/PostHandlerView.java +6 -0
- package/rules/.source/hippy/extend_views/fastlist/PostTaskHolder.java +20 -0
- package/rules/.source/hippy/extend_views/fastlist/ReplaceChildController.java +105 -0
- package/rules/.source/hippy/extend_views/fastlist/ReplaceChildView.java +312 -0
- package/rules/.source/hippy/extend_views/fastlist/TVListView.java +3692 -0
- package/rules/.source/hippy/extend_views/fastlist/TemplateCodeParser.java +247 -0
- package/rules/.source/hippy/extend_views/fastlist/Utils.java +572 -0
- package/rules/.source/hippy/extend_views/fastlist/ViewTag.java +317 -0
- package/rules/.source/hippy/extend_views/fastlist/VirtualListView.java +8 -0
- package/rules/.source/hippy/extend_views/fastlist/diff/FastListDataBindingHelper.java +320 -0
- package/rules/.source/hippy/extend_views/fastlist/diff/KeyDiffHelper.java +289 -0
- package/rules/.source/hippy/extend_views/fastlist/diff/NoKeyDiffHelper.java +278 -0
- package/rules/.source/hippy/extend_views/tag/FontTag.java +53 -0
- package/rules/.source/hippy/extend_views/tag/HtmlTag.java +191 -0
- package/rules/.source/hippy/extend_views/tag/HtmlTagHandler.java +185 -0
- package/rules/.source/hippy/extend_views/tag/SpanTag.java +160 -0
- package/rules/.source/hippy/extend_views/tag/TextFontSpan.java +102 -0
- package/rules/.source/hippy/extend_views/waterfall/Chunk.java +10 -0
- package/rules/.source/hippy/extend_views/waterfall/ChunkGroup.java +5 -0
- package/rules/.source/hippy/extend_views/waterfall/Section.java +4 -0
- package/rules/.source/hippy/extend_views/waterfall/Tabs.java +5 -0
- package/rules/.source/hippy/extend_views/waterfall/WaterfallUtils.java +26 -0
- package/rules/.source/hippy/hippy_uimanager/ControllerHolder.java +30 -0
- package/rules/.source/hippy/hippy_uimanager/ControllerManager.java +651 -0
- package/rules/.source/hippy/hippy_uimanager/ControllerRegistry.java +102 -0
- package/rules/.source/hippy/hippy_uimanager/ControllerUpdateManger.java +252 -0
- package/rules/.source/hippy/hippy_uimanager/CustomControllerHelper.java +425 -0
- package/rules/.source/hippy/hippy_uimanager/DiffUtils.java +526 -0
- package/rules/.source/hippy/hippy_uimanager/ExtendViewGroup.java +36 -0
- package/rules/.source/hippy/hippy_uimanager/HippyCustomViewCreator.java +29 -0
- package/rules/.source/hippy/hippy_uimanager/HippyGroupController.java +83 -0
- package/rules/.source/hippy/hippy_uimanager/HippyViewBase.java +27 -0
- package/rules/.source/hippy/hippy_uimanager/HippyViewController.java +2189 -0
- package/rules/.source/hippy/hippy_uimanager/HippyViewEvent.java +52 -0
- package/rules/.source/hippy/hippy_uimanager/IHippyZIndexViewGroup.java +24 -0
- package/rules/.source/hippy/hippy_uimanager/InternalExtendViewUtil.java +395 -0
- package/rules/.source/hippy/hippy_uimanager/ListItemRenderNode.java +143 -0
- package/rules/.source/hippy/hippy_uimanager/ListViewRenderNode.java +44 -0
- package/rules/.source/hippy/hippy_uimanager/MatrixUtil.java +470 -0
- package/rules/.source/hippy/hippy_uimanager/NativeGestureDispatcher.java +349 -0
- package/rules/.source/hippy/hippy_uimanager/NativeGestureProcessor.java +188 -0
- package/rules/.source/hippy/hippy_uimanager/PullFooterRenderNode.java +43 -0
- package/rules/.source/hippy/hippy_uimanager/PullHeaderRenderNode.java +43 -0
- package/rules/.source/hippy/hippy_uimanager/RenderManager.java +304 -0
- package/rules/.source/hippy/hippy_uimanager/RenderNode.java +533 -0
- package/rules/.source/hippy/hippy_uimanager/StateView.java +17 -0
- package/rules/.source/hippy/hippy_uimanager/TransformUtil.java +125 -0
- package/rules/.source/hippy/hippy_uimanager/ViewGroupDrawingOrderHelper.java +108 -0
- package/rules/.source/hippy/hippy_uimanager/ViewStateProvider.java +10 -0
- package/rules/.source/hippy/hippy_views/audioview/AudioPlayManager.java +457 -0
- package/rules/.source/hippy/hippy_views/audioview/AudioView.java +225 -0
- package/rules/.source/hippy/hippy_views/audioview/AudioViewController.java +135 -0
- package/rules/.source/hippy/hippy_views/common/CommonBackgroundDrawable.java +58 -0
- package/rules/.source/hippy/hippy_views/common/CommonBorder.java +37 -0
- package/rules/.source/hippy/hippy_views/custom/HippyCustomPropsController.java +61 -0
- package/rules/.source/hippy/hippy_views/hippylist/HippyRecyclerListAdapter.java +399 -0
- package/rules/.source/hippy/hippy_views/hippylist/HippyRecyclerView.java +378 -0
- package/rules/.source/hippy/hippy_views/hippylist/HippyRecyclerViewController.java +187 -0
- package/rules/.source/hippy/hippy_views/hippylist/HippyRecyclerViewHolder.java +39 -0
- package/rules/.source/hippy/hippy_views/hippylist/HippyRecyclerViewWrapper.java +134 -0
- package/rules/.source/hippy/hippy_views/hippylist/NodePositionHelper.java +55 -0
- package/rules/.source/hippy/hippy_views/hippylist/PreloadHelper.java +54 -0
- package/rules/.source/hippy/hippy_views/hippylist/PullFooterEventHelper.java +61 -0
- package/rules/.source/hippy/hippy_views/hippylist/PullHeaderEventHelper.java +127 -0
- package/rules/.source/hippy/hippy_views/hippylist/RecyclerViewEventHelper.java +394 -0
- package/rules/.source/hippy/hippy_views/image/HippyContentDrawable.java +113 -0
- package/rules/.source/hippy/hippy_views/image/HippyImageView.java +1608 -0
- package/rules/.source/hippy/hippy_views/image/HippyImageViewController.java +382 -0
- package/rules/.source/hippy/hippy_views/image/IImageStateListener.java +7 -0
- package/rules/.source/hippy/hippy_views/list/ChildOnScreenScroller.java +255 -0
- package/rules/.source/hippy/hippy_views/list/HippyListAdapter.java +647 -0
- package/rules/.source/hippy/hippy_views/list/HippyListItemView.java +162 -0
- package/rules/.source/hippy/hippy_views/list/HippyListItemViewController.java +45 -0
- package/rules/.source/hippy/hippy_views/list/HippyListView.java +915 -0
- package/rules/.source/hippy/hippy_views/list/HippyListViewController.java +622 -0
- package/rules/.source/hippy/hippy_views/list/HippyRecycler.java +31 -0
- package/rules/.source/hippy/hippy_views/list/IRecycleItemTypeChange.java +23 -0
- package/rules/.source/hippy/hippy_views/list/ItemDecorations.java +70 -0
- package/rules/.source/hippy/hippy_views/list/NegativeLongKeyFlinger.java +156 -0
- package/rules/.source/hippy/hippy_views/list/NodeHolder.java +34 -0
- package/rules/.source/hippy/hippy_views/list/RecycleViewFlinger.java +126 -0
- package/rules/.source/hippy/hippy_views/list/TVRecyclerView.java +2070 -0
- package/rules/.source/hippy/hippy_views/list/TVSingleLineListView.java +15 -0
- package/rules/.source/hippy/hippy_views/modal/HippyModalHostManager.java +102 -0
- package/rules/.source/hippy/hippy_views/modal/HippyModalHostView.java +597 -0
- package/rules/.source/hippy/hippy_views/modal/ModalHostHelper.java +46 -0
- package/rules/.source/hippy/hippy_views/modal/ModalStyleNode.java +34 -0
- package/rules/.source/hippy/hippy_views/modal/RequestCloseEvent.java +32 -0
- package/rules/.source/hippy/hippy_views/modal/ShowEvent.java +31 -0
- package/rules/.source/hippy/hippy_views/navigator/Navigator.java +126 -0
- package/rules/.source/hippy/hippy_views/navigator/NavigatorController.java +120 -0
- package/rules/.source/hippy/hippy_views/refresh/HippyPullFooterView.java +47 -0
- package/rules/.source/hippy/hippy_views/refresh/HippyPullFooterViewController.java +65 -0
- package/rules/.source/hippy/hippy_views/refresh/HippyPullHeaderView.java +39 -0
- package/rules/.source/hippy/hippy_views/refresh/HippyPullHeaderViewController.java +104 -0
- package/rules/.source/hippy/hippy_views/refresh/RefreshWrapper.java +237 -0
- package/rules/.source/hippy/hippy_views/refresh/RefreshWrapperController.java +62 -0
- package/rules/.source/hippy/hippy_views/refresh/RefreshWrapperItemController.java +39 -0
- package/rules/.source/hippy/hippy_views/refresh/RefreshWrapperItemView.java +26 -0
- package/rules/.source/hippy/hippy_views/scroll/HippyHorizontalScrollView.java +500 -0
- package/rules/.source/hippy/hippy_views/scroll/HippyOnScrollHelper.java +39 -0
- package/rules/.source/hippy/hippy_views/scroll/HippyScrollView.java +46 -0
- package/rules/.source/hippy/hippy_views/scroll/HippyScrollViewController.java +178 -0
- package/rules/.source/hippy/hippy_views/scroll/HippyScrollViewEventHelper.java +92 -0
- package/rules/.source/hippy/hippy_views/scroll/HippyVerticalScrollView.java +522 -0
- package/rules/.source/hippy/hippy_views/text/HippyTextView.java +512 -0
- package/rules/.source/hippy/hippy_views/text/HippyTextViewController.java +77 -0
- package/rules/.source/hippy/hippy_views/textinput/HippyTextInput.java +668 -0
- package/rules/.source/hippy/hippy_views/textinput/HippyTextInputController.java +528 -0
- package/rules/.source/hippy/hippy_views/textinput/TextInputNode.java +115 -0
- package/rules/.source/hippy/hippy_views/videoview/APEZProvider.java +287 -0
- package/rules/.source/hippy/hippy_views/videoview/APKExpansionSupport.java +82 -0
- package/rules/.source/hippy/hippy_views/videoview/PivotPoint.java +13 -0
- package/rules/.source/hippy/hippy_views/videoview/ScalableType.java +34 -0
- package/rules/.source/hippy/hippy_views/videoview/ScalableVideoView.java +265 -0
- package/rules/.source/hippy/hippy_views/videoview/ScaleManager.java +191 -0
- package/rules/.source/hippy/hippy_views/videoview/Size.java +19 -0
- package/rules/.source/hippy/hippy_views/videoview/VideoHippyView.java +917 -0
- package/rules/.source/hippy/hippy_views/videoview/VideoHippyViewController.java +236 -0
- package/rules/.source/hippy/hippy_views/videoview/ZipResourceFile.java +427 -0
- package/rules/.source/hippy/hippy_views/view/CardRootView.java +28 -0
- package/rules/.source/hippy/hippy_views/view/CustomLayoutView.java +10 -0
- package/rules/.source/hippy/hippy_views/view/CustomNodeView.java +5 -0
- package/rules/.source/hippy/hippy_views/view/DialogViewGroup.java +113 -0
- package/rules/.source/hippy/hippy_views/view/HippyViewGroup.java +2042 -0
- package/rules/.source/hippy/hippy_views/view/HippyViewGroupController.java +583 -0
- package/rules/.source/hippy/hippy_views/view/WindowRoot.java +5 -0
- package/rules/.source/hippy/hippy_views/viewpager/HippyViewPager.java +308 -0
- package/rules/.source/hippy/hippy_views/viewpager/HippyViewPagerAdapter.java +148 -0
- package/rules/.source/hippy/hippy_views/viewpager/HippyViewPagerController.java +246 -0
- package/rules/.source/hippy/hippy_views/viewpager/HippyViewPagerItem.java +27 -0
- package/rules/.source/hippy/hippy_views/viewpager/HippyViewPagerItemController.java +42 -0
- package/rules/.source/hippy/hippy_views/viewpager/ViewPagerPageChangeListener.java +114 -0
- package/rules/.source/hippy/hippy_views/viewpager/event/HippyPageItemExposureEvent.java +40 -0
- package/rules/.source/hippy/hippy_views/viewpager/event/HippyPageScrollEvent.java +43 -0
- package/rules/.source/hippy/hippy_views/viewpager/event/HippyPageScrollStateChangedEvent.java +42 -0
- package/rules/.source/hippy/hippy_views/viewpager/event/HippyPageSelectedEvent.java +42 -0
- package/rules/.source/hippy/hippy_views/webview/HippyWebView.java +160 -0
- package/rules/.source/hippy/hippy_views/webview/HippyWebViewBridge.java +20 -0
- package/rules/.source/hippy/hippy_views/webview/HippyWebViewController.java +103 -0
- package/rules/.source/hippy/hippy_views/webview/HippyWebViewInner.java +77 -0
- package/rules/.source/quicktvui/assets/ic_media_sereis_vip.png +0 -0
- package/rules/.source/quicktvui/package.json +38 -0
- package/rules/.source/quicktvui/rollup.config.js +33 -0
- package/rules/.source/quicktvui/src/animation/QTAnimation.android.ts +1139 -0
- package/rules/.source/quicktvui/src/animation/QTAnimation.harmony.ts +1088 -0
- package/rules/.source/quicktvui/src/animation/QTIAnimation.ts +336 -0
- package/rules/.source/quicktvui/src/animation/QtAnimationAPI.ts +467 -0
- package/rules/.source/quicktvui/src/animation/types.ts +97 -0
- package/rules/.source/quicktvui/src/app/QTAppIcon.ts +41 -0
- package/rules/.source/quicktvui/src/app/QTIAppIcon.ts +5 -0
- package/rules/.source/quicktvui/src/app/QtAppIconAPI.ts +56 -0
- package/rules/.source/quicktvui/src/assets/vip.png +0 -0
- package/rules/.source/quicktvui/src/base/QTIBaseView.ts +95 -0
- package/rules/.source/quicktvui/src/base/QtBaseNativeViewAPI.ts +604 -0
- package/rules/.source/quicktvui/src/base/QtBaseViewAPI.ts +750 -0
- package/rules/.source/quicktvui/src/base/useBaseView.ts +374 -0
- package/rules/.source/quicktvui/src/button/QTIButton.ts +3 -0
- package/rules/.source/quicktvui/src/button/QtButtonAPI.ts +9 -0
- package/rules/.source/quicktvui/src/button/index.vue +223 -0
- package/rules/.source/quicktvui/src/canvas/CanvasGradient.ts +84 -0
- package/rules/.source/quicktvui/src/canvas/QTCanvasView.ts +468 -0
- package/rules/.source/quicktvui/src/canvas/QTICanvasView.ts +141 -0
- package/rules/.source/quicktvui/src/canvas/QtCanvasViewAPI.ts +1140 -0
- package/rules/.source/quicktvui/src/classified-list-view/QtClassifiedListViewAPI.ts +115 -0
- package/rules/.source/quicktvui/src/classified-list-view/core/QTClassifiedListViewItem.ts +11 -0
- package/rules/.source/quicktvui/src/classified-list-view/core/QTClassifiedListViewItemDecoration.ts +7 -0
- package/rules/.source/quicktvui/src/classified-list-view/core/QTIClassifiedListView.ts +18 -0
- package/rules/.source/quicktvui/src/classified-list-view/index.vue +520 -0
- package/rules/.source/quicktvui/src/collapse/QtCollapseAPI.ts +60 -0
- package/rules/.source/quicktvui/src/collapse/core/QTCollapse.ts +13 -0
- package/rules/.source/quicktvui/src/collapse/core/QTCollapseItem.ts +7 -0
- package/rules/.source/quicktvui/src/collapse/core/QTICollapse.ts +15 -0
- package/rules/.source/quicktvui/src/collapse/core/QTICollapseItem.ts +5 -0
- package/rules/.source/quicktvui/src/collapse/index.vue +337 -0
- package/rules/.source/quicktvui/src/column/QTIColumn.ts +3 -0
- package/rules/.source/quicktvui/src/column/QtColumnAPI.ts +9 -0
- package/rules/.source/quicktvui/src/column/index.vue +29 -0
- package/rules/.source/quicktvui/src/core/QTEventData.ts +4 -0
- package/rules/.source/quicktvui/src/core/QTFlexStyleBackground.ts +4 -0
- package/rules/.source/quicktvui/src/core/QTFlexStyleCoordinate.ts +5 -0
- package/rules/.source/quicktvui/src/core/QTFlexStyleDecoration.ts +7 -0
- package/rules/.source/quicktvui/src/core/QTFlexStyleGradientBackground.ts +6 -0
- package/rules/.source/quicktvui/src/core/QTFlexStyleMargin.ts +8 -0
- package/rules/.source/quicktvui/src/core/QTFlexStylePadding.ts +8 -0
- package/rules/.source/quicktvui/src/core/QTFlexStylePosition.ts +7 -0
- package/rules/.source/quicktvui/src/core/QTFlexStyleSize.ts +6 -0
- package/rules/.source/quicktvui/src/core/QTFlexStyleSpacing.ts +4 -0
- package/rules/.source/quicktvui/src/core/QTFlexStyleText.ts +5 -0
- package/rules/.source/quicktvui/src/core/QTFocusable.ts +5 -0
- package/rules/.source/quicktvui/src/core/QTLocation.ts +4 -0
- package/rules/.source/quicktvui/src/core/QTNativeParams.ts +22 -0
- package/rules/.source/quicktvui/src/core/QTPosition.ts +4 -0
- package/rules/.source/quicktvui/src/core/QTVisibility.ts +5 -0
- package/rules/.source/quicktvui/src/dialog/QTDialog.ts +28 -0
- package/rules/.source/quicktvui/src/dialog/QTIDialog.ts +3 -0
- package/rules/.source/quicktvui/src/file-browse/QTFileBrowse.ts +76 -0
- package/rules/.source/quicktvui/src/file-browse/QTIFileBrowse.ts +13 -0
- package/rules/.source/quicktvui/src/focus/QTDescendantFocusability.ts +5 -0
- package/rules/.source/quicktvui/src/focus/QTFocusDescendant.ts +5 -0
- package/rules/.source/quicktvui/src/focus/QTFocusDirection.ts +8 -0
- package/rules/.source/quicktvui/src/focus/QTFocusDirectionName.ts +7 -0
- package/rules/.source/quicktvui/src/gradient/QTGradient.ts +14 -0
- package/rules/.source/quicktvui/src/gradient/QTGradientOrientation.ts +10 -0
- package/rules/.source/quicktvui/src/gradient/QTGradientShape.ts +6 -0
- package/rules/.source/quicktvui/src/gradient/QTGradientType.ts +5 -0
- package/rules/.source/quicktvui/src/grid-view/QtGridViewAPI.ts +121 -0
- package/rules/.source/quicktvui/src/grid-view/README.md +93 -0
- package/rules/.source/quicktvui/src/grid-view/core/QTGridViewItem.ts +4 -0
- package/rules/.source/quicktvui/src/grid-view/core/QTGridViewItemDecoration.ts +7 -0
- package/rules/.source/quicktvui/src/grid-view/core/QTGridViewItemFunctionParams.ts +7 -0
- package/rules/.source/quicktvui/src/grid-view/core/QTIGridView.ts +23 -0
- package/rules/.source/quicktvui/src/grid-view/index.vue +390 -0
- package/rules/.source/quicktvui/src/image/QTIImage.ts +8 -0
- package/rules/.source/quicktvui/src/image/QTImageResizeMode.ts +7 -0
- package/rules/.source/quicktvui/src/image/QtImageAPI.ts +54 -0
- package/rules/.source/quicktvui/src/image/index.vue +33 -0
- package/rules/.source/quicktvui/src/index.ts +404 -0
- package/rules/.source/quicktvui/src/list/QTIBaseListView.ts +144 -0
- package/rules/.source/quicktvui/src/list/QTListInitPosition.ts +15 -0
- package/rules/.source/quicktvui/src/list/QtBaseListViewAPI.ts +930 -0
- package/rules/.source/quicktvui/src/list/useBaseListView.ts +454 -0
- package/rules/.source/quicktvui/src/list/useListView.ts +294 -0
- package/rules/.source/quicktvui/src/list-indicator/QTIndicatorListViewComponent.ts +553 -0
- package/rules/.source/quicktvui/src/list-indicator/QtIndicatorViewAPI.ts +114 -0
- package/rules/.source/quicktvui/src/list-indicator/core/QTIIndicatorView.ts +21 -0
- package/rules/.source/quicktvui/src/list-item/ESListItemComponent.ts +86 -0
- package/rules/.source/quicktvui/src/list-item/QTIListItem.ts +14 -0
- package/rules/.source/quicktvui/src/list-item/QtListItemAPI.ts +107 -0
- package/rules/.source/quicktvui/src/list-view/QTListViewComponent.ts +389 -0
- package/rules/.source/quicktvui/src/list-view/QtListViewAPI.ts +101 -0
- package/rules/.source/quicktvui/src/list-view/core/QTIListView.ts +19 -0
- package/rules/.source/quicktvui/src/list-view/core/QTListViewItem.ts +12 -0
- package/rules/.source/quicktvui/src/list-view/core/QTListViewItemDecoration.ts +7 -0
- package/rules/.source/quicktvui/src/list-view/core/QTListViewItemFunctionParams.ts +7 -0
- package/rules/.source/quicktvui/src/list-view/core/QTListViewItemState.ts +8 -0
- package/rules/.source/quicktvui/src/loading/QTILoadingView.ts +3 -0
- package/rules/.source/quicktvui/src/loading/QTLoadingView.ts +25 -0
- package/rules/.source/quicktvui/src/loading/QtLoadingAPI.ts +9 -0
- package/rules/.source/quicktvui/src/long-image/QTILongImage.ts +68 -0
- package/rules/.source/quicktvui/src/long-image/QTLongImage.ts +442 -0
- package/rules/.source/quicktvui/src/long-image/QTLongImageEventBean.ts +62 -0
- package/rules/.source/quicktvui/src/long-image/QTLongImageOrientation.ts +19 -0
- package/rules/.source/quicktvui/src/long-image/QTLongImagePositionType.ts +5 -0
- package/rules/.source/quicktvui/src/long-image/QTLongImageScaleType.ts +9 -0
- package/rules/.source/quicktvui/src/long-image/QtLongImageAPI.ts +9 -0
- package/rules/.source/quicktvui/src/long-image/index.vue +397 -0
- package/rules/.source/quicktvui/src/lottie/QTILottieView.ts +62 -0
- package/rules/.source/quicktvui/src/lottie/QTLottieAsyncUpdates.ts +5 -0
- package/rules/.source/quicktvui/src/lottie/QTLottieEvent.ts +5 -0
- package/rules/.source/quicktvui/src/lottie/QTLottieRenderMode.ts +5 -0
- package/rules/.source/quicktvui/src/lottie/QTLottieRepeatMode.ts +5 -0
- package/rules/.source/quicktvui/src/lottie/QTLottieView.android.ts +207 -0
- package/rules/.source/quicktvui/src/lottie/QTLottieView.harmony.ts +207 -0
- package/rules/.source/quicktvui/src/lottie/QtLottieViewAPI.ts +586 -0
- package/rules/.source/quicktvui/src/nav-bar/QTINavBar.ts +11 -0
- package/rules/.source/quicktvui/src/nav-bar/QTNavBar.ts +9 -0
- package/rules/.source/quicktvui/src/nav-bar/QTNavBarItem.ts +9 -0
- package/rules/.source/quicktvui/src/nav-bar/QTNavBarItemType.ts +3 -0
- package/rules/.source/quicktvui/src/nav-bar/QtNavBarAPI.ts +36 -0
- package/rules/.source/quicktvui/src/nav-bar/index.vue +220 -0
- package/rules/.source/quicktvui/src/plugin/QTIPluginView.ts +11 -0
- package/rules/.source/quicktvui/src/plugin/QTPluginView.ts +49 -0
- package/rules/.source/quicktvui/src/plugin/QtPluginViewAPI.ts +44 -0
- package/rules/.source/quicktvui/src/poster/QtPosterAPI.ts +9 -0
- package/rules/.source/quicktvui/src/poster/core/QTIPoster.ts +3 -0
- package/rules/.source/quicktvui/src/poster/core/QTPoster.ts +32 -0
- package/rules/.source/quicktvui/src/poster/core/QTPosterCorner.ts +9 -0
- package/rules/.source/quicktvui/src/poster/core/QTPosterElement.ts +8 -0
- package/rules/.source/quicktvui/src/poster/core/QTPosterImage.ts +7 -0
- package/rules/.source/quicktvui/src/poster/core/QTPosterPlaceholderImg.ts +4 -0
- package/rules/.source/quicktvui/src/poster/core/QTPosterRipple.ts +10 -0
- package/rules/.source/quicktvui/src/poster/core/QTPosterScore.ts +14 -0
- package/rules/.source/quicktvui/src/poster/core/QTPosterShadow.ts +4 -0
- package/rules/.source/quicktvui/src/poster/core/QTPosterShimmer.ts +4 -0
- package/rules/.source/quicktvui/src/poster/core/QTPosterTitle.ts +17 -0
- package/rules/.source/quicktvui/src/poster/index.vue +279 -0
- package/rules/.source/quicktvui/src/poster/qt-poster-corner-title.vue +69 -0
- package/rules/.source/quicktvui/src/poster/qt-poster-focus-title.vue +113 -0
- package/rules/.source/quicktvui/src/progressbar/QTIProgressBar.ts +264 -0
- package/rules/.source/quicktvui/src/progressbar/QTProgressBar.ts +1284 -0
- package/rules/.source/quicktvui/src/progressbar/QtProgressBarAPI.ts +2637 -0
- package/rules/.source/quicktvui/src/qrcode/QTIQRCode.ts +3 -0
- package/rules/.source/quicktvui/src/qrcode/QTQRCodeView.ts +24 -0
- package/rules/.source/quicktvui/src/qrcode/QtQRCodeAPI.ts +9 -0
- package/rules/.source/quicktvui/src/qt/QtAPI.ts +337 -0
- package/rules/.source/quicktvui/src/qt/QtAPIModule.ts +3 -0
- package/rules/.source/quicktvui/src/qt/warning.ts +9 -0
- package/rules/.source/quicktvui/src/qtListen/README.md +76 -0
- package/rules/.source/quicktvui/src/qtListen/effect.ts +141 -0
- package/rules/.source/quicktvui/src/qtListen/index.ts +11 -0
- package/rules/.source/quicktvui/src/qtListen/qtArray.ts +156 -0
- package/rules/.source/quicktvui/src/qtListen/qtDiff.ts +143 -0
- package/rules/.source/quicktvui/src/qtListen/reactive.ts +205 -0
- package/rules/.source/quicktvui/src/qtListen/ref.ts +98 -0
- package/rules/.source/quicktvui/src/qtListen/types.ts +311 -0
- package/rules/.source/quicktvui/src/qtListen/watch.ts +233 -0
- package/rules/.source/quicktvui/src/replace-child/QTIReplaceChildView.ts +5 -0
- package/rules/.source/quicktvui/src/replace-child/QTReplaceChildView.ts +30 -0
- package/rules/.source/quicktvui/src/replace-child/QtReplaceChildViewAPI.ts +37 -0
- package/rules/.source/quicktvui/src/row/QTIRow.ts +3 -0
- package/rules/.source/quicktvui/src/row/QtRowAPI.ts +9 -0
- package/rules/.source/quicktvui/src/row/index.vue +29 -0
- package/rules/.source/quicktvui/src/scroll-view/QTIScrollView.ts +7 -0
- package/rules/.source/quicktvui/src/scroll-view/QTScrollView.ts +45 -0
- package/rules/.source/quicktvui/src/scroll-view/QtScrollViewAPI.ts +62 -0
- package/rules/.source/quicktvui/src/section/index.vue +40 -0
- package/rules/.source/quicktvui/src/seekbar/QTISeekBar.ts +277 -0
- package/rules/.source/quicktvui/src/seekbar/QTSeekBar.ts +1380 -0
- package/rules/.source/quicktvui/src/seekbar/QTSeekBarGravity.ts +5 -0
- package/rules/.source/quicktvui/src/seekbar/QTSeekBarIndicatorMode.ts +6 -0
- package/rules/.source/quicktvui/src/seekbar/QTSeekBarMode.ts +4 -0
- package/rules/.source/quicktvui/src/seekbar/QTSeekBarTickMarkGravity.ts +5 -0
- package/rules/.source/quicktvui/src/seekbar/QTSeekBarTickMarkLayoutGravity.ts +4 -0
- package/rules/.source/quicktvui/src/seekbar/QTSeekBarTickMarkMode.ts +4 -0
- package/rules/.source/quicktvui/src/seekbar/QtSeekBarAPI.ts +2645 -0
- package/rules/.source/quicktvui/src/series/DataAdapter.ts +329 -0
- package/rules/.source/quicktvui/src/series/QTIMediaSeries.ts +33 -0
- package/rules/.source/quicktvui/src/series/QTMediaSeries.ts +9 -0
- package/rules/.source/quicktvui/src/series/QTMediaSeriesData.ts +9 -0
- package/rules/.source/quicktvui/src/series/QTMediaSeriesDataStyle.ts +4 -0
- package/rules/.source/quicktvui/src/series/QTMediaSeriesEvent.ts +7 -0
- package/rules/.source/quicktvui/src/series/QTMediaSeriesGroup.ts +8 -0
- package/rules/.source/quicktvui/src/series/QTMediaSeriesGroupStyle.ts +58 -0
- package/rules/.source/quicktvui/src/series/QTMediaSeriesStyleType.ts +5 -0
- package/rules/.source/quicktvui/src/series/QTMediaSeriesType.ts +8 -0
- package/rules/.source/quicktvui/src/series/QTMediaSeriesVip.ts +4 -0
- package/rules/.source/quicktvui/src/series/QtMediaSeriesAPI.ts +140 -0
- package/rules/.source/quicktvui/src/series/component/media-series.vue +160 -0
- package/rules/.source/quicktvui/src/series/index.vue +316 -0
- package/rules/.source/quicktvui/src/series/item/media-series-number-item.vue +212 -0
- package/rules/.source/quicktvui/src/series/item/media-series-text-item.vue +239 -0
- package/rules/.source/quicktvui/src/tab/QTITab.ts +163 -0
- package/rules/.source/quicktvui/src/tab/QTTab.ts +8 -0
- package/rules/.source/quicktvui/src/tab/QTTabDataManager.ts +620 -0
- package/rules/.source/quicktvui/src/tab/QTTabEvent.ts +11 -0
- package/rules/.source/quicktvui/src/tab/QTTabEventParams.ts +12 -0
- package/rules/.source/quicktvui/src/tab/QTTabIndex.ts +8 -0
- package/rules/.source/quicktvui/src/tab/QTTabItem.ts +5 -0
- package/rules/.source/quicktvui/src/tab/QTTabItemType.ts +3 -0
- package/rules/.source/quicktvui/src/tab/QTTabPage.ts +5 -0
- package/rules/.source/quicktvui/src/tab/QTTabPageData.ts +11 -0
- package/rules/.source/quicktvui/src/tab/QTTabPageDataState.ts +8 -0
- package/rules/.source/quicktvui/src/tab/QTTabPageState.ts +8 -0
- package/rules/.source/quicktvui/src/tab/QtTabAPI.ts +578 -0
- package/rules/.source/quicktvui/src/tab/index.vue +1561 -0
- package/rules/.source/quicktvui/src/tab/useQtTabWatch.ts +203 -0
- package/rules/.source/quicktvui/src/text/QTIText.ts +12 -0
- package/rules/.source/quicktvui/src/text/QTTextSpan.ts +6 -0
- package/rules/.source/quicktvui/src/text/QTTextSpanAttribute.ts +6 -0
- package/rules/.source/quicktvui/src/text/QTTextSpanAttributeType.ts +4 -0
- package/rules/.source/quicktvui/src/text/QtTextAPI.ts +90 -0
- package/rules/.source/quicktvui/src/text/index.vue +44 -0
- package/rules/.source/quicktvui/src/theme/button.css +195 -0
- package/rules/.source/quicktvui/src/typings/shims-vue.d.ts +6 -0
- package/rules/.source/quicktvui/src/ul/QTIUL.ts +34 -0
- package/rules/.source/quicktvui/src/ul/QTULInitPosition.ts +3 -0
- package/rules/.source/quicktvui/src/ul/QtULAPI.ts +232 -0
- package/rules/.source/quicktvui/src/utils/QtVirtualViewAPI.ts +32 -0
- package/rules/.source/quicktvui/src/utils/VirtualView.ts +124 -0
- package/rules/.source/quicktvui/src/utils/functions.ts +1 -0
- package/rules/.source/quicktvui/src/utils/index.ts +3 -0
- package/rules/.source/quicktvui/src/utils/make-installer.ts +16 -0
- package/rules/.source/quicktvui/src/utils/objects.ts +4 -0
- package/rules/.source/quicktvui/src/utils/type.ts +1 -0
- package/rules/.source/quicktvui/src/utils/types.ts +42 -0
- package/rules/.source/quicktvui/src/utils/utils.ts +62 -0
- package/rules/.source/quicktvui/src/utils/vue/index.ts +3 -0
- package/rules/.source/quicktvui/src/utils/vue/install.ts +48 -0
- package/rules/.source/quicktvui/src/utils/vue/props/index.ts +3 -0
- package/rules/.source/quicktvui/src/utils/vue/props/runtime.ts +129 -0
- package/rules/.source/quicktvui/src/utils/vue/props/types.ts +165 -0
- package/rules/.source/quicktvui/src/utils/vue/props/util.ts +10 -0
- package/rules/.source/quicktvui/src/utils/vue/typescript.ts +9 -0
- package/rules/.source/quicktvui/src/view/QTIView.ts +3 -0
- package/rules/.source/quicktvui/src/view/QTIViewVisibility.ts +5 -0
- package/rules/.source/quicktvui/src/view/QTViewEvent.ts +3 -0
- package/rules/.source/quicktvui/src/view/QTViewState.ts +12 -0
- package/rules/.source/quicktvui/src/view/QtViewAPI.ts +9 -0
- package/rules/.source/quicktvui/src/view/index.vue +24 -0
- package/rules/.source/quicktvui/src/waterfall/QtWaterfallAPI.ts +219 -0
- package/rules/.source/quicktvui/src/waterfall/README.md +143 -0
- package/rules/.source/quicktvui/src/waterfall/core/QTIWaterfall.ts +49 -0
- package/rules/.source/quicktvui/src/waterfall/core/QTScrollState.ts +5 -0
- package/rules/.source/quicktvui/src/waterfall/core/QTWaterfall.ts +13 -0
- package/rules/.source/quicktvui/src/waterfall/core/QTWaterfallCardItem.ts +11 -0
- package/rules/.source/quicktvui/src/waterfall/core/QTWaterfallCardPlaceHolder.ts +10 -0
- package/rules/.source/quicktvui/src/waterfall/core/QTWaterfallCardSection.ts +12 -0
- package/rules/.source/quicktvui/src/waterfall/core/QTWaterfallDataAdapter.ts +195 -0
- package/rules/.source/quicktvui/src/waterfall/core/QTWaterfallDataManager.ts +305 -0
- package/rules/.source/quicktvui/src/waterfall/core/QTWaterfallEvent.ts +11 -0
- package/rules/.source/quicktvui/src/waterfall/core/QTWaterfallFlexStyle.ts +19 -0
- package/rules/.source/quicktvui/src/waterfall/core/QTWaterfallIndex.ts +7 -0
- package/rules/.source/quicktvui/src/waterfall/core/QTWaterfallItem.ts +9 -0
- package/rules/.source/quicktvui/src/waterfall/core/QTWaterfallItemType.ts +7 -0
- package/rules/.source/quicktvui/src/waterfall/core/QTWaterfallPlaceholder.ts +5 -0
- package/rules/.source/quicktvui/src/waterfall/core/QTWaterfallPluginItem.ts +9 -0
- package/rules/.source/quicktvui/src/waterfall/core/QTWaterfallPluginSection.ts +8 -0
- package/rules/.source/quicktvui/src/waterfall/core/QTWaterfallSection.ts +17 -0
- package/rules/.source/quicktvui/src/waterfall/core/QTWaterfallSectionType.ts +14 -0
- package/rules/.source/quicktvui/src/waterfall/core/QTWaterfallTabItem.ts +10 -0
- package/rules/.source/quicktvui/src/waterfall/core/QTWaterfallVisibleType.ts +7 -0
- package/rules/.source/quicktvui/src/waterfall/index.vue +704 -0
- package/rules/.source/quicktvui/src/waterfall/item/card-item.vue +49 -0
- package/rules/.source/quicktvui/src/waterfall/item/plugin-item.vue +52 -0
- package/rules/.source/quicktvui/src/waterfall/section/blank-section.vue +27 -0
- package/rules/.source/quicktvui/src/waterfall/section/card-section.vue +81 -0
- package/rules/.source/quicktvui/src/waterfall/section/end-section.vue +50 -0
- package/rules/.source/quicktvui/src/waterfall/section/flex-section.vue +167 -0
- package/rules/.source/quicktvui/src/waterfall/section/list-section.vue +247 -0
- package/rules/.source/quicktvui/src/waterfall/section/loading-section.vue +34 -0
- package/rules/.source/quicktvui/src/waterfall/section/plugin-section.vue +87 -0
- package/rules/.source/quicktvui/src/waterfall/section/section-title.vue +63 -0
- package/rules/.source/quicktvui/src/waterfall/section/vue-section.vue +44 -0
- package/rules/.source/quicktvui/src/webview/QTIWebView.ts +199 -0
- package/rules/.source/quicktvui/src/webview/QTWebView.ts +957 -0
- package/rules/.source/quicktvui/src/webview/QTWebViewInterceptRule.ts +4 -0
- package/rules/.source/quicktvui/src/webview/QTWebViewLayerType.ts +6 -0
- package/rules/.source/quicktvui/src/webview/QTWebViewSniffingRule.ts +18 -0
- package/rules/.source/quicktvui/src/webview/QtWebViewAPI.ts +1963 -0
- package/rules/.source/quicktvui/src/x5webview/QTIX5WebView.ts +211 -0
- package/rules/.source/quicktvui/src/x5webview/QTX5WebView.ts +1014 -0
- package/rules/.source/quicktvui/src/x5webview/QTX5WebViewInterceptRule.ts +4 -0
- package/rules/.source/quicktvui/src/x5webview/QTX5WebViewLayerType.ts +6 -0
- package/rules/.source/quicktvui/src/x5webview/QTX5WebViewSniffingRule.ts +18 -0
- package/rules/.source/quicktvui/src/x5webview/QtX5WebViewAPI.ts +2015 -0
- package/rules/.source/quicktvui/tsconfig.json +34 -0
- package/rules/.source/quicktvui/web-types.json +1 -0
- package/rules/.source/quicktvui/yarn.lock +72 -0
- package/rules/.source/web/audio/index.ts +9 -0
- package/rules/.source/web/audio/src/audio.ts +34 -0
- package/rules/.source/web/audio/src/audio.vue +146 -0
- package/rules/.source/web/audio/src/instance.ts +3 -0
- package/rules/.source/web/audio-service/index.ts +10 -0
- package/rules/.source/web/audio-service/src/audio-service.ts +34 -0
- package/rules/.source/web/audio-service/src/audio-service.vue +115 -0
- package/rules/.source/web/audio-service/src/instance.ts +3 -0
- package/rules/.source/web/base/index.ts +1 -0
- package/rules/.source/web/base/src/base-types.ts +1 -0
- package/rules/.source/web/component.ts +25 -0
- package/rules/.source/web/docs/h.txt +6 -0
- package/rules/.source/web/docs/video.txt +88 -0
- package/rules/.source/web/h1/index.ts +9 -0
- package/rules/.source/web/h1/src/h1.ts +9 -0
- package/rules/.source/web/h1/src/h1.vue +30 -0
- package/rules/.source/web/h1/src/instance.ts +3 -0
- package/rules/.source/web/h2/index.ts +9 -0
- package/rules/.source/web/h2/src/h2.ts +9 -0
- package/rules/.source/web/h2/src/h2.vue +30 -0
- package/rules/.source/web/h2/src/instance.ts +3 -0
- package/rules/.source/web/h3/index.ts +9 -0
- package/rules/.source/web/h3/src/h3.ts +9 -0
- package/rules/.source/web/h3/src/h3.vue +30 -0
- package/rules/.source/web/h3/src/instance.ts +3 -0
- package/rules/.source/web/h4/index.ts +9 -0
- package/rules/.source/web/h4/src/h4.ts +9 -0
- package/rules/.source/web/h4/src/h4.vue +30 -0
- package/rules/.source/web/h4/src/instance.ts +3 -0
- package/rules/.source/web/h5/index.ts +9 -0
- package/rules/.source/web/h5/src/h5.ts +9 -0
- package/rules/.source/web/h5/src/h5.vue +30 -0
- package/rules/.source/web/h5/src/instance.ts +3 -0
- package/rules/.source/web/h6/index.ts +9 -0
- package/rules/.source/web/h6/src/h6.ts +9 -0
- package/rules/.source/web/h6/src/h6.vue +30 -0
- package/rules/.source/web/h6/src/instance.ts +3 -0
- package/rules/.source/web/index.ts +84 -0
- package/rules/.source/web/package.json +24 -0
- package/rules/.source/web/plugin.ts +3 -0
- package/rules/.source/web/rollup.config.js +37 -0
- package/rules/.source/web/shims-vue.d.ts +6 -0
- package/rules/.source/web/source/index.ts +9 -0
- package/rules/.source/web/source/src/instance.ts +3 -0
- package/rules/.source/web/source/src/source.ts +17 -0
- package/rules/.source/web/source/src/source.vue +19 -0
- package/rules/.source/web/tsconfig.json +34 -0
- package/rules/.source/web/utils/functions.ts +1 -0
- package/rules/.source/web/utils/index.ts +3 -0
- package/rules/.source/web/utils/make-installer.ts +16 -0
- package/rules/.source/web/utils/objects.ts +4 -0
- package/rules/.source/web/utils/types.ts +42 -0
- package/rules/.source/web/utils/vue/index.ts +3 -0
- package/rules/.source/web/utils/vue/install.ts +48 -0
- package/rules/.source/web/utils/vue/props/index.ts +3 -0
- package/rules/.source/web/utils/vue/props/runtime.ts +129 -0
- package/rules/.source/web/utils/vue/props/types.ts +165 -0
- package/rules/.source/web/utils/vue/props/util.ts +10 -0
- package/rules/.source/web/utils/vue/typescript.ts +9 -0
- package/rules/.source/web/video/index.ts +9 -0
- package/rules/.source/web/video/src/instance.ts +3 -0
- package/rules/.source/web/video/src/video.ts +34 -0
- package/rules/.source/web/video/src/video.vue +171 -0
- package/rules/.windsurfrules +28 -4
- package/rules/AGENTS.md +28 -4
- package/rules/CLAUDE.md +28 -3
- package/rules/GEMINI.md +26 -3
|
@@ -0,0 +1,4683 @@
|
|
|
1
|
+
package com.tencent.extend.views.fastlist;
|
|
2
|
+
|
|
3
|
+
import static com.tencent.extend.views.fastlist.Utils.ROUGH_PERFORMANCE_MEDIUM;
|
|
4
|
+
import static com.tencent.extend.views.fastlist.Utils.getRoughPerformance;
|
|
5
|
+
|
|
6
|
+
import android.annotation.SuppressLint;
|
|
7
|
+
import android.content.Context;
|
|
8
|
+
import android.graphics.Canvas;
|
|
9
|
+
import android.graphics.Color;
|
|
10
|
+
import android.graphics.Paint;
|
|
11
|
+
import android.graphics.Rect;
|
|
12
|
+
import android.graphics.RectF;
|
|
13
|
+
import android.os.Build;
|
|
14
|
+
import android.support.v4.util.ArrayMap;
|
|
15
|
+
import android.text.TextUtils;
|
|
16
|
+
import android.util.Log;
|
|
17
|
+
import android.util.SparseArray;
|
|
18
|
+
import android.view.View;
|
|
19
|
+
import android.view.ViewGroup;
|
|
20
|
+
|
|
21
|
+
import android.support.annotation.NonNull;
|
|
22
|
+
import android.support.annotation.Nullable;
|
|
23
|
+
import android.support.v7.widget.RecyclerView;
|
|
24
|
+
|
|
25
|
+
import com.tencent.extend.AutoFocusManager;
|
|
26
|
+
import com.tencent.extend.FocusManagerModule;
|
|
27
|
+
import com.tencent.extend.pm.IPageRootView;
|
|
28
|
+
import com.tencent.extend.views.ExtendTag;
|
|
29
|
+
import com.tencent.extend.views.IRecyclerItemView;
|
|
30
|
+
import com.tencent.extend.views.JSEventHandleView;
|
|
31
|
+
import com.tencent.extend.views.TVTextView;
|
|
32
|
+
import com.tencent.mtt.hippy.FocusDispatchView;
|
|
33
|
+
import com.tencent.mtt.hippy.HippyEngineContext;
|
|
34
|
+
import com.tencent.mtt.hippy.HippyInstanceContext;
|
|
35
|
+
import com.tencent.mtt.hippy.HippyRootView;
|
|
36
|
+
import com.tencent.mtt.hippy.R;
|
|
37
|
+
import com.tencent.mtt.hippy.common.HippyArray;
|
|
38
|
+
import com.tencent.mtt.hippy.common.HippyMap;
|
|
39
|
+
import com.tencent.mtt.hippy.dom.DomUpdateManager;
|
|
40
|
+
import com.tencent.mtt.hippy.dom.flex.FlexConstants;
|
|
41
|
+
import com.tencent.mtt.hippy.dom.node.DomNode;
|
|
42
|
+
import com.tencent.mtt.hippy.dom.node.NodeProps;
|
|
43
|
+
import com.tencent.mtt.hippy.dom.node.StyleNode;
|
|
44
|
+
import com.tencent.mtt.hippy.uimanager.ControllerManager;
|
|
45
|
+
import com.tencent.mtt.hippy.uimanager.CustomControllerHelper;
|
|
46
|
+
import com.tencent.mtt.hippy.uimanager.DiffUtils;
|
|
47
|
+
import com.tencent.mtt.hippy.uimanager.HippyViewController;
|
|
48
|
+
import com.tencent.mtt.hippy.uimanager.HippyViewEvent;
|
|
49
|
+
import com.tencent.mtt.hippy.uimanager.RenderNode;
|
|
50
|
+
import com.tencent.mtt.hippy.utils.ExtendUtil;
|
|
51
|
+
import com.tencent.mtt.hippy.utils.LogUtils;
|
|
52
|
+
import com.tencent.mtt.hippy.utils.PixelUtil;
|
|
53
|
+
import com.tencent.mtt.hippy.views.image.HippyImageView;
|
|
54
|
+
import com.tencent.mtt.hippy.views.image.HippyImageViewController;
|
|
55
|
+
import com.tencent.mtt.hippy.views.image.IImageStateListener;
|
|
56
|
+
import com.tencent.mtt.hippy.views.view.HippyViewGroup;
|
|
57
|
+
import com.tencent.smtt.flexbox.FlexNodeStyle;
|
|
58
|
+
|
|
59
|
+
import java.util.ArrayList;
|
|
60
|
+
import java.util.HashMap;
|
|
61
|
+
import java.util.List;
|
|
62
|
+
import java.util.Map;
|
|
63
|
+
import java.util.Set;
|
|
64
|
+
|
|
65
|
+
public class FastAdapter extends RecyclerView.Adapter<FastAdapter.Holder> {
|
|
66
|
+
|
|
67
|
+
HippyArray dataList;
|
|
68
|
+
ListNode listNode;
|
|
69
|
+
Map<Integer, RenderNode> templateNodes;
|
|
70
|
+
Map<Integer, RenderNode> itemStoreNodes;
|
|
71
|
+
|
|
72
|
+
HippyEngineContext context;
|
|
73
|
+
Context viewContext;
|
|
74
|
+
|
|
75
|
+
static Map<String, CachePool> gSharedCachePools;
|
|
76
|
+
|
|
77
|
+
DomUpdateManager<ElementNode> domUpdateManager;
|
|
78
|
+
|
|
79
|
+
FastFlexView mBoundFlexView;
|
|
80
|
+
FastListView mBoundListView;
|
|
81
|
+
FastListView mRootListView;
|
|
82
|
+
int rootListNodeID = -1;
|
|
83
|
+
|
|
84
|
+
String mShareItemStoreName = null;
|
|
85
|
+
|
|
86
|
+
FocusDispatchView rootView;
|
|
87
|
+
View pageRootView;
|
|
88
|
+
int postDelay = 200;
|
|
89
|
+
int placeholderPostDelay = 100;
|
|
90
|
+
int placeholderBackgroundColor;
|
|
91
|
+
float placeholderFocusScale = FocusManagerModule.defaultPlaceholderFocusScale;
|
|
92
|
+
float placeholderBorderRadius = 0;
|
|
93
|
+
|
|
94
|
+
private String mUserKeyName = null;
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
public void setShareItemStoreName(String mShareItemStoreName) {
|
|
100
|
+
this.mShareItemStoreName = mShareItemStoreName;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
EventDeliverer eventDeliverer;
|
|
104
|
+
//默认嵌套子List的placeholder是否开启
|
|
105
|
+
public static boolean CHILD_LIST_PLACEHOLDER_ENABLE = false;
|
|
106
|
+
|
|
107
|
+
//发送事件时,是否传递item数据
|
|
108
|
+
private boolean isEventSendItem = true;
|
|
109
|
+
|
|
110
|
+
private boolean enablePlaceholder = false;
|
|
111
|
+
|
|
112
|
+
static int rough_performance_level = -1;
|
|
113
|
+
|
|
114
|
+
ArrayMap<Integer,Holder> mDetachedChildren;
|
|
115
|
+
|
|
116
|
+
boolean isInfiniteLoop = false;
|
|
117
|
+
|
|
118
|
+
//10,0000,0000
|
|
119
|
+
final static int INFINITE_START_POSITION = 1000000000;
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
private boolean isInfiniteLoopEnabled(){
|
|
123
|
+
return isInfiniteLoop;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
public static RenderNode findRenderNodeFromView(View v) {
|
|
127
|
+
if (v == null) {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
if (v instanceof ItemContainer) {
|
|
131
|
+
v = ((ItemContainer) v).getContentView();
|
|
132
|
+
}
|
|
133
|
+
Object tag = ExtendTag.getExtendTag(v);
|
|
134
|
+
if (tag instanceof ClonedViewTag) {
|
|
135
|
+
final ClonedViewTag c = (ClonedViewTag) tag;
|
|
136
|
+
return c.originNode;
|
|
137
|
+
}
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
public int getRoughPerformanceLevel(Context context) {
|
|
142
|
+
if(rough_performance_level < 0){
|
|
143
|
+
rough_performance_level = getRoughPerformance(context);
|
|
144
|
+
}
|
|
145
|
+
return rough_performance_level;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
public FastAdapter() {
|
|
149
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
150
|
+
placeholderBackgroundColor = Color.argb(0.1f,1,1,1);
|
|
151
|
+
}else{
|
|
152
|
+
placeholderBackgroundColor = Color.argb((int) ((255 + 0.5) * 0.1f),255,255,255);
|
|
153
|
+
}
|
|
154
|
+
placeholderBorderRadius = 8;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
public static void updateLayoutF(View view, float x, float y, float width, float height) {
|
|
158
|
+
FastAdapterUtil.updateLayout(view, (int) x, (int) y, (int) width, (int) height);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
public void setEnablePlaceholder(boolean enablePlaceholder) {
|
|
163
|
+
this.enablePlaceholder = enablePlaceholder;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
public boolean isEnablePlaceholder() {
|
|
167
|
+
return enablePlaceholder;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
public void setEventSendItem(boolean eventSendItem) {
|
|
171
|
+
isEventSendItem = eventSendItem;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
//item点击事件接口、item焦点事件
|
|
175
|
+
public OnFastItemClickListener onFastItemClickListener;
|
|
176
|
+
public OnFastItemFocusChangeListener onFastItemFocusChangeListener;
|
|
177
|
+
|
|
178
|
+
public static int POST_TASK_CATEGORY_DELAY_LOAD = PostTaskHolder.POST_TASK_CATEGORY_DELAY_LOAD;
|
|
179
|
+
public static int POST_TASK_CATEGORY_UPDATE_LAYOUT = PostTaskHolder.POST_TASK_CATEGORY_UPDATE_LAYOUT;
|
|
180
|
+
public static int POST_TASK_CATEGORY_PLACEHOLDER_TO_CONTENT = PostTaskHolder.POST_TASK_CATEGORY_PLACEHOLDER_TO_CONTENT;
|
|
181
|
+
private static final String CACHE_KEY = "FastCache";
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
public abstract static class FastItemDispatchedClickListener implements OnFastItemClickListener{
|
|
185
|
+
public SparseArray<View.OnClickListener> customClickListener;
|
|
186
|
+
public SparseArray<View.OnLongClickListener> customLongClickListener;
|
|
187
|
+
public SparseArray<View> customViews;
|
|
188
|
+
public boolean onItemClick(View view, int position){
|
|
189
|
+
return false;
|
|
190
|
+
}
|
|
191
|
+
public boolean onItemLongClick(View view, int position){
|
|
192
|
+
return false;
|
|
193
|
+
}
|
|
194
|
+
@Override
|
|
195
|
+
public void onItemClickListener(View view, int position) {
|
|
196
|
+
if(!onItemClick(view, position)){
|
|
197
|
+
if(customClickListener != null){
|
|
198
|
+
final View cv = customViews.get(position);
|
|
199
|
+
final View.OnClickListener lc = this.customClickListener.get(position);
|
|
200
|
+
if(LogUtils.isDebug()) {
|
|
201
|
+
Log.d("DebugClick", "onItemClickListener position:" + position + ",lc:" + (lc != null) + ",cv:" + ExtendUtil.debugViewLite(cv));
|
|
202
|
+
}
|
|
203
|
+
if(lc != null && cv != null) {
|
|
204
|
+
lc.onClick(cv);
|
|
205
|
+
}
|
|
206
|
+
}else{
|
|
207
|
+
Log.e("DebugClick","onItemClick error customClickListener is null,view:"+view+",position:"+position);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
public void putClickListener(int position,View view, View.OnClickListener clickListener,View.OnLongClickListener longClickListener){
|
|
212
|
+
if (customClickListener == null) {
|
|
213
|
+
customClickListener = new SparseArray<>();
|
|
214
|
+
}
|
|
215
|
+
if (customLongClickListener == null) {
|
|
216
|
+
customLongClickListener = new SparseArray<>();
|
|
217
|
+
}
|
|
218
|
+
if (customViews == null) {
|
|
219
|
+
customViews = new SparseArray<>();
|
|
220
|
+
}
|
|
221
|
+
if(LogUtils.isDebug()){
|
|
222
|
+
Log.d("DebugClick","putClickListener position:"+position+",view:"+ExtendUtil.debugViewLite(view)+
|
|
223
|
+
",clickListener:"+clickListener+",longClickListener:"+longClickListener);
|
|
224
|
+
}
|
|
225
|
+
customViews.put(position,view);
|
|
226
|
+
customClickListener.put(position,clickListener);
|
|
227
|
+
customLongClickListener.put(position,longClickListener);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
@Override
|
|
231
|
+
public boolean onItemLongClickListener(View view, int position) {
|
|
232
|
+
if(!onItemLongClick(view,position)){
|
|
233
|
+
if(customLongClickListener != null){
|
|
234
|
+
final View.OnLongClickListener lc = customLongClickListener.get(position);
|
|
235
|
+
final View cv = customViews.get(position);
|
|
236
|
+
return lc != null && cv != null && lc.onLongClick(cv);
|
|
237
|
+
}else{
|
|
238
|
+
Log.e("DebugClick","onItemLongClick error customLongClickListener is null,view:"+view+",position:"+position);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return false;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
public void dispose(){
|
|
245
|
+
if (customClickListener != null) {
|
|
246
|
+
customClickListener.clear();
|
|
247
|
+
customClickListener = null;
|
|
248
|
+
}
|
|
249
|
+
if (customLongClickListener != null) {
|
|
250
|
+
customLongClickListener.clear();
|
|
251
|
+
customLongClickListener = null;
|
|
252
|
+
}
|
|
253
|
+
if (customViews != null) {
|
|
254
|
+
customViews.clear();
|
|
255
|
+
customViews = null;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
public ControllerManager getControllerManager() {
|
|
261
|
+
assert context != null;
|
|
262
|
+
|
|
263
|
+
return context.getRenderManager().getControllerManager();
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
public static void clearGlobalCache() {
|
|
267
|
+
if (gSharedCachePools != null) {
|
|
268
|
+
gSharedCachePools.clear();
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
public FastPendingView getFastPendingView() {
|
|
273
|
+
return mBoundListView != null ? mBoundListView : mBoundFlexView;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
public int getRootListNodeID() {
|
|
277
|
+
return rootListNodeID;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
private String shareViewPoolType = null;
|
|
281
|
+
// public static final String TAG = "FastAdapter";
|
|
282
|
+
public static final String TAG = "FastListAdapter";
|
|
283
|
+
public static final String TAG_PERFORMANCE = "WorkLOG";
|
|
284
|
+
public static final String TAG_POST = "FastPostTask";
|
|
285
|
+
|
|
286
|
+
void onAttachedToView(FastPendingView view) {
|
|
287
|
+
if (LogUtils.isDebug()) {
|
|
288
|
+
Log.e(TAG, "FastAdapterEvent onAttachToView ,adapter:" + Utils.hashCode(this) + ",view:" + Utils.hashCode(view));
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
void onDetachedFromView(FastPendingView view) {
|
|
295
|
+
if (LogUtils.isDebug()) {
|
|
296
|
+
Log.e(TAG, "FastAdapterEvent onDettachToView ,adapter:" + Utils.hashCode(this) + ",view:" + Utils.hashCode(view));
|
|
297
|
+
}
|
|
298
|
+
clearDetachCaches();
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
public void setShareViewPoolType(String shareViewPoolType) {
|
|
302
|
+
this.shareViewPoolType = shareViewPoolType;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
FastListModule.GlobalConfig globalConfig;
|
|
306
|
+
public void setContext(HippyEngineContext context,Context viewContext) {
|
|
307
|
+
this.context = context;
|
|
308
|
+
this.viewContext = viewContext;
|
|
309
|
+
this.rootView = context.getInstance(HippyRootView.ROOT_VIEW_TAG_INCREMENT);
|
|
310
|
+
if (LogUtils.isDebug()) {
|
|
311
|
+
Log.i(TAG, "DebugPool getCacheWorker init rootView:" + rootView);
|
|
312
|
+
}
|
|
313
|
+
globalConfig = FastListModule.getGlobalConfig(context);
|
|
314
|
+
placeholderBorderRadius = globalConfig.placeholderBorderRadius;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
private void onFixDevicePerformance(int level){
|
|
318
|
+
if(level > ROUGH_PERFORMANCE_MEDIUM){
|
|
319
|
+
placeholderPostDelay = 50;
|
|
320
|
+
}else if(level < ROUGH_PERFORMANCE_MEDIUM){
|
|
321
|
+
placeholderPostDelay = 200;
|
|
322
|
+
}
|
|
323
|
+
if(LogUtils.isDebug()) {
|
|
324
|
+
Log.i(TAG, "fixDevicePerformance level:" + level + ",set placeholderPostDelay:" + placeholderPostDelay);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
public View findClonedViewByTemplateView(int position, View template){
|
|
330
|
+
FastListView list = mBoundListView;
|
|
331
|
+
if(LogUtils.isDebug()) {
|
|
332
|
+
int itemCount = list.getAdapter() == null ? -1 : list.getAdapter().getItemCount();
|
|
333
|
+
Log.i(FastListView.TAG_CLONED, "findClonedViewByTemplateView position:" + position + ",list :" + list+",childCount:"+itemCount+",listID:"+list.getId());
|
|
334
|
+
Log.i(FastListView.TAG_CLONED, "findClonedViewByTemplateView position:" + position + ",findViewByPosition :" + list.findViewByPosition(position));
|
|
335
|
+
}
|
|
336
|
+
RecyclerView.ViewHolder holder = list.findViewHolderForAdapterPosition(position);
|
|
337
|
+
if(holder instanceof FastAdapter.Holder){
|
|
338
|
+
return FastAdapterUtil.findClonedViewByTemplateView(template,((Holder) holder).tag.getRootNode());
|
|
339
|
+
}else{
|
|
340
|
+
Log.e(FastListView.TAG_CLONED,"findClonedViewByTemplateView error holder :"+holder);
|
|
341
|
+
}
|
|
342
|
+
return null;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
public RenderNode getTemplateNodeByType(int viewType){
|
|
346
|
+
if (templateNodes != null) {
|
|
347
|
+
return templateNodes.get(viewType);
|
|
348
|
+
}
|
|
349
|
+
return null;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
View createItemContainerView(ViewGroup parent, int viewType, ViewTag tag, boolean isSingleton, View templateView){
|
|
353
|
+
ElementNode itemNode = tag.getRootNode();
|
|
354
|
+
if (isSingleton) {
|
|
355
|
+
Log.i(TAG,"crateItemContainerView itemNode template :"+itemNode.templateNode+",templateView : "+templateView);
|
|
356
|
+
}
|
|
357
|
+
if(!isSingleton && itemNode.boundView instanceof FastItemView){
|
|
358
|
+
final FastItemView fiv = (FastItemView) itemNode.boundView;
|
|
359
|
+
//Log.i(TAG,"crateItemContainerView tag.getRootNode() :"+tag.getRootNode()+",tag.getRootNode().initConfig.isViewFocusable :"+tag.getRootNode().initConfig.isViewFocusable);
|
|
360
|
+
if(enablePlaceholder) {
|
|
361
|
+
fiv.setEnablePlaceholder(true);
|
|
362
|
+
if(!itemNode.initConfig.disablePlaceholderFocus){
|
|
363
|
+
fiv.setFocusable(tag.getRootNode().initConfig.isViewFocusable);
|
|
364
|
+
fiv.setFocusScale(tag.getRootNode().initConfig.placeholderScale > -1 ? tag.getRootNode().initConfig.placeholderScale : placeholderFocusScale);
|
|
365
|
+
fiv.configPlaceholder(placeholderBackgroundColor, placeholderBorderRadius);
|
|
366
|
+
}
|
|
367
|
+
fiv.setDisablePlaceholderFocus(itemNode.initConfig.disablePlaceholderFocus);
|
|
368
|
+
}
|
|
369
|
+
return fiv;
|
|
370
|
+
}else{
|
|
371
|
+
//这里如果是singleton的view,disablePlaceholder只会将背景颜色去掉,也就是singleton的View一直返回ItemRootView
|
|
372
|
+
boolean disablePlaceholder = tag.getRootNode().initConfig.disablePlaceholder || isSingleton;
|
|
373
|
+
View placeholderView = null;
|
|
374
|
+
String placeholderIcon = tag.getRootNode().initConfig.placeholderIcon == null && globalConfig != null ?
|
|
375
|
+
globalConfig.placeholderIcon : tag.getRootNode().initConfig.placeholderIcon;
|
|
376
|
+
HippyArray placeholderIconSize = tag.getRootNode().initConfig.placeholderIconSize == null && globalConfig != null ?
|
|
377
|
+
globalConfig.placeholderIconSize : tag.getRootNode().initConfig.placeholderIconSize;
|
|
378
|
+
// if (placeholderIcon != null) {
|
|
379
|
+
// placeholderView = new IconPlaceholderView(parent.getContext(),placeholderIcon,viewType, disablePlaceholder ?
|
|
380
|
+
// Color.TRANSPARENT : placeholderBackgroundColor, placeholderBorderRadius, tag.getRootNode().initConfig.placeholderLayout,placeholderIconSize);
|
|
381
|
+
// }else {
|
|
382
|
+
placeholderView = new PendingPlaceHolderView(parent.getContext(),
|
|
383
|
+
viewType, disablePlaceholder ? Color.TRANSPARENT : placeholderBackgroundColor, placeholderBorderRadius, tag.getRootNode().initConfig.placeholderLayout);
|
|
384
|
+
// }
|
|
385
|
+
|
|
386
|
+
final ItemRootView rootView = new ItemRootView(parent.getContext(), viewType, placeholderView, isSingleton,itemNode);
|
|
387
|
+
rootView.setContentView(tag.getRootNode().boundView,isSingleton);
|
|
388
|
+
rootView.setFocusable(tag.getRootNode().initConfig.isViewFocusable && !itemNode.initConfig.disablePlaceholderFocus);
|
|
389
|
+
// final float rootNodeFocusScale = itemNode.getTemplateNode()
|
|
390
|
+
|
|
391
|
+
if(!itemNode.initConfig.disablePlaceholderFocus) {
|
|
392
|
+
if(!isSingleton || rootView.isFocusable()) {
|
|
393
|
+
//这里singleton时,当TVItem里潜逃了列表如果setFocusScale移动焦点时会有bug
|
|
394
|
+
rootView.setFocusScale(tag.getRootNode().initConfig.placeholderScale > -1 ? tag.getRootNode().initConfig.placeholderScale : placeholderFocusScale);
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
return rootView;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
@NonNull
|
|
402
|
+
@Override
|
|
403
|
+
public Holder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
|
404
|
+
assert (templateNodes != null);
|
|
405
|
+
final RenderNode node = templateNodes.get(viewType);
|
|
406
|
+
|
|
407
|
+
if (LogUtils.isDebug()) {
|
|
408
|
+
Log.e(TAG, "FastAdapterAttach FastAdapterEvent DebugPool onCreateViewHolder NewOne viewType:" + viewType + ",this:" + Utils.hashCode(this));
|
|
409
|
+
}
|
|
410
|
+
Holder holder;
|
|
411
|
+
View view = null;
|
|
412
|
+
final ViewTag tag = new ViewTag(node);
|
|
413
|
+
boolean singleton = false;
|
|
414
|
+
int width = 0;
|
|
415
|
+
int height = 0;
|
|
416
|
+
if (node == null) {
|
|
417
|
+
Log.e(TAG,"没有注册对应的item,itemType:" + viewType);
|
|
418
|
+
}else{
|
|
419
|
+
width = node.getWidth();
|
|
420
|
+
height = node.getHeight();
|
|
421
|
+
View templateView = Utils.findBoundView(context, node);
|
|
422
|
+
if (templateView != null) {
|
|
423
|
+
if(LogUtils.isDebug()){
|
|
424
|
+
Log.v(TAG,"node valid,templateView valid,viewType:"+viewType+",nodeClass "+node.getClassName()+",id:"+node.getId());
|
|
425
|
+
}
|
|
426
|
+
singleton = Utils.containKey(node, Utils.KEY_SINGLETON);
|
|
427
|
+
if (templateView instanceof FastItemView) {
|
|
428
|
+
if (mBoundListView != null) {
|
|
429
|
+
((FastItemView) templateView).setParentListView(mBoundListView);
|
|
430
|
+
} else {
|
|
431
|
+
((FastItemView) templateView).setParentFlexView(mBoundFlexView);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
if (singleton) {
|
|
435
|
+
if (LogUtils.isDebug()) {
|
|
436
|
+
Log.e(TAG, "SingleItem view node:" + node);
|
|
437
|
+
}
|
|
438
|
+
//view = templateView;
|
|
439
|
+
tag.getRootNode().onNodeInitOnSingleton(node);
|
|
440
|
+
view = createItemContainerView(parent,viewType,tag,true,templateView);
|
|
441
|
+
config4SingleItem(tag, view, node);
|
|
442
|
+
} else {
|
|
443
|
+
//创建所有节点
|
|
444
|
+
createAllElementNodeRecursive(node, tag, null);
|
|
445
|
+
//使用模版将所有view创建,如果placeholder激活则只创建部分view
|
|
446
|
+
createViewRecursiveOnCreateViewHolder(tag.getRootNode(),null);
|
|
447
|
+
//view = tag.getRootNode().boundView;
|
|
448
|
+
boolean enablePlaceholder = this.enablePlaceholder;
|
|
449
|
+
if(enablePlaceholder){
|
|
450
|
+
if(LogUtils.isDebug()) {
|
|
451
|
+
Log.d(TAG, "onCreateViewHolder create ItemRootView type:" + viewType+",hasNestList:"+tag.getRootNode().initConfig.hasNestList+",node class:"+node.getClassName());
|
|
452
|
+
}
|
|
453
|
+
if(tag.getRootNode().initConfig.hasNestList){
|
|
454
|
+
//如果itemView中包含tvList、fastFlexView等,则不创建placeholder
|
|
455
|
+
view = tag.getRootNode().boundView;
|
|
456
|
+
}else if(tag.getRootNode().initConfig.disablePlaceholder){
|
|
457
|
+
if(LogUtils.isDebug()) {
|
|
458
|
+
Log.d(TAG, "onCreateViewHolder use boundView when disablePlaceholder viewType:"+viewType);
|
|
459
|
+
}
|
|
460
|
+
view = tag.getRootNode().boundView;
|
|
461
|
+
}else{
|
|
462
|
+
if(node.getChildCount() < 1 && tag.getRootNode().boundView instanceof HippyViewGroup){
|
|
463
|
+
//这种情况下代表一个空的div,没必要再添加placeholder
|
|
464
|
+
if(LogUtils.isDebug()) {
|
|
465
|
+
Log.d(TAG, "onCreateViewHolder use boundView when node.getChildCount() < 1 viewType:"+viewType);
|
|
466
|
+
}
|
|
467
|
+
view = tag.getRootNode().boundView;
|
|
468
|
+
}else{
|
|
469
|
+
view = createItemContainerView(parent,viewType,tag,false,templateView);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
}else{
|
|
473
|
+
if(LogUtils.isDebug()) {
|
|
474
|
+
Log.d(TAG, "onCreateViewHolder use boundView type:" + viewType + ",boundView:" + tag.getRootNode().boundView);
|
|
475
|
+
}
|
|
476
|
+
view = tag.getRootNode().boundView;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}else{
|
|
480
|
+
Log.e(TAG,"onCreateViewHolder error on 确定type为:"+viewType+"的模版已经设置,node:"+node);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
if (view == null) {
|
|
484
|
+
Log.e(TAG,"创建view holder失败,node is "+node);
|
|
485
|
+
view = new ErrorPlaceHolderView(parent.getContext(),viewType);
|
|
486
|
+
holder = new Holder(view, tag, viewType, false);
|
|
487
|
+
holder.isErrorView = true;
|
|
488
|
+
}else{
|
|
489
|
+
holder = new Holder(view, tag, viewType, singleton);
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
view.setLayoutParams(new RecyclerView.LayoutParams(width, height));
|
|
493
|
+
if (view instanceof IRecyclerItemView){
|
|
494
|
+
((IRecyclerItemView)view).setJSEventViewID(node.getId());
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
if (holder.itemView instanceof IRecyclerItemView) {
|
|
498
|
+
//通知
|
|
499
|
+
IRecyclerItemView itemView = (IRecyclerItemView) holder.itemView;
|
|
500
|
+
itemView.onCreate(getRootListView());
|
|
501
|
+
}
|
|
502
|
+
return holder;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
void config4SingleItem(ViewTag tag, View view, RenderNode node) {
|
|
506
|
+
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
@Override
|
|
510
|
+
public long getItemId(int position) {
|
|
511
|
+
if (!TextUtils.isEmpty(mUserKeyName)) {
|
|
512
|
+
HippyMap map = FastAdapterUtil.getRawItemFromFastList(getRawObject(position));
|
|
513
|
+
if (map != null) {
|
|
514
|
+
Object id = map.get(mUserKeyName);
|
|
515
|
+
if (id != null) {
|
|
516
|
+
// Log.d("DebugUpdate","getItemID:"+id+",position:"+position+",list:"+ExtendUtil.debugViewLite(mBoundListView));
|
|
517
|
+
return id.hashCode();
|
|
518
|
+
}else {
|
|
519
|
+
long superID = super.getItemId(position);
|
|
520
|
+
// Log.e("DebugUpdate","getItemID by super:"+superID+",position:"+position+",list:"+ExtendUtil.debugViewLite(mBoundListView));
|
|
521
|
+
return superID;
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
final Object id = getIDFromData(position);
|
|
526
|
+
if(id instanceof String){
|
|
527
|
+
return id.hashCode();
|
|
528
|
+
}
|
|
529
|
+
return super.getItemId(position);
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
@Override
|
|
533
|
+
public void onViewRecycled(@NonNull Holder holder) {
|
|
534
|
+
if (LogUtils.isDebug()) {
|
|
535
|
+
Log.e(TAG, "postAllDelayContent BindEvent onViewRecycled holder:" + Utils.hashCode(holder) + ",holderParent:" + holder.itemView.getParent());
|
|
536
|
+
Log.e(TAG_POST, "PlaceholderToContent BindEvent onViewRecycled holder:" + Utils.hashCode(holder) + ",tag:" + holder.itemView.getTag());
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
if(holder.tag != null ){
|
|
540
|
+
if (holder.tag.getRootNode() != null) {
|
|
541
|
+
holder.tag.getRootNode().recycled = true;
|
|
542
|
+
holder.tag.getRootNode().clearPostTask();
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
if(holder.isErrorView){
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
//已经Recycled的任务,无需再执行
|
|
550
|
+
if (holder.postTask != null) {
|
|
551
|
+
holder.postTask.cancel = true;
|
|
552
|
+
}
|
|
553
|
+
//getRootListView().clearTask(POST_TASK_CATEGORY_PLACEHOLDER_TO_CONTENT,holder.itemView.hashCode());
|
|
554
|
+
|
|
555
|
+
final int pos = holder.getAdapterPosition() > -1 ? holder.getAdapterPosition() : holder.adapterPosition;
|
|
556
|
+
removeDetached(pos);
|
|
557
|
+
if (LogUtils.isDebug()) {
|
|
558
|
+
Log.v(TAG, "FastAdapterAttach BindEvent DebugPool onViewRecycled in FastAdapter holder type:" + holder.type + ",view:" + Utils.hashCode(holder.itemView) + ",pos:" + pos);
|
|
559
|
+
}
|
|
560
|
+
super.onViewRecycled(holder);
|
|
561
|
+
holder.reset();
|
|
562
|
+
// recycleItem(holder);
|
|
563
|
+
if (isListenBoundEvent) {
|
|
564
|
+
sendUnBindEvent(rootListNodeID, pos, holder);
|
|
565
|
+
}
|
|
566
|
+
if (holder.singleton) {
|
|
567
|
+
sendUnBindEvent4singleton(holder, pos);
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
if (holder.itemView instanceof IRecyclerItemView) {
|
|
571
|
+
//通知
|
|
572
|
+
IRecyclerItemView itemView = (IRecyclerItemView) holder.itemView;
|
|
573
|
+
final ItemEntity ie = getItemEntity(pos);
|
|
574
|
+
itemView.onUnBind(getRootListView(), pos, ie == null ? null : ie.raw);
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
|
|
579
|
+
private static void changeVisibility(ElementNode node, boolean b) {
|
|
580
|
+
if (node != null && node.boundView != null) {
|
|
581
|
+
node.boundView.setAlpha(b ? 1 : 0);
|
|
582
|
+
// node.boundView.setVisibility(b ? View.VISIBLE : View.INVISIBLE);
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
void dealDelayContent(Holder holder, int position) {
|
|
587
|
+
final ViewTag vt = holder.tag;
|
|
588
|
+
|
|
589
|
+
if (LogUtils.isDebug()) {
|
|
590
|
+
Log.i(TAG_POST, "FastAdapterEvent before dealDelayContent pos:" + position + ",rootElement:" + vt.getRootNode() + ",itemView:" + holder.itemView);
|
|
591
|
+
}
|
|
592
|
+
if (position > -1) {
|
|
593
|
+
final ElementNode itemENode = vt.getRootNode();
|
|
594
|
+
if (vt.enableLoadDelay) {
|
|
595
|
+
if (LogUtils.isDebug()) {
|
|
596
|
+
Log.e(TAG, "FastAdapterEvent post dealDelayContent pos:" + position + ",enablePlaceHolder:" + true + ",viewCreated:" + false);
|
|
597
|
+
}
|
|
598
|
+
postAllDelayContent(vt, itemENode, holder, position);
|
|
599
|
+
}
|
|
600
|
+
} else {
|
|
601
|
+
if (LogUtils.isDebug()) {
|
|
602
|
+
Log.e(TAG, "FastAdapterEvent post dealDelayContent pos invalid");
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
|
|
608
|
+
static int getHolderTaskType(Holder h) {
|
|
609
|
+
return h.hashCode();
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
public void clearPostTask(Holder holder) {
|
|
613
|
+
if (getRootListView() != null) {
|
|
614
|
+
ViewTag vt = holder.tag;
|
|
615
|
+
if (vt.getDelayLoadNodes() != null) {
|
|
616
|
+
if(LogUtils.isDebug()) {
|
|
617
|
+
Log.e(TAG_POST, "PlaceholderToContent clearPostTask position:" + holder.adapterPosition+",tag:"+holder.itemView.getTag());
|
|
618
|
+
}
|
|
619
|
+
getRootListView().clearTask(POST_TASK_CATEGORY_PLACEHOLDER_TO_CONTENT, holder.itemView.hashCode());
|
|
620
|
+
for (int i = 0; i < vt.getDelayLoadNodes().size(); i++) {
|
|
621
|
+
final ElementNode en = vt.getDelayLoadNodes().get(i);
|
|
622
|
+
int pType = getUpdateLayoutType(en);
|
|
623
|
+
getRootListView().clearTask(POST_TASK_CATEGORY_DELAY_LOAD, pType);
|
|
624
|
+
getRootListView().clearTask(POST_TASK_CATEGORY_UPDATE_LAYOUT, pType);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
@Override
|
|
631
|
+
public void onViewAttachedToWindow(@NonNull Holder holder) {
|
|
632
|
+
if(holder.isErrorView){
|
|
633
|
+
return;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
|
|
637
|
+
ViewTag vt = holder.tag;
|
|
638
|
+
final int position = vt.domNode != null ? vt.domNode.adapterPosition : -1;
|
|
639
|
+
|
|
640
|
+
final ItemEntity ie = getItemEntity(position);
|
|
641
|
+
|
|
642
|
+
if (LogUtils.isDebug()) {
|
|
643
|
+
Log.w(TAG, "postAllDelayContent FastAdapterAttach onViewAttachedToWindow holder: "
|
|
644
|
+
+ Utils.hashCode(holder) + ",pos:" + holder.getAdapterPosition()
|
|
645
|
+
+ ",type:"+holder.getItemViewType()
|
|
646
|
+
+",attached:"+holder.attached +",hasOnBind:"+holder.hasOnBind+",patched:"+holder.patched+ ",view:" + holder.itemView);
|
|
647
|
+
Log.i(TAG_POST, "PlaceholderToContent ++++++++onViewAttachedToWindow position:" + position+",holder.itemView.hashCode():"+holder.itemView.hashCode()+",tag:"+holder.itemView.getTag()+",enablePlaceholder:"+enablePlaceholder);
|
|
648
|
+
}
|
|
649
|
+
//attach之前如果textView是marquee状态,先手动layout,避免重新setText位置不正确问题
|
|
650
|
+
holder.resetTextView();
|
|
651
|
+
holder.attached = true;
|
|
652
|
+
// if(holder.boundPos > -1){
|
|
653
|
+
// doPatch(holder,holder.boundPos);
|
|
654
|
+
// }
|
|
655
|
+
|
|
656
|
+
FastAdapterUtil.notifyAttachToParent(getContentView(holder));
|
|
657
|
+
|
|
658
|
+
if(!this.enablePlaceholder){
|
|
659
|
+
dealDelayContent(holder, position);
|
|
660
|
+
}else{
|
|
661
|
+
//这里在onBind中已经执行,无需在这里requestPlaceholderToContent
|
|
662
|
+
// Object data = getRawObject(position);
|
|
663
|
+
// if(data instanceof HippyMap) {
|
|
664
|
+
// requestPlaceholderToContent(holder, vt.domNode, position, (HippyMap) data);
|
|
665
|
+
// }
|
|
666
|
+
}
|
|
667
|
+
sendEvent4Singleton(holder, holder.adapterPosition, "onAttachedToWindow");
|
|
668
|
+
if (isListenBoundEvent) {
|
|
669
|
+
sendAdapterEvent(rootListNodeID, position, listNode.getNode(), holder, "onAttachedToWindow");
|
|
670
|
+
}
|
|
671
|
+
super.onViewAttachedToWindow(holder);
|
|
672
|
+
|
|
673
|
+
if (holder.itemView instanceof IRecyclerItemView) {
|
|
674
|
+
//通知
|
|
675
|
+
IRecyclerItemView itemView = (IRecyclerItemView) holder.itemView;
|
|
676
|
+
//final ItemEntity ie = getItemEntity(position);
|
|
677
|
+
itemView.onAttachToWindow(getRootListView(), position, ie == null ? null : ie.raw);
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
Context context = holder.itemView.getContext();
|
|
681
|
+
if(context instanceof HippyInstanceContext){
|
|
682
|
+
final View contentView = getContentView(holder);
|
|
683
|
+
String id = null;
|
|
684
|
+
if(contentView != null) {
|
|
685
|
+
id = ExtendUtil.getViewSID(contentView);
|
|
686
|
+
}
|
|
687
|
+
// Log.i(AutoFocusManager.TAG,"FastList onAttachToWindow name:"+id+",pos:"+position+",view:"+holder.itemView);
|
|
688
|
+
if(getRootListView() != null) {
|
|
689
|
+
//RenderNode renderNode = getRenderNode(getRootListView());
|
|
690
|
+
if(pageRootView == null){
|
|
691
|
+
pageRootView = HippyViewGroup.findPageRootView(getRootListView());
|
|
692
|
+
}
|
|
693
|
+
// if(pageRootView instanceof HippyViewGroup) {
|
|
694
|
+
// ((HippyViewGroup) pageRootView).getAutoFocusManager().checkAndRequestAutoFocus(holder.itemView, id);
|
|
695
|
+
// }else{
|
|
696
|
+
// Log.e(AutoFocusManager.TAG,"checkAndRequestAutoFocus error on renderNode is null,pageRootView :"+pageRootView);
|
|
697
|
+
// }
|
|
698
|
+
}else{
|
|
699
|
+
if(LogUtils.isDebug()) {
|
|
700
|
+
Log.e(AutoFocusManager.TAG, "checkAndRequestAutoFocus error on renderNode is null,getRootListView() :" + getRootListView());
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
}else{
|
|
704
|
+
if(LogUtils.isDebug()) {
|
|
705
|
+
Log.i(AutoFocusManager.TAG, "checkAndRequestAutoFocus context error 22 onAttachToWindow ,context:" + context);
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
//final ItemEntity ie = getItemEntity(position);
|
|
710
|
+
// if (ie != null && ie.updateItemDirty) {
|
|
711
|
+
// Log.e("DebugReplaceItem","onAttachToWindow when updateItemDirty "+ie.raw);
|
|
712
|
+
// updateItemOnReplace(holder,position,false);
|
|
713
|
+
// }
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
public static View getContentView(Holder holder){
|
|
717
|
+
if (holder.itemView instanceof ItemContainer) {
|
|
718
|
+
return ((ItemContainer) holder.itemView).getContentView();
|
|
719
|
+
}
|
|
720
|
+
return holder.itemView;
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
public static HippyMap getUnWrappedItem(Object item){
|
|
724
|
+
if(item instanceof HippyMap){
|
|
725
|
+
return (HippyMap) item;
|
|
726
|
+
}else if(item instanceof ItemEntity){
|
|
727
|
+
return ((ItemEntity)item).getMap();
|
|
728
|
+
}
|
|
729
|
+
return null;
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
@Override
|
|
733
|
+
public void onViewDetachedFromWindow(@NonNull Holder holder) {
|
|
734
|
+
if(holder.isErrorView){
|
|
735
|
+
return;
|
|
736
|
+
}
|
|
737
|
+
if (LogUtils.isDebug()) {
|
|
738
|
+
Log.e(TAG, "postAllDelayContent onViewDetachedFromWindow holder: " + Utils.hashCode(holder));
|
|
739
|
+
Log.i(TAG_POST, "PlaceholderToContent ________onViewDetachedFromWindow position:" + holder.adapterPosition+",holder.itemView.hashCode():"+holder.itemView.hashCode());
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
|
|
743
|
+
holder.attached = false;
|
|
744
|
+
holder.patched = false;
|
|
745
|
+
int position = holder.adapterPosition;
|
|
746
|
+
//clearPostTask(holder);
|
|
747
|
+
FastAdapterUtil.notifyDetachFromParent(getContentView(holder));
|
|
748
|
+
sendEvent4Singleton(holder, holder.adapterPosition, "onDetachedFromWindow");
|
|
749
|
+
if (holder.tag != null && isListenBoundEvent) {
|
|
750
|
+
position = holder.tag.domNode != null ? holder.tag.domNode.adapterPosition : -1;
|
|
751
|
+
sendAdapterEvent(rootListNodeID, position, listNode.getNode(), holder, "onDetachedFromWindow");
|
|
752
|
+
}
|
|
753
|
+
// recycleItem(holder);
|
|
754
|
+
super.onViewDetachedFromWindow(holder);
|
|
755
|
+
|
|
756
|
+
if (holder.itemView instanceof IRecyclerItemView) {
|
|
757
|
+
//通知
|
|
758
|
+
IRecyclerItemView itemView = (IRecyclerItemView) holder.itemView;
|
|
759
|
+
final ItemEntity ie = getItemEntity(holder.adapterPosition);
|
|
760
|
+
itemView.onDetachFromWindow(getRootListView(), holder.adapterPosition, ie == null ? null : ie.raw);
|
|
761
|
+
}
|
|
762
|
+
cacheDetach(position,holder);
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
private void cacheDetach(int pos,Holder holder){
|
|
766
|
+
if (mDetachedChildren == null) {
|
|
767
|
+
mDetachedChildren = new ArrayMap<>();
|
|
768
|
+
}
|
|
769
|
+
mDetachedChildren.put(pos,holder);
|
|
770
|
+
if(LogUtils.isDebug()) {
|
|
771
|
+
Log.d("DebugReplaceItem", "++cacheDetach pos:" + pos + ",total:" + mDetachedChildren.size());
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
public ArrayMap<Integer, Holder> getDetachedChildren() {
|
|
776
|
+
return mDetachedChildren;
|
|
777
|
+
}
|
|
778
|
+
public void removeDetached(int pos){
|
|
779
|
+
if (mDetachedChildren != null) {
|
|
780
|
+
mDetachedChildren.remove(pos);
|
|
781
|
+
if(LogUtils.isDebug()) {
|
|
782
|
+
Log.d("DebugReplaceItem","--removeDetached pos:"+pos+",total:"+mDetachedChildren.size());
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
void clearDetachCaches(){
|
|
788
|
+
if (mDetachedChildren != null) {
|
|
789
|
+
mDetachedChildren.clear();
|
|
790
|
+
mDetachedChildren = null;
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
public void setBoundListView(FastListView fastListView) {
|
|
795
|
+
mBoundListView = fastListView;
|
|
796
|
+
if (LogUtils.isDebug()) {
|
|
797
|
+
Log.i(TAG, "setBoundListView:" + mBoundListView);
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
public void setBoundFLexView(FastFlexView fastFlexView) {
|
|
802
|
+
mBoundFlexView = fastFlexView;
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
public void setRootList(FastListView fastListView, FastAdapter parentAdapter) {
|
|
806
|
+
mRootListView = fastListView;
|
|
807
|
+
if (LogUtils.isDebug()) {
|
|
808
|
+
Log.i(TAG, "setRootListView:" + mRootListView + ",parentAdapter:" + parentAdapter + ",this:" + this);
|
|
809
|
+
}
|
|
810
|
+
if (parentAdapter != null && parentAdapter.itemStoreNodes != null) {
|
|
811
|
+
if (LogUtils.isDebug()) {
|
|
812
|
+
Log.i(TAG, "setRootListView putTemplate :" + parentAdapter.itemStoreNodes.size());
|
|
813
|
+
}
|
|
814
|
+
//parentAdapter.putTemplate(parentAdapter.itemStoreNodes);
|
|
815
|
+
this.itemStoreNodes = parentAdapter.itemStoreNodes;
|
|
816
|
+
}
|
|
817
|
+
onFixDevicePerformance(getRoughPerformanceLevel(fastListView.getContext()));
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
FastListView getRootListView() {
|
|
821
|
+
return mRootListView != null ? mRootListView : mBoundListView;
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
FastPendingView getCacheRootView() {
|
|
825
|
+
return getRootListView() != null ? getRootListView() : getFastPendingView();
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
public void setListNode(ListNode listNode) {
|
|
829
|
+
this.listNode = listNode;
|
|
830
|
+
if (listNode.getBoundTag() == null) {
|
|
831
|
+
listNode.setBoundTag(new ListNodeTag());
|
|
832
|
+
}
|
|
833
|
+
domUpdateManager = new DomUpdateManager<>();
|
|
834
|
+
buildTemplate();
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
int getDefaultItemType() {
|
|
838
|
+
return hashCode();
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
public static int DEFAULT_ITEM_TYPE = 0;
|
|
842
|
+
public static int TYPE_HEADER = 1001;//header类型
|
|
843
|
+
public static int TYPE_FOOTER = 1002;//footer类型
|
|
844
|
+
public static int TYPE_ONE_LINE = 1003;//一行展示类型
|
|
845
|
+
public static int TYPE_EMPTY = 1004;//一行展示类型 空view
|
|
846
|
+
public static int TYPE_SPAN_COUNT_TWO = 10002;//spanCount 2布局类型
|
|
847
|
+
public static int TYPE_SPAN_COUNT_THREE = 10003;//spanCount 3布局类型
|
|
848
|
+
public static int TYPE_SPAN_COUNT_FOUR = 10004;//spanCount 4布局类型
|
|
849
|
+
public static int TYPE_SPAN_COUNT_FIVE = 10005;//spanCount 5布局类型
|
|
850
|
+
public static int TYPE_SPAN_COUNT_SIX = 10006;//spanCount 6布局类型
|
|
851
|
+
|
|
852
|
+
public void putTemplate(Map<Integer, RenderNode> tm) {
|
|
853
|
+
if (tm != null && tm.size() > 0) {
|
|
854
|
+
if (templateNodes == null) {
|
|
855
|
+
templateNodes = new HashMap<>();
|
|
856
|
+
}
|
|
857
|
+
templateNodes.putAll(tm);
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
void buildTemplate() {
|
|
862
|
+
if (LogUtils.isDebug()) {
|
|
863
|
+
Log.d(TAG, "buildTemplate called this: " + this);
|
|
864
|
+
}
|
|
865
|
+
assert (listNode != null);
|
|
866
|
+
if (templateNodes == null) {
|
|
867
|
+
templateNodes = new HashMap<>();
|
|
868
|
+
} else {
|
|
869
|
+
templateNodes.clear();
|
|
870
|
+
}
|
|
871
|
+
if (mShareItemStoreName != null) {
|
|
872
|
+
//2024.09.08 这里添加共享的itemNode,共享的itemStore如果遇到type冲突,会被覆盖
|
|
873
|
+
final RenderNode windowRootNode = listNode.getNode().getWindowRootNode();
|
|
874
|
+
if (windowRootNode != null) {
|
|
875
|
+
final RenderNode sharedNode = ExtendUtil.findRenderNodeByName(mShareItemStoreName,windowRootNode);
|
|
876
|
+
if (sharedNode != null) {
|
|
877
|
+
if (LogUtils.isDebug()) {
|
|
878
|
+
Log.d(TAG, "build Shared Template sharedNode:" + sharedNode);
|
|
879
|
+
}
|
|
880
|
+
final Map<Integer, RenderNode> sharedTemplate = ItemStoreNode.buildItemStoreTemplate((ItemStoreNode) sharedNode);
|
|
881
|
+
if (LogUtils.isDebug()) {
|
|
882
|
+
Log.i(TAG, "buildTemplate put all Shared Template this: " + this + ",mBoundListView:" + mBoundListView);
|
|
883
|
+
for (Map.Entry<Integer, RenderNode> e : sharedTemplate.entrySet()) {
|
|
884
|
+
Log.i(TAG, "buildTemplate put Shared itemNode itemType: " + e.getKey());
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
templateNodes.putAll(sharedTemplate);
|
|
888
|
+
}else{
|
|
889
|
+
Log.e(TAG, "build Shared Template error sharedNode is null mShareItemStoreName:" + mShareItemStoreName);
|
|
890
|
+
}
|
|
891
|
+
}else{
|
|
892
|
+
Log.e(TAG, "build Shared Template error windowRootNode is null mShareItemStoreName:" + mShareItemStoreName);
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
for (int i = 0; i < listNode.getChildCount(); i++) {
|
|
896
|
+
final RenderNode child = listNode.getChildAt(i);
|
|
897
|
+
if (child instanceof ItemStoreNode) {
|
|
898
|
+
itemStoreNodes = ItemStoreNode.buildItemStoreTemplate((ItemStoreNode) child);
|
|
899
|
+
//templateNodes.putAll(itemStoreNodes);
|
|
900
|
+
} else {
|
|
901
|
+
if (child.getProps().containsKey("type")) {
|
|
902
|
+
final String childType = child.getProps().getString("type");
|
|
903
|
+
final int type = Integer.parseInt(childType);
|
|
904
|
+
if (LogUtils.isDebug()) {
|
|
905
|
+
Log.d(TAG, "buildTemplate put type:" + type + ",node:" + child);
|
|
906
|
+
}
|
|
907
|
+
templateNodes.put(type, child);
|
|
908
|
+
} else {
|
|
909
|
+
if (LogUtils.isDebug()) {
|
|
910
|
+
Log.d(TAG, "buildTemplate put DefaultType,node:" + child);
|
|
911
|
+
}
|
|
912
|
+
templateNodes.put(getDefaultItemType(), child);
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
if (itemStoreNodes != null) {
|
|
918
|
+
if (LogUtils.isDebug()) {
|
|
919
|
+
Log.i(TAG, "buildTemplate put all itemStoreNodes this: " + this + ",mBoundListView:" + mBoundListView);
|
|
920
|
+
for (Map.Entry<Integer, RenderNode> e : itemStoreNodes.entrySet()) {
|
|
921
|
+
Log.i(TAG, "buildTemplate put itemNode itemType: " + e.getKey());
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
templateNodes.putAll(itemStoreNodes);
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
public Map<Integer, RenderNode> getIteStoreNodes() {
|
|
929
|
+
return itemStoreNodes;
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
Holder findOldCacheView(int type) {
|
|
933
|
+
if (findOldCacheWorker() != null) {
|
|
934
|
+
if(LogUtils.isDebug()) {
|
|
935
|
+
CachePool cachePool = findOldCacheWorker();
|
|
936
|
+
if (cachePool != null) {
|
|
937
|
+
Log.i("DebugPool","findOldCacheView cache pool cache size of type:"+type+",count:"+cachePool.getRecycledViewCount(type)+",cachePool:"+cachePool);
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
return findOldCacheWorker().get(type);
|
|
941
|
+
}else if(LogUtils.isDebug()){
|
|
942
|
+
Log.e("DebugPool","findOldCacheView error, old is null type:"+type);
|
|
943
|
+
}
|
|
944
|
+
return null;
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
CachePool findOldCacheWorker() {
|
|
948
|
+
final String k = getPoolCacheKey(viewContext, shareViewPoolType,getCacheRootView());
|
|
949
|
+
if (gSharedCachePools != null) {
|
|
950
|
+
CachePool v = null;
|
|
951
|
+
if (gSharedCachePools.containsKey(k)) {
|
|
952
|
+
v = gSharedCachePools.get(k);
|
|
953
|
+
if (LogUtils.isDebug()) {
|
|
954
|
+
Log.d(TAG, "DebugPool getCacheWorker find old:" + v + ",name:" + k);
|
|
955
|
+
}
|
|
956
|
+
}else if(LogUtils.isDebug()){
|
|
957
|
+
Log.w("DebugPool","findOldCacheWorker null k:"+k+",shareViewPoolType:"+shareViewPoolType);
|
|
958
|
+
}
|
|
959
|
+
return v;
|
|
960
|
+
}
|
|
961
|
+
return null;
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
private final static String getPoolCacheKey(@Nullable Context context,String k,FastPendingView boundView){
|
|
965
|
+
|
|
966
|
+
final View root = boundView == null ? null : boundView.findPageRootView();
|
|
967
|
+
if (root != null) {
|
|
968
|
+
// Log.d("EsPageViewLog","~~~~~getPoolCacheKey from PageRoot:"+root+",k:"+k);
|
|
969
|
+
return "k-" + k + "|cxt-" + root.hashCode();
|
|
970
|
+
}
|
|
971
|
+
if(LogUtils.isDebug()) {
|
|
972
|
+
Log.i("EsPageViewLog", "~~~~~getPoolCacheKey from Context:" + context + ",k:" + k + ",boundView:" + boundView);
|
|
973
|
+
}
|
|
974
|
+
return context == null ? "k-" + k : "k-" + k + "|cxt-" + context.hashCode();
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
private final String getPoolCacheKey(Context context,FastPendingView boundView){
|
|
978
|
+
return getPoolCacheKey(context,shareViewPoolType,boundView);
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
CachePool getCacheWorker(Context context,FastPendingView fastListView) {
|
|
982
|
+
//2023.11.27确定一个缓存池,保证一块context环境里一个缓存池,这里加一个context的hasCode
|
|
983
|
+
final String k = getPoolCacheKey(context,fastListView);
|
|
984
|
+
if (LogUtils.isDebug()) {
|
|
985
|
+
Log.d(TAG, "DebugPool >>>>>>>>>>>>.getCacheWorker k :" + k+",context:"+context+",CACHE_KEY:"+CACHE_KEY);
|
|
986
|
+
}
|
|
987
|
+
if (gSharedCachePools == null) {
|
|
988
|
+
if (rootView != null) {
|
|
989
|
+
final Object tag = rootView.getViewTag(CACHE_KEY);
|
|
990
|
+
if (tag instanceof HashMap) {
|
|
991
|
+
if (LogUtils.isDebug()) {
|
|
992
|
+
Log.d(TAG, "DebugPool getCacheWorker from rootView:" + Utils.hashCode(gSharedCachePools));
|
|
993
|
+
}
|
|
994
|
+
gSharedCachePools = (Map<String, CachePool>) tag;
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
if (gSharedCachePools == null) {
|
|
999
|
+
gSharedCachePools = new HashMap<>();
|
|
1000
|
+
if (LogUtils.isDebug()) {
|
|
1001
|
+
Log.e(TAG, "DebugPool getCacheWorker new gSharedCachePools :" + Utils.hashCode(gSharedCachePools) + ",rootView:" + rootView);
|
|
1002
|
+
}
|
|
1003
|
+
if (rootView != null) {
|
|
1004
|
+
rootView.putViewTag(CACHE_KEY, gSharedCachePools);
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
final CachePool v;
|
|
1008
|
+
if (gSharedCachePools.containsKey(k)) {
|
|
1009
|
+
v = gSharedCachePools.get(k);
|
|
1010
|
+
if (LogUtils.isDebug()) {
|
|
1011
|
+
Log.d(TAG, "DebugPool getCacheWorker find old:" + v.hashCode() + ",name:" + CACHE_KEY + ",type:" + k);
|
|
1012
|
+
}
|
|
1013
|
+
} else {
|
|
1014
|
+
v = new CachePool();
|
|
1015
|
+
gSharedCachePools.put(k, v);
|
|
1016
|
+
if (LogUtils.isDebug()) {
|
|
1017
|
+
Log.e(TAG, "DebugPool new CachePool !!!!:" + v.hashCode() + ",adapter :" + Utils.hashCode(this) + ",keyType:" + k);
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
return v;
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
|
|
1024
|
+
public Object getRawObject(int position) {
|
|
1025
|
+
final ItemEntity item = getItemEntity(position);
|
|
1026
|
+
return item != null ? item.raw : null;
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
int getLoopPosition(int pos){
|
|
1030
|
+
int realPos = pos;
|
|
1031
|
+
if (isInfiniteLoopEnabled()) {
|
|
1032
|
+
//循环获取数据,需要
|
|
1033
|
+
int itemDataCount = getItemDataCount();
|
|
1034
|
+
if (itemDataCount <= 0) {
|
|
1035
|
+
realPos = -1;
|
|
1036
|
+
}else {
|
|
1037
|
+
realPos = pos % itemDataCount;
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
return realPos;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
ItemEntity getItemEntity(int position) {
|
|
1044
|
+
|
|
1045
|
+
if(isInfiniteLoop){
|
|
1046
|
+
// int dataPosition = getLoopPosition(position);
|
|
1047
|
+
// if (dataPosition < 0 || getItemDataCount() < 1) {
|
|
1048
|
+
// return null;
|
|
1049
|
+
// }
|
|
1050
|
+
int remain = INFINITE_START_POSITION % getItemDataCount();
|
|
1051
|
+
int offsetPosition = Math.max(0,position - remain);
|
|
1052
|
+
int dataPosition = getLoopPosition(offsetPosition);
|
|
1053
|
+
int finalPosition = dataPosition;
|
|
1054
|
+
//Log.d("DebugInfinite"," getItemEntity finalPosition:"+finalPosition+",remain:"+remain+",dataPosition:"+dataPosition+",position:"+position);
|
|
1055
|
+
return (ItemEntity) this.dataList.get(finalPosition);
|
|
1056
|
+
}else{
|
|
1057
|
+
if (position < 0 || this.dataList == null || this.dataList.size() <= position) {
|
|
1058
|
+
return null;
|
|
1059
|
+
}
|
|
1060
|
+
return (ItemEntity) this.dataList.get(position);
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
void exeCustomPendingProp4Singleton(View view, String prop, Object dataFromValue) {
|
|
1065
|
+
if (view == null) {
|
|
1066
|
+
Log.e(TAG, "exeCustomPendingProp error on view is null ");
|
|
1067
|
+
return;
|
|
1068
|
+
}
|
|
1069
|
+
switch (prop) {
|
|
1070
|
+
// case TemplateCodeParser.PENDING_PROP_LAYOUT: {
|
|
1071
|
+
// if (LogUtils.isDebug()) {
|
|
1072
|
+
// Log.e(TAG, "doPatch4Prepare layout dataFromValue:" + dataFromValue);
|
|
1073
|
+
// }
|
|
1074
|
+
// final HippyArray posArray = (HippyArray) dataFromValue;
|
|
1075
|
+
// if (posArray != null && posArray.size() == 4) {
|
|
1076
|
+
// //tempPatchLayout.add(new UpdateLayoutPatch(posArray.getInt(0), posArray.getInt(1), posArray.getInt(2),posArray.getInt(3), p.view, boundNode));
|
|
1077
|
+
// FastAdapterUtil.updateLayout(view, Utils.toPX(posArray.getInt(0))
|
|
1078
|
+
// , Utils.toPX(posArray.getInt(1)),
|
|
1079
|
+
// Utils.toPX(posArray.getInt(2)),
|
|
1080
|
+
// Utils.toPX(posArray.getInt(3)));
|
|
1081
|
+
// }
|
|
1082
|
+
// break;
|
|
1083
|
+
// }
|
|
1084
|
+
case TemplateCodeParser.PENDING_PROP_TRANSLATION: {
|
|
1085
|
+
if (LogUtils.isDebug()) {
|
|
1086
|
+
Log.e(TAG, "doPatch4Prepare position dataFromValue:" + dataFromValue);
|
|
1087
|
+
}
|
|
1088
|
+
final HippyArray posArray = (HippyArray) dataFromValue;
|
|
1089
|
+
if (posArray != null && posArray.size() == 2) {
|
|
1090
|
+
//tempPatchLayout.add(new UpdateLayoutPatch(posArray.getInt(0), posArray.getInt(1), boundNode.getWidth(), boundNode.getHeight(), p.view, boundNode));
|
|
1091
|
+
FastAdapterUtil.updateLayout(view, Utils.toPX(posArray.getInt(0))
|
|
1092
|
+
, Utils.toPX(posArray.getInt(1)),
|
|
1093
|
+
view.getWidth(),
|
|
1094
|
+
view.getHeight());
|
|
1095
|
+
}
|
|
1096
|
+
break;
|
|
1097
|
+
}
|
|
1098
|
+
case TemplateCodeParser.PENDING_PROP_SIZE: {
|
|
1099
|
+
if (LogUtils.isDebug()) {
|
|
1100
|
+
Log.e(TAG, "doPatch4Prepare size dataFromValue:" + dataFromValue);
|
|
1101
|
+
}
|
|
1102
|
+
final HippyArray posArray = (HippyArray) dataFromValue;
|
|
1103
|
+
if (posArray != null && posArray.size() == 2) {
|
|
1104
|
+
//tempPatchLayout.add(new UpdateLayoutPatch(boundNode.getX(),boundNode.getY(),posArray.getInt(0), posArray.getInt(1), p.view, boundNode));
|
|
1105
|
+
FastAdapterUtil.updateLayout(view, view.getLeft()
|
|
1106
|
+
, view.getTop(),
|
|
1107
|
+
Utils.toPX(posArray.getInt(0)),
|
|
1108
|
+
Utils.toPX(posArray.getInt(1)));
|
|
1109
|
+
}
|
|
1110
|
+
break;
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
|
|
1116
|
+
private boolean isListenBoundEvent = false;
|
|
1117
|
+
|
|
1118
|
+
public void setListenBoundEvent(boolean enable) {
|
|
1119
|
+
this.isListenBoundEvent = enable;
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
public RecyclerView.ItemDecoration buildListItemDecoration() {
|
|
1123
|
+
RecyclerView.ItemDecoration itemDecoration = new RecyclerView.ItemDecoration() {
|
|
1124
|
+
@Override
|
|
1125
|
+
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
|
|
1126
|
+
super.getItemOffsets(outRect, view, parent, state);
|
|
1127
|
+
try {
|
|
1128
|
+
final int pos = parent.getChildAdapterPosition(view);
|
|
1129
|
+
|
|
1130
|
+
if (dataList != null && dataList.size() > getLoopPosition(pos)) {
|
|
1131
|
+
final HippyMap item = (HippyMap) getRawObject(pos);
|
|
1132
|
+
if (item.containsKey("decoration")) {
|
|
1133
|
+
final HippyMap dec = item.getMap("decoration");
|
|
1134
|
+
if (dec.containsKey("left")) {
|
|
1135
|
+
outRect.left = Utils.toPX(dec.getInt("left"));
|
|
1136
|
+
}
|
|
1137
|
+
if (dec.containsKey("right")) {
|
|
1138
|
+
outRect.right = Utils.toPX(dec.getInt("right"));
|
|
1139
|
+
}
|
|
1140
|
+
if (dec.containsKey("top")) {
|
|
1141
|
+
outRect.top = Utils.toPX(dec.getInt("top"));
|
|
1142
|
+
}
|
|
1143
|
+
if (dec.containsKey("bottom")) {
|
|
1144
|
+
outRect.bottom = Utils.toPX(dec.getInt("bottom"));
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
} catch (Exception e) {
|
|
1149
|
+
//Do Nothing
|
|
1150
|
+
//{position:1,prevent:{down,left,right,up}}
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
};
|
|
1154
|
+
return itemDecoration;
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
|
|
1158
|
+
|
|
1159
|
+
public void onBeforeChangeAdapter() {
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
/***
|
|
1163
|
+
*
|
|
1164
|
+
* @param position 要更新的位置
|
|
1165
|
+
* @param dataToUpdate 从前端传来需要更新的数据,eg:{
|
|
1166
|
+
* contentList:[{},{}] ,注意这里contentList是在前端对应${contentList}
|
|
1167
|
+
*
|
|
1168
|
+
* }
|
|
1169
|
+
* @param updateView 是否更新view
|
|
1170
|
+
* @param holder 当前展示的viewHolder
|
|
1171
|
+
*/
|
|
1172
|
+
public void updateItemProps(String name, int position, HippyMap dataToUpdate, boolean updateView, RecyclerView.ViewHolder holder) {
|
|
1173
|
+
if (LogUtils.isDebug()) {
|
|
1174
|
+
Log.e(TAG, "BindEvent updateItemProps called position: " + position + ",name:" + name + ",dataToUpdate:" + dataToUpdate + ",updateView:" + updateView + ",holder:" + Utils.hashCode(holder) + ",this:" + Utils.hashCode(this));
|
|
1175
|
+
}
|
|
1176
|
+
if (this.dataList != null && this.dataList.size() > position) {
|
|
1177
|
+
final HippyMap itemToUpdate = (HippyMap) getRawObject(position);
|
|
1178
|
+
final ItemEntity it = getItemEntity(position);
|
|
1179
|
+
if (it != null) {
|
|
1180
|
+
final HippyMap toUpdateProps = new HippyMap();
|
|
1181
|
+
if (LogUtils.isDebug()) {
|
|
1182
|
+
Log.d(TAG, "updateItemProps ItemEntity raw :" + it.raw);
|
|
1183
|
+
}
|
|
1184
|
+
final ElementNode target = Utils.findElementNodeByName(name, ((Holder) holder).tag.getRootNode());
|
|
1185
|
+
for (String pendingProp : dataToUpdate.keySet()) {
|
|
1186
|
+
//先通过${key}里的值,获取到map对象,并更新数据
|
|
1187
|
+
final Object newData = dataToUpdate.get(pendingProp);
|
|
1188
|
+
TemplateCodeParser.setValueFromCode(itemToUpdate, pendingProp, newData);
|
|
1189
|
+
// final String viewProp = it.rawPendingPropsReverse.getString(pendingProp);
|
|
1190
|
+
final String viewProp = Utils.findPropByPendingProp(pendingProp, target);
|
|
1191
|
+
if (LogUtils.isDebug()) {
|
|
1192
|
+
Log.d(TAG, "updateItemProps viewProp " + viewProp + ",pendingProp:" + pendingProp);
|
|
1193
|
+
}
|
|
1194
|
+
if (TextUtils.isEmpty(viewProp)) {
|
|
1195
|
+
throw new IllegalStateException("updateItemProps Error viewProp cant be null!");
|
|
1196
|
+
}
|
|
1197
|
+
toUpdateProps.pushObject(viewProp, newData);
|
|
1198
|
+
}
|
|
1199
|
+
if (updateView) {
|
|
1200
|
+
|
|
1201
|
+
if (LogUtils.isDebug()) {
|
|
1202
|
+
Log.d(TAG, "updateItemProps doUpdateView toUpdateMap:" + toUpdateProps + ",findTargetByName:" + target + ",name:" + name);
|
|
1203
|
+
}
|
|
1204
|
+
if (target != null) {
|
|
1205
|
+
// new ElementDiffPatch(this, ((Holder) holder).tag.getRootNode(), itemToUpdate, position)
|
|
1206
|
+
// .invokeProps(toUpdateProps, target);
|
|
1207
|
+
final HippyViewController vc = CustomControllerHelper.getViewController(getControllerManager(), target.templateNode);
|
|
1208
|
+
FastAdapterUtil.invokePropsSync(vc,toUpdateProps,position,target,this,STEP_UPDATE_ITEM);
|
|
1209
|
+
} else {
|
|
1210
|
+
Log.e(TAG, "updateItemProps doUpdateView toUpdateMap:" + toUpdateProps + ",findTargetByName:" + null + ",name:" + name);
|
|
1211
|
+
}
|
|
1212
|
+
} else {
|
|
1213
|
+
Log.e(TAG, "updateItemProp 不执行更新ui,updateView:" + false + ",holder:" + holder);
|
|
1214
|
+
}
|
|
1215
|
+
} else {
|
|
1216
|
+
Log.e(TAG, "updateItemProp error ,此位置的数据,重来没有展示过,无法进行更新 it:" + it);
|
|
1217
|
+
}
|
|
1218
|
+
} else {
|
|
1219
|
+
Log.e(TAG, "updateItemProps error position: " + position + ",name:" + name + ",updateView:" + updateView + ",holder:" + Utils.hashCode(holder) + ",this:" + Utils.hashCode(this) + ",dataList:" + (this.dataList == null ? 0 : this.dataList.size()));
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
public void updateItemSpecificPropByTargetName(String name, int position,String prop, Object dataToUpdate, boolean updateView, RecyclerView.ViewHolder holder) {
|
|
1224
|
+
final ElementNode target = Utils.findElementNodeByName(name, ((Holder) holder).tag.getRootNode());
|
|
1225
|
+
updateItemSpecificProp(target, position, prop, dataToUpdate, updateView, holder);
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
public void updateItemSpecificPropByTargetSID(String targetSID, int position,String prop, Object dataToUpdate, boolean updateView, RecyclerView.ViewHolder holder) {
|
|
1229
|
+
final ElementNode target = Utils.findElementNodeBySID(targetSID, ((Holder) holder).tag.getRootNode());
|
|
1230
|
+
updateItemSpecificProp(target, position, prop, dataToUpdate, updateView, holder);
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
public void updateItemSpecificProp(ElementNode target, int position,String prop, Object dataToUpdate, boolean updateView, RecyclerView.ViewHolder holder) {
|
|
1234
|
+
if (LogUtils.isDebug()) {
|
|
1235
|
+
Log.e(TAG, "BindEvent updateItemSpecificProp called position: " + position + ",target:" + target + ",dataToUpdate:" + dataToUpdate + ",updateView:" + updateView + ",holder:" + Utils.hashCode(holder) + ",this:" + Utils.hashCode(this));
|
|
1236
|
+
}
|
|
1237
|
+
if (this.dataList != null && this.dataList.size() > position) {
|
|
1238
|
+
final HippyMap itemToUpdate = (HippyMap) getRawObject(position);
|
|
1239
|
+
final ItemEntity it = getItemEntity(position);
|
|
1240
|
+
if (it != null) {
|
|
1241
|
+
if (LogUtils.isDebug()) {
|
|
1242
|
+
Log.d(TAG, "updateItemSpecificProp ItemEntity raw :" + it.raw);
|
|
1243
|
+
}
|
|
1244
|
+
//先通过${key}里的值,获取到map对象,并更新数据
|
|
1245
|
+
//final Object newData = dataToUpdate.get(prop);
|
|
1246
|
+
TemplateCodeParser.setValueFromCode(itemToUpdate, prop, dataToUpdate);
|
|
1247
|
+
// final String viewProp = it.rawPendingPropsReverse.getString(pendingProp);
|
|
1248
|
+
//final ElementNode target = Utils.findElementNodeByName(name, ((Holder) holder).tag.getRootNode());
|
|
1249
|
+
if (updateView) {
|
|
1250
|
+
final HippyMap toUpdateProps = new HippyMap();
|
|
1251
|
+
toUpdateProps.pushObject(prop, dataToUpdate);
|
|
1252
|
+
if (LogUtils.isDebug()) {
|
|
1253
|
+
Log.d(TAG, "updateItemSpecificProp doUpdateView toUpdateMap:" + toUpdateProps + ",findTargetByName:" + target );
|
|
1254
|
+
}
|
|
1255
|
+
if (target != null) {
|
|
1256
|
+
// new ElementDiffPatch(this, ((Holder) holder).tag.getRootNode(), itemToUpdate, position)
|
|
1257
|
+
// .invokeProps(toUpdateProps, target);
|
|
1258
|
+
final HippyViewController vc = CustomControllerHelper.getViewController(getControllerManager(), target.templateNode);
|
|
1259
|
+
FastAdapterUtil.invokePropsSync(vc,toUpdateProps,position,target,this,STEP_UPDATE_ITEM);
|
|
1260
|
+
} else {
|
|
1261
|
+
Log.e(TAG, "updateItemSpecificProp doUpdateView toUpdateMap:" + toUpdateProps + ",findTargetByName:" + null );
|
|
1262
|
+
}
|
|
1263
|
+
} else {
|
|
1264
|
+
Log.e(TAG, "updateItemSpecificProp 不执行更新ui,updateView:" + false + ",holder:" + holder);
|
|
1265
|
+
}
|
|
1266
|
+
} else {
|
|
1267
|
+
Log.e(TAG, "updateItemSpecificProp error ,此位置的数据,重来没有展示过,无法进行更新 it:" + null);
|
|
1268
|
+
}
|
|
1269
|
+
} else {
|
|
1270
|
+
Log.e(TAG, "updateItemProps error position: " + position + ",updateView:" + updateView + ",holder:" + Utils.hashCode(holder) + ",this:" + Utils.hashCode(this) + ",dataList:" + (this.dataList == null ? 0 : this.dataList.size()));
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
|
|
1275
|
+
|
|
1276
|
+
public void updateItemDataRange(final int pos, final int count, HippyArray data) {
|
|
1277
|
+
if (LogUtils.isDebug()) {
|
|
1278
|
+
Log.i(TAG, "updateItemRange pos " + pos + ",count:" + count + "this:" + Utils.hashCode(this));
|
|
1279
|
+
}
|
|
1280
|
+
//更新列表里的数据
|
|
1281
|
+
int index = 0;
|
|
1282
|
+
if (this.dataList != null) {
|
|
1283
|
+
final int totalCount = this.dataList.size();
|
|
1284
|
+
//update
|
|
1285
|
+
for (int i = pos; i < pos + count; i++) {
|
|
1286
|
+
if (pos + count > totalCount) {
|
|
1287
|
+
break;
|
|
1288
|
+
}
|
|
1289
|
+
this.dataList.setObject(i, new ItemEntity(data.get(index), i));
|
|
1290
|
+
if (LogUtils.isDebug()) {
|
|
1291
|
+
Log.i("DebugReplaceItem", "updateItemRange set data i:" + i + ",index:" + index+",data:"+data.get(index));
|
|
1292
|
+
}
|
|
1293
|
+
index++;
|
|
1294
|
+
}
|
|
1295
|
+
if (LogUtils.isDebug()) {
|
|
1296
|
+
Log.e(TAG, "updateItemRange pos done");
|
|
1297
|
+
}
|
|
1298
|
+
} else {
|
|
1299
|
+
Log.e(TAG, "updateItemRange error dataList null");
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
public void insertItemDataRange(final int pos, int count, HippyArray data) {
|
|
1304
|
+
if (LogUtils.isDebug()) {
|
|
1305
|
+
Log.d(TAG, "insertItemDataRange pos " + pos + ",count:" + count + "this:" + Utils.hashCode(this));
|
|
1306
|
+
}
|
|
1307
|
+
//更新列表里的数据
|
|
1308
|
+
if (this.dataList != null && data != null) {
|
|
1309
|
+
final int totalCount = this.dataList.size();
|
|
1310
|
+
//add
|
|
1311
|
+
if (pos >= 0 && pos <= totalCount) {
|
|
1312
|
+
for (int i = count; i > 0; i--) {
|
|
1313
|
+
this.dataList.addObject(pos, new ItemEntity(data.get(i - 1), i - 1));
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
if (LogUtils.isDebug()) {
|
|
1317
|
+
Log.e(TAG, "insertItemDataRange pos done");
|
|
1318
|
+
}
|
|
1319
|
+
} else {
|
|
1320
|
+
Log.e(TAG, "insertItemDataRange error dataList null");
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
//用来阻止列表焦点移动时滚动列表
|
|
1325
|
+
public boolean onInterceptRequestChildRectangleOnScreen(RecyclerView parent, View view, Rect rect, boolean immediate, int direction, boolean focusedChildVisible) {
|
|
1326
|
+
boolean prevent = false;
|
|
1327
|
+
try {
|
|
1328
|
+
final int pos = parent.getChildAdapterPosition(view);
|
|
1329
|
+
if (dataList != null && dataList.size() > pos && pos > -1) {
|
|
1330
|
+
final HippyMap item = (HippyMap) getRawObject(pos);
|
|
1331
|
+
if (item.containsKey("preventChildOnScreen")) {
|
|
1332
|
+
final HippyArray dec = item.getArray("preventChildOnScreen");
|
|
1333
|
+
if (LogUtils.isDebug()) {
|
|
1334
|
+
Log.d(TAG, "preventChildOnScreen position:" + pos + ",array:" + dec +",parent:"+parent);
|
|
1335
|
+
}
|
|
1336
|
+
for (int i = 0; i < dec.size(); i++) {
|
|
1337
|
+
final String directionStr = dec.getString(i);
|
|
1338
|
+
switch (directionStr) {
|
|
1339
|
+
case "up":
|
|
1340
|
+
prevent = direction == View.FOCUS_UP;
|
|
1341
|
+
break;
|
|
1342
|
+
case "down":
|
|
1343
|
+
prevent = direction == View.FOCUS_DOWN;
|
|
1344
|
+
break;
|
|
1345
|
+
case "right":
|
|
1346
|
+
prevent = direction == View.FOCUS_RIGHT;
|
|
1347
|
+
break;
|
|
1348
|
+
case "left":
|
|
1349
|
+
prevent = direction == View.FOCUS_LEFT;
|
|
1350
|
+
break;
|
|
1351
|
+
case "first":
|
|
1352
|
+
prevent = direction == -1;
|
|
1353
|
+
break;
|
|
1354
|
+
}
|
|
1355
|
+
if (prevent) {
|
|
1356
|
+
break;
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
if (LogUtils.isDebug()) {
|
|
1360
|
+
Log.d(TAG, "preventChildOnScreen position:" + pos + ",prevent:" + prevent + ",direction:" + direction);
|
|
1361
|
+
}
|
|
1362
|
+
} else {
|
|
1363
|
+
if (LogUtils.isDebug()) {
|
|
1364
|
+
Log.d(TAG, "preventChildOnScreen position:" + pos + ",array null" +",parent:"+parent+",item :"+item);
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
} catch (Exception e) {
|
|
1369
|
+
//Do Nothing
|
|
1370
|
+
//{position:1,prevent:{down,left,right,up}}
|
|
1371
|
+
}
|
|
1372
|
+
return prevent;
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
public void onLayoutComplete(RecyclerView.State state,FastListView listView) {
|
|
1376
|
+
if(LogUtils.isDebug()) {
|
|
1377
|
+
Log.d("DebugEvent", "onLayoutComplete state: " + state + ",view:" + ExtendUtil.debugViewLite(listView) + ",childCount:" + listView.getChildCount());
|
|
1378
|
+
}
|
|
1379
|
+
if (listView.getChildCount() > 0) {
|
|
1380
|
+
for(int i = 0; i < listView.getChildCount(); i ++){
|
|
1381
|
+
View child = listView.getChildAt(i);
|
|
1382
|
+
int pos = listView.getChildAdapterPosition(child);
|
|
1383
|
+
RecyclerView.ViewHolder vh = listView.findViewHolderForAdapterPosition(pos);
|
|
1384
|
+
if(vh instanceof FastAdapter.Holder){
|
|
1385
|
+
ElementNode elementNode = ((Holder) vh).getItemRootNode();
|
|
1386
|
+
if(elementNode != null) {
|
|
1387
|
+
elementNode.adapterPosition = pos;
|
|
1388
|
+
if(LogUtils.isDebug()){
|
|
1389
|
+
Log.i("DebugEvent", "onLayoutComplete elementNode pos: " + elementNode.adapterPosition);
|
|
1390
|
+
}
|
|
1391
|
+
}else if (LogUtils.isDebug()){
|
|
1392
|
+
Log.e("DebugEvent", "onLayoutComplete elementNode null pos: " + pos);
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
|
|
1401
|
+
final static class ElementClickListener implements View.OnClickListener {
|
|
1402
|
+
final FastAdapter adapter;
|
|
1403
|
+
final ElementNode elementNode;
|
|
1404
|
+
final int rootListID;
|
|
1405
|
+
final EventDeliverer deliverer;
|
|
1406
|
+
|
|
1407
|
+
ElementClickListener(FastAdapter adapter, int rootListID, ElementNode elementNode, EventDeliverer deliverer) {
|
|
1408
|
+
this.adapter = adapter;
|
|
1409
|
+
this.elementNode = elementNode;
|
|
1410
|
+
this.rootListID = rootListID;
|
|
1411
|
+
this.deliverer = deliverer;
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1414
|
+
@Override
|
|
1415
|
+
public void onClick(View v) {
|
|
1416
|
+
final int parentPosition = Utils.findParentPositionByView(v, 0);
|
|
1417
|
+
int position = elementNode.rootNode.adapterPosition;
|
|
1418
|
+
if (LogUtils.isDebug()) {
|
|
1419
|
+
Log.i("DebugClick", "ElementCallback click v:" + ExtendUtil.debugViewLite(v) + ",parentPosition:" + parentPosition+",position:"+position+",inTouchMode:"+ v.isInTouchMode());
|
|
1420
|
+
}
|
|
1421
|
+
HippyViewEvent event = new HippyViewEvent("onItemClick");
|
|
1422
|
+
HippyMap m = new HippyMap();
|
|
1423
|
+
Utils.buildEventBasic(m, v, elementNode, position);
|
|
1424
|
+
if (adapter != null) {
|
|
1425
|
+
m.pushObject("item", adapter.getRawObject(position));
|
|
1426
|
+
}
|
|
1427
|
+
m.pushString("name", elementNode.name);
|
|
1428
|
+
|
|
1429
|
+
m.pushInt("parentPosition", parentPosition);
|
|
1430
|
+
//event.send(rootListID,Utils.getHippyContext(v),m);
|
|
1431
|
+
deliverer.sendEvent(event, rootListID, m);
|
|
1432
|
+
final ElementNode itemRoot = findItemRoot(elementNode);
|
|
1433
|
+
if (itemRoot != null && itemRoot.templateNode.getProps() != null) {
|
|
1434
|
+
|
|
1435
|
+
// for (String s : itemRoot.templateNode.getProps().keySet()) {
|
|
1436
|
+
// if (LogUtils.isDebug()) {
|
|
1437
|
+
// Log.d(TAG, "ElementCallback 1 prop:" + s + ",value:" + itemRoot.templateNode.getProps().get(s));
|
|
1438
|
+
// }
|
|
1439
|
+
// }
|
|
1440
|
+
if (itemRoot.templateNode.getProps().containsKey("onItemClick")) {
|
|
1441
|
+
//View view = Utils.findBoundView(elementNode.boundView, itemRoot.templateNode);
|
|
1442
|
+
if (LogUtils.isDebug()) {
|
|
1443
|
+
Log.d(TAG, "ElementCallback ClickEvent position of Parent " + parentPosition);
|
|
1444
|
+
}
|
|
1445
|
+
deliverer.sendEvent(event, itemRoot.templateNode.getId(), m);
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1452
|
+
final static class ElementLongClickListener implements View.OnLongClickListener {
|
|
1453
|
+
final FastAdapter adapter;
|
|
1454
|
+
final ElementNode elementNode;
|
|
1455
|
+
final int rootListID;
|
|
1456
|
+
final EventDeliverer deliverer;
|
|
1457
|
+
|
|
1458
|
+
public ElementLongClickListener(FastAdapter adapter, int rootListID, ElementNode elementNode, EventDeliverer deliverer) {
|
|
1459
|
+
this.adapter = adapter;
|
|
1460
|
+
this.elementNode = elementNode;
|
|
1461
|
+
this.rootListID = rootListID;
|
|
1462
|
+
this.deliverer = deliverer;
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
@Override
|
|
1466
|
+
public boolean onLongClick(View v) {
|
|
1467
|
+
final int parentPosition = Utils.findParentPositionByView(v, 0);
|
|
1468
|
+
int position = elementNode.rootNode.adapterPosition;
|
|
1469
|
+
if (LogUtils.isDebug()) {
|
|
1470
|
+
Log.d("DebugClick", "ElementCallback longClick v:" + v + ",name:" + elementNode.name + ",parentPosition:" + parentPosition+",position:"+position);
|
|
1471
|
+
}
|
|
1472
|
+
HippyViewEvent event = new HippyViewEvent("onItemLongClick");
|
|
1473
|
+
HippyMap m = new HippyMap();
|
|
1474
|
+
|
|
1475
|
+
Utils.buildEventBasic(m, v, elementNode, position);
|
|
1476
|
+
if (adapter != null) {
|
|
1477
|
+
m.pushObject("item", adapter.getRawObject(position));
|
|
1478
|
+
}
|
|
1479
|
+
m.pushString("name", elementNode.name);
|
|
1480
|
+
m.pushInt("parentPosition", parentPosition);
|
|
1481
|
+
//event.send(rootListID,Utils.getHippyContext(v),m);
|
|
1482
|
+
deliverer.sendEvent(event, rootListID, m);
|
|
1483
|
+
final ElementNode itemRoot = findItemRoot(elementNode);
|
|
1484
|
+
if (itemRoot != null && itemRoot.templateNode.getProps() != null) {
|
|
1485
|
+
|
|
1486
|
+
// for (String s : itemRoot.templateNode.getProps().keySet()) {
|
|
1487
|
+
// if (LogUtils.isDebug()) {
|
|
1488
|
+
// Log.d(TAG, "ElementCallback 1 prop:" + s + ",value:" + itemRoot.templateNode.getProps().get(s));
|
|
1489
|
+
// }
|
|
1490
|
+
// }
|
|
1491
|
+
if (itemRoot.templateNode.getProps().containsKey("onItemLongClick")) {
|
|
1492
|
+
//View view = Utils.findBoundView(elementNode.boundView, itemRoot.templateNode);
|
|
1493
|
+
if (LogUtils.isDebug()) {
|
|
1494
|
+
Log.d(TAG, "ElementCallback LongClickEvent position of Parent " + parentPosition);
|
|
1495
|
+
}
|
|
1496
|
+
deliverer.sendEvent(event, itemRoot.templateNode.getId(), m);
|
|
1497
|
+
}
|
|
1498
|
+
|
|
1499
|
+
}
|
|
1500
|
+
return true;
|
|
1501
|
+
}
|
|
1502
|
+
}
|
|
1503
|
+
|
|
1504
|
+
|
|
1505
|
+
final static class ItemFocusListener implements View.OnFocusChangeListener {
|
|
1506
|
+
final FastAdapter adapter;
|
|
1507
|
+
final int rootListID;
|
|
1508
|
+
final ElementNode elementNode;
|
|
1509
|
+
final EventDeliverer deliverer;
|
|
1510
|
+
|
|
1511
|
+
ItemFocusListener(FastAdapter adapter, int rootListID, ElementNode elementNode, EventDeliverer deliverer) {
|
|
1512
|
+
this.adapter = adapter;
|
|
1513
|
+
this.rootListID = rootListID;
|
|
1514
|
+
this.elementNode = elementNode;
|
|
1515
|
+
this.deliverer = deliverer;
|
|
1516
|
+
}
|
|
1517
|
+
|
|
1518
|
+
@Override
|
|
1519
|
+
public void onFocusChange(View v, boolean hasFocus) {
|
|
1520
|
+
final ElementNode itemRoot = findItemRoot(elementNode);
|
|
1521
|
+
|
|
1522
|
+
final int parentPosition = Utils.findParentPositionByView(v, 0);
|
|
1523
|
+
int position = elementNode.rootNode.adapterPosition;
|
|
1524
|
+
if (LogUtils.isDebug()) {
|
|
1525
|
+
Log.e(TAG, "ElementCallback focus v:" + v.hashCode() + ",hasFocus:" + hasFocus + ",parentPosition:" + parentPosition+",position:"+position);
|
|
1526
|
+
}
|
|
1527
|
+
HippyViewEvent event = new HippyViewEvent("onItemFocused");
|
|
1528
|
+
HippyMap m = new HippyMap();
|
|
1529
|
+
Utils.buildEventBasic(m, v, elementNode, position);
|
|
1530
|
+
if (adapter != null) {
|
|
1531
|
+
m.pushObject("item", adapter.getRawObject(position));
|
|
1532
|
+
}
|
|
1533
|
+
m.pushString("name", elementNode.name);
|
|
1534
|
+
m.pushBoolean("hasFocus", hasFocus);
|
|
1535
|
+
m.pushInt("parentPosition", parentPosition);
|
|
1536
|
+
//event.send(rootListID,Utils.getHippyContext(v), m);
|
|
1537
|
+
deliverer.sendEvent(event, rootListID, m);
|
|
1538
|
+
|
|
1539
|
+
if (itemRoot != null && itemRoot.templateNode.getProps() != null) {
|
|
1540
|
+
|
|
1541
|
+
// for (String s : itemRoot.templateNode.getProps().keySet()) {
|
|
1542
|
+
// if (LogUtils.isDebug()) {
|
|
1543
|
+
// Log.d(TAG, "ElementCallback 1 prop:" + s + ",value:" + itemRoot.templateNode.getProps().get(s));
|
|
1544
|
+
// }
|
|
1545
|
+
// }
|
|
1546
|
+
if (itemRoot.templateNode.getProps().containsKey("onItemFocused")) {
|
|
1547
|
+
//View view = Utils.findBoundView(elementNode.boundView, itemRoot.templateNode);
|
|
1548
|
+
if (LogUtils.isDebug()) {
|
|
1549
|
+
Log.d(TAG, "ElementCallback position of Parent " + parentPosition);
|
|
1550
|
+
}
|
|
1551
|
+
|
|
1552
|
+
deliverer.sendEvent(event, itemRoot.templateNode.getId(), m);
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1558
|
+
static ElementNode findItemRoot(DomNode node) {
|
|
1559
|
+
if (node != null) {
|
|
1560
|
+
if (node instanceof ElementNode && ((ElementNode) node).isRootItem) {
|
|
1561
|
+
return (ElementNode) node;
|
|
1562
|
+
} else {
|
|
1563
|
+
return findItemRoot(node.getParent());
|
|
1564
|
+
}
|
|
1565
|
+
}
|
|
1566
|
+
return null;
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1569
|
+
void notifyElementBeforeOnBind(DomNode node, Object itemData) {
|
|
1570
|
+
if (node instanceof ElementNode) {
|
|
1571
|
+
|
|
1572
|
+
final View view = ((ElementNode) node).boundView;
|
|
1573
|
+
if (view instanceof ListItemHolder) {
|
|
1574
|
+
imgSpecial(view, node, itemData);
|
|
1575
|
+
//把ListItemHolder相关的生命周期执行一下
|
|
1576
|
+
((ListItemHolder) view).onItemBind();
|
|
1577
|
+
}
|
|
1578
|
+
if (view instanceof PostTaskHolder) {
|
|
1579
|
+
((PostTaskHolder) view).setRootPostHandlerView(getRootListView());
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
for (int i = 0; i < node.getChildCount(); i++) {
|
|
1583
|
+
notifyElementBeforeOnBind(node.getChildAt(i), itemData);
|
|
1584
|
+
}
|
|
1585
|
+
}
|
|
1586
|
+
|
|
1587
|
+
private void imgSpecial(View view, DomNode node, Object itemData) {
|
|
1588
|
+
if (view instanceof HippyImageView && !(view instanceof HippyViewGroup) && ((ElementNode) node).templateNode != null) {
|
|
1589
|
+
|
|
1590
|
+
HippyMap uiProps = ((ElementNode) node).templateNode.getProps();
|
|
1591
|
+
|
|
1592
|
+
if (uiProps != null && uiProps.containsKey("src") && itemData instanceof HippyMap) {
|
|
1593
|
+
final String pendingProp = TemplateCodeParser.parsePlaceholderProp("src", uiProps);
|
|
1594
|
+
if (!TextUtils.isEmpty(pendingProp)) {
|
|
1595
|
+
final Object dataFromValue = TemplateCodeParser.getValueFromCode((HippyMap) itemData, pendingProp);
|
|
1596
|
+
if (dataFromValue != null) {
|
|
1597
|
+
((HippyImageView) view).beforeItemBind(dataFromValue);
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1604
|
+
void updateItemLayout(DomNode node) {
|
|
1605
|
+
if (node instanceof ElementNode) {
|
|
1606
|
+
final ElementNode en = (ElementNode) node;
|
|
1607
|
+
final View view = en.boundView;
|
|
1608
|
+
if (view != null) {
|
|
1609
|
+
// if(LogUtils.isDebug()){
|
|
1610
|
+
// Log.v(TAG,"updateItemLayout node:"+en+",view:"+view);
|
|
1611
|
+
// }
|
|
1612
|
+
if(en.isMarkToDelay){
|
|
1613
|
+
changeVisibility(en,true);
|
|
1614
|
+
}
|
|
1615
|
+
FastAdapterUtil.updateLayout(view, (ElementNode) node);
|
|
1616
|
+
}
|
|
1617
|
+
}
|
|
1618
|
+
for (int i = 0; i < node.getChildCount(); i++) {
|
|
1619
|
+
updateItemLayout(node.getChildAt(i));
|
|
1620
|
+
}
|
|
1621
|
+
}
|
|
1622
|
+
|
|
1623
|
+
|
|
1624
|
+
void updateItemLayout4ItemRootView(View itemView,ElementNode en) {
|
|
1625
|
+
final View view = en.boundView;
|
|
1626
|
+
if(en.getLayoutWidth() < 1 || en.getLayoutHeight() < 1 && en.getParent() == en.rootNode){
|
|
1627
|
+
// Log.e(TAG, "fixElementNodeSize error width:"+en.getLayoutWidth()+",height:"+en.getLayoutHeight()+",template :"+en.templateNode);
|
|
1628
|
+
}
|
|
1629
|
+
if (view != null) {
|
|
1630
|
+
boolean changed = false;
|
|
1631
|
+
int currentWidth = view.getWidth();
|
|
1632
|
+
int currentHeight = view.getHeight();
|
|
1633
|
+
int toWidth = currentWidth;
|
|
1634
|
+
int toHeight = currentHeight;
|
|
1635
|
+
if(en.getLayoutWidth() != currentWidth && en.getLayoutWidth() > 0){
|
|
1636
|
+
toWidth = (int) en.getLayoutWidth();
|
|
1637
|
+
changed = true;
|
|
1638
|
+
}
|
|
1639
|
+
if(en.getLayoutHeight() != currentHeight && en.getLayoutHeight() > 0){
|
|
1640
|
+
toHeight = (int) en.getLayoutHeight();
|
|
1641
|
+
changed = true;
|
|
1642
|
+
}
|
|
1643
|
+
if(changed){
|
|
1644
|
+
if (en.isRootItem) {
|
|
1645
|
+
// if(LogUtils.isDebug()){
|
|
1646
|
+
// Log.v(TAG,"updateItemLayout node:"+en+",view:"+view);
|
|
1647
|
+
// }
|
|
1648
|
+
updateLayoutF(en.boundView, 0, 0, toWidth, toHeight);
|
|
1649
|
+
}else{
|
|
1650
|
+
updateLayoutF(en.boundView,en.getLayoutX(),en.getLayoutY(),toWidth,toHeight);
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1654
|
+
for (int i = 0; i < en.getChildCount(); i++) {
|
|
1655
|
+
updateItemLayout4ItemRootView(itemView,(ElementNode) en.getChildAt(i));
|
|
1656
|
+
}
|
|
1657
|
+
if (en.isRootItem) {
|
|
1658
|
+
if(itemView instanceof ItemContainer) {
|
|
1659
|
+
updateLayoutF(itemView, en.getLayoutX(), en.getLayoutY(), en.getLayoutWidth(), en.getLayoutHeight());
|
|
1660
|
+
}
|
|
1661
|
+
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
|
|
1665
|
+
/**
|
|
1666
|
+
* 只更新item内部所有的view,跳过root的item,以防止列表在已经layout后再次layout出现的位置错误
|
|
1667
|
+
*
|
|
1668
|
+
* @param node
|
|
1669
|
+
*/
|
|
1670
|
+
void updateItemLayoutInside(DomNode node) {
|
|
1671
|
+
if (node instanceof ElementNode && !((ElementNode) node).isRootItem) {
|
|
1672
|
+
final ElementNode en = (ElementNode) node;
|
|
1673
|
+
final View view = en.boundView;
|
|
1674
|
+
if (view != null) {
|
|
1675
|
+
FastAdapterUtil.updateLayout(view, (ElementNode) node);
|
|
1676
|
+
}
|
|
1677
|
+
}
|
|
1678
|
+
for (int i = 0; i < node.getChildCount(); i++) {
|
|
1679
|
+
updateItemLayoutInside(node.getChildAt(i));
|
|
1680
|
+
}
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
|
|
1684
|
+
void measureFastFlexView(ElementNode node) {
|
|
1685
|
+
final FastFlexView content = (FastFlexView) node.boundView;
|
|
1686
|
+
//updateLayout(content,0,0,content.getPreferWidth(),content.getPreferHeight());
|
|
1687
|
+
if (LogUtils.isDebug()) {
|
|
1688
|
+
Log.i(TAG, "FIX_ITEM_SIZE prepareFlexView width:" + content.getPreferWidth() + ",height:" + content.getPreferHeight() + ",node:" + node);
|
|
1689
|
+
Log.i(TAG, "FIX_ITEM_SIZE prepareFlexView contentView width:" + content.getWidth() + ",height:" + content.getHeight() + ",node:" + node);
|
|
1690
|
+
}
|
|
1691
|
+
if(node.getStyleWidth() < 1) {
|
|
1692
|
+
node.setStyleWidth(content.getPreferWidth());
|
|
1693
|
+
}
|
|
1694
|
+
if(node.getStyleHeight() < 1) {
|
|
1695
|
+
node.setStyleHeight(content.getPreferHeight());
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1698
|
+
|
|
1699
|
+
void measureTextAutoSize(ElementNode node, TVTextView tx) {
|
|
1700
|
+
if (node.isWidthWrapContent) {
|
|
1701
|
+
tx.measureTextWidth(node);
|
|
1702
|
+
if (LogUtils.isDebug()) {
|
|
1703
|
+
Log.e("AutoMeasure", "FIX_ITEM_SIZE fixTextView textSize tx:" + tx.getWidth() + ",height:" + tx.getHeight() + ",layoutWidth:" + node.getStyleWidth() + ",layoutHeight:" + node.getStyleHeight() + ",text:" + tx.getText());
|
|
1704
|
+
}
|
|
1705
|
+
node.measureParentWidthIfNeed(node, node.getStyleWidth());
|
|
1706
|
+
// measureWidth(tx, (int) node.getStyleHeight());
|
|
1707
|
+
}
|
|
1708
|
+
if (node.isHeightWrapContent) {
|
|
1709
|
+
if (LogUtils.isDebug()) {
|
|
1710
|
+
Log.i("AutoMeasure", "FIX_ITEM_SIZE ----updateItemLayout :" + tx.hashCode() + ",isLayoutDirty:" + node.isLayoutDirty + ",getLayoutHeight:" + node.getLayoutHeight() + ",text:" + tx.getText());
|
|
1711
|
+
}
|
|
1712
|
+
FastAdapterUtil.measureHeight(tx, (int) node.getStyleWidth());
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1715
|
+
|
|
1716
|
+
|
|
1717
|
+
void measureAllCreatedView(ElementNode node) {
|
|
1718
|
+
//执行过pending的任务后,所有的节点大小都已经在node中确认,需要在
|
|
1719
|
+
if (node.boundView instanceof FastFlexView) {
|
|
1720
|
+
measureFastFlexView(node);
|
|
1721
|
+
} else if (node.boundView instanceof TVTextView) {
|
|
1722
|
+
measureTextAutoSize(node, (TVTextView) node.boundView);
|
|
1723
|
+
} else {
|
|
1724
|
+
for (int i = 0; i < node.getChildCount(); i++) {
|
|
1725
|
+
measureAllCreatedView((ElementNode) node.getChildAt(i));
|
|
1726
|
+
}
|
|
1727
|
+
}
|
|
1728
|
+
|
|
1729
|
+
}
|
|
1730
|
+
|
|
1731
|
+
|
|
1732
|
+
private void doDelayUpdatePropsRecursive(ElementNode node, HippyMap itemData, int itemPos) {
|
|
1733
|
+
if (node.boundView != null && node.isMarkToDelay) {
|
|
1734
|
+
//node.hasInit = false;
|
|
1735
|
+
doDiffProps4ElementNode(node, itemData, itemPos, STEP_DELAY_POST,true);
|
|
1736
|
+
}
|
|
1737
|
+
//更新节点里的map
|
|
1738
|
+
//node.props = toMap;
|
|
1739
|
+
if (node.templateNode instanceof ListNode) {
|
|
1740
|
+
// 如果嵌套list的话,不应该继续处理子节点,而是由子list自己处理
|
|
1741
|
+
return;
|
|
1742
|
+
}
|
|
1743
|
+
for (int i = 0; i < node.getChildCount(); i++) {
|
|
1744
|
+
// 这里的(ElementNode) node.getChildAt(i) 一定是ElementNode类型?
|
|
1745
|
+
doDelayUpdatePropsRecursive((ElementNode) node.getChildAt(i), itemData, itemPos);
|
|
1746
|
+
}
|
|
1747
|
+
}
|
|
1748
|
+
|
|
1749
|
+
// private void doDiffProps4ElementNode(ElementNode node, HippyMap itemData, int itemPos, int step) {
|
|
1750
|
+
// doDiffProps4ElementNode(node,itemData,itemPos,step,true);
|
|
1751
|
+
// }
|
|
1752
|
+
private void doDiffProps4ElementNode(ElementNode node, HippyMap itemData, int itemPos, int step,boolean traverse) {
|
|
1753
|
+
final HippyMap rawMap = node.templateNode.getProps();
|
|
1754
|
+
HippyMap toMap, oldMap;
|
|
1755
|
+
// if (LogUtils.isDebug()) {
|
|
1756
|
+
// if (node.hasInit) {
|
|
1757
|
+
// Log.e(TAG, "testHasInit patch hasInit:" + true + ",node:" + node);
|
|
1758
|
+
// } else {
|
|
1759
|
+
// Log.i(TAG, "testHasInit patch hasInit:" + false + ",node:" + node);
|
|
1760
|
+
// }
|
|
1761
|
+
// }
|
|
1762
|
+
// if(mBoundListView != null && mBoundListView.getAutofocusPosition() > -1 && node.boundView instanceof ITVView && node.boundView.isFocusable()){
|
|
1763
|
+
// ((ITVView) node.boundView).setAutoFocus(mBoundListView.getAutofocusPosition() == itemPos);
|
|
1764
|
+
// Log.i(TAG,"发现autofocusPosition set Auto focus");
|
|
1765
|
+
// }
|
|
1766
|
+
toMap = new HippyMap();
|
|
1767
|
+
if (!node.hasInit) {
|
|
1768
|
+
//首次初始化时,将所有prop都初始化一遍
|
|
1769
|
+
oldMap = null;
|
|
1770
|
+
FastAdapterUtil.preInitElementNodeProps(node,itemData,rawMap,toMap);
|
|
1771
|
+
} else {
|
|
1772
|
+
//doPendingProps
|
|
1773
|
+
//只去比如pending的数据
|
|
1774
|
+
if(step == STEP_UPDATE_ITEM){
|
|
1775
|
+
// oldMap = node.pendingProps;
|
|
1776
|
+
// FastAdapterUtil.preGeneratePropsToUpdateWithoutPendingProp(node, itemData, rawMap, toMap);
|
|
1777
|
+
oldMap = node.pendingProps;
|
|
1778
|
+
FastAdapterUtil.preGeneratePropsToUpdateWithoutPendingProp(node,itemData,rawMap,toMap);
|
|
1779
|
+
}else {
|
|
1780
|
+
oldMap = node.pendingProps;
|
|
1781
|
+
FastAdapterUtil.preGeneratePropsToUpdate(node, itemData, rawMap, toMap);
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
//和原有的map对比
|
|
1785
|
+
//old
|
|
1786
|
+
/**
|
|
1787
|
+
* {
|
|
1788
|
+
* progress:100,
|
|
1789
|
+
* list:[item1,item2]
|
|
1790
|
+
* }
|
|
1791
|
+
*/
|
|
1792
|
+
//new
|
|
1793
|
+
/**
|
|
1794
|
+
* {
|
|
1795
|
+
* progress:60,
|
|
1796
|
+
* list:[item1,item2]
|
|
1797
|
+
* }
|
|
1798
|
+
*/
|
|
1799
|
+
// if (step == FastAdapter.STEP_UPDATE_ITEM) {
|
|
1800
|
+
// String stepPrefix = ""+step;
|
|
1801
|
+
// Log.i("DebugReplaceItem","-------old Map:"+oldMap);
|
|
1802
|
+
// if(oldMap != null) {
|
|
1803
|
+
// for (String key : oldMap.keySet()) {
|
|
1804
|
+
// Log.i("DebugReplaceItem", stepPrefix + " ----diffPatch path prop:" + key + ",value:" + oldMap.get(key));
|
|
1805
|
+
// }
|
|
1806
|
+
// }
|
|
1807
|
+
// Log.i("DebugReplaceItem","-------toMap Map:"+toMap);
|
|
1808
|
+
// for (String key : toMap.keySet()) {
|
|
1809
|
+
// Log.i("DebugReplaceItem", stepPrefix+" ----diffPatch path prop:" + key+",value:"+toMap.get(key));
|
|
1810
|
+
// }
|
|
1811
|
+
// }
|
|
1812
|
+
// if(LogUtils.isDebug()){
|
|
1813
|
+
// Log.d("DebugReplaceItem","---------------oldMap---------------------- size:"+ (oldMap == null ? 0 : oldMap.size()));
|
|
1814
|
+
// InternalExtendViewUtil.logMap(oldMap,"DebugReplaceItem");
|
|
1815
|
+
// Log.i("DebugReplaceItem","--------------------toMap---------------------- size:"+ (toMap == null ? 0 : toMap.size()));
|
|
1816
|
+
// InternalExtendViewUtil.logMap(toMap,"DebugReplaceItem");
|
|
1817
|
+
// }
|
|
1818
|
+
HippyMap toUpdate = DiffUtils.diffProps(oldMap, toMap, 0);
|
|
1819
|
+
// Log.i("DebugReplaceItem","--------------------toUpdate---------------------- size:"+ (toUpdate == null ? 0 : toUpdate.size()));
|
|
1820
|
+
// InternalExtendViewUtil.logMap(toUpdate,"DebugReplaceItem");
|
|
1821
|
+
if(toUpdate != null && toUpdate.containsKey(PendingViewController.PROP_LIST)){
|
|
1822
|
+
//FIXME 这里最好变成在调用updateItem时一次性更新时的判断,而不是所有的更新都生效
|
|
1823
|
+
// if(LogUtils.isDebug()) {
|
|
1824
|
+
// Log.e(TAG, "updateItem 包含嵌套List toMap traverse : " + traverse);
|
|
1825
|
+
// if (toUpdate.get(PendingViewController.PROP_LIST) instanceof HippyArray) {
|
|
1826
|
+
// final HippyArray array = toUpdate.getArray(PendingViewController.PROP_LIST);
|
|
1827
|
+
// for (int i = 0; i < array.size(); i++) {
|
|
1828
|
+
// final Object o = array.get(i);
|
|
1829
|
+
// Log.i("updateItem","----updateItem for list , item:"+o);
|
|
1830
|
+
// }
|
|
1831
|
+
// }
|
|
1832
|
+
// }
|
|
1833
|
+
//列表这里优化一下,加一个判断
|
|
1834
|
+
// if(itemData.containsKey(PendingViewController.PROP_UPDATE_NESTED)){
|
|
1835
|
+
// //这里用户期望不刷新下级列表
|
|
1836
|
+
// final boolean updateNested = itemData.getBoolean(PendingViewController.PROP_UPDATE_NESTED);
|
|
1837
|
+
// if(!updateNested){
|
|
1838
|
+
// Log.e(TAG, "updateItem diffPatch 用户设置了updateChildren false,忽略下级列表刷新");
|
|
1839
|
+
// toUpdate.remove(PendingViewController.PROP_LIST);
|
|
1840
|
+
// }
|
|
1841
|
+
// }
|
|
1842
|
+
|
|
1843
|
+
if(!traverse){
|
|
1844
|
+
toUpdate.remove(PendingViewController.PROP_LIST);
|
|
1845
|
+
}
|
|
1846
|
+
}
|
|
1847
|
+
if (LogUtils.isDebug() && step == FastAdapter.STEP_UPDATE_ITEM) {
|
|
1848
|
+
String stepPrefix = ""+step;
|
|
1849
|
+
Log.i("DebugReplaceItem", stepPrefix+" diffPatch path size:" + toUpdate.size() + ",oldSize:" + (oldMap == null ? 0 : oldMap.size()));
|
|
1850
|
+
for (String key : toUpdate.keySet()) {
|
|
1851
|
+
Log.i("DebugReplaceItem", stepPrefix+" ----diffPatch path prop:" + key+",value:"+toUpdate.get(key));
|
|
1852
|
+
}
|
|
1853
|
+
}
|
|
1854
|
+
//执行map中的属性变化
|
|
1855
|
+
final HippyViewController vc = CustomControllerHelper.getViewController(getControllerManager(), node.templateNode);
|
|
1856
|
+
CustomControllerHelper.updateExtraIfNeed(vc, node.boundView, node.templateNode);
|
|
1857
|
+
FastAdapterUtil.invokePropsSync(vc, toUpdate, itemPos, node, FastAdapter.this,step); // 用处理好的属性key和value 进行处理
|
|
1858
|
+
ExtendUtil.resetViewWithFocusable(node.boundView);
|
|
1859
|
+
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1862
|
+
private static boolean isAddVif4ElementNode(ElementNode node,HippyMap itemData,int itemPos){
|
|
1863
|
+
if(node.initConfig.needCheckVIF && node.templateNode != null){
|
|
1864
|
+
boolean value = TemplateCodeParser.parseBooleanFromPendingProp(
|
|
1865
|
+
TemplateCodeParser.PENDING_PROP_CREATE_IF, itemData, node.templateNode.getProps().get(TemplateCodeParser.PENDING_PROP_CREATE_IF));
|
|
1866
|
+
if (value) {
|
|
1867
|
+
if(LogUtils.isDebug()){
|
|
1868
|
+
Log.e("CheckVIF","+++dealVif4ElementNode crateView condition true :"+node.templateNode.getProps().get(TemplateCodeParser.PENDING_PROP_CREATE_IF)+",itemPos:"+itemPos);
|
|
1869
|
+
}
|
|
1870
|
+
return true;
|
|
1871
|
+
}
|
|
1872
|
+
}
|
|
1873
|
+
return false;
|
|
1874
|
+
}
|
|
1875
|
+
|
|
1876
|
+
void onElementViewCreated(ElementNode en){
|
|
1877
|
+
if (en.boundView instanceof HippyImageView) {
|
|
1878
|
+
// Log.i("DebugImage","onElementViewCreated imageView :"+en);
|
|
1879
|
+
if(globalConfig != null) {
|
|
1880
|
+
((HippyImageView) en.boundView).setFadeEnabled(globalConfig.fadeImageEnable);
|
|
1881
|
+
if (globalConfig.fadeImageEnable) {
|
|
1882
|
+
((HippyImageView) en.boundView).setFadeDuration(globalConfig.fadeDuration);
|
|
1883
|
+
}
|
|
1884
|
+
}
|
|
1885
|
+
if(en.initConfig.enableCoverRole){
|
|
1886
|
+
ItemRootView iv = findItemRootView(en);
|
|
1887
|
+
// Log.v("ZHAOPENG","update all preLoadView node.boundView:"+ExtendUtil.debugViewLite(en.boundView)+",iv:"+ExtendUtil.debugViewLite(iv));
|
|
1888
|
+
if(iv != null) {
|
|
1889
|
+
iv.registerCoverView(en);
|
|
1890
|
+
}
|
|
1891
|
+
}
|
|
1892
|
+
|
|
1893
|
+
}
|
|
1894
|
+
}
|
|
1895
|
+
|
|
1896
|
+
ItemRootView findItemRootView(ElementNode e){
|
|
1897
|
+
ElementNode root = e != null ? e.rootNode : null;
|
|
1898
|
+
if(root != null){
|
|
1899
|
+
if(root.boundView instanceof ItemRootView) {
|
|
1900
|
+
return (ItemRootView) root.boundView;
|
|
1901
|
+
}
|
|
1902
|
+
if(root.boundView != null && root.boundView.getParent() instanceof ItemRootView){
|
|
1903
|
+
return (ItemRootView) root.boundView.getParent();
|
|
1904
|
+
}
|
|
1905
|
+
}
|
|
1906
|
+
return null;
|
|
1907
|
+
}
|
|
1908
|
+
|
|
1909
|
+
ItemRootView findItemRootViewByPosition(int position){
|
|
1910
|
+
View view = getFastPendingView().findViewByPosition(position);
|
|
1911
|
+
if(view instanceof ItemRootView) {
|
|
1912
|
+
return (ItemRootView) view;
|
|
1913
|
+
}
|
|
1914
|
+
return null;
|
|
1915
|
+
}
|
|
1916
|
+
|
|
1917
|
+
void createViewRecursiveOnVIF(ElementNode en,HippyMap itemData,View parent){
|
|
1918
|
+
RenderNode templateNode = en.templateNode;
|
|
1919
|
+
if(LogUtils.isDebug() && en.initConfig.needCheckVIF) {
|
|
1920
|
+
Log.i(TAG, "createViewRecursiveOnVIF------------------------ ------------------------------------------------- item:"+itemData
|
|
1921
|
+
+"en.boundView:"+en.boundView);
|
|
1922
|
+
}
|
|
1923
|
+
if(en.boundView == null ){
|
|
1924
|
+
if(en.initConfig.needCheckVIF){
|
|
1925
|
+
if(isAddVif4ElementNode(en,itemData,en.adapterPosition)) {
|
|
1926
|
+
en.boundView = createView4ElementNode(getControllerManager(), en, getRootListView(), parent,STEP_VIF);
|
|
1927
|
+
onElementViewCreated(en);
|
|
1928
|
+
}else {
|
|
1929
|
+
if(LogUtils.isDebug()) {
|
|
1930
|
+
Log.e("CheckVIF", "createViewRecursiveOnVIF return on isAddVif4ElementNode false:" + templateNode + ",itemData:" + itemData);
|
|
1931
|
+
}
|
|
1932
|
+
return;
|
|
1933
|
+
}
|
|
1934
|
+
}else{
|
|
1935
|
+
en.boundView = createView4ElementNode(getControllerManager(), en, getRootListView(),parent, STEP_VIF);
|
|
1936
|
+
onElementViewCreated(en);
|
|
1937
|
+
// Log.i("CheckVIF", "createViewRecursiveOnVIF add on needCheckVIF false:" + templateNode);
|
|
1938
|
+
}
|
|
1939
|
+
}else{
|
|
1940
|
+
if(en.initConfig.needCheckVIF){
|
|
1941
|
+
if(isAddVif4ElementNode(en,itemData,en.adapterPosition)) {
|
|
1942
|
+
if (en.boundView.getParent() == null) {
|
|
1943
|
+
// Log.i("CheckVIF", "createViewRecursiveOnVIF attachViewToParent on en.boundView != null:" + en.boundView+",item:"+itemData);
|
|
1944
|
+
attachViewToParent(en);
|
|
1945
|
+
}
|
|
1946
|
+
}else{
|
|
1947
|
+
// Log.e("CheckVIF", "createViewRecursiveOnVIF return attachViewToParent isAddVif4ElementNode false:" + templateNode+",itemData:"+itemData);
|
|
1948
|
+
return;
|
|
1949
|
+
}
|
|
1950
|
+
}else{
|
|
1951
|
+
if (en.boundView.getParent() == null) {
|
|
1952
|
+
// Log.i("CheckVIF", "createViewRecursiveOnVIF attachViewToParent on en.boundView != null:" + en.boundView+",item:"+itemData);
|
|
1953
|
+
attachViewToParent(en);
|
|
1954
|
+
}// Log.e("CheckVIF", "createViewRecursiveOnVIF attachViewToParent parent != null :" + en.boundView+",item:"+itemData);
|
|
1955
|
+
}
|
|
1956
|
+
}
|
|
1957
|
+
if (en.getChildCount() > 0) {
|
|
1958
|
+
for (int i = 0; i < en.getChildCount(); i++) {
|
|
1959
|
+
ElementNode child = (ElementNode) en.getChildAt(i);
|
|
1960
|
+
if (Utils.isPendingListNode(templateNode) && Utils.isPendingItemNode(child.templateNode)) {
|
|
1961
|
+
break;
|
|
1962
|
+
}
|
|
1963
|
+
createViewRecursiveOnVIF(child,itemData,en.boundView);
|
|
1964
|
+
}
|
|
1965
|
+
}
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1968
|
+
static void clearNodeView(ElementNode node){
|
|
1969
|
+
if (node.boundView != null) {
|
|
1970
|
+
FastAdapterUtil.removeFromParentIfNeed(node.boundView);
|
|
1971
|
+
// if (LogUtils.isDebug()) {
|
|
1972
|
+
// Log.e("CheckVIF", "createViewRecursiveOnVIF ---clearNodeView:" + node.templateNode);
|
|
1973
|
+
// }
|
|
1974
|
+
}
|
|
1975
|
+
for(int i = 0; i < node.getChildCount(); i ++){
|
|
1976
|
+
clearNodeView((ElementNode) node.getChildAt(i));
|
|
1977
|
+
}
|
|
1978
|
+
node.boundView = null;
|
|
1979
|
+
node.hasInit = false;
|
|
1980
|
+
node.hasCreateView = false;
|
|
1981
|
+
}
|
|
1982
|
+
|
|
1983
|
+
static void removeVif4ElementNode(ElementNode node,HippyMap itemData,int itemPos){
|
|
1984
|
+
if(node.initConfig.needCheckVIF && node.templateNode != null && node.boundView != null){
|
|
1985
|
+
boolean value = TemplateCodeParser.parseBooleanFromPendingProp(
|
|
1986
|
+
TemplateCodeParser.PENDING_PROP_CREATE_IF, itemData, node.templateNode.getProps().get(TemplateCodeParser.PENDING_PROP_CREATE_IF));
|
|
1987
|
+
if(!value) {
|
|
1988
|
+
if (LogUtils.isDebug()) {
|
|
1989
|
+
Log.i("CheckVIF", "createViewRecursiveOnVIF ---clearNodeView removeVif4ElementNode !value itemPos" + itemPos+",node.boundView:"+node.boundView);
|
|
1990
|
+
}
|
|
1991
|
+
if (node.boundView != null) {
|
|
1992
|
+
clearNodeView(node);
|
|
1993
|
+
}
|
|
1994
|
+
}else{
|
|
1995
|
+
if (LogUtils.isDebug()) {
|
|
1996
|
+
Log.e("CheckVIF", "createViewRecursiveOnVIF ---clearNodeView removeVif4ElementNode itemPos" + itemPos);
|
|
1997
|
+
}
|
|
1998
|
+
}
|
|
1999
|
+
}
|
|
2000
|
+
}
|
|
2001
|
+
|
|
2002
|
+
|
|
2003
|
+
// protected void onAfterDiffProps(ElementNode node) {
|
|
2004
|
+
// //
|
|
2005
|
+
// if (node.boundView instanceof HippyImageView && HippyImageViewController.CLASS_NAME.equals(node.templateNode.getClassName())) {
|
|
2006
|
+
// HippyImageView.RoleType roleType = ((HippyImageView) node.boundView).getRoleType();
|
|
2007
|
+
// if(roleType == HippyImageView.RoleType.COVER){
|
|
2008
|
+
// Log.v("ZHAOPENG","update all preLoadView node.boundView:"+ExtendUtil.debugViewLite(node.boundView)+",rootView:"+node);
|
|
2009
|
+
// node.rootNode.registerCoverView((HippyImageView) node.boundView);
|
|
2010
|
+
// }
|
|
2011
|
+
// }
|
|
2012
|
+
// }
|
|
2013
|
+
|
|
2014
|
+
/**
|
|
2015
|
+
* 更新所有placeholder阶段预先加载view的属性
|
|
2016
|
+
* @param node
|
|
2017
|
+
* @param itemData
|
|
2018
|
+
* @param itemPos
|
|
2019
|
+
*/
|
|
2020
|
+
private void updateAllPreLoadViewRecursive(Holder holder,ElementNode node, HippyMap itemData, int itemPos,boolean traverse,int step) {
|
|
2021
|
+
// RenderNode templateNode = node.templateNode;
|
|
2022
|
+
//1. 先删除
|
|
2023
|
+
//2. 创建
|
|
2024
|
+
//3. 执行props
|
|
2025
|
+
removeVif4ElementNode(node,itemData,itemPos);
|
|
2026
|
+
boolean isInvokeProps = node.boundView != null;
|
|
2027
|
+
if (isInvokeProps) {
|
|
2028
|
+
//只有嵌套的子列表,还有placeholder才执行属性方法
|
|
2029
|
+
isInvokeProps = node.initConfig.createViewOnInit ;
|
|
2030
|
+
//如果有postDelay,直接执行
|
|
2031
|
+
// isInvokeProps |= (node.initConfig.enablePostDelay);
|
|
2032
|
+
isInvokeProps |= (node.initConfig.enablePostDelay && !node.initConfig.enableDelayLoad);
|
|
2033
|
+
}
|
|
2034
|
+
//如果是更新item,也执行属性方法
|
|
2035
|
+
isInvokeProps |= (step == STEP_UPDATE_ITEM);
|
|
2036
|
+
if(isInvokeProps){
|
|
2037
|
+
if (node.boundView instanceof FastListView) {
|
|
2038
|
+
//这里嵌套的子list时,将任务暂时取消
|
|
2039
|
+
((FastListView) node.boundView).pausePostTask();
|
|
2040
|
+
}
|
|
2041
|
+
doDiffProps4ElementNode(node,itemData,itemPos,step,traverse);
|
|
2042
|
+
// if (node.boundView instanceof HippyImageView && HippyImageViewController.CLASS_NAME.equals(node.templateNode.getClassName())) {
|
|
2043
|
+
// HippyImageView.RoleType roleType = ((HippyImageView) node.boundView).getRoleType();
|
|
2044
|
+
// if(roleType == HippyImageView.RoleType.COVER){
|
|
2045
|
+
// Log.v("ZHAOPENG","update all preLoadView node.boundView:"+ExtendUtil.debugViewLite(node.boundView)+",rootView:"+node);
|
|
2046
|
+
// //node.rootNode.coverView = ((HippyImageView) node.boundView);
|
|
2047
|
+
// if (holder.findItemRootView() != null) {
|
|
2048
|
+
// Objects.requireNonNull(holder.findItemRootView()).registerCoverView((HippyImageView) node.boundView);
|
|
2049
|
+
// }
|
|
2050
|
+
// }
|
|
2051
|
+
// }
|
|
2052
|
+
if (enablePlaceholder && node.boundView != null) {
|
|
2053
|
+
if(!(node.boundView instanceof ItemContainer)) {
|
|
2054
|
+
//如果node.boundView是一个ItemContainer,则他的可聚焦性在创建时已经确定,不能在这里置成false
|
|
2055
|
+
if(!node.rootNode.initConfig.disablePlaceholderFocus){
|
|
2056
|
+
node.boundView.setFocusable(false);
|
|
2057
|
+
}
|
|
2058
|
+
}
|
|
2059
|
+
|
|
2060
|
+
}
|
|
2061
|
+
}
|
|
2062
|
+
// if (node.isRootItem) {
|
|
2063
|
+
// if (node.boundView instanceof TVBaseView) {
|
|
2064
|
+
// Log.i("DebugPlaceholder","root node boundView focusScale:"+((TVBaseView) node.boundView).getFocusScale()+",view:"+ExtendUtil.debugViewLite(node.boundView));
|
|
2065
|
+
// }
|
|
2066
|
+
// }
|
|
2067
|
+
|
|
2068
|
+
//更新节点里的map
|
|
2069
|
+
//node.props = toMap;
|
|
2070
|
+
if (node.templateNode instanceof ListNode) {
|
|
2071
|
+
// 如果嵌套list的话,不应该继续处理子节点,而是由子list自己处理
|
|
2072
|
+
Log.e("DebugReplaceItem","updateAllPreLoadViewRecursive node is ListNode,return ");
|
|
2073
|
+
return;
|
|
2074
|
+
}
|
|
2075
|
+
for (int i = 0; i < node.getChildCount(); i++) {
|
|
2076
|
+
// 这里的(ElementNode) node.getChildAt(i) 一定是ElementNode类型?
|
|
2077
|
+
final ElementNode child = (ElementNode) node.getChildAt(i);
|
|
2078
|
+
updateAllPreLoadViewRecursive(holder,child, itemData, itemPos,traverse,step);
|
|
2079
|
+
}
|
|
2080
|
+
}
|
|
2081
|
+
|
|
2082
|
+
/**
|
|
2083
|
+
* 将所有ElementNode的属性在主线程里全部更新
|
|
2084
|
+
* @param node
|
|
2085
|
+
* @param itemData
|
|
2086
|
+
* @param itemPos
|
|
2087
|
+
*/
|
|
2088
|
+
private void updateAllPropsRecursive(ElementNode node, HippyMap itemData, int itemPos, View parent,boolean traverse,int step) {
|
|
2089
|
+
if(node.initConfig.needCheckVIF){
|
|
2090
|
+
//先删除
|
|
2091
|
+
removeVif4ElementNode(node,itemData,itemPos);
|
|
2092
|
+
//再添加
|
|
2093
|
+
createViewRecursiveOnVIF(node,itemData,parent);
|
|
2094
|
+
}
|
|
2095
|
+
if (node.boundView == null) {
|
|
2096
|
+
return;
|
|
2097
|
+
}
|
|
2098
|
+
doDiffProps4ElementNode(node,itemData,itemPos,step,traverse);
|
|
2099
|
+
//更新节点里的map
|
|
2100
|
+
//node.props = toMap;
|
|
2101
|
+
if (node.templateNode instanceof ListNode) {
|
|
2102
|
+
// 如果嵌套list的话,不应该继续处理子节点,而是由子list自己处理
|
|
2103
|
+
return;
|
|
2104
|
+
}
|
|
2105
|
+
for (int i = 0; i < node.getChildCount(); i++) {
|
|
2106
|
+
// 这里的(ElementNode) node.getChildAt(i) 一定是ElementNode类型?
|
|
2107
|
+
updateAllPropsRecursive((ElementNode) node.getChildAt(i), itemData, itemPos, node.boundView,traverse,step);
|
|
2108
|
+
}
|
|
2109
|
+
}
|
|
2110
|
+
|
|
2111
|
+
/**
|
|
2112
|
+
* 在主线程里将ElementNode的属性更新
|
|
2113
|
+
* @param node
|
|
2114
|
+
* @param itemData
|
|
2115
|
+
* @param itemPos
|
|
2116
|
+
*/
|
|
2117
|
+
private void postUpdatePropsRecursive(ElementNode node, HippyMap itemData, int itemPos, int step) {
|
|
2118
|
+
// if(node.boundView != null){
|
|
2119
|
+
// if(node.boundView != null && !node.initConfig.createViewOnInit && !node.isMarkToDelay){
|
|
2120
|
+
if(node.boundView != null && !node.initConfig.createViewOnInit && !node.isMarkToDelay){
|
|
2121
|
+
// if(node.initConfig.needCheckVIF){
|
|
2122
|
+
// Log.i("CheckVIF","doPostUpdatePropsRecursive handle needCheckVIF node.boundView:"+node.boundView+",itemData:"+itemData);
|
|
2123
|
+
// }
|
|
2124
|
+
doDiffProps4ElementNode(node,itemData,itemPos,step,true);
|
|
2125
|
+
}else if(LogUtils.isDebug()){
|
|
2126
|
+
if(node.initConfig.needCheckVIF){
|
|
2127
|
+
Log.e("CheckVIF","!!doPostUpdatePropsRecursive no handle needCheckVIF node.boundView:"+node.boundView+",itemData:"+itemData);
|
|
2128
|
+
}
|
|
2129
|
+
}
|
|
2130
|
+
//更新节点里的map
|
|
2131
|
+
//node.props = toMap;
|
|
2132
|
+
if (node.templateNode instanceof ListNode) {
|
|
2133
|
+
// 如果嵌套list的话,不应该继续处理子节点,而是由子list自己处理
|
|
2134
|
+
return;
|
|
2135
|
+
}
|
|
2136
|
+
for (int i = 0; i < node.getChildCount(); i++) {
|
|
2137
|
+
// 这里的(ElementNode) node.getChildAt(i) 一定是ElementNode类型?
|
|
2138
|
+
postUpdatePropsRecursive((ElementNode) node.getChildAt(i), itemData, itemPos,step);
|
|
2139
|
+
}
|
|
2140
|
+
}
|
|
2141
|
+
|
|
2142
|
+
public static FastItemView findTVItemViewById(View view, String id) {
|
|
2143
|
+
// if(LogUtils.isDebug()) {
|
|
2144
|
+
// LogUtils.d("ZHAOPENG","findTVItemViewById id:"+id+",View:"+view);
|
|
2145
|
+
// }
|
|
2146
|
+
if (id == null || view == null) {
|
|
2147
|
+
return null;
|
|
2148
|
+
}
|
|
2149
|
+
if (view instanceof FastItemView && id.equals(view.getTag(R.id.tag_item_id))) {
|
|
2150
|
+
return (FastItemView) view;
|
|
2151
|
+
}
|
|
2152
|
+
if (view instanceof IPageRootView) {
|
|
2153
|
+
// Log.e("ZHAOPENG","findTVItemViewById fid IPageRootView id:"+id+",getPageContentView:"+((IPageRootView) view).getPageContentView());
|
|
2154
|
+
FastItemView result = findTVItemViewById(((IPageRootView) view).getPageContentView(), id);
|
|
2155
|
+
if (result != null) {
|
|
2156
|
+
return result;
|
|
2157
|
+
}
|
|
2158
|
+
}
|
|
2159
|
+
if (view instanceof ViewGroup) {
|
|
2160
|
+
if (view instanceof HippyViewGroup) {
|
|
2161
|
+
if (((HippyViewGroup) view).isPageHidden()) {
|
|
2162
|
+
//只找没有隐藏的页面
|
|
2163
|
+
LogUtils.e(TAG, "findTVItemViewById return on pageHidden");
|
|
2164
|
+
return null;
|
|
2165
|
+
}
|
|
2166
|
+
}
|
|
2167
|
+
for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) {
|
|
2168
|
+
View result = findTVItemViewById(((ViewGroup) view).getChildAt(i), id);
|
|
2169
|
+
if (result != null) {
|
|
2170
|
+
if (LogUtils.isDebug()) {
|
|
2171
|
+
LogUtils.i(TAG, "findTVItemViewById found target id:" + id + ",View:" + view);
|
|
2172
|
+
}
|
|
2173
|
+
return (FastItemView) result;
|
|
2174
|
+
}
|
|
2175
|
+
}
|
|
2176
|
+
}
|
|
2177
|
+
return null;
|
|
2178
|
+
}
|
|
2179
|
+
|
|
2180
|
+
public void setStableIdKey(String key){
|
|
2181
|
+
this.mUserKeyName = key;
|
|
2182
|
+
if(LogUtils.isDebug()) {
|
|
2183
|
+
Log.i("DebugUpdate", "setKeyName mUserKeyName:" + mUserKeyName+",this:"+hashCode());
|
|
2184
|
+
}
|
|
2185
|
+
try {
|
|
2186
|
+
setHasStableIds(!TextUtils.isEmpty(key));
|
|
2187
|
+
}catch (Throwable t){
|
|
2188
|
+
Log.e("DebugUpdate","setStableIdKey error",t);
|
|
2189
|
+
}
|
|
2190
|
+
}
|
|
2191
|
+
|
|
2192
|
+
public String getStableIdKey(){
|
|
2193
|
+
return mUserKeyName;
|
|
2194
|
+
}
|
|
2195
|
+
|
|
2196
|
+
final Object getIDFromData(int position){
|
|
2197
|
+
return FastAdapterUtil.getIDFromData(getRawObject(position));
|
|
2198
|
+
}
|
|
2199
|
+
|
|
2200
|
+
public int findItemPositionBySID(final String id) {
|
|
2201
|
+
if (id == null) {
|
|
2202
|
+
return -1;
|
|
2203
|
+
}
|
|
2204
|
+
int count = getItemCount();
|
|
2205
|
+
for (int i = 0; i < count; i++) {
|
|
2206
|
+
Object item = getRawObject(i);
|
|
2207
|
+
if (item instanceof HippyMap) {
|
|
2208
|
+
HippyMap map = (HippyMap) item;
|
|
2209
|
+
if (id.equals(FastAdapterUtil.getIDFromData(map))) {
|
|
2210
|
+
return i;
|
|
2211
|
+
}
|
|
2212
|
+
}
|
|
2213
|
+
}
|
|
2214
|
+
return -1;
|
|
2215
|
+
}
|
|
2216
|
+
|
|
2217
|
+
|
|
2218
|
+
|
|
2219
|
+
|
|
2220
|
+
// 属性赋值主要方法
|
|
2221
|
+
void preConfigID4Item(Holder holder, ElementNode itemNode, int position, HippyMap map){
|
|
2222
|
+
//这里方法主要为了兼容之前的版本,这里不再需要单独设置,可以直接使用sid属性设置
|
|
2223
|
+
final View contentView = FastAdapterUtil.getRealContent(holder);
|
|
2224
|
+
// if(itemNode.templateNode.getProps().containsKey("sid")){
|
|
2225
|
+
//
|
|
2226
|
+
// }
|
|
2227
|
+
boolean hasSetID = false;
|
|
2228
|
+
if (contentView != null) {
|
|
2229
|
+
if (map.containsKey("id")) {
|
|
2230
|
+
ExtendUtil.putViewSID(contentView,map.getString("id"));
|
|
2231
|
+
hasSetID = true;
|
|
2232
|
+
}else{
|
|
2233
|
+
// ExtendUtil.putViewSID(contentView,null);
|
|
2234
|
+
// if (map.containsKey("key")) {
|
|
2235
|
+
// ExtendUtil.putViewSID(contentView,map.getString("key"));
|
|
2236
|
+
// hasSetID = true;
|
|
2237
|
+
// }
|
|
2238
|
+
}
|
|
2239
|
+
if(map.containsKey("_id")){
|
|
2240
|
+
ExtendUtil.putViewSID(contentView,map.getString("_id"));
|
|
2241
|
+
}else{
|
|
2242
|
+
if(!hasSetID) {
|
|
2243
|
+
ExtendUtil.putViewSID(contentView, null);
|
|
2244
|
+
}
|
|
2245
|
+
}
|
|
2246
|
+
}
|
|
2247
|
+
if(LogUtils.isDebug()){
|
|
2248
|
+
Log.i("configID4Item","configID4Item contentView :"+ExtendUtil.debugViewLite(contentView));
|
|
2249
|
+
}
|
|
2250
|
+
}
|
|
2251
|
+
|
|
2252
|
+
public void preUpdatePropsRecursive(Holder holder, int position, boolean traverse) {
|
|
2253
|
+
this.preUpdatePropsRecursive(holder, position, traverse,STEP_ON_BIND);
|
|
2254
|
+
}
|
|
2255
|
+
|
|
2256
|
+
|
|
2257
|
+
@Deprecated
|
|
2258
|
+
public void updateItemOnReplace(Holder holder, int position,boolean traverse){
|
|
2259
|
+
// final ItemEntity ie = getItemEntity(position);
|
|
2260
|
+
// if (ie != null) {
|
|
2261
|
+
// if (ie.updateItemDirty) {
|
|
2262
|
+
// Log.e("DebugReplaceItem","updateItemOnReplace found updateItemDirty ie:"+ie.raw);
|
|
2263
|
+
// }
|
|
2264
|
+
// ie.updateItemDirty = false;
|
|
2265
|
+
// }
|
|
2266
|
+
this.preUpdatePropsRecursive(holder,position,traverse,STEP_UPDATE_ITEM);
|
|
2267
|
+
}
|
|
2268
|
+
|
|
2269
|
+
|
|
2270
|
+
/**
|
|
2271
|
+
* 使用position对应数据对象,将holder中所有view使用数据更新
|
|
2272
|
+
* @param holder
|
|
2273
|
+
* @param position
|
|
2274
|
+
*/
|
|
2275
|
+
public void preUpdatePropsRecursive(Holder holder, int position, boolean traverse, int step) {
|
|
2276
|
+
if (LogUtils.isDebug()) {
|
|
2277
|
+
int itemTpe = getItemViewType(position);
|
|
2278
|
+
Log.d(TAG, "FastAdapterEvent exeBindViewHolder pos :" + position
|
|
2279
|
+
+",itemType:" + itemTpe + ",holder:" + Utils.hashCode(holder)
|
|
2280
|
+
+ ",itemView:" + Utils.hashCode(holder.itemView) + ",attached:" + holder.attached
|
|
2281
|
+
+ ",traverse:" +traverse
|
|
2282
|
+
+ ",enablePlaceholder:" +enablePlaceholder
|
|
2283
|
+
)
|
|
2284
|
+
;
|
|
2285
|
+
}
|
|
2286
|
+
final ViewTag vt = holder.tag;
|
|
2287
|
+
final ElementNode rootNode = vt.getRootNode();
|
|
2288
|
+
//TODO 遍历出需要删除的view,并且删除
|
|
2289
|
+
//遍历Element节点
|
|
2290
|
+
//将pendingMap的值根据position拿到,将toMap中对应的值进行赋值
|
|
2291
|
+
//将fromMap 和 toMap 去比对
|
|
2292
|
+
//执行出比对完需要更新的属性
|
|
2293
|
+
vt.cancelWork();
|
|
2294
|
+
final HippyMap map = (HippyMap) getRawObject(position);
|
|
2295
|
+
preConfigID4Item(holder,rootNode,position,map);
|
|
2296
|
+
//vt.work(new ElementDiffPatch(this, rootNode, map, position,getRootListView()));
|
|
2297
|
+
if (enablePlaceholder) {
|
|
2298
|
+
updateAllPreLoadViewRecursive(holder,rootNode,map,position,traverse,step);
|
|
2299
|
+
// if(rootNode.boundView instanceof ITVView && holder.itemView instanceof ItemRootView && holder.itemView.isFocusable()) {
|
|
2300
|
+
// ItemRootView ir = (ItemRootView) holder.itemView;
|
|
2301
|
+
// ITVView tv = (ITVView) rootNode.boundView;
|
|
2302
|
+
// ir.setFocusScaleX(rootNode.tem);
|
|
2303
|
+
// rootNode.initConfig.placeholderScale
|
|
2304
|
+
// ir.setFocusScaleY(tv.getFocusScaleY());
|
|
2305
|
+
// tv.setFocusScale(1);
|
|
2306
|
+
// }
|
|
2307
|
+
}else {
|
|
2308
|
+
updateAllPropsRecursive(rootNode, map, position,null,traverse,STEP_INIT);
|
|
2309
|
+
}
|
|
2310
|
+
//dispatchPropsRecursiveAsync(rootNode,map,position);
|
|
2311
|
+
}
|
|
2312
|
+
|
|
2313
|
+
public void requestItemLayout(Holder holder, int position) {
|
|
2314
|
+
|
|
2315
|
+
final ViewTag vt = holder.tag;
|
|
2316
|
+
final ElementNode node = vt.getRootNode();
|
|
2317
|
+
if (node != null) {
|
|
2318
|
+
measureAllCreatedView(node);
|
|
2319
|
+
node.calculateLayout();
|
|
2320
|
+
//layout所有delay的View
|
|
2321
|
+
updateItemLayoutInside(node);
|
|
2322
|
+
}
|
|
2323
|
+
}
|
|
2324
|
+
|
|
2325
|
+
private void sendOnBindEvent4singleton(Holder holder, int position) {
|
|
2326
|
+
this.sendEvent4Singleton(holder, position, "onBindItem");
|
|
2327
|
+
}
|
|
2328
|
+
|
|
2329
|
+
private void sendEvent4Singleton(Holder holder, int position, String eventName) {
|
|
2330
|
+
if (holder.singleton) {
|
|
2331
|
+
if (position < 0 || dataList == null || dataList.size() < position) {
|
|
2332
|
+
return;
|
|
2333
|
+
}
|
|
2334
|
+
final HippyViewEvent event = new HippyViewEvent(eventName);
|
|
2335
|
+
final RenderNode node = holder.tag.template;
|
|
2336
|
+
HippyMap map = new HippyMap();
|
|
2337
|
+
map.pushInt("position", position);
|
|
2338
|
+
map.pushObject("item", getRawObject(position));
|
|
2339
|
+
if (node != null) {
|
|
2340
|
+
map.pushObject("name", Utils.getNameFromProps(node.getProps()));
|
|
2341
|
+
}
|
|
2342
|
+
if (LogUtils.isDebug()) {
|
|
2343
|
+
Log.i("BindEvent", "sendEvent4Singleton " + eventName + " position:" + position);
|
|
2344
|
+
}
|
|
2345
|
+
//event.send(holder.itemView, map);
|
|
2346
|
+
if(holder.itemView instanceof ItemContainer){
|
|
2347
|
+
if(((ItemContainer) holder.itemView).getContentView() != null) {
|
|
2348
|
+
final View contentView = ((ItemContainer) holder.itemView).getContentView();
|
|
2349
|
+
if (LogUtils.isDebug()) {
|
|
2350
|
+
Log.i("BindEvent", "sendEvent4Singleton contentView is " +contentView +",id : "+(contentView == null ? "null" : contentView.getId()));
|
|
2351
|
+
}
|
|
2352
|
+
eventDeliverer.sendEvent(event, ((ItemContainer) holder.itemView).getContentView().getId(), map);
|
|
2353
|
+
}
|
|
2354
|
+
}else{
|
|
2355
|
+
eventDeliverer.sendEvent(event, holder.itemView.getId(), map);
|
|
2356
|
+
}
|
|
2357
|
+
}
|
|
2358
|
+
}
|
|
2359
|
+
|
|
2360
|
+
|
|
2361
|
+
private void sendUnBindEvent4singleton(Holder holder, int position) {
|
|
2362
|
+
this.sendEvent4Singleton(holder, position, "onItemRecycled");
|
|
2363
|
+
}
|
|
2364
|
+
|
|
2365
|
+
|
|
2366
|
+
/**
|
|
2367
|
+
* 请求将placeholder替代成contentView
|
|
2368
|
+
* @param holder
|
|
2369
|
+
* @param node
|
|
2370
|
+
* @param position
|
|
2371
|
+
* @param itemData
|
|
2372
|
+
*/
|
|
2373
|
+
private void requestPlaceholderToContent(final Holder holder,ElementNode node,int position,HippyMap itemData){
|
|
2374
|
+
if (holder.postTask != null) {
|
|
2375
|
+
holder.postTask.cancel = true;
|
|
2376
|
+
}
|
|
2377
|
+
if(LogUtils.isDebug()) {
|
|
2378
|
+
Log.i(TAG_POST, "PlaceholderToContent requestPlaceholderToContent position:" + position+",holder.itemView.hashCode():"+holder.itemView.hashCode()+",tag:"+holder.itemView.getTag());
|
|
2379
|
+
}
|
|
2380
|
+
if (node.initConfig.disablePlaceholder) {
|
|
2381
|
+
//如果节点disablePlaceholder,则不需要
|
|
2382
|
+
exePlaceholderToContent(holder,node,position,itemData);
|
|
2383
|
+
}else{
|
|
2384
|
+
PostTask task = new PostTask(node, new Runnable() {
|
|
2385
|
+
@Override
|
|
2386
|
+
public void run() {
|
|
2387
|
+
exePlaceholderToContent(holder,node,position,itemData);
|
|
2388
|
+
holder.postTask = null;
|
|
2389
|
+
}
|
|
2390
|
+
});
|
|
2391
|
+
holder.postTask = task;
|
|
2392
|
+
getRootListView().postTask(POST_TASK_CATEGORY_PLACEHOLDER_TO_CONTENT,holder.itemView.hashCode(),task,postDelay);
|
|
2393
|
+
}
|
|
2394
|
+
|
|
2395
|
+
}
|
|
2396
|
+
|
|
2397
|
+
|
|
2398
|
+
/**
|
|
2399
|
+
* 执行将placeholder替代成contentView
|
|
2400
|
+
* @param holder
|
|
2401
|
+
* @param itemENode
|
|
2402
|
+
* @param position
|
|
2403
|
+
* @param itemData
|
|
2404
|
+
*/
|
|
2405
|
+
private void exePlaceholderToContent(final Holder holder,ElementNode itemENode,int position,HippyMap itemData){
|
|
2406
|
+
if(LogUtils.isDebug()) {
|
|
2407
|
+
Log.i(TAG_POST, "PlaceholderToContent -----exePlaceholderToContent position:" + position);
|
|
2408
|
+
}
|
|
2409
|
+
if(!holder.placeholderState){
|
|
2410
|
+
if(LogUtils.isDebug()) {
|
|
2411
|
+
Log.e(TAG_POST, "PlaceholderToContent -----exePlaceholderToContent return !holder.placeholderState position:" + position);
|
|
2412
|
+
}
|
|
2413
|
+
return;
|
|
2414
|
+
}
|
|
2415
|
+
|
|
2416
|
+
if(!holder.singleton){
|
|
2417
|
+
createElementNodeViewRecursiveOnPost(itemENode,itemData,null);
|
|
2418
|
+
postUpdatePropsRecursive(itemENode,itemData,position,STEP_PLACEHOLDER_TO_CONTENT);
|
|
2419
|
+
//将所有数据与模版建立的view进行一一绑定
|
|
2420
|
+
//exeBindViewHolder(holder, position); // 属性赋值的主要方法
|
|
2421
|
+
//如果tv-item没有指定大小,而子view指定了大小,则使用子view中的大小
|
|
2422
|
+
measureAllCreatedView(itemENode);
|
|
2423
|
+
//属性绑定后,位置信息可能发生变化,重新计算
|
|
2424
|
+
itemENode.calculateLayout();
|
|
2425
|
+
//将itemView中的所有的View遍历,根据绑定的node节点来更新Layout
|
|
2426
|
+
updateItemLayoutInside(itemENode);
|
|
2427
|
+
dealDelayContent(holder,position);
|
|
2428
|
+
if (holder.itemView instanceof ItemRootView) {
|
|
2429
|
+
((ItemRootView) holder.itemView).afterPostBind();
|
|
2430
|
+
}
|
|
2431
|
+
}
|
|
2432
|
+
if (holder.itemView instanceof ItemContainer) {
|
|
2433
|
+
((ItemContainer) holder.itemView).toggle(false);
|
|
2434
|
+
holder.placeholderState = false;
|
|
2435
|
+
}
|
|
2436
|
+
}
|
|
2437
|
+
|
|
2438
|
+
/**
|
|
2439
|
+
* singleton BindViewHolder
|
|
2440
|
+
* @param holder
|
|
2441
|
+
* @param position
|
|
2442
|
+
* @param itemENode
|
|
2443
|
+
*/
|
|
2444
|
+
void onSingletBindViewHolder(@NonNull Holder holder, int position, ElementNode itemENode){
|
|
2445
|
+
if (LogUtils.isDebug()) {
|
|
2446
|
+
Log.d(TAG, "SingleItem onSingletBindViewHolder position:" + position + ",holder.hasInit:" + holder.hasOnBind);
|
|
2447
|
+
}
|
|
2448
|
+
int itemWidth = 0;
|
|
2449
|
+
int itemHeight = 0;
|
|
2450
|
+
final RenderNode rootNode = holder.tag.template;
|
|
2451
|
+
View nodeView = Utils.findBoundView(context, rootNode);
|
|
2452
|
+
// if (nodeView instanceof FastItemView) {
|
|
2453
|
+
// ((FastItemView) nodeView).toggle(true);
|
|
2454
|
+
// }
|
|
2455
|
+
HippyMap itemData = (HippyMap) getRawObject(position);
|
|
2456
|
+
if(nodeView != null) {
|
|
2457
|
+
if(nodeView.getParent() != holder.itemView){
|
|
2458
|
+
if (nodeView.getParent() instanceof ViewGroup) {
|
|
2459
|
+
// throw new IllegalStateException("FastAdapterEvent DebugPool onCreateViewHolder itemView的Parent不可有值 itemView:"+holder.itemView+",en:"+node+",viewType:"+viewType+",singleton:"+ holder.singleton);
|
|
2460
|
+
if (LogUtils.isDebug()) {
|
|
2461
|
+
Log.e(TAG, "SingleItem onSingletBindViewHolder nodeView remove from adapter vh" + holder.hashCode() + ",type:" + holder.type);
|
|
2462
|
+
}
|
|
2463
|
+
((ViewGroup) nodeView.getParent()).removeView(nodeView);
|
|
2464
|
+
}
|
|
2465
|
+
if(holder.itemView instanceof ItemRootView){
|
|
2466
|
+
final ItemRootView itemRootView = (ItemRootView) holder.itemView;
|
|
2467
|
+
itemRootView.setContentView(nodeView,true);
|
|
2468
|
+
}
|
|
2469
|
+
}
|
|
2470
|
+
sendOnBindEvent4singleton(holder, position);
|
|
2471
|
+
itemWidth = nodeView.getWidth();
|
|
2472
|
+
itemHeight = nodeView.getHeight();
|
|
2473
|
+
if ( nodeView instanceof FastItemView) {
|
|
2474
|
+
|
|
2475
|
+
if (rootNode.getChildCount() == 1) {
|
|
2476
|
+
itemWidth = rootNode.getChildAt(0).getWidth();
|
|
2477
|
+
itemHeight = rootNode.getChildAt(0).getHeight();
|
|
2478
|
+
Log.e(TAG, "SingleItem onSingletBindViewHolder fixTVItemSize:" + itemWidth + ",height:" + itemHeight);
|
|
2479
|
+
}
|
|
2480
|
+
|
|
2481
|
+
//FastAdapterUtil.updateLayout(holder.itemView, holder.itemView.getLeft(), holder.itemView.getTop(), itemWidth, itemHeight);
|
|
2482
|
+
int[] layout = new int[4];
|
|
2483
|
+
|
|
2484
|
+
FastAdapterUtil.findItemViewSize(rootNode,position,itemData,layout);
|
|
2485
|
+
if(itemWidth < 1){
|
|
2486
|
+
itemWidth = layout[2];
|
|
2487
|
+
}
|
|
2488
|
+
if(itemHeight < 1){
|
|
2489
|
+
itemHeight = layout[3];
|
|
2490
|
+
}
|
|
2491
|
+
FastAdapterUtil.updateLayout(holder.itemView, layout[0], layout[1], itemWidth, itemHeight);
|
|
2492
|
+
//FastAdapterUtil.updateLayout(nodeView, 0, 0, itemWidth, itemHeight);
|
|
2493
|
+
if (LogUtils.isDebug()) {
|
|
2494
|
+
Log.e(TAG, "SingleItem onSingletBindViewHolder updateLayout holder.itemView " + holder.itemView + ",nodeView:" + nodeView);
|
|
2495
|
+
Log.e(TAG, "SingleItem onSingletBindViewHolder updateLayout holder.itemWidth "
|
|
2496
|
+
+ itemWidth + ",holder.itemHeight:" + itemHeight+",layout x :"+layout[0]+",layout y:"+layout[1]+",layout width:"+layout[2]+",layout height:"+layout[3]);
|
|
2497
|
+
}
|
|
2498
|
+
}
|
|
2499
|
+
itemENode.setStyleWidth(itemWidth);
|
|
2500
|
+
itemENode.setStyleHeight(itemHeight);
|
|
2501
|
+
//requestPlaceholderToContent(holder,itemENode,position,itemData);
|
|
2502
|
+
}else{
|
|
2503
|
+
Log.e(TAG,"SingleItem onSingletBindViewHolder nodeView is null node :"+rootNode);
|
|
2504
|
+
}
|
|
2505
|
+
|
|
2506
|
+
assert rootNode != null;
|
|
2507
|
+
rootNode.updateViewRecursive();
|
|
2508
|
+
if (FastItemNode.isFastItemNode(rootNode)) {
|
|
2509
|
+
final HippyMap rawMap = rootNode.getProps();
|
|
2510
|
+
Set<String> props = rawMap.keySet();
|
|
2511
|
+
for (String prop : props) {
|
|
2512
|
+
final String pendingProp = TemplateCodeParser.parsePlaceholderProp(prop, rawMap);
|
|
2513
|
+
// Log.d(TAG,"prepareItemViewAndCreatePatches pendingProp:"+pendingProp+",isTextProp:"+isTextProp+",isPendingProp:"+isPendingProp+",prop:"+prop);
|
|
2514
|
+
if (!TextUtils.isEmpty(pendingProp)) {
|
|
2515
|
+
//只理会FastItem中的layout、size、等自定义属性
|
|
2516
|
+
//用item中的数据,替换map中的数据
|
|
2517
|
+
final Object dataFromValue = TemplateCodeParser.getValueFromCode((HippyMap) getRawObject(position), pendingProp);
|
|
2518
|
+
// if(TemplateCodeParser.PENDING_PROP_LAYOUT.equals(prop) && dataFromValue instanceof HippyArray){
|
|
2519
|
+
// Log.e("ZHAOPENGLOG","兼容老版本错误 enable "+enablePlaceholder);
|
|
2520
|
+
// ((HippyArray) dataFromValue).setObject(0,0);
|
|
2521
|
+
// ((HippyArray) dataFromValue).setObject(1,0);
|
|
2522
|
+
// }
|
|
2523
|
+
//Log.e("ZHAOPENGLOG","兼容老版本错误 holder itemView "+holder.itemView);
|
|
2524
|
+
exeCustomPendingProp4Singleton(nodeView, prop, dataFromValue);
|
|
2525
|
+
}
|
|
2526
|
+
}
|
|
2527
|
+
}
|
|
2528
|
+
}
|
|
2529
|
+
|
|
2530
|
+
@Override
|
|
2531
|
+
public void onBindViewHolder(@NonNull Holder holder, int position, @NonNull List<Object> payloads) {
|
|
2532
|
+
// super.onBindViewHolder(holder, position, payloads);
|
|
2533
|
+
|
|
2534
|
+
if (payloads.isEmpty()) {
|
|
2535
|
+
super.onBindViewHolder(holder, position,payloads);
|
|
2536
|
+
if(LogUtils.isDebug()) {
|
|
2537
|
+
Log.d("DebugUpdate", "onBindViewHolder position:" + position + ",holder:" + holder.itemView.hashCode() + ",payloads:" + "[] "+",stableKey:"+mUserKeyName+",this:"+hashCode());
|
|
2538
|
+
}
|
|
2539
|
+
}else{
|
|
2540
|
+
for(Object payload : payloads){
|
|
2541
|
+
Payload p = (Payload) payload;
|
|
2542
|
+
switch (p.type){
|
|
2543
|
+
case TYPE_UPDATE:
|
|
2544
|
+
doBindViewHolder(holder, position,p);
|
|
2545
|
+
if(LogUtils.isDebug()) {
|
|
2546
|
+
Log.d("DebugUpdate", "onBindViewHolder position:" + position + ",holder:" + holder.itemView.hashCode() + ",payloads:" + "update "+",stableKey:"+mUserKeyName+",this:"+hashCode());
|
|
2547
|
+
}
|
|
2548
|
+
break;
|
|
2549
|
+
case TYPE_LAYOUT:
|
|
2550
|
+
if(LogUtils.isDebug()) {
|
|
2551
|
+
Log.d("DebugUpdate", "onBindViewHolder position:" + position + ",holder:" + holder.itemView.hashCode() + ",payloads:" + "layout "+",stableKey:"+mUserKeyName+",this:"+hashCode());
|
|
2552
|
+
}
|
|
2553
|
+
// Log.d(TAG,"update item layout : "+ExtendUtil.debugViewLite(holder.tag.getRootNode().boundView));
|
|
2554
|
+
updateHolderLayout(holder, position);
|
|
2555
|
+
break;
|
|
2556
|
+
case TYPE_LAYOUT_ROOT:
|
|
2557
|
+
if(LogUtils.isDebug()) {
|
|
2558
|
+
Log.d("DebugUpdate", "onBindViewHolder position:" + position + ",holder:" + holder.itemView.hashCode() + ",payloads:" + "layoutRoot "+",stableKey:"+mUserKeyName+",this:"+hashCode());
|
|
2559
|
+
}
|
|
2560
|
+
// Log.i(TAG,"update root Layout : "+ExtendUtil.debugViewLite(getRootListView()));
|
|
2561
|
+
getRootListView().notifyItemsLayoutChanged();
|
|
2562
|
+
break;
|
|
2563
|
+
}
|
|
2564
|
+
|
|
2565
|
+
}
|
|
2566
|
+
}
|
|
2567
|
+
}
|
|
2568
|
+
|
|
2569
|
+
public void updateHolderLayout(Holder holder, int position){
|
|
2570
|
+
if (holder.tag == null) {
|
|
2571
|
+
return;
|
|
2572
|
+
}
|
|
2573
|
+
ElementNode itemENode = holder.tag.getRootNode();
|
|
2574
|
+
int itemWidth = 0;
|
|
2575
|
+
int itemHeight = 0;
|
|
2576
|
+
if (holder.singleton) {
|
|
2577
|
+
//单例的holder绑定
|
|
2578
|
+
itemWidth = (int) itemENode.getStyleWidth();
|
|
2579
|
+
itemHeight = (int) itemENode.getStyleHeight();
|
|
2580
|
+
} else {
|
|
2581
|
+
//bind之前将节点内一些属性reset
|
|
2582
|
+
//将所有数据与模版建立的view进行一一绑定
|
|
2583
|
+
// updateAllPropsOnViewHolder(holder, position,true); // 属性赋值的主要方法
|
|
2584
|
+
measureAllCreatedView(itemENode);
|
|
2585
|
+
//重新计算itemNode中的布局
|
|
2586
|
+
itemENode.calculateLayout();
|
|
2587
|
+
// if (holder.itemView instanceof FastItemView) {
|
|
2588
|
+
// FastAdapterUtil.keepWithChildSize(itemENode);
|
|
2589
|
+
// }
|
|
2590
|
+
//itemView大小由itemENode的大小决定
|
|
2591
|
+
itemWidth = (int) itemENode.getLayoutWidth();
|
|
2592
|
+
itemHeight = (int) itemENode.getLayoutHeight();
|
|
2593
|
+
if(enablePlaceholder){
|
|
2594
|
+
if(holder.itemView instanceof ItemContainer) {
|
|
2595
|
+
updateItemLayout4ItemRootView(holder.itemView, itemENode);
|
|
2596
|
+
}else{
|
|
2597
|
+
updateItemLayout(itemENode);
|
|
2598
|
+
}
|
|
2599
|
+
}else{
|
|
2600
|
+
//将itemView中的所有的View遍历,根据绑定的node节点来更新Layout
|
|
2601
|
+
updateItemLayout(itemENode);
|
|
2602
|
+
//measureItemTextView(itemENode);
|
|
2603
|
+
if (itemWidth < 1 || itemHeight < 1) {
|
|
2604
|
+
int[] size = fixItemViewSize(itemENode);
|
|
2605
|
+
itemWidth = size[0];
|
|
2606
|
+
itemHeight = size[1];
|
|
2607
|
+
if(itemENode.boundView != null) {
|
|
2608
|
+
FastAdapterUtil.updateLayout(itemENode.boundView, 0, 0, itemWidth, itemHeight);
|
|
2609
|
+
}
|
|
2610
|
+
}
|
|
2611
|
+
}
|
|
2612
|
+
//measureItemNode(itemENode);
|
|
2613
|
+
}
|
|
2614
|
+
if (itemWidth < 1 || itemHeight < 1) {
|
|
2615
|
+
Log.e(TAG, "FIX_ITEM_SIZE 计算尺寸错误:ItemWidth:" + itemWidth + ",height:" + itemHeight + ",itemType:" + getItemViewType(position) + ",position:" + position);
|
|
2616
|
+
}
|
|
2617
|
+
Log.i(FastListView.TAG,"updateHolderLayout itemWidth:"+itemWidth+",itemHeight:"+itemHeight+",holder:"+holder.itemView.hashCode());
|
|
2618
|
+
|
|
2619
|
+
boolean changed = false;
|
|
2620
|
+
//更新recyclerView中的尺寸
|
|
2621
|
+
if (holder.itemView.getLayoutParams() == null) {
|
|
2622
|
+
holder.itemView.setLayoutParams(new RecyclerView.LayoutParams(itemWidth, itemHeight));
|
|
2623
|
+
changed = true;
|
|
2624
|
+
} else {
|
|
2625
|
+
changed = holder.itemView.getLayoutParams().width != itemWidth || holder.itemView.getLayoutParams().height != itemHeight;
|
|
2626
|
+
holder.itemView.getLayoutParams().width = itemWidth;
|
|
2627
|
+
holder.itemView.getLayoutParams().height = itemHeight;
|
|
2628
|
+
}
|
|
2629
|
+
// if (changed && getFastPendingView() != null) {
|
|
2630
|
+
// getFastPendingView().notifyItemsLayoutChanged();
|
|
2631
|
+
// }
|
|
2632
|
+
if(changed && getRootListView() != null && getRootListView() != mBoundListView){
|
|
2633
|
+
getRootListView().notifyItemsLayoutChanged();
|
|
2634
|
+
}
|
|
2635
|
+
|
|
2636
|
+
}
|
|
2637
|
+
|
|
2638
|
+
|
|
2639
|
+
|
|
2640
|
+
public RecyclerView.LayoutParams getItemLayoutParams(Holder holder) {
|
|
2641
|
+
return holder.itemView.getLayoutParams() instanceof RecyclerView.LayoutParams ? (RecyclerView.LayoutParams) holder.itemView.getLayoutParams() : null;
|
|
2642
|
+
}
|
|
2643
|
+
|
|
2644
|
+
@Override
|
|
2645
|
+
public void onBindViewHolder(@NonNull Holder holder, @SuppressLint("RecyclerView") int position) {
|
|
2646
|
+
this.doBindViewHolder(holder, position, null);
|
|
2647
|
+
}
|
|
2648
|
+
|
|
2649
|
+
|
|
2650
|
+
public void doBindViewHolder(@NonNull Holder holder, @SuppressLint("RecyclerView") int position, @Nullable Payload payload) {
|
|
2651
|
+
if (LogUtils.isDebug()) {
|
|
2652
|
+
Log.e(TAG_POST, "START>>>---------------------------------------------onBindViewHolder position:"+position+",template:"+(holder.tag.getRootNode() != null ? holder.tag.getRootNode().templateNode : null) +",type:"+holder.type);
|
|
2653
|
+
Log.i(TAG, "FastAdapterAttach onBindViewHolder position:" + position + ",holder:" + Utils.hashCode(holder)+",tag:"+holder.itemView.getTag());
|
|
2654
|
+
Log.i(TAG, "PlaceholderToContent onBindViewHolder position:" + position + ",holder:" + Utils.hashCode(holder)+",tag:"+holder.itemView.getTag());
|
|
2655
|
+
}
|
|
2656
|
+
if(LogUtils.isDebug()) {
|
|
2657
|
+
Log.d("BindEvent", "inner onBindViewHolder position:" + position + ",holder:" + holder.itemView.hashCode());
|
|
2658
|
+
}
|
|
2659
|
+
holder.adapterPosition = position;
|
|
2660
|
+
int itemWidth = 0;
|
|
2661
|
+
int itemHeight = 0;
|
|
2662
|
+
if(holder.isErrorView){
|
|
2663
|
+
return;
|
|
2664
|
+
}
|
|
2665
|
+
removeDetached(position);
|
|
2666
|
+
final ViewTag vt = holder.tag;
|
|
2667
|
+
final ElementNode itemENode = vt.getRootNode();
|
|
2668
|
+
|
|
2669
|
+
if(enablePlaceholder && holder.itemView instanceof ItemContainer) {
|
|
2670
|
+
//先展示placeholder
|
|
2671
|
+
if(!holder.hasOnBind || payload == null) {
|
|
2672
|
+
((ItemContainer) holder.itemView).toggle(true);
|
|
2673
|
+
}else{
|
|
2674
|
+
if(holder.itemView.isFocused()){
|
|
2675
|
+
holder.itemView.refreshDrawableState();
|
|
2676
|
+
}
|
|
2677
|
+
}
|
|
2678
|
+
holder.placeholderState = true;
|
|
2679
|
+
}
|
|
2680
|
+
holder.hasOnBind = true;
|
|
2681
|
+
clearPostTask(holder);
|
|
2682
|
+
itemENode.recycled = false;
|
|
2683
|
+
itemENode.adapterPosition = position;
|
|
2684
|
+
if (holder.singleton) {
|
|
2685
|
+
//单例的holder绑定
|
|
2686
|
+
onSingletBindViewHolder(holder,position,itemENode);
|
|
2687
|
+
itemWidth = (int) itemENode.getStyleWidth();
|
|
2688
|
+
itemHeight = (int) itemENode.getStyleHeight();
|
|
2689
|
+
} else {
|
|
2690
|
+
if(!(getRawObject(position) instanceof HippyMap)){
|
|
2691
|
+
return;
|
|
2692
|
+
}
|
|
2693
|
+
HippyMap itemData = (HippyMap) getRawObject(position);
|
|
2694
|
+
//bind之前将节点内一些属性reset
|
|
2695
|
+
notifyElementBeforeOnBind(itemENode, itemData);
|
|
2696
|
+
//将所有数据与模版建立的view进行一一绑定
|
|
2697
|
+
preUpdatePropsRecursive(holder, position,true); // 属性赋值的主要方法
|
|
2698
|
+
measureAllCreatedView(itemENode);
|
|
2699
|
+
//重新计算itemNode中的布局
|
|
2700
|
+
itemENode.calculateLayout();
|
|
2701
|
+
// if (holder.itemView instanceof FastItemView) {
|
|
2702
|
+
// FastAdapterUtil.keepWithChildSize(itemENode);
|
|
2703
|
+
// }
|
|
2704
|
+
//itemView大小由itemENode的大小决定
|
|
2705
|
+
itemWidth = (int) itemENode.getLayoutWidth();
|
|
2706
|
+
itemHeight = (int) itemENode.getLayoutHeight();
|
|
2707
|
+
if(enablePlaceholder){
|
|
2708
|
+
requestPlaceholderToContent(holder,itemENode,position,itemData);
|
|
2709
|
+
if(holder.itemView instanceof ItemContainer) {
|
|
2710
|
+
updateItemLayout4ItemRootView(holder.itemView, itemENode);
|
|
2711
|
+
}else{
|
|
2712
|
+
updateItemLayout(itemENode);
|
|
2713
|
+
}
|
|
2714
|
+
}else{
|
|
2715
|
+
//将itemView中的所有的View遍历,根据绑定的node节点来更新Layout
|
|
2716
|
+
updateItemLayout(itemENode);
|
|
2717
|
+
//measureItemTextView(itemENode);
|
|
2718
|
+
if (itemWidth < 1 || itemHeight < 1) {
|
|
2719
|
+
int[] size = fixItemViewSize(itemENode);
|
|
2720
|
+
itemWidth = size[0];
|
|
2721
|
+
itemHeight = size[1];
|
|
2722
|
+
if(itemENode.boundView != null) {
|
|
2723
|
+
FastAdapterUtil.updateLayout(itemENode.boundView, 0, 0, itemWidth, itemHeight);
|
|
2724
|
+
}
|
|
2725
|
+
}
|
|
2726
|
+
}
|
|
2727
|
+
//measureItemNode(itemENode);
|
|
2728
|
+
if (LogUtils.isDebug()) {
|
|
2729
|
+
Log.i(TAG, "FastAdapterEvent DEAL_LAYOUT BeforeCalculate pos:" + position + ",rootElement:" + vt.getRootNode());
|
|
2730
|
+
Log.i(TAG, "FastAdapterEvent FIX_ITEM_SIZE pos:" + position + ",width:" + itemWidth + ",height:" + itemHeight + ",type:" + getItemViewType(position) + ",this:" + Utils.hashCode(this));
|
|
2731
|
+
}
|
|
2732
|
+
}
|
|
2733
|
+
if (itemWidth < 1 || itemHeight < 1) {
|
|
2734
|
+
Log.e(TAG, "FIX_ITEM_SIZE 计算尺寸错误:ItemWidth:" + itemWidth + ",height:" + itemHeight + ",itemType:" + getItemViewType(position) + ",position:" + position);
|
|
2735
|
+
}
|
|
2736
|
+
//更新recyclerView中的尺寸
|
|
2737
|
+
if (holder.itemView.getLayoutParams() == null) {
|
|
2738
|
+
holder.itemView.setLayoutParams(new RecyclerView.LayoutParams(itemWidth, itemHeight));
|
|
2739
|
+
} else {
|
|
2740
|
+
holder.itemView.getLayoutParams().width = itemWidth;
|
|
2741
|
+
holder.itemView.getLayoutParams().height = itemHeight;
|
|
2742
|
+
}
|
|
2743
|
+
/** wanglei 添加点击、长按、焦点事件*/
|
|
2744
|
+
/**
|
|
2745
|
+
* 这里是为内部native提供的点击事件
|
|
2746
|
+
*/
|
|
2747
|
+
if (onFastItemClickListener != null) {
|
|
2748
|
+
holder.itemView.setOnClickListener(new View.OnClickListener() {
|
|
2749
|
+
@Override
|
|
2750
|
+
public void onClick(View v) {
|
|
2751
|
+
Log.i("DebugClick", "onFastItemClickListener onItemClick position:" + position + ",rootElement:" + vt.getRootNode());
|
|
2752
|
+
onFastItemClickListener.onItemClickListener(v, position);
|
|
2753
|
+
}
|
|
2754
|
+
});
|
|
2755
|
+
holder.itemView.setOnLongClickListener(new View.OnLongClickListener() {
|
|
2756
|
+
@Override
|
|
2757
|
+
public boolean onLongClick(View v) {
|
|
2758
|
+
return onFastItemClickListener.onItemLongClickListener(v, position);
|
|
2759
|
+
}
|
|
2760
|
+
});
|
|
2761
|
+
}
|
|
2762
|
+
if (onFastItemFocusChangeListener != null) {
|
|
2763
|
+
holder.itemView.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
|
2764
|
+
@Override
|
|
2765
|
+
public void onFocusChange(View v, boolean hasFocus) {
|
|
2766
|
+
onFastItemFocusChangeListener.onFocusChange(v, hasFocus, position);
|
|
2767
|
+
}
|
|
2768
|
+
});
|
|
2769
|
+
}
|
|
2770
|
+
if (isListenBoundEvent) {
|
|
2771
|
+
sendOnBindEvent(rootListNodeID, position, listNode.getNode(), holder);
|
|
2772
|
+
}
|
|
2773
|
+
if (holder.itemView instanceof IRecyclerItemView) {
|
|
2774
|
+
//通知
|
|
2775
|
+
IRecyclerItemView itemView = (IRecyclerItemView) holder.itemView;
|
|
2776
|
+
final ItemEntity ie = getItemEntity(position);
|
|
2777
|
+
itemView.onBind(getRootListView(), position, ie == null ? null : ie.raw);
|
|
2778
|
+
}
|
|
2779
|
+
if(LogUtils.isDebug()) {
|
|
2780
|
+
Log.e(TAG_POST, "END>>>>---------------------------------------------onBindViewHolder position:" + position + "---------------------------------------------");
|
|
2781
|
+
}
|
|
2782
|
+
|
|
2783
|
+
if (holder.itemView instanceof ItemRootView) {
|
|
2784
|
+
((ItemRootView) holder.itemView).afterPreBind();
|
|
2785
|
+
}else{
|
|
2786
|
+
//当前的itemView不是ItemContainer时,设置contentView的itemSID
|
|
2787
|
+
if(itemENode.itemSID != null){
|
|
2788
|
+
ExtendUtil.putViewSID(holder.itemView, itemENode.itemSID);
|
|
2789
|
+
}
|
|
2790
|
+
}
|
|
2791
|
+
}
|
|
2792
|
+
|
|
2793
|
+
private int[] fixItemViewSize(ElementNode itemNode) {
|
|
2794
|
+
int[] size = new int[2];
|
|
2795
|
+
if (itemNode.getChildCount() == 1) {
|
|
2796
|
+
size[0] = (int) itemNode.getChildAt(0).getLayoutWidth();
|
|
2797
|
+
size[1] = (int) itemNode.getChildAt(0).getLayoutHeight();
|
|
2798
|
+
if (LogUtils.isDebug()) {
|
|
2799
|
+
Log.v(TAG, "fixItemViewSize FIX_ITEM_SIZE ,width:" + itemNode.getLayoutWidth() + ",height:" + itemNode.getLayoutHeight() + ",this:" + Utils.hashCode(this));
|
|
2800
|
+
if (itemNode.getLayoutWidth() < 1 || itemNode.getLayoutHeight() < 1) {
|
|
2801
|
+
Log.e(TAG, "fixItemViewSize error FIX_ITEM_SIZE ,width:" + itemNode.getLayoutWidth() + ",height:" + itemNode.getLayoutHeight() + ",this:" + Utils.hashCode(this) + ",itemNode:" + itemNode);
|
|
2802
|
+
}
|
|
2803
|
+
}
|
|
2804
|
+
} else {
|
|
2805
|
+
if (itemNode.getChildCount() > 1) {
|
|
2806
|
+
//简单的measure
|
|
2807
|
+
int maxWidth = 0;
|
|
2808
|
+
int maxHeight = 0;
|
|
2809
|
+
for (int i = 0; i < itemNode.getChildCount(); i++) {
|
|
2810
|
+
int cw = (int) itemNode.getChildAt(i).getLayoutWidth();
|
|
2811
|
+
int ch = (int) itemNode.getChildAt(i).getLayoutHeight();
|
|
2812
|
+
maxWidth = Math.max(maxWidth, cw);
|
|
2813
|
+
maxHeight = Math.max(maxHeight, ch);
|
|
2814
|
+
}
|
|
2815
|
+
size[0] = maxWidth;
|
|
2816
|
+
size[1] = maxHeight;
|
|
2817
|
+
} else {
|
|
2818
|
+
Log.e(TAG, "fixItemViewSize FIX_ITEM_SIZE 错误,node info:" + itemNode);
|
|
2819
|
+
}
|
|
2820
|
+
}
|
|
2821
|
+
return size;
|
|
2822
|
+
}
|
|
2823
|
+
|
|
2824
|
+
|
|
2825
|
+
|
|
2826
|
+
@Override
|
|
2827
|
+
public int getItemViewType(int pos) {
|
|
2828
|
+
int position = getLoopPosition(pos);
|
|
2829
|
+
// if (LogUtils.isDebug()) {
|
|
2830
|
+
// Log.v(TAG, "FastAdapterEvent getItemViewType position " + position);
|
|
2831
|
+
// }
|
|
2832
|
+
|
|
2833
|
+
if (dataList == null || dataList.size() < position) {
|
|
2834
|
+
if (LogUtils.isDebug()) {
|
|
2835
|
+
Log.e(TAG, "FastAdapter getItemViewType dataList is empty position" + position);
|
|
2836
|
+
}
|
|
2837
|
+
return DEFAULT_ITEM_TYPE;
|
|
2838
|
+
}
|
|
2839
|
+
int type;
|
|
2840
|
+
final HippyMap map = (HippyMap) getRawObject(position);
|
|
2841
|
+
if (map == null || !map.containsKey("type")) {
|
|
2842
|
+
if (templateNodes.size() > (1 + (itemStoreNodes == null ? 0 : itemStoreNodes.size()))) { //如果template中的列表包含多个模版,则必须要传type
|
|
2843
|
+
Log.e(TAG, "FastAdapter getItemViewType map is " +
|
|
2844
|
+
"empty or type missing dataList" + dataList + ",this:" + Utils.hashCode(this) + ",itemData:" + map + ",pos:" + position);
|
|
2845
|
+
throw new IllegalArgumentException("getItemViewType error :确认每个item包含type参数 data:" + map);
|
|
2846
|
+
} else {
|
|
2847
|
+
type = getDefaultItemType();
|
|
2848
|
+
}
|
|
2849
|
+
} else {
|
|
2850
|
+
type = Integer.parseInt(map.getString("type"));
|
|
2851
|
+
}
|
|
2852
|
+
if (LogUtils.isDebug()) {
|
|
2853
|
+
Log.d(TAG, "FastAdapter getItemViewType return " + type);
|
|
2854
|
+
}
|
|
2855
|
+
return type;
|
|
2856
|
+
}
|
|
2857
|
+
|
|
2858
|
+
@Override
|
|
2859
|
+
public int getItemCount() {
|
|
2860
|
+
if (templateNodes == null) {
|
|
2861
|
+
if (LogUtils.isDebug()) {
|
|
2862
|
+
Log.e(TAG, "FastAdapter getItemCount return 0" + ",this:" + Utils.hashCode(this));
|
|
2863
|
+
}
|
|
2864
|
+
return 0;
|
|
2865
|
+
}
|
|
2866
|
+
final int count = getItemDataCount();
|
|
2867
|
+
// if (LogUtils.isDebug()) {
|
|
2868
|
+
// Log.d(TAG, "FastAdapter getItemCount return " + count + ",this:" + Utils.hashCode(this));
|
|
2869
|
+
// }
|
|
2870
|
+
return isInfiniteLoopEnabled() ? Integer.MAX_VALUE : count;
|
|
2871
|
+
}
|
|
2872
|
+
|
|
2873
|
+
public int getItemDataCount(){
|
|
2874
|
+
return dataList != null ? dataList.size() : 0;
|
|
2875
|
+
}
|
|
2876
|
+
|
|
2877
|
+
|
|
2878
|
+
|
|
2879
|
+
public void setData(HippyArray array) {
|
|
2880
|
+
if (this.dataList == null) {
|
|
2881
|
+
this.dataList = new HippyArray();
|
|
2882
|
+
} else {
|
|
2883
|
+
this.dataList.clear();
|
|
2884
|
+
}
|
|
2885
|
+
if (array != null) {
|
|
2886
|
+
for (int i = 0; i < array.size(); i++) {
|
|
2887
|
+
this.dataList.pushObject(new ItemEntity(array.get(i), i));
|
|
2888
|
+
}
|
|
2889
|
+
}
|
|
2890
|
+
clearDetachCaches();
|
|
2891
|
+
if (LogUtils.isDebug()) {
|
|
2892
|
+
Log.e(TAG, "FastAdapter setData array size: " + (array == null ? 0 : array.size()) + ",this:" + Utils.hashCode(this));
|
|
2893
|
+
}
|
|
2894
|
+
// if(getRootListView() != null && getRootListView() != mBoundListView){
|
|
2895
|
+
// getRootListView().notifyItemsLayoutChanged();
|
|
2896
|
+
// }
|
|
2897
|
+
}
|
|
2898
|
+
|
|
2899
|
+
public void replaceItemData(int pos,Object data){
|
|
2900
|
+
if(this.dataList != null && this.dataList.size() > pos && pos > -1){
|
|
2901
|
+
this.dataList.setObject(pos,new ItemEntity(data,pos));
|
|
2902
|
+
}
|
|
2903
|
+
}
|
|
2904
|
+
|
|
2905
|
+
public void addData(HippyArray array) {
|
|
2906
|
+
assert dataList != null;
|
|
2907
|
+
if (array != null) {
|
|
2908
|
+
int index = dataList.size();
|
|
2909
|
+
for (int i = 0; i < array.size(); i++) {
|
|
2910
|
+
this.dataList.pushObject(new ItemEntity(array.get(i), index++));
|
|
2911
|
+
}
|
|
2912
|
+
}
|
|
2913
|
+
if (LogUtils.isDebug()) {
|
|
2914
|
+
Log.e(TAG, "FastAdapter setData array size: " + (array == null ? 0 : array.size()) + ",this:" + Utils.hashCode(this));
|
|
2915
|
+
}
|
|
2916
|
+
}
|
|
2917
|
+
|
|
2918
|
+
public void deleteData(int count) {
|
|
2919
|
+
if (dataList != null && this.dataList.size() >= count) {
|
|
2920
|
+
for (int i = 0; i < count; i++) {
|
|
2921
|
+
this.dataList.removeAt(this.dataList.size() - 1);
|
|
2922
|
+
}
|
|
2923
|
+
}
|
|
2924
|
+
}
|
|
2925
|
+
|
|
2926
|
+
public void deleteData(int start, int count) {
|
|
2927
|
+
// if(dataList != null && this.dataList.size() >= count){
|
|
2928
|
+
// for(int i= 0; i < count; i ++){
|
|
2929
|
+
// this.dataList.removeAt(this.dataList.size() -1);
|
|
2930
|
+
// }
|
|
2931
|
+
// }
|
|
2932
|
+
if (dataList != null && dataList.size() > 0) { //3
|
|
2933
|
+
//start 0, count 2
|
|
2934
|
+
//start 1 ,count 3 0 1 2 3
|
|
2935
|
+
final int last = start + count - 1;
|
|
2936
|
+
for (int i = last; i >= start; i--) {
|
|
2937
|
+
this.dataList.removeAt(i);
|
|
2938
|
+
}
|
|
2939
|
+
}
|
|
2940
|
+
}
|
|
2941
|
+
|
|
2942
|
+
public void clearData() {
|
|
2943
|
+
if (this.dataList != null) {
|
|
2944
|
+
this.dataList.clear();
|
|
2945
|
+
}
|
|
2946
|
+
if (onFastItemClickListener != null) {
|
|
2947
|
+
if(onFastItemClickListener instanceof FastItemDispatchedClickListener){
|
|
2948
|
+
((FastItemDispatchedClickListener) onFastItemClickListener).dispose();
|
|
2949
|
+
}
|
|
2950
|
+
onFastItemClickListener = null;
|
|
2951
|
+
}
|
|
2952
|
+
}
|
|
2953
|
+
|
|
2954
|
+
public void recycleAll() {
|
|
2955
|
+
|
|
2956
|
+
}
|
|
2957
|
+
|
|
2958
|
+
public void clearCache() {
|
|
2959
|
+
if (findOldCacheWorker() != null) {
|
|
2960
|
+
findOldCacheWorker().clear();
|
|
2961
|
+
}
|
|
2962
|
+
if (gSharedCachePools != null) {
|
|
2963
|
+
if(getCacheRootView() != null) {
|
|
2964
|
+
gSharedCachePools.remove(getPoolCacheKey(viewContext,getCacheRootView()));
|
|
2965
|
+
}
|
|
2966
|
+
}
|
|
2967
|
+
}
|
|
2968
|
+
|
|
2969
|
+
public static class Holder extends RecyclerView.ViewHolder {
|
|
2970
|
+
|
|
2971
|
+
ViewTag tag;
|
|
2972
|
+
boolean attached = false;
|
|
2973
|
+
boolean patched = false;
|
|
2974
|
+
boolean singleton;
|
|
2975
|
+
boolean hasOnBind = false;
|
|
2976
|
+
int adapterPosition = -1;
|
|
2977
|
+
boolean isErrorView = false;
|
|
2978
|
+
boolean placeholderState = true;
|
|
2979
|
+
PostTask postTask;
|
|
2980
|
+
|
|
2981
|
+
int type;
|
|
2982
|
+
|
|
2983
|
+
public Holder(@NonNull View itemView, ViewTag tag, int type, boolean singleton) {
|
|
2984
|
+
super(itemView);
|
|
2985
|
+
this.type = type;
|
|
2986
|
+
this.tag = tag;
|
|
2987
|
+
this.singleton = singleton;
|
|
2988
|
+
}
|
|
2989
|
+
|
|
2990
|
+
public ElementNode getItemRootNode(){
|
|
2991
|
+
return tag.getRootNode();
|
|
2992
|
+
}
|
|
2993
|
+
|
|
2994
|
+
public @Nullable ItemRootView findItemRootView(){
|
|
2995
|
+
if(itemView instanceof ItemRootView){
|
|
2996
|
+
return (ItemRootView) itemView;
|
|
2997
|
+
}
|
|
2998
|
+
return null;
|
|
2999
|
+
}
|
|
3000
|
+
|
|
3001
|
+
|
|
3002
|
+
void reset() {
|
|
3003
|
+
// hasInit = false;
|
|
3004
|
+
//adapterPosition = -1;
|
|
3005
|
+
hasOnBind = false;
|
|
3006
|
+
tag.reset();
|
|
3007
|
+
}
|
|
3008
|
+
|
|
3009
|
+
void resetTextView(){
|
|
3010
|
+
tag.resetTextView();
|
|
3011
|
+
}
|
|
3012
|
+
|
|
3013
|
+
}
|
|
3014
|
+
|
|
3015
|
+
|
|
3016
|
+
static class PostTask implements Runnable {
|
|
3017
|
+
boolean cancel = false;
|
|
3018
|
+
final Runnable task;
|
|
3019
|
+
ElementNode node;
|
|
3020
|
+
|
|
3021
|
+
public PostTask(FastAdapter.ElementNode node,@NonNull Runnable task) {
|
|
3022
|
+
this.task = task;
|
|
3023
|
+
this.node = node;
|
|
3024
|
+
}
|
|
3025
|
+
|
|
3026
|
+
@Override
|
|
3027
|
+
public void run() {
|
|
3028
|
+
if(cancel || node == null || node.rootNode.recycled){
|
|
3029
|
+
if(LogUtils.isDebug()){
|
|
3030
|
+
if (node == null) {
|
|
3031
|
+
Log.e(TAG_POST,"PostTask return on cancel:"+cancel+",node:"+ null+",this:"+this);
|
|
3032
|
+
}else{
|
|
3033
|
+
Log.e(TAG_POST,"PostTask return on cancel:"+cancel+",node recycled:"+node.rootNode.recycled+",this:"+this);
|
|
3034
|
+
}
|
|
3035
|
+
}
|
|
3036
|
+
}else{
|
|
3037
|
+
task.run();
|
|
3038
|
+
}
|
|
3039
|
+
}
|
|
3040
|
+
}
|
|
3041
|
+
|
|
3042
|
+
void markCrateOnParent(ElementNode node,boolean create){
|
|
3043
|
+
if(node != null){
|
|
3044
|
+
node.initConfig.createViewOnInit = create;
|
|
3045
|
+
if (node.getParent() != null) {
|
|
3046
|
+
markCrateOnParent((ElementNode) node.getParent(),create);
|
|
3047
|
+
}
|
|
3048
|
+
}
|
|
3049
|
+
}
|
|
3050
|
+
|
|
3051
|
+
/**
|
|
3052
|
+
*根据模版创建所有的Element节点
|
|
3053
|
+
* @param templateNode
|
|
3054
|
+
* @param tag
|
|
3055
|
+
* @param parentElement
|
|
3056
|
+
*/
|
|
3057
|
+
void createAllElementNodeRecursive(@NonNull RenderNode templateNode, ViewTag tag, ElementNode parentElement) {
|
|
3058
|
+
DomNode templateDomNode = context.getDomManager().getNode(templateNode.getId());
|
|
3059
|
+
if (templateDomNode != null) {
|
|
3060
|
+
ElementNode en;
|
|
3061
|
+
if (parentElement == null) {
|
|
3062
|
+
en = tag.getRootNode();
|
|
3063
|
+
en.isPlaceholderEnable = this.enablePlaceholder;
|
|
3064
|
+
} else {
|
|
3065
|
+
en = new ElementNode();
|
|
3066
|
+
}
|
|
3067
|
+
Utils.cloneNode(en, templateDomNode);
|
|
3068
|
+
if (parentElement != null) {
|
|
3069
|
+
en.rootNode = parentElement.rootNode;
|
|
3070
|
+
parentElement.addChildAt(en, parentElement.getChildCount());
|
|
3071
|
+
}
|
|
3072
|
+
//用来标识一个节点的名称
|
|
3073
|
+
en.onNodeInit(templateNode);
|
|
3074
|
+
if(en.initConfig.isViewFocusable && en.rootNode != null){
|
|
3075
|
+
en.rootNode.initConfig.isViewFocusable = true;
|
|
3076
|
+
}
|
|
3077
|
+
//如果enablePlaceholder为true,则所有的view默认都不创建
|
|
3078
|
+
boolean createView = !this.enablePlaceholder;
|
|
3079
|
+
// final boolean isDelayLoad = en.isMarkToDelay || (parentElement != null && parentElement.isMarkToDelay);
|
|
3080
|
+
if(parentElement != null && parentElement.isMarkToDelay){
|
|
3081
|
+
en.loadDelay = parentElement.loadDelay + 20;
|
|
3082
|
+
//parent是delayLoad,则子节点同意是delayLoad
|
|
3083
|
+
tag.addDelayLoad(en);
|
|
3084
|
+
if(LogUtils.isDebug()) {
|
|
3085
|
+
Log.e("MakeContentLog", "add load delay node:" + en.templateNode + ",elementNode:" + en.hashCode() + ",root:" + en.rootNode.hashCode());
|
|
3086
|
+
}
|
|
3087
|
+
createView = false;
|
|
3088
|
+
en.isMarkToDelay = true;
|
|
3089
|
+
}else{
|
|
3090
|
+
final boolean isDelayLoad = en.isMarkToDelay;
|
|
3091
|
+
if (isDelayLoad) {
|
|
3092
|
+
//被delayLoad标识的view这里都不创建
|
|
3093
|
+
tag.enableLoadDelay = true;
|
|
3094
|
+
if (en.loadDelay > 0) {
|
|
3095
|
+
tag.addDelayLoad(en);
|
|
3096
|
+
if(LogUtils.isDebug()) {
|
|
3097
|
+
Log.e("MakeContentLog", "add load delay node:" + en.templateNode + ",elementNode:" + en.hashCode() + ",root:" + en.rootNode.hashCode());
|
|
3098
|
+
}
|
|
3099
|
+
//delayLoad的view,没有必要创建view
|
|
3100
|
+
//return;
|
|
3101
|
+
createView = false;
|
|
3102
|
+
}else{
|
|
3103
|
+
en.isMarkToDelay = false;
|
|
3104
|
+
}
|
|
3105
|
+
}
|
|
3106
|
+
}
|
|
3107
|
+
|
|
3108
|
+
final boolean isPlaceholder = en.markAsPlaceholder;
|
|
3109
|
+
// if(LogUtils.isDebug() && this.enablePlaceholder){
|
|
3110
|
+
// if (templateNode.getProps() != null) {
|
|
3111
|
+
// Log.d(TAG,"-----------createOnCreateViewHolder isPlaceholder :"+isPlaceholder);
|
|
3112
|
+
// for(String s : templateNode.getProps().keySet()){
|
|
3113
|
+
// Log.d(TAG,"createOnCreateViewHolder prop s :"+s);
|
|
3114
|
+
// }
|
|
3115
|
+
// if (isPlaceholder) {
|
|
3116
|
+
// Log.e(TAG,"createOnCreateViewHolder isPlaceholder templateNode:"+templateNode);
|
|
3117
|
+
// }
|
|
3118
|
+
// }
|
|
3119
|
+
// }
|
|
3120
|
+
if (isPlaceholder) {
|
|
3121
|
+
tag.placeHolderNode = en;
|
|
3122
|
+
//被标记为placeholder的view不创建,在placeholder转变为content的时候,再进行创建
|
|
3123
|
+
createView = true;
|
|
3124
|
+
}
|
|
3125
|
+
//只创建嵌套的node
|
|
3126
|
+
if(!createView) {
|
|
3127
|
+
//简便FastPendingListView类型的被标记为不创建,这个强制创建
|
|
3128
|
+
boolean createOnPendingList = Utils.isPendingListNode(templateNode);
|
|
3129
|
+
if (en.rootNode != null && createOnPendingList) {
|
|
3130
|
+
en.rootNode.initConfig.hasNestList = true;
|
|
3131
|
+
//如果包含嵌套的List,它所有的节点及父节点都要直接创建
|
|
3132
|
+
markCrateOnParent(en,true);
|
|
3133
|
+
}
|
|
3134
|
+
createView = createOnPendingList;
|
|
3135
|
+
}
|
|
3136
|
+
if(!createView) {
|
|
3137
|
+
//根view一定要创建
|
|
3138
|
+
createView = en.isRootItem;
|
|
3139
|
+
if (en.isWidthWrapContent || en.isHeightWrapContent) {
|
|
3140
|
+
createView = true;
|
|
3141
|
+
}
|
|
3142
|
+
}
|
|
3143
|
+
if(createView && en.initConfig.needCheckVIF || (parentElement != null && parentElement.initConfig.needCheckVIF)) {
|
|
3144
|
+
createView = false;
|
|
3145
|
+
}
|
|
3146
|
+
if (parentElement != null) {
|
|
3147
|
+
//如果父组件不创建,子组件也不可创建view
|
|
3148
|
+
en.initConfig.createViewOnInit = createView && parentElement.initConfig.createViewOnInit;
|
|
3149
|
+
}else{
|
|
3150
|
+
en.initConfig.createViewOnInit = createView;
|
|
3151
|
+
}
|
|
3152
|
+
|
|
3153
|
+
if (templateNode.getChildCount() > 0) {
|
|
3154
|
+
for (int i = 0; i < templateNode.getChildCount(); i++) {
|
|
3155
|
+
RenderNode child = templateNode.getChildAt(i);
|
|
3156
|
+
if (Utils.isPendingListNode(templateNode) && Utils.isPendingItemNode(child)) {
|
|
3157
|
+
if (LogUtils.isDebug()) {
|
|
3158
|
+
Log.e(TAG, "addViewOnCreateViewRecursive return,子节点是一个ListNode,跳过。node:" + templateNode);
|
|
3159
|
+
}
|
|
3160
|
+
break;
|
|
3161
|
+
}
|
|
3162
|
+
createAllElementNodeRecursive( child, tag, en);
|
|
3163
|
+
}
|
|
3164
|
+
}
|
|
3165
|
+
}
|
|
3166
|
+
}
|
|
3167
|
+
|
|
3168
|
+
void createViewRecursiveOnCreateViewHolder(ElementNode en,View parent){
|
|
3169
|
+
RenderNode templateNode = en.templateNode;
|
|
3170
|
+
if(en.boundView == null && en.initConfig.createViewOnInit){
|
|
3171
|
+
en.boundView = createView4ElementNode(getControllerManager(),en,getRootListView(),parent, STEP_INIT);
|
|
3172
|
+
onElementViewCreated(en);
|
|
3173
|
+
}
|
|
3174
|
+
if (en.getChildCount() > 0 && en.initConfig.createViewOnInit) {
|
|
3175
|
+
for (int i = 0; i < en.getChildCount(); i++) {
|
|
3176
|
+
ElementNode child = (ElementNode) en.getChildAt(i);
|
|
3177
|
+
if (Utils.isPendingListNode(templateNode) && Utils.isPendingItemNode(child.templateNode)) {
|
|
3178
|
+
if (LogUtils.isDebug()) {
|
|
3179
|
+
Log.e(TAG, "createItemElementNodeRecursive addViewOnCreateViewRecursive return,子节点是一个ListNode,跳过。node:" + templateNode);
|
|
3180
|
+
}
|
|
3181
|
+
break;
|
|
3182
|
+
}
|
|
3183
|
+
createViewRecursiveOnCreateViewHolder(child,en.boundView);
|
|
3184
|
+
}
|
|
3185
|
+
}
|
|
3186
|
+
}
|
|
3187
|
+
|
|
3188
|
+
void createElementNodeViewRecursiveOnPost(ElementNode en,HippyMap itemData,View parent) {
|
|
3189
|
+
//assert templateDomNode != null;
|
|
3190
|
+
RenderNode templateNode = en.templateNode;
|
|
3191
|
+
|
|
3192
|
+
//dealVif4ElementNode()
|
|
3193
|
+
if(en.boundView == null ){
|
|
3194
|
+
if(!en.isMarkToDelay) {
|
|
3195
|
+
if(en.initConfig.needCheckVIF){
|
|
3196
|
+
createViewRecursiveOnVIF(en,itemData,parent);
|
|
3197
|
+
}else {
|
|
3198
|
+
en.boundView = createView4ElementNode(getControllerManager(), en, getRootListView(), parent,STEP_PLACEHOLDER_TO_CONTENT);
|
|
3199
|
+
onElementViewCreated(en);
|
|
3200
|
+
}
|
|
3201
|
+
}
|
|
3202
|
+
}else{
|
|
3203
|
+
if(en.isMarkToDelay){
|
|
3204
|
+
changeVisibility(en,false);
|
|
3205
|
+
}
|
|
3206
|
+
}
|
|
3207
|
+
if (en.boundView instanceof FastListView) {
|
|
3208
|
+
((FastListView) en.boundView).resumePostTask();
|
|
3209
|
+
}
|
|
3210
|
+
if (en.getChildCount() > 0) {
|
|
3211
|
+
for (int i = 0; i < en.getChildCount(); i++) {
|
|
3212
|
+
ElementNode child = (ElementNode) en.getChildAt(i);
|
|
3213
|
+
if (en.initConfig.needCheckVIF) {
|
|
3214
|
+
child.hasInit = false;
|
|
3215
|
+
}
|
|
3216
|
+
// if(en.isRootItem){
|
|
3217
|
+
// if (child.boundView != null && child.needRestoreVisible) {
|
|
3218
|
+
// child.needRestoreVisible = false;
|
|
3219
|
+
// //changeVisibility(child,true);
|
|
3220
|
+
// }
|
|
3221
|
+
// }
|
|
3222
|
+
if (Utils.isPendingListNode(templateNode) && Utils.isPendingItemNode(child.templateNode)) {
|
|
3223
|
+
if (LogUtils.isDebug()) {
|
|
3224
|
+
Log.e(TAG, "createItemElementNodeRecursive addViewOnCreateViewRecursive return,子节点是一个ListNode,跳过。node:" + templateNode);
|
|
3225
|
+
}
|
|
3226
|
+
break;
|
|
3227
|
+
}
|
|
3228
|
+
createElementNodeViewRecursiveOnPost(child,itemData,en.boundView);
|
|
3229
|
+
}
|
|
3230
|
+
}
|
|
3231
|
+
}
|
|
3232
|
+
|
|
3233
|
+
static int getUpdateLayoutType(ElementNode en) {
|
|
3234
|
+
return en.hashCode();
|
|
3235
|
+
}
|
|
3236
|
+
|
|
3237
|
+
void postAllDelayContent(final ViewTag vt,final ElementNode itemENode, Holder holder, int position) {
|
|
3238
|
+
if (vt.getDelayLoadNodes() != null) {
|
|
3239
|
+
// if (LogUtils.isDebug()) {
|
|
3240
|
+
// Log.d(TAG, "postAllDelayContent run,position:" + position + ",size:" + vt.getDelayLoadNodes().size());
|
|
3241
|
+
// Log.d(TAG, "MakeContentLog run,position:" + position + ",size:" + vt.getDelayLoadNodes().size()+",root:"+itemENode.rootNode.hashCode());
|
|
3242
|
+
// }
|
|
3243
|
+
for (int i = 0; i < vt.getDelayLoadNodes().size(); i++) {
|
|
3244
|
+
final ElementNode en = vt.getDelayLoadNodes().get(i);
|
|
3245
|
+
//为了不要频繁更新layout
|
|
3246
|
+
if (en.pendingWorker != null) {
|
|
3247
|
+
en.pendingWorker.cancel();
|
|
3248
|
+
en.pendingWorker = null;
|
|
3249
|
+
}
|
|
3250
|
+
int postType = getUpdateLayoutType(en);
|
|
3251
|
+
// if (LogUtils.isDebug()) {
|
|
3252
|
+
// Log.d(TAG, "postAllDelayContent run,position:" + position+",getRootListView:"+getRootListView()+",en templateNode :"+en.templateNode+",boundView:"+en.boundView);
|
|
3253
|
+
// }
|
|
3254
|
+
getRootListView().postTask(POST_TASK_CATEGORY_DELAY_LOAD, postType, new PostTask(en, () -> {
|
|
3255
|
+
if (enablePlaceholder) {
|
|
3256
|
+
if(en.rootNode != null && en.rootNode.recycled){
|
|
3257
|
+
if (LogUtils.isDebug()) {
|
|
3258
|
+
Log.e(TAG, "postAllDelayContent SCROLL_POSTER return on en.rootNode.recycled pos:" + position);
|
|
3259
|
+
}
|
|
3260
|
+
return;
|
|
3261
|
+
}
|
|
3262
|
+
}else{
|
|
3263
|
+
if(!holder.attached){
|
|
3264
|
+
if (LogUtils.isDebug()) {
|
|
3265
|
+
Log.e(TAG, "postAllDelayContent SCROLL_POSTER return on Holder is detached pos:" + position);
|
|
3266
|
+
}
|
|
3267
|
+
return;
|
|
3268
|
+
}
|
|
3269
|
+
}
|
|
3270
|
+
if (LogUtils.isDebug()) {
|
|
3271
|
+
// Log.e(TAG, "postAllDelayContent SCROLL_POSTER exeTask,holder:" + getHolderTaskType(holder) + ",attached:" + holder.attached + ",dataList.size():" + dataList.size() + ",position:" + position);
|
|
3272
|
+
// Log.v("MakeContentLog", "postAllDelayContent SCROLL_POSTER exeTask,holder:" + getHolderTaskType(holder) + ",attached:" + holder.attached + ",dataList.size():" + dataList.size() + ",position:" + position+",rootNode:"+en.rootNode.hashCode());
|
|
3273
|
+
}
|
|
3274
|
+
//updateItemContentRecursive(getControllerManager(), null, holder.tag, itemENode);
|
|
3275
|
+
if (dataList.size() > position) {
|
|
3276
|
+
// if (LogUtils.isDebug()) {
|
|
3277
|
+
// Log.i(TAG, "FastAdapterEvent createContent BeforeCalculate pos:" + position + ",templateNode:" + en.templateNode);
|
|
3278
|
+
// }
|
|
3279
|
+
if (en.getParent() instanceof ElementNode) {
|
|
3280
|
+
makeContentReady(getControllerManager(), holder.tag, en, getRootListView(),((ElementNode) en.getParent()).boundView,"");
|
|
3281
|
+
}else{
|
|
3282
|
+
makeContentReady(getControllerManager(), holder.tag, en, getRootListView(),null,"");
|
|
3283
|
+
}
|
|
3284
|
+
if (en.boundView instanceof PostTaskHolder) {
|
|
3285
|
+
((PostTaskHolder) en.boundView).setRootPostHandlerView(getRootListView());
|
|
3286
|
+
}
|
|
3287
|
+
final HippyMap map = (HippyMap) getRawObject(position);
|
|
3288
|
+
doDelayUpdatePropsRecursive(en,map,position);
|
|
3289
|
+
|
|
3290
|
+
// itemENode.calculateLayout();
|
|
3291
|
+
if (LogUtils.isDebug()) {
|
|
3292
|
+
// Log.e(TAG, "FastAdapterEvent DEAL_LAYOUT AfterCalculate pos:" + position + ",rootElement:" + vt.getRootNode() + "getItemType:" + getItemViewType(position));
|
|
3293
|
+
// Log.i(TAG, "FastAdapterEvent createContent DEAL_LAYOUT AfterCalculate pos:" + position + ",Style" + vt.getRootNode().styleToString());
|
|
3294
|
+
}
|
|
3295
|
+
//将itemView中的所有的View遍历,根据绑定的node节点来更新Layout
|
|
3296
|
+
//updateItemLayout(vt.getDelayLoadNodes());
|
|
3297
|
+
en.hasCreateView = true;
|
|
3298
|
+
} else {
|
|
3299
|
+
if (LogUtils.isDebug()) {
|
|
3300
|
+
Log.e(TAG, "postAllDelayContent SCROLL_POSTER return on position invalid: count is " + dataList.size() + ",position:" + position);
|
|
3301
|
+
}
|
|
3302
|
+
}
|
|
3303
|
+
}) , en.loadDelay);
|
|
3304
|
+
//updateLayout
|
|
3305
|
+
getRootListView().postTask(POST_TASK_CATEGORY_UPDATE_LAYOUT, postType, () -> {
|
|
3306
|
+
//重新计算布局
|
|
3307
|
+
if (enablePlaceholder) {
|
|
3308
|
+
if(en.rootNode != null && en.rootNode.recycled){
|
|
3309
|
+
if (LogUtils.isDebug()) {
|
|
3310
|
+
Log.e(TAG, "postAllDelayContent SCROLL_POSTER updateLayout return on en.rootNode.recycled pos:" + position);
|
|
3311
|
+
}
|
|
3312
|
+
return;
|
|
3313
|
+
}
|
|
3314
|
+
}else{
|
|
3315
|
+
if(!holder.attached){
|
|
3316
|
+
if (LogUtils.isDebug()) {
|
|
3317
|
+
Log.e(TAG, "postAllDelayContent SCROLL_POSTER updateLayout return on Holder is detached pos:" + position);
|
|
3318
|
+
}
|
|
3319
|
+
return;
|
|
3320
|
+
}
|
|
3321
|
+
}
|
|
3322
|
+
if (en.boundView != null) {
|
|
3323
|
+
measureAllCreatedView(en);
|
|
3324
|
+
itemENode.calculateLayout();
|
|
3325
|
+
//layout所有delay的View
|
|
3326
|
+
// if (holder.itemView instanceof ItemRootView) {
|
|
3327
|
+
// updateItemLayout4ItemRootView( holder.itemView,en);
|
|
3328
|
+
// }else {
|
|
3329
|
+
// updateItemLayout(en);
|
|
3330
|
+
// en.hasUpdateLayout = true;
|
|
3331
|
+
// }
|
|
3332
|
+
updateItemLayout(en);
|
|
3333
|
+
|
|
3334
|
+
}
|
|
3335
|
+
}, en.loadDelay + 20);
|
|
3336
|
+
}
|
|
3337
|
+
|
|
3338
|
+
} else {
|
|
3339
|
+
if (LogUtils.isDebug()) {
|
|
3340
|
+
Log.e(TAG, "postAllDelayContent return on getDelayLoadNodes,position:" + position);
|
|
3341
|
+
}
|
|
3342
|
+
}
|
|
3343
|
+
|
|
3344
|
+
|
|
3345
|
+
}
|
|
3346
|
+
|
|
3347
|
+
final static int STEP_INIT = 0;
|
|
3348
|
+
final static int STEP_ON_BIND = 1;
|
|
3349
|
+
final static int STEP_PLACEHOLDER_TO_CONTENT = 2;
|
|
3350
|
+
final static int STEP_VIF = 3;
|
|
3351
|
+
final static int STEP_DELAY_POST = 4;
|
|
3352
|
+
final static int STEP_UPDATE_ITEM = 5;
|
|
3353
|
+
|
|
3354
|
+
static boolean attachViewToParent(ElementNode cn){
|
|
3355
|
+
if (cn.boundView == null) {
|
|
3356
|
+
return false;
|
|
3357
|
+
}
|
|
3358
|
+
View parent = null;
|
|
3359
|
+
parent = cn.getParent() != null ? ((ElementNode) cn.getParent()).boundView : null;
|
|
3360
|
+
if (parent instanceof ViewGroup && !(parent instanceof FastPendingView)) {
|
|
3361
|
+
((ViewGroup) parent).addView(cn.boundView);
|
|
3362
|
+
if (LogUtils.isDebug()) {
|
|
3363
|
+
Log.e(TAG, "createViewRecursiveOnVIF attachToParent :" + cn.boundView + ",parent:" + parent);
|
|
3364
|
+
}
|
|
3365
|
+
return true;
|
|
3366
|
+
}
|
|
3367
|
+
return false;
|
|
3368
|
+
}
|
|
3369
|
+
|
|
3370
|
+
/**
|
|
3371
|
+
* 为ElementNode创建view
|
|
3372
|
+
*
|
|
3373
|
+
* @param m
|
|
3374
|
+
* @param cn
|
|
3375
|
+
* @param rootList
|
|
3376
|
+
* @return
|
|
3377
|
+
*/
|
|
3378
|
+
private static View createView4ElementNode(ControllerManager m, ElementNode cn, FastListView rootList,final View parentView,boolean addToParent,int step){
|
|
3379
|
+
String tag = "";
|
|
3380
|
+
switch (step){
|
|
3381
|
+
case STEP_VIF:
|
|
3382
|
+
tag = "CheckVIF";
|
|
3383
|
+
break;
|
|
3384
|
+
case STEP_DELAY_POST:
|
|
3385
|
+
tag = "MakeContentLog";
|
|
3386
|
+
break;
|
|
3387
|
+
}
|
|
3388
|
+
View view = null;
|
|
3389
|
+
final RenderNode templateNode = cn.templateNode;
|
|
3390
|
+
View parent = parentView;
|
|
3391
|
+
if(parent == null) {
|
|
3392
|
+
parent = cn.getParent() != null ? ((ElementNode) cn.getParent()).boundView : null;
|
|
3393
|
+
}
|
|
3394
|
+
final HippyViewController viewComponent = CustomControllerHelper.getViewController(m, cn.templateNode);
|
|
3395
|
+
|
|
3396
|
+
// if (step == STEP_PLACEHOLDER_TO_CONTENT) {
|
|
3397
|
+
// //在第二阶段,检查 v-if判断
|
|
3398
|
+
// boolean needCreate = dealVif4ElementNode(cn,)
|
|
3399
|
+
// }
|
|
3400
|
+
|
|
3401
|
+
if (viewComponent != null) {
|
|
3402
|
+
view = Utils.createViewImpl4FastList(CustomControllerHelper.getContext(templateNode),
|
|
3403
|
+
cn.pureProps != null ? cn.pureProps : templateNode.getProps(), viewComponent);
|
|
3404
|
+
if (view == null) {
|
|
3405
|
+
view = CustomControllerHelper.createViewImpl(CustomControllerHelper.getContext(templateNode), viewComponent);
|
|
3406
|
+
}
|
|
3407
|
+
if (view == null) {
|
|
3408
|
+
Log.e(tag,"createView4ElementNode error view is null");
|
|
3409
|
+
}
|
|
3410
|
+
cn.onViewInit(view,cn);
|
|
3411
|
+
if (cn.boundView instanceof PostTaskHolder) {
|
|
3412
|
+
//Image和textView
|
|
3413
|
+
((PostTaskHolder) cn.boundView).setRootPostHandlerView(rootList);
|
|
3414
|
+
}
|
|
3415
|
+
CustomControllerHelper.dealCustomProp(view, templateNode.getProps());
|
|
3416
|
+
//添加view
|
|
3417
|
+
if (addToParent && parent instanceof ViewGroup && !(parent instanceof FastPendingView)) {
|
|
3418
|
+
((ViewGroup) parent).addView(view);
|
|
3419
|
+
// if (LogUtils.isDebug()) {
|
|
3420
|
+
// Log.e(TAG, "createView4ElementNode addViewOnCreateViewRecursive :" + view + ",parent:" + parent);
|
|
3421
|
+
// Log.i(tag, "makeContentReady addViewOnCreateViewRecursive :" + view + ",parent:" + parent+",this.:"+cn.templateNode+",parentNode:"+ ((ElementNode) cn.getParent()).templateNode);
|
|
3422
|
+
// }
|
|
3423
|
+
}else{
|
|
3424
|
+
if(LogUtils.isDebug() && parent == null && cn.getParent() instanceof ElementNode) {
|
|
3425
|
+
if(step == STEP_VIF && !cn.isRootItem){
|
|
3426
|
+
Log.e("CheckVIF", "createView4ElementNode addViewOnCreateViewRecursive return ! :" + view + ",parentView :" + parent + ",template:" + cn.templateNode + ",parentNode:" + ((ElementNode) cn.getParent()).templateNode+",root:"+cn.rootNode.hashCode());
|
|
3427
|
+
}
|
|
3428
|
+
// Log.e(TAG, "makeContentReady addViewOnCreateViewRecursive return ! :" + view + ",parentView :" + parent + ",template:" + cn.templateNode + ",parentNode:" + cn.getParent());
|
|
3429
|
+
}
|
|
3430
|
+
}
|
|
3431
|
+
}else{
|
|
3432
|
+
Log.e(tag, "createView4ElementNode error viewComponent is null :" + ",node:" + cn.templateNode);
|
|
3433
|
+
}
|
|
3434
|
+
return view;
|
|
3435
|
+
}
|
|
3436
|
+
/**
|
|
3437
|
+
* 为ElementNode创建view
|
|
3438
|
+
* @param m
|
|
3439
|
+
* @param cn
|
|
3440
|
+
* @param rootList
|
|
3441
|
+
* @return
|
|
3442
|
+
*/
|
|
3443
|
+
static View createView4ElementNode(ControllerManager m, ElementNode cn, FastListView rootList,View parent,int type){
|
|
3444
|
+
return createView4ElementNode(m,cn,rootList,parent,true,type);
|
|
3445
|
+
}
|
|
3446
|
+
|
|
3447
|
+
static void makeContentReady(ControllerManager m, ViewTag tag, ElementNode cn, FastListView rootList,View parent,String pref) {
|
|
3448
|
+
if (cn != null) {
|
|
3449
|
+
if(LogUtils.isDebug()) {
|
|
3450
|
+
if ("".equals(pref)) {
|
|
3451
|
+
Log.i("MakeContentLog", pref + "-------------------------------------");
|
|
3452
|
+
}
|
|
3453
|
+
Log.i("MakeContentLog",pref+"makeContentReady node view :"+cn.boundView+",node:"+cn.templateNode);
|
|
3454
|
+
}
|
|
3455
|
+
|
|
3456
|
+
if (cn.boundView == null) {
|
|
3457
|
+
cn.boundView = createView4ElementNode(m, cn, rootList,parent, STEP_DELAY_POST);
|
|
3458
|
+
if (rootList != null && rootList.getFastAdapter() != null) {
|
|
3459
|
+
rootList.getFastAdapter().onElementViewCreated(cn);
|
|
3460
|
+
}
|
|
3461
|
+
}
|
|
3462
|
+
// if (LogUtils.isDebug() && cn.getChildCount() > 0) {
|
|
3463
|
+
// Log.e(TAG, "TestMakeContent child count > 0 :" + cn.getChildCount());
|
|
3464
|
+
// }
|
|
3465
|
+
if(LogUtils.isDebug()) {
|
|
3466
|
+
pref += ">>>";
|
|
3467
|
+
}
|
|
3468
|
+
for (int i = 0; i < cn.getChildCount(); i++) {
|
|
3469
|
+
ElementNode child = (ElementNode) cn.getChildAt(i);
|
|
3470
|
+
makeContentReady(m, tag, child, rootList,cn.boundView,pref);
|
|
3471
|
+
}
|
|
3472
|
+
}
|
|
3473
|
+
}
|
|
3474
|
+
|
|
3475
|
+
|
|
3476
|
+
|
|
3477
|
+
|
|
3478
|
+
|
|
3479
|
+
//zhaopeng add
|
|
3480
|
+
private HippyViewEvent mBindEvent, mUnbindEvent;
|
|
3481
|
+
|
|
3482
|
+
private void sendAdapterEvent(int id, int position, RenderNode node, Holder holder, String eventName) {
|
|
3483
|
+
|
|
3484
|
+
final HippyViewEvent event = new HippyViewEvent(eventName);
|
|
3485
|
+
|
|
3486
|
+
HippyMap map = new HippyMap();
|
|
3487
|
+
map.pushInt("position", position);
|
|
3488
|
+
if (node != null) {
|
|
3489
|
+
map.pushObject("name", Utils.getNameFromProps(node.getProps()));
|
|
3490
|
+
}
|
|
3491
|
+
if (LogUtils.isDebug()) {
|
|
3492
|
+
Log.i("BindEvent", "+++++sendAdapterEvent position:" + position + ",eventName:" + eventName+", id :"+id);
|
|
3493
|
+
}
|
|
3494
|
+
//event.send(view, map);
|
|
3495
|
+
eventDeliverer.sendEvent(event, id, map);
|
|
3496
|
+
// if (LogUtils.isDebug()) {
|
|
3497
|
+
// for (String s : holder.tag.template.getProps().keySet()) {
|
|
3498
|
+
// Log.d(TAG, "BindEvent item :" + position + ",prop:" + s);
|
|
3499
|
+
// }
|
|
3500
|
+
// }
|
|
3501
|
+
if (holder.tag.template.getProps().containsKey(eventName)) {
|
|
3502
|
+
final View templateItemView = Utils.findBoundView(context, holder.tag.template);
|
|
3503
|
+
// Log.d(TAG, "BindEvent sendAdapterEvent : eventName:" + eventName + ",id:" + (templateItemView == null ? -1 : templateItemView.getId()));
|
|
3504
|
+
if (templateItemView != null && this.dataList.size() > position && position > -1) {
|
|
3505
|
+
eventAppendRawItem(position,map);
|
|
3506
|
+
//event.send(templateItemView, map);
|
|
3507
|
+
eventDeliverer.sendEvent(event, templateItemView, map);
|
|
3508
|
+
} else {
|
|
3509
|
+
if (LogUtils.isDebug()) {
|
|
3510
|
+
Log.e(TAG, "BindEvent sendAdapterEvent error on templateView is null or dataList size 0, position:" + position + ",templateItemView:" + templateItemView);
|
|
3511
|
+
}
|
|
3512
|
+
}
|
|
3513
|
+
}
|
|
3514
|
+
}
|
|
3515
|
+
|
|
3516
|
+
|
|
3517
|
+
// private HippyMap mBindEventMap,mUnbindEventMap;
|
|
3518
|
+
private void sendOnBindEvent(int id, int position, RenderNode node, Holder holder) {
|
|
3519
|
+
if (mBindEvent == null) {
|
|
3520
|
+
mBindEvent = new HippyViewEvent("onBindItem");
|
|
3521
|
+
}
|
|
3522
|
+
|
|
3523
|
+
HippyMap map = new HippyMap();
|
|
3524
|
+
map.pushInt("position", position);
|
|
3525
|
+
if (node != null) {
|
|
3526
|
+
map.pushObject("name", Utils.getNameFromProps(node.getProps()));
|
|
3527
|
+
}
|
|
3528
|
+
if (LogUtils.isDebug()) {
|
|
3529
|
+
Log.i("BindEvent", "+++++sendOnBindEvent position:" + position+",id:"+id);
|
|
3530
|
+
}
|
|
3531
|
+
//mBindEvent.send(view, map);
|
|
3532
|
+
eventDeliverer.sendEvent(mBindEvent, id, map);
|
|
3533
|
+
// if (LogUtils.isDebug()) {
|
|
3534
|
+
// for (String s : holder.tag.template.getProps().keySet()) {
|
|
3535
|
+
// Log.d(TAG, "BindEvent item :" + position + ",prop:" + s);
|
|
3536
|
+
// }
|
|
3537
|
+
// }
|
|
3538
|
+
if (holder.tag.template.getProps().containsKey("onBindItem")) {
|
|
3539
|
+
final View templateItemView = Utils.findBoundView(context, holder.tag.template);
|
|
3540
|
+
if (LogUtils.isDebug()) {
|
|
3541
|
+
Log.d(TAG, "BindEvent send4TemplateView : templateItemView:" + templateItemView + ",id:" + (templateItemView == null ? -1 : templateItemView.getId()));
|
|
3542
|
+
}
|
|
3543
|
+
if (templateItemView != null && this.dataList.size() > position && position > -1) {
|
|
3544
|
+
eventAppendRawItem(position,map);
|
|
3545
|
+
//mBindEvent.send(templateItemView, map);
|
|
3546
|
+
eventDeliverer.sendEvent(mBindEvent, templateItemView, map);
|
|
3547
|
+
} else {
|
|
3548
|
+
if (LogUtils.isDebug()) {
|
|
3549
|
+
Log.e(TAG, "BindEvent send4TemplateView error on templateView is null or dataList size 0, position:" + position + ",templateItemView:" + templateItemView);
|
|
3550
|
+
}
|
|
3551
|
+
}
|
|
3552
|
+
}
|
|
3553
|
+
}
|
|
3554
|
+
|
|
3555
|
+
private void eventAppendRawItem(int position,HippyMap map){
|
|
3556
|
+
if(isEventSendItem) {
|
|
3557
|
+
if (LogUtils.isDebug()) {
|
|
3558
|
+
final Object item = getRawObject(position);
|
|
3559
|
+
Log.i(TAG, "BindEvent send4TemplateView sendUnBindEvent success position:" + position + ",itemData:" + item);
|
|
3560
|
+
}
|
|
3561
|
+
map.pushObject("item", getRawObject(position));
|
|
3562
|
+
}
|
|
3563
|
+
}
|
|
3564
|
+
|
|
3565
|
+
private void sendUnBindEvent(int id, int position, Holder holder) {
|
|
3566
|
+
if (mUnbindEvent == null) {
|
|
3567
|
+
mUnbindEvent = new HippyViewEvent("onItemRecycled");
|
|
3568
|
+
}
|
|
3569
|
+
HippyMap map = new HippyMap();
|
|
3570
|
+
map.pushInt("position", position);
|
|
3571
|
+
if (LogUtils.isDebug()) {
|
|
3572
|
+
Log.e("BindEvent", "-----unBind position:" + position);
|
|
3573
|
+
}
|
|
3574
|
+
//mUnbindEvent.send(view, map);
|
|
3575
|
+
eventDeliverer.sendEvent(mUnbindEvent, id, map);
|
|
3576
|
+
if (holder.tag.template.getProps().containsKey("onItemRecycled")) {
|
|
3577
|
+
final View templateItemView = Utils.findBoundView(context, holder.tag.template);
|
|
3578
|
+
if (LogUtils.isDebug()) {
|
|
3579
|
+
Log.d(TAG, "BindEvent sendUnBindEvent : templateItemView:" + templateItemView + ",id:" + (templateItemView == null ? -1 : templateItemView.getId()));
|
|
3580
|
+
}
|
|
3581
|
+
if (templateItemView != null && this.dataList.size() > position && position > -1) {
|
|
3582
|
+
eventAppendRawItem(position,map);
|
|
3583
|
+
//mUnbindEvent.send(templateItemView, map);
|
|
3584
|
+
eventDeliverer.sendEvent(mUnbindEvent, templateItemView, map);
|
|
3585
|
+
} else {
|
|
3586
|
+
if (LogUtils.isDebug()) {
|
|
3587
|
+
Log.e(TAG, "BindEvent send4TemplateView sendUnBindEvent error on position:" + position + ",dataSize:" + (this.dataList == null ? 0 : this.dataList.size()));
|
|
3588
|
+
}
|
|
3589
|
+
}
|
|
3590
|
+
}
|
|
3591
|
+
}
|
|
3592
|
+
|
|
3593
|
+
interface ListNode {
|
|
3594
|
+
|
|
3595
|
+
int getChildCount();
|
|
3596
|
+
|
|
3597
|
+
RenderNode getNode();
|
|
3598
|
+
|
|
3599
|
+
void setBoundTag(ListNodeTag tag);
|
|
3600
|
+
|
|
3601
|
+
ListNodeTag getBoundTag();
|
|
3602
|
+
|
|
3603
|
+
RenderNode getChildAt(int i);
|
|
3604
|
+
}
|
|
3605
|
+
|
|
3606
|
+
static class ListNodeTag {
|
|
3607
|
+
|
|
3608
|
+
public int position;
|
|
3609
|
+
public ListNode parent;
|
|
3610
|
+
public ElementNode listElementNode;
|
|
3611
|
+
}
|
|
3612
|
+
|
|
3613
|
+
void recycleItem(Holder holder) {
|
|
3614
|
+
final View v = holder.itemView;
|
|
3615
|
+
if(v.getParent() != null){
|
|
3616
|
+
((ViewGroup)v.getParent()).removeView(v);
|
|
3617
|
+
}
|
|
3618
|
+
if (LogUtils.isDebug()) {
|
|
3619
|
+
Log.i(TAG, "WorkLOG recycleItem holder:" + Utils.hashCode(holder));
|
|
3620
|
+
}
|
|
3621
|
+
holder.tag.cancelWork();
|
|
3622
|
+
getCacheWorker(holder.itemView.getContext(),getCacheRootView()).put(holder);
|
|
3623
|
+
}
|
|
3624
|
+
|
|
3625
|
+
|
|
3626
|
+
final static class CachePool extends RecyclerView.RecycledViewPool {
|
|
3627
|
+
// Map<Integer, CacheViewList> map = new HashMap<>();
|
|
3628
|
+
|
|
3629
|
+
Holder get(int type) {
|
|
3630
|
+
final Holder h = (Holder) getRecycledView(type);
|
|
3631
|
+
if (h == null) {
|
|
3632
|
+
if(LogUtils.isDebug()) {
|
|
3633
|
+
Log.d(TAG, "!!!!DebugPool CachePool get return null,type:" + type + ",pool :" + Utils.hashCode(this) + "remain:" + getRecycledViewCount(type));
|
|
3634
|
+
}
|
|
3635
|
+
}
|
|
3636
|
+
return h;
|
|
3637
|
+
}
|
|
3638
|
+
|
|
3639
|
+
public void setMaxCacheSize(int type, int max) {
|
|
3640
|
+
setMaxRecycledViews(type, max);
|
|
3641
|
+
}
|
|
3642
|
+
|
|
3643
|
+
void put(Holder view) {
|
|
3644
|
+
|
|
3645
|
+
if (view != null && LogUtils.isDebug()) {
|
|
3646
|
+
Log.d(TAG, "++++DebugPool CachePool put new ,type:" + view.type + ",pool :" + Utils.hashCode(this) + ",cacheCount::" + getRecycledViewCount(view.type));
|
|
3647
|
+
}
|
|
3648
|
+
putRecycledView(view);
|
|
3649
|
+
}
|
|
3650
|
+
}
|
|
3651
|
+
|
|
3652
|
+
|
|
3653
|
+
private final static class CacheViewList {
|
|
3654
|
+
final int type;
|
|
3655
|
+
CacheList list;
|
|
3656
|
+
|
|
3657
|
+
|
|
3658
|
+
private CacheViewList(int type) {
|
|
3659
|
+
this.type = type;
|
|
3660
|
+
}
|
|
3661
|
+
|
|
3662
|
+
|
|
3663
|
+
public void setMaxCacheSize(int max) {
|
|
3664
|
+
if (list == null) {
|
|
3665
|
+
list = new CacheList();
|
|
3666
|
+
}
|
|
3667
|
+
list.max = max;
|
|
3668
|
+
}
|
|
3669
|
+
|
|
3670
|
+
void put(Holder view) {
|
|
3671
|
+
if (list == null) {
|
|
3672
|
+
list = new CacheList();
|
|
3673
|
+
}
|
|
3674
|
+
final boolean add = list.add(view);
|
|
3675
|
+
if (add) {
|
|
3676
|
+
if (LogUtils.isDebug()) {
|
|
3677
|
+
Log.d(TAG, "+++CacheViewList put size:" + list.size() + ",type:" + type);
|
|
3678
|
+
}
|
|
3679
|
+
} else {
|
|
3680
|
+
if (LogUtils.isDebug()) {
|
|
3681
|
+
Log.e(TAG, "+++CacheViewList put max items " + ",type:" + type);
|
|
3682
|
+
}
|
|
3683
|
+
}
|
|
3684
|
+
}
|
|
3685
|
+
|
|
3686
|
+
Holder get() {
|
|
3687
|
+
if (list != null && list.size() > 0) {
|
|
3688
|
+
if (LogUtils.isDebug()) {
|
|
3689
|
+
Log.d(TAG, "---CacheViewList popup size:" + list.size() + ",type:" + type);
|
|
3690
|
+
}
|
|
3691
|
+
return list.get();
|
|
3692
|
+
}
|
|
3693
|
+
return null;
|
|
3694
|
+
}
|
|
3695
|
+
}
|
|
3696
|
+
|
|
3697
|
+
public static class CacheList {
|
|
3698
|
+
int max = 20;
|
|
3699
|
+
List<Holder> list;
|
|
3700
|
+
|
|
3701
|
+
boolean add(Holder view) {
|
|
3702
|
+
if (list == null) {
|
|
3703
|
+
list = new ArrayList<>();
|
|
3704
|
+
}
|
|
3705
|
+
if (size() < max) {
|
|
3706
|
+
|
|
3707
|
+
|
|
3708
|
+
final boolean b = list.add(view);
|
|
3709
|
+
// if(b){
|
|
3710
|
+
// if(view instanceof HippyRecycler){
|
|
3711
|
+
// ((HippyRecycler) view).onResetBeforeCache();
|
|
3712
|
+
// }
|
|
3713
|
+
// }
|
|
3714
|
+
return b;
|
|
3715
|
+
} else {
|
|
3716
|
+
return false;
|
|
3717
|
+
}
|
|
3718
|
+
}
|
|
3719
|
+
|
|
3720
|
+
Holder get() {
|
|
3721
|
+
if (list != null && list.size() > 0) {
|
|
3722
|
+
return list.remove(0);
|
|
3723
|
+
}
|
|
3724
|
+
return null;
|
|
3725
|
+
}
|
|
3726
|
+
|
|
3727
|
+
int size() {
|
|
3728
|
+
return list.size();
|
|
3729
|
+
}
|
|
3730
|
+
|
|
3731
|
+
}
|
|
3732
|
+
|
|
3733
|
+
private static class initConfig{
|
|
3734
|
+
public boolean enablePostDelay = false;
|
|
3735
|
+
public boolean disablePlaceholder = false;
|
|
3736
|
+
public HippyArray placeholderLayout = null;
|
|
3737
|
+
public float placeholderScale = -1;
|
|
3738
|
+
public boolean disablePlaceholderFocus = false;
|
|
3739
|
+
public String placeholderIcon = null;
|
|
3740
|
+
public HippyArray placeholderIconSize = null;
|
|
3741
|
+
private boolean needCheckVIF = false;
|
|
3742
|
+
private boolean isViewFocusable = false;
|
|
3743
|
+
private boolean hasNestList = false;
|
|
3744
|
+
private boolean createViewOnInit = false;
|
|
3745
|
+
private boolean enableDelayLoad = false;
|
|
3746
|
+
private boolean enableCoverRole = false;
|
|
3747
|
+
}
|
|
3748
|
+
|
|
3749
|
+
/**
|
|
3750
|
+
* 主要功能相当于RenderNode及DomNode二合一。不等于每个position都拥有一个绑定的view,面是ItemView绑定一个element;
|
|
3751
|
+
* 例如当一个列表中可见三个item时,可能最多有5个ElementNode存在
|
|
3752
|
+
*/
|
|
3753
|
+
public static class ElementNode extends StyleNode {
|
|
3754
|
+
final FastAdapter.initConfig initConfig;
|
|
3755
|
+
public View boundView;
|
|
3756
|
+
String name;
|
|
3757
|
+
RenderNode templateNode;
|
|
3758
|
+
HippyMap pureProps;
|
|
3759
|
+
ElementNode rootNode;
|
|
3760
|
+
Runnable layoutTask;
|
|
3761
|
+
ElementNode focusableNode;
|
|
3762
|
+
ViewTag.Worker pendingWorker;
|
|
3763
|
+
boolean markAsPlaceholder = false;
|
|
3764
|
+
//是否初始化过
|
|
3765
|
+
boolean hasInit = false;
|
|
3766
|
+
//是否创建过绑定的view
|
|
3767
|
+
boolean hasCreateView = false;
|
|
3768
|
+
boolean hasUpdateLayout = false;
|
|
3769
|
+
//是否请求layout,该请求来自于子节点
|
|
3770
|
+
boolean isLayoutDirty = false;
|
|
3771
|
+
//宽度自适应
|
|
3772
|
+
public boolean isWidthWrapContent = false;
|
|
3773
|
+
//高度自适应
|
|
3774
|
+
public boolean isHeightWrapContent = false;
|
|
3775
|
+
int adapterPosition = -1;
|
|
3776
|
+
HippyMap pendingProps;
|
|
3777
|
+
//是否是根的item
|
|
3778
|
+
boolean isRootItem = false;
|
|
3779
|
+
ArrayList<Runnable> mPostTasks;
|
|
3780
|
+
//延迟加载
|
|
3781
|
+
int loadDelay = 0;
|
|
3782
|
+
//延迟加载的view
|
|
3783
|
+
boolean isMarkToDelay = false;
|
|
3784
|
+
boolean recycled = false;
|
|
3785
|
+
//检查v-if是否生效
|
|
3786
|
+
boolean isPlaceholderEnable = false;
|
|
3787
|
+
|
|
3788
|
+
public HippyMap placeholderStyle = null;
|
|
3789
|
+
public String itemSID = null;
|
|
3790
|
+
|
|
3791
|
+
public RenderNode getTemplateNode() {
|
|
3792
|
+
return templateNode;
|
|
3793
|
+
}
|
|
3794
|
+
|
|
3795
|
+
public ElementNode() {
|
|
3796
|
+
this.initConfig = new initConfig();
|
|
3797
|
+
}
|
|
3798
|
+
|
|
3799
|
+
void resetState() {
|
|
3800
|
+
// this.hasInit = false;
|
|
3801
|
+
this.isLayoutDirty = true;
|
|
3802
|
+
//this.adapterPosition = -1;
|
|
3803
|
+
}
|
|
3804
|
+
|
|
3805
|
+
static void updateItemLayoutNegative(DomNode node) {
|
|
3806
|
+
if (node instanceof ElementNode) {
|
|
3807
|
+
final ElementNode en = (ElementNode) node;
|
|
3808
|
+
if (!en.isRootItem) {
|
|
3809
|
+
final View view = en.boundView;
|
|
3810
|
+
if (view != null) {
|
|
3811
|
+
if (LogUtils.isDebug()) {
|
|
3812
|
+
Log.i("AutoMeasure", "updateItemLayoutNegative this:" + en);
|
|
3813
|
+
}
|
|
3814
|
+
FastAdapterUtil.updateLayout(view, en);
|
|
3815
|
+
}
|
|
3816
|
+
}
|
|
3817
|
+
}
|
|
3818
|
+
for (int i = 0; i < node.getChildCount(); i++) {
|
|
3819
|
+
updateItemLayoutNegative(node.getChildAt(i));
|
|
3820
|
+
}
|
|
3821
|
+
}
|
|
3822
|
+
|
|
3823
|
+
void postTask(PostTask postTask){
|
|
3824
|
+
if (mPostTasks == null) {
|
|
3825
|
+
mPostTasks = new ArrayList();
|
|
3826
|
+
}
|
|
3827
|
+
mPostTasks.add(postTask);
|
|
3828
|
+
if (boundView != null) {
|
|
3829
|
+
if(LogUtils.isDebug()){
|
|
3830
|
+
Log.i(TAG_POST,"PostTask +++++++++add task t :"+postTask);
|
|
3831
|
+
}
|
|
3832
|
+
boundView.post(postTask);
|
|
3833
|
+
}
|
|
3834
|
+
}
|
|
3835
|
+
|
|
3836
|
+
void clearPostTask(){
|
|
3837
|
+
if (mPostTasks != null) {
|
|
3838
|
+
if(boundView != null){
|
|
3839
|
+
for(Runnable t : mPostTasks) {
|
|
3840
|
+
if(LogUtils.isDebug()){
|
|
3841
|
+
Log.i(TAG_POST,"PostTask ---------remove task t :"+t);
|
|
3842
|
+
}
|
|
3843
|
+
boundView.removeCallbacks(t);
|
|
3844
|
+
}
|
|
3845
|
+
}
|
|
3846
|
+
mPostTasks.clear();
|
|
3847
|
+
}
|
|
3848
|
+
for(int i = 0; i < getChildCount(); i ++){
|
|
3849
|
+
Object child = getChildAt(i);
|
|
3850
|
+
if(child instanceof ElementNode){
|
|
3851
|
+
((ElementNode) child).clearPostTask();
|
|
3852
|
+
}
|
|
3853
|
+
}
|
|
3854
|
+
}
|
|
3855
|
+
|
|
3856
|
+
void requestItemLayout() {
|
|
3857
|
+
if (boundView != null) {
|
|
3858
|
+
if (layoutTask != null) {
|
|
3859
|
+
boundView.removeCallbacks(layoutTask);
|
|
3860
|
+
}
|
|
3861
|
+
layoutTask = () -> {
|
|
3862
|
+
calculateLayout();
|
|
3863
|
+
updateItemLayoutNegative(ElementNode.this);
|
|
3864
|
+
};
|
|
3865
|
+
boundView.postDelayed(layoutTask, 16);
|
|
3866
|
+
}
|
|
3867
|
+
}
|
|
3868
|
+
|
|
3869
|
+
public void requestMeasure() {
|
|
3870
|
+
if (LogUtils.isDebug()) {
|
|
3871
|
+
Log.i("AutoMeasure", "~~~~~~~~~~~~requestMeasure this:" + this);
|
|
3872
|
+
}
|
|
3873
|
+
isLayoutDirty = true;
|
|
3874
|
+
if (isRootItem) {
|
|
3875
|
+
requestItemLayout();
|
|
3876
|
+
}
|
|
3877
|
+
if (getParent() instanceof ElementNode) {
|
|
3878
|
+
final ElementNode pNode = (ElementNode) getParent();
|
|
3879
|
+
if (pNode.isHeightWrapContent) {
|
|
3880
|
+
pNode.setStyleHeight(FlexConstants.UNDEFINED);
|
|
3881
|
+
}
|
|
3882
|
+
pNode.requestMeasure();
|
|
3883
|
+
}
|
|
3884
|
+
}
|
|
3885
|
+
|
|
3886
|
+
|
|
3887
|
+
public float getStylePadding(int spacingType) {
|
|
3888
|
+
return Style().getPadding(FlexNodeStyle.Edge.fromInt(spacingType)).value();
|
|
3889
|
+
}
|
|
3890
|
+
|
|
3891
|
+
public float getStyleMargin(int spacingType) {
|
|
3892
|
+
return Style().getMargin(FlexNodeStyle.Edge.fromInt(spacingType)).value();
|
|
3893
|
+
}
|
|
3894
|
+
|
|
3895
|
+
public float getStyleBorder(int spacingType) {
|
|
3896
|
+
return Style().getBorder(FlexNodeStyle.Edge.fromInt(spacingType)).value();
|
|
3897
|
+
}
|
|
3898
|
+
|
|
3899
|
+
@Override
|
|
3900
|
+
public String toString() {
|
|
3901
|
+
return styleToString();
|
|
3902
|
+
}
|
|
3903
|
+
|
|
3904
|
+
// @Override
|
|
3905
|
+
public String styleToString() {
|
|
3906
|
+
return "\nSTYLE:\n" +
|
|
3907
|
+
"{left: " + getLayoutX() + ", " +
|
|
3908
|
+
"top: " + getLayoutY() + ", " +
|
|
3909
|
+
"width: " + getLayoutWidth() + ", " +
|
|
3910
|
+
"height: " + getLayoutHeight() + ", " +
|
|
3911
|
+
"styleWidth: " + getStyleWidth() + ", " +
|
|
3912
|
+
"styleHeight: " + getStyleHeight() + ", " +
|
|
3913
|
+
"className: " + getViewClass() + ", " +
|
|
3914
|
+
"this: " + (boundView != null ? boundView.hashCode() : null) + ", " +
|
|
3915
|
+
"}";
|
|
3916
|
+
}
|
|
3917
|
+
|
|
3918
|
+
public void onNodeInitOnSingleton(RenderNode templateNode) {
|
|
3919
|
+
this.onConfigFix(templateNode,true);
|
|
3920
|
+
}
|
|
3921
|
+
|
|
3922
|
+
void onConfigFix(RenderNode templateNode,boolean singleton){
|
|
3923
|
+
this.templateNode = templateNode;
|
|
3924
|
+
// Log.i("FocusableNode","++++onNodeInit false templateNode : "+templateNode);
|
|
3925
|
+
this.pureProps = new HippyMap();
|
|
3926
|
+
//如果数据包含${xx},将这种prop排除
|
|
3927
|
+
// if(getStyleWidth() < 1){
|
|
3928
|
+
// Log.e(TAG,"onNodeInit getStyleWidth < 1 this:"+templateNode);
|
|
3929
|
+
// }
|
|
3930
|
+
// if(getStyleHeight() < 1){
|
|
3931
|
+
// Log.e(TAG,"onNodeInit getStyleHeight < 1 this:"+templateNode);
|
|
3932
|
+
// }
|
|
3933
|
+
if(HippyImageViewController.CLASS_NAME.equals(templateNode.getClassName())){
|
|
3934
|
+
boolean isCoverRole = "cover".equals( templateNode.getProps().getString("roleType"));
|
|
3935
|
+
if(isCoverRole){
|
|
3936
|
+
this.initConfig.enableCoverRole = true;
|
|
3937
|
+
if (rootNode != null) {
|
|
3938
|
+
rootNode.initConfig.enableCoverRole = true;
|
|
3939
|
+
}
|
|
3940
|
+
}
|
|
3941
|
+
}
|
|
3942
|
+
|
|
3943
|
+
for(String prop : templateNode.getProps().keySet()){
|
|
3944
|
+
final Object value = templateNode.getProps().get(prop);
|
|
3945
|
+
if (value != null) {
|
|
3946
|
+
if (!TemplateCodeParser.isPendingProForce(value)) {
|
|
3947
|
+
this.pureProps.pushObject(prop, value);
|
|
3948
|
+
} else {
|
|
3949
|
+
if (TemplateCodeParser.PENDING_PROP_CREATE_IF.equals(prop)) {
|
|
3950
|
+
this.initConfig.needCheckVIF = true;
|
|
3951
|
+
}
|
|
3952
|
+
}
|
|
3953
|
+
}
|
|
3954
|
+
switch (prop){
|
|
3955
|
+
case "autoWidth":
|
|
3956
|
+
isWidthWrapContent = true;
|
|
3957
|
+
break;
|
|
3958
|
+
case "autoHeight":
|
|
3959
|
+
isHeightWrapContent = true;
|
|
3960
|
+
break;
|
|
3961
|
+
case Utils.KEY_CONTENT_DELAY:
|
|
3962
|
+
isMarkToDelay = true;
|
|
3963
|
+
if (rootNode != null) {
|
|
3964
|
+
rootNode.initConfig.enableDelayLoad = true;
|
|
3965
|
+
}
|
|
3966
|
+
if(value instanceof Integer) {
|
|
3967
|
+
loadDelay = (int) value;
|
|
3968
|
+
}
|
|
3969
|
+
break;
|
|
3970
|
+
case Utils.KEY_PLACEHOLDER_VIEW:
|
|
3971
|
+
markAsPlaceholder = true;
|
|
3972
|
+
break;
|
|
3973
|
+
case "name":
|
|
3974
|
+
if(value instanceof String){
|
|
3975
|
+
name = (String) value;
|
|
3976
|
+
}
|
|
3977
|
+
break;
|
|
3978
|
+
case NodeProps.FOCUSABLE:
|
|
3979
|
+
if( FastAdapterUtil.parseBoolean(value)){
|
|
3980
|
+
this.initConfig.isViewFocusable = true;
|
|
3981
|
+
if (this.rootNode != null) {
|
|
3982
|
+
this.rootNode.focusableNode = this;
|
|
3983
|
+
// Log.e("FocusableNode","++++focusableNode firm : "+templateNode+",rootNode:"+this.rootNode.templateNode);
|
|
3984
|
+
}
|
|
3985
|
+
}
|
|
3986
|
+
break;
|
|
3987
|
+
// case "eventFocus":
|
|
3988
|
+
// case "eventClick":
|
|
3989
|
+
// this.initConfig.isViewFocusable = true;
|
|
3990
|
+
// if (this.rootNode != null) {
|
|
3991
|
+
// this.rootNode.focusableNode = this;
|
|
3992
|
+
// Log.e("FocusableNode","focusableNode firm on eventClick: "+focusableNode.templateNode+",rootNode:"+this.rootNode.templateNode);
|
|
3993
|
+
// }
|
|
3994
|
+
// break;
|
|
3995
|
+
case "postDelay":
|
|
3996
|
+
this.initConfig.enablePostDelay = true;
|
|
3997
|
+
break;
|
|
3998
|
+
case "disablePlaceholder":
|
|
3999
|
+
initConfig.disablePlaceholder = true;
|
|
4000
|
+
if (rootNode != null) {
|
|
4001
|
+
rootNode.initConfig.disablePlaceholder = true;
|
|
4002
|
+
}
|
|
4003
|
+
break;
|
|
4004
|
+
case "placeholderLayout":
|
|
4005
|
+
if (rootNode != null && value instanceof HippyArray) {
|
|
4006
|
+
rootNode.initConfig.placeholderLayout = (HippyArray) value;
|
|
4007
|
+
}
|
|
4008
|
+
break;
|
|
4009
|
+
case "placeholderScale":
|
|
4010
|
+
if (rootNode != null && value != null) {
|
|
4011
|
+
//Log.i("placeholderScale","placeholderScale set on float "+value+",class:"+value.getClass());
|
|
4012
|
+
if(value instanceof Float) {
|
|
4013
|
+
rootNode.initConfig.placeholderScale = (Float) value;
|
|
4014
|
+
}
|
|
4015
|
+
if (value instanceof Double) {
|
|
4016
|
+
rootNode.initConfig.placeholderScale = ((Double) value).floatValue();
|
|
4017
|
+
}
|
|
4018
|
+
if (value instanceof Integer) {
|
|
4019
|
+
rootNode.initConfig.placeholderScale = ((Integer) value).floatValue();
|
|
4020
|
+
}
|
|
4021
|
+
}else{
|
|
4022
|
+
//Log.e("placeholderScale","placeholderScale value null");
|
|
4023
|
+
}
|
|
4024
|
+
break;
|
|
4025
|
+
case "disablePlaceholderFocus":
|
|
4026
|
+
initConfig.disablePlaceholderFocus = true;
|
|
4027
|
+
if (rootNode != null) {
|
|
4028
|
+
rootNode.initConfig.disablePlaceholderFocus = true;
|
|
4029
|
+
}
|
|
4030
|
+
break;
|
|
4031
|
+
case "placeholderIcon":
|
|
4032
|
+
if(value instanceof String) {
|
|
4033
|
+
initConfig.placeholderIcon = (String) value;
|
|
4034
|
+
if (rootNode != null) {
|
|
4035
|
+
rootNode.initConfig.placeholderIcon = (String) value;
|
|
4036
|
+
}
|
|
4037
|
+
}
|
|
4038
|
+
break;
|
|
4039
|
+
case "placeholderIconSize":
|
|
4040
|
+
if(value instanceof HippyArray) {
|
|
4041
|
+
initConfig.placeholderIconSize = (HippyArray) value;
|
|
4042
|
+
if (rootNode != null) {
|
|
4043
|
+
rootNode.initConfig.placeholderIconSize = (HippyArray) value;
|
|
4044
|
+
}
|
|
4045
|
+
}
|
|
4046
|
+
break;
|
|
4047
|
+
}
|
|
4048
|
+
|
|
4049
|
+
}
|
|
4050
|
+
|
|
4051
|
+
}
|
|
4052
|
+
|
|
4053
|
+
public void onNodeInit(RenderNode templateNode) {
|
|
4054
|
+
this.onConfigFix(templateNode,false);
|
|
4055
|
+
|
|
4056
|
+
}
|
|
4057
|
+
|
|
4058
|
+
/**
|
|
4059
|
+
* 当item中每个view创建完成后,调用该方法
|
|
4060
|
+
* @param view
|
|
4061
|
+
*/
|
|
4062
|
+
public void onViewInit(View view,ElementNode el) {
|
|
4063
|
+
if (view instanceof TVTextView) {
|
|
4064
|
+
((TVTextView) view).bindNode(this);
|
|
4065
|
+
if (isHeightWrapContent) {
|
|
4066
|
+
setStyleHeight(FlexConstants.UNDEFINED);
|
|
4067
|
+
view.setLayoutParams(new ViewGroup.LayoutParams((int) getStyleWidth(), -2));
|
|
4068
|
+
}
|
|
4069
|
+
}
|
|
4070
|
+
if (view instanceof HippyImageView) {
|
|
4071
|
+
|
|
4072
|
+
}
|
|
4073
|
+
// Log.v("ItemContainerLog","---onViewInit view : rootNode.isPlaceholderEnable"+rootNode.isPlaceholderEnable+",this == rootNode.focusableNode"+(this == rootNode.focusableNode)+",!initConfig.disablePlaceholderFocus:"+(!initConfig.disablePlaceholderFocus)+",view:"+view);
|
|
4074
|
+
// if (rootNode.isPlaceholderEnable && this == rootNode.focusableNode && !initConfig.disablePlaceholderFocus) {
|
|
4075
|
+
// Log.i("ItemContainerLog","onViewInit view : "+view);
|
|
4076
|
+
// FastAdapterUtil.setDuplicateParentStateEnabled4AllParent(view,true);
|
|
4077
|
+
// }
|
|
4078
|
+
if (view instanceof FastListView) {
|
|
4079
|
+
//Log.i("ZHAOPENG", "FastAdapter onViewInit setTemplateNode :" + templateNode);
|
|
4080
|
+
((FastListView) view).setTemplateNode(templateNode);
|
|
4081
|
+
((FastListView) view).getFastAdapter().setEnablePlaceholder(CHILD_LIST_PLACEHOLDER_ENABLE);
|
|
4082
|
+
}
|
|
4083
|
+
if(view instanceof JSEventHandleView){
|
|
4084
|
+
((JSEventHandleView) view).setJSEventViewID(templateNode.getId());
|
|
4085
|
+
}
|
|
4086
|
+
boundView = view;
|
|
4087
|
+
//设置Name,zhaopeng 这里如果不设置Name,会导致一些基于name而设置的api无效,比如firstSearchTarget等
|
|
4088
|
+
// ItemTag tagObj = new ItemTag();
|
|
4089
|
+
// tagObj.pushString(NodeProps.NAME, name);
|
|
4090
|
+
// view.setTag(tagObj);
|
|
4091
|
+
final ExtendTag extTag = new ClonedViewTag(templateNode);
|
|
4092
|
+
extTag.nodeClassName = templateNode.getClassName();
|
|
4093
|
+
extTag.name = name;
|
|
4094
|
+
ExtendTag.putTag(view,extTag);
|
|
4095
|
+
}
|
|
4096
|
+
|
|
4097
|
+
void measureParentWidthIfNeed(ElementNode node, float width) {
|
|
4098
|
+
if (node.isWidthWrapContent) {
|
|
4099
|
+
final float padding = node.getStylePadding(0) + node.getStylePadding(2);
|
|
4100
|
+
node.setStyleWidth(width + padding);
|
|
4101
|
+
}
|
|
4102
|
+
if (node.getParent() instanceof ElementNode) {
|
|
4103
|
+
measureParentWidthIfNeed((ElementNode) node.getParent(), width);
|
|
4104
|
+
}
|
|
4105
|
+
}
|
|
4106
|
+
|
|
4107
|
+
// public String styleToString() {
|
|
4108
|
+
// return "\nSTYLE:\n" +
|
|
4109
|
+
// "flexDirection: {" +getFlexDirection()+", "+
|
|
4110
|
+
// "getJustifyContent: {" +getJustifyContent()+", "+
|
|
4111
|
+
// "getAlignItems: {" +getAlignItems()+", \n"+
|
|
4112
|
+
// "margin: " + getMargin(0) + ", " +getMargin(1) + ", "+ +getMargin(2) + ", "+ +getMargin(3) + ", "+
|
|
4113
|
+
// "padding: " + getPadding(0) + ", " +getPadding(1) + ", "+ +getPadding(2) + ", "+ +getPadding(3) + ", \n"+
|
|
4114
|
+
// "stylePadding: " + getStylePadding(0) + ", " +getStylePadding(1) + ", "+ +getStylePadding(2) + ", "+ +getStylePadding(3) + ", \n"+
|
|
4115
|
+
// "left: " + getLayoutX() + ", " +
|
|
4116
|
+
// "top: " + getLayoutY() + ", " +
|
|
4117
|
+
// "width: " + getLayoutWidth() + ", " +
|
|
4118
|
+
// "height: " + getLayoutHeight() + ", " +
|
|
4119
|
+
// "styleWidth: " + getStyleWidth() + ", " +
|
|
4120
|
+
// "styleHeight: " + getStyleHeight() + ", " +
|
|
4121
|
+
// "className: " + getViewClass() + ", " +
|
|
4122
|
+
// "this: " + Utils.hashCode(this) + ", " +
|
|
4123
|
+
// "}";
|
|
4124
|
+
// }
|
|
4125
|
+
|
|
4126
|
+
}
|
|
4127
|
+
|
|
4128
|
+
public void setOnFastItemClickListener(OnFastItemClickListener onFastItemClickListener) {
|
|
4129
|
+
this.onFastItemClickListener = onFastItemClickListener;
|
|
4130
|
+
}
|
|
4131
|
+
|
|
4132
|
+
public void setOnFastItemFocusChangeListener(OnFastItemFocusChangeListener onFastItemFocusChangeListener) {
|
|
4133
|
+
this.onFastItemFocusChangeListener = onFastItemFocusChangeListener;
|
|
4134
|
+
}
|
|
4135
|
+
|
|
4136
|
+
public interface ScrollTaskHandler {
|
|
4137
|
+
void clearPostTask(int type);
|
|
4138
|
+
|
|
4139
|
+
void notifyDetachFromParent();
|
|
4140
|
+
|
|
4141
|
+
void notifyAttachToParent();
|
|
4142
|
+
|
|
4143
|
+
void notifyPauseTask();
|
|
4144
|
+
|
|
4145
|
+
void notifyResumeTask();
|
|
4146
|
+
|
|
4147
|
+
void notifyBringToFront(boolean front);
|
|
4148
|
+
|
|
4149
|
+
}
|
|
4150
|
+
|
|
4151
|
+
|
|
4152
|
+
public static final class ItemEntity {
|
|
4153
|
+
int position;
|
|
4154
|
+
final Object raw;
|
|
4155
|
+
// boolean updateItemDirty = false;
|
|
4156
|
+
|
|
4157
|
+
|
|
4158
|
+
// HippyMap rawPendingPropsReverse;
|
|
4159
|
+
ItemEntity(Object raw, int position) {
|
|
4160
|
+
this.raw = raw;
|
|
4161
|
+
this.position = position;
|
|
4162
|
+
}
|
|
4163
|
+
|
|
4164
|
+
// @Override
|
|
4165
|
+
// public String toString() {
|
|
4166
|
+
// return "ItemEntity{" +
|
|
4167
|
+
// "position=" + position +
|
|
4168
|
+
// ", updateItemDirty=" + updateItemDirty +
|
|
4169
|
+
// '}';
|
|
4170
|
+
// }
|
|
4171
|
+
|
|
4172
|
+
HippyMap getMap() {
|
|
4173
|
+
return raw instanceof HippyMap ? (HippyMap) raw : null;
|
|
4174
|
+
}
|
|
4175
|
+
|
|
4176
|
+
Object getObject() {
|
|
4177
|
+
return raw;
|
|
4178
|
+
}
|
|
4179
|
+
}
|
|
4180
|
+
|
|
4181
|
+
|
|
4182
|
+
// public static final class ItemTag extends HippyMap{
|
|
4183
|
+
// private Object id;
|
|
4184
|
+
// public void setID(Object id){
|
|
4185
|
+
// if(LogUtils.isDebug()){
|
|
4186
|
+
// Log.v(TAG,"InnerTag setID:"+id);
|
|
4187
|
+
// }
|
|
4188
|
+
// this.id = id;
|
|
4189
|
+
// }
|
|
4190
|
+
//
|
|
4191
|
+
// public Object getId() {
|
|
4192
|
+
// return id;
|
|
4193
|
+
// }
|
|
4194
|
+
//
|
|
4195
|
+
// @Override
|
|
4196
|
+
// public boolean equals(Object o) {
|
|
4197
|
+
// if (this == o) return true;
|
|
4198
|
+
// if(o instanceof String){
|
|
4199
|
+
// return o.equals(id);
|
|
4200
|
+
// }
|
|
4201
|
+
// if (o == null || getClass() != o.getClass()) return false;
|
|
4202
|
+
// ItemTag innerTag = (ItemTag) o;
|
|
4203
|
+
// return Objects.equals(id, innerTag.id);
|
|
4204
|
+
// }
|
|
4205
|
+
//
|
|
4206
|
+
// @Override
|
|
4207
|
+
// public String toString() {
|
|
4208
|
+
// return "InnerTag{" +
|
|
4209
|
+
// "id=" + id +
|
|
4210
|
+
// '}'+"super:"+super.toString();
|
|
4211
|
+
// }
|
|
4212
|
+
//
|
|
4213
|
+
// @Override
|
|
4214
|
+
// public int hashCode() {
|
|
4215
|
+
// return Objects.hash(id);
|
|
4216
|
+
// }
|
|
4217
|
+
// }
|
|
4218
|
+
static final class IconPlaceholderView extends ViewGroup {
|
|
4219
|
+
|
|
4220
|
+
private final HippyImageView iconView;
|
|
4221
|
+
private int iconWidth = 50;
|
|
4222
|
+
private int iconHeight = 50;
|
|
4223
|
+
|
|
4224
|
+
final int viewType;
|
|
4225
|
+
final Paint paint;
|
|
4226
|
+
final RectF rect;
|
|
4227
|
+
final @Nullable HippyArray drawRect;
|
|
4228
|
+
final float border;
|
|
4229
|
+
|
|
4230
|
+
|
|
4231
|
+
public IconPlaceholderView(Context context, String icon,int viewType, int color, float border, @Nullable HippyArray drawRect, @Nullable HippyArray iconSize){
|
|
4232
|
+
super(context);
|
|
4233
|
+
iconView = new HippyImageView(context);
|
|
4234
|
+
iconView.setDelayLoad(100);
|
|
4235
|
+
iconView.setUrl(icon);
|
|
4236
|
+
addView(iconView);
|
|
4237
|
+
if(iconSize != null && iconSize.size() == 2){
|
|
4238
|
+
iconWidth = iconSize.getInt(0);
|
|
4239
|
+
iconHeight = iconSize.getInt(1);
|
|
4240
|
+
}
|
|
4241
|
+
|
|
4242
|
+
this.viewType = viewType;
|
|
4243
|
+
setFocusable(false);
|
|
4244
|
+
paint = new Paint();
|
|
4245
|
+
paint.setColor(color);
|
|
4246
|
+
if (border > 0) {
|
|
4247
|
+
paint.setAntiAlias(true);
|
|
4248
|
+
}
|
|
4249
|
+
this.drawRect = drawRect;
|
|
4250
|
+
rect = new RectF();
|
|
4251
|
+
this.border = Utils.toPX((int) border);
|
|
4252
|
+
|
|
4253
|
+
}
|
|
4254
|
+
|
|
4255
|
+
@Override
|
|
4256
|
+
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
|
|
4257
|
+
super.onSizeChanged(w, h, oldw, oldh);
|
|
4258
|
+
if(drawRect == null){
|
|
4259
|
+
rect.set(0, 0, w, h);
|
|
4260
|
+
}else {
|
|
4261
|
+
rect.set(drawRect.getInt(0),drawRect.getInt(1),
|
|
4262
|
+
drawRect.getInt(2),drawRect.getInt(3));
|
|
4263
|
+
}
|
|
4264
|
+
postInvalidateDelayed(16);
|
|
4265
|
+
}
|
|
4266
|
+
|
|
4267
|
+
@Override
|
|
4268
|
+
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
|
4269
|
+
int cl = (int) (((r - l) - iconWidth) * 0.5);
|
|
4270
|
+
int ct = (int) (((b - t) - iconHeight) * 0.5);
|
|
4271
|
+
iconView.layout(cl, ct, cl + iconWidth, ct + iconHeight);
|
|
4272
|
+
}
|
|
4273
|
+
|
|
4274
|
+
@Override
|
|
4275
|
+
protected void dispatchDraw(Canvas canvas) {
|
|
4276
|
+
if(border > 0){
|
|
4277
|
+
canvas.drawRoundRect(rect,border,border,paint);
|
|
4278
|
+
}else{
|
|
4279
|
+
canvas.drawRect(rect,paint);
|
|
4280
|
+
}
|
|
4281
|
+
super.dispatchDraw(canvas);
|
|
4282
|
+
}
|
|
4283
|
+
|
|
4284
|
+
// @Override
|
|
4285
|
+
// public void draw(Canvas canvas) {
|
|
4286
|
+
//
|
|
4287
|
+
// super.draw(canvas);
|
|
4288
|
+
// }
|
|
4289
|
+
}
|
|
4290
|
+
|
|
4291
|
+
static final class PendingPlaceHolderView extends View{
|
|
4292
|
+
final int viewType;
|
|
4293
|
+
final Paint paint;
|
|
4294
|
+
final RectF rect;
|
|
4295
|
+
@Nullable HippyArray drawRect;
|
|
4296
|
+
final float border;
|
|
4297
|
+
public PendingPlaceHolderView(Context context, int viewType, int color, float border, @Nullable HippyArray drawRect) {
|
|
4298
|
+
super(context);
|
|
4299
|
+
this.viewType = viewType;
|
|
4300
|
+
setFocusable(false);
|
|
4301
|
+
paint = new Paint();
|
|
4302
|
+
paint.setColor(color);
|
|
4303
|
+
if (border > 0) {
|
|
4304
|
+
paint.setAntiAlias(true);
|
|
4305
|
+
}
|
|
4306
|
+
this.drawRect = drawRect;
|
|
4307
|
+
rect = new RectF();
|
|
4308
|
+
this.border = Utils.toPX((int) border);
|
|
4309
|
+
}
|
|
4310
|
+
|
|
4311
|
+
@Override
|
|
4312
|
+
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
|
|
4313
|
+
super.onSizeChanged(w, h, oldw, oldh);
|
|
4314
|
+
if(drawRect == null){
|
|
4315
|
+
rect.set(0, 0, w, h);
|
|
4316
|
+
}else {
|
|
4317
|
+
rect.set(drawRect.getInt(0),drawRect.getInt(1),
|
|
4318
|
+
drawRect.getInt(2),drawRect.getInt(3));
|
|
4319
|
+
}
|
|
4320
|
+
postInvalidate();
|
|
4321
|
+
}
|
|
4322
|
+
|
|
4323
|
+
public void setDrawRect(@Nullable HippyArray drawRect){
|
|
4324
|
+
this.drawRect = drawRect;
|
|
4325
|
+
if(drawRect != null && drawRect.size() == 4){
|
|
4326
|
+
rect.set(drawRect.getInt(0),drawRect.getInt(1),
|
|
4327
|
+
drawRect.getInt(2),drawRect.getInt(3));
|
|
4328
|
+
}
|
|
4329
|
+
postInvalidate();
|
|
4330
|
+
}
|
|
4331
|
+
|
|
4332
|
+
@Nullable
|
|
4333
|
+
public HippyArray getDrawRect() {
|
|
4334
|
+
return drawRect;
|
|
4335
|
+
}
|
|
4336
|
+
|
|
4337
|
+
@Override
|
|
4338
|
+
public void draw(Canvas canvas) {
|
|
4339
|
+
super.draw(canvas);
|
|
4340
|
+
if(border > 0){
|
|
4341
|
+
canvas.drawRoundRect(rect,border,border,paint);
|
|
4342
|
+
}else{
|
|
4343
|
+
canvas.drawRect(rect,paint);
|
|
4344
|
+
}
|
|
4345
|
+
}
|
|
4346
|
+
}
|
|
4347
|
+
|
|
4348
|
+
public interface ItemContainer {
|
|
4349
|
+
View getItemView();
|
|
4350
|
+
View getContentView();
|
|
4351
|
+
void toggle(boolean toPlaceholder);
|
|
4352
|
+
|
|
4353
|
+
//void setContentView(View nodeView);
|
|
4354
|
+
}
|
|
4355
|
+
|
|
4356
|
+
@SuppressLint("ViewConstructor")
|
|
4357
|
+
static final class ItemRootView extends HippyViewGroup implements View.OnClickListener, View.OnFocusChangeListener, ItemContainer, IImageStateListener<HippyImageView>, View.OnLongClickListener {
|
|
4358
|
+
View placeholderView;
|
|
4359
|
+
View contentView;
|
|
4360
|
+
ElementNode coverNode;
|
|
4361
|
+
final int viewType;
|
|
4362
|
+
final boolean isSingleton;
|
|
4363
|
+
Runnable changeDisplayRunnable;
|
|
4364
|
+
final ElementNode itemNode;
|
|
4365
|
+
boolean isPlaceholderState = false;
|
|
4366
|
+
public ItemRootView(Context context,int viewType,View placeholderView,boolean isSingleton,ElementNode itemNode) {
|
|
4367
|
+
super(context);
|
|
4368
|
+
this.viewType = viewType;
|
|
4369
|
+
this.placeholderView = placeholderView;
|
|
4370
|
+
setFocusable(true);
|
|
4371
|
+
setClipChildren(false);
|
|
4372
|
+
addView(placeholderView);
|
|
4373
|
+
setOnClickListener(this);
|
|
4374
|
+
setOnLongClickListener(this);
|
|
4375
|
+
setOnFocusChangeListener(this);
|
|
4376
|
+
// setBackgroundColor(Color.GREEN);
|
|
4377
|
+
this.isSingleton = isSingleton;
|
|
4378
|
+
this.itemNode = itemNode;
|
|
4379
|
+
}
|
|
4380
|
+
|
|
4381
|
+
public void registerCoverView(ElementNode coverNode){
|
|
4382
|
+
this.coverNode = coverNode;
|
|
4383
|
+
if(getCoverView() != null) {
|
|
4384
|
+
getCoverView().setCustomImageRequestListener(this);
|
|
4385
|
+
}
|
|
4386
|
+
}
|
|
4387
|
+
|
|
4388
|
+
public void afterPostBind(){
|
|
4389
|
+
|
|
4390
|
+
}
|
|
4391
|
+
|
|
4392
|
+
public void afterPreBind(){
|
|
4393
|
+
if(itemNode.itemSID != null){
|
|
4394
|
+
// Log.e("configID4Item","configID4Item itemSID "+itemNode.itemSID +",contentView:"+ExtendUtil.debugViewLite(contentView));
|
|
4395
|
+
ExtendUtil.putViewSID(this,itemNode.itemSID);
|
|
4396
|
+
}
|
|
4397
|
+
if (this.isClickable() && this.isFocusable()) {
|
|
4398
|
+
if(FocusManagerModule.findGlobalFocusConfig(getContext()).enableFocusableTouchMode){
|
|
4399
|
+
setFocusableInTouchMode(true);
|
|
4400
|
+
}
|
|
4401
|
+
if (getContentView() != null) {
|
|
4402
|
+
getContentView().setFocusable(false);
|
|
4403
|
+
getContentView().setClickable(false);
|
|
4404
|
+
placeholderView.setEnabled(false);
|
|
4405
|
+
placeholderView.setClickable(false);
|
|
4406
|
+
// getContentView().setEnabled(false);
|
|
4407
|
+
// getContentView().setOnClickListener(null);
|
|
4408
|
+
}
|
|
4409
|
+
}
|
|
4410
|
+
if (itemNode.placeholderStyle != null && placeholderView instanceof PendingPlaceHolderView) {
|
|
4411
|
+
int left = PixelUtil.dp2pxInt(itemNode.placeholderStyle.getInt("left"));
|
|
4412
|
+
int top = PixelUtil.dp2pxInt(itemNode.placeholderStyle.getInt("top"));
|
|
4413
|
+
int right = PixelUtil.dp2pxInt(itemNode.placeholderStyle.getInt("width")) + left;
|
|
4414
|
+
int bottom = PixelUtil.dp2pxInt(itemNode.placeholderStyle.getInt("height")) + top;
|
|
4415
|
+
|
|
4416
|
+
HippyArray drawArray = ((PendingPlaceHolderView) placeholderView).getDrawRect();
|
|
4417
|
+
boolean changed = false;
|
|
4418
|
+
if (drawArray == null) {
|
|
4419
|
+
drawArray = new HippyArray();
|
|
4420
|
+
changed = true;
|
|
4421
|
+
}
|
|
4422
|
+
if(!changed && drawArray.size() == 4) {
|
|
4423
|
+
changed = left != drawArray.getInt(0) || top != drawArray.getInt(1);
|
|
4424
|
+
if(!changed) {
|
|
4425
|
+
changed = right != drawArray.getInt(2) || bottom != drawArray.getInt(3);
|
|
4426
|
+
}
|
|
4427
|
+
}
|
|
4428
|
+
if(changed) {
|
|
4429
|
+
drawArray.clear();
|
|
4430
|
+
drawArray.pushInt(left);
|
|
4431
|
+
drawArray.pushInt(top);
|
|
4432
|
+
drawArray.pushInt(right);
|
|
4433
|
+
drawArray.pushInt(bottom);
|
|
4434
|
+
((PendingPlaceHolderView) placeholderView).setDrawRect(drawArray);
|
|
4435
|
+
}
|
|
4436
|
+
}
|
|
4437
|
+
}
|
|
4438
|
+
|
|
4439
|
+
public HippyImageView getCoverView(){
|
|
4440
|
+
return coverNode != null && coverNode.boundView instanceof HippyImageView ? (HippyImageView) coverNode.boundView : null;
|
|
4441
|
+
}
|
|
4442
|
+
|
|
4443
|
+
@Override
|
|
4444
|
+
public HippyMap getScrollOverride() {
|
|
4445
|
+
if(getContentView() instanceof HippyViewGroup){
|
|
4446
|
+
return ((HippyViewGroup) getContentView()).getScrollOverride();
|
|
4447
|
+
}
|
|
4448
|
+
return super.getScrollOverride();
|
|
4449
|
+
}
|
|
4450
|
+
|
|
4451
|
+
public void setContentView(View contentView, boolean forceDetach) {
|
|
4452
|
+
if(forceDetach && contentView != null){
|
|
4453
|
+
FastAdapterUtil.removeFromParentIfNeed(contentView);
|
|
4454
|
+
}
|
|
4455
|
+
if(contentView == null || contentView.getParent() == this){
|
|
4456
|
+
return;
|
|
4457
|
+
}
|
|
4458
|
+
if (this.contentView != null) {
|
|
4459
|
+
removeView(this.contentView);
|
|
4460
|
+
}
|
|
4461
|
+
this.contentView = contentView;
|
|
4462
|
+
if (isSingleton && contentView instanceof FastItemView) {
|
|
4463
|
+
|
|
4464
|
+
}
|
|
4465
|
+
contentView.setDuplicateParentStateEnabled(true);
|
|
4466
|
+
this.addView(contentView);
|
|
4467
|
+
}
|
|
4468
|
+
|
|
4469
|
+
@Override
|
|
4470
|
+
protected void onDetachedFromWindow() {
|
|
4471
|
+
super.onDetachedFromWindow();
|
|
4472
|
+
if(this.changeDisplayRunnable != null) {
|
|
4473
|
+
this.removeCallbacks(this.changeDisplayRunnable);
|
|
4474
|
+
this.changeDisplayRunnable = null;
|
|
4475
|
+
}
|
|
4476
|
+
}
|
|
4477
|
+
|
|
4478
|
+
@Override
|
|
4479
|
+
public View getItemView() {
|
|
4480
|
+
return this;
|
|
4481
|
+
}
|
|
4482
|
+
|
|
4483
|
+
public View getContentView() {
|
|
4484
|
+
return contentView;
|
|
4485
|
+
}
|
|
4486
|
+
|
|
4487
|
+
@Override
|
|
4488
|
+
public void toggle(boolean toPlaceholder){
|
|
4489
|
+
if(isSingleton){
|
|
4490
|
+
//单例暂不处理
|
|
4491
|
+
return;
|
|
4492
|
+
}
|
|
4493
|
+
this.isPlaceholderState = toPlaceholder;
|
|
4494
|
+
if(toPlaceholder){
|
|
4495
|
+
if (this.contentView != null) {
|
|
4496
|
+
if (placeholderView != null) {
|
|
4497
|
+
placeholderView.setAlpha(1);
|
|
4498
|
+
}
|
|
4499
|
+
this.contentView.setAlpha(0);
|
|
4500
|
+
}
|
|
4501
|
+
}else{
|
|
4502
|
+
if (itemNode.initConfig.enableCoverRole) {
|
|
4503
|
+
if (contentView != null) {
|
|
4504
|
+
contentView.setAlpha(1);
|
|
4505
|
+
}
|
|
4506
|
+
if(getCoverView() != null){
|
|
4507
|
+
// Log.e("ZHAOPENG","ItemRootViewLog toggle on coverView loadState:"
|
|
4508
|
+
// +getCoverView().getFetchState()+",url:"+getCoverView().getUrl());
|
|
4509
|
+
if(getCoverView().getFetchState() == 2){
|
|
4510
|
+
if (placeholderView != null) {
|
|
4511
|
+
placeholderView.setAlpha(0);
|
|
4512
|
+
}
|
|
4513
|
+
}else if(getCoverView().getFetchState() == 1){
|
|
4514
|
+
if (placeholderView != null) {
|
|
4515
|
+
placeholderView.setAlpha(1);
|
|
4516
|
+
}
|
|
4517
|
+
}
|
|
4518
|
+
}else{
|
|
4519
|
+
if (placeholderView != null) {
|
|
4520
|
+
placeholderView.setAlpha(1);
|
|
4521
|
+
}
|
|
4522
|
+
}
|
|
4523
|
+
}else {
|
|
4524
|
+
if (placeholderView != null) {
|
|
4525
|
+
if (this.contentView != null) {
|
|
4526
|
+
this.contentView.setAlpha(1);
|
|
4527
|
+
}
|
|
4528
|
+
placeholderView.setAlpha(0);
|
|
4529
|
+
}
|
|
4530
|
+
}
|
|
4531
|
+
}
|
|
4532
|
+
if(isFocused()) {
|
|
4533
|
+
refreshDrawableState();
|
|
4534
|
+
}
|
|
4535
|
+
// }
|
|
4536
|
+
if(this.changeDisplayRunnable != null) {
|
|
4537
|
+
this.removeCallbacks(this.changeDisplayRunnable);
|
|
4538
|
+
}
|
|
4539
|
+
|
|
4540
|
+
}
|
|
4541
|
+
|
|
4542
|
+
@Override
|
|
4543
|
+
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
|
|
4544
|
+
super.onSizeChanged(w, h, oldw, oldh);
|
|
4545
|
+
|
|
4546
|
+
}
|
|
4547
|
+
|
|
4548
|
+
@Override
|
|
4549
|
+
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
|
4550
|
+
super.onLayout(changed,left,top,right,bottom);
|
|
4551
|
+
if (placeholderView != null) {
|
|
4552
|
+
placeholderView.layout(0, 0, right - left, bottom - top);
|
|
4553
|
+
}
|
|
4554
|
+
if(contentView != null) {
|
|
4555
|
+
contentView.layout(0, 0, right - left, bottom - top);
|
|
4556
|
+
}
|
|
4557
|
+
}
|
|
4558
|
+
|
|
4559
|
+
private OnClickListener mContentClickListener;
|
|
4560
|
+
private OnLongClickListener mContentLongClickListener;
|
|
4561
|
+
private ItemFocusListener mContentFocusListener;
|
|
4562
|
+
public void setContentOnClickListener(OnClickListener listener) {
|
|
4563
|
+
this.mContentClickListener = listener;
|
|
4564
|
+
}
|
|
4565
|
+
|
|
4566
|
+
public void setContentLongClickListener(OnLongClickListener listener) {
|
|
4567
|
+
this.mContentLongClickListener = listener;
|
|
4568
|
+
}
|
|
4569
|
+
|
|
4570
|
+
public void setContentItemFocusListener(ItemFocusListener listener) {
|
|
4571
|
+
this.mContentFocusListener = listener;
|
|
4572
|
+
}
|
|
4573
|
+
|
|
4574
|
+
View getFocusableView(){
|
|
4575
|
+
if (itemNode.focusableNode != null) {
|
|
4576
|
+
return itemNode.focusableNode.boundView;
|
|
4577
|
+
}
|
|
4578
|
+
return null;
|
|
4579
|
+
}
|
|
4580
|
+
|
|
4581
|
+
|
|
4582
|
+
@Override
|
|
4583
|
+
public void onClick(View v) {
|
|
4584
|
+
View focusableView = getFocusableView();
|
|
4585
|
+
if (LogUtils.isDebug()) {
|
|
4586
|
+
Log.i("DebugClick","ItemRootView onClick contentView:"+contentView+",focusableView:"+focusableView);
|
|
4587
|
+
}
|
|
4588
|
+
if (mContentClickListener != null && focusableView != null) {
|
|
4589
|
+
mContentClickListener.onClick(focusableView);
|
|
4590
|
+
}
|
|
4591
|
+
}
|
|
4592
|
+
|
|
4593
|
+
|
|
4594
|
+
@Override
|
|
4595
|
+
public void onFocusChange(View v, boolean hasFocus) {
|
|
4596
|
+
View focusableView = getFocusableView();
|
|
4597
|
+
if (LogUtils.isDebug()) {
|
|
4598
|
+
Log.i("ItemRootViewLog","ItemRootView onFocusChange contentView:"+contentView+",focusableView:"+focusableView);
|
|
4599
|
+
}
|
|
4600
|
+
if (mContentFocusListener != null && focusableView != null) {
|
|
4601
|
+
mContentFocusListener.onFocusChange(focusableView,hasFocus);
|
|
4602
|
+
}
|
|
4603
|
+
}
|
|
4604
|
+
|
|
4605
|
+
@Override
|
|
4606
|
+
public void onRequestStart(HippyImageView drawableTarget) {
|
|
4607
|
+
// if(placeholderView != null) {
|
|
4608
|
+
// placeholderView.setAlpha(1);
|
|
4609
|
+
// }
|
|
4610
|
+
// if (contentView != null) {
|
|
4611
|
+
// contentView.setAlpha(0);
|
|
4612
|
+
}
|
|
4613
|
+
|
|
4614
|
+
@Override
|
|
4615
|
+
public void onImageLayout(HippyImageView drawableTarget, int left, int top, int right, int bottom) {
|
|
4616
|
+
}
|
|
4617
|
+
|
|
4618
|
+
|
|
4619
|
+
@Override
|
|
4620
|
+
public void onRequestSuccess(HippyImageView drawableTarget) {
|
|
4621
|
+
if(isPlaceholderState){
|
|
4622
|
+
return;
|
|
4623
|
+
}
|
|
4624
|
+
if(placeholderView != null) {
|
|
4625
|
+
placeholderView.setAlpha(0);
|
|
4626
|
+
}
|
|
4627
|
+
if (contentView != null) {
|
|
4628
|
+
contentView.setAlpha(1);
|
|
4629
|
+
}
|
|
4630
|
+
}
|
|
4631
|
+
|
|
4632
|
+
@Override
|
|
4633
|
+
public void onRequestFail(Throwable cause, String source) {
|
|
4634
|
+
if(isPlaceholderState){
|
|
4635
|
+
return;
|
|
4636
|
+
}
|
|
4637
|
+
if(placeholderView != null) {
|
|
4638
|
+
placeholderView.setAlpha(0);
|
|
4639
|
+
}
|
|
4640
|
+
if (contentView != null) {
|
|
4641
|
+
contentView.setAlpha(1);
|
|
4642
|
+
}
|
|
4643
|
+
}
|
|
4644
|
+
|
|
4645
|
+
@Override
|
|
4646
|
+
public boolean onLongClick(View v) {
|
|
4647
|
+
if (mContentLongClickListener != null) {
|
|
4648
|
+
return mContentLongClickListener.onLongClick(v);
|
|
4649
|
+
}
|
|
4650
|
+
return false;
|
|
4651
|
+
}
|
|
4652
|
+
}
|
|
4653
|
+
|
|
4654
|
+
public static final class ErrorPlaceHolderView extends View{
|
|
4655
|
+
|
|
4656
|
+
final int viewType;
|
|
4657
|
+
public ErrorPlaceHolderView(Context context,int viewType) {
|
|
4658
|
+
super(context);
|
|
4659
|
+
this.viewType = viewType;
|
|
4660
|
+
setBackgroundColor(Color.TRANSPARENT);
|
|
4661
|
+
setFocusable(false);
|
|
4662
|
+
}
|
|
4663
|
+
}
|
|
4664
|
+
|
|
4665
|
+
public static class Payload{
|
|
4666
|
+
final PayloadType type;
|
|
4667
|
+
final HippyMap params;
|
|
4668
|
+
public Payload(PayloadType type,@Nullable HippyMap params) {
|
|
4669
|
+
this.type = type;
|
|
4670
|
+
this.params = params;
|
|
4671
|
+
}
|
|
4672
|
+
}
|
|
4673
|
+
|
|
4674
|
+
public enum PayloadType {
|
|
4675
|
+
TYPE_UPDATE,
|
|
4676
|
+
TYPE_LAYOUT,
|
|
4677
|
+
TYPE_LAYOUT_ROOT,
|
|
4678
|
+
}
|
|
4679
|
+
|
|
4680
|
+
|
|
4681
|
+
|
|
4682
|
+
|
|
4683
|
+
}
|