update screenshot code

Signed-off-by: supeng <supeng13@huawei.com>
This commit is contained in:
supeng 2022-04-25 20:15:44 +08:00
parent 0bffb80c4c
commit eef6758814
49 changed files with 2240 additions and 680 deletions

233
.eslintrc.json Normal file
View 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
View 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
}
}

View File

@ -0,0 +1,8 @@
{
"string": [
{
"name": "app_name",
"value": "screenshot"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

40
build-profile.json5 Normal file
View File

@ -0,0 +1,40 @@
{
"app": {
"compileSdkVersion": 9,
"compatibleSdkVersion": 9,
"products": [
{
"name": "default",
"signingConfig": "default"
}
],
"signingConfigs": [
{
"name": "default",
"material": {
"storePassword": "0000001627D6345E561C5124ADE619EC6DA7A8E3EEA5B00E951C5D2A5BD2CE498615DB7D3D07",
"certpath": "C:/Users/Administrator/AppData/Local/OpenHarmony/OpenHarmonyApplication.cer",
"keyAlias": "OpenHarmony Application Release",
"keyPassword": "00000016F7210C76396BEEBBD5EA3B3AC4387176AE2012D8F58DF886BCCFD3588846A9B8FB71",
"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",
],
},
],
}
],
}

View File

@ -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
}
}
}

View File

@ -0,0 +1,6 @@
{
"apiType": 'stageMode',
"buildOption": {
"arkEnable": true
}
}

View File

@ -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 {
}

View File

@ -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
View 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": {
}
}

View File

@ -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"
}
}

View File

@ -0,0 +1,10 @@
{
"module": {
"package": "com.ohos.screenshot",
"name": "common",
"type": "har",
"deviceTypes": [
"phone"
],
"uiSyntax": "ets"
}

View File

@ -0,0 +1,11 @@
{
"apiType": 'stageMode',
"buildOption": {
"arkEnable": true
},
"targets": [
{
"name": "default",
}
]
}

View File

@ -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'])
}

View File

@ -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

5
entry/phone/package-lock.json generated Normal file
View File

@ -0,0 +1,5 @@
{
"name": "entry",
"version": "1.0.0",
"lockfileVersion": 1
}

13
entry/phone/package.json Normal file
View File

@ -0,0 +1,13 @@
{
"name": "entry",
"version": "1.0.0",
"ohos": {
"org": "huawei",
"buildTool": "hvigor",
"directoryLevel": "module"
},
"description": "example description",
"repository": {},
"license": "ISC",
"dependencies": {}
}

View File

@ -1 +0,0 @@
# config module specific ProGuard rules here.

View File

@ -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"
}
}

View File

@ -0,0 +1,7 @@
import AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
}
}

View File

@ -0,0 +1,37 @@
{
"module": {
"name": "entry",
"type": "entry",
"srcEntrance": "./ets/AbilityStage.ts",
"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"
]
}
]
}
]
}
}

View File

@ -0,0 +1,6 @@
{
"apiType": 'stageMode',
"buildOption": {
"arkEnable": true
}
}

View File

@ -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')
}

View File

@ -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

View 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": {
}
}

View File

@ -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"
}
}

View File

@ -0,0 +1,10 @@
{
"module": {
"name": "recents",
"type": "har",
"deviceTypes": [
"phone",
],
"uiSyntax": "ets"
}
}

View File

@ -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
View File

@ -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
View File

@ -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

View File

@ -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.
*/
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")
}
}
// 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

View File

@ -1,6 +0,0 @@
ext {
version = [
compileSdk : 8,
compatibleSdk: 8
]
}

View File

@ -8,6 +8,6 @@
# 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=
sdk.dir=XXX
nodejs.dir=XXX
npm.dir=XXX

1643
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

15
package.json Normal file
View 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"
}
}

View File

@ -0,0 +1,11 @@
{
"apiType": 'stageMode',
"buildOption": {
"arkEnable": true
},
"targets": [
{
"name": "default",
}
]
}

View File

@ -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')
}

View File

@ -0,0 +1,17 @@
/**
* 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.
*/
// 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
View File

@ -0,0 +1,5 @@
{
"name": "screenshot",
"version": "1.0.0",
"lockfileVersion": 1
}

View File

@ -0,0 +1,11 @@
{
"devDependencies": {},
"name": "screenshot",
"ohos": {
"org": "huawei",
"directoryLevel": "module",
"buildTool": "hvigor"
},
"version": "1.0.0",
"dependencies": {}
}

View File

@ -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"
}
]
}
}

View 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');
}
}

View File

@ -12,9 +12,9 @@
* 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';

View File

@ -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'

View File

@ -0,0 +1,62 @@
{
"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",
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home",
"flag.home.intent.from.system"
],
"actions": [
"com.ohos.systemui.action.TOGGLE",
"action.system.home"
]
}
],
"visible": true,
"name": "com.ohos.screenshot.ServiceExtAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"launchType": "singleton",
"srcEntrance": "./ets/ServiceExtAbility/ServiceExtAbility.ts",
"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"
}
]
}
}

View File

@ -0,0 +1,5 @@
{
"src": [
"pages/index"
]
}

View File

@ -11,6 +11,10 @@
{
"name": "button_name",
"value": "Detail"
},
{
"name": "mainability_description",
"value": "ETS_Empty Feature Ability"
}
]
}

View File

@ -11,6 +11,10 @@
{
"name": "button_name",
"value": "查 看"
},
{
"name": "mainability_description",
"value": "ETS_Empty Feature Ability"
}
]
}