Parcourir la source

deviceInfo.sdkApiVersion判断6.0的api能不能用

onecold il y a 9 mois
Parent
commit
df77135ff3

+ 1 - 1
entry/src/main/ets/pages/SettingPage.ets

@@ -228,7 +228,7 @@ export struct SettingPage {
 
   // 组件生命周期
   aboutToAppear() {
-    this.geIDD()
+    // this.geIDD()
     this.isBgPlayOpen = PreferencesUtil.getBooleanSync(SettingPage.IS_BGPLAY_OPEN, true)
     this.isAutoRatate = PreferencesUtil.getBooleanSync(SettingPage.IS_AUTO_RATATE, true)
     this.isMemoryPlay = PreferencesUtil.getBooleanSync(SettingPage.iS_MEMORY_PLAY, true)

+ 3 - 1
entry/src/main/ets/pages/SplashIndex.ets

@@ -70,6 +70,7 @@ let adHeight: number = Math.round(screenHeight)
 @Entry
 @Component
 struct  SplashIndex{
+  @State iconCurrentUrl: string = 'default';//图标的url
   context:common.UIAbilityContext = getContext(this) as  common.UIAbilityContext;
   @Provide isToPri:boolean = false
   //穿山甲属性
@@ -259,6 +260,7 @@ struct  SplashIndex{
 
   //判断是否弹出隐私政策对话框
   aboutToAppear(): void {
+    this.iconCurrentUrl = PreferencesUtil.getStringSync('iconCurrentUrl', 'default')
     Utility.getAppName(getContext(this)).then((appName:string)=>{
       this.appName = appName
     })
@@ -394,7 +396,7 @@ struct  SplashIndex{
 
 
         Column(){
-          Image($r('app.media.icon'))
+          Image(this.iconCurrentUrl=='default'?$r('app.media.icon'):this.iconCurrentUrl)
             .width(66)
             .height(66)
             .clip(true)

+ 5 - 3
entry/src/main/ets/view/LocalMusic.ets

@@ -233,7 +233,8 @@ const ITEM_HEIGHT_BIG: number = 78; // 列表项大高度
 @Preview
 @Component
 export struct LocalMusic {
-  @State sceneBgController: HdsSceneController|undefined = canIUse("SystemCapability.UIDesign.HDSComponent.Core")?
+  @State sceneBgController: HdsSceneController|undefined = deviceInfo.sdkApiVersion>=20
+    &&canIUse("SystemCapability.UIDesign.HDSComponent.Core")?
     new HdsSceneController()
     .setSceneParams({
       backgroundMaskColors: [Color.Green, Color.Red],
@@ -248,7 +249,7 @@ export struct LocalMusic {
         color: Color.Green
       }
     }) : undefined;
-  // @State controller: hdsEffect.ShaderEffectController = new hdsEffect.ShaderEffectController();
+
   @State showAddSheet:boolean = false
   searchController: SearchController = new SearchController()
   @State rightTopImage:Resource = $r('sys.symbol.sort')
@@ -653,6 +654,7 @@ export struct LocalMusic {
   }
   // 组件生命周期
   aboutToAppear() {
+    console.info('onecold aboutToAppear sdkApiVersion = '+deviceInfo.sdkApiVersion)
     if(ArrayUtil.isNotEmpty(this.videoLocalList)&&this.modeType==0){
       this.updateListData(this.videoLocalList)
     }
@@ -8248,7 +8250,7 @@ export struct LocalMusic {
   IjkMusicPlayerView() {
 
     Stack() {
-        if(canIUse("SystemCapability.UIDesign.HDSComponent.Core")&&this.sceneBgController){
+        if(canIUse("SystemCapability.UIDesign.HDSComponent.Core")&&deviceInfo.sdkApiVersion>=20&&this.sceneBgController){
           HdsVisualComponent()
             .scene(HdsSceneType.DUAL_EDGE_FLOW_LIGHT_WITH_BACKGROUND_MASK, this.sceneBgController, () => {
               console.info('Succeeded in finishing');