add fancynew finished
This commit is contained in:
commit
2ab2d85738
16
.gitignore
vendored
Normal file
16
.gitignore
vendored
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
*.iml
|
||||||
|
.gradle
|
||||||
|
/local.properties
|
||||||
|
/.idea/caches
|
||||||
|
/.idea/libraries
|
||||||
|
/.idea/modules.xml
|
||||||
|
/.idea/workspace.xml
|
||||||
|
/.idea/navEditor.xml
|
||||||
|
/.idea/assetWizardSettings.xml
|
||||||
|
.DS_Store
|
||||||
|
/build
|
||||||
|
/captures
|
||||||
|
.externalNativeBuild
|
||||||
|
/entry/.preview
|
||||||
|
.cxx
|
||||||
|
/node_modules
|
3
.idea/.gitignore
vendored
Normal file
3
.idea/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# 默认忽略的文件
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
6
.idea/compiler.xml
Normal file
6
.idea/compiler.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CompilerConfiguration">
|
||||||
|
<bytecodeTargetLevel target="11" />
|
||||||
|
</component>
|
||||||
|
</project>
|
24
.idea/gradle.xml
Normal file
24
.idea/gradle.xml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||||
|
<component name="GradleSettings">
|
||||||
|
<option name="linkedExternalProjectsSettings">
|
||||||
|
<GradleProjectSettings>
|
||||||
|
<option name="testRunner" value="PLATFORM" />
|
||||||
|
<option name="distributionType" value="LOCAL" />
|
||||||
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
|
<option name="gradleHome" value="C:\Program Files\Huawei\DevEco Studio 3.0.0.800\tools\gradle" />
|
||||||
|
<option name="gradleJvm" value="#JAVA_INTERNAL" />
|
||||||
|
<option name="modules">
|
||||||
|
<set>
|
||||||
|
<option value="$PROJECT_DIR$" />
|
||||||
|
<option value="$PROJECT_DIR$/Demo" />
|
||||||
|
<option value="$PROJECT_DIR$/fancynew" />
|
||||||
|
</set>
|
||||||
|
</option>
|
||||||
|
<option name="resolveModulePerSourceSet" value="false" />
|
||||||
|
<option name="useQualifiedModuleNames" value="false" />
|
||||||
|
</GradleProjectSettings>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
36
.idea/inspectionProfiles/Project_Default.xml
Normal file
36
.idea/inspectionProfiles/Project_Default.xml
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0">
|
||||||
|
<option name="myName" value="Project Default" />
|
||||||
|
<inspection_tool class="JavaDoc" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="TOP_LEVEL_CLASS_OPTIONS">
|
||||||
|
<value>
|
||||||
|
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||||
|
<option name="REQUIRED_TAGS" value="" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="INNER_CLASS_OPTIONS">
|
||||||
|
<value>
|
||||||
|
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||||
|
<option name="REQUIRED_TAGS" value="" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="METHOD_OPTIONS">
|
||||||
|
<value>
|
||||||
|
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||||
|
<option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="FIELD_OPTIONS">
|
||||||
|
<value>
|
||||||
|
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||||
|
<option name="REQUIRED_TAGS" value="" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="IGNORE_DEPRECATED" value="false" />
|
||||||
|
<option name="IGNORE_JAVADOC_PERIOD" value="true" />
|
||||||
|
<option name="IGNORE_DUPLICATED_THROWS" value="false" />
|
||||||
|
<option name="IGNORE_POINT_TO_ITSELF" value="false" />
|
||||||
|
<option name="myAdditionalJavadocTags" value="date" />
|
||||||
|
</inspection_tool>
|
||||||
|
</profile>
|
||||||
|
</component>
|
141
.idea/intellij-javadocs-4.0.1.xml
Normal file
141
.idea/intellij-javadocs-4.0.1.xml
Normal file
@ -0,0 +1,141 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="JavaDocConfiguration">
|
||||||
|
<GENERAL>
|
||||||
|
<MODE>UPDATE</MODE>
|
||||||
|
<OVERRIDDEN_METHODS>false</OVERRIDDEN_METHODS>
|
||||||
|
<SPLITTED_CLASS_NAME>true</SPLITTED_CLASS_NAME>
|
||||||
|
<LEVELS>
|
||||||
|
<LEVEL>TYPE</LEVEL>
|
||||||
|
<LEVEL>FIELD</LEVEL>
|
||||||
|
<LEVEL>METHOD</LEVEL>
|
||||||
|
</LEVELS>
|
||||||
|
<VISIBILITIES>
|
||||||
|
<VISIBILITY>DEFAULT</VISIBILITY>
|
||||||
|
<VISIBILITY>PUBLIC</VISIBILITY>
|
||||||
|
<VISIBILITY>PROTECTED</VISIBILITY>
|
||||||
|
</VISIBILITIES>
|
||||||
|
</GENERAL>
|
||||||
|
<TEMPLATES>
|
||||||
|
<CLASSES>
|
||||||
|
<CLASS>
|
||||||
|
<KEY>^.*(public|protected|private)*.+interface\s+\w+.*</KEY>
|
||||||
|
<VALUE>/**\n
|
||||||
|
* The interface ${name}.\n
|
||||||
|
<#if element.typeParameters?has_content> * \n
|
||||||
|
</#if><#list element.typeParameters as typeParameter> * @param <${typeParameter.name}> the type parameter\n
|
||||||
|
</#list> */</VALUE>
|
||||||
|
</CLASS>
|
||||||
|
<CLASS>
|
||||||
|
<KEY>^.*(public|protected|private)*.+enum\s+\w+.*</KEY>
|
||||||
|
<VALUE>/**\n
|
||||||
|
* The enum ${name}.\n
|
||||||
|
*/</VALUE>
|
||||||
|
</CLASS>
|
||||||
|
<CLASS>
|
||||||
|
<KEY>^.*(public|protected|private)*.+class\s+\w+.*</KEY>
|
||||||
|
<VALUE>/**\n
|
||||||
|
* The type ${name}.\n
|
||||||
|
<#if element.typeParameters?has_content> * \n
|
||||||
|
</#if><#list element.typeParameters as typeParameter> * @param <${typeParameter.name}> the type parameter\n
|
||||||
|
</#list> */</VALUE>
|
||||||
|
</CLASS>
|
||||||
|
<CLASS>
|
||||||
|
<KEY>.+</KEY>
|
||||||
|
<VALUE>/**\n
|
||||||
|
* The type ${name}.\n
|
||||||
|
*/</VALUE>
|
||||||
|
</CLASS>
|
||||||
|
</CLASSES>
|
||||||
|
<CONSTRUCTORS>
|
||||||
|
<CONSTRUCTOR>
|
||||||
|
<KEY>.+</KEY>
|
||||||
|
<VALUE>/**\n
|
||||||
|
* Instantiates a new ${name}.\n
|
||||||
|
<#if element.parameterList.parameters?has_content> *\n
|
||||||
|
</#if><#list element.parameterList.parameters as parameter> * @param ${parameter.name} the ${paramNames[parameter.name]}\n
|
||||||
|
</#list><#if element.throwsList.referenceElements?has_content> *\n
|
||||||
|
</#if><#list element.throwsList.referenceElements as exception> * @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
|
||||||
|
</#list> */</VALUE>
|
||||||
|
</CONSTRUCTOR>
|
||||||
|
</CONSTRUCTORS>
|
||||||
|
<METHODS>
|
||||||
|
<METHOD>
|
||||||
|
<KEY>^.*(public|protected|private)*\s*.*(\w(\s*<.+>)*)+\s+get\w+\s*\(.*\).+</KEY>
|
||||||
|
<VALUE>/**\n
|
||||||
|
* Gets ${partName}.\n
|
||||||
|
<#if element.typeParameters?has_content> * \n
|
||||||
|
</#if><#list element.typeParameters as typeParameter> * @param <${typeParameter.name}> the type parameter\n
|
||||||
|
</#list><#if element.parameterList.parameters?has_content> *\n
|
||||||
|
</#if><#list element.parameterList.parameters as parameter> * @param ${parameter.name} the ${paramNames[parameter.name]}\n
|
||||||
|
</#list><#if isNotVoid> *\n
|
||||||
|
* @return the ${partName}\n
|
||||||
|
</#if><#if element.throwsList.referenceElements?has_content> *\n
|
||||||
|
</#if><#list element.throwsList.referenceElements as exception> * @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
|
||||||
|
</#list> */</VALUE>
|
||||||
|
</METHOD>
|
||||||
|
<METHOD>
|
||||||
|
<KEY>^.*(public|protected|private)*\s*.*(void|\w(\s*<.+>)*)+\s+set\w+\s*\(.*\).+</KEY>
|
||||||
|
<VALUE>/**\n
|
||||||
|
* Sets ${partName}.\n
|
||||||
|
<#if element.typeParameters?has_content> * \n
|
||||||
|
</#if><#list element.typeParameters as typeParameter> * @param <${typeParameter.name}> the type parameter\n
|
||||||
|
</#list><#if element.parameterList.parameters?has_content> *\n
|
||||||
|
</#if><#list element.parameterList.parameters as parameter> * @param ${parameter.name} the ${paramNames[parameter.name]}\n
|
||||||
|
</#list><#if isNotVoid> *\n
|
||||||
|
* @return the ${partName}\n
|
||||||
|
</#if><#if element.throwsList.referenceElements?has_content> *\n
|
||||||
|
</#if><#list element.throwsList.referenceElements as exception> * @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
|
||||||
|
</#list> */</VALUE>
|
||||||
|
</METHOD>
|
||||||
|
<METHOD>
|
||||||
|
<KEY>^.*((public\s+static)|(static\s+public))\s+void\s+main\s*\(\s*String\s*(\[\s*\]|\.\.\.)\s+\w+\s*\).+</KEY>
|
||||||
|
<VALUE>/**\n
|
||||||
|
* The entry point of application.\n
|
||||||
|
|
||||||
|
<#if element.parameterList.parameters?has_content> *\n
|
||||||
|
</#if> * @param ${element.parameterList.parameters[0].name} the input arguments\n
|
||||||
|
<#if element.throwsList.referenceElements?has_content> *\n
|
||||||
|
</#if><#list element.throwsList.referenceElements as exception> * @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
|
||||||
|
</#list> */</VALUE>
|
||||||
|
</METHOD>
|
||||||
|
<METHOD>
|
||||||
|
<KEY>.+</KEY>
|
||||||
|
<VALUE>/**\n
|
||||||
|
* ${name}<#if isNotVoid> ${return}</#if>.\n
|
||||||
|
<#if element.typeParameters?has_content> * \n
|
||||||
|
</#if><#list element.typeParameters as typeParameter> * @param <${typeParameter.name}> the type parameter\n
|
||||||
|
</#list><#if element.parameterList.parameters?has_content> *\n
|
||||||
|
</#if><#list element.parameterList.parameters as parameter> * @param ${parameter.name} the ${paramNames[parameter.name]}\n
|
||||||
|
</#list><#if isNotVoid> *\n
|
||||||
|
* @return the ${return}\n
|
||||||
|
</#if><#if element.throwsList.referenceElements?has_content> *\n
|
||||||
|
</#if><#list element.throwsList.referenceElements as exception> * @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
|
||||||
|
</#list> */</VALUE>
|
||||||
|
</METHOD>
|
||||||
|
</METHODS>
|
||||||
|
<FIELDS>
|
||||||
|
<FIELD>
|
||||||
|
<KEY>^.*(public|protected|private)*.+static.*(\w\s\w)+.+</KEY>
|
||||||
|
<VALUE>/**\n
|
||||||
|
* The constant ${element.getName()}.\n
|
||||||
|
*/</VALUE>
|
||||||
|
</FIELD>
|
||||||
|
<FIELD>
|
||||||
|
<KEY>^.*(public|protected|private)*.*(\w\s\w)+.+</KEY>
|
||||||
|
<VALUE>/**\n
|
||||||
|
<#if element.parent.isInterface()> * The constant ${element.getName()}.\n
|
||||||
|
<#else> * The ${name}.\n
|
||||||
|
</#if> */</VALUE>
|
||||||
|
</FIELD>
|
||||||
|
<FIELD>
|
||||||
|
<KEY>.+</KEY>
|
||||||
|
<VALUE>/**\n
|
||||||
|
<#if element.parent.isEnum()> *${name} ${typeName}.\n
|
||||||
|
<#else> * The ${name}.\n
|
||||||
|
</#if>*/</VALUE>
|
||||||
|
</FIELD>
|
||||||
|
</FIELDS>
|
||||||
|
</TEMPLATES>
|
||||||
|
</component>
|
||||||
|
</project>
|
25
.idea/jarRepositories.xml
Normal file
25
.idea/jarRepositories.xml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="RemoteRepositoriesConfiguration">
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="central" />
|
||||||
|
<option name="name" value="Maven Central repository" />
|
||||||
|
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="jboss.community" />
|
||||||
|
<option name="name" value="JBoss Community repository" />
|
||||||
|
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="maven2" />
|
||||||
|
<option name="name" value="maven2" />
|
||||||
|
<option name="url" value="https://developer.huawei.com/repo/" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="maven" />
|
||||||
|
<option name="name" value="maven" />
|
||||||
|
<option name="url" value="https://repo.huaweicloud.com/repository/maven/" />
|
||||||
|
</remote-repository>
|
||||||
|
</component>
|
||||||
|
</project>
|
4
.idea/misc.xml
Normal file
4
.idea/misc.xml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
|
||||||
|
</project>
|
@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
Z
|
||||||
|
java:S2184"DCast one of the operands of this subtraction operation to a "float".(æù²ç
|
||||||
|
Z
|
||||||
|
java:S2184 "DCast one of the operands of this subtraction operation to a "float".(սɵ
|
||||||
|
W
|
||||||
|
java:S2184 "ACast one of the operands of this addition operation to a "float".(սɵ
|
||||||
|
W
|
||||||
|
java:S2184""ACast one of the operands of this addition operation to a "float".(áñùÔ
|
||||||
|
W
|
||||||
|
java:S2184""ACast one of the operands of this addition operation to a "float".(áñùÔ
|
||||||
|
_
|
||||||
|
java:S2184,"DCast one of the operands of this subtraction operation to a "float".(Ášâ‚üÿÿÿÿ
|
||||||
|
_
|
||||||
|
java:S2184,"DCast one of the operands of this subtraction operation to a "float".(Ášâ‚üÿÿÿÿ
|
@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
\
|
||||||
|
java:S2184'"ACast one of the operands of this addition operation to a "float".(‚ãŒÊüÿÿÿÿ
|
||||||
|
_
|
||||||
|
java:S2184="DCast one of the operands of this subtraction operation to a "float".(Š֙øÿÿÿÿ
|
||||||
|
]
|
||||||
|
java:S2184>"GCast one of the operands of this multiplication operation to a "float".(†žã
|
@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
—
|
||||||
|
java:S1186"€Add a nested comment explaining why this method is empty, throw an UnsupportedOperationException or complete the implementation.(õæÛÝ
|
||||||
|
h
|
||||||
|
java:S3776;"RRefactor this method to reduce its Cognitive Complexity from 23 to the 15 allowed.(Ń<C385>‰
|
||||||
|
_
|
||||||
|
java:S2184+"DCast one of the operands of this subtraction operation to a "float".(ƒû÷Ôÿÿÿÿÿ
|
||||||
|
Z
|
||||||
|
java:S2184E"DCast one of the operands of this subtraction operation to a "float".(Þò«Ÿ
|
||||||
|
Z
|
||||||
|
java:S2184G"DCast one of the operands of this subtraction operation to a "float".(–¡Óõ
|
||||||
|
`
|
||||||
|
java:S2184Š"DCast one of the operands of this subtraction operation to a "float".(Š֙øÿÿÿÿ
|
||||||
|
^
|
||||||
|
java:S2184‹"GCast one of the operands of this multiplication operation to a "float".(†žã
|
@ -0,0 +1,29 @@
|
|||||||
|
|
||||||
|
œ
|
||||||
|
java:S1186"€Add a nested comment explaining why this method is empty, throw an UnsupportedOperationException or complete the implementation.(×™”Çþÿÿÿÿ
|
||||||
|
_
|
||||||
|
java:S2184"DCast one of the operands of this subtraction operation to a "float".(Ø×ö€ûÿÿÿÿ
|
||||||
|
_
|
||||||
|
java:S2184"DCast one of the operands of this subtraction operation to a "float".(Ø×ö€ûÿÿÿÿ
|
||||||
|
\
|
||||||
|
java:S2184$"ACast one of the operands of this addition operation to a "float".(‚ãŒÊüÿÿÿÿ
|
||||||
|
_
|
||||||
|
java:S2184;"DCast one of the operands of this subtraction operation to a "float".(Š֙øÿÿÿÿ
|
||||||
|
]
|
||||||
|
java:S2184<"GCast one of the operands of this multiplication operation to a "float".(†žã
|
||||||
|
X
|
||||||
|
java:S2184’"ACast one of the operands of this addition operation to a "float".(Ƴɗ
|
||||||
|
X
|
||||||
|
java:S2184ž"ACast one of the operands of this addition operation to a "float".(Ƴɗ
|
||||||
|
]
|
||||||
|
java:S2184 "ACast one of the operands of this addition operation to a "float".(¸¼À«úÿÿÿÿ
|
||||||
|
`
|
||||||
|
java:S2184£"DCast one of the operands of this subtraction operation to a "float".(®£ˆËýÿÿÿÿ
|
||||||
|
]
|
||||||
|
java:S2184¿"ACast one of the operands of this addition operation to a "float".(¤Âȯûÿÿÿÿ
|
||||||
|
]
|
||||||
|
java:S2184Ç"ACast one of the operands of this addition operation to a "float".(¤Âȯûÿÿÿÿ
|
||||||
|
X
|
||||||
|
java:S2184É"ACast one of the operands of this addition operation to a "float".(«¸Ïì
|
||||||
|
[
|
||||||
|
java:S2184Ë"DCast one of the operands of this subtraction operation to a "float".( ÎÕ‚
|
@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
t
|
||||||
|
java:S11717"YMove the contents of this initializer to a standard constructor or to field initializers.(ÒÌâ–øÿÿÿÿ
|
||||||
|
H
|
||||||
|
java:S1602¨",Remove useless curly braces around statement(ƒÌ†ûþÿÿÿÿ
|
||||||
|
K
|
||||||
|
java:S1172Ç"/Remove this unused method parameter "activity".(ºö”°úÿÿÿÿ
|
||||||
|
M
|
||||||
|
java:S2696à"6Make the enclosing method "static" or remove this set.(ð¯¿ÿ
|
||||||
|
p
|
||||||
|
java:S1104×"YMake mDrawStrategy a static final constant or non-public and provide accessors if needed.(ʱ°¥
|
||||||
|
J
|
||||||
|
java:S1444×"3Make this "public static mDrawStrategy" field final(ʱ°¥
|
@ -0,0 +1,21 @@
|
|||||||
|
|
||||||
|
Z
|
||||||
|
java:S2184"DCast one of the operands of this subtraction operation to a "float".(å•Í„
|
||||||
|
Z
|
||||||
|
java:S2184"DCast one of the operands of this subtraction operation to a "float".(âÈ”ä
|
||||||
|
Z
|
||||||
|
java:S2184""DCast one of the operands of this subtraction operation to a "float".(–ʪ
|
||||||
|
W
|
||||||
|
java:S2184""ACast one of the operands of this addition operation to a "float".(–ʪ
|
||||||
|
_
|
||||||
|
java:S2184$"DCast one of the operands of this subtraction operation to a "float".(žÚàØýÿÿÿÿ
|
||||||
|
\
|
||||||
|
java:S2184$"ACast one of the operands of this addition operation to a "float".(žÚàØýÿÿÿÿ
|
||||||
|
W
|
||||||
|
java:S2184)"ACast one of the operands of this addition operation to a "float".(¸Á‚ê
|
||||||
|
W
|
||||||
|
java:S2184)"ACast one of the operands of this addition operation to a "float".(¸Á‚ê
|
||||||
|
W
|
||||||
|
java:S2184+"ACast one of the operands of this addition operation to a "float".(¸ØÚ»
|
||||||
|
W
|
||||||
|
java:S2184+"ACast one of the operands of this addition operation to a "float".(¸ØÚ»
|
@ -0,0 +1,27 @@
|
|||||||
|
|
||||||
|
œ
|
||||||
|
java:S1186"€Add a nested comment explaining why this method is empty, throw an UnsupportedOperationException or complete the implementation.(ÿ»‹÷ýÿÿÿÿ
|
||||||
|
\
|
||||||
|
java:S2184("ACast one of the operands of this addition operation to a "float".(‚ãŒÊüÿÿÿÿ
|
||||||
|
_
|
||||||
|
java:S2184<"DCast one of the operands of this subtraction operation to a "float".(ăÙàûÿÿÿÿ
|
||||||
|
_
|
||||||
|
java:S2184<"DCast one of the operands of this subtraction operation to a "float".(ăÙàûÿÿÿÿ
|
||||||
|
Z
|
||||||
|
java:S2184@"DCast one of the operands of this subtraction operation to a "float".(“èÉ°
|
||||||
|
Z
|
||||||
|
java:S2184@"DCast one of the operands of this subtraction operation to a "float".(“èÉ°
|
||||||
|
Y
|
||||||
|
java:S2184E"DCast one of the operands of this subtraction operation to a "float".(õµ–
|
||||||
|
Y
|
||||||
|
java:S2184E"DCast one of the operands of this subtraction operation to a "float".(õµ–
|
||||||
|
Z
|
||||||
|
java:S2184G"DCast one of the operands of this subtraction operation to a "float".(“èÉ°
|
||||||
|
Z
|
||||||
|
java:S2184G"DCast one of the operands of this subtraction operation to a "float".(“èÉ°
|
||||||
|
Z
|
||||||
|
java:S2184X"DCast one of the operands of this subtraction operation to a "float".(ôýí›
|
||||||
|
W
|
||||||
|
java:S2184X"ACast one of the operands of this division operation to a "float".(ôýí›
|
||||||
|
]
|
||||||
|
java:S2184Y"GCast one of the operands of this multiplication operation to a "float".(†žã
|
@ -0,0 +1,3 @@
|
|||||||
|
|
||||||
|
_
|
||||||
|
java:S1659"DDeclare "button2" and all following declarations on a separate line.(í’Äìûÿÿÿÿ
|
49
.idea/sonarlint/issuestore/index.pb
Normal file
49
.idea/sonarlint/issuestore/index.pb
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
|
||||||
|
q
|
||||||
|
Afancynew/src/main/java/com/xcl/fancynew/RotationDrawStrategy.java,5\8\585392fa3d94f566bb1188394b562f14c6c9c488
|
||||||
|
v
|
||||||
|
Ffancynew/src/main/java/com/xcl/fancynew/RedYellowBlueDrawStrategy.java,2\5\250571f0f87559b2091f2a1692763278afeb5afb
|
||||||
|
z
|
||||||
|
Jfancynew/src/main/java/com/xcl/fancynew/RYBDrawStrategyStateInterface.java,f\8\f8a4642d88a920830a9a5d269289fbddeed487ec
|
||||||
|
{
|
||||||
|
Kfancynew/src/main/java/com/xcl/fancynew/RYBDrawStrategyStateController.java,d\8\d8a0658202903cb6af169d1b46330efa49b57afa
|
||||||
|
i
|
||||||
|
9fancynew/src/main/java/com/xcl/fancynew/DrawStrategy.java,5\3\530e3d0118f93ca6363986e498e66cf6a9552b02
|
||||||
|
o
|
||||||
|
?fancynew/src/main/java/com/xcl/fancynew/NormalDrawStrategy.java,b\e\be63dba01d86effd49ca8041c3d8bd6245b18f2e
|
||||||
|
m
|
||||||
|
=fancynew/src/main/java/com/xcl/fancynew/LineDrawStrategy.java,3\a\3abf8fc6d4addad7016ee72786ba18c965730a9e
|
||||||
|
t
|
||||||
|
Dfancynew/src/main/java/com/xcl/fancynew/RYBDrawStrategyStateTwo.java,0\f\0f1a74f5c1730682867e957b5e243b319d097e29
|
||||||
|
q
|
||||||
|
Afancynew/src/main/java/com/xcl/fancynew/WidthAndHeightOfView.java,7\4\744ad0ac78a55070067dbd8ee88efd07fafd62ec
|
||||||
|
X
|
||||||
|
(gradle/wrapper/gradle-wrapper.properties,f\b\fbe448ebfc3eb2d4e308f6b8b043666f5b57235e
|
||||||
|
r
|
||||||
|
Bfancynew/src/main/java/com/xcl/fancynew/OpeningStartAnimation.java,7\c\7c9ed26b5c5f61daf6ceefd22f095b26ac128237
|
||||||
|
h
|
||||||
|
8fancynew/src/main/java/com/xcl/fancynew/BitmapUtils.java,b\2\b2cea52dbbd1251915826ea405e6edaf8a73960b
|
||||||
|
`
|
||||||
|
0Demo/src/main/java/com/xcl/demo/MainAbility.java,c\4\c451ae50c69015c64c4957c95c9965ddec52f515
|
||||||
|
p
|
||||||
|
@fancynew/src/main/java/com/xcl/fancynew/DelegateRecycleView.java,4\b\4bd8280964f017b9a6ec044a2187e759ea0ffefb
|
||||||
|
<
|
||||||
|
package.json,7\0\7030d0b2f71b999ff89a343de08c414af32fc93a
|
||||||
|
K
|
||||||
|
fancynew/proguard-rules.pro,d\1\d1b5eed5db1d2cf5d35a4b27b455e4f2de4b557f
|
||||||
|
A
|
||||||
|
Demo/build.gradle,1\6\1611a668fe7133fd3896efd5dfce61a46708945a
|
||||||
|
G
|
||||||
|
Demo/proguard-rules.pro,1\6\1659e47be1c6c99e0be0d0c8dc5f92b5a0aca548
|
||||||
|
E
|
||||||
|
fancynew/build.gradle,8\d\8dcc5b5af7ca5afe9d2f8b77b22d47a0c53f5d67
|
||||||
|
t
|
||||||
|
Dfancynew/src/main/java/com/xcl/fancynew/RYBDrawStrategyStateOne.java,b\1\b1b43c8633105aa0b5562f04a6c01aa962e3604b
|
||||||
|
M
|
||||||
|
fancynew/src/main/config.json,d\9\d9db31e200a87f24da2444f2622f0cc3600ceee9
|
||||||
|
I
|
||||||
|
Demo/src/main/config.json,c\5\c5f428a73cf2c1f94982b30571dfeb78d3e9b79a
|
||||||
|
<
|
||||||
|
build.gradle,f\0\f07866736216be0ee2aba49e392191aeae700a35
|
||||||
|
9
|
||||||
|
README.md,8\e\8ec9a00bfd09b3190ac6b22251dbb1aa95a0579d
|
2
Demo/.gitignore
vendored
Normal file
2
Demo/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/build
|
||||||
|
/node_modules
|
33
Demo/build.gradle
Normal file
33
Demo/build.gradle
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
apply plugin: 'com.huawei.ohos.hap'
|
||||||
|
apply plugin: 'com.huawei.ohos.decctest'
|
||||||
|
//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510
|
||||||
|
ohos {
|
||||||
|
compileSdkVersion 6
|
||||||
|
defaultConfig {
|
||||||
|
compatibleSdkVersion 5
|
||||||
|
}
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
proguardOpt {
|
||||||
|
proguardEnabled true
|
||||||
|
rulesFiles 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
debug {
|
||||||
|
proguardOpt {
|
||||||
|
proguardEnabled true
|
||||||
|
rulesFiles 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation fileTree(dir: 'libs', include: ['*.jar', '*.har'])
|
||||||
|
testImplementation 'junit:junit:4.13.1'
|
||||||
|
ohosTestImplementation 'com.huawei.ohos.testkit:runner:2.0.0.200'
|
||||||
|
implementation project(':fancynew')
|
||||||
|
}
|
||||||
|
decc {
|
||||||
|
supportType = ['html','xml']
|
||||||
|
}
|
66
Demo/proguard-rules.pro
vendored
Normal file
66
Demo/proguard-rules.pro
vendored
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
-dontwarn
|
||||||
|
# 代码混淆压缩比,在0~7之间
|
||||||
|
-optimizationpasses 5
|
||||||
|
# 混合时不使用大小写混合,混合后的类名为小写
|
||||||
|
-dontusemixedcaseclassnames
|
||||||
|
# 在读取依赖的库文件时,不要略过那些非public类成员
|
||||||
|
-dontskipnonpubliclibraryclassmembers
|
||||||
|
# 指定不去忽略非公共库的类
|
||||||
|
-dontskipnonpubliclibraryclasses
|
||||||
|
# 不做预校验,preverify是proguard的四个步骤之一,去掉这一步能够加快混淆速度。
|
||||||
|
-dontpreverify
|
||||||
|
-verbose
|
||||||
|
# google推荐算法
|
||||||
|
-optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/*
|
||||||
|
# 保留注解、内部类、泛型、匿名类
|
||||||
|
-keepattributes *Annotation*,Exceptions,InnerClasses,Signature,EnclosingMethod
|
||||||
|
# 重命名抛出异常时的文件名称
|
||||||
|
-renamesourcefileattribute SourceFile
|
||||||
|
# 抛出异常时保留代码行号
|
||||||
|
-keepattributes SourceFile,LineNumberTable
|
||||||
|
-dontwarn javax.annotation.**
|
||||||
|
# 保留本地native方法不被混淆
|
||||||
|
-keepclasseswithmembernames,allowshrinking class * {
|
||||||
|
native <methods>;
|
||||||
|
}
|
||||||
|
# 保留枚举类不被混淆
|
||||||
|
-keepclassmembers enum * {
|
||||||
|
public static **[] values();
|
||||||
|
public static ** valueOf(java.lang.String);
|
||||||
|
}
|
||||||
|
# 忽略继承
|
||||||
|
-keepclassmembers class * implements java.io.Serializable {
|
||||||
|
static final long serialVersionUID;
|
||||||
|
private static final java.io.ObjectStreamField[] serialPersistentFields;
|
||||||
|
private void writeObject(java.io.ObjectOutputStream);
|
||||||
|
private void readObject(java.io.ObjectInputStream);
|
||||||
|
java.lang.Object writeReplace();
|
||||||
|
java.lang.Object readResolve();
|
||||||
|
}
|
||||||
|
# 保留HMS相关接入[AnalyticsKit SDK和依赖SDK的混淆配置]
|
||||||
|
-ignorewarnings
|
||||||
|
-repackageclasses
|
||||||
|
-keep class com.huawei.agconnect.**{*;}
|
||||||
|
-keep class com.huawei.hms.analytics.**{*;}
|
||||||
|
-keep class com.huawei.hms.push.**{*;}
|
||||||
|
-keep class com.huawei.hms.**{*;}
|
||||||
|
# HMS接口服务
|
||||||
|
-keepattributes Exceptions
|
||||||
|
-keep interface com.huawei.hms.analytics.type.HAEventType{*;}
|
||||||
|
-keep interface com.huawei.hms.analytics.type.HAParamType{*;}
|
||||||
|
-keep class com.huawei.hms.analytics.HiAnalyticsInstance{*;}
|
||||||
|
-keep class com.huawei.hms.analytics.HiAnalytics{*;}
|
||||||
|
-keep class com.huawei.hianalytics.**{*;}
|
||||||
|
-keep class com.huawei.updatesdk.**{*;}
|
||||||
|
-keep class com.huawei.harmony.**{*;}
|
||||||
|
-keep class com.huawei.mylibrary.**{*;}
|
||||||
|
# 保留HarmonyOS应用/服务入口类
|
||||||
|
-keep public class * extends *.aafwk.ability.Ability
|
||||||
|
-keep public class * extends *.ace.ability.AceAbility
|
||||||
|
-keep public class * extends *.aafwk.ability.AbilitySlice
|
||||||
|
-keep public class * extends *.aafwk.ability.AbilityPackage
|
||||||
|
-dontwarn java.lang.invoke.**
|
||||||
|
-dontwarn javax.naming.**
|
||||||
|
-keepattributes Signature, InnerClasses, EnclosingMethod, Exceptions
|
||||||
|
# 保留配置文件
|
||||||
|
-printmapping mapping.txt
|
49
Demo/src/main/config.json
Normal file
49
Demo/src/main/config.json
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
{
|
||||||
|
"app": {
|
||||||
|
"bundleName":"com.xcl.demo",
|
||||||
|
"vendor": "tzx",
|
||||||
|
"version": {
|
||||||
|
"code": 1932,
|
||||||
|
"name": "1.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deviceConfig": {},
|
||||||
|
"module": {
|
||||||
|
"package": "com.xcl.demo",
|
||||||
|
"name": ".MyApplication",
|
||||||
|
"mainAbility": "com.xcl.demo.MainAbility",
|
||||||
|
"deviceType": [
|
||||||
|
"phone",
|
||||||
|
"tablet",
|
||||||
|
"wearable"
|
||||||
|
],
|
||||||
|
"distro": {
|
||||||
|
"deliveryWithInstall": true,
|
||||||
|
"moduleName": "Demo",
|
||||||
|
"moduleType": "entry",
|
||||||
|
"installationFree": false
|
||||||
|
},
|
||||||
|
"abilities": [
|
||||||
|
{
|
||||||
|
"skills": [
|
||||||
|
{
|
||||||
|
"entities": [
|
||||||
|
"entity.system.home"
|
||||||
|
],
|
||||||
|
"actions": [
|
||||||
|
"action.system.home"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"orientation": "unspecified",
|
||||||
|
"visible": true,
|
||||||
|
"name": "com.xcl.demo.MainAbility",
|
||||||
|
"icon": "$media:icon",
|
||||||
|
"description": "$string:mainability_description",
|
||||||
|
"label": "$string:Demo_MainAbility",
|
||||||
|
"type": "page",
|
||||||
|
"launchType": "standard"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
97
Demo/src/main/java/com/xcl/demo/MainAbility.java
Normal file
97
Demo/src/main/java/com/xcl/demo/MainAbility.java
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
package com.xcl.demo;
|
||||||
|
|
||||||
|
import com.xcl.fancynew.*;
|
||||||
|
import ohos.aafwk.ability.Ability;
|
||||||
|
import ohos.aafwk.content.Intent;
|
||||||
|
import ohos.agp.components.Button;
|
||||||
|
import ohos.agp.components.Component;
|
||||||
|
import ohos.agp.utils.Color;
|
||||||
|
import ohos.global.resource.NotExistException;
|
||||||
|
import ohos.media.image.ImageSource;
|
||||||
|
import ohos.media.image.PixelMap;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Main ability.
|
||||||
|
*
|
||||||
|
* @author Xcl
|
||||||
|
* @version 1.2
|
||||||
|
* @package com.xcl.fancynew
|
||||||
|
*/
|
||||||
|
public class MainAbility extends Ability implements Component.ClickedListener {
|
||||||
|
@Override
|
||||||
|
public void onStart(Intent intent) {
|
||||||
|
super.onStart(intent);
|
||||||
|
super.setUIContent(ResourceTable.Layout_ability_main);
|
||||||
|
|
||||||
|
Button button1, button2, button3, button4;
|
||||||
|
button1 = (Button) findComponentById(ResourceTable.Id_button_normal);
|
||||||
|
button2 = (Button) findComponentById(ResourceTable.Id_button_ryb);
|
||||||
|
button3 = (Button) findComponentById(ResourceTable.Id_button_line);
|
||||||
|
button4 = (Button) findComponentById(ResourceTable.Id_button_rotation);
|
||||||
|
|
||||||
|
button1.setClickedListener(this);
|
||||||
|
button2.setClickedListener(this);
|
||||||
|
button3.setClickedListener(this);
|
||||||
|
button4.setClickedListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private PixelMap getPixelMapFromResource(int resourceId) {
|
||||||
|
InputStream inputStream = null;
|
||||||
|
try {
|
||||||
|
// 创建图像数据源ImageSource对象
|
||||||
|
inputStream = getContext().getResourceManager().getResource(resourceId);
|
||||||
|
ImageSource.SourceOptions srcOpts = new ImageSource.SourceOptions();
|
||||||
|
srcOpts.formatHint = "image/png";
|
||||||
|
ImageSource imageSource = ImageSource.create(inputStream, srcOpts);
|
||||||
|
// 设置图片参数
|
||||||
|
ImageSource.DecodingOptions decodingOptions = new ImageSource.DecodingOptions();
|
||||||
|
return imageSource.createPixelmap(decodingOptions);
|
||||||
|
} catch (IOException | NotExistException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(Component component) {
|
||||||
|
switch (component.getId()) {
|
||||||
|
case ResourceTable.Id_button_normal:
|
||||||
|
OpeningStartAnimation openingStartAnimation = new OpeningStartAnimation.Builder(this, ResourceTable.Media_icon, 1)
|
||||||
|
.setDrawStategy(new NormalDrawStrategy())
|
||||||
|
.setAppIcon(getPixelMapFromResource(ResourceTable.Media_icon))
|
||||||
|
.setAppName("测试APP")
|
||||||
|
.setColorOfBackground(Color.rgb(255, 0, 0))
|
||||||
|
.setColorOfAppIcon(Color.rgb(255, 0, 0))
|
||||||
|
.setColorOfAppName(Color.rgb(0, 237, 255))
|
||||||
|
.setColorOfAppStatement(Color.rgb(68, 255, 0))
|
||||||
|
.create();
|
||||||
|
openingStartAnimation.show(this);
|
||||||
|
break;
|
||||||
|
case ResourceTable.Id_button_ryb:
|
||||||
|
OpeningStartAnimation openingStartAnimation1 = new OpeningStartAnimation.Builder(this, ResourceTable.Media_icon, 2)
|
||||||
|
.setDrawStategy(new RedYellowBlueDrawStrategy())
|
||||||
|
.setColorOfBackground(Color.BLACK.getValue())
|
||||||
|
.create();
|
||||||
|
openingStartAnimation1.show(this);
|
||||||
|
break;
|
||||||
|
case ResourceTable.Id_button_line:
|
||||||
|
OpeningStartAnimation openingStartAnimation2 = new OpeningStartAnimation.Builder(this, ResourceTable.Media_icon, 3)
|
||||||
|
.setDrawStategy(new LineDrawStrategy())
|
||||||
|
.setAppIcon(getPixelMapFromResource(ResourceTable.Media_icon))
|
||||||
|
.create();
|
||||||
|
openingStartAnimation2.show(this);
|
||||||
|
break;
|
||||||
|
case ResourceTable.Id_button_rotation:
|
||||||
|
OpeningStartAnimation openingStartAnimation3 = new OpeningStartAnimation.Builder(this, ResourceTable.Media_icon)
|
||||||
|
.setDrawStategy(new RotationDrawStrategy())
|
||||||
|
.create();
|
||||||
|
openingStartAnimation3.show(this);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
17
Demo/src/main/java/com/xcl/demo/MyApplication.java
Normal file
17
Demo/src/main/java/com/xcl/demo/MyApplication.java
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
package com.xcl.demo;
|
||||||
|
|
||||||
|
import ohos.aafwk.ability.AbilityPackage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type My application.
|
||||||
|
*
|
||||||
|
* @author Xcl
|
||||||
|
* @version 1.2
|
||||||
|
* @package com.xcl.fancynew
|
||||||
|
*/
|
||||||
|
public class MyApplication extends AbilityPackage {
|
||||||
|
@Override
|
||||||
|
public void onInitialize() {
|
||||||
|
super.onInitialize();
|
||||||
|
}
|
||||||
|
}
|
16
Demo/src/main/resources/base/element/string.json
Normal file
16
Demo/src/main/resources/base/element/string.json
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"string": [
|
||||||
|
{
|
||||||
|
"name": "Demo_MainAbility",
|
||||||
|
"value": "FancyNew示例"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "mainability_description",
|
||||||
|
"value": "Java_Empty Ability"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "mainability_HelloWorld",
|
||||||
|
"value": "Hello World"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<shape
|
||||||
|
xmlns:ohos="http://schemas.huawei.com/res/ohos"
|
||||||
|
ohos:shape="rectangle">
|
||||||
|
|
||||||
|
<solid
|
||||||
|
ohos:color="#FFFFFF"/>
|
||||||
|
</shape>
|
48
Demo/src/main/resources/base/layout/ability_main.xml
Normal file
48
Demo/src/main/resources/base/layout/ability_main.xml
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<DirectionalLayout
|
||||||
|
xmlns:ohos="http://schemas.huawei.com/res/ohos"
|
||||||
|
ohos:height="match_parent"
|
||||||
|
ohos:width="match_parent"
|
||||||
|
ohos:orientation="vertical">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
ohos:id="$+id:button_normal"
|
||||||
|
ohos:height="match_content"
|
||||||
|
ohos:width="match_parent"
|
||||||
|
ohos:background_element="#30000000"
|
||||||
|
ohos:bottom_margin="10vp"
|
||||||
|
ohos:padding="10vp"
|
||||||
|
ohos:text="NormalDraw"
|
||||||
|
ohos:text_size="16fp"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
ohos:id="$+id:button_ryb"
|
||||||
|
ohos:height="match_content"
|
||||||
|
ohos:width="match_parent"
|
||||||
|
ohos:background_element="#30000000"
|
||||||
|
ohos:bottom_margin="10vp"
|
||||||
|
ohos:padding="10vp"
|
||||||
|
ohos:text="RYBDraw"
|
||||||
|
ohos:text_size="16fp"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
ohos:id="$+id:button_line"
|
||||||
|
ohos:height="match_content"
|
||||||
|
ohos:width="match_parent"
|
||||||
|
ohos:background_element="#30000000"
|
||||||
|
ohos:bottom_margin="10vp"
|
||||||
|
ohos:padding="10vp"
|
||||||
|
ohos:text="LineDraw"
|
||||||
|
ohos:text_size="16fp"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
ohos:id="$+id:button_rotation"
|
||||||
|
ohos:height="match_content"
|
||||||
|
ohos:width="match_parent"
|
||||||
|
ohos:background_element="#30000000"
|
||||||
|
ohos:bottom_margin="10vp"
|
||||||
|
ohos:padding="10vp"
|
||||||
|
ohos:text="RotationDraw"
|
||||||
|
ohos:text_size="16fp"/>
|
||||||
|
|
||||||
|
</DirectionalLayout>
|
BIN
Demo/src/main/resources/base/media/icon.png
Normal file
BIN
Demo/src/main/resources/base/media/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.6 KiB |
14
Demo/src/ohosTest/java/com/xcl/demo/ExampleOhosTest.java
Normal file
14
Demo/src/ohosTest/java/com/xcl/demo/ExampleOhosTest.java
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
package com.xcl.demo;
|
||||||
|
|
||||||
|
import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
public class ExampleOhosTest {
|
||||||
|
@Test
|
||||||
|
public void testBundleName() {
|
||||||
|
final String actualBundleName = AbilityDelegatorRegistry.getArguments().getTestBundleName();
|
||||||
|
assertEquals("", actualBundleName);
|
||||||
|
}
|
||||||
|
}
|
9
Demo/src/test/java/com/xcl/demo/ExampleTest.java
Normal file
9
Demo/src/test/java/com/xcl/demo/ExampleTest.java
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
package com.xcl.demo;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class ExampleTest {
|
||||||
|
@Test
|
||||||
|
public void onStart() {
|
||||||
|
}
|
||||||
|
}
|
201
LICENSE
Normal file
201
LICENSE
Normal file
@ -0,0 +1,201 @@
|
|||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright {yyyy} {name of copyright owner}
|
||||||
|
|
||||||
|
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.
|
98
README.md
Normal file
98
README.md
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
# FancyNew
|
||||||
|
|
||||||
|
**本项目是基于开源项目FancyView进行ohos化的移植和改进的,可以通过Github地址( https://github.com/wongzy/FancyView )追踪到原项目版本**
|
||||||
|
|
||||||
|
#### 项目介绍
|
||||||
|
|
||||||
|
- 项目名称:FancyNew
|
||||||
|
- 所属系列:ohos的第三方组件适配移植
|
||||||
|
- 功能:应用打开动画
|
||||||
|
- 项目移植状态:完成
|
||||||
|
- 调用差异:新增、更改部分语法,详见下方介绍
|
||||||
|
- 项目作者和维护人:田梓萱
|
||||||
|
- 联系方式:xcl@xuegao-tzx.top
|
||||||
|
- 原项目Doc地址:https://github.com/wongzy/FancyView
|
||||||
|
- 原项目基线版本:无release版本
|
||||||
|
- 编程语言:Java
|
||||||
|
- 外部库依赖:无
|
||||||
|
|
||||||
|
#### 功能介绍与差异:
|
||||||
|
|
||||||
|
1. 支持自动根据设备状态改变背景颜色[默认]
|
||||||
|
2. 支持用户自定义显示数据项[全显示(默认)、只显示图标、只显示图标和APP名字]
|
||||||
|
3. 兼容API5和6,支持开箱即用
|
||||||
|
4. 由于鸿蒙不提供获取APP名字途径,故不显示APP包名,需要手动调用进行设置,详见Demo示例
|
||||||
|
5. 设置动画图标有2种写法,详见Demo示例
|
||||||
|
|
||||||
|
|
||||||
|
#### 安装教程
|
||||||
|
|
||||||
|
##### 方案一:
|
||||||
|
|
||||||
|
1. 下载依赖库 FancyNew.har。
|
||||||
|
2. 启动 DevEco Studio,将编译的har包,导入工程目录“entry->libs”下。
|
||||||
|
3. 在moudle级别下的build.gradle文件中添加依赖,在dependences标签中增加对libs目录下har包的引用。
|
||||||
|
```
|
||||||
|
dependencies {
|
||||||
|
implementation fileTree(dir: 'libs', include: ['*.jar', '*.har'])
|
||||||
|
……
|
||||||
|
}
|
||||||
|
```
|
||||||
|
4.在导入的har包上点击右键,选择“Add as Library”对包进行引用,选择需要引用的模块,并点击“OK”即引用成功。
|
||||||
|
|
||||||
|
##### 方案二:
|
||||||
|
1. 克隆本仓库到本地
|
||||||
|
2. 启动 DevEco Studio,左上角点击:文件-新建-导入模块
|
||||||
|
3. 在应用模块的build.gradle的dependencies闭包中,添加如下代码:
|
||||||
|
```
|
||||||
|
dependencies {
|
||||||
|
implementation project(':fancynew')
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 使用说明
|
||||||
|
1、使用方法
|
||||||
|
```java
|
||||||
|
OpeningStartAnimation openingStartAnimation = new OpeningStartAnimation.Builder(this,ResourceTable.Media_icon,1)//设置图标`ResourceTable.Media_icon`以及要显示的模块数量`1`[模块数量可不填(默认全部显示)]
|
||||||
|
.setDrawStategy(new NormalDrawStrategy())//设置动画效果
|
||||||
|
.setAppIcon(getPixelMapFromResource(ResourceTable.Media_icon))//设置动画图标
|
||||||
|
.setAppName("测试APP")//设置APP名字
|
||||||
|
.setColorOfBackground(Color.rgb(255,0,0))//设置背景颜色
|
||||||
|
.setColorOfAppIcon(Color.rgb(255,0,0))//设置图标圈线的颜色
|
||||||
|
.setColorOfAppName(Color.rgb(0,237,255))//设置APP名字颜色
|
||||||
|
.setColorOfAppStatement(Color.rgb(68,255,0))//设置下方一句话的颜色
|
||||||
|
.create();
|
||||||
|
openingStartAnimation.show(this);
|
||||||
|
```
|
||||||
|
2、除此之外,还可以设置文字、图标、一句话描述、动画时间等等,也可以自定义应用打开动画,开放了策略接口,像这样。
|
||||||
|
```java
|
||||||
|
OpeningStartAnimation openingStartAnimation = new OpeningStartAnimation.Builder(this,ResourceTable.Media_icon,1)
|
||||||
|
.setDrawStategy(new DrawStrategy() {
|
||||||
|
@Override
|
||||||
|
public void drawAppName(Canvas canvas, float fraction, String name, int colorOfAppName, WidthAndHeightOfView widthAndHeightOfView) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawAppIcon(Canvas canvas, float fraction, PixelMap icon, int colorOfIcon, WidthAndHeightOfView widthAndHeightOfView) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawAppStatement(Canvas canvas, float fraction, String statement, int colorOfStatement, WidthAndHeightOfView widthAndHeightOfView) {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.create();
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 混淆相关
|
||||||
|
1. fancynew的包不建议单独混淆,如确实需要混淆请务必保留类名,加入代码如下:
|
||||||
|
```json
|
||||||
|
-dontwarn com.xcl.fancynew.**
|
||||||
|
-keep class com.xcl.fancynew.** { *; }
|
||||||
|
```
|
||||||
|
2. 整体项目中混淆无要求,你随意
|
||||||
|
|
||||||
|
#### 版权和许可信息
|
||||||
|
- Apache Licence
|
37
build.gradle
Normal file
37
build.gradle
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
apply plugin: 'com.huawei.ohos.app'
|
||||||
|
|
||||||
|
//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510
|
||||||
|
ohos {
|
||||||
|
compileSdkVersion 6
|
||||||
|
defaultConfig {
|
||||||
|
compatibleSdkVersion 5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
url 'https://repo.huaweicloud.com/repository/maven/'
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
url 'https://developer.huawei.com/repo/'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath 'com.huawei.ohos:hap:3.0.5.2'
|
||||||
|
classpath 'com.huawei.ohos:decctest:1.2.7.2'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
allprojects {
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
url 'https://repo.huaweicloud.com/repository/maven/'
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
url 'https://developer.huawei.com/repo/'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
2
fancynew/.gitignore
vendored
Normal file
2
fancynew/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/build
|
||||||
|
/node_modules
|
27
fancynew/build.gradle
Normal file
27
fancynew/build.gradle
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
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 6
|
||||||
|
defaultConfig {
|
||||||
|
compatibleSdkVersion 5
|
||||||
|
}
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
proguardOpt {
|
||||||
|
proguardEnabled false
|
||||||
|
rulesFiles 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
debug {
|
||||||
|
proguardOpt {
|
||||||
|
proguardEnabled false
|
||||||
|
rulesFiles 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
testImplementation 'junit:junit:4.13.1'
|
||||||
|
}
|
1
fancynew/consumer-rules.pro
Normal file
1
fancynew/consumer-rules.pro
Normal file
@ -0,0 +1 @@
|
|||||||
|
# Add har specific ProGuard rules for consumer here.
|
0
fancynew/proguard-rules.pro
vendored
Normal file
0
fancynew/proguard-rules.pro
vendored
Normal file
27
fancynew/src/main/config.json
Normal file
27
fancynew/src/main/config.json
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"app": {
|
||||||
|
"bundleName": "com.xcl.fancynew",
|
||||||
|
"vendor": "tzx",
|
||||||
|
"version": {
|
||||||
|
"code": 1830,
|
||||||
|
"name": "1.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deviceConfig": {
|
||||||
|
},
|
||||||
|
"module": {
|
||||||
|
"package": "com.xcl.fancynew",
|
||||||
|
"deviceType": [
|
||||||
|
"phone",
|
||||||
|
"tablet",
|
||||||
|
"tv",
|
||||||
|
"wearable",
|
||||||
|
"car"
|
||||||
|
],
|
||||||
|
"distro": {
|
||||||
|
"deliveryWithInstall": true,
|
||||||
|
"moduleName": "fancynew",
|
||||||
|
"moduleType": "har"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
37
fancynew/src/main/java/com/xcl/fancynew/BitmapUtils.java
Normal file
37
fancynew/src/main/java/com/xcl/fancynew/BitmapUtils.java
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
package com.xcl.fancynew;
|
||||||
|
|
||||||
|
import ohos.agp.components.element.PixelMapElement;
|
||||||
|
import ohos.agp.render.Canvas;
|
||||||
|
import ohos.agp.render.Texture;
|
||||||
|
import ohos.media.image.PixelMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* github wongzy
|
||||||
|
* wongzhenyu96@gmail.com
|
||||||
|
* 2020-04-29
|
||||||
|
*/
|
||||||
|
public class BitmapUtils {
|
||||||
|
private BitmapUtils() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Drawable to bitmap pixel map.
|
||||||
|
*
|
||||||
|
* @param drawable the drawable
|
||||||
|
* @return the pixel map
|
||||||
|
*/
|
||||||
|
public static PixelMap drawableToBitmap(PixelMapElement drawable) {
|
||||||
|
|
||||||
|
int w = drawable.getWidth();
|
||||||
|
int h = drawable.getHeight();
|
||||||
|
|
||||||
|
PixelMap pixelMap = drawable.getPixelMap();
|
||||||
|
|
||||||
|
Canvas canvas = new Canvas(new Texture(pixelMap));
|
||||||
|
drawable.setBounds(0, 0, w, h);
|
||||||
|
drawable.drawToCanvas(canvas);
|
||||||
|
|
||||||
|
return pixelMap;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package com.xcl.fancynew;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The interface Delegate recycle view.
|
||||||
|
*
|
||||||
|
* @author Xcl
|
||||||
|
* @version 1.2
|
||||||
|
* @package com.xcl.fancynew
|
||||||
|
*/
|
||||||
|
interface DelegateRecycleView {
|
||||||
|
/**
|
||||||
|
* 释放动画view内存的接口
|
||||||
|
*/
|
||||||
|
void finishAnimation();
|
||||||
|
}
|
51
fancynew/src/main/java/com/xcl/fancynew/DrawStrategy.java
Normal file
51
fancynew/src/main/java/com/xcl/fancynew/DrawStrategy.java
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
package com.xcl.fancynew;
|
||||||
|
|
||||||
|
|
||||||
|
import ohos.agp.render.Canvas;
|
||||||
|
import ohos.media.image.PixelMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The interface Draw strategy.
|
||||||
|
*
|
||||||
|
* @author Xcl
|
||||||
|
* @version 1.2
|
||||||
|
* @package com.xcl.fancynew
|
||||||
|
*/
|
||||||
|
public interface DrawStrategy {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绘制app名称文字
|
||||||
|
*
|
||||||
|
* @param canvas 画布
|
||||||
|
* @param fraction 完成时间百分比
|
||||||
|
* @param name 文字
|
||||||
|
* @param colorOfAppName 字体颜色
|
||||||
|
* @param widthAndHeightOfView view的宽和高
|
||||||
|
*/
|
||||||
|
void drawAppName(Canvas canvas, float fraction, String name, int colorOfAppName,
|
||||||
|
WidthAndHeightOfView widthAndHeightOfView);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绘制app图标
|
||||||
|
*
|
||||||
|
* @param canvas 画布
|
||||||
|
* @param fraction 完成时间百分比
|
||||||
|
* @param icon 图标
|
||||||
|
* @param colorOfIcon 绘制图标颜色
|
||||||
|
* @param widthAndHeightOfView view的宽和高
|
||||||
|
*/
|
||||||
|
void drawAppIcon(Canvas canvas, float fraction, PixelMap icon, int colorOfIcon,
|
||||||
|
WidthAndHeightOfView widthAndHeightOfView);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绘制app一句话描述
|
||||||
|
*
|
||||||
|
* @param canvas 画布
|
||||||
|
* @param fraction 完成时间百分比
|
||||||
|
* @param statement 一句话描述
|
||||||
|
* @param colorOfStatement 字体颜色
|
||||||
|
* @param widthAndHeightOfView view的宽和高
|
||||||
|
*/
|
||||||
|
void drawAppStatement(Canvas canvas, float fraction, String statement, int colorOfStatement,
|
||||||
|
WidthAndHeightOfView widthAndHeightOfView);
|
||||||
|
}
|
152
fancynew/src/main/java/com/xcl/fancynew/LineDrawStrategy.java
Normal file
152
fancynew/src/main/java/com/xcl/fancynew/LineDrawStrategy.java
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
package com.xcl.fancynew;
|
||||||
|
|
||||||
|
|
||||||
|
import ohos.agp.components.element.PixelMapElement;
|
||||||
|
import ohos.agp.render.Canvas;
|
||||||
|
import ohos.agp.render.Paint;
|
||||||
|
import ohos.agp.render.Path;
|
||||||
|
import ohos.agp.render.PixelMapHolder;
|
||||||
|
import ohos.agp.utils.Color;
|
||||||
|
import ohos.agp.utils.Matrix;
|
||||||
|
import ohos.agp.utils.RectFloat;
|
||||||
|
import ohos.agp.utils.TextAlignment;
|
||||||
|
import ohos.media.image.PixelMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Line draw strategy.
|
||||||
|
*
|
||||||
|
* @author Xcl
|
||||||
|
* @version 1.2
|
||||||
|
* @package com.xcl.fancynew
|
||||||
|
*/
|
||||||
|
public class LineDrawStrategy implements DrawStrategy {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new Line draw strategy.
|
||||||
|
*/
|
||||||
|
public LineDrawStrategy() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawAppName(Canvas canvas, float fraction, String name, int colorOfAppName,
|
||||||
|
WidthAndHeightOfView widthAndHeightOfView) {
|
||||||
|
canvas.save();
|
||||||
|
Paint paint = new Paint();
|
||||||
|
paint.setColor(new Color(colorOfAppName));
|
||||||
|
paint.setStyle(Paint.Style.STROKE_STYLE);
|
||||||
|
paint.setStrokeWidth(5);
|
||||||
|
paint.setTextSize(50);
|
||||||
|
paint.setStrokeJoin(Paint.Join.ROUND_JOIN);
|
||||||
|
paint.setTextAlign(TextAlignment.LEFT);
|
||||||
|
float x = widthAndHeightOfView.getWidth() >> 1;
|
||||||
|
int centerY = widthAndHeightOfView.getHeight() / 2;
|
||||||
|
float y = centerY - 275;
|
||||||
|
Path path = new Path();
|
||||||
|
path.moveTo(x, y);
|
||||||
|
if (fraction <= 0.50) {
|
||||||
|
path.lineTo(x, y + (25 + name.length() + 250) * (fraction / 0.50f));
|
||||||
|
canvas.drawPath(path, paint);
|
||||||
|
} else {
|
||||||
|
path.lineTo(x, y + (25 + name.length() + 250) * ((1 - fraction) / 0.50f));
|
||||||
|
canvas.drawPath(path, paint);
|
||||||
|
paint.setStyle(Paint.Style.FILL_STYLE);
|
||||||
|
canvas.drawText(paint, name, x + 20, y + 150);
|
||||||
|
}
|
||||||
|
canvas.restore();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawAppIcon(Canvas canvas, float fraction, PixelMap icon, int colorOfIcon,
|
||||||
|
WidthAndHeightOfView widthAndHeightOfView) {
|
||||||
|
int centerX = widthAndHeightOfView.getWidth() / 2;
|
||||||
|
int centerY = widthAndHeightOfView.getHeight() / 2;
|
||||||
|
PixelMap bitmap = BitmapUtils.drawableToBitmap(new PixelMapElement(icon));
|
||||||
|
Paint paint = new Paint();
|
||||||
|
paint.setColor(new Color(colorOfIcon));
|
||||||
|
paint.setStrokeWidth(3);
|
||||||
|
paint.setStrokeJoin(Paint.Join.ROUND_JOIN);
|
||||||
|
paint.setStyle(Paint.Style.STROKE_STYLE);
|
||||||
|
float bitmapLeft = centerX - 250;
|
||||||
|
float bitmapRight = bitmapLeft + bitmap.getImageInfo().size.width * 1.7f;
|
||||||
|
float bitmapTop = centerY - 250;
|
||||||
|
float bitmapBottom = bitmapTop + bitmap.getImageInfo().size.height * 1.7f;
|
||||||
|
canvas.save();
|
||||||
|
if (fraction <= 0.75) {
|
||||||
|
float newfraction = fraction / 0.75f;
|
||||||
|
if (newfraction <= 0.25) {
|
||||||
|
canvas.drawLine(bitmapLeft, bitmapBottom, bitmapLeft,
|
||||||
|
bitmapBottom - (bitmapBottom - bitmapTop) * (newfraction / 0.25f), paint);
|
||||||
|
} else {
|
||||||
|
canvas.drawLine(bitmapLeft, bitmapBottom, bitmapLeft, bitmapTop, paint);
|
||||||
|
}
|
||||||
|
if (newfraction > 0.25) {
|
||||||
|
if (newfraction <= 0.50) {
|
||||||
|
canvas.drawLine(bitmapLeft, bitmapTop,
|
||||||
|
bitmapLeft + (bitmapRight - bitmapLeft) * ((newfraction - 0.25f) / 0.25f),
|
||||||
|
bitmapTop, paint);
|
||||||
|
} else {
|
||||||
|
canvas.drawLine(bitmapLeft, bitmapTop, bitmapRight, bitmapTop, paint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (newfraction > 0.50) {
|
||||||
|
if (newfraction <= 0.75) {
|
||||||
|
canvas.drawLine(bitmapRight, bitmapTop, bitmapRight,
|
||||||
|
bitmapTop + (bitmapBottom - bitmapTop) * ((newfraction - 0.50f) / 0.25f),
|
||||||
|
paint);
|
||||||
|
} else {
|
||||||
|
canvas.drawLine(bitmapRight, bitmapTop, bitmapRight, bitmapBottom, paint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (newfraction > 0.75) {
|
||||||
|
if (newfraction <= 1) {
|
||||||
|
canvas.drawLine(bitmapRight, bitmapBottom, bitmapRight - (bitmapRight - bitmapLeft) * ((newfraction - 0.75f) / 0.25f),
|
||||||
|
bitmapBottom, paint);
|
||||||
|
} else {
|
||||||
|
canvas.drawLine(bitmapRight, bitmapBottom, bitmapLeft, bitmapBottom, paint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
canvas.restore();
|
||||||
|
canvas.save();
|
||||||
|
if (fraction > 0.75) {
|
||||||
|
canvas.clipRect(bitmapLeft + (bitmap.getImageInfo().size.width / 2f) * ((1 - fraction) / 0.25f),
|
||||||
|
bitmapTop + (bitmap.getImageInfo().size.height / 2f) * ((1 - fraction) / 0.25f),
|
||||||
|
bitmapRight - (bitmap.getImageInfo().size.width / 2f) * ((1 - fraction) / 0.25f),
|
||||||
|
bitmapBottom - (bitmap.getImageInfo().size.height / 2f) * ((1 - fraction) / 0.25f));
|
||||||
|
Matrix matrix = new Matrix();
|
||||||
|
matrix.postScale(1.7f, 1.7f, (bitmapLeft + bitmapRight) * 0.5f,
|
||||||
|
(bitmapTop + bitmapBottom) * 0.5f);
|
||||||
|
canvas.concat(matrix);
|
||||||
|
canvas.drawPixelMapHolder(new PixelMapHolder(bitmap), (bitmapLeft + bitmapRight) / 2 - (bitmap.getImageInfo().size.width >> 1),
|
||||||
|
(bitmapTop + bitmapBottom) / 2 - (bitmap.getImageInfo().size.height >> 1), paint);
|
||||||
|
}
|
||||||
|
canvas.restore();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawAppStatement(Canvas canvas, float fraction, String statement, int colorOfStatement,
|
||||||
|
WidthAndHeightOfView widthAndHeightOfView) {
|
||||||
|
canvas.save();
|
||||||
|
int width = widthAndHeightOfView.getWidth();
|
||||||
|
int height = widthAndHeightOfView.getHeight();
|
||||||
|
Paint paint = new Paint();
|
||||||
|
paint.setColor(new Color(colorOfStatement));
|
||||||
|
paint.setStyle(Paint.Style.STROKE_STYLE);
|
||||||
|
paint.setTextSize(45);
|
||||||
|
paint.horizontalTilt(-0.2f);
|
||||||
|
paint.setTextAlign(TextAlignment.CENTER);
|
||||||
|
RectFloat rectF = new RectFloat((width >> 2) - statement.length(), height * 7 >> 3,
|
||||||
|
width * 3, height);
|
||||||
|
if (fraction <= 0.60f) {
|
||||||
|
Path path = new Path();
|
||||||
|
path.addArc(rectF, 193, 40 * fraction * 1.67f);
|
||||||
|
canvas.drawPath(path, paint);
|
||||||
|
} else {
|
||||||
|
Path path = new Path();
|
||||||
|
path.addArc(rectF, 193, 40);
|
||||||
|
canvas.drawPath(path, paint);
|
||||||
|
canvas.drawTextOnPath(paint, statement, path, 0, 0);
|
||||||
|
}
|
||||||
|
canvas.restore();
|
||||||
|
}
|
||||||
|
}
|
102
fancynew/src/main/java/com/xcl/fancynew/NormalDrawStrategy.java
Normal file
102
fancynew/src/main/java/com/xcl/fancynew/NormalDrawStrategy.java
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
package com.xcl.fancynew;
|
||||||
|
|
||||||
|
|
||||||
|
import ohos.agp.components.element.PixelMapElement;
|
||||||
|
import ohos.agp.render.Canvas;
|
||||||
|
import ohos.agp.render.Paint;
|
||||||
|
import ohos.agp.render.Path;
|
||||||
|
import ohos.agp.render.PixelMapHolder;
|
||||||
|
import ohos.agp.utils.Color;
|
||||||
|
import ohos.agp.utils.Matrix;
|
||||||
|
import ohos.agp.utils.RectFloat;
|
||||||
|
import ohos.agp.utils.TextAlignment;
|
||||||
|
import ohos.media.image.PixelMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Normal draw strategy.
|
||||||
|
*
|
||||||
|
* @author Xcl
|
||||||
|
* @version 1.2
|
||||||
|
* @package com.xcl.fancynew
|
||||||
|
*/
|
||||||
|
public class NormalDrawStrategy implements DrawStrategy {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new Normal draw strategy.
|
||||||
|
*/
|
||||||
|
public NormalDrawStrategy() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawAppName(Canvas canvas, float fraction, String name, int colorOfAppName,
|
||||||
|
WidthAndHeightOfView widthAndHeightOfView) {
|
||||||
|
canvas.save();
|
||||||
|
int width = widthAndHeightOfView.getWidth();
|
||||||
|
int height = widthAndHeightOfView.getHeight();
|
||||||
|
Paint paint = new Paint();
|
||||||
|
paint.setColor(new Color(colorOfAppName));
|
||||||
|
paint.setTextAlign(TextAlignment.CENTER);
|
||||||
|
paint.setTextSize(50);
|
||||||
|
canvas.drawText(paint, name, width >> 1, (height >> 1) + 50);
|
||||||
|
canvas.restore();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawAppIcon(Canvas canvas, float fraction, PixelMap icon, int colorOfIcon, WidthAndHeightOfView widthAndHeightOfView) {
|
||||||
|
canvas.save();
|
||||||
|
int width = widthAndHeightOfView.getWidth();
|
||||||
|
int height = widthAndHeightOfView.getHeight();
|
||||||
|
Paint paint = new Paint();
|
||||||
|
PixelMap bitmap = BitmapUtils.drawableToBitmap(new PixelMapElement(icon));
|
||||||
|
|
||||||
|
int bitmapWidth = bitmap.getImageInfo().size.width;
|
||||||
|
int bitmapHeight = bitmap.getImageInfo().size.height;
|
||||||
|
int radius = bitmapWidth * 3 / 2;
|
||||||
|
int centerX = width / 2 + bitmapWidth / 2;
|
||||||
|
int centerY = height / 2 - 100;
|
||||||
|
if (fraction <= 0.60) {
|
||||||
|
Path path = new Path();
|
||||||
|
Matrix matrix = new Matrix();
|
||||||
|
matrix.postScale(1.2f, 1.2f, centerX - (bitmapWidth >> 1), centerY - (bitmapHeight >> 1));
|
||||||
|
path.addCircle(centerX, centerY, radius * (fraction - 0.1f) * 2, Path.Direction.CLOCK_WISE);
|
||||||
|
canvas.concat(matrix);
|
||||||
|
canvas.clipPath(path, Canvas.ClipOp.INTERSECT);
|
||||||
|
canvas.drawPixelMapHolder(new PixelMapHolder(bitmap), centerX - bitmapWidth, centerY - bitmapHeight, paint);
|
||||||
|
} else {
|
||||||
|
Matrix matrix = new Matrix();
|
||||||
|
matrix.postScale(1.2f + (0.5f) * (fraction - 0.6f) * 2.5f,
|
||||||
|
1.2f + (0.5f) * (fraction - 0.6f) * 2.5f,
|
||||||
|
centerX - (bitmapWidth >> 1), centerY - (bitmapHeight >> 1));
|
||||||
|
canvas.concat(matrix);
|
||||||
|
canvas.drawPixelMapHolder(new PixelMapHolder(bitmap), centerX - bitmapWidth, centerY - bitmapHeight, paint);
|
||||||
|
}
|
||||||
|
canvas.restore();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawAppStatement(Canvas canvas, float fraction, String statement, int colorOfStatement,
|
||||||
|
WidthAndHeightOfView widthAndHeightOfView) {
|
||||||
|
canvas.save();
|
||||||
|
int width = widthAndHeightOfView.getWidth();
|
||||||
|
int height = widthAndHeightOfView.getHeight();
|
||||||
|
Paint paint = new Paint();
|
||||||
|
paint.setColor(new Color(colorOfStatement));
|
||||||
|
paint.setStyle(Paint.Style.STROKE_STYLE);
|
||||||
|
paint.setTextSize(45);
|
||||||
|
paint.horizontalTilt(-0.2f);
|
||||||
|
paint.setTextAlign(TextAlignment.CENTER);
|
||||||
|
RectFloat rectF = new RectFloat((width >> 2) - statement.length(), height * 7 / 8,
|
||||||
|
width * 3, height);
|
||||||
|
if (fraction <= 0.60f) {
|
||||||
|
Path path = new Path();
|
||||||
|
path.addArc(rectF, 193, 40 * fraction * 1.67f);
|
||||||
|
canvas.drawPath(path, paint);
|
||||||
|
} else {
|
||||||
|
Path path = new Path();
|
||||||
|
path.addArc(rectF, 193, 40);
|
||||||
|
canvas.drawPath(path, paint);
|
||||||
|
canvas.drawTextOnPath(paint, statement, path, 0, 0);
|
||||||
|
}
|
||||||
|
canvas.restore();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,370 @@
|
|||||||
|
package com.xcl.fancynew;
|
||||||
|
|
||||||
|
import ohos.aafwk.ability.Ability;
|
||||||
|
import ohos.agp.animation.Animator;
|
||||||
|
import ohos.agp.animation.AnimatorValue;
|
||||||
|
import ohos.agp.components.Component;
|
||||||
|
import ohos.agp.components.StackLayout;
|
||||||
|
import ohos.agp.render.Canvas;
|
||||||
|
import ohos.agp.utils.Color;
|
||||||
|
import ohos.agp.window.dialog.CommonDialog;
|
||||||
|
import ohos.app.Context;
|
||||||
|
import ohos.eventhandler.EventHandler;
|
||||||
|
import ohos.eventhandler.EventRunner;
|
||||||
|
import ohos.eventhandler.InnerEvent;
|
||||||
|
import ohos.global.configuration.Configuration;
|
||||||
|
import ohos.global.resource.NotExistException;
|
||||||
|
import ohos.media.image.ImageSource;
|
||||||
|
import ohos.media.image.PixelMap;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.lang.ref.SoftReference;
|
||||||
|
import java.util.Timer;
|
||||||
|
import java.util.TimerTask;
|
||||||
|
|
||||||
|
import static ohos.agp.components.ComponentContainer.LayoutConfig.MATCH_PARENT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Opening start animation.
|
||||||
|
*
|
||||||
|
* @author Xcl
|
||||||
|
* @version 1.2
|
||||||
|
* @package com.xcl.fancynew
|
||||||
|
*/
|
||||||
|
public class OpeningStartAnimation extends Component implements Component.DrawTask {
|
||||||
|
private static final int FINISHANIMATION = 1;
|
||||||
|
private final WidthAndHeightOfView mWidthAndHeightOfView;
|
||||||
|
/**
|
||||||
|
* The Device.
|
||||||
|
*/
|
||||||
|
int device = 0;
|
||||||
|
private long animationInterval = 1500;
|
||||||
|
private long animationFinishTime = 350;
|
||||||
|
private int colorOfBackground = 0;
|
||||||
|
private float fraction;
|
||||||
|
private PixelMap mDrawable = null;
|
||||||
|
private int colorOfAppIcon = Color.getIntColor("#FF4BF3E2");
|
||||||
|
private String appName = "";
|
||||||
|
private int colorOfAppName = Color.getIntColor("#FF86AEAA");
|
||||||
|
private String appStatement = "";
|
||||||
|
private int colorOfAppStatement = Color.getIntColor("#FF8E6FFD");
|
||||||
|
private DelegateRecycleView mDelegateRecycleView;
|
||||||
|
private DrawStrategy mDrawStrategy = new NormalDrawStrategy();
|
||||||
|
|
||||||
|
{
|
||||||
|
StackLayout.LayoutConfig layoutParams;
|
||||||
|
layoutParams = new StackLayout.LayoutConfig(MATCH_PARENT,
|
||||||
|
MATCH_PARENT);
|
||||||
|
this.setLayoutConfig(layoutParams);
|
||||||
|
mWidthAndHeightOfView = new WidthAndHeightOfView();
|
||||||
|
}
|
||||||
|
|
||||||
|
private OpeningStartAnimation(Context context, int iconId, int dev) {
|
||||||
|
super(context);
|
||||||
|
int colorMode = new Configuration().getSystemColorMode();
|
||||||
|
if (colorMode == Configuration.DARK_MODE) {
|
||||||
|
colorOfBackground = Color.BLACK.getValue();
|
||||||
|
} else {
|
||||||
|
colorOfBackground = Color.WHITE.getValue();
|
||||||
|
}
|
||||||
|
device = dev;
|
||||||
|
appName = "示例APP名字";
|
||||||
|
appStatement = "示例一句话";
|
||||||
|
mDrawable = getPixelMapFromResource(context, iconId);
|
||||||
|
addDrawTask(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private OpeningStartAnimation(Context context, int iconId) {
|
||||||
|
super(context);
|
||||||
|
int colorMode = new Configuration().getSystemColorMode();
|
||||||
|
if (colorMode == Configuration.DARK_MODE) {
|
||||||
|
colorOfBackground = Color.BLACK.getValue();
|
||||||
|
} else {
|
||||||
|
colorOfBackground = Color.WHITE.getValue();
|
||||||
|
}
|
||||||
|
device = 0;
|
||||||
|
appName = "示例APP名字";
|
||||||
|
appStatement = "示例一句话";
|
||||||
|
mDrawable = getPixelMapFromResource(context, iconId);
|
||||||
|
addDrawTask(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private PixelMap getPixelMapFromResource(Context context, int resourceId) {
|
||||||
|
InputStream inputStream = null;
|
||||||
|
try {
|
||||||
|
// 创建图像数据源ImageSource对象
|
||||||
|
inputStream = context.getResourceManager().getResource(resourceId);
|
||||||
|
ImageSource.SourceOptions srcOpts = new ImageSource.SourceOptions();
|
||||||
|
srcOpts.formatHint = "image/png";
|
||||||
|
ImageSource imageSource = ImageSource.create(inputStream, srcOpts);
|
||||||
|
// 设置图片参数
|
||||||
|
ImageSource.DecodingOptions decodingOptions = new ImageSource.DecodingOptions();
|
||||||
|
return imageSource.createPixelmap(decodingOptions);
|
||||||
|
} catch (IOException | NotExistException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
if (inputStream != null) {
|
||||||
|
try {
|
||||||
|
inputStream.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置完成的百分比
|
||||||
|
*
|
||||||
|
* @param fraction 百分比
|
||||||
|
*/
|
||||||
|
private void setFraction(float fraction) {
|
||||||
|
this.fraction = fraction;
|
||||||
|
invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDraw(Component component, Canvas canvas) {
|
||||||
|
canvas.drawColor(colorOfBackground, Canvas.PorterDuffMode.SRC_OVER); //绘制背景色
|
||||||
|
mWidthAndHeightOfView.setHeight(getHeight());
|
||||||
|
mWidthAndHeightOfView.setWidth(getWidth());
|
||||||
|
if (device == 0 || device == 3) {
|
||||||
|
mDrawStrategy.drawAppIcon(canvas, fraction, mDrawable, colorOfAppIcon,
|
||||||
|
mWidthAndHeightOfView);
|
||||||
|
mDrawStrategy.drawAppName(canvas, fraction, appName, colorOfAppName,
|
||||||
|
mWidthAndHeightOfView);
|
||||||
|
mDrawStrategy.drawAppStatement(canvas, fraction, appStatement, colorOfAppStatement,
|
||||||
|
mWidthAndHeightOfView);
|
||||||
|
} else if (device == 2) {
|
||||||
|
mDrawStrategy.drawAppIcon(canvas, fraction, mDrawable, colorOfAppIcon,
|
||||||
|
mWidthAndHeightOfView);
|
||||||
|
mDrawStrategy.drawAppName(canvas, fraction, appName, colorOfAppName,
|
||||||
|
mWidthAndHeightOfView);
|
||||||
|
} else if (device == 1) {
|
||||||
|
mDrawStrategy.drawAppIcon(canvas, fraction, mDrawable, colorOfAppIcon,
|
||||||
|
mWidthAndHeightOfView);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 显示动画
|
||||||
|
*
|
||||||
|
* @param mactivity 显示动画的界面
|
||||||
|
*/
|
||||||
|
public void show(Ability mactivity) {
|
||||||
|
SoftReference<Ability> softReference = new SoftReference<>(mactivity);
|
||||||
|
final Ability activity = softReference.get();
|
||||||
|
CommonDialog dialog = new CommonDialog(activity.getContext());
|
||||||
|
dialog.setContentCustomComponent(this);
|
||||||
|
dialog.show();
|
||||||
|
AnimatorValue animatorValue = new AnimatorValue();
|
||||||
|
animatorValue.setDuration(animationInterval - 50);
|
||||||
|
animatorValue.setDelay(100);
|
||||||
|
animatorValue.setLoopedCount(0);
|
||||||
|
animatorValue.setCurveType(Animator.CurveType.LINEAR);
|
||||||
|
animatorValue.setValueUpdateListener((animatorValue1, value) -> {
|
||||||
|
setFraction(value);
|
||||||
|
});
|
||||||
|
animatorValue.start();
|
||||||
|
//处理动画定时
|
||||||
|
EventHandler handler = new EventHandler(EventRunner.getMainEventRunner()) {
|
||||||
|
@Override
|
||||||
|
protected void processEvent(InnerEvent event) {
|
||||||
|
super.processEvent(event);
|
||||||
|
if (event.eventId == FINISHANIMATION) {
|
||||||
|
moveAnimation(activity);
|
||||||
|
dialog.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
//动画定时器
|
||||||
|
new Timer().schedule(new TimerTask() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
InnerEvent message = InnerEvent.get();
|
||||||
|
message.eventId = FINISHANIMATION;
|
||||||
|
handler.sendEvent(message);
|
||||||
|
}
|
||||||
|
}, animationInterval + 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 隐藏动画view
|
||||||
|
*
|
||||||
|
* @param activity 当前活动
|
||||||
|
*/
|
||||||
|
private void moveAnimation(Ability activity) {
|
||||||
|
this.createAnimatorProperty()
|
||||||
|
.scaleX(0)
|
||||||
|
.scaleY(0)
|
||||||
|
.alpha(0)
|
||||||
|
.setDuration(animationFinishTime);
|
||||||
|
mDelegateRecycleView.finishAnimation();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用Builder模式创建对象
|
||||||
|
*/
|
||||||
|
public static final class Builder implements DelegateRecycleView {
|
||||||
|
/**
|
||||||
|
* The constant mDrawStrategy.
|
||||||
|
*/
|
||||||
|
public static DrawStrategy mDrawStrategy;
|
||||||
|
/**
|
||||||
|
* The M opening start animation.
|
||||||
|
*/
|
||||||
|
OpeningStartAnimation mOpeningStartAnimation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new Builder.
|
||||||
|
*
|
||||||
|
* @param context the context
|
||||||
|
* @param iconId the icon id
|
||||||
|
* @param dev the dev
|
||||||
|
*/
|
||||||
|
public Builder(Context context, int iconId, int dev) {
|
||||||
|
mOpeningStartAnimation = new OpeningStartAnimation(context, iconId, dev);
|
||||||
|
mOpeningStartAnimation.mDelegateRecycleView = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new Builder.
|
||||||
|
*
|
||||||
|
* @param context the context
|
||||||
|
* @param iconId the icon id
|
||||||
|
*/
|
||||||
|
public Builder(Context context, int iconId) {
|
||||||
|
mOpeningStartAnimation = new OpeningStartAnimation(context, iconId);
|
||||||
|
mOpeningStartAnimation.mDelegateRecycleView = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置动画时间的方法
|
||||||
|
*
|
||||||
|
* @param animationInterval 动画时间
|
||||||
|
* @return Builder对象 animation interval
|
||||||
|
*/
|
||||||
|
public Builder setAnimationInterval(long animationInterval) {
|
||||||
|
mOpeningStartAnimation.animationInterval = animationInterval;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置动画消失的时间
|
||||||
|
*
|
||||||
|
* @param animationFinishTime 动画消失的时间
|
||||||
|
* @return Builder对象 animation finish time
|
||||||
|
*/
|
||||||
|
public Builder setAnimationFinishTime(long animationFinishTime) {
|
||||||
|
mOpeningStartAnimation.animationFinishTime = animationFinishTime;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置动画图标
|
||||||
|
*
|
||||||
|
* @param drawable 动画图标
|
||||||
|
* @return Builder对象 app icon
|
||||||
|
*/
|
||||||
|
public Builder setAppIcon(PixelMap drawable) {
|
||||||
|
mOpeningStartAnimation.mDrawable = drawable;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置图标绘制辅助颜色
|
||||||
|
*
|
||||||
|
* @param colorOfAppIcon 辅助颜色
|
||||||
|
* @return Builder对象 color of app icon
|
||||||
|
*/
|
||||||
|
public Builder setColorOfAppIcon(int colorOfAppIcon) {
|
||||||
|
mOpeningStartAnimation.colorOfAppIcon = colorOfAppIcon;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置要绘制的app名称
|
||||||
|
*
|
||||||
|
* @param appName app名称
|
||||||
|
* @return Builder对象 app name
|
||||||
|
*/
|
||||||
|
public Builder setAppName(String appName) {
|
||||||
|
mOpeningStartAnimation.appName = appName;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置app名称的颜色
|
||||||
|
*
|
||||||
|
* @param colorOfAppName app名称颜色
|
||||||
|
* @return Builder对象 color of app name
|
||||||
|
*/
|
||||||
|
public Builder setColorOfAppName(int colorOfAppName) {
|
||||||
|
mOpeningStartAnimation.colorOfAppName = colorOfAppName;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置app一句话描述
|
||||||
|
*
|
||||||
|
* @param appStatement app一句话描述
|
||||||
|
* @return Builder对象 app statement
|
||||||
|
*/
|
||||||
|
public Builder setAppStatement(String appStatement) {
|
||||||
|
mOpeningStartAnimation.appStatement = appStatement;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置一句话描述的字体颜色
|
||||||
|
*
|
||||||
|
* @param colorOfAppStatement 字体颜色
|
||||||
|
* @return Builder对象 color of app statement
|
||||||
|
*/
|
||||||
|
public Builder setColorOfAppStatement(int colorOfAppStatement) {
|
||||||
|
mOpeningStartAnimation.colorOfAppStatement = colorOfAppStatement;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置背景颜色
|
||||||
|
*
|
||||||
|
* @param colorOfBackground 背景颜色对应的int值
|
||||||
|
* @return Builder对象 color of background
|
||||||
|
*/
|
||||||
|
public Builder setColorOfBackground(int colorOfBackground) {
|
||||||
|
mOpeningStartAnimation.colorOfBackground = colorOfBackground;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开放绘制策略接口,可由用户自行定义
|
||||||
|
*
|
||||||
|
* @param drawStrategy 绘制接口
|
||||||
|
* @return Builder对象 draw stategy
|
||||||
|
*/
|
||||||
|
public Builder setDrawStategy(DrawStrategy drawStrategy) {
|
||||||
|
mOpeningStartAnimation.mDrawStrategy = drawStrategy;
|
||||||
|
mDrawStrategy = drawStrategy;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建开屏动画
|
||||||
|
*
|
||||||
|
* @return 创建出的开屏动画 opening start animation
|
||||||
|
*/
|
||||||
|
public OpeningStartAnimation create() {
|
||||||
|
return mOpeningStartAnimation;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void finishAnimation() {
|
||||||
|
mOpeningStartAnimation = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,54 @@
|
|||||||
|
package com.xcl.fancynew;
|
||||||
|
|
||||||
|
|
||||||
|
import ohos.agp.render.Canvas;
|
||||||
|
import ohos.media.image.PixelMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Ryb draw strategy state controller.
|
||||||
|
*
|
||||||
|
* @author Xcl
|
||||||
|
* @version 1.2
|
||||||
|
* @package com.xcl.fancynew
|
||||||
|
*/
|
||||||
|
class RYBDrawStrategyStateController {
|
||||||
|
|
||||||
|
private final RYBDrawStrategyStateOne mRYBDrawStrategyStateOne = new RYBDrawStrategyStateOne();
|
||||||
|
private final RYBDrawStrategyStateTwo mRYBDrawStrategyStateTwo = new RYBDrawStrategyStateTwo();
|
||||||
|
private RYBDrawStrategyStateInterface mRYBDrawStrategyStateInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new Ryb draw strategy state controller.
|
||||||
|
*/
|
||||||
|
RYBDrawStrategyStateController() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置状态
|
||||||
|
*
|
||||||
|
* @param rybDrawStrategyStateInterface 状态接口
|
||||||
|
*/
|
||||||
|
private void setState(RYBDrawStrategyStateInterface rybDrawStrategyStateInterface) {
|
||||||
|
mRYBDrawStrategyStateInterface = rybDrawStrategyStateInterface;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选择合适的状态来执行操作
|
||||||
|
*
|
||||||
|
* @param canvas 画布
|
||||||
|
* @param fraction 完成时间百分比
|
||||||
|
* @param icon 图标
|
||||||
|
* @param colorOfIcon 绘制颜色
|
||||||
|
* @param widthAndHeightOfView view的宽高
|
||||||
|
*/
|
||||||
|
void choseStateDrawIcon(Canvas canvas, float fraction, PixelMap icon, int colorOfIcon,
|
||||||
|
WidthAndHeightOfView widthAndHeightOfView) {
|
||||||
|
if (fraction <= 0.65f) {
|
||||||
|
setState(mRYBDrawStrategyStateOne);
|
||||||
|
} else if (fraction > 0.65f) {
|
||||||
|
setState(mRYBDrawStrategyStateTwo);
|
||||||
|
}
|
||||||
|
mRYBDrawStrategyStateInterface.drawIcon(canvas, fraction, icon, colorOfIcon, widthAndHeightOfView);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
package com.xcl.fancynew;
|
||||||
|
|
||||||
|
|
||||||
|
import ohos.agp.render.Canvas;
|
||||||
|
import ohos.media.image.PixelMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The interface Ryb draw strategy state interface.
|
||||||
|
*
|
||||||
|
* @author Xcl
|
||||||
|
* @version 1.2
|
||||||
|
* @package com.xcl.fancynew
|
||||||
|
*/
|
||||||
|
interface RYBDrawStrategyStateInterface {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绘制图标
|
||||||
|
*
|
||||||
|
* @param canvas 画布
|
||||||
|
* @param fraction 完成时间
|
||||||
|
* @param drawable 图标素材
|
||||||
|
* @param colorOfIcon 绘制颜色
|
||||||
|
* @param widthAndHeightOfView view的宽高
|
||||||
|
*/
|
||||||
|
void drawIcon(Canvas canvas, float fraction, PixelMap drawable, int colorOfIcon,
|
||||||
|
WidthAndHeightOfView widthAndHeightOfView);
|
||||||
|
}
|
@ -0,0 +1,47 @@
|
|||||||
|
package com.xcl.fancynew;
|
||||||
|
|
||||||
|
|
||||||
|
import ohos.agp.render.Canvas;
|
||||||
|
import ohos.agp.render.Paint;
|
||||||
|
import ohos.agp.utils.Color;
|
||||||
|
import ohos.media.image.PixelMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Ryb draw strategy state one.
|
||||||
|
*
|
||||||
|
* @author Xcl
|
||||||
|
* @version 1.2
|
||||||
|
* @package com.xcl.fancynew
|
||||||
|
*/
|
||||||
|
class RYBDrawStrategyStateOne implements RYBDrawStrategyStateInterface {
|
||||||
|
@Override
|
||||||
|
public void drawIcon(Canvas canvas, float fraction, PixelMap drawable, int colorOfIcon,
|
||||||
|
WidthAndHeightOfView widthAndHeightOfView) {
|
||||||
|
float newFraction = fraction / 0.65f;
|
||||||
|
int centerX = widthAndHeightOfView.getWidth() / 2;
|
||||||
|
int centerY = widthAndHeightOfView.getHeight() / 2 - 150;
|
||||||
|
Paint paint = new Paint();
|
||||||
|
canvas.save();
|
||||||
|
paint.setColor(new Color(Color.getIntColor("#FFFF0500")));//RED
|
||||||
|
if (newFraction <= 0.33f) {
|
||||||
|
canvas.drawCircle(centerX, centerY - 50, 100 * (newFraction / 0.33f), paint);
|
||||||
|
} else {
|
||||||
|
canvas.drawCircle(centerX, centerY - 50, 100, paint);
|
||||||
|
}
|
||||||
|
if (newFraction > 0.33f) {
|
||||||
|
paint.setColor(new Color(Color.getIntColor("#FFFFD100")));//YELLOW
|
||||||
|
if (newFraction <= 0.66f)
|
||||||
|
canvas.drawCircle(centerX - 35, centerY + 35, 100 * ((newFraction - 0.33f) / 0.33f), paint);
|
||||||
|
else
|
||||||
|
canvas.drawCircle(centerX - 35, centerY + 35, 100, paint);
|
||||||
|
}
|
||||||
|
if (newFraction > 0.66f) {
|
||||||
|
paint.setColor(new Color(Color.getIntColor("#FF008BFF")));//BLUE
|
||||||
|
if (newFraction <= 1f)
|
||||||
|
canvas.drawCircle(centerX + 35, centerY + 35, 100 * ((newFraction - 0.66f) / 0.34f), paint);
|
||||||
|
else
|
||||||
|
canvas.drawCircle(centerX + 35, centerY + 35, 100, paint);
|
||||||
|
}
|
||||||
|
canvas.restore();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,47 @@
|
|||||||
|
package com.xcl.fancynew;
|
||||||
|
|
||||||
|
|
||||||
|
import ohos.agp.components.element.PixelMapElement;
|
||||||
|
import ohos.agp.render.Canvas;
|
||||||
|
import ohos.agp.render.Paint;
|
||||||
|
import ohos.agp.render.Path;
|
||||||
|
import ohos.agp.render.PixelMapHolder;
|
||||||
|
import ohos.agp.utils.Color;
|
||||||
|
import ohos.agp.utils.Matrix;
|
||||||
|
import ohos.media.image.PixelMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Ryb draw strategy state two.
|
||||||
|
*
|
||||||
|
* @author Xcl
|
||||||
|
* @version 1.2
|
||||||
|
* @package com.xcl.fancynew
|
||||||
|
*/
|
||||||
|
class RYBDrawStrategyStateTwo implements RYBDrawStrategyStateInterface {
|
||||||
|
@Override
|
||||||
|
public void drawIcon(Canvas canvas, float fraction, PixelMap drawable, int colorOfIcon,
|
||||||
|
WidthAndHeightOfView widthAndHeightOfView) {
|
||||||
|
int centerX = widthAndHeightOfView.getWidth() / 2;
|
||||||
|
int centerY = widthAndHeightOfView.getHeight() / 2 - 150;
|
||||||
|
canvas.save();
|
||||||
|
Paint paint = new Paint();
|
||||||
|
float newFraction = (fraction - 0.65f) / 0.35f;
|
||||||
|
paint.setColor(new Color(Color.getIntColor("#FFFF0500")));//RED
|
||||||
|
canvas.drawCircle(centerX, centerY - 50, 100 * (1 - newFraction), paint);
|
||||||
|
paint.setColor(new Color(Color.getIntColor("#FFFFD100")));//YELLOW
|
||||||
|
canvas.drawCircle(centerX - 35, centerY + 35, 100 * (1 - newFraction), paint);
|
||||||
|
paint.setColor(new Color(Color.getIntColor("#FF008BFF")));//BLUE
|
||||||
|
canvas.drawCircle(centerX + 35, centerY + 35, 100 * (1 - newFraction), paint);
|
||||||
|
canvas.restore();
|
||||||
|
canvas.save();
|
||||||
|
Path path = new Path();
|
||||||
|
PixelMap bitmap = BitmapUtils.drawableToBitmap(new PixelMapElement(drawable));
|
||||||
|
Matrix matrix = new Matrix();
|
||||||
|
matrix.postScale(1.7f, 1.7f, centerX, centerY);
|
||||||
|
canvas.concat(matrix);
|
||||||
|
path.addCircle(centerX, centerY, bitmap.getImageInfo().size.height * 1.5f * newFraction, Path.Direction.CLOCK_WISE);
|
||||||
|
canvas.clipPath(path, Canvas.ClipOp.INTERSECT);
|
||||||
|
canvas.drawPixelMapHolder(new PixelMapHolder(bitmap), centerX - (bitmap.getImageInfo().size.width >> 1), centerY - bitmap.getImageInfo().size.height / 2, paint);
|
||||||
|
canvas.restore();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,75 @@
|
|||||||
|
package com.xcl.fancynew;
|
||||||
|
|
||||||
|
|
||||||
|
import ohos.agp.render.Canvas;
|
||||||
|
import ohos.agp.render.Paint;
|
||||||
|
import ohos.agp.render.Path;
|
||||||
|
import ohos.agp.utils.Color;
|
||||||
|
import ohos.agp.utils.RectFloat;
|
||||||
|
import ohos.agp.utils.TextAlignment;
|
||||||
|
import ohos.media.image.PixelMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Red yellow blue draw strategy.
|
||||||
|
*
|
||||||
|
* @author Xcl
|
||||||
|
* @version 1.2
|
||||||
|
* @package com.xcl.fancynew
|
||||||
|
*/
|
||||||
|
public class RedYellowBlueDrawStrategy implements DrawStrategy {
|
||||||
|
private final RYBDrawStrategyStateController mRYBDrawStrategyStateController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new Red yellow blue draw strategy.
|
||||||
|
*/
|
||||||
|
public RedYellowBlueDrawStrategy() {
|
||||||
|
mRYBDrawStrategyStateController = new RYBDrawStrategyStateController();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawAppName(Canvas canvas, float fraction, String name, int colorOfAppName,
|
||||||
|
WidthAndHeightOfView widthAndHeightOfView) {
|
||||||
|
canvas.save();
|
||||||
|
int width = widthAndHeightOfView.getWidth();
|
||||||
|
int height = widthAndHeightOfView.getHeight();
|
||||||
|
Paint paint = new Paint();
|
||||||
|
paint.setColor(new Color(colorOfAppName));
|
||||||
|
paint.setTextAlign(TextAlignment.CENTER);
|
||||||
|
paint.setTextSize(50);
|
||||||
|
canvas.drawText(paint, name, width >> 1, (height >> 1) + 50);
|
||||||
|
canvas.restore();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawAppIcon(Canvas canvas, float fraction, PixelMap icon, int colorOfIcon,
|
||||||
|
WidthAndHeightOfView widthAndHeightOfView) {
|
||||||
|
mRYBDrawStrategyStateController.choseStateDrawIcon(canvas, fraction, icon, colorOfIcon, widthAndHeightOfView);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawAppStatement(Canvas canvas, float fraction, String statement, int colorOfStatement,
|
||||||
|
WidthAndHeightOfView widthAndHeightOfView) {
|
||||||
|
canvas.save();
|
||||||
|
int width = widthAndHeightOfView.getWidth();
|
||||||
|
int height = widthAndHeightOfView.getHeight();
|
||||||
|
Paint paint = new Paint();
|
||||||
|
paint.setColor(new Color(colorOfStatement));
|
||||||
|
paint.setStyle(Paint.Style.STROKE_STYLE);
|
||||||
|
paint.setTextSize(45);
|
||||||
|
paint.horizontalTilt(-0.2f);
|
||||||
|
paint.setTextAlign(TextAlignment.CENTER);
|
||||||
|
RectFloat rectF = new RectFloat((width >> 2) - statement.length(), height * 7 >> 3,
|
||||||
|
width * 3, height);
|
||||||
|
if (fraction <= 0.60f) {
|
||||||
|
Path path = new Path();
|
||||||
|
path.addArc(rectF, 193, 40 * fraction * 1.67f);
|
||||||
|
canvas.drawPath(path, paint);
|
||||||
|
} else {
|
||||||
|
Path path = new Path();
|
||||||
|
path.addArc(rectF, 193, 40);
|
||||||
|
canvas.drawPath(path, paint);
|
||||||
|
canvas.drawTextOnPath(paint, statement, path, 0, 0);
|
||||||
|
}
|
||||||
|
canvas.restore();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,209 @@
|
|||||||
|
package com.xcl.fancynew;
|
||||||
|
|
||||||
|
import ohos.agp.render.*;
|
||||||
|
import ohos.agp.utils.Color;
|
||||||
|
import ohos.agp.utils.Matrix;
|
||||||
|
import ohos.agp.utils.RectFloat;
|
||||||
|
import ohos.agp.utils.TextAlignment;
|
||||||
|
import ohos.media.image.PixelMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Rotation draw strategy.
|
||||||
|
*
|
||||||
|
* @author Xcl
|
||||||
|
* @version 1.2
|
||||||
|
* @package com.xcl.fancynew
|
||||||
|
*/
|
||||||
|
public class RotationDrawStrategy implements DrawStrategy {
|
||||||
|
/**
|
||||||
|
* Instantiates a new Rotation draw strategy.
|
||||||
|
*/
|
||||||
|
public RotationDrawStrategy() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawAppName(Canvas canvas, float fraction, String name, int colorOfAppName,
|
||||||
|
WidthAndHeightOfView widthAndHeightOfView) {
|
||||||
|
canvas.save();
|
||||||
|
int width = widthAndHeightOfView.getWidth();
|
||||||
|
int height = widthAndHeightOfView.getHeight();
|
||||||
|
canvas.clipRect((width >> 1) - 150, (height >> 1) - 80,
|
||||||
|
(width >> 1) + 150 * fraction, (height >> 1) + 65 * fraction);
|
||||||
|
Paint paint = new Paint();
|
||||||
|
paint.setColor(new Color(colorOfAppName));
|
||||||
|
paint.setTextAlign(TextAlignment.CENTER);
|
||||||
|
paint.setTextSize(50);
|
||||||
|
canvas.drawText(paint, name, width >> 1, (height >> 1) + 50);
|
||||||
|
canvas.restore();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawAppIcon(Canvas canvas, float fraction, PixelMap icon, int colorOfIcon,
|
||||||
|
WidthAndHeightOfView widthAndHeightOfView) {
|
||||||
|
drawIcon(canvas, (int) (fraction * 540), icon,
|
||||||
|
widthAndHeightOfView.getWidth(), widthAndHeightOfView.getHeight());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawAppStatement(Canvas canvas, float fraction, String statement,
|
||||||
|
int colorOfStatement, WidthAndHeightOfView widthAndHeightOfView) {
|
||||||
|
canvas.save();
|
||||||
|
int width = widthAndHeightOfView.getWidth();
|
||||||
|
int height = widthAndHeightOfView.getHeight();
|
||||||
|
Paint paint = new Paint();
|
||||||
|
paint.setColor(new Color(colorOfStatement));
|
||||||
|
paint.setStyle(Paint.Style.STROKE_STYLE);
|
||||||
|
paint.setTextSize(45);
|
||||||
|
paint.horizontalTilt(-0.2f);
|
||||||
|
paint.setTextAlign(TextAlignment.CENTER);
|
||||||
|
RectFloat rectF = new RectFloat((width >> 2) - statement.length(), height * 7 >> 3,
|
||||||
|
width * 3, height);
|
||||||
|
if (fraction <= 0.60f) {
|
||||||
|
Path path = new Path();
|
||||||
|
path.addArc(rectF, 193, 40 * fraction * 1.67f);
|
||||||
|
canvas.drawPath(path, paint);
|
||||||
|
} else {
|
||||||
|
Path path = new Path();
|
||||||
|
path.addArc(rectF, 193, 40);
|
||||||
|
canvas.drawPath(path, paint);
|
||||||
|
canvas.drawTextOnPath(paint, statement, path, 0, 0);
|
||||||
|
}
|
||||||
|
canvas.restore();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据角度绘制图标的类
|
||||||
|
*
|
||||||
|
* @param canvas 画布
|
||||||
|
* @param degree 角度
|
||||||
|
* @param icon 图标
|
||||||
|
* @param width view宽度
|
||||||
|
* @param height view高度
|
||||||
|
*/
|
||||||
|
private void drawIcon(Canvas canvas, int degree, PixelMap icon, int width, int height) {
|
||||||
|
if (degree <= 180) {
|
||||||
|
drawIconOne(canvas, degree / 180f, icon, width, height);
|
||||||
|
}
|
||||||
|
if (degree > 180 && degree <= 360) {
|
||||||
|
drawIconTwo(canvas, degree - 180, icon, width, height);
|
||||||
|
}
|
||||||
|
if (degree > 360 && degree <= 540) {
|
||||||
|
drawIconThree(canvas, degree - 360, icon, width, height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据角度绘制图标的类
|
||||||
|
*
|
||||||
|
* @param canvas 画布
|
||||||
|
* @param fraction 完成时间百分比
|
||||||
|
* @param icon 图标
|
||||||
|
* @param width view宽度
|
||||||
|
* @param height view高度
|
||||||
|
*/
|
||||||
|
private void drawIconOne(Canvas canvas, float fraction, PixelMap icon, int width, int height) {
|
||||||
|
ThreeDimView camera = new ThreeDimView();
|
||||||
|
Paint paint = new Paint();
|
||||||
|
canvas.save();
|
||||||
|
int centerX = width / 2;
|
||||||
|
int centerY = height / 2 - 200;
|
||||||
|
int x = centerX - icon.getImageInfo().size.width / 2;
|
||||||
|
int y = centerY - icon.getImageInfo().size.height / 2;
|
||||||
|
Matrix matrix = new Matrix();
|
||||||
|
matrix.postScale(1.7f, 1.7f, centerX, centerY);
|
||||||
|
canvas.concat(matrix);
|
||||||
|
canvas.clipRect(x, y, x + icon.getImageInfo().size.width * fraction * 0.5f, y + icon.getImageInfo().size.height * fraction * 0.5f);
|
||||||
|
canvas.translate(centerX, centerY);
|
||||||
|
camera.rotateX(180);
|
||||||
|
camera.rotateY(-180);
|
||||||
|
camera.applyToCanvas(canvas);
|
||||||
|
canvas.translate(-centerX, -centerY);
|
||||||
|
canvas.drawPixelMapHolder(new PixelMapHolder(icon), x, y, paint);
|
||||||
|
canvas.restore();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据角度绘制图标的类
|
||||||
|
*
|
||||||
|
* @param canvas 画布
|
||||||
|
* @param degree 角度
|
||||||
|
* @param icon 图标
|
||||||
|
* @param width view宽度
|
||||||
|
* @param height view高度
|
||||||
|
*/
|
||||||
|
private void drawIconTwo(Canvas canvas, int degree, PixelMap icon, int width, int height) {
|
||||||
|
ThreeDimView camera = new ThreeDimView();
|
||||||
|
Paint paint = new Paint();
|
||||||
|
int centerX = width / 2;
|
||||||
|
int centerY = height / 2 - 200;
|
||||||
|
int x = centerX - icon.getImageInfo().size.width / 2;
|
||||||
|
int y = centerY - icon.getImageInfo().size.height / 2;
|
||||||
|
Matrix matrix = new Matrix();
|
||||||
|
matrix.postScale(1.7f, 1.7f, centerX, centerY);
|
||||||
|
//绘制左半部分
|
||||||
|
canvas.save();
|
||||||
|
canvas.concat(matrix);
|
||||||
|
canvas.clipRect(x, y, x + icon.getImageInfo().size.width / 2, y + (icon.getImageInfo().size.height >> 1));
|
||||||
|
canvas.translate(centerX, centerY);
|
||||||
|
camera.rotateX(180);
|
||||||
|
camera.applyToCanvas(canvas);
|
||||||
|
canvas.translate(-centerX, -centerY);
|
||||||
|
canvas.drawPixelMapHolder(new PixelMapHolder(icon), x, y, paint);
|
||||||
|
canvas.restore();
|
||||||
|
|
||||||
|
//绘制右半部分
|
||||||
|
canvas.save();
|
||||||
|
canvas.concat(matrix);
|
||||||
|
if (degree <= 90)
|
||||||
|
canvas.clipRect(x, y, x + icon.getImageInfo().size.width / 2, y + (icon.getImageInfo().size.height >> 1));
|
||||||
|
else
|
||||||
|
canvas.clipRect(x + icon.getImageInfo().size.width / 2, y, x + icon.getImageInfo().size.width, y + icon.getImageInfo().size.height / 2);
|
||||||
|
canvas.translate(centerX, centerY);
|
||||||
|
camera.rotateX(180);
|
||||||
|
camera.rotateY(180 - degree);
|
||||||
|
camera.applyToCanvas(canvas);
|
||||||
|
canvas.translate(-centerX, -centerY);
|
||||||
|
canvas.drawPixelMapHolder(new PixelMapHolder(icon), x, y, paint);
|
||||||
|
canvas.restore();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据角度绘制图标的类
|
||||||
|
*
|
||||||
|
* @param canvas 画布
|
||||||
|
* @param degree 角度
|
||||||
|
* @param icon 图标
|
||||||
|
* @param width view宽度
|
||||||
|
* @param height view高度
|
||||||
|
*/
|
||||||
|
private void drawIconThree(Canvas canvas, int degree, PixelMap icon, int width, int height) {
|
||||||
|
ThreeDimView camera = new ThreeDimView();
|
||||||
|
Paint paint = new Paint();
|
||||||
|
int centerX = width / 2;
|
||||||
|
int centerY = height / 2 - 200;
|
||||||
|
int x = centerX - icon.getImageInfo().size.width / 2;
|
||||||
|
int y = centerY - icon.getImageInfo().size.height / 2;
|
||||||
|
Matrix matrix = new Matrix();
|
||||||
|
matrix.postScale(1.7f, 1.7f, centerX, centerY);
|
||||||
|
//绘制上半部分
|
||||||
|
canvas.save();
|
||||||
|
canvas.concat(matrix);
|
||||||
|
canvas.clipRect(x, y, x + icon.getImageInfo().size.width, y + (icon.getImageInfo().size.height >> 1));
|
||||||
|
canvas.drawPixelMapHolder(new PixelMapHolder(icon), x, y, paint);
|
||||||
|
canvas.restore();
|
||||||
|
|
||||||
|
//绘制下半部分
|
||||||
|
canvas.save();
|
||||||
|
canvas.concat(matrix);
|
||||||
|
if (degree <= 90)
|
||||||
|
canvas.clipRect(x, y, x + icon.getImageInfo().size.width, y + (icon.getImageInfo().size.height >> 1));
|
||||||
|
else
|
||||||
|
canvas.clipRect(x, y + icon.getImageInfo().size.height / 2, x + icon.getImageInfo().size.width, y + icon.getImageInfo().size.height);
|
||||||
|
canvas.translate(centerX, centerY);
|
||||||
|
camera.rotateX(180 - degree);
|
||||||
|
camera.applyToCanvas(canvas);
|
||||||
|
canvas.translate(-centerX, -centerY);
|
||||||
|
canvas.drawPixelMapHolder(new PixelMapHolder(icon), x, y, paint);
|
||||||
|
canvas.restore();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
package com.xcl.fancynew;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Width and height of view.
|
||||||
|
*
|
||||||
|
* @author Xcl
|
||||||
|
* @version 1.2
|
||||||
|
* @package com.xcl.fancynew
|
||||||
|
*/
|
||||||
|
public class WidthAndHeightOfView {
|
||||||
|
private int width;
|
||||||
|
private int height;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new Width and height of view.
|
||||||
|
*/
|
||||||
|
WidthAndHeightOfView() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets width.
|
||||||
|
*
|
||||||
|
* @return the width
|
||||||
|
*/
|
||||||
|
public int getWidth() {
|
||||||
|
return width;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets width.
|
||||||
|
*
|
||||||
|
* @param width the width
|
||||||
|
*/
|
||||||
|
void setWidth(int width) {
|
||||||
|
this.width = width;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets height.
|
||||||
|
*
|
||||||
|
* @return the height
|
||||||
|
*/
|
||||||
|
public int getHeight() {
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets height.
|
||||||
|
*
|
||||||
|
* @param height the height
|
||||||
|
*/
|
||||||
|
void setHeight(int height) {
|
||||||
|
this.height = height;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
8
fancynew/src/main/resources/base/element/string.json
Normal file
8
fancynew/src/main/resources/base/element/string.json
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"string": [
|
||||||
|
{
|
||||||
|
"name": "fancynew_library",
|
||||||
|
"value": "fancynew"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
9
fancynew/src/test/java/com/xcl/fancynew/ExampleTest.java
Normal file
9
fancynew/src/test/java/com/xcl/fancynew/ExampleTest.java
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
package com.xcl.fancynew;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class ExampleTest {
|
||||||
|
@Test
|
||||||
|
public void onStart() {
|
||||||
|
}
|
||||||
|
}
|
13
gradle.properties
Normal file
13
gradle.properties
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# 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.
|
||||||
|
# This function is enabled by default when the DevEco Studio builds the hap/app,if you need disable gradle parallel,you should set org.gradle.parallel false.
|
||||||
|
# more information see https://docs.gradle.org/current/userguide/performance.html
|
||||||
|
# org.gradle.parallel=false
|
||||||
|
# org.gradle.jvmargs=-Dfile.encoding=GBK
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
5
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
5
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://repo.huaweicloud.com/gradle/gradle-7.3-bin.zip
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
183
gradlew
vendored
Normal file
183
gradlew
vendored
Normal file
@ -0,0 +1,183 @@
|
|||||||
|
#!/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" "$@"
|
103
gradlew.bat
vendored
Normal file
103
gradlew.bat
vendored
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
@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
package.json
Normal file
1
package.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{}
|
1
settings.gradle
Normal file
1
settings.gradle
Normal file
@ -0,0 +1 @@
|
|||||||
|
include ':fancynew', ':Demo'
|
Reference in New Issue
Block a user