mirror of
https://gitee.com/openharmony/applications_screenshot
synced 2024-11-23 15:10:04 +00:00
!14 截屏应用升级api9
Merge pull request !14 from lijinfengde123/OpenHarmony-3.1-Release
This commit is contained in:
commit
32fa14f228
233
.eslintrc.json
Normal file
233
.eslintrc.json
Normal file
@ -0,0 +1,233 @@
|
||||
{
|
||||
"env": {
|
||||
"es2017": true,
|
||||
"node": true
|
||||
},
|
||||
"extends": [],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": "latest",
|
||||
"sourceType": "module",
|
||||
"project": "tsconfig.json"
|
||||
},
|
||||
"plugins": [
|
||||
"@typescript-eslint"
|
||||
],
|
||||
"rules": {
|
||||
"indent": [
|
||||
"error",
|
||||
2
|
||||
],
|
||||
"quotes": [
|
||||
"error",
|
||||
"single"
|
||||
],
|
||||
"semi": [
|
||||
"error",
|
||||
"always"
|
||||
],
|
||||
"max-lines": [
|
||||
"warn", 2000
|
||||
],
|
||||
"max-lines-per-function": [
|
||||
"warn", 50
|
||||
],
|
||||
"complexity": [
|
||||
"warn", 20
|
||||
],
|
||||
"max-depth": [
|
||||
"warn", 4
|
||||
],
|
||||
"@typescript-eslint/array-type": [
|
||||
"error",
|
||||
{
|
||||
"options":
|
||||
"array"
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/prefer-as-const": [
|
||||
"error"
|
||||
],
|
||||
"@typescript-eslint/no-inferrable-types": [
|
||||
"error",
|
||||
{
|
||||
"ignoreParameters": false,
|
||||
"ignoreProperties": false
|
||||
}
|
||||
],
|
||||
|
||||
"@typescript-eslint/method-signature-style": ["error", "method"],
|
||||
"@typescript-eslint/naming-convention": [ "error",
|
||||
{
|
||||
"selector": "default",
|
||||
"format": [ "camelCase" ],
|
||||
"leadingUnderscore": "forbid",
|
||||
"trailingUnderscore": "forbid"
|
||||
},
|
||||
{
|
||||
"selector": "variable",
|
||||
"modifiers": ["const"],
|
||||
"format": [ "camelCase", "UPPER_CASE" ],
|
||||
"leadingUnderscore": "forbid",
|
||||
"trailingUnderscore": "forbid"
|
||||
},
|
||||
{
|
||||
"selector": "memberLike",
|
||||
"modifiers": ["static", "readonly"],
|
||||
"format": [ "UPPER_CASE" ],
|
||||
"leadingUnderscore": "forbid",
|
||||
"trailingUnderscore": "forbid"
|
||||
},
|
||||
{
|
||||
"selector": "typeLike",
|
||||
"format": [ "PascalCase" ]
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/no-base-to-string": [
|
||||
"error",
|
||||
{
|
||||
"ignoredTypeNames": ["RegExp"]
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/no-confusing-non-null-assertion": ["error"],
|
||||
"@typescript-eslint/no-dynamic-delete": ["error"],
|
||||
"@typescript-eslint/no-empty-interface": ["error"],
|
||||
"@typescript-eslint/no-explicit-any": [
|
||||
"error",
|
||||
{
|
||||
"fixToUnknown": false,
|
||||
"ignoreRestArgs": false
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/no-extra-non-null-assertion": ["error"],
|
||||
"@typescript-eslint/no-floating-promises": [
|
||||
"error",
|
||||
{
|
||||
"ignoreVoid": true,
|
||||
"ignoreIIFE": false
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/no-for-in-array": ["error"],
|
||||
"@typescript-eslint/no-meaningless-void-operator": [
|
||||
"error",
|
||||
{
|
||||
"checkNever": false
|
||||
}
|
||||
],
|
||||
|
||||
"@typescript-eslint/no-invalid-void-type": [
|
||||
"error",
|
||||
{
|
||||
"allowInGenericTypeArguments": true,
|
||||
"allowAsThisParameter": false
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/prefer-readonly": ["error"],
|
||||
"@typescript-eslint/prefer-string-starts-ends-with": ["error"],
|
||||
"@typescript-eslint/prefer-ts-expect-error": ["error"],
|
||||
"@typescript-eslint/promise-function-async": ["error"],
|
||||
"@typescript-eslint/require-array-sort-compare": ["error"],
|
||||
"@typescript-eslint/restrict-plus-operands": ["error"],
|
||||
"@typescript-eslint/restrict-template-expressions": ["error"],
|
||||
"@typescript-eslint/strict-boolean-expressions": ["error"],
|
||||
"@typescript-eslint/triple-slash-reference": ["error"],
|
||||
"@typescript-eslint/type-annotation-spacing": ["error"],
|
||||
"@typescript-eslint/unbound-method": ["error"],
|
||||
"@typescript-eslint/unified-signatures": ["error"],
|
||||
"@typescript-eslint/no-unsafe-argument":["error"],
|
||||
"@typescript-eslint/no-unsafe-assignment":["error"],
|
||||
"@typescript-eslint/no-unsafe-call":["error"],
|
||||
"@typescript-eslint/no-unsafe-member-access":["error"],
|
||||
"@typescript-eslint/no-unsafe-return":["error"],
|
||||
"@typescript-eslint/no-var-requires":["error"],
|
||||
"@typescript-eslint/non-nullable-type-assertion-style":["error"],
|
||||
"@typescript-eslint/prefer-for-of":["error"],
|
||||
"@typescript-eslint/prefer-literal-enum-member":["error"],
|
||||
"@typescript-eslint/prefer-optional-chain":["error"],
|
||||
"@typescript-eslint/no-misused-new": ["error"],
|
||||
"@typescript-eslint/no-misused-promises": [
|
||||
"error",
|
||||
{
|
||||
"checksConditionals": true,
|
||||
"checksVoidReturn": true
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/no-namespace": [
|
||||
"error",
|
||||
{
|
||||
"allowDeclarations": false,
|
||||
"allowDefinitionFiles": true
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/no-non-null-asserted-nullish-coalescing":["error"],
|
||||
"@typescript-eslint/no-non-null-asserted-optional-chain":["error"],
|
||||
"@typescript-eslint/no-non-null-assertion":["error"],
|
||||
"@typescript-eslint/no-parameter-properties":["error"],
|
||||
"@typescript-eslint/no-require-imports":["error"],
|
||||
"@typescript-eslint/no-this-alias":["error"],
|
||||
"@typescript-eslint/no-type-alias":["error"],
|
||||
"@typescript-eslint/no-unnecessary-boolean-literal-compare":["error"],
|
||||
"@typescript-eslint/no-unnecessary-condition":["error"],
|
||||
"@typescript-eslint/no-unnecessary-qualifier":["error"],
|
||||
"@typescript-eslint/no-unnecessary-type-arguments":["error"],
|
||||
"@typescript-eslint/no-unnecessary-type-assertion":["error"],
|
||||
"@typescript-eslint/no-unnecessary-type-constraint":["error"],
|
||||
"@typescript-eslint/adjacent-overload-signatures": ["error"],
|
||||
"@typescript-eslint/await-thenable": ["error"],
|
||||
"@typescript-eslint/ban-ts-comment":[
|
||||
"error",
|
||||
{
|
||||
"ts-expect-error": true,
|
||||
"ts-ignore": true,
|
||||
"ts-nocheck": true,
|
||||
"ts-check": true
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/ban-tslint-comment": "error",
|
||||
"@typescript-eslint/ban-types": [
|
||||
"error",
|
||||
{
|
||||
"types": {
|
||||
"Array": {
|
||||
"message": "Use [] instead",
|
||||
"fixWith": "[]"
|
||||
},
|
||||
"Boolean": {
|
||||
"message": "Use boolean instead",
|
||||
"fixWith": "boolean"
|
||||
},
|
||||
"Number": {
|
||||
"message": "Use number instead",
|
||||
"fixWith": "number"
|
||||
},
|
||||
"function": "Do not use Function",
|
||||
"String": {
|
||||
"message": "Use string instead",
|
||||
"fixWith": "string"
|
||||
},
|
||||
"{}": {
|
||||
"message": "Use object instead",
|
||||
"fixWith": "object"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/consistent-indexed-object-style": [ "error", "record" ],
|
||||
"@typescript-eslint/explicit-function-return-type": [
|
||||
"error",
|
||||
{
|
||||
"allowExpressions": true,
|
||||
"allowTypedFunctionExpressions": true,
|
||||
"allowHigherOrderFunctions": false,
|
||||
"allowDirectConstAssertionInArrowFunctions": false,
|
||||
"allowConciseArrowFunctionExpressionsStartingWithVoid": false
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/explicit-member-accessibility": [
|
||||
"error",
|
||||
{
|
||||
"accessibility": "no-public"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
11
AppScope/app.json5
Normal file
11
AppScope/app.json5
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"app": {
|
||||
"bundleName": "com.ohos.screenshot",
|
||||
"vendor": "ohos",
|
||||
"versionCode": 1000000,
|
||||
"versionName": "1.0.0",
|
||||
"icon": "$media:app_icon",
|
||||
"label": "$string:app_name",
|
||||
"distributedNotificationEnabled": true
|
||||
}
|
||||
}
|
8
AppScope/resources/base/element/string.json
Normal file
8
AppScope/resources/base/element/string.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"string": [
|
||||
{
|
||||
"name": "app_name",
|
||||
"value": "screenshot"
|
||||
}
|
||||
]
|
||||
}
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
6
OAT.xml
6
OAT.xml
@ -54,6 +54,12 @@
|
||||
</policy>
|
||||
</policylist>
|
||||
<filefilterlist>
|
||||
<filefilter name="defaultFilter" desc="Files not to check">
|
||||
<filteritem type="filepath" name=".*.json5" desc="build config file"/>
|
||||
<filteritem type="filepath" name="**/.*.json5" desc="build config file"/>
|
||||
<filteritem type="filepath" name="features/.*/.*.json5" desc="build config file"/>
|
||||
<filteritem type="filepath" name="product/.*/.*.json5" desc="build config file"/>
|
||||
</filefilter>
|
||||
<filefilter name="binaryFileTypePolicyFilter" desc="Filters for binary file policies">
|
||||
<filteritem type="filepath" name="entry/phone/src/main/resources/base/media/.*.png" desc="self developed image"/>
|
||||
<filteritem type="filepath" name="features/screenshot/src/main/resources/base/media/.*.png" desc="self developed image"/>
|
||||
|
@ -30,7 +30,7 @@ ScreenShot应用是OpenHarmony中预置的系统应用,为用户提供截取
|
||||
├── product # ScreenShot总体功能目录
|
||||
```
|
||||
|
||||
###功能描述
|
||||
### 功能描述
|
||||
#### features
|
||||
子组件目录,提供截屏窗口显示控制,图片保存控制。
|
||||
|
||||
|
40
build-profile.json5
Normal file
40
build-profile.json5
Normal file
@ -0,0 +1,40 @@
|
||||
{
|
||||
"app": {
|
||||
"compileSdkVersion": 9,
|
||||
"compatibleSdkVersion": 9,
|
||||
"products": [
|
||||
{
|
||||
"name": "default",
|
||||
"signingConfig": "default"
|
||||
}
|
||||
],
|
||||
"signingConfigs": [
|
||||
{
|
||||
"name": "default",
|
||||
"material": {
|
||||
"certpath": "C:/Users/Administrator/AppData/Local/OpenHarmony/OpenHarmonyApplication.cer",
|
||||
"storePassword": "00000016ABE2FA3169DEA4C8550456B888D0FF70F42648A46FC95ED2ADD36C26486E8D941A9D",
|
||||
"keyAlias": "OpenHarmony Application Release",
|
||||
"keyPassword": "00000016036224B5B988AA8E22FE94805292A26974131A2CAFCA9470B71016E7B534E3B5EF05",
|
||||
"profile": "C:/Users/Administrator/AppData/Local/OpenHarmony/screenshot.p7b",
|
||||
"signAlg": "SHA256withECDSA",
|
||||
"storeFile": "C:/Users/Administrator/AppData/Local/OpenHarmony/OpenHarmony.p12"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"modules": [
|
||||
{
|
||||
"name": "phone",
|
||||
"srcPath": "./product/phone",
|
||||
"targets": [
|
||||
{
|
||||
"name": "default",
|
||||
"applyToProducts": [
|
||||
"default",
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
],
|
||||
}
|
48
build.gradle
48
build.gradle
@ -1,48 +0,0 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
apply plugin: 'com.huawei.ohos.app'
|
||||
apply from: "./infra/config_exts.gradle"
|
||||
|
||||
ohos {
|
||||
compileSdkVersion rootProject.ext.version.compileSdk
|
||||
defaultConfig {
|
||||
compatibleSdkVersion rootProject.ext.version.compatibleSdk
|
||||
}
|
||||
supportSystem "standard"
|
||||
}
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
maven {
|
||||
url 'https://mirrors.huaweicloud.com/repository/maven/'
|
||||
allowInsecureProtocol = true
|
||||
}
|
||||
maven {
|
||||
url 'https://developer.huawei.com/repo/'
|
||||
allowInsecureProtocol = true
|
||||
}
|
||||
maven {
|
||||
url 'http://repo.ark.tools.huawei.com/artifactory/maven-public/'
|
||||
allowInsecureProtocol = true
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.huawei.ohos:hap:3.0.5.2'
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
maven {
|
||||
url 'http://repo.ark.tools.huawei.com/artifactory/maven-public/'
|
||||
allowInsecureProtocol = true
|
||||
}
|
||||
maven {
|
||||
url 'https://mirrors.huaweicloud.com/repository/maven/'
|
||||
allowInsecureProtocol = true
|
||||
}
|
||||
maven {
|
||||
url 'https://developer.huawei.com/repo/'
|
||||
allowInsecureProtocol = true
|
||||
}
|
||||
}
|
||||
}
|
6
common/build-profile.json5
Normal file
6
common/build-profile.json5
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"apiType": 'stageMode',
|
||||
"buildOption": {
|
||||
"arkEnable": true
|
||||
}
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
apply plugin: 'com.huawei.ohos.library'
|
||||
//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510
|
||||
ohos {
|
||||
compileSdkVersion rootProject.ext.version.compileSdk
|
||||
defaultConfig {
|
||||
compatibleSdkVersion rootProject.ext.version.compatibleSdk
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
proguardOpt {
|
||||
proguardEnabled false
|
||||
rulesFiles 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
entryModules "phone"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/**
|
||||
* 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.
|
||||
@ -12,6 +12,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
include ':phone_entry',':phone', ':common', ':features:screenshot'
|
||||
project(':phone_entry').projectDir = new File('./entry/phone')
|
||||
project(':phone').projectDir = new File('./product/phone')
|
||||
|
||||
// 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
|
12
common/package.json
Normal file
12
common/package.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "@ohos/common",
|
||||
"version": "1.0.0",
|
||||
"description": "a npm package which contains common function",
|
||||
"ohos": {
|
||||
"org": "huawei",
|
||||
"buildTool": "hvigor",
|
||||
"directoryLevel": "module"
|
||||
},
|
||||
"dependencies": {
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
{
|
||||
"app": {
|
||||
"bundleName": "com.ohos.screenshot",
|
||||
"vendor": "ohos",
|
||||
"version": {
|
||||
"code": 1000000,
|
||||
"name": "1.0.0"
|
||||
}
|
||||
},
|
||||
"deviceConfig": {
|
||||
},
|
||||
"module": {
|
||||
"package": "com.ohos.screenshot.common",
|
||||
"deviceType": [
|
||||
"phone"
|
||||
],
|
||||
"distro": {
|
||||
"deliveryWithInstall": true,
|
||||
"moduleName": "common",
|
||||
"moduleType": "har"
|
||||
},
|
||||
"srcPath": "default"
|
||||
}
|
||||
}
|
10
common/src/main/module.json5
Normal file
10
common/src/main/module.json5
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"module": {
|
||||
"package": "com.ohos.screenshot",
|
||||
"name": "common",
|
||||
"type": "har",
|
||||
"deviceTypes": [
|
||||
"phone"
|
||||
],
|
||||
"uiSyntax": "ets"
|
||||
}
|
2
entry/phone/.gitignore
vendored
2
entry/phone/.gitignore
vendored
@ -1,2 +0,0 @@
|
||||
/build
|
||||
/node_modules
|
@ -1,23 +0,0 @@
|
||||
apply plugin: 'com.huawei.ohos.hap'
|
||||
//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510
|
||||
ohos {
|
||||
compileSdkVersion rootProject.ext.version.compileSdk
|
||||
defaultConfig {
|
||||
compatibleSdkVersion rootProject.ext.version.compatibleSdk
|
||||
}
|
||||
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
proguardOpt {
|
||||
proguardEnabled false
|
||||
rulesFiles 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar', '*.har'])
|
||||
}
|
1
entry/phone/proguard-rules.pro
vendored
1
entry/phone/proguard-rules.pro
vendored
@ -1 +0,0 @@
|
||||
# config module specific ProGuard rules here.
|
@ -1,64 +0,0 @@
|
||||
{
|
||||
"app": {
|
||||
"bundleName": "com.ohos.screenshot",
|
||||
"vendor": "ohos",
|
||||
"version": {
|
||||
"code": 1000000,
|
||||
"name": "1.0.0"
|
||||
}
|
||||
},
|
||||
"deviceConfig": {},
|
||||
"module": {
|
||||
"package": "com.ohos.screenshot",
|
||||
"name": ".MyApplication",
|
||||
"deviceType": [
|
||||
"phone"
|
||||
],
|
||||
"distro": {
|
||||
"deliveryWithInstall": true,
|
||||
"moduleName": "phone_entry",
|
||||
"moduleType": "entry",
|
||||
"installationFree": false
|
||||
},
|
||||
"abilities": [
|
||||
{
|
||||
"skills": [
|
||||
{
|
||||
"entities": [
|
||||
"entity.system.home"
|
||||
],
|
||||
"actions": [
|
||||
"action.system.home"
|
||||
]
|
||||
}
|
||||
],
|
||||
"visible": true,
|
||||
"name": "com.ohos.screenshot.MainAbility",
|
||||
"icon": "$media:icon",
|
||||
"description": "$string:mainability_description",
|
||||
"label": "$string:entry_MainAbility",
|
||||
"type": "page",
|
||||
"launchType": "standard",
|
||||
"srcPath": "MainAbility",
|
||||
"srcLanguage": "ets"
|
||||
}
|
||||
],
|
||||
"js": [
|
||||
{
|
||||
"mode": {
|
||||
"syntax": "ets",
|
||||
"type": "pageAbility"
|
||||
},
|
||||
"pages": [
|
||||
"pages/index"
|
||||
],
|
||||
"name": "MainAbility",
|
||||
"window": {
|
||||
"designWidth": 720,
|
||||
"autoDesignWidth": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"srcPath": "MainAbility"
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
/*
|
||||
* 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"
|
||||
import Log from '../../../../../common/src/main/ets/default/Log.ets'
|
||||
|
||||
const TAG = "MainAbilityStage"
|
||||
|
||||
export default class MainAbilityStage extends AbilityStage {
|
||||
onCreate() {
|
||||
Log.showInfo(TAG, "onCreate")
|
||||
}
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
/*
|
||||
* 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.info('API8 A onCreate')
|
||||
}
|
||||
|
||||
onWindowStageCreate(windowStage) {
|
||||
console.info('API8 A onWindowStageCreate')
|
||||
windowStage.setUIContent(this.content, "pages/index", null)
|
||||
}
|
||||
|
||||
onForeground() {
|
||||
console.info('API8 A onForeground')
|
||||
}
|
||||
|
||||
onBackground() {
|
||||
console.info('API8 A onBackground')
|
||||
}
|
||||
|
||||
onWindowStageDestroy() {
|
||||
console.info('API8 A onWindowStageDestroy')
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
console.info('API8 A onDestroy')
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
{
|
||||
"string": [
|
||||
{
|
||||
"name": "entry_MainAbility",
|
||||
"value": "entry_MainAbility"
|
||||
},
|
||||
{
|
||||
"name": "mainability_description",
|
||||
"value": "eTS_Empty Ability"
|
||||
}
|
||||
]
|
||||
}
|
6
features/screenshot/build-profile.json5
Normal file
6
features/screenshot/build-profile.json5
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"apiType": 'stageMode',
|
||||
"buildOption": {
|
||||
"arkEnable": true
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
apply plugin: 'com.huawei.ohos.library'
|
||||
//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510
|
||||
ohos {
|
||||
compileSdkVersion rootProject.ext.version.compileSdk
|
||||
defaultConfig {
|
||||
compatibleSdkVersion rootProject.ext.version.compatibleSdk
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
proguardOpt {
|
||||
proguardEnabled false
|
||||
rulesFiles 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar', '*.har'])
|
||||
implementation project(':common')
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/**
|
||||
* 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.
|
||||
@ -13,13 +13,5 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct Index {
|
||||
build() {
|
||||
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
}
|
||||
}
|
||||
// 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
|
12
features/screenshot/package.json
Normal file
12
features/screenshot/package.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "@ohos/features",
|
||||
"version": "1.0.0",
|
||||
"description": "a npm package which contains common function",
|
||||
"ohos": {
|
||||
"org": "huawei",
|
||||
"buildTool": "hvigor",
|
||||
"directoryLevel": "module"
|
||||
},
|
||||
"dependencies": {
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
{
|
||||
"app": {
|
||||
"bundleName": "com.ohos.screenshot",
|
||||
"vendor": "ohos",
|
||||
"version": {
|
||||
"code": 1000000,
|
||||
"name": "1.0.0"
|
||||
}
|
||||
},
|
||||
"deviceConfig": {},
|
||||
"module": {
|
||||
"package": "com.ohos.screenshot",
|
||||
"deviceType": [
|
||||
"phone"
|
||||
],
|
||||
"distro": {
|
||||
"deliveryWithInstall": true,
|
||||
"moduleName": "screenshot",
|
||||
"moduleType": "har"
|
||||
},
|
||||
"srcPath": "default"
|
||||
}
|
||||
}
|
@ -26,15 +26,17 @@ const TAG = 'ScreenShot-ScreenShotModel';
|
||||
const SCREEN_SHOT_PATH = "Screenshots/";
|
||||
const SCREENSHOT_PREFIX = "Screenshot";
|
||||
const PICTURE_TYPE = ".jpg";
|
||||
const SAVE_IMAGE_DELAY = 500;
|
||||
const SAVE_IMAGE_DELAY = 300;
|
||||
const OPTIONS_QUALITY = 100;
|
||||
const CREATE_WINDOW_DELAY = 300;
|
||||
|
||||
export class ScreenShotModel {
|
||||
captureImage: any = null;
|
||||
captureImage: any;
|
||||
imageFilename: string = '';
|
||||
|
||||
shotScreen() {
|
||||
async shotScreen() {
|
||||
Log.showInfo(TAG, `shotScreen`)
|
||||
await new Promise((resolve) => setTimeout(resolve, CREATE_WINDOW_DELAY));
|
||||
ScreenshotManager.save().then(async (data) => {
|
||||
Log.showInfo(TAG, `ScreenshotManager.save data:${JSON.stringify(data)}`)
|
||||
if (!!data) {
|
||||
@ -56,7 +58,7 @@ export class ScreenShotModel {
|
||||
var packer = ImageMar.createImagePacker();
|
||||
Log.showInfo(TAG, `saveImage packer:${JSON.stringify(packer)}`);
|
||||
this.showWindow();
|
||||
await new Promise((resolve) => setTimeout(resolve, SAVE_IMAGE_DELAY))
|
||||
await new Promise((resolve) => setTimeout(resolve, SAVE_IMAGE_DELAY));
|
||||
packer.packingFromPixelMap(pixelMap, options).then((jpegData) => {
|
||||
Log.showInfo(TAG, `packing jpegData type:` + jpegData.constructor.name + ' value : ' + jpegData);
|
||||
media.getPublicDirectory(mediaLibrary.DirectoryType.DIR_IMAGE, (err, rp) => {
|
||||
|
10
features/screenshot/src/main/module.json5
Normal file
10
features/screenshot/src/main/module.json5
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"module": {
|
||||
"name": "screenshot",
|
||||
"type": "har",
|
||||
"deviceTypes": [
|
||||
"phone",
|
||||
],
|
||||
"uiSyntax": "ets"
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
# Project-wide Gradle settings.
|
||||
# IDE (e.g. DevEco Studio) users:
|
||||
# Gradle settings configured through the IDE *will override*
|
||||
# any settings specified in this file.
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
# If the Chinese output is garbled, please configure the following parameter.
|
||||
# org.gradle.jvmargs=-Dfile.encoding=GBK
|
||||
|
184
gradlew
vendored
184
gradlew
vendored
@ -1,184 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
# 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
|
||||
#
|
||||
# https://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.
|
||||
#
|
||||
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
exec "$JAVACMD" "$@"
|
104
gradlew.bat
vendored
104
gradlew.bat
vendored
@ -1,104 +0,0 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/**
|
||||
* 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.
|
||||
@ -13,11 +13,5 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export default {
|
||||
onCreate() {
|
||||
console.info('Application onCreate')
|
||||
},
|
||||
onDestroy() {
|
||||
console.info('Application onDestroy')
|
||||
},
|
||||
}
|
||||
// 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').appTasks
|
@ -1,6 +0,0 @@
|
||||
ext {
|
||||
version = [
|
||||
compileSdk : 8,
|
||||
compatibleSdk: 8
|
||||
]
|
||||
}
|
@ -1,13 +1,10 @@
|
||||
## This file is automatically generated by DevEco Studio.
|
||||
# This file is automatically generated by DevEco Studio.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must *NOT* be checked into Version Control Systems,
|
||||
# This file should *NOT* be checked into Version Control Systems,
|
||||
# as it contains information specific to your local configuration.
|
||||
#
|
||||
# Location of the SDK. This is only used by Gradle.
|
||||
# For customization when using a Version Control System, please read the
|
||||
# header note.
|
||||
#Tue Mar 08 16:56:18 CST 2022
|
||||
sdk.dir=
|
||||
nodejs.dir=
|
||||
npm.dir=
|
||||
# For customization when using a Version Control System, please read the header note.
|
||||
sdk.dir=C:/Users/Administrator/AppData/Local/OpenHarmony/900sdk
|
||||
nodejs.dir=D:/Installation/DevEco Studio 3.0.0.900/tools/nodejs
|
||||
npm.dir=D:/Installation/DevEco Studio 3.0.0.900/tools/nodejs
|
1643
package-lock.json
generated
Normal file
1643
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
15
package.json
Normal file
15
package.json
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"devDependencies":{},
|
||||
"name":"screenshot",
|
||||
"ohos":{
|
||||
"org":"huawei",
|
||||
"directoryLevel":"project",
|
||||
"buildTool":"hvigor"
|
||||
},
|
||||
"version":"1.0.0",
|
||||
"dependencies":{
|
||||
"@ohos/hvigor-ohos-plugin":"1.0.6",
|
||||
"hypium":"^1.0.0",
|
||||
"@ohos/hvigor":"1.0.6"
|
||||
}
|
||||
}
|
11
product/phone/build-profile.json5
Normal file
11
product/phone/build-profile.json5
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"apiType": 'stageMode',
|
||||
"buildOption": {
|
||||
"arkEnable": true
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"name": "default",
|
||||
}
|
||||
]
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
apply plugin: 'com.huawei.ohos.hap'
|
||||
ohos {
|
||||
compileSdkVersion rootProject.ext.version.compileSdk
|
||||
defaultConfig {
|
||||
compatibleSdkVersion rootProject.ext.version.compatibleSdk
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
proguardOpt {
|
||||
proguardEnabled false
|
||||
rulesFiles 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
entryModules "phone_entry"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
entryImplementation project(':phone_entry')
|
||||
implementation project(':common')
|
||||
implementation project(':features:screenshot')
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/**
|
||||
* 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.
|
||||
@ -12,15 +12,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import Log from '../../../../../../common/src/main/ets/default/Log.ets';
|
||||
|
||||
const TAG = 'ScreenShot-App'
|
||||
|
||||
export default {
|
||||
onCreate() {
|
||||
Log.showInfo(TAG, 'Application onCreate');
|
||||
},
|
||||
onDestroy() {
|
||||
Log.showInfo(TAG, 'Application onDestroy');
|
||||
},
|
||||
}
|
||||
// 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
|
5
product/phone/package-lock.json
generated
Normal file
5
product/phone/package-lock.json
generated
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"name": "screenshot",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 1
|
||||
}
|
11
product/phone/package.json
Normal file
11
product/phone/package.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"devDependencies":{},
|
||||
"name":"screenshot",
|
||||
"ohos":{
|
||||
"org":"huawei",
|
||||
"directoryLevel":"module",
|
||||
"buildTool":"hvigor"
|
||||
},
|
||||
"version":"1.0.0",
|
||||
"dependencies":{}
|
||||
}
|
@ -1,94 +0,0 @@
|
||||
{
|
||||
"app": {
|
||||
"bundleName": "com.ohos.screenshot",
|
||||
"vendor": "ohos",
|
||||
"version": {
|
||||
"code": 1000000,
|
||||
"name": "1.0.0"
|
||||
}
|
||||
},
|
||||
"deviceConfig": {},
|
||||
"module": {
|
||||
"package": "com.ohos.screenshot",
|
||||
"name": "com.ohos.screenshot.MyApplication",
|
||||
"mainAbility": ".ServiceExtAbility",
|
||||
"deviceType": [
|
||||
"phone"
|
||||
],
|
||||
"distro": {
|
||||
"deliveryWithInstall": true,
|
||||
"moduleName": "phone",
|
||||
"moduleType": "feature",
|
||||
"installationFree": false
|
||||
},
|
||||
"abilities": [
|
||||
{
|
||||
"skills": [
|
||||
{
|
||||
"actions": [
|
||||
"com.ohos.systemui.action.TOGGLE",
|
||||
"action.system.home"
|
||||
]
|
||||
}
|
||||
],
|
||||
"visible": true,
|
||||
"name": ".ServiceExtAbility",
|
||||
"icon": "$media:icon",
|
||||
"description": "$string:mainability_description",
|
||||
"label": "$string:app_name",
|
||||
"type": "service",
|
||||
"launchType": "singleton",
|
||||
"srcPath": "ServiceExtAbility",
|
||||
"srcLanguage": "ets",
|
||||
"metaData": {
|
||||
"customizeData": [
|
||||
{
|
||||
"name": "com.ohos.systemui.action.TOGGLE",
|
||||
"value": "",
|
||||
"extra": "\"pluginType\":\"1\",\"clickAction\":\"ability=com.ohos.screenshot|com.ohos.screenshot.ServiceExtAbility\""
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"js": [
|
||||
{
|
||||
"mode": {
|
||||
"syntax": "ets",
|
||||
"type": "pageAbility"
|
||||
},
|
||||
"pages": [
|
||||
"pages/index"
|
||||
],
|
||||
"name": ".ServiceExtAbility",
|
||||
"window": {
|
||||
"designWidth": 720,
|
||||
"autoDesignWidth": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"srcPath": "",
|
||||
"reqPermissions": [
|
||||
{
|
||||
"name": "ohos.permission.MEDIA_LOCATION",
|
||||
"reason": "request permission"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.READ_MEDIA",
|
||||
"reason": "request permission"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.WRITE_MEDIA",
|
||||
"reason": "request permission"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
|
||||
"reason": "request permission"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.CAPTURE_SCREEN",
|
||||
"reason": "request permission"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
/*
|
||||
* 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"
|
||||
import Log from '../../../../../common/src/main/ets/default/Log.ets'
|
||||
|
||||
const TAG = "ScreenShot-MainAbilityStage"
|
||||
|
||||
export default class MainAbilityStage extends AbilityStage {
|
||||
onCreate() {
|
||||
Log.showInfo(TAG, "onCreate")
|
||||
}
|
||||
}
|
22
product/phone/src/main/ets/Application/AbilityStage.ts
Normal file
22
product/phone/src/main/ets/Application/AbilityStage.ts
Normal file
@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Copyright (c) 2021-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(): void {
|
||||
console.log('MyAbilityStage onCreate is called');
|
||||
}
|
||||
}
|
@ -12,16 +12,16 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import Log from '../../../../../../../common/src/main/ets/default/Log.ets';
|
||||
import Constants from '../common/constants.ets';
|
||||
import ViewModel from '../vm/ViewModel.ets';
|
||||
import Log from '../../../../../../common/src/main/ets/default/log';
|
||||
import Constants from '../common/constants';
|
||||
import ViewModel from '../vm/viewmodel';
|
||||
|
||||
const TAG = 'ScreenShot-Index';
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct Index {
|
||||
@StorageLink("captureImage") captureImage: any = undefined;
|
||||
@StorageLink("captureImage") captureImage: any = "";
|
||||
@StorageLink("imageFilename") imageFilename: string = "";
|
||||
|
||||
build() {
|
@ -13,9 +13,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import Log from '../../../../../../../common/src/main/ets/default/Log.ets';
|
||||
import Log from '../../../../../../common/src/main/ets/default/log';
|
||||
import ShotScreenModel, {ScreenShotModel
|
||||
}from '../../../../../../../features/screenshot/src/main/ets/com/ohos/model/screenShotModel.ets'
|
||||
}from '../../../../../../features/screenshot/src/main/ets/com/ohos/model/screenshotmodel'
|
||||
|
||||
const TAG = 'ScreenShot-ViewModel'
|
||||
const GALLERY_BUNDLE = 'com.ohos.photos'
|
57
product/phone/src/main/module.json5
Normal file
57
product/phone/src/main/module.json5
Normal file
@ -0,0 +1,57 @@
|
||||
{
|
||||
"module": {
|
||||
"name": "phone",
|
||||
"type": "feature",
|
||||
"srcEntrance": "./ets/Application/AbilityStage.ts",
|
||||
"description": "$string:mainability_description",
|
||||
"mainElement": "com.ohos.screenshot.ServiceExtAbility",
|
||||
"deviceTypes": [
|
||||
"phone"
|
||||
],
|
||||
"deliveryWithInstall": true,
|
||||
"installationFree": false,
|
||||
"pages": "$profile:main_pages",
|
||||
"uiSyntax": "ets",
|
||||
"extensionAbilities": [
|
||||
{
|
||||
"visible": true,
|
||||
"skills": [
|
||||
{
|
||||
"actions": [
|
||||
"com.ohos.systemui.action.TOGGLE"
|
||||
]
|
||||
}
|
||||
],
|
||||
"srcEntrance": "./ets/ServiceExtAbility/ServiceExtAbility.ts",
|
||||
"name": "com.ohos.screenshot.ServiceExtAbility",
|
||||
"icon": "$media:icon",
|
||||
"description": "$string:mainability_description",
|
||||
"label": "$string:app_name",
|
||||
"type": "service",
|
||||
"metadata": [
|
||||
{
|
||||
"name": "com.ohos.systemui.action.TOGGLE",
|
||||
"value": "\"pluginType\":\"1\",\"clickAction\":\"ability=com.ohos.screenshot|com.ohos.screenshot.ServiceExtAbility\""
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"requestPermissions": [
|
||||
{
|
||||
"name": "ohos.permission.MEDIA_LOCATION"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.READ_MEDIA"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.WRITE_MEDIA"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.CAPTURE_SCREEN"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
"src": [
|
||||
"pages/index"
|
||||
]
|
||||
}
|
@ -11,6 +11,10 @@
|
||||
{
|
||||
"name": "button_name",
|
||||
"value": "Detail"
|
||||
},
|
||||
{
|
||||
"name": "mainability_description",
|
||||
"value": "ETS_Empty Feature Ability"
|
||||
}
|
||||
]
|
||||
}
|
@ -11,6 +11,10 @@
|
||||
{
|
||||
"name": "button_name",
|
||||
"value": "查 看"
|
||||
},
|
||||
{
|
||||
"name": "mainability_description",
|
||||
"value": "ETS_Empty Feature Ability"
|
||||
}
|
||||
]
|
||||
}
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user