yuzhilin

注释音频悬浮窗

@@ -77,7 +77,7 @@ export struct MorningEveningPaperComponent { @@ -77,7 +77,7 @@ export struct MorningEveningPaperComponent {
77 offset: { dx: 12, dy: -150 }, 77 offset: { dx: 12, dy: -150 },
78 78
79 }) 79 })
80 - private AudioSuspension = new AudioSuspensionModel() 80 + // private AudioSuspension = new AudioSuspensionModel()
81 81
82 onCancel() { 82 onCancel() {
83 Logger.info(TAG, "cj2024 onCancel = ") 83 Logger.info(TAG, "cj2024 onCancel = ")
@@ -307,7 +307,7 @@ export struct MorningEveningPaperComponent { @@ -307,7 +307,7 @@ export struct MorningEveningPaperComponent {
307 Logger.info("TAG", "cj compInfoBean onClick1 = " + this.isAudioPlaying) 307 Logger.info("TAG", "cj compInfoBean onClick1 = " + this.isAudioPlaying)
308 // dialog.open() 308 // dialog.open()
309 // this.playerController.firstPlay(this.audioPlayUrl, this.audioTitle) 309 // this.playerController.firstPlay(this.audioPlayUrl, this.audioTitle)
310 - this.AudioSuspension.setPlayerUrl(this.audioPlayUrl, this.audioTitle) 310 + // this.AudioSuspension.setPlayerUrl(this.audioPlayUrl, this.audioTitle)
311 Logger.info(TAG, "this.audioPlayUrl = " + this.audioPlayUrl) 311 Logger.info(TAG, "this.audioPlayUrl = " + this.audioPlayUrl)
312 Logger.info("TAG", "cj compInfoBean onClick2 = " + this.isAudioPlaying) 312 Logger.info("TAG", "cj compInfoBean onClick2 = " + this.isAudioPlaying)
313 }) 313 })
@@ -193,7 +193,7 @@ export struct TopNavigationComponent { @@ -193,7 +193,7 @@ export struct TopNavigationComponent {
193 //意图共享 193 //意图共享
194 topNavInsightIntentShare(item: TopNavDTO){ 194 topNavInsightIntentShare(item: TopNavDTO){
195 let tapNavIntent: insightIntent.InsightIntent = { 195 let tapNavIntent: insightIntent.InsightIntent = {
196 - intentName: 'ViewColumn', 196 + intentName: 'ViewBlog',
197 intentVersion: '1.0.1', 197 intentVersion: '1.0.1',
198 identifier: '52dac3b0-6520-4974-81e5-25f0879449b5', 198 identifier: '52dac3b0-6520-4974-81e5-25f0879449b5',
199 intentActionInfo: { 199 intentActionInfo: {
@@ -205,7 +205,7 @@ export struct TopNavigationComponent { @@ -205,7 +205,7 @@ export struct TopNavigationComponent {
205 } 205 }
206 }, 206 },
207 intentEntityInfo: { 207 intentEntityInfo: {
208 - entityName: 'ViewColumn', 208 + entityName: 'Blog',
209 entityId: String(item.pageId) || '', 209 entityId: String(item.pageId) || '',
210 displayName: item.name, 210 displayName: item.name,
211 logoURL: 'https://www-file.huawei.com/-/media/corporate/images/home/logo/huawei_logo.png', 211 logoURL: 'https://www-file.huawei.com/-/media/corporate/images/home/logo/huawei_logo.png',
@@ -213,7 +213,7 @@ export struct TopNavigationComponent { @@ -213,7 +213,7 @@ export struct TopNavigationComponent {
213 isPublicData: true 213 isPublicData: true
214 } 214 }
215 } 215 }
216 - 216 + console.log('yzl',JSON.stringify(tapNavIntent))
217 try { 217 try {
218 let context = getContext(this) as common.UIAbilityContext; 218 let context = getContext(this) as common.UIAbilityContext;
219 // 共享数据 219 // 共享数据
@@ -77,7 +77,7 @@ export struct OperRowListView { @@ -77,7 +77,7 @@ export struct OperRowListView {
77 @State audioUrl: string = '' 77 @State audioUrl: string = ''
78 @State audioTitle: string = '' 78 @State audioTitle: string = ''
79 @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 79 @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
80 - private AudioSuspension = new AudioSuspensionModel() 80 + // private AudioSuspension = new AudioSuspensionModel()
81 @State currentStatus: number | string | undefined = 0; 81 @State currentStatus: number | string | undefined = 0;
82 82
83 async aboutToAppear() { 83 async aboutToAppear() {
@@ -281,7 +281,7 @@ export struct OperRowListView { @@ -281,7 +281,7 @@ export struct OperRowListView {
281 .aspectRatio(1) 281 .aspectRatio(1)
282 .interpolation(ImageInterpolation.High) 282 .interpolation(ImageInterpolation.High)
283 .onClick((event: ClickEvent) => { 283 .onClick((event: ClickEvent) => {
284 - this.AudioSuspension.setPlayerUrl(this.audioUrl, this.audioTitle) 284 + // this.AudioSuspension.setPlayerUrl(this.audioUrl, this.audioTitle)
285 // ToastUtils.showToast('音频为公共方法,待开发', 1000); 285 // ToastUtils.showToast('音频为公共方法,待开发', 1000);
286 }) 286 })
287 } 287 }
@@ -70,59 +70,59 @@ export default class EntryAbility extends UIAbility { @@ -70,59 +70,59 @@ export default class EntryAbility extends UIAbility {
70 } 70 }
71 hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); 71 hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? '');
72 }); 72 });
73 - // 1.创建悬浮窗  
74 - const config: window.Configuration = {  
75 - name: "floatWindow", windowType: window.WindowType.TYPE_FLOAT, ctx: this.context  
76 - };  
77 - window.createWindow(config, (err: BusinessError, data) => {  
78 - let errCode: number = err.code;  
79 - if (errCode) {  
80 - console.error('floatWindowClass Failed to create the floatWindow. Cause: ' + JSON.stringify(err));  
81 - return;  
82 - }  
83 - console.info('floatWindowClass Succeeded in creating the floatWindow. Data: ' + JSON.stringify(data));  
84 - floatWindowClass = data;  
85 - AppStorage.setOrCreate('floatWindowClass', floatWindowClass);  
86 - // 2.悬浮窗窗口创建成功后,设置悬浮窗的位置、大小及相关属性等。  
87 - floatWindowClass.moveWindowTo(0, 604, (err: BusinessError) => {  
88 - let errCode: number = err.code;  
89 - if (errCode) {  
90 - console.error('floatWindowClass Failed to move the window. Cause:' + JSON.stringify(err));  
91 - return;  
92 - }  
93 - console.info('floatWindowClass Succeeded in moving the window.');  
94 - });  
95 - // 3.为悬浮窗加载对应的目标页面。  
96 - floatWindowClass.setUIContent("pages/view/AudioComponent", (err: BusinessError) => {  
97 - let errCode: number = err.code;  
98 - if (errCode) {  
99 - console.error('floatWindowClass Failed to load the content. Cause:' + JSON.stringify(err));  
100 - return;  
101 - }  
102 - console.info('floatWindowClass Succeeded in loading the content.');  
103 - });  
104 -  
105 - floatWindowClass.on('windowEvent', (data) => {  
106 - EmitterUtils.sendEvent(EmitterEventId.AUDIO_WINDOW_TYPE, data)  
107 - });  
108 -  
109 - }); 73 + // 1.创建悬浮窗
  74 + // const config: window.Configuration = {
  75 + // name: "floatWindow", windowType: window.WindowType.TYPE_FLOAT, ctx: this.context
  76 + // };
  77 + // window.createWindow(config, (err: BusinessError, data) => {
  78 + // let errCode: number = err.code;
  79 + // if (errCode) {
  80 + // console.error('floatWindowClass Failed to create the floatWindow. Cause: ' + JSON.stringify(err));
  81 + // return;
  82 + // }
  83 + // console.info('floatWindowClass Succeeded in creating the floatWindow. Data: ' + JSON.stringify(data));
  84 + // floatWindowClass = data;
  85 + // AppStorage.setOrCreate('floatWindowClass', floatWindowClass);
  86 + // // 2.悬浮窗窗口创建成功后,设置悬浮窗的位置、大小及相关属性等。
  87 + // floatWindowClass.moveWindowTo(0, 604, (err: BusinessError) => {
  88 + // let errCode: number = err.code;
  89 + // if (errCode) {
  90 + // console.error('floatWindowClass Failed to move the window. Cause:' + JSON.stringify(err));
  91 + // return;
  92 + // }
  93 + // console.info('floatWindowClass Succeeded in moving the window.');
  94 + // });
  95 + // // 3.为悬浮窗加载对应的目标页面。
  96 + // floatWindowClass.setUIContent("pages/view/AudioComponent", (err: BusinessError) => {
  97 + // let errCode: number = err.code;
  98 + // if (errCode) {
  99 + // console.error('floatWindowClass Failed to load the content. Cause:' + JSON.stringify(err));
  100 + // return;
  101 + // }
  102 + // console.info('floatWindowClass Succeeded in loading the content.');
  103 + // });
  104 + //
  105 + // floatWindowClass.on('windowEvent', (data) => {
  106 + // EmitterUtils.sendEvent(EmitterEventId.AUDIO_WINDOW_TYPE, data)
  107 + // });
  108 + //
  109 + // });
110 } 110 }
111 111
112 - destroyFloatWindow() {  
113 - (floatWindowClass as window.Window).destroyWindow((err: BusinessError) => {  
114 - let errCode: number = err.code;  
115 - if (errCode) {  
116 - console.error('floatWindowClass Failed to destroy the window. Cause: ' + JSON.stringify(err));  
117 - return;  
118 - }  
119 - console.info('floatWindowClass Succeeded in destroying the window.');  
120 - });  
121 - } 112 + // destroyFloatWindow() {
  113 + // (floatWindowClass as window.Window).destroyWindow((err: BusinessError) => {
  114 + // let errCode: number = err.code;
  115 + // if (errCode) {
  116 + // console.error('floatWindowClass Failed to destroy the window. Cause: ' + JSON.stringify(err));
  117 + // return;
  118 + // }
  119 + // console.info('floatWindowClass Succeeded in destroying the window.');
  120 + // });
  121 + // }
122 122
123 onWindowStageDestroy(): void { 123 onWindowStageDestroy(): void {
124 // Main window is destroyed, release UI related resources 124 // Main window is destroyed, release UI related resources
125 - this.destroyFloatWindow() 125 + // this.destroyFloatWindow()
126 hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); 126 hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
127 } 127 }
128 128
@@ -8,7 +8,7 @@ const TAG = 'AudioSuspensionModel' @@ -8,7 +8,7 @@ const TAG = 'AudioSuspensionModel'
8 @Entry 8 @Entry
9 @Component 9 @Component
10 struct Index { 10 struct Index {
11 - private AudioSuspension = new AudioSuspensionModel() 11 + // private AudioSuspension = new AudioSuspensionModel()
12 @State audioTitle: string | undefined = ''; 12 @State audioTitle: string | undefined = '';
13 @State currentTime: string = '00:00'; 13 @State currentTime: string = '00:00';
14 @State totalTime: string = '00:00'; 14 @State totalTime: string = '00:00';
@@ -21,11 +21,11 @@ struct Index { @@ -21,11 +21,11 @@ struct Index {
21 private foldHeight: number = 200 21 private foldHeight: number = 200
22 22
23 aboutToAppear() { 23 aboutToAppear() {
24 - this.AudioSuspension.playerController.get().onTimeUpdate = (position, duration) => {  
25 - this.currentTime = DateFormatUtil.convertMillisecondsToMinutesSeconds(position);  
26 - this.totalTime = DateFormatUtil.convertMillisecondsToMinutesSeconds(duration);  
27 - this.progressVal = Math.floor(position * 100 / duration);  
28 - } 24 + // this.AudioSuspension.playerController.get().onTimeUpdate = (position, duration) => {
  25 + // this.currentTime = DateFormatUtil.convertMillisecondsToMinutesSeconds(position);
  26 + // this.totalTime = DateFormatUtil.convertMillisecondsToMinutesSeconds(duration);
  27 + // this.progressVal = Math.floor(position * 100 / duration);
  28 + // }
29 29
30 EmitterUtils.receiveEvent(EmitterEventId.AUDIO_CHANGE_TITLe, (val:string | undefined) => { 30 EmitterUtils.receiveEvent(EmitterEventId.AUDIO_CHANGE_TITLe, (val:string | undefined) => {
31 console.log(TAG,'this.audioTitle', val) 31 console.log(TAG,'this.audioTitle', val)
@@ -41,11 +41,11 @@ struct Index { @@ -41,11 +41,11 @@ struct Index {
41 if (val == window.WindowEventType.WINDOW_ACTIVE) { 41 if (val == window.WindowEventType.WINDOW_ACTIVE) {
42 console.info(TAG, 'current window stage event is WINDOW_ACTIVE', val); 42 console.info(TAG, 'current window stage event is WINDOW_ACTIVE', val);
43 this.isExpand = true 43 this.isExpand = true
44 - this.AudioSuspension.resizeWindow(this.expandWidth, this.expandHeight) 44 + // this.AudioSuspension.resizeWindow(this.expandWidth, this.expandHeight)
45 } else if (val == window.WindowEventType.WINDOW_INACTIVE) { 45 } else if (val == window.WindowEventType.WINDOW_INACTIVE) {
46 console.info(TAG, 'current window stage event is WINDOW_INACTIVE', val); 46 console.info(TAG, 'current window stage event is WINDOW_INACTIVE', val);
47 this.isExpand = false 47 this.isExpand = false
48 - this.AudioSuspension.resizeWindow(this.foldWidth, this.foldHeight) 48 + // this.AudioSuspension.resizeWindow(this.foldWidth, this.foldHeight)
49 } 49 }
50 }) 50 })
51 51
@@ -53,7 +53,7 @@ struct Index { @@ -53,7 +53,7 @@ struct Index {
53 53
54 onPageHide() { 54 onPageHide() {
55 // this.status = PlayerConstants.STATUS_PAUSE; 55 // this.status = PlayerConstants.STATUS_PAUSE;
56 - this.AudioSuspension.playerController.get()?.pause(); 56 + // this.AudioSuspension.playerController.get()?.pause();
57 } 57 }
58 58
59 build() { 59 build() {
@@ -118,9 +118,9 @@ struct Index { @@ -118,9 +118,9 @@ struct Index {
118 .height(24) 118 .height(24)
119 .margin({ right: 12 }) 119 .margin({ right: 12 })
120 .onClick(() => { 120 .onClick(() => {
121 - if (this.AudioSuspension.playerController) {  
122 - this.AudioSuspension.playerController.get().switchPlayOrPause()  
123 - } 121 + // if (this.AudioSuspension.playerController) {
  122 + // this.AudioSuspension.playerController.get().switchPlayOrPause()
  123 + // }
124 }) 124 })
125 125
126 Image($r("app.media.icon_audio_close")) 126 Image($r("app.media.icon_audio_close"))
@@ -128,10 +128,10 @@ struct Index { @@ -128,10 +128,10 @@ struct Index {
128 .width(24) 128 .width(24)
129 .height(24) 129 .height(24)
130 .onClick(() => { 130 .onClick(() => {
131 - if (this.AudioSuspension.playerController) {  
132 - this.AudioSuspension.playerController.get().stop()  
133 - this.AudioSuspension.destroyWindow()  
134 - } 131 + // if (this.AudioSuspension.playerController) {
  132 + // this.AudioSuspension.playerController.get().stop()
  133 + // this.AudioSuspension.destroyWindow()
  134 + // }
135 }) 135 })
136 }.width(80) 136 }.width(80)
137 .height(60) 137 .height(60)
@@ -142,9 +142,9 @@ struct Index { @@ -142,9 +142,9 @@ struct Index {
142 .width(24) 142 .width(24)
143 .height(24) 143 .height(24)
144 .onClick(() => { 144 .onClick(() => {
145 - if (this.AudioSuspension.playerController) {  
146 - this.AudioSuspension.playerController.get().switchPlayOrPause()  
147 - } 145 + // if (this.AudioSuspension.playerController) {
  146 + // this.AudioSuspension.playerController.get().switchPlayOrPause()
  147 + // }
148 }) 148 })
149 } 149 }
150 .justifyContent(FlexAlign.Center) 150 .justifyContent(FlexAlign.Center)
@@ -92,16 +92,16 @@ @@ -92,16 +92,16 @@
92 { 92 {
93 "name": "ohos.permission.INTERNET" 93 "name": "ohos.permission.INTERNET"
94 }, 94 },
95 - {  
96 - "name": "ohos.permission.SYSTEM_FLOAT_WINDOW",  
97 - "reason": "$string:EntryAbility_desc",  
98 - "usedScene": {  
99 - "abilities": [  
100 - "FormAbility"  
101 - ],  
102 - "when": "inuse"  
103 - }  
104 - } 95 +// {
  96 +// "name": "ohos.permission.SYSTEM_FLOAT_WINDOW",
  97 +// "reason": "$string:EntryAbility_desc",
  98 +// "usedScene": {
  99 +// "abilities": [
  100 +// "FormAbility"
  101 +// ],
  102 +// "when": "inuse"
  103 +// }
  104 +// }
105 ] 105 ]
106 } 106 }
107 } 107 }