mirror of
https://github.com/openharmony/applications_theme.git
synced 2026-07-01 10:05:33 -04:00
support build by product type
support no icons in desktop Signed-off-by: yangpeng85 <yangpeng85@huawei.com>
This commit is contained in:
+11
-11
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"app": {
|
||||
"bundleName": "com.example.ohosproject.hmservice",
|
||||
"vendor": "example",
|
||||
"versionCode": 1000000,
|
||||
"versionName": "1.0.0",
|
||||
"icon": "$media:app_icon",
|
||||
"label": "$string:app_name",
|
||||
"distributedNotificationEnabled": true
|
||||
}
|
||||
}
|
||||
{
|
||||
"app": {
|
||||
"bundleName": "com.ohos.wallpaper",
|
||||
"vendor": "example",
|
||||
"versionCode": 1000000,
|
||||
"versionName": "1.0.0",
|
||||
"icon": "$media:app_icon",
|
||||
"label": "$string:app_name",
|
||||
"distributedNotificationEnabled": true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"string": [
|
||||
{
|
||||
"name": "app_name",
|
||||
"value": "Theme"
|
||||
}
|
||||
]
|
||||
}
|
||||
{
|
||||
"string": [
|
||||
{
|
||||
"name": "app_name",
|
||||
"value": "Theme"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
+37
-26
@@ -1,27 +1,38 @@
|
||||
{
|
||||
"app": {
|
||||
"signingConfigs": [],
|
||||
"compileSdkVersion": 9,
|
||||
"compatibleSdkVersion": 9,
|
||||
"products": [
|
||||
{
|
||||
"name": "default",
|
||||
"signingConfig": "default"
|
||||
},
|
||||
],
|
||||
},
|
||||
"modules": [
|
||||
{
|
||||
"name": "entry",
|
||||
"srcPath": "./entry",
|
||||
"targets": [
|
||||
{
|
||||
"name": "default",
|
||||
"applyToProducts": [
|
||||
"default",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
{
|
||||
"app": {
|
||||
"compileSdkVersion": 9,
|
||||
"compatibleSdkVersion": 9,
|
||||
"products": [
|
||||
{
|
||||
"name": "default",
|
||||
"signingConfig": "default"
|
||||
},
|
||||
],
|
||||
},
|
||||
"modules": [
|
||||
{
|
||||
"name": "phone-wallpaper",
|
||||
"srcPath": "./product/phone",
|
||||
"targets": [
|
||||
{
|
||||
"name": "default",
|
||||
"applyToProducts": [
|
||||
"default"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "pad-wallpaper",
|
||||
"srcPath": "./product/pad",
|
||||
"targets": [
|
||||
{
|
||||
"name": "default",
|
||||
"applyToProducts": [
|
||||
"default"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
}
|
||||
Generated
-5
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"name": "entry",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 1
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"license":"ISC",
|
||||
"devDependencies":{},
|
||||
"name":"entry",
|
||||
"ohos":{
|
||||
"org":"huawei",
|
||||
"directoryLevel":"module",
|
||||
"buildTool":"hvigor"
|
||||
},
|
||||
"description":"example description",
|
||||
"repository":{},
|
||||
"version":"1.0.0",
|
||||
"dependencies":{}
|
||||
}
|
||||
+18
-18
@@ -1,18 +1,18 @@
|
||||
{
|
||||
"license":"ISC",
|
||||
"devDependencies":{},
|
||||
"name":"applications_theme",
|
||||
"ohos":{
|
||||
"org":"huawei",
|
||||
"directoryLevel":"project",
|
||||
"buildTool":"hvigor"
|
||||
},
|
||||
"description":"example description",
|
||||
"repository":{},
|
||||
"version":"1.0.0",
|
||||
"dependencies":{
|
||||
"@ohos/hvigor-ohos-plugin":"1.0.6",
|
||||
"hypium":"^1.0.0",
|
||||
"@ohos/hvigor":"1.0.6"
|
||||
}
|
||||
}
|
||||
{
|
||||
"license": "ISC",
|
||||
"devDependencies": {},
|
||||
"name": "applications_theme",
|
||||
"ohos": {
|
||||
"org": "huawei",
|
||||
"directoryLevel": "project",
|
||||
"buildTool": "hvigor"
|
||||
},
|
||||
"description": "example description",
|
||||
"repository": {},
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"@ohos/hvigor-ohos-plugin": "1.0.6",
|
||||
"hypium": "^1.0.0",
|
||||
"@ohos/hvigor": "1.0.6"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
/node_modules
|
||||
/.preview
|
||||
/node_modules
|
||||
/.preview
|
||||
/build
|
||||
@@ -1,10 +1,11 @@
|
||||
{
|
||||
"apiType": 'stageMode',
|
||||
"buildOption": {
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"name": "default",
|
||||
}
|
||||
]
|
||||
{
|
||||
"apiType": 'stageMode',
|
||||
"buildOption": {
|
||||
"arkEnable": true
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"name": "default",
|
||||
}
|
||||
]
|
||||
}
|
||||
Generated
+5
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"name": "pad-wallpaper",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 1
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "wallpaper",
|
||||
"version": "1.0.0",
|
||||
"ohos": {
|
||||
"org": "huawei",
|
||||
"buildTool": "hvigor",
|
||||
"directoryLevel": "module"
|
||||
},
|
||||
"description": "wallpaper for phone",
|
||||
"repository": {},
|
||||
"license": "ISC",
|
||||
"dependencies": {}
|
||||
}
|
||||
+47
-48
@@ -1,48 +1,47 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import Ability from '@ohos.application.Ability'
|
||||
|
||||
export default class MainAbility extends Ability {
|
||||
onCreate(want, launchParam) {
|
||||
console.log("ExtWallpaper: MainAbility onCreate")
|
||||
globalThis.abilityWant = want;
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
console.log("ExtWallpaper: MainAbility onDestroy")
|
||||
}
|
||||
|
||||
onWindowStageCreate(windowStage) {
|
||||
// Main window is created, set main page for this ability
|
||||
console.log("ExtWallpaper: MainAbility onWindowStageCreate")
|
||||
windowStage.setUIContent(this.context, "pages/index", null)
|
||||
}
|
||||
|
||||
onWindowStageDestroy() {
|
||||
// Main window is destroyed, release UI related resources
|
||||
console.log("ExtWallpaper: MainAbility onWindowStageDestroy")
|
||||
}
|
||||
|
||||
onForeground() {
|
||||
// Ability has brought to foreground
|
||||
console.log("ExtWallpaper: MainAbility onForeground")
|
||||
}
|
||||
|
||||
onBackground() {
|
||||
// Ability has back to background
|
||||
console.log("ExtWallpaper: MainAbility onBackground")
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import Ability from '@ohos.application.Ability'
|
||||
|
||||
export default class MainAbility extends Ability {
|
||||
onCreate(want, launchParam) {
|
||||
console.log("ExtWallpaper: MainAbility onCreate")
|
||||
globalThis.abilityWant = want;
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
console.log("ExtWallpaper: MainAbility onDestroy")
|
||||
}
|
||||
|
||||
onWindowStageCreate(windowStage) {
|
||||
// Main window is created, set main page for this ability
|
||||
console.log("ExtWallpaper: MainAbility onWindowStageCreate")
|
||||
}
|
||||
|
||||
onWindowStageDestroy() {
|
||||
// Main window is destroyed, release UI related resources
|
||||
console.log("ExtWallpaper: MainAbility onWindowStageDestroy")
|
||||
}
|
||||
|
||||
onForeground() {
|
||||
// Ability has brought to foreground
|
||||
console.log("ExtWallpaper: MainAbility onForeground")
|
||||
}
|
||||
|
||||
onBackground() {
|
||||
// Ability has back to background
|
||||
console.log("ExtWallpaper: MainAbility onBackground")
|
||||
}
|
||||
};
|
||||
+76
-62
@@ -1,62 +1,76 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import Extension from '@ohos.application.WallpaperExtension'
|
||||
import wallPaper from '@ohos.app.wallpaperability'
|
||||
|
||||
const MODULE_TAG = 'ExtWallpaper : ';
|
||||
|
||||
export default class WallpaperExtAbility extends Extension {
|
||||
onCreated(want) {
|
||||
console.info(MODULE_TAG + 'ability on created start');
|
||||
super.setUiContent("pages/index");
|
||||
this.initWallpaperImage();
|
||||
console.info(MODULE_TAG + 'ability on created end');
|
||||
}
|
||||
|
||||
onWallpaperChanged(wallpaperType) {
|
||||
console.info(MODULE_TAG + 'ability on wallpaper changed start, type is : ' + wallpaperType);
|
||||
if (wallPaper) {
|
||||
this.sendPixelMapData();
|
||||
}
|
||||
console.info(MODULE_TAG + 'ability on wallpaper changed end');
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
console.info(MODULE_TAG + 'ability on destroy');
|
||||
}
|
||||
|
||||
initWallpaperImage() {
|
||||
console.info(MODULE_TAG + 'ability init wallpaper image start');
|
||||
if (!wallPaper) {
|
||||
console.info(MODULE_TAG + 'ability init wallpaper image failed as wallpaper is null');
|
||||
return;
|
||||
}
|
||||
this.sendPixelMapData();
|
||||
console.info(MODULE_TAG + 'ability init wallpaper image end');
|
||||
}
|
||||
|
||||
sendPixelMapData() {
|
||||
console.info(MODULE_TAG + 'ability send pixel map data start');
|
||||
wallPaper.getPixelMap(0, (err, data) => {
|
||||
console.info(MODULE_TAG + 'ability get pixel map, err: ' + JSON.stringify(err) +
|
||||
" data: " + JSON.stringify(data));
|
||||
AppStorage.SetOrCreate('slPixelData', data);
|
||||
console.info(MODULE_TAG + 'ability set or create end');
|
||||
});
|
||||
console.info(MODULE_TAG + 'ability send pixel map data end');
|
||||
}
|
||||
};
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import windowManager from '@ohos.window'
|
||||
import Extension from '@ohos.WallpaperExtension'
|
||||
import wallPaper from '@ohos.wallpaper'
|
||||
|
||||
const MODULE_TAG = 'ExtWallpaper : ';
|
||||
|
||||
export default class WallpaperExtAbility extends Extension {
|
||||
onCreated(want) {
|
||||
console.info(MODULE_TAG + 'ability on created start');
|
||||
windowManager.create(this.context, "wallpaper", 2000).then((win) => {
|
||||
win.loadContent("pages/index").then(() => {
|
||||
console.info(MODULE_TAG, "wallpaper window loadContent in then!")
|
||||
win.show().then(() => {
|
||||
win.setFullScreen(true).then(() => {
|
||||
console.info(MODULE_TAG, "set full");
|
||||
});
|
||||
console.info(MODULE_TAG, "then begin window show in then!");
|
||||
})
|
||||
})
|
||||
}, (error) => {
|
||||
Log.showError(TAG, name + " window createFailed, error.code = " + error.code)
|
||||
})
|
||||
// super.setUiContent("pages/index");
|
||||
this.initWallpaperImage();
|
||||
console.info(MODULE_TAG + 'ability on created end');
|
||||
}
|
||||
|
||||
onWallpaperChanged(wallpaperType) {
|
||||
console.info(MODULE_TAG + 'ability on wallpaper changed start, type is : ' + wallpaperType);
|
||||
if (wallPaper) {
|
||||
this.sendPixelMapData();
|
||||
}
|
||||
console.info(MODULE_TAG + 'ability on wallpaper changed end');
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
console.info(MODULE_TAG + 'ability on destroy');
|
||||
}
|
||||
|
||||
initWallpaperImage() {
|
||||
console.info(MODULE_TAG + 'ability init wallpaper image start');
|
||||
if (!wallPaper) {
|
||||
console.info(MODULE_TAG + 'ability init wallpaper image failed as wallpaper is null');
|
||||
return;
|
||||
}
|
||||
this.sendPixelMapData();
|
||||
console.info(MODULE_TAG + 'ability init wallpaper image end');
|
||||
}
|
||||
|
||||
sendPixelMapData() {
|
||||
console.info(MODULE_TAG + 'ability send pixel map data start');
|
||||
wallPaper.getPixelMap(0, (err, data) => {
|
||||
console.info(MODULE_TAG + 'ability get pixel map, err: ' + JSON.stringify(err) +
|
||||
" data: " + JSON.stringify(data));
|
||||
AppStorage.SetOrCreate('slPixelData', data);
|
||||
console.info(MODULE_TAG + 'ability set or create end');
|
||||
});
|
||||
console.info(MODULE_TAG + 'ability send pixel map data end');
|
||||
}
|
||||
};
|
||||
@@ -1,39 +1,41 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
const MODULE_TAG = 'ExtWallpaper : ';
|
||||
let changeCount = 0;
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct Index {
|
||||
@StorageLink('slPixelData') pixelData: any = [];
|
||||
|
||||
build() {
|
||||
Flex({direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center}) {
|
||||
Image(this.pixelData);
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%');
|
||||
}
|
||||
|
||||
aboutToAppear() {
|
||||
console.info(MODULE_TAG + 'index page about to appear');
|
||||
}
|
||||
|
||||
onPageShow() {
|
||||
console.info(MODULE_TAG + 'index page show');
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
const MODULE_TAG = 'ExtWallpaper : ';
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct Index {
|
||||
@StorageLink('slPixelData') pixelData: any = [];
|
||||
|
||||
build() {
|
||||
Flex({direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center}) {
|
||||
Text("Hello Wallpaper")
|
||||
.fontSize("40vp")
|
||||
.fontColor(Color.Green)
|
||||
Image(this.pixelData);
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%');
|
||||
}
|
||||
|
||||
aboutToAppear() {
|
||||
console.info(MODULE_TAG + 'index page about to appear');
|
||||
}
|
||||
|
||||
onPageShow() {
|
||||
console.info(MODULE_TAG + 'index page show');
|
||||
}
|
||||
}
|
||||
@@ -1,55 +1,35 @@
|
||||
{
|
||||
"module": {
|
||||
"name": "entry",
|
||||
"type": "entry",
|
||||
"description": "$string:entry_desc",
|
||||
"mainElement": "MainAbility",
|
||||
"deviceTypes": [
|
||||
"phone",
|
||||
"tablet"
|
||||
],
|
||||
"deliveryWithInstall": true,
|
||||
"installationFree": false,
|
||||
"pages": "$profile:main_pages",
|
||||
"uiSyntax": "ets",
|
||||
"abilities": [
|
||||
{
|
||||
"name": "MainAbility",
|
||||
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
|
||||
"description": "$string:MainAbility_desc",
|
||||
"icon": "$media:icon",
|
||||
"label": "$string:MainAbility_label",
|
||||
"visible": true,
|
||||
"skills": [
|
||||
{
|
||||
"entities": [
|
||||
"entity.system.home"
|
||||
],
|
||||
"actions": [
|
||||
"action.system.home"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"requestPermissions": [
|
||||
{
|
||||
"name": "ohos.permission.GET_WALLPAPER"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.READ_USER_STORAGE"
|
||||
}
|
||||
],
|
||||
"extensionAbilities": [
|
||||
{
|
||||
"name": "WallpaperExtAbility",
|
||||
"srcEntrance": "./ets/WallpaperExtAbility/WallpaperExtAbility.ts",
|
||||
"description": "$string:MainAbility_desc",
|
||||
"icon": "$media:icon",
|
||||
"label": "$string:app_name",
|
||||
"visible": true,
|
||||
"type": "wallpaper",
|
||||
}
|
||||
]
|
||||
}
|
||||
{
|
||||
"module": {
|
||||
"name": "pad-wallpaper",
|
||||
"type": "feature",
|
||||
"srcEntrance": "./ets/Application/AbilityStage.ts",
|
||||
"description": "$string:myapplication_desc",
|
||||
"mainElement": "MainAbility",
|
||||
"deviceTypes": [
|
||||
"tablet"
|
||||
],
|
||||
"deliveryWithInstall": true,
|
||||
"installationFree": false,
|
||||
"pages": "$profile:main_pages",
|
||||
"uiSyntax": "ets",
|
||||
"requestPermissions": [
|
||||
{
|
||||
"name": "ohos.permission.GET_WALLPAPER"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.READ_USER_STORAGE"
|
||||
}
|
||||
],
|
||||
"extensionAbilities": [
|
||||
{
|
||||
"name": "WallpaperExtAbility",
|
||||
"srcEntrance": "./ets/WallpaperExtAbility/WallpaperExtAbility.ts",
|
||||
"description": "$string:MainAbility_desc",
|
||||
"icon": "$media:icon",
|
||||
"label": "$string:app_name",
|
||||
"visible": true,
|
||||
"type": "wallpaper",
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
+15
-23
@@ -1,24 +1,16 @@
|
||||
{
|
||||
"string": [
|
||||
{
|
||||
"name": "entry_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility_label",
|
||||
"value": "label"
|
||||
},
|
||||
{
|
||||
"name": "WallpaperExtAbility_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "WallpaperExtAbility_label",
|
||||
"value": "label"
|
||||
}
|
||||
]
|
||||
{
|
||||
"string": [
|
||||
{
|
||||
"name": "myapplication_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility_label",
|
||||
"value": "label"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
@@ -0,0 +1,3 @@
|
||||
/node_modules
|
||||
/.preview
|
||||
/build
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"apiType": 'stageMode',
|
||||
"buildOption": {
|
||||
"arkEnable": true
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"name": "default",
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
|
||||
module.exports = require('@ohos/hvigor-ohos-plugin').hapTasks
|
||||
Generated
+5
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"name": "phone-wallpaper",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 1
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "wallpaper",
|
||||
"version": "1.0.0",
|
||||
"ohos": {
|
||||
"org": "huawei",
|
||||
"buildTool": "hvigor",
|
||||
"directoryLevel": "module"
|
||||
},
|
||||
"description": "wallpaper for phone",
|
||||
"repository": {},
|
||||
"license": "ISC",
|
||||
"dependencies": {}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import AbilityStage from "@ohos.application.AbilityStage"
|
||||
|
||||
export default class MyAbilityStage extends AbilityStage {
|
||||
onCreate() {
|
||||
console.log("ExtWallpaper: MyAbilityStage onCreate")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import Ability from '@ohos.application.Ability'
|
||||
|
||||
export default class MainAbility extends Ability {
|
||||
onCreate(want, launchParam) {
|
||||
console.log("ExtWallpaper: MainAbility onCreate")
|
||||
globalThis.abilityWant = want;
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
console.log("ExtWallpaper: MainAbility onDestroy")
|
||||
}
|
||||
|
||||
onWindowStageCreate(windowStage) {
|
||||
// Main window is created, set main page for this ability
|
||||
console.log("ExtWallpaper: MainAbility onWindowStageCreate")
|
||||
}
|
||||
|
||||
onWindowStageDestroy() {
|
||||
// Main window is destroyed, release UI related resources
|
||||
console.log("ExtWallpaper: MainAbility onWindowStageDestroy")
|
||||
}
|
||||
|
||||
onForeground() {
|
||||
// Ability has brought to foreground
|
||||
console.log("ExtWallpaper: MainAbility onForeground")
|
||||
}
|
||||
|
||||
onBackground() {
|
||||
// Ability has back to background
|
||||
console.log("ExtWallpaper: MainAbility onBackground")
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,76 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import windowManager from '@ohos.window'
|
||||
import Extension from '@ohos.WallpaperExtension'
|
||||
import wallPaper from '@ohos.wallpaper'
|
||||
|
||||
const MODULE_TAG = 'ExtWallpaper : ';
|
||||
|
||||
export default class WallpaperExtAbility extends Extension {
|
||||
onCreated(want) {
|
||||
console.info(MODULE_TAG + 'ability on created start');
|
||||
windowManager.create(this.context, "wallpaper", 2000).then((win) => {
|
||||
win.loadContent("pages/index").then(() => {
|
||||
console.info(MODULE_TAG, "wallpaper window loadContent in then!")
|
||||
win.show().then(() => {
|
||||
win.setFullScreen(true).then(() => {
|
||||
console.info(MODULE_TAG, "set full");
|
||||
});
|
||||
console.info(MODULE_TAG, "then begin window show in then!");
|
||||
})
|
||||
})
|
||||
}, (error) => {
|
||||
Log.showError(TAG, name + " window createFailed, error.code = " + error.code)
|
||||
})
|
||||
// super.setUiContent("pages/index");
|
||||
this.initWallpaperImage();
|
||||
console.info(MODULE_TAG + 'ability on created end');
|
||||
}
|
||||
|
||||
onWallpaperChanged(wallpaperType) {
|
||||
console.info(MODULE_TAG + 'ability on wallpaper changed start, type is : ' + wallpaperType);
|
||||
if (wallPaper) {
|
||||
this.sendPixelMapData();
|
||||
}
|
||||
console.info(MODULE_TAG + 'ability on wallpaper changed end');
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
console.info(MODULE_TAG + 'ability on destroy');
|
||||
}
|
||||
|
||||
initWallpaperImage() {
|
||||
console.info(MODULE_TAG + 'ability init wallpaper image start');
|
||||
if (!wallPaper) {
|
||||
console.info(MODULE_TAG + 'ability init wallpaper image failed as wallpaper is null');
|
||||
return;
|
||||
}
|
||||
this.sendPixelMapData();
|
||||
console.info(MODULE_TAG + 'ability init wallpaper image end');
|
||||
}
|
||||
|
||||
sendPixelMapData() {
|
||||
console.info(MODULE_TAG + 'ability send pixel map data start');
|
||||
wallPaper.getPixelMap(0, (err, data) => {
|
||||
console.info(MODULE_TAG + 'ability get pixel map, err: ' + JSON.stringify(err) +
|
||||
" data: " + JSON.stringify(data));
|
||||
AppStorage.SetOrCreate('slPixelData', data);
|
||||
console.info(MODULE_TAG + 'ability set or create end');
|
||||
});
|
||||
console.info(MODULE_TAG + 'ability send pixel map data end');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
const MODULE_TAG = 'ExtWallpaper : ';
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct Index {
|
||||
@StorageLink('slPixelData') pixelData: any = [];
|
||||
|
||||
build() {
|
||||
Flex({direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center}) {
|
||||
Text("Hello Wallpaper")
|
||||
.fontSize("40vp")
|
||||
.fontColor(Color.Green)
|
||||
Image(this.pixelData);
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%');
|
||||
}
|
||||
|
||||
aboutToAppear() {
|
||||
console.info(MODULE_TAG + 'index page about to appear');
|
||||
}
|
||||
|
||||
onPageShow() {
|
||||
console.info(MODULE_TAG + 'index page show');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"module": {
|
||||
"name": "phone-wallpaper",
|
||||
"type": "feature",
|
||||
"srcEntrance": "./ets/Application/AbilityStage.ts",
|
||||
"description": "$string:myapplication_desc",
|
||||
"mainElement": "MainAbility",
|
||||
"deviceTypes": [
|
||||
"phone"
|
||||
],
|
||||
"deliveryWithInstall": true,
|
||||
"installationFree": false,
|
||||
"pages": "$profile:main_pages",
|
||||
"uiSyntax": "ets",
|
||||
"requestPermissions": [
|
||||
{
|
||||
"name": "ohos.permission.GET_WALLPAPER"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.READ_USER_STORAGE"
|
||||
}
|
||||
],
|
||||
"extensionAbilities": [
|
||||
{
|
||||
"name": "WallpaperExtAbility",
|
||||
"srcEntrance": "./ets/WallpaperExtAbility/WallpaperExtAbility.ts",
|
||||
"description": "$string:MainAbility_desc",
|
||||
"icon": "$media:icon",
|
||||
"label": "$string:app_name",
|
||||
"visible": true,
|
||||
"type": "wallpaper",
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"string": [
|
||||
{
|
||||
"name": "myapplication_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility_label",
|
||||
"value": "label"
|
||||
}
|
||||
]
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 6.6 KiB |
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"src": [
|
||||
"pages/index"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
{
|
||||
"version-name": "1.0.0",
|
||||
"version-code": 1000000,
|
||||
"app-distribution-type": "os_integration",
|
||||
"uuid": "5027b99e-5f9e-465d-9508-a9e0134ffe18",
|
||||
"validity": {
|
||||
"not-before": 1594865258,
|
||||
"not-after": 1689473258
|
||||
},
|
||||
"type": "release",
|
||||
"bundle-info": {
|
||||
"developer-id": "example",
|
||||
"distribution-certificate": "-----BEGIN CERTIFICATE-----\nMIICMzCCAbegAwIBAgIEaOC/zDAMBggqhkjOPQQDAwUAMGMxCzAJBgNVBAYTAkNO\nMRQwEgYDVQQKEwtPcGVuSGFybW9ueTEZMBcGA1UECxMQT3Blbkhhcm1vbnkgVGVh\nbTEjMCEGA1UEAxMaT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gQ0EwHhcNMjEwMjAy\nMTIxOTMxWhcNNDkxMjMxMTIxOTMxWjBoMQswCQYDVQQGEwJDTjEUMBIGA1UEChML\nT3Blbkhhcm1vbnkxGTAXBgNVBAsTEE9wZW5IYXJtb255IFRlYW0xKDAmBgNVBAMT\nH09wZW5IYXJtb255IEFwcGxpY2F0aW9uIFJlbGVhc2UwWTATBgcqhkjOPQIBBggq\nhkjOPQMBBwNCAATbYOCQQpW5fdkYHN45v0X3AHax12jPBdEDosFRIZ1eXmxOYzSG\nJwMfsHhUU90E8lI0TXYZnNmgM1sovubeQqATo1IwUDAfBgNVHSMEGDAWgBTbhrci\nFtULoUu33SV7ufEFfaItRzAOBgNVHQ8BAf8EBAMCB4AwHQYDVR0OBBYEFPtxruhl\ncRBQsJdwcZqLu9oNUVgaMAwGCCqGSM49BAMDBQADaAAwZQIxAJta0PQ2p4DIu/ps\nLMdLCDgQ5UH1l0B4PGhBlMgdi2zf8nk9spazEQI/0XNwpft8QAIwHSuA2WelVi/o\nzAlF08DnbJrOOtOnQq5wHOPlDYB4OtUzOYJk9scotrEnJxJzGsh/\n-----END CERTIFICATE-----\n",
|
||||
"bundle-name": "com.ohos.wallpaper",
|
||||
"apl": "system_basic",
|
||||
"app-feature": "hos_system_app"
|
||||
},
|
||||
"acls": {},
|
||||
"permissions": {
|
||||
"restricted-permissions": [
|
||||
"ohos.permission.GET_WALLPAPER",
|
||||
"ohos.permission.READ_USER_STORAGE"
|
||||
]
|
||||
},
|
||||
"issuer": "pki_internal"
|
||||
}
|
||||
Binary file not shown.
Reference in New Issue
Block a user