Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
zhenghy
2024-05-14 20:51:58 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
8225a7900d00eca92b0c778500f6266dc5b560b5
8225a790
2 parents
0cead670
55043bc6
Merge remote-tracking branch 'origin/main'
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
83 additions
and
83 deletions
sight_harmony/features/wdComponent/src/main/ets/components/MorningEveningPaper/MorningEveningPaperComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/TopNavigationComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/view/OperRowListView.ets
sight_harmony/products/phone/src/main/ets/entryability/EntryAbility.ets
sight_harmony/products/phone/src/main/ets/pages/view/AudioComponent.ets
sight_harmony/products/phone/src/main/module.json5
sight_harmony/features/wdComponent/src/main/ets/components/MorningEveningPaper/MorningEveningPaperComponent.ets
View file @
8225a79
...
...
@@ -77,7 +77,7 @@ export struct MorningEveningPaperComponent {
offset: { dx: 12, dy: -150 },
})
private AudioSuspension = new AudioSuspensionModel()
//
private AudioSuspension = new AudioSuspensionModel()
onCancel() {
Logger.info(TAG, "cj2024 onCancel = ")
...
...
@@ -307,7 +307,7 @@ export struct MorningEveningPaperComponent {
Logger.info("TAG", "cj compInfoBean onClick1 = " + this.isAudioPlaying)
// dialog.open()
// this.playerController.firstPlay(this.audioPlayUrl, this.audioTitle)
this.AudioSuspension.setPlayerUrl(this.audioPlayUrl, this.audioTitle)
//
this.AudioSuspension.setPlayerUrl(this.audioPlayUrl, this.audioTitle)
Logger.info(TAG, "this.audioPlayUrl = " + this.audioPlayUrl)
Logger.info("TAG", "cj compInfoBean onClick2 = " + this.isAudioPlaying)
})
...
...
sight_harmony/features/wdComponent/src/main/ets/components/page/TopNavigationComponent.ets
View file @
8225a79
...
...
@@ -193,7 +193,7 @@ export struct TopNavigationComponent {
//意图共享
topNavInsightIntentShare(item: TopNavDTO){
let tapNavIntent: insightIntent.InsightIntent = {
intentName: 'View
Column
',
intentName: 'View
Blog
',
intentVersion: '1.0.1',
identifier: '52dac3b0-6520-4974-81e5-25f0879449b5',
intentActionInfo: {
...
...
@@ -205,7 +205,7 @@ export struct TopNavigationComponent {
}
},
intentEntityInfo: {
entityName: '
ViewColumn
',
entityName: '
Blog
',
entityId: String(item.pageId) || '',
displayName: item.name,
logoURL: 'https://www-file.huawei.com/-/media/corporate/images/home/logo/huawei_logo.png',
...
...
@@ -213,7 +213,7 @@ export struct TopNavigationComponent {
isPublicData: true
}
}
console.log('yzl',JSON.stringify(tapNavIntent))
try {
let context = getContext(this) as common.UIAbilityContext;
// 共享数据
...
...
sight_harmony/features/wdComponent/src/main/ets/components/view/OperRowListView.ets
View file @
8225a79
...
...
@@ -76,7 +76,7 @@ export struct OperRowListView {
@State audioUrl: string = ''
@State audioTitle: string = ''
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
private AudioSuspension = new AudioSuspensionModel()
//
private AudioSuspension = new AudioSuspensionModel()
@State currentStatus: number | string | undefined = 0;
async aboutToAppear() {
...
...
@@ -279,7 +279,7 @@ export struct OperRowListView {
.aspectRatio(1)
.interpolation(ImageInterpolation.High)
.onClick((event: ClickEvent) => {
this.AudioSuspension.setPlayerUrl(this.audioUrl, this.audioTitle)
//
this.AudioSuspension.setPlayerUrl(this.audioUrl, this.audioTitle)
// ToastUtils.showToast('音频为公共方法,待开发', 1000);
})
}
...
...
sight_harmony/products/phone/src/main/ets/entryability/EntryAbility.ets
View file @
8225a79
...
...
@@ -71,58 +71,58 @@ export default class EntryAbility extends UIAbility {
hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? '');
});
// 1.创建悬浮窗
const config: window.Configuration = {
name: "floatWindow", windowType: window.WindowType.TYPE_FLOAT, ctx: this.context
};
window.createWindow(config, (err: BusinessError, data) => {
let errCode: number = err.code;
if (errCode) {
console.error('floatWindowClass Failed to create the floatWindow. Cause: ' + JSON.stringify(err));
return;
}
console.info('floatWindowClass Succeeded in creating the floatWindow. Data: ' + JSON.stringify(data));
floatWindowClass = data;
AppStorage.setOrCreate('floatWindowClass', floatWindowClass);
// 2.悬浮窗窗口创建成功后,设置悬浮窗的位置、大小及相关属性等。
floatWindowClass.moveWindowTo(0, 604, (err: BusinessError) => {
let errCode: number = err.code;
if (errCode) {
console.error('floatWindowClass Failed to move the window. Cause:' + JSON.stringify(err));
return;
}
console.info('floatWindowClass Succeeded in moving the window.');
});
// 3.为悬浮窗加载对应的目标页面。
floatWindowClass.setUIContent("pages/view/AudioComponent", (err: BusinessError) => {
let errCode: number = err.code;
if (errCode) {
console.error('floatWindowClass Failed to load the content. Cause:' + JSON.stringify(err));
return;
}
console.info('floatWindowClass Succeeded in loading the content.');
});
floatWindowClass.on('windowEvent', (data) => {
EmitterUtils.sendEvent(EmitterEventId.AUDIO_WINDOW_TYPE, data)
});
});
// const config: window.Configuration = {
// name: "floatWindow", windowType: window.WindowType.TYPE_FLOAT, ctx: this.context
// };
// window.createWindow(config, (err: BusinessError, data) => {
// let errCode: number = err.code;
// if (errCode) {
// console.error('floatWindowClass Failed to create the floatWindow. Cause: ' + JSON.stringify(err));
// return;
// }
// console.info('floatWindowClass Succeeded in creating the floatWindow. Data: ' + JSON.stringify(data));
// floatWindowClass = data;
// AppStorage.setOrCreate('floatWindowClass', floatWindowClass);
// // 2.悬浮窗窗口创建成功后,设置悬浮窗的位置、大小及相关属性等。
// floatWindowClass.moveWindowTo(0, 604, (err: BusinessError) => {
// let errCode: number = err.code;
// if (errCode) {
// console.error('floatWindowClass Failed to move the window. Cause:' + JSON.stringify(err));
// return;
// }
// console.info('floatWindowClass Succeeded in moving the window.');
// });
// // 3.为悬浮窗加载对应的目标页面。
// floatWindowClass.setUIContent("pages/view/AudioComponent", (err: BusinessError) => {
// let errCode: number = err.code;
// if (errCode) {
// console.error('floatWindowClass Failed to load the content. Cause:' + JSON.stringify(err));
// return;
// }
// console.info('floatWindowClass Succeeded in loading the content.');
// });
//
// floatWindowClass.on('windowEvent', (data) => {
// EmitterUtils.sendEvent(EmitterEventId.AUDIO_WINDOW_TYPE, data)
// });
//
// });
}
destroyFloatWindow() {
(floatWindowClass as window.Window).destroyWindow((err: BusinessError) => {
let errCode: number = err.code;
if (errCode) {
console.error('floatWindowClass Failed to destroy the window. Cause: ' + JSON.stringify(err));
return;
}
console.info('floatWindowClass Succeeded in destroying the window.');
});
}
// destroyFloatWindow() {
// (floatWindowClass as window.Window).destroyWindow((err: BusinessError) => {
// let errCode: number = err.code;
// if (errCode) {
// console.error('floatWindowClass Failed to destroy the window. Cause: ' + JSON.stringify(err));
// return;
// }
// console.info('floatWindowClass Succeeded in destroying the window.');
// });
// }
onWindowStageDestroy(): void {
// Main window is destroyed, release UI related resources
this.destroyFloatWindow()
//
this.destroyFloatWindow()
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
}
...
...
sight_harmony/products/phone/src/main/ets/pages/view/AudioComponent.ets
View file @
8225a79
...
...
@@ -8,7 +8,7 @@ const TAG = 'AudioSuspensionModel'
@Entry
@Component
struct Index {
private AudioSuspension = new AudioSuspensionModel()
//
private AudioSuspension = new AudioSuspensionModel()
@State audioTitle: string | undefined = '';
@State currentTime: string = '00:00';
@State totalTime: string = '00:00';
...
...
@@ -21,11 +21,11 @@ struct Index {
private foldHeight: number = 200
aboutToAppear() {
this.AudioSuspension.playerController.get().onTimeUpdate = (position, duration) => {
this.currentTime = DateFormatUtil.convertMillisecondsToMinutesSeconds(position);
this.totalTime = DateFormatUtil.convertMillisecondsToMinutesSeconds(duration);
this.progressVal = Math.floor(position * 100 / duration);
}
// this.AudioSuspension.playerController.get().onTimeUpdate = (position, duration) => {
// this.currentTime = DateFormatUtil.convertMillisecondsToMinutesSeconds(position);
// this.totalTime = DateFormatUtil.convertMillisecondsToMinutesSeconds(duration);
// this.progressVal = Math.floor(position * 100 / duration);
// }
EmitterUtils.receiveEvent(EmitterEventId.AUDIO_CHANGE_TITLe, (val:string | undefined) => {
console.log(TAG,'this.audioTitle', val)
...
...
@@ -41,11 +41,11 @@ struct Index {
if (val == window.WindowEventType.WINDOW_ACTIVE) {
console.info(TAG, 'current window stage event is WINDOW_ACTIVE', val);
this.isExpand = true
this.AudioSuspension.resizeWindow(this.expandWidth, this.expandHeight)
//
this.AudioSuspension.resizeWindow(this.expandWidth, this.expandHeight)
} else if (val == window.WindowEventType.WINDOW_INACTIVE) {
console.info(TAG, 'current window stage event is WINDOW_INACTIVE', val);
this.isExpand = false
this.AudioSuspension.resizeWindow(this.foldWidth, this.foldHeight)
//
this.AudioSuspension.resizeWindow(this.foldWidth, this.foldHeight)
}
})
...
...
@@ -53,7 +53,7 @@ struct Index {
onPageHide() {
// this.status = PlayerConstants.STATUS_PAUSE;
this.AudioSuspension.playerController.get()?.pause();
//
this.AudioSuspension.playerController.get()?.pause();
}
build() {
...
...
@@ -118,9 +118,9 @@ struct Index {
.height(24)
.margin({ right: 12 })
.onClick(() => {
if (this.AudioSuspension.playerController) {
this.AudioSuspension.playerController.get().switchPlayOrPause()
}
// if (this.AudioSuspension.playerController) {
// this.AudioSuspension.playerController.get().switchPlayOrPause()
// }
})
Image($r("app.media.icon_audio_close"))
...
...
@@ -128,10 +128,10 @@ struct Index {
.width(24)
.height(24)
.onClick(() => {
if (this.AudioSuspension.playerController) {
this.AudioSuspension.playerController.get().stop()
this.AudioSuspension.destroyWindow()
}
// if (this.AudioSuspension.playerController) {
// this.AudioSuspension.playerController.get().stop()
// this.AudioSuspension.destroyWindow()
// }
})
}.width(80)
.height(60)
...
...
@@ -142,9 +142,9 @@ struct Index {
.width(24)
.height(24)
.onClick(() => {
if (this.AudioSuspension.playerController) {
this.AudioSuspension.playerController.get().switchPlayOrPause()
}
// if (this.AudioSuspension.playerController) {
// this.AudioSuspension.playerController.get().switchPlayOrPause()
// }
})
}
.justifyContent(FlexAlign.Center)
...
...
sight_harmony/products/phone/src/main/module.json5
View file @
8225a79
...
...
@@ -92,16 +92,16 @@
{
"name"
:
"ohos.permission.INTERNET"
},
{
"name"
:
"ohos.permission.SYSTEM_FLOAT_WINDOW"
,
"reason"
:
"$string:EntryAbility_desc"
,
"usedScene"
:
{
"abilities"
:
[
"FormAbility"
],
"when"
:
"inuse"
}
}
//
{
//
"name"
:
"ohos.permission.SYSTEM_FLOAT_WINDOW"
,
//
"reason"
:
"$string:EntryAbility_desc"
,
//
"usedScene"
:
{
//
"abilities"
:
[
//
"FormAbility"
//
],
//
"when"
:
"inuse"
//
}
//
}
]
}
}
\ No newline at end of file
...
...
Please
register
or
login
to post a comment