list = getData();
+ ListItemProvider mListItemProvider = new ListItemProvider(list, this);
+ mListContainer.setItemProvider(mListItemProvider);
+
+ ```
+添加滑动事件处理
+ ```
+ mListContainer.setTouchEventListener(new Component.TouchEventListener() {
+ @Override
+ public boolean onTouchEvent(Component component, TouchEvent touchEvent) {
+ int action = touchEvent.getAction();
+ MmiPoint point = touchEvent.getPointerPosition(touchEvent.getIndex());
+ switch (action) {
+ case TouchEvent.PRIMARY_POINT_DOWN:
+ return true;
+ ```
+3.添加展开动画和关闭动画
+top展开动画:
+ ```
+setContentPosition(getDisplayWidthInPx(this) - 225, getDisplayHeightInPx(this) - 555);
+animatorPropertyTwo = mDSTwo.createAnimatorProperty();
+animatorPropertyTwo.moveByY(-150).setDuration(200);
+animatorPropertyThreeTest.start();
+ ```
+top关闭动画:
+ ```
+ view.setVisibility(Component.VERTICAL);
+ ```
+4.选择角度变化
+添加旋转45°变化
+ ```
+ animatorPropertyAdd.rotate(0).setDuration(1);
+ animatorPropertyAdd.start();
+ mImageAdd.setWidth(90);
+ mImageAdd.setHeight(90);
+ animatorPropertyAddPen.rotate(45).setDuration(500);
+ animatorPropertyAddPen.start();
+ ```
+添加旋转90°变化
+ ```
+ animatorPropertyAdd.rotate(-45).setDuration(1);
+ animatorPropertyAdd.start();
+
+ PixelMapElement pixelMapElement = null;
+ try {
+ pixelMapElement = new PixelMapElement(mImageAddPen.getResourceManager().getResource(ResourceTable.Media_brush1));
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (NotExistException e) {
+ e.printStackTrace();
+ }
+ mImageAddPen.setBackground(pixelMapElement);
+ animatorPropertyAddPen.rotate(90).setDuration(500);
+ animatorPropertyAddPen.start();
+```
+
+5.设置切换颜色变化
+ ```
+ shapeElement.setRgbColor(new RgbColor(66, 133, 244));
+ mDSOne.setBackground(shapeElement);
+ ```
+
+#### 测试信息
+
+CodeCheck代码测试无异常
+
+CloudTest代码测试无异常
+
+火绒安全病毒安全检测通过
+
+当前版本demo功能与原组件基本无差异
+
+#### 版本迭代
+
+- 0.0.1-SNAPSHOT
+
+#### 版权和许可信息
+ ```
+ 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 2018 Roberto Leinardi
+
+ 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.
+ ```
\ No newline at end of file
diff --git a/RELEASING.md b/RELEASING.md
deleted file mode 100644
index e7855c2d0cfc5a92ec06abd73d8547dc6b7f7413..0000000000000000000000000000000000000000
--- a/RELEASING.md
+++ /dev/null
@@ -1,16 +0,0 @@
-# Releasing
-
-1. Bump the `build_versions.version_name` property in `dependencies.gradle` based on Major.Minor.Patch naming scheme
-2. Update `CHANGELOG.md` for the impending release.
-3. Update the `README.md` with the new version.
-4. `git commit -am "Prepare for release X.Y.Z"` (where X.Y.Z is the version you set in step 1)
-5. `git push`
-6. `./gradlew clean assembleRelease :library:publishReleasePublicationToSonatypeRepository`
-7. Create a new release on Github
- 1. Tag version `X.Y.Z` (`git tag -s X.Y.Z && git push --tags`)
- 2. Release title `X.Y.Z`
- 3. Paste the content from `CHANGELOG.md` as the description
- 4. Upload the sample-release.apk
-8. Create a PR from [master](../../tree/master) to [release](../../tree/release)
-9. Visit [Sonatype](https://s01.oss.sonatype.org/#stagingRepositories) and Close and Release the artifact
-10. Visit [Google Play Console](https://play.google.com/apps/publish/) and upload and publish the new APK
diff --git a/art/banner.png b/art/banner.png
deleted file mode 100644
index 70b54d17f00e17c50540ce15cf67a97caaffd991..0000000000000000000000000000000000000000
Binary files a/art/banner.png and /dev/null differ
diff --git a/art/demo_1.gif b/art/demo_1.gif
deleted file mode 100644
index b24697be1a8709d4be0d0698ca3a155b65dc977f..0000000000000000000000000000000000000000
Binary files a/art/demo_1.gif and /dev/null differ
diff --git a/art/playstore_getiton.png b/art/playstore_getiton.png
deleted file mode 100644
index d47d433fef74b1cca149784cfdd6940ebabfb066..0000000000000000000000000000000000000000
Binary files a/art/playstore_getiton.png and /dev/null differ
diff --git a/art/screenshot_api_16.png b/art/screenshot_api_16.png
deleted file mode 100644
index f19851d071be2bc4fc5cb819277659fbdc34a325..0000000000000000000000000000000000000000
Binary files a/art/screenshot_api_16.png and /dev/null differ
diff --git a/art/screenshot_api_27.png b/art/screenshot_api_27.png
deleted file mode 100644
index 8ea54144f36686dd9b8b8f60a096a2c21dfb622c..0000000000000000000000000000000000000000
Binary files a/art/screenshot_api_27.png and /dev/null differ
diff --git a/art/screenshot_api_27_bottom_fab_left_expansion.png b/art/screenshot_api_27_bottom_fab_left_expansion.png
deleted file mode 100644
index 9a74d1c8dd07a4de45d72c8c0cbf1f16ca35a5cd..0000000000000000000000000000000000000000
Binary files a/art/screenshot_api_27_bottom_fab_left_expansion.png and /dev/null differ
diff --git a/art/screenshot_api_27_top_fab_bottom_expansion.png b/art/screenshot_api_27_top_fab_bottom_expansion.png
deleted file mode 100644
index 14a7a8579fcfb5defc4e045b137812748bf8d442..0000000000000000000000000000000000000000
Binary files a/art/screenshot_api_27_top_fab_bottom_expansion.png and /dev/null differ
diff --git a/art/web_hi_res_512.png b/art/web_hi_res_512.png
deleted file mode 100644
index 6a74858a1da944f3fb5d075964038942a0c5b75d..0000000000000000000000000000000000000000
Binary files a/art/web_hi_res_512.png and /dev/null differ
diff --git a/build.gradle b/build.gradle
index 158d00aa708eb41229cf665a927cbdfc4c3d7226..a91ef6ba65e55aa4af3e7ec9bd65cb67502129af 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,70 +1,48 @@
-/*
- * Copyright 2021 Roberto Leinardi.
- *
- * 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.
- */
-apply plugin: 'org.jetbrains.dokka'
-apply from: rootProject.file('versions-plugin.gradle')
-apply from: rootProject.file('detekt.gradle')
-apply from: rootProject.file('publish-root.gradle')
-apply plugin: "se.bjurr.violations.violation-comments-to-github-gradle-plugin"
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+apply plugin: 'com.huawei.ohos.app'
+
+ohos {
+ signingConfigs {
+ debug {
+ storeFile file('D:\\svn\\hongmeng\\trunk\\keyStore\\ActivityRouter\\root_1.p12')
+ storePassword '00000020D07C9BD0B68C4E52604D1F551975FAD868B44197BEA13582D7DB6A5176ADD1F3469EE4E8252CF4F0C53B3D82'
+ keyAlias = 'hos_platform_os'
+ keyPassword '00000020E237E732961415CF32895D63C927E02E4FDCACA6677564E225B67E579C6E3BAB65C19AD5F524753ECBFBE808'
+ signAlg = 'SHA256withECDSA'
+ profile file('D:\\svn\\hongmeng\\trunk\\签名文件\\六月份组件签名\\FloatingActionButtonSpeedDialDebug.p7b')
+ certpath file('D:\\svn\\hongmeng\\trunk\\keyStore\\ActivityRouter\\root.cer')
+ }
+ }
+ compileSdkVersion 5
+ defaultConfig {
+ compatibleSdkVersion 4
+ }
+}
buildscript {
repositories {
- apply from: 'dependencies.gradle'
- addRepos(repositories)
+ maven {
+ url 'https://repo.huaweicloud.com/repository/maven/'
+ }
+ maven {
+ url 'https://developer.huawei.com/repo/'
+ }
+ jcenter()
}
dependencies {
- classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$versions.kotlin"
- classpath "com.android.tools.build:gradle:$versions.android_gradle_plugin"
- classpath "com.leinardi.android:android-checkstyle-plugin:$versions.android_checkstyle_plugin"
- classpath "org.jetbrains.dokka:dokka-gradle-plugin:$versions.dokka"
- classpath "io.github.gradle-nexus:publish-plugin:$versions.publish_plugin"
- classpath "com.github.ben-manes:gradle-versions-plugin:$versions.gradle_versions_plugin"
- classpath "se.bjurr.violations:violation-comments-to-github-gradle-plugin:$versions.violations_plugin"
- classpath "net.ltgt.gradle:gradle-errorprone-plugin:$versions.errorprone_plugin"
- classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:$versions.detekt"
+ classpath 'com.huawei.ohos:hap:2.4.4.2'
+ classpath 'com.huawei.ohos:decctest:1.0.0.6'
}
}
allprojects {
- gradle.projectsEvaluated {
- tasks.withType(JavaCompile) {
- options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
- }
- }
repositories {
- addRepos(repositories)
+ maven {
+ url 'https://repo.huaweicloud.com/repository/maven/'
+ }
+ maven {
+ url 'https://developer.huawei.com/repo/'
+ }
+ jcenter()
}
}
-
-task clean(type: Delete) {
- delete rootProject.buildDir
-}
-
-task violationCommentsToGitHub(type: se.bjurr.violations.comments.github.plugin.gradle.ViolationCommentsToGitHubTask) {
- repositoryOwner = "leinardi"
- repositoryName = "FloatingActionButtonSpeedDial"
- pullRequestId = System.properties['GITHUB_PULLREQUESTID']
- oAuth2Token = System.properties['GITHUB_OAUTH2TOKEN']
- gitHubUrl = "https://api.github.com/"
- createCommentWithAllSingleFileComments = false
- createSingleFileComments = true
- commentOnlyChangedContent = true
- violations = [
- ["FINDBUGS", ".", ".*/reports/findbugs/.*\\.xml\$", "Findbugs"],
- ["CHECKSTYLE", ".", ".*/reports/checkstyle/.*debug\\.xml\$", "Checkstyle"],
- ["ANDROIDLINT", ".", ".*/reports/lint-results.*\\.xml\$", "Android Lint"],
- ["GOOGLEERRORPRONE", ".", ".*/build.log\$", "Error Prone"]
- ]
-}
diff --git a/config/checkstyle/checkstyle-suppressions.xml b/config/checkstyle/checkstyle-suppressions.xml
deleted file mode 100644
index a8eab057eaaee33a19a2894d908fe5db8d75f1ae..0000000000000000000000000000000000000000
--- a/config/checkstyle/checkstyle-suppressions.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml
deleted file mode 100644
index 243c49172f520e34aa27fcede628843737cc3e4e..0000000000000000000000000000000000000000
--- a/config/checkstyle/checkstyle.xml
+++ /dev/null
@@ -1,229 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/config/detekt/config.yml b/config/detekt/config.yml
deleted file mode 100644
index c190a585c2021b4a29e60d6faa502c335f79a9c8..0000000000000000000000000000000000000000
--- a/config/detekt/config.yml
+++ /dev/null
@@ -1,561 +0,0 @@
-build:
- maxIssues: 1 # Custom
- weights:
- complexity: 1 # Custom
- # LongParameterList: 1
- style: 1 # Custom
- comments: 1 # Custom
- empty-blocks: 1 # Custom
- exceptions: 1 # Custom
- naming: 1 # Custom
- performance: 1 # Custom
- potential-bugs: 1 # Custom
-
-processors:
- active: true
- exclude:
- # - 'FunctionCountProcessor'
- # - 'PropertyCountProcessor'
- # - 'ClassCountProcessor'
- # - 'PackageCountProcessor'
- # - 'KtFileCountProcessor'
-
-console-reports:
- active: true
- exclude:
- # - 'ProjectStatisticsReport'
- # - 'ComplexityReport'
- # - 'NotificationReport'
- # - 'FindingsReport'
- # - 'BuildFailureReport'
-
-comments:
- active: true
- excludes: "**/modules/test-*/**" # Custom
- CommentOverPrivateFunction:
- active: false
- CommentOverPrivateProperty:
- active: false
- EndOfSentenceFormat:
- active: false
- endOfSentenceFormat: ([.?!][ \t\n\r\f<])|([.?!:]$)
- UndocumentedPublicClass:
- active: false
- searchInNestedClass: true
- searchInInnerClass: true
- searchInInnerObject: true
- searchInInnerInterface: true
- UndocumentedPublicFunction:
- active: false
-
-complexity:
- active: true
- ComplexCondition:
- active: true
- threshold: 6 # Custom
- ComplexInterface:
- active: false
- threshold: 10
- includeStaticDeclarations: false
- ComplexMethod:
- active: true
- threshold: 20 # Custom
- ignoreSingleWhenExpression: true # Custom
- ignoreSimpleWhenEntries: false
- LabeledExpression:
- active: false
- ignoredLabels: ""
- LargeClass:
- active: true
- threshold: 600
- LongMethod:
- active: true
- threshold: 60
- excludes: "**/modules/test-*/**,**/src/test*/**,**/src/androidTest*/**,**/*Test.kt" # Custom
- LongParameterList:
- active: false # Custom
- threshold: 6
- ignoreDefaultParameters: false
- MethodOverloading:
- active: false
- threshold: 6
- NestedBlockDepth:
- active: true
- threshold: 4
- StringLiteralDuplication:
- active: false
- excludes: "**/modules/test-*/**" # Custom
- threshold: 3
- ignoreAnnotation: true
- excludeStringsWithLessThan5Characters: true
- ignoreStringsRegex: '$^'
- TooManyFunctions:
- active: false # Custom
- excludes: "**/modules/test-*/**" # Custom
- thresholdInFiles: 11
- thresholdInClasses: 11
- thresholdInInterfaces: 11
- thresholdInObjects: 11
- thresholdInEnums: 11
- ignoreDeprecated: false
- ignorePrivate: false
- ignoreOverridden: false
-
-empty-blocks:
- active: true
- EmptyCatchBlock:
- active: true
- allowedExceptionNameRegex: "^(_|(ignore|expected).*)"
- EmptyClassBlock:
- active: true
- EmptyDefaultConstructor:
- active: true
- EmptyDoWhileBlock:
- active: true
- EmptyElseBlock:
- active: true
- EmptyFinallyBlock:
- active: true
- EmptyForBlock:
- active: true
- EmptyFunctionBlock:
- active: true
- ignoreOverriddenFunctions: false
- EmptyIfBlock:
- active: true
- EmptyInitBlock:
- active: true
- EmptyKtFile:
- active: true
- EmptySecondaryConstructor:
- active: true
- EmptyWhenBlock:
- active: true
- EmptyWhileBlock:
- active: true
-
-exceptions:
- active: true
- ExceptionRaisedInUnexpectedLocation:
- active: true # Custom
- methodNames: 'toString,hashCode,equals,finalize'
- InstanceOfCheckForException:
- active: false
- excludes: "**/modules/test-*/**" # Custom
- NotImplementedDeclaration:
- active: false
- PrintStackTrace:
- active: true # Custom
- RethrowCaughtException:
- active: false
- ReturnFromFinally:
- active: false
- SwallowedException:
- active: false
- ignoredExceptionTypes: 'InterruptedException,NumberFormatException,ParseException,MalformedURLException'
- ThrowingExceptionFromFinally:
- active: true # Custom
- ThrowingExceptionInMain:
- active: false
- ThrowingExceptionsWithoutMessageOrCause:
- active: true # Custom
- exceptions: 'IllegalArgumentException,IllegalStateException,IOException'
- ThrowingNewInstanceOfSameException:
- active: false
- TooGenericExceptionCaught:
- active: true
- excludes: "**/modules/test-*/**" # Custom
- exceptionNames:
- - ArrayIndexOutOfBoundsException
- - Error
- - Exception
- - IllegalMonitorStateException
- - NullPointerException
- - IndexOutOfBoundsException
- - RuntimeException
- - Throwable
- allowedExceptionNameRegex: "^(_|(ignore|expected).*)"
- TooGenericExceptionThrown:
- active: true
- exceptionNames:
- - Error
- - Exception
- - Throwable
- - RuntimeException
-
-formatting:
- active: true
- android: true # Custom
- autoCorrect: true
- excludes: "**/modules/test-*/**" # Custom
- AnnotationOnSeparateLine:
- active: false
- ChainWrapping:
- active: true
- autoCorrect: true
- CommentSpacing:
- active: true
- autoCorrect: true
- Filename:
- active: true
- FinalNewline:
- active: true
- autoCorrect: true
- ImportOrdering:
- active: false
- Indentation:
- active: false
- indentSize: 4
- continuationIndentSize: 4
- MaximumLineLength:
- active: true
- maxLineLength: 120 # Custom
- ModifierOrdering:
- active: true
- autoCorrect: true
- MultiLineIfElse:
- active: true
- autoCorrect: true
- NoBlankLineBeforeRbrace:
- active: false # Custom
- autoCorrect: true
- NoConsecutiveBlankLines:
- active: true
- autoCorrect: true
- NoEmptyClassBody:
- active: true
- autoCorrect: true
- NoItParamInMultilineLambda:
- active: false
- NoLineBreakAfterElse:
- active: true
- autoCorrect: true
- NoLineBreakBeforeAssignment:
- active: true
- autoCorrect: true
- NoMultipleSpaces:
- active: true
- autoCorrect: true
- excludes: "**/modules/test-*/**,**/src/test*/**,**/src/androidTest*/**,**/*Test.kt" # Custom
- NoSemicolons:
- active: true
- autoCorrect: true
- NoTrailingSpaces:
- active: true
- autoCorrect: true
- excludes: "**/modules/test-*/**,**/src/test*/**,**/src/androidTest*/**,**/*Test.kt" # Custom
- NoUnitReturn:
- active: true
- autoCorrect: true
- NoUnusedImports:
- active: true
- autoCorrect: true
- NoWildcardImports:
- active: true
- autoCorrect: true
- PackageName:
- active: true
- autoCorrect: true
- ParameterListWrapping:
- active: true
- autoCorrect: true
- indentSize: 4
- SpacingAroundColon:
- active: true
- autoCorrect: true
- SpacingAroundComma:
- active: true
- autoCorrect: true
- SpacingAroundCurly:
- active: true
- autoCorrect: true
- SpacingAroundDot:
- active: true
- autoCorrect: true
- SpacingAroundKeyword:
- active: true
- autoCorrect: true
- excludes: "**/modules/test-*/**,**/src/test*/**,**/src/androidTest*/**,**/*Test.kt" # Custom
- SpacingAroundOperators:
- active: true
- autoCorrect: true
- SpacingAroundParens:
- active: true
- autoCorrect: true
- SpacingAroundRangeOperator:
- active: true
- autoCorrect: true
- SpacingAroundUnaryOperators:
- active: true
- autoCorrect: true
- StringTemplate:
- active: true
- autoCorrect: true
-
-naming:
- active: true
- ClassNaming:
- active: true
- excludes: "**/modules/test-*/**" # Custom
- classPattern: '[A-Z$][a-zA-Z0-9$]*'
- ConstructorParameterNaming:
- active: true
- excludes: "**/modules/test-*/**" # Custom
- parameterPattern: '([a-ln-z]|m[a-z])[A-Za-z0-9]*' # Custom
- privateParameterPattern: '([a-ln-z]|m[a-z])[A-Za-z0-9]*' # Custom
- excludeClassPattern: '$^'
- EnumNaming:
- active: true
- excludes: "**/modules/test-*/**" # Custom
- enumEntryPattern: '^[A-Z][_A-Z0-9]*' # Custom
- ForbiddenClassName:
- active: false
- excludes: "**/modules/test-*/**" # Custom
- forbiddenName: ''
- FunctionMaxLength:
- active: false
- excludes: "**/modules/test-*/**" # Custom
- maximumFunctionNameLength: 30
- FunctionMinLength:
- active: false
- excludes: "**/modules/test-*/**" # Custom
- minimumFunctionNameLength: 3
- FunctionNaming:
- active: true
- excludes: "**/modules/test-*/**,**/src/test*/**,**/src/androidTest*/**,**/*Test.kt" # Custom
- functionPattern: '^([a-z$][a-zA-Z$0-9]*)|(`.*`)$'
- excludeClassPattern: '$^'
- ignoreOverridden: true
- FunctionParameterNaming:
- active: true
- excludes: "**/modules/test-*/**" # Custom
- parameterPattern: '([a-ln-z]|m[a-z])[A-Za-z0-9]*' # Custom
- excludeClassPattern: '$^'
- ignoreOverriddenFunctions: true
- InvalidPackageDeclaration:
- active: false
- rootPackage: ''
- MatchingDeclarationName:
- active: false # Custom
- MemberNameEqualsClassName:
- active: true # Custom
- ignoreOverriddenFunction: true
- ObjectPropertyNaming:
- active: true
- excludes: "**/modules/test-*/**" # Custom
- constantPattern: '[A-Za-z][_A-Za-z0-9]*'
- propertyPattern: '[A-Za-z][_A-Za-z0-9]*'
- privatePropertyPattern: '(_)?[A-Za-z][_A-Za-z0-9]*'
- PackageNaming:
- active: true
- excludes: "**/modules/test-*/**" # Custom
- packagePattern: '^[a-z]+(\.[a-z][a-z0-9]*)*$' # Custom
- TopLevelPropertyNaming:
- active: true
- excludes: "**/modules/test-*/**" # Custom
- constantPattern: '[A-Z][_A-Z0-9]*'
- propertyPattern: '[A-Za-z][_A-Za-z0-9]*'
- privatePropertyPattern: '(_)?[A-Za-z][_A-Za-z0-9]*' # Custom
- VariableMaxLength:
- active: false
- excludes: "**/modules/test-*/**" # Custom
- maximumVariableNameLength: 64
- VariableMinLength:
- active: false
- excludes: "**/modules/test-*/**" # Custom
- minimumVariableNameLength: 1
- VariableNaming:
- active: true
- excludes: "**/modules/test-*/**" # Custom
- variablePattern: '(_)?([a-ln-z]|m[a-z])[A-Za-z0-9]*' # Custom
- privateVariablePattern: '(_)?([a-ln-z]|m[a-z])[A-Za-z0-9]*' # Custom
- excludeClassPattern: '$^'
- ignoreOverridden: true
-
-performance:
- active: true
- ArrayPrimitive:
- active: true # Custom
- ForEachOnRange:
- active: true
- excludes: "**/modules/test-*/**" # Custom
- SpreadOperator:
- active: false # Custom
- excludes: "**/modules/test-*/**" # Custom
- UnnecessaryTemporaryInstantiation:
- active: true
-
-potential-bugs:
- active: true
- DuplicateCaseInWhenExpression:
- active: true
- EqualsAlwaysReturnsTrueOrFalse:
- active: false
- EqualsWithHashCodeExist:
- active: true
- ExplicitGarbageCollectionCall:
- active: true
- InvalidRange:
- active: true # Custom
- IteratorHasNextCallsNextMethod:
- active: false
- IteratorNotThrowingNoSuchElementException:
- active: false
- LateinitUsage:
- active: true # Custom
- excludes: "**/modules/test-*/**,**/src/test*/**,**/src/androidTest*/**,**/*Test.kt" # Custom
- excludeAnnotatedProperties: "Inject" # Custom
- ignoreOnClassesPattern: "(.*Activity|.*Fragment|.*Adapter|.*ViewModel|.*ViewModelObservable|.*Sdk)" # Custom
- MissingWhenCase:
- active: false
- RedundantElseInWhen:
- active: false
- UnconditionalJumpStatementInLoop:
- active: false
- UnreachableCode:
- active: true
- UnsafeCallOnNullableType:
- active: true # Custom
- UnsafeCast:
- active: false
- UselessPostfixExpression:
- active: true # Custom
- WrongEqualsTypeParameter:
- active: true # Custom
-
-style:
- active: true
- CollapsibleIfStatements:
- active: true # Custom
- DataClassContainsFunctions:
- active: true # Custom
- conversionFunctionPrefix: 'to'
- DataClassShouldBeImmutable:
- active: false
- EqualsNullCall:
- active: true # Custom
- EqualsOnSignatureLine:
- active: false
- ExplicitItLambdaParameter:
- active: true # Custom
- ExpressionBodySyntax:
- active: false
- includeLineWrapping: false
- ForbiddenComment:
- active: true
- values: 'TODO' # Custom
- ForbiddenImport:
- active: true # Custom
- imports: ''
- ForbiddenVoid:
- active: true # Custom
- ignoreOverridden: false
- FunctionOnlyReturningConstant:
- active: false
- ignoreOverridableFunction: true
- excludedFunctions: 'describeContents'
- LibraryCodeMustSpecifyReturnType:
- active: false
- LoopWithTooManyJumpStatements:
- active: false
- maxJumpCount: 1
- MagicNumber:
- active: true
- excludes: "**/modules/test-*/**,**/src/test*/**,**/src/androidTest*/**,**/*Test.kt" # Custom
- ignoreNumbers: '-1,0,1,2'
- ignoreHashCodeFunction: false # Custom
- ignorePropertyDeclaration: true # Custom
- ignoreConstantDeclaration: true
- ignoreCompanionObjectPropertyDeclaration: true
- ignoreAnnotation: false
- ignoreNamedArgument: true
- ignoreEnums: true # Custom
- ignoreRanges: false
- MandatoryBracesIfStatements:
- active: true # Custom
- MaxLineLength:
- active: true
- excludes: "**/modules/test-*/**" # Custom
- maxLineLength: 120 # Custom
- excludePackageStatements: true
- excludeImportStatements: true
- excludeCommentStatements: false
- MayBeConst:
- active: true # Custom
- ModifierOrder:
- active: true
- NestedClassesVisibility:
- active: true # Custom
- NewLineAtEndOfFile:
- active: true
- NoTabs:
- active: true # Custom
- OptionalAbstractKeyword:
- active: true
- OptionalUnit:
- active: false
- OptionalWhenBraces:
- active: false
- PreferToOverPairSyntax:
- active: false
- ProtectedMemberInFinalClass:
- active: true # Custom
- RedundantVisibilityModifierRule:
- active: true # Custom
- ReturnCount:
- active: true
- max: 5 # Custom
- excludedFunctions: "equals"
- excludeLabeled: false
- excludeReturnFromLambda: true
- SafeCast:
- active: true
- SerialVersionUIDInSerializableClass:
- active: false
- SpacingBetweenPackageAndImports:
- active: true # Custom
- ThrowsCount:
- active: true
- max: 2
- TrailingWhitespace:
- active: true # Custom
- UnderscoresInNumericLiterals:
- active: false
- acceptableDecimalLength: 5
- UnnecessaryAbstractClass:
- active: false
- excludeAnnotatedClasses: "dagger.Module"
- UnnecessaryApply:
- active: false
- UnnecessaryInheritance:
- active: false
- UnnecessaryLet:
- active: true # Custom
- UnnecessaryParentheses:
- active: true # Custom
- UntilInsteadOfRangeTo:
- active: false
- UnusedImports:
- active: true # Custom
- UnusedPrivateClass:
- active: false
- UnusedPrivateMember:
- active: false
- allowedNames: "(_|ignored|expected|serialVersionUID)"
- UseCheckOrError:
- active: false
- UseDataClass:
- active: true # Custom
- excludeAnnotatedClasses: ""
- UseRequire:
- active: false
- UselessCallOnNotNull:
- active: false
- UtilityClassWithPublicConstructor:
- active: true # Custom
- VarCouldBeVal:
- active: true # Custom
- WildcardImport:
- active: true
- excludes: "**/modules/test-*/**" # Custom
- excludeImports: 'java.util.*,kotlinx.android.synthetic.*'
diff --git a/dependencies.gradle b/dependencies.gradle
deleted file mode 100644
index 49daee1c8a1d440559e2a846fec8ee04b908dac0..0000000000000000000000000000000000000000
--- a/dependencies.gradle
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2021 Roberto Leinardi.
- *
- * 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.
- */
-
-/**
- * Shared file between builds so that they can all use the same dependencies and
- * maven repositories.
- **/
-ext.deps = [:]
-def versions = [:]
-versions.android_checkstyle_plugin = "1.1.0"
-versions.android_gradle_plugin = "4.2.1"
-versions.android_material = "1.3.0"
-versions.androidx_appcompat = "1.3.0"
-versions.androidx_cardview = "1.0.0"
-versions.androidx_constraintlayout = "2.0.4"
-versions.androidx_recyclerview = "1.2.0"
-versions.constraint_layout = "1.1.3"
-versions.detekt = "1.14.2"
-versions.dokka = "1.4.32"
-versions.errorprone_javac = "9+181-r4173-1"
-versions.errorprone_core = "2.4.0"
-versions.errorprone_plugin = "2.0.1"
-versions.espresso = "3.0.1"
-versions.gradle_versions_plugin = "0.38.0"
-versions.junit = "4.12"
-versions.kotlin = "1.5.0"
-versions.material = "1.0.0"
-versions.mockito = "2.13.3"
-versions.mockito_all = "1.10.19"
-versions.nullaway = "0.9.1"
-versions.publish_plugin = "1.1.0"
-versions.violations_plugin = "1.68.3"
-ext.versions = versions
-
-def commitCount = 'git rev-list --count HEAD'.execute().text.trim()
-def build_versions = [:]
-build_versions.min_sdk = 14
-build_versions.target_sdk = 30
-build_versions.java_version = JavaVersion.VERSION_1_8
-build_versions.version_code = commitCount.isNumber() ? commitCount as int : 0
-build_versions.version_name = "3.2.0"
-ext.build_versions = build_versions
-
-
-static def addRepos(RepositoryHandler handler) {
- handler.google()
- handler.mavenCentral()
- handler.gradlePluginPortal()
-}
-
-ext.addRepos = this.&addRepos
diff --git a/entry/build.gradle b/entry/build.gradle
new file mode 100644
index 0000000000000000000000000000000000000000..5a648f30d4f25931ecd993c0bf5ac9d02da85160
--- /dev/null
+++ b/entry/build.gradle
@@ -0,0 +1,30 @@
+apply plugin: 'com.huawei.ohos.hap'
+apply plugin: 'com.huawei.ohos.decctest'
+ohos {
+
+ compileSdkVersion 5
+ defaultConfig {
+ compatibleSdkVersion 4
+ }
+ buildTypes {
+ release {
+ proguardOpt {
+ proguardEnabled false
+ rulesFiles 'proguard-rules.pro'
+ }
+ }
+ }
+
+}
+
+dependencies {
+ implementation fileTree(dir: 'libs', include: ['*.jar', '*.har'])
+ testImplementation 'junit:junit:4.13'
+ ohosTestImplementation 'com.huawei.ohos.testkit:runner:1.0.0.100'
+ implementation project(':library')
+ implementation 'io.openharmony.tpc.thirdlib:XPopup:1.0.3'
+ implementation 'io.openharmony.tpc.thirdlib:EventBus:1.0.2'
+}
+decc {
+ supportType = ['html', 'xml']
+}
diff --git a/entry/src/main/config.json b/entry/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..565e1f096dbfa11526ee6cd6a88a5816ef792f8a
--- /dev/null
+++ b/entry/src/main/config.json
@@ -0,0 +1,75 @@
+{
+ "app": {
+ "bundleName": "com.leinardi.ohos.speeddial.sample",
+ "vendor": "leinardi",
+ "version": {
+ "code": 1,
+ "name": "1.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 5
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "com.leinardi.ohos.speeddial.sample",
+ "name": ".MyApplication",
+ "deviceType": [
+ "phone"
+ ],
+ "metaData": {
+ "customizeData": [
+ {
+ "name": "hwc-theme",
+ "value": "androidhwext:style/Theme.Emui.NoTitleBar",
+ "extra": ""
+ }
+ ]
+ },
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry",
+ "moduleType": "entry"
+ },
+ "abilities": [
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "orientation": "unspecified",
+ "name": "com.leinardi.ohos.speeddial.sample.MainAbility",
+ "icon": "$media:icon",
+ "description": "$string:mainability_description",
+ "label": "$string:app_name",
+ "type": "page",
+ "launchType": "standard"
+ },
+ {
+ "orientation": "unspecified",
+ "name": "com.leinardi.ohos.speeddial.sample.UseCasesActivityAblity",
+ "icon": "$media:icon",
+ "description": "$string:usecasesactivity_description",
+ "label": "$string:app_name",
+ "type": "page",
+ "launchType": "standard"
+ },
+ {
+ "orientation": "unspecified",
+ "name": "com.leinardi.ohos.speeddial.sample.TestMainAbility",
+ "icon": "$media:icon",
+ "description": "$string:testmainability_description",
+ "label": "$string:app_name",
+ "type": "page",
+ "launchType": "standard"
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/entry/src/main/java/com/leinardi/ohos/speeddial/sample/MainAbility.java b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/MainAbility.java
new file mode 100644
index 0000000000000000000000000000000000000000..c020d4cd7df1c828109fe57873c003461a5926fa
--- /dev/null
+++ b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/MainAbility.java
@@ -0,0 +1,14 @@
+package com.leinardi.ohos.speeddial.sample;
+
+import com.leinardi.ohos.speeddial.sample.slice.MainAbilitySlice;
+import ohos.aafwk.ability.Ability;
+import ohos.aafwk.content.Intent;
+
+public class MainAbility extends Ability {
+ @Override
+ public void onStart(Intent intent) {
+ super.onStart(intent);
+ super.setMainRoute(MainAbilitySlice.class.getName());
+ }
+
+}
diff --git a/entry/src/main/java/com/leinardi/ohos/speeddial/sample/MyApplication.java b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/MyApplication.java
new file mode 100644
index 0000000000000000000000000000000000000000..03a7d29b875b28840fe75253c744f9d9ea5f6388
--- /dev/null
+++ b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/MyApplication.java
@@ -0,0 +1,12 @@
+package com.leinardi.ohos.speeddial.sample;
+
+import ohos.aafwk.ability.AbilityPackage;
+import org.greenrobot.eventbus.EventBus;
+
+public class MyApplication extends AbilityPackage {
+ @Override
+ public void onInitialize() {
+ super.onInitialize();
+ EventBus.initThreadForHos(getUITaskDispatcher());
+ }
+}
diff --git a/entry/src/main/java/com/leinardi/ohos/speeddial/sample/TestMainAbility.java b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/TestMainAbility.java
new file mode 100644
index 0000000000000000000000000000000000000000..2ace063abfd11d32c0b2c3175d869642df5f1cea
--- /dev/null
+++ b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/TestMainAbility.java
@@ -0,0 +1,13 @@
+package com.leinardi.ohos.speeddial.sample;
+
+import com.leinardi.ohos.speeddial.sample.slice.TestMainAbilitySlice;
+import ohos.aafwk.ability.Ability;
+import ohos.aafwk.content.Intent;
+
+public class TestMainAbility extends Ability {
+ @Override
+ public void onStart(Intent intent) {
+ super.onStart(intent);
+ super.setMainRoute(TestMainAbilitySlice.class.getName());
+ }
+}
diff --git a/entry/src/main/java/com/leinardi/ohos/speeddial/sample/UseCasesActivityAblity.java b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/UseCasesActivityAblity.java
new file mode 100644
index 0000000000000000000000000000000000000000..fe38f9bc18b7b04086c7748aadfc6d03b60da023
--- /dev/null
+++ b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/UseCasesActivityAblity.java
@@ -0,0 +1,13 @@
+package com.leinardi.ohos.speeddial.sample;
+
+import com.leinardi.ohos.speeddial.sample.slice.UseCasesActivitySlice;
+import ohos.aafwk.ability.Ability;
+import ohos.aafwk.content.Intent;
+
+public class UseCasesActivityAblity extends Ability {
+ @Override
+ public void onStart(Intent intent) {
+ super.onStart(intent);
+ super.setMainRoute(UseCasesActivitySlice.class.getName());
+ }
+}
diff --git a/entry/src/main/java/com/leinardi/ohos/speeddial/sample/adapter/ListItemProvider.java b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/adapter/ListItemProvider.java
new file mode 100644
index 0000000000000000000000000000000000000000..4e61128aae47b8f9a7ab2f2a4688b6ab93c47ebe
--- /dev/null
+++ b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/adapter/ListItemProvider.java
@@ -0,0 +1,73 @@
+/**
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.leinardi.ohos.speeddial.sample.adapter;
+
+import com.leinardi.ohos.speeddial.sample.ResourceTable;
+import com.leinardi.ohos.speeddial.sample.beans.ListBean;
+import ohos.aafwk.ability.AbilitySlice;
+import ohos.agp.components.*;
+import ohos.hiviewdfx.HiLog;
+import ohos.hiviewdfx.HiLogLabel;
+
+import java.util.List;
+
+public class ListItemProvider extends BaseItemProvider {
+ private List list;
+ private AbilitySlice slice;
+ // 定义日志标签
+ private static final HiLogLabel LABEL = new HiLogLabel(HiLog.LOG_APP, 0x00201, "MY_TAG");
+
+ public ListItemProvider(List list, AbilitySlice slice) {
+ this.list = list;
+ this.slice = slice;
+ this.notifyDataChanged();
+ }
+
+ @Override
+ public int getCount() {
+ return list == null ? 0 : list.size();
+ }
+
+ @Override
+ public Object getItem(int position) {
+ if (list != null && position >= 0 && position < list.size()) {
+ return list.get(position);
+ }
+ return null;
+ }
+
+ @Override
+ public long getItemId(int position) {
+ return position;
+ }
+
+ @Override
+ public Component getComponent(int position, Component convertComponent, ComponentContainer componentContainer) {
+ final Component cpt;
+ if (convertComponent == null) {
+ cpt = LayoutScatter.getInstance(slice).parse(ResourceTable.Layout_layout_item_sample, null, false);
+ } else {
+ cpt = convertComponent;
+ }
+ ListBean mText = list.get(position);
+ DependentLayout mDirectionalLayout = (DependentLayout) cpt.findComponentById(ResourceTable.Id_item_DirectionalLayout);
+ Text text = (Text) cpt.findComponentById(ResourceTable.Id_item_text);
+
+ text.setText(mText.getText());
+
+ return cpt;
+ }
+}
\ No newline at end of file
diff --git a/entry/src/main/java/com/leinardi/ohos/speeddial/sample/adapter/ListItemProviderCircle.java b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/adapter/ListItemProviderCircle.java
new file mode 100644
index 0000000000000000000000000000000000000000..097f14a2eaf802bf68d757ed16e0552353f32ee9
--- /dev/null
+++ b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/adapter/ListItemProviderCircle.java
@@ -0,0 +1,193 @@
+/**
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.leinardi.ohos.speeddial.sample.adapter;
+
+import com.leinardi.ohos.speeddial.sample.ResourceTable;
+import com.leinardi.ohos.speeddial.sample.beans.ListBeanCircle;
+import ohos.aafwk.ability.AbilitySlice;
+import ohos.agp.colors.RgbColor;
+import ohos.agp.components.*;
+import ohos.agp.components.element.PixelMapElement;
+import ohos.agp.components.element.ShapeElement;
+import ohos.agp.utils.Color;
+import ohos.global.resource.NotExistException;
+import ohos.hiviewdfx.HiLog;
+import ohos.hiviewdfx.HiLogLabel;
+
+import java.io.IOException;
+import java.util.List;
+
+public class ListItemProviderCircle extends BaseItemProvider {
+ private List list;
+ private AbilitySlice slice;
+ private String type;
+ // 定义日志标签
+ private static final HiLogLabel LABEL = new HiLogLabel(HiLog.LOG_APP, 0x00201, "MY_TAG");
+
+ public ListItemProviderCircle(List list, AbilitySlice slice, String type) {
+ this.type = type;
+ this.list = list;
+ this.slice = slice;
+ this.notifyDataChanged();
+ }
+
+ @Override
+ public int getCount() {
+ return list == null ? 0 : list.size();
+ }
+
+ @Override
+ public Object getItem(int position) {
+ if (list != null && position >= 0 && position < list.size()) {
+ return list.get(position);
+ }
+ return null;
+ }
+
+ @Override
+ public long getItemId(int position) {
+ return position;
+ }
+
+ @Override
+ public Component getComponent(int position, Component convertComponent, ComponentContainer componentContainer) {
+ final Component cpt;
+ final SettingHolder holder;
+ ListBeanCircle mListBeanCircle = list.get(position);
+
+ if (convertComponent == null) {
+ if (type.equals("left") || type.equals("right")) {
+ cpt = LayoutScatter.getInstance(slice).parse(ResourceTable.Layout_layout_item_sample_circal_lr, null, false);
+ } else {
+ cpt = LayoutScatter.getInstance(slice).parse(ResourceTable.Layout_layout_item_sample_circal, null, false);
+ }
+ holder = new SettingHolder(cpt);
+ // 将获取到的子组件信息绑定到列表项的实例中
+ cpt.setTag(holder);
+ } else {
+ cpt = convertComponent;
+ // 从缓存中获取到列表项实例后,直接使用绑定的子组件信息进行数据填充。
+ holder = (SettingHolder) cpt.getTag();
+ }
+ holder.mImage.setWidth(120);
+ holder.mImage.setHeight(120);
+ holder.mText.setTextColor(Color.DKGRAY);
+ holder.mText.setVisibility(Component.VISIBLE);
+ if (type.equals("right")) {
+ holder.mDependentLayout.setWidth(120);
+ holder.mDependentLayout.setHeight(120);
+ if (list.get(position).getId() == 3) {
+ holder.mImage.setWidth(120);
+ holder.mImage.setHeight(120);
+ }
+ } else if (type.equals("left")) {
+ holder.mDependentLayout.setWidth(120);
+ holder.mDependentLayout.setHeight(120);
+ if (list.get(position).getId() == 3) {
+ holder.mImage.setWidth(120);
+ holder.mImage.setHeight(120);
+ }
+ } else if (type.equals("top")) {
+ if (position == list.size() - 7) {
+ ShapeElement shapeElement = new ShapeElement(slice, ResourceTable.Graphic_background_white_text);
+ shapeElement.setStroke(2, new RgbColor(204, 204, 204));
+ holder.mText.setBackground(shapeElement);
+ } else if (position == list.size() - 6) {
+ ShapeElement shapeElement = new ShapeElement(slice, ResourceTable.Graphic_background_white_text);
+ shapeElement.setStroke(2, new RgbColor(204, 204, 204));
+ holder.mText.setBackground(shapeElement);
+ } else if (position == list.size() - 5) {
+ ShapeElement shapeElement = new ShapeElement(slice, ResourceTable.Graphic_background_white_text);
+ shapeElement.setStroke(2, new RgbColor(204, 204, 204));
+ holder.mText.setBackground(shapeElement);
+ } else if (position == list.size() - 4) {
+ } else if (position == list.size() - 3) {
+ ShapeElement shapeElement = new ShapeElement(slice, ResourceTable.Graphic_background_white_text);
+ shapeElement.setStroke(2, new RgbColor(204, 204, 204));
+ holder.mText.setBackground(shapeElement);
+ holder.mImage.setWidth(120);
+ holder.mImage.setHeight(120);
+ } else if (position == list.size() - 2) {
+ ShapeElement shapeElement = new ShapeElement(slice, ResourceTable.Graphic_background_blue_text);
+ holder.mText.setBackground(shapeElement);
+ holder.mText.setTextColor(Color.WHITE);
+ } else if (position == list.size() - 1) {
+ holder.mText.setVisibility(Component.HIDE);
+ } else {
+ holder.mText.setVisibility(Component.HIDE);
+ }
+ } else if (type.equals("bottom")) {
+ if (position == 0) {
+ holder.mText.setVisibility(Component.HIDE);
+ } else if (position == 1) {
+ ShapeElement shapeElement = new ShapeElement(slice, ResourceTable.Graphic_background_blue_text);
+ shapeElement.setStroke(2, new RgbColor(204, 204, 204));
+ holder.mText.setBackground(shapeElement);
+ holder.mText.setTextColor(Color.WHITE);
+ } else if (position == 2) {
+ ShapeElement shapeElement = new ShapeElement(slice, ResourceTable.Graphic_background_white_text);
+ shapeElement.setStroke(2, new RgbColor(204, 204, 204));
+ holder.mText.setBackground(shapeElement);
+ holder.mImage.setWidth(120);
+ holder.mImage.setHeight(120);
+ } else if (position == 3) {
+ } else if (position == 4) {
+ ShapeElement shapeElement = new ShapeElement(slice, ResourceTable.Graphic_background_white_text);
+ shapeElement.setStroke(2, new RgbColor(204, 204, 204));
+ holder.mText.setBackground(shapeElement);
+ } else if (position == 5) {
+ ShapeElement shapeElement = new ShapeElement(slice, ResourceTable.Graphic_background_white_text);
+ shapeElement.setStroke(2, new RgbColor(204, 204, 204));
+ holder.mText.setBackground(shapeElement);
+ } else if (position == 6) {
+ ShapeElement shapeElement = new ShapeElement(slice, ResourceTable.Graphic_background_white_text);
+ shapeElement.setStroke(2, new RgbColor(204, 204, 204));
+ holder.mText.setBackground(shapeElement);
+ } else {
+ holder.mText.setVisibility(Component.HIDE);
+ }
+ }
+
+ PixelMapElement pixelMapElement = null;
+ try {
+ pixelMapElement = new PixelMapElement(holder.mText.getResourceManager().getResource(mListBeanCircle.getmImage()));
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (NotExistException e) {
+ e.printStackTrace();
+ }
+ holder.mImage.setBackground(pixelMapElement);
+ if (mListBeanCircle.getText().equals("")) {
+ holder.mText.setVisibility(Component.HIDE);
+ } else {
+ holder.mText.setText(mListBeanCircle.getText());
+ }
+ return cpt;
+ }
+
+ // 用于保存列表项中的子组件信息
+ public class SettingHolder {
+ DependentLayout mDependentLayout;
+ Image mImage;
+ Text mText;
+
+ SettingHolder(Component component) {
+ mDependentLayout = (DependentLayout) component.findComponentById(ResourceTable.Id_item_DependentLayouts);
+ mImage = (Image) component.findComponentById(ResourceTable.Id_item_image);
+ mText = (Text) component.findComponentById(ResourceTable.Id_item_text);
+ }
+ }
+}
\ No newline at end of file
diff --git a/entry/src/main/java/com/leinardi/ohos/speeddial/sample/beans/ListBean.java b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/beans/ListBean.java
new file mode 100644
index 0000000000000000000000000000000000000000..ee00d49b30b2334219b6b537ad1970ef1a3cf2a9
--- /dev/null
+++ b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/beans/ListBean.java
@@ -0,0 +1,18 @@
+package com.leinardi.ohos.speeddial.sample.beans;
+
+public class ListBean {
+ private String text;
+
+
+ public ListBean(String text) {
+ this.text = text;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+}
diff --git a/entry/src/main/java/com/leinardi/ohos/speeddial/sample/beans/ListBeanCircle.java b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/beans/ListBeanCircle.java
new file mode 100644
index 0000000000000000000000000000000000000000..55950228c8ae11a1b91a4169e4d9ae2a60d247c0
--- /dev/null
+++ b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/beans/ListBeanCircle.java
@@ -0,0 +1,41 @@
+package com.leinardi.ohos.speeddial.sample.beans;
+
+public class ListBeanCircle {
+ private int id;
+ private int mImage;
+ private String text;
+
+ public ListBeanCircle() {
+
+ }
+
+ public ListBeanCircle(int id, int mImage, String text) {
+ this.id = id;
+ this.mImage = mImage;
+ this.text = text;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public int getmImage() {
+ return mImage;
+ }
+
+ public void setmImage(int mImage) {
+ this.mImage = mImage;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+}
diff --git a/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/CustomAttachDialogFive.java b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/CustomAttachDialogFive.java
new file mode 100644
index 0000000000000000000000000000000000000000..66780fd258d92a7584f0a734d7f3bde694f1eaaf
--- /dev/null
+++ b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/CustomAttachDialogFive.java
@@ -0,0 +1,60 @@
+package com.leinardi.ohos.speeddial.sample.custom;
+
+import com.leinardi.ohos.speeddial.sample.ResourceTable;
+import com.lxj.xpopup.core.AttachPopupView;
+import ohos.agp.components.Component;
+import ohos.agp.components.DependentLayout;
+import ohos.agp.components.DirectionalLayout;
+import ohos.app.Context;
+
+public class CustomAttachDialogFive extends AttachPopupView implements Component.ClickedListener {
+ private CustomAttachDialogListener customAttachDialogListener;
+ public Context context;
+
+ public CustomAttachDialogFive(Context context, CustomAttachDialogListener customAttachDialogListener) {
+ super(context, null);
+ this.context = context;
+ this.customAttachDialogListener = customAttachDialogListener;
+ }
+
+ public CustomAttachDialogFive(Context context) {
+ super(context, null);
+ this.context = context;
+ }
+
+ public interface CustomAttachDialogListener {
+ public void onClick(Component component);
+ }
+
+ @Override
+ protected int getImplLayoutId() {
+ return ResourceTable.Layout_custom_attach_popup_five;
+ }
+
+ @Override
+ protected void onCreate() {
+ super.onCreate();
+ final DirectionalLayout dl_toggle_list = (DirectionalLayout) findComponentById(ResourceTable.Id_dl_toggle_list);
+ final DirectionalLayout dl_reverse_animation = (DirectionalLayout) findComponentById(ResourceTable.Id_dl_reverse_animation);
+ final DirectionalLayout dl_add_action = (DirectionalLayout) findComponentById(ResourceTable.Id_dl_add_action);
+ final DirectionalLayout dl_remove_action = (DirectionalLayout) findComponentById(ResourceTable.Id_dl_remove_action);
+ final DependentLayout tv_dl_main_fab = (DependentLayout) findComponentById(ResourceTable.Id_dl_main_fab);
+ final DirectionalLayout dl_layout_dialog_five = (DirectionalLayout) findComponentById(ResourceTable.Id_dl_layout_dialog_five);
+
+ dl_toggle_list.setClickedListener(this::onClick);
+ dl_reverse_animation.setClickedListener(this::onClick);
+ dl_add_action.setClickedListener(this::onClick);
+ dl_remove_action.setClickedListener(this::onClick);
+ tv_dl_main_fab.setClickedListener(this::onClick);
+ }
+
+ @Override
+ protected int setStatusBarHeight() {
+ return 130;
+ }
+
+ @Override
+ public void onClick(Component component) {
+ customAttachDialogListener.onClick(component);
+ }
+}
diff --git a/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/CustomAttachDialogFiveItem.java b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/CustomAttachDialogFiveItem.java
new file mode 100644
index 0000000000000000000000000000000000000000..113af35d005b01288937b3f0df48172b9af27a5a
--- /dev/null
+++ b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/CustomAttachDialogFiveItem.java
@@ -0,0 +1,57 @@
+package com.leinardi.ohos.speeddial.sample.custom;
+
+import com.leinardi.ohos.speeddial.sample.ResourceTable;
+import com.lxj.xpopup.core.AttachPopupView;
+import ohos.agp.components.Component;
+import ohos.agp.components.DependentLayout;
+import ohos.agp.components.Text;
+import ohos.app.Context;
+
+public class CustomAttachDialogFiveItem extends AttachPopupView implements Component.ClickedListener {
+ public Context context;
+ public CustomAttachDialogListener customAttachDialogListener;
+
+ public CustomAttachDialogFiveItem(Context context, CustomAttachDialogListener customAttachDialogListener) {
+ super(context, null);
+ this.context = context;
+ this.customAttachDialogListener = customAttachDialogListener;
+ }
+
+ public CustomAttachDialogFiveItem(Context context) {
+ super(context, null);
+ this.context = context;
+ }
+
+ @Override
+ public void onClick(Component component) {
+ customAttachDialogListener.onClick(component);
+ }
+
+ public interface CustomAttachDialogListener {
+ public void onClick(Component component);
+ }
+
+ @Override
+ protected int getImplLayoutId() {
+ return ResourceTable.Layout_custom_attach_popup_five_item;
+ }
+
+ @Override
+ protected void onCreate() {
+ super.onCreate();
+ final Text tv_main_fab_color = (Text) findComponentById(ResourceTable.Id_tv_main_fab_color);
+ final Text tv_main_fab_open = (Text) findComponentById(ResourceTable.Id_tv_main_fab_open);
+ final Text tv_main_fab_close = (Text) findComponentById(ResourceTable.Id_tv_main_fab_close);
+ final DependentLayout mainFabColorOpen = (DependentLayout) findComponentById(ResourceTable.Id_dl_main_fab_color_open);
+ final DependentLayout mainFabColorClose = (DependentLayout) findComponentById(ResourceTable.Id_dl_main_fab_color_close);
+
+ mainFabColorOpen.setClickedListener(this::onClick);
+ mainFabColorClose.setClickedListener(this::onClick);
+ }
+
+ // 设置状态栏的高度,用以修正自定义位置弹窗的高度
+ @Override
+ protected int setStatusBarHeight() {
+ return 130;
+ }
+}
diff --git a/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/CustomAttachDialogFiveItemClose.java b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/CustomAttachDialogFiveItemClose.java
new file mode 100644
index 0000000000000000000000000000000000000000..3488e1f0d232dc9c6d421e1e29590439a31ff215
--- /dev/null
+++ b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/CustomAttachDialogFiveItemClose.java
@@ -0,0 +1,57 @@
+package com.leinardi.ohos.speeddial.sample.custom;
+
+import com.leinardi.ohos.speeddial.sample.ResourceTable;
+import com.lxj.xpopup.core.AttachPopupView;
+import ohos.agp.components.Component;
+import ohos.agp.components.Text;
+import ohos.app.Context;
+
+public class CustomAttachDialogFiveItemClose extends AttachPopupView implements Component.ClickedListener {
+ private Context context;
+ private CustomFiveItemCloseListenner customFiveItemCloseListenner;
+
+ public CustomAttachDialogFiveItemClose(Context context, CustomFiveItemCloseListenner customFiveItemCloseListenner) {
+ super(context, null);
+ this.context = context;
+ this.customFiveItemCloseListenner = customFiveItemCloseListenner;
+ }
+
+ public interface CustomFiveItemCloseListenner {
+ void onClick(Component component);
+ }
+
+ @Override
+ protected int getImplLayoutId() {
+ return ResourceTable.Layout_custom_five_item_child_close;
+ }
+
+ @Override
+ protected void onCreate() {
+ super.onCreate();
+ final Text tvFabcolorOpen = (Text) findComponentById(ResourceTable.Id_tv_fab_color_close);
+ final Text tvPrimary = (Text) findComponentById(ResourceTable.Id_tv_primary_close);
+ final Text tvOrange = (Text) findComponentById(ResourceTable.Id_tv_orange_close);
+ final Text tvWhile = (Text) findComponentById(ResourceTable.Id_tv_while_close);
+ final Text tvNone = (Text) findComponentById(ResourceTable.Id_tv_none_close);
+ final Text tvPurple = (Text) findComponentById(ResourceTable.Id_tv_purple_close);
+
+ tvPrimary.setClickedListener(this::onClick);
+ tvOrange.setClickedListener(this::onClick);
+ tvWhile.setClickedListener(this::onClick);
+ tvNone.setClickedListener(this::onClick);
+ tvPurple.setClickedListener(this::onClick);
+ tvFabcolorOpen.setText("Main FAB color close");
+ //getPopupImplView().setBackground(XPopupUtils.createDrawable(0xFFFFFFFF, popupInfo.borderRadius, 0, popupInfo.borderRadius, 0));
+ }
+
+ // 设置状态栏的高度,用以修正自定义位置弹窗的高度
+ @Override
+ protected int setStatusBarHeight() {
+ return 260;
+ }
+
+ @Override
+ public void onClick(Component component) {
+ customFiveItemCloseListenner.onClick(component);
+ }
+}
diff --git a/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/CustomAttachDialogFiveItemOpen.java b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/CustomAttachDialogFiveItemOpen.java
new file mode 100644
index 0000000000000000000000000000000000000000..8e1f50ae2e5080b6d48fd843bbff4e6011f1562d
--- /dev/null
+++ b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/CustomAttachDialogFiveItemOpen.java
@@ -0,0 +1,65 @@
+package com.leinardi.ohos.speeddial.sample.custom;
+
+import com.leinardi.ohos.speeddial.sample.ResourceTable;
+import com.lxj.xpopup.core.AttachPopupView;
+import ohos.agp.components.Component;
+import ohos.agp.components.Text;
+import ohos.app.Context;
+
+/**
+ * CustomAttachDialogFiveItemOpen
+ *
+ * @since 2021.06.29
+ */
+public class CustomAttachDialogFiveItemOpen extends AttachPopupView implements Component.ClickedListener {
+ private Context context;
+ private CustomAttachDialogFiveItemListener customAttachDialogFiveItemListener;
+
+ public CustomAttachDialogFiveItemOpen(Context context, CustomAttachDialogFiveItemListener customAttachDialogFiveItemListener) {
+ super(context, null);
+ this.context = context;
+ this.customAttachDialogFiveItemListener = customAttachDialogFiveItemListener;
+ }
+
+ public CustomAttachDialogFiveItemOpen(Context context) {
+ super(context, null);
+ this.context = context;
+ }
+
+ public interface CustomAttachDialogFiveItemListener {
+ public void onClick(Component component);
+ }
+
+ @Override
+ protected int getImplLayoutId() {
+ return ResourceTable.Layout_custom_attach_popup_five_item_child;
+ }
+
+ @Override
+ protected void onCreate() {
+ super.onCreate();
+ final Text tvPurple = (Text) findComponentById(ResourceTable.Id_tv_purple);
+ final Text tvPrimary = (Text) findComponentById(ResourceTable.Id_tv_primary);
+
+ final Text tvOrange = (Text) findComponentById(ResourceTable.Id_tv_orange);
+ final Text tvWhile = (Text) findComponentById(ResourceTable.Id_tv_while);
+ final Text tvNone = (Text) findComponentById(ResourceTable.Id_tv_none);
+
+ tvPrimary.setClickedListener(this::onClick);
+ tvOrange.setClickedListener(this::onClick);
+ tvWhile.setClickedListener(this::onClick);
+ tvNone.setClickedListener(this::onClick);
+ tvPurple.setClickedListener(this::onClick);
+ }
+
+ // 设置状态栏的高度,用以修正自定义位置弹窗的高度
+ @Override
+ protected int setStatusBarHeight() {
+ return 130;
+ }
+
+ @Override
+ public void onClick(Component component) {
+ customAttachDialogFiveItemListener.onClick(component);
+ }
+}
diff --git a/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/CustomAttachDialogFour.java b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/CustomAttachDialogFour.java
new file mode 100644
index 0000000000000000000000000000000000000000..fb55156a6efa394af869c55d9fae218394c45bac
--- /dev/null
+++ b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/CustomAttachDialogFour.java
@@ -0,0 +1,63 @@
+package com.leinardi.ohos.speeddial.sample.custom;
+
+import com.leinardi.ohos.speeddial.sample.ResourceTable;
+import com.lxj.xpopup.core.AttachPopupView;
+import ohos.agp.components.Component;
+import ohos.agp.components.Text;
+import ohos.app.Context;
+
+public class CustomAttachDialogFour extends AttachPopupView implements Component.ClickedListener {
+ private Context context;
+ private LeaveMyDialogListener leaveMyDialogListener;
+
+ public CustomAttachDialogFour(Context context, LeaveMyDialogListener leaveMyDialogListener) {
+ super(context, null);
+ this.context = context;
+ this.leaveMyDialogListener = leaveMyDialogListener;
+ }
+
+ public CustomAttachDialogFour(Context context) {
+ super(context, null);
+ this.context = context;
+ }
+
+ @Override
+ public void onClick(Component component) {
+ leaveMyDialogListener.onClick(component);
+ }
+
+ public interface LeaveMyDialogListener {
+ public void onClick(Component component);
+ }
+
+ @Override
+ protected int getImplLayoutId() {
+ return ResourceTable.Layout_custom_attach_popup_four;
+ }
+
+ @Override
+ protected void onCreate() {
+ super.onCreate();
+ final Text tvZeroDegree = (Text) findComponentById(ResourceTable.Id_tv_zero_degree);
+ final Text tvFourDegree = (Text) findComponentById(ResourceTable.Id_tv_zero_four_degree);
+ final Text tvNithDegree = (Text) findComponentById(ResourceTable.Id_tv_nith_degree);
+ final Text tvEiGthDegree = (Text) findComponentById(ResourceTable.Id_tv_eigh_degree);
+ tvZeroDegree.setText("0 degrees");
+ tvFourDegree.setText("45 degrees");
+ tvNithDegree.setText("90 degrees");
+ tvEiGthDegree.setText("180 degrees");
+
+ tvZeroDegree.setClickedListener(this::onClick);
+ tvFourDegree.setClickedListener(this::onClick);
+ tvNithDegree.setClickedListener(this::onClick);
+ tvEiGthDegree.setClickedListener(this::onClick);
+
+ //getPopupImplView().setBackground(XPopupUtils.createDrawable(0xFFFFFFFF, popupInfo.borderRadius, 0, popupInfo.borderRadius, 0));
+ }
+
+ // 设置状态栏的高度,用以修正自定义位置弹窗的高度
+ @Override
+ protected int setStatusBarHeight() {
+ return 130;
+ }
+}
diff --git a/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/CustomAttachPopup2.java b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/CustomAttachPopup2.java
new file mode 100644
index 0000000000000000000000000000000000000000..cfe0f80e65e182a9d62b889e010d5731279b1c83
--- /dev/null
+++ b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/CustomAttachPopup2.java
@@ -0,0 +1,42 @@
+package com.leinardi.ohos.speeddial.sample.custom;
+
+import com.leinardi.ohos.speeddial.sample.ResourceTable;
+import com.lxj.xpopup.core.AttachPopupView;
+import com.lxj.xpopup.util.XPopupUtils;
+import ohos.agp.components.Component;
+import ohos.agp.components.Text;
+import ohos.app.Context;
+
+/**
+ * Description: 自定义背景的Attach弹窗
+ * Create by lxj, at 2019/3/13
+ */
+public class CustomAttachPopup2 extends AttachPopupView {
+ public CustomAttachPopup2(Context context) {
+ super(context, null);
+ }
+
+ @Override
+ protected int getImplLayoutId() {
+ return ResourceTable.Layout_custom_attach_popup2;
+ }
+
+ @Override
+ protected void onCreate() {
+ super.onCreate();
+ final Text tv = (Text) findComponentById(ResourceTable.Id_tv);
+ tv.setText("Use cases");
+ tv.setClickedListener(new ClickedListener() {
+ @Override
+ public void onClick(Component component) {
+ }
+ });
+ getPopupImplView().setBackground(XPopupUtils.createDrawable(0xFFFFFFFF, popupInfo.borderRadius, 0, popupInfo.borderRadius, 0));
+ }
+
+ // 设置状态栏的高度,用以修正自定义位置弹窗的高度
+ @Override
+ protected int setStatusBarHeight() {
+ return 130;
+ }
+}
diff --git a/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/FastClickUtil.java b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/FastClickUtil.java
new file mode 100644
index 0000000000000000000000000000000000000000..2b9bffec3ff9b95f05a0bebbed8ecdd7d16bc07d
--- /dev/null
+++ b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/FastClickUtil.java
@@ -0,0 +1,26 @@
+package com.leinardi.ohos.speeddial.sample.custom;
+
+public class FastClickUtil {
+ /**
+ * 两次点击按钮之间的点击间隔不能少于1000毫秒
+ */
+ private static final int MIN_CLICK_DELAY_TIME = 1000;
+ private static long lastClickTime = -1;
+
+ /**
+ * 是否为快速点击
+ *
+ * @return 快速点击
+ */
+ public static boolean isFastClick() {
+ boolean isFlag;
+ long curClickTime = System.currentTimeMillis();
+ if (curClickTime - lastClickTime > MIN_CLICK_DELAY_TIME) {
+ isFlag = false;
+ } else {
+ isFlag = true;
+ }
+ lastClickTime = curClickTime;
+ return isFlag;
+ }
+}
diff --git a/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/MessageEvent.java b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/MessageEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..fcbb1e552658f9d534581018c4f397958b5ba500
--- /dev/null
+++ b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/MessageEvent.java
@@ -0,0 +1,13 @@
+package com.leinardi.ohos.speeddial.sample.custom;
+
+public class MessageEvent {
+ public final String message;
+
+ public static MessageEvent getInstance(String message) {
+ return new MessageEvent(message);
+ }
+
+ public MessageEvent(String message) {
+ this.message = message;
+ }
+}
diff --git a/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/MyToast.java b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/MyToast.java
new file mode 100644
index 0000000000000000000000000000000000000000..a60602fa1d229bd4193874576f4db90b22dc64b2
--- /dev/null
+++ b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/MyToast.java
@@ -0,0 +1,75 @@
+package com.leinardi.ohos.speeddial.sample.custom;
+
+import com.leinardi.ohos.speeddial.sample.ResourceTable;
+import ohos.agp.colors.RgbColor;
+import ohos.agp.components.Component;
+import ohos.agp.components.DirectionalLayout;
+import ohos.agp.components.LayoutScatter;
+import ohos.agp.components.Text;
+import ohos.agp.components.element.ShapeElement;
+import ohos.agp.utils.Color;
+import ohos.agp.window.dialog.ToastDialog;
+import ohos.agp.window.service.DisplayAttributes;
+import ohos.agp.window.service.DisplayManager;
+import ohos.app.Context;
+
+/**
+ * author xuechangfeng
+ * Version 1.0
+ * ModifiedBy
+ * date 2021-05-18 14:46
+ * description 自定义Toast
+ */
+public class MyToast {
+ public static final int LENGTH_LONG = 4000;
+ private ToastDialog toastDialog;
+ private int offsetX, offsetY;
+
+ public MyToast(int offsetX, int offsetY) {
+ this.offsetX = offsetX;
+ this.offsetY = offsetY;
+ }
+
+ public void createToast(Context mContext, String content, int duration, String bgColor) {
+ Component itemView = LayoutScatter.getInstance(mContext)
+ .parse(ResourceTable.Layout_text, null, false);
+ Text text = (Text) itemView.findComponentById(ResourceTable.Id_title);
+ text.setText(content);
+ text.setTextColor(new Color(Color.getIntColor("#000000")));
+ text.setPadding(vp2px(mContext, 15), vp2px(mContext, 8),
+ vp2px(mContext, 15), vp2px(mContext, 8));
+ text.setBackground(buildDrawableByColorRadius(Color.getIntColor(bgColor), vp2px(mContext, 5)));
+ text.setMarginBottom(20);
+ if (toastDialog != null) {
+ toastDialog.cancel();
+ toastDialog = null;
+ }
+ toastDialog = new ToastDialog(mContext);
+ toastDialog.setComponent(itemView);
+ toastDialog.setSize(DirectionalLayout.LayoutConfig.MATCH_CONTENT, DirectionalLayout.LayoutConfig.MATCH_CONTENT);
+ toastDialog.setTransparent(true);
+ toastDialog.setDuration(duration);
+ toastDialog.setOffset(offsetX, offsetY);
+ toastDialog.show();
+ }
+
+ /**
+ * @return toast是否正在展示
+ */
+ public boolean toastIsShowing() {
+ return toastDialog.isShowing();
+ }
+
+ private ohos.agp.components.element.Element buildDrawableByColorRadius(int color, float radius) {
+ ShapeElement drawable = new ShapeElement();
+ drawable.setShape(0);
+ drawable.setRgbColor(RgbColor.fromArgbInt(color));
+ drawable.setCornerRadius(radius);
+ return drawable;
+ }
+
+ private static int vp2px(Context context, float vp) {
+ DisplayAttributes attributes = DisplayManager.getInstance().getDefaultDisplay(context).get().getAttributes();
+ return (int) (attributes.densityPixels * vp);
+ }
+}
diff --git a/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/ToastUtil.java b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/ToastUtil.java
new file mode 100644
index 0000000000000000000000000000000000000000..341e3e65639c18ee39c74cf34e61a468077e9de7
--- /dev/null
+++ b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/custom/ToastUtil.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.leinardi.ohos.speeddial.sample.custom;
+
+import ohos.agp.colors.RgbColor;
+import ohos.agp.components.ComponentContainer;
+import ohos.agp.components.DirectionalLayout;
+import ohos.agp.components.Text;
+import ohos.agp.components.element.ShapeElement;
+import ohos.agp.utils.LayoutAlignment;
+import ohos.agp.utils.TextAlignment;
+import ohos.agp.window.dialog.ToastDialog;
+import ohos.app.Context;
+
+/**
+ * 吐司工具类
+ */
+public class ToastUtil {
+ /**
+ * 显示一个吐司
+ *
+ * @param abilityContext 上下文
+ * @param str str
+ */
+ public static void showToast(Context abilityContext, String str) {
+ Text text = new Text(abilityContext);
+ text.setWidth(ComponentContainer.LayoutConfig.MATCH_PARENT);
+ text.setHeight(ComponentContainer.LayoutConfig.MATCH_CONTENT);
+ text.setTextSize(48);
+ text.setText(str);
+ text.setMultipleLine(true);
+ text.setTextAlignment(TextAlignment.CENTER);
+ DirectionalLayout directionalLayout = new DirectionalLayout(abilityContext);
+ directionalLayout.setBackground(createDrawable(0xF0F0F0F0, 50));
+ DirectionalLayout.LayoutConfig layoutConfig = new DirectionalLayout.LayoutConfig
+ (DirectionalLayout.LayoutConfig.MATCH_PARENT, DirectionalLayout.LayoutConfig.MATCH_CONTENT);
+ layoutConfig.setMarginBottom(100);
+ directionalLayout.setLayoutConfig(layoutConfig);
+ directionalLayout.setPadding(20, 30, 20, 30);
+ directionalLayout.addComponent(text);
+ ToastDialog toastDialog = new ToastDialog(abilityContext);
+ toastDialog.setContentCustomComponent(directionalLayout).setDuration(2000).setAutoClosable(true)
+ .setAlignment(LayoutAlignment.BOTTOM).setTransparent(true).show();
+ }
+
+ private static ShapeElement createDrawable(int color, float radius) {
+ ShapeElement drawable = new ShapeElement();
+ drawable.setShape(ShapeElement.RECTANGLE);
+ drawable.setRgbColor(new RgbColor(color));
+ drawable.setCornerRadius(radius);
+ return drawable;
+ }
+}
diff --git a/entry/src/main/java/com/leinardi/ohos/speeddial/sample/slice/MainAbilitySlice.java b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/slice/MainAbilitySlice.java
new file mode 100644
index 0000000000000000000000000000000000000000..94d5aed9f81202a36505f9004776f4d77432e04c
--- /dev/null
+++ b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/slice/MainAbilitySlice.java
@@ -0,0 +1,1576 @@
+/**
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.leinardi.ohos.speeddial.sample.slice;
+
+import com.leinardi.ohos.speeddial.sample.ResourceTable;
+import com.leinardi.ohos.speeddial.sample.adapter.ListItemProvider;
+import com.leinardi.ohos.speeddial.sample.adapter.ListItemProviderCircle;
+import com.leinardi.ohos.speeddial.sample.beans.ListBean;
+import com.leinardi.ohos.speeddial.sample.beans.ListBeanCircle;
+import com.leinardi.ohos.speeddial.sample.custom.*;
+import com.lxj.xpopup.XPopup;
+import com.lxj.xpopup.core.BasePopupView;
+import com.lxj.xpopup.interfaces.OnSelectListener;
+import ohos.aafwk.ability.AbilitySlice;
+import ohos.aafwk.content.Intent;
+import ohos.aafwk.content.Operation;
+import ohos.agp.animation.AnimatorProperty;
+import ohos.agp.colors.RgbColor;
+import ohos.agp.components.*;
+import ohos.agp.components.element.PixelMapElement;
+import ohos.agp.components.element.ShapeElement;
+import ohos.agp.utils.Color;
+import ohos.agp.utils.LayoutAlignment;
+import ohos.agp.window.dialog.ToastDialog;
+import ohos.agp.window.service.Display;
+import ohos.agp.window.service.DisplayAttributes;
+import ohos.agp.window.service.DisplayManager;
+import ohos.agp.window.service.WindowManager;
+import ohos.app.Context;
+import ohos.global.resource.NotExistException;
+import ohos.hiviewdfx.HiLog;
+import ohos.hiviewdfx.HiLogLabel;
+import ohos.multimodalinput.event.MmiPoint;
+import ohos.multimodalinput.event.TouchEvent;
+import org.greenrobot.eventbus.EventBus;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * MainAbilitySlice
+ *
+ * @since 2021-06-29
+ */
+public class MainAbilitySlice extends AbilitySlice {
+ private Image mImage, mImageAdd, mImageAddPen, mImageDelete, mMainImageBg;
+ private DependentLayout mDirectionalOne, mDirectionalTwo, mDirectionalThree, mDirectionalFour, mDirectionalFive;
+ private DependentLayout mDSOne;
+ private ListContainer mListContainer, mListContainerCircleTop, mListContainerCircleBottom, mListContainerCircleLeft, mListContainerCircleLeftTwo, mListContainerCircleRight;
+ private float mDownY = 0;
+ private int scrollType = 0;
+ private static final int UPSCROLL = 1;
+ private static final int DOWNSCROLL = 2;
+ private static final HiLogLabel LABEL = new HiLogLabel(HiLog.LOG_APP, 0x00201, "MY_TAG");
+ private boolean isFloat = true;
+ private boolean isAddFloat;
+ private boolean isShow = true;
+ private AnimatorProperty animatorProperty, animatorProperty2;
+ private Context context = this;
+ private DependentLayout dlDialog;
+ private Text dlDialogText;
+ private Text tvClose;
+ private int colorIsShow = 0;
+ private int colorClose = 0;
+ private BasePopupView basePopupView = null;
+ private BasePopupView basePopupViewFive = null;
+ private BasePopupView basePopupViewItemOpen = null;
+ private BasePopupView basePopupViewItemClose = null;
+ private ShapeElement shapeElement;
+ private ShapeElement shapeElementClose;
+ private int pos;
+ private int posDegree;
+ private boolean isDialogShow = true;
+ private DependentLayout mDependentLayoutTop;
+ private AnimatorProperty animatorPropertyAdd, animatorPropertyAddPen;
+ private boolean isLeft;
+ private boolean isTop;
+ private boolean isRight;
+ private boolean isBottom;
+ private String isFourTopSize = "0";
+ private String isFourBottomSize = "0";
+ private String isFourLeftSize = "0";
+ private String isFourRightSize = "0";
+ private ArrayList listCircle;
+ private ListItemProviderCircle mListItemProviderCircle;
+ private ListItemProvider mListItemProvider;
+ private int topNumSize = 8;
+ private Display display;
+ private boolean isOrange = true;
+ private boolean isYellow = false;
+ private boolean isDelete = false;
+ private Text top_dl_dialog_texttwo;
+ private boolean isDouble;
+ private boolean isTowShow = true;
+ private boolean isBank = false;
+ private Text mText;
+
+ @Override
+ public void onStart(Intent intent) {
+ super.onStart(intent);
+ super.setUIContent(ResourceTable.Layout_ability_main);
+ WindowManager.getInstance().getTopWindow().get().setStatusBarColor(Color.getIntColor("#4285f4"));
+ initViews();
+ int position = intent.getIntParam("flag", 0);
+ if (position == 1) {
+ initViews();
+ mImage.setVisibility(Component.HIDE);
+ isBank = true;
+ isAddFloat = false;
+ mText.setText("Minimal setup");
+ }
+ initData();
+ initListeners();
+ }
+
+ private void initViews() {
+ mText = (Text) findComponentById(ResourceTable.Id_Main_Title);
+ display = DisplayManager.getInstance().getDefaultDisplay(this).get();
+ mImage = (Image) findComponentById(ResourceTable.Id_MainAbility_More);
+ mMainImageBg = (Image) findComponentById(ResourceTable.Id_Main_bg);
+ mDependentLayoutTop = (DependentLayout) findComponentById(ResourceTable.Id_DependentLayout_Top);
+ top_dl_dialog_texttwo = (Text) findComponentById(ResourceTable.Id_top_dl_dialog_texttwo);
+ mDirectionalOne = (DependentLayout) findComponentById(ResourceTable.Id_MainAbility_One);
+ mDirectionalTwo = (DependentLayout) findComponentById(ResourceTable.Id_MainAbility_Two);
+ mDirectionalThree = (DependentLayout) findComponentById(ResourceTable.Id_MainAbility_Three);
+ mDirectionalFour = (DependentLayout) findComponentById(ResourceTable.Id_MainAbility_Four);
+ mDirectionalFive = (DependentLayout) findComponentById(ResourceTable.Id_MainAbility_Five);
+ mListContainer = (ListContainer) findComponentById(ResourceTable.Id_MainAbility_ListContainer);
+ mListContainerCircleTop = (ListContainer) findComponentById(ResourceTable.Id_Main_ListContainerCircle);
+ mListContainerCircleBottom = (ListContainer) findComponentById(ResourceTable.Id_Main_ListContainerCircleBottom);
+ mListContainerCircleLeft = (ListContainer) findComponentById(ResourceTable.Id_Main_ListContainerCircleLeft);
+ mListContainerCircleLeftTwo = (ListContainer)
+ findComponentById(ResourceTable.Id_Main_ListContainerCircleLeftTwo);
+ mListContainerCircleRight = (ListContainer) findComponentById(ResourceTable.Id_Main_ListContainerCircleRight);
+ mListContainerCircleTop.setEnabled(false);
+ mListContainerCircleBottom.setEnabled(false);
+ mListContainerCircleLeft.setEnabled(false);
+ mListContainerCircleRight.setEnabled(false);
+ mDSOne = (DependentLayout) findComponentById(ResourceTable.Id_Top_one);
+ mImageAdd = (Image) findComponentById(ResourceTable.Id_top_Add);
+ mImageAddPen = (Image) findComponentById(ResourceTable.Id_top_AddPen);
+ dlDialog = (DependentLayout) findComponentById(ResourceTable.Id_top_dl_dialog);
+ dlDialogText = (Text) findComponentById(ResourceTable.Id_top_dl_dialog_text1);
+ tvClose = (Text) findComponentById(ResourceTable.Id_top_tv_close);
+ mImageAdd = (Image) findComponentById(ResourceTable.Id_top_Add);
+ mImageAddPen = (Image) findComponentById(ResourceTable.Id_top_AddPen);
+ shapeElement = new ShapeElement();
+ shapeElement.setShape(ShapeElement.OVAL);
+ shapeElementClose = new ShapeElement();
+ shapeElementClose.setShape(ShapeElement.OVAL);
+ }
+
+ private void initData() {
+ List list = getData();
+ mListItemProvider = new ListItemProvider(list, MainAbilitySlice.this);
+ mListContainer.setItemProvider(mListItemProvider);
+ mDSOne.setContentPosition(getDisplayWidthInPx(MainAbilitySlice.this) - 200,
+ getDisplayHeightInPx(MainAbilitySlice.this) - 255);
+ }
+
+ private void initListeners() {
+ animatorProperty = mDSOne.createAnimatorProperty();
+ animatorProperty.scaleX(0).scaleY(0).setDuration(200);
+
+ animatorProperty2 = mDSOne.createAnimatorProperty();
+ animatorProperty2.scaleX(1).scaleY(1).setDuration(200);
+
+ mListContainerCircleBottom.setItemClickedListener(new ListContainer.ItemClickedListener() {
+ @Override
+ public void onItemClicked(ListContainer listContainer, Component component, int position, long l) {
+ System.out.println(listCircle.get(position).getId() + "wwwww");
+ if (isBank) {
+ initOneHide();
+ mListContainer.setEnabled(true);
+ }
+ if (listCircle.get(position).getId() == 1) {
+ initOneHide();
+ DirectionalLayout toastLayout = (DirectionalLayout)
+ LayoutScatter.getInstance(component.getContext())
+ .parse(ResourceTable.Layout_layout_toast_dia_four, null, false);
+ new ToastDialog(getContext())
+ .setContentCustomComponent(toastLayout)
+ .setSize(DirectionalLayout.LayoutConfig.MATCH_CONTENT,
+ DirectionalLayout.LayoutConfig.MATCH_CONTENT)
+ .setAlignment(LayoutAlignment.BOTTOM)
+ .show();
+ } else if (listCircle.get(position).getId() == 2) {
+ initOneHide();
+ DirectionalLayout toastLayout = (DirectionalLayout)
+ LayoutScatter.getInstance(component.getContext())
+ .parse(ResourceTable.Layout_layout_toast_dia_three, null, false);
+ new ToastDialog(getContext())
+ .setContentCustomComponent(toastLayout)
+ .setSize(DirectionalLayout.LayoutConfig.MATCH_CONTENT,
+ DirectionalLayout.LayoutConfig.MATCH_CONTENT)
+ .setAlignment(LayoutAlignment.BOTTOM)
+ .show();
+ } else if (listCircle.get(position).getId() == 3) {
+ dlDialogText.setText("Lorem ipsum dolor sit amet, consectetur");
+ top_dl_dialog_texttwo.setText("adipiscing elit, sed do eiusmod tempor inci......");
+ top_dl_dialog_texttwo.setVisibility(Component.VISIBLE);
+ dlDialog.setVisibility(Component.VISIBLE);
+ if (isDialogShow) {
+ isDialogShow = true;
+ component.getContext().getUITaskDispatcher().delayDispatch(new Runnable() {
+ @Override
+ public void run() {
+ dlDialog.setVisibility(Component.HIDE);
+ }
+ }, 2000);
+ }
+ } else if (listCircle.get(position).getId() == 4) {
+ if (!isYellow && !isDelete) {
+ isYellow = true;
+ isDelete = false;
+ listCircle.add(position + 1, new ListBeanCircle(5,
+ ResourceTable.Media_six, "Replace action"));
+ System.out.println("1");
+ } else if (!isYellow && isDelete) {
+ isDouble = true;
+ isYellow = true;
+ isDelete = true;
+ listCircle.add(position + 1, new ListBeanCircle(5,
+ ResourceTable.Media_six, "Replace action"));
+ System.out.println("9");
+ }
+ } else if (listCircle.get(position).getId() == 5) {
+ if (isYellow && isDelete) {
+ isYellow = false;
+ isDelete = true;
+ listCircle.remove(listCircle.get(position));
+ System.out.println("3");
+ } else if (isYellow && !isDelete) {
+ isYellow = false;
+ isDelete = true;
+ listCircle.remove(listCircle.get(position));
+ listCircle.add(position, new ListBeanCircle(6,
+ ResourceTable.Media_seven, "Remove action"));
+ System.out.println("4");
+ }
+ } else if (listCircle.get(position).getId() == 6) {
+ if (isYellow && isDelete) {
+ isYellow = true;
+ isDelete = false;
+ listCircle.remove(listCircle.get(position));
+ System.out.println("6");
+ } else if (isYellow && !isDelete) {
+ isYellow = false;
+ isDelete = false;
+ listCircle.remove(listCircle.get(position));
+ System.out.println("7");
+ } else if (!isYellow && isDelete) {
+ isYellow = false;
+ isDelete = false;
+ isDouble = false;
+ listCircle.remove(listCircle.get(position));
+ }
+ } else if (listCircle.get(position).getId() == 7) {
+ DirectionalLayout toastLayout = (DirectionalLayout) LayoutScatter.getInstance(component.getContext()).parse(ResourceTable.Layout_layout_toast_eight, null, false);
+ new ToastDialog(getContext())
+ .setContentCustomComponent(toastLayout)
+ .setSize(DirectionalLayout.LayoutConfig.MATCH_CONTENT,
+ DirectionalLayout.LayoutConfig.MATCH_CONTENT)
+ .setAlignment(LayoutAlignment.BOTTOM)
+ .show();
+ }
+ mListItemProviderCircle.notifyDataChanged();
+ }
+ });
+ mListContainerCircleLeft.setItemClickedListener(new ListContainer.ItemClickedListener() {
+ @Override
+ public void onItemClicked(ListContainer listContainer, Component component, int position, long l) {
+ if (isBank) {
+ initOneHide();
+ mListContainer.setEnabled(true);
+ }
+ if (listCircle.get(position).getId() == 1) {
+ initOneHide();
+ DirectionalLayout toastLayout = (DirectionalLayout) LayoutScatter.getInstance(component.getContext())
+ .parse(ResourceTable.Layout_layout_toast_dia_four, null, false);
+ new ToastDialog(getContext())
+ .setContentCustomComponent(toastLayout)
+ .setSize(DirectionalLayout.LayoutConfig.MATCH_CONTENT, DirectionalLayout.LayoutConfig.MATCH_CONTENT)
+ .setAlignment(LayoutAlignment.BOTTOM)
+ .show();
+ } else if (listCircle.get(position).getId() == 2) {
+ initOneHide();
+ DirectionalLayout toastLayout = (DirectionalLayout) LayoutScatter.getInstance(component.getContext())
+ .parse(ResourceTable.Layout_layout_toast_dia_three, null, false);
+ new ToastDialog(getContext())
+ .setContentCustomComponent(toastLayout)
+ .setSize(DirectionalLayout.LayoutConfig.MATCH_CONTENT, DirectionalLayout.LayoutConfig.MATCH_CONTENT)
+ .setAlignment(LayoutAlignment.BOTTOM)
+ .show();
+ } else if (listCircle.get(position).getId() == 3) {
+ mDSOne.setContentPosition(getDisplayWidthInPx(MainAbilitySlice.this) - 260, getDisplayHeightInPx(MainAbilitySlice.this) - 370);
+ mListContainerCircleLeft.setContentPosition(20, getDisplayHeightInPx(MainAbilitySlice.this) - 360);
+ dlDialogText.setText("Lorem ipsum dolor sit amet, consectetur");
+ top_dl_dialog_texttwo.setText("adipiscing elit, sed do eiusmod tempor inci......");
+ top_dl_dialog_texttwo.setVisibility(Component.VISIBLE);
+ dlDialog.setVisibility(Component.VISIBLE);
+ if (isDialogShow) {
+ isDialogShow = true;
+ component.getContext().getUITaskDispatcher().delayDispatch(new Runnable() {
+ @Override
+ public void run() {
+ dlDialog.setVisibility(Component.HIDE);
+ mDSOne.setContentPosition(getDisplayWidthInPx(MainAbilitySlice.this) - 260, getDisplayHeightInPx(MainAbilitySlice.this) - 270);
+ mListContainerCircleLeft.setContentPosition(20, getDisplayHeightInPx(MainAbilitySlice.this) - 260);
+ }
+ }, 2000);
+ }
+ } else if (listCircle.get(position).getId() == 4) {
+ if (!isYellow && !isDelete) {
+ isYellow = true;
+ isDelete = false;
+ listCircle.add(position, new ListBeanCircle(5, ResourceTable.Media_six, "Replace action"));
+ mDSOne.setContentPosition(getDisplayWidthInPx(MainAbilitySlice.this) - 70, getDisplayHeightInPx(MainAbilitySlice.this) - 370);
+ System.out.println("1");
+ } else if (!isYellow && isDelete) {
+ isDouble = true;
+ isYellow = true;
+ isDelete = true;
+ listCircle.add(position, new ListBeanCircle(5, ResourceTable.Media_six, "Replace action"));
+ mDSOne.setContentPosition(getDisplayWidthInPx(MainAbilitySlice.this), getDisplayHeightInPx(MainAbilitySlice.this) - 370);
+ System.out.println("9");
+ }
+ } else if (listCircle.get(position).getId() == 5) {
+ if (isYellow && isDelete) {
+ isYellow = false;
+ isDelete = true;
+ listCircle.remove(listCircle.get(position));
+ mDSOne.setContentPosition(getDisplayWidthInPx(MainAbilitySlice.this) - 70, getDisplayHeightInPx(MainAbilitySlice.this) - 370);
+ System.out.println("3");
+ } else if (isYellow && !isDelete) {
+ isYellow = false;
+ isDelete = true;
+ listCircle.remove(listCircle.get(position));
+ listCircle.add(position, new ListBeanCircle(6, ResourceTable.Media_seven, "Remove action"));
+ System.out.println("4");
+ }
+ } else if (listCircle.get(position).getId() == 6) {
+ if (isYellow && isDelete) {
+ isYellow = true;
+ isDelete = false;
+ listCircle.remove(listCircle.get(position));
+ mDSOne.setContentPosition(getDisplayWidthInPx(MainAbilitySlice.this) - 70, getDisplayHeightInPx(MainAbilitySlice.this) - 370);
+ System.out.println("6");
+ } else if (isYellow && !isDelete) {
+ isYellow = false;
+ isDelete = false;
+ listCircle.remove(listCircle.get(position));
+ System.out.println("7");
+ } else if (!isYellow && isDelete) {
+ isYellow = false;
+ isDelete = false;
+ isDouble = false;
+ listCircle.remove(listCircle.get(position));
+ mDSOne.setContentPosition(getDisplayWidthInPx(MainAbilitySlice.this) - 200, getDisplayHeightInPx(MainAbilitySlice.this) - 370);
+ System.out.println("17");
+ }
+ } else if (listCircle.get(position).getId() == 7) {
+ System.out.println("7777777");
+ DirectionalLayout toastLayout = (DirectionalLayout) LayoutScatter.getInstance(component.getContext())
+ .parse(ResourceTable.Layout_layout_toast_eight, null, false);
+ new ToastDialog(getContext())
+ .setContentCustomComponent(toastLayout)
+ .setSize(DirectionalLayout.LayoutConfig.MATCH_CONTENT, DirectionalLayout.LayoutConfig.MATCH_CONTENT)
+ .setAlignment(LayoutAlignment.BOTTOM)
+ .show();
+ }
+ mListItemProviderCircle.notifyDataChanged();
+ }
+ });
+ mListContainerCircleTop.setItemClickedListener(new ListContainer.ItemClickedListener() {
+ @Override
+ public void onItemClicked(ListContainer listContainer, Component component, int position, long l) {
+ System.out.println("到了");
+ if (isBank) {
+ initOneHide();
+ mListContainer.setEnabled(true);
+ }
+ if (listCircle.get(position).getId() == 1) {
+ initOneHide();
+ DirectionalLayout toastLayout = (DirectionalLayout) LayoutScatter.getInstance(component.getContext())
+ .parse(ResourceTable.Layout_layout_toast_dia_four, null, false);
+ new ToastDialog(getContext())
+ .setContentCustomComponent(toastLayout)
+ .setSize(DirectionalLayout.LayoutConfig.MATCH_CONTENT, DirectionalLayout.LayoutConfig.MATCH_CONTENT)
+ .setAlignment(LayoutAlignment.BOTTOM)
+ .show();
+ } else if (listCircle.get(position).getId() == 2) {
+ initOneHide();
+ DirectionalLayout toastLayout = (DirectionalLayout) LayoutScatter.getInstance(component.getContext())
+ .parse(ResourceTable.Layout_layout_toast_dia_three, null, false);
+ new ToastDialog(getContext())
+ .setContentCustomComponent(toastLayout)
+ .setSize(DirectionalLayout.LayoutConfig.MATCH_CONTENT, DirectionalLayout.LayoutConfig.MATCH_CONTENT)
+ .setAlignment(LayoutAlignment.BOTTOM)
+ .show();
+ } else if (listCircle.get(position).getId() == 3) {
+ dlDialogText.setText("Lorem ipsum dolor sit amet, consectetur");
+ top_dl_dialog_texttwo.setText("adipiscing elit, sed do eiusmod tempor inci......");
+ top_dl_dialog_texttwo.setVisibility(Component.VISIBLE);
+ dlDialog.setVisibility(Component.VISIBLE);
+ if (isDialogShow) {
+ isDialogShow = true;
+ tvClose.setClickedListener(new Component.ClickedListener() {
+ @Override
+ public void onClick(Component component) {
+ dlDialog.setVisibility(Component.HIDE);
+ }
+ });
+ component.getContext().getUITaskDispatcher().delayDispatch(new Runnable() {
+ @Override
+ public void run() {
+ dlDialog.setVisibility(Component.HIDE);
+ }
+ }, 2000);
+ }
+ } else if (listCircle.get(position).getId() == 4) {
+ if (!isYellow && !isDelete) {
+ isYellow = true;
+ isDelete = false;
+ listCircle.add(position, new ListBeanCircle(5, ResourceTable.Media_six, "Replace action"));
+ System.out.println("1");
+ } else if (!isYellow && isDelete) {
+ isDouble = true;
+ isYellow = true;
+ isDelete = true;
+ listCircle.add(position, new ListBeanCircle(5, ResourceTable.Media_six, "Replace action"));
+ System.out.println("9");
+ }
+ } else if (listCircle.get(position).getId() == 5) {
+ if (isYellow && isDelete) {
+ isYellow = false;
+ isDelete = true;
+ listCircle.remove(listCircle.get(position));
+ System.out.println("3");
+ } else if (isYellow && !isDelete) {
+ isYellow = false;
+ isDelete = true;
+ listCircle.remove(listCircle.get(position));
+ listCircle.add(position, new ListBeanCircle(6, ResourceTable.Media_seven, "Remove action"));
+ System.out.println("4");
+ }
+ } else if (listCircle.get(position).getId() == 6) {
+ if (isYellow && isDelete) {
+ isYellow = true;
+ isDelete = false;
+ listCircle.remove(listCircle.get(position));
+ System.out.println("top6");
+ } else if (isYellow && !isDelete) {
+ isYellow = false;
+ isDelete = false;
+ listCircle.remove(listCircle.get(position));
+ System.out.println("7");
+ } else if (!isYellow && isDelete) {
+ isYellow = false;
+ isDelete = false;
+ isDouble = false;
+ listCircle.remove(listCircle.get(position));
+ }
+ } else if (listCircle.get(position).getId() == 7) {
+ DirectionalLayout toastLayout = (DirectionalLayout) LayoutScatter.getInstance(component.getContext())
+ .parse(ResourceTable.Layout_layout_toast_eight, null, false);
+ new ToastDialog(getContext())
+ .setContentCustomComponent(toastLayout)
+ .setSize(DirectionalLayout.LayoutConfig.MATCH_CONTENT, DirectionalLayout.LayoutConfig.MATCH_CONTENT)
+ .setAlignment(LayoutAlignment.BOTTOM)
+ .show();
+ }
+ mListItemProviderCircle.notifyDataChanged();
+ }
+ });
+ mListContainerCircleRight.setItemClickedListener(new ListContainer.ItemClickedListener() {
+ @Override
+ public void onItemClicked(ListContainer listContainer, Component component, int position, long l) {
+ System.out.println(listCircle.get(position).getId() + "wwwww");
+ if (isBank) {
+ initOneHide();
+ mListContainer.setEnabled(true);
+ }
+ if (listCircle.get(position).getId() == 1) {
+ initOneHide();
+ DirectionalLayout toastLayout = (DirectionalLayout) LayoutScatter.getInstance(component.getContext())
+ .parse(ResourceTable.Layout_layout_toast_dia_four, null, false);
+ new ToastDialog(getContext())
+ .setContentCustomComponent(toastLayout)
+ .setSize(DirectionalLayout.LayoutConfig.MATCH_CONTENT, DirectionalLayout.LayoutConfig.MATCH_CONTENT)
+ .setAlignment(LayoutAlignment.BOTTOM)
+ .show();
+ } else if (listCircle.get(position).getId() == 2) {
+ initOneHide();
+ DirectionalLayout toastLayout = (DirectionalLayout) LayoutScatter.getInstance(component.getContext())
+ .parse(ResourceTable.Layout_layout_toast_dia_three, null, false);
+ new ToastDialog(getContext())
+ .setContentCustomComponent(toastLayout)
+ .setSize(DirectionalLayout.LayoutConfig.MATCH_CONTENT, DirectionalLayout.LayoutConfig.MATCH_CONTENT)
+ .setAlignment(LayoutAlignment.BOTTOM)
+ .show();
+ } else if (listCircle.get(position).getId() == 3) {
+ mDSOne.setContentPosition(40, getDisplayHeightInPx(MainAbilitySlice.this) - 365);
+ mListContainerCircleRight.setContentPosition(220, getDisplayHeightInPx(MainAbilitySlice.this) - 365);
+ dlDialogText.setText("Lorem ipsum dolor sit amet, consectetur");
+ top_dl_dialog_texttwo.setText("adipiscing elit, sed do eiusmod tempor inci......");
+ top_dl_dialog_texttwo.setVisibility(Component.VISIBLE);
+ dlDialog.setVisibility(Component.VISIBLE);
+ if (isDialogShow) {
+ isDialogShow = true;
+ component.getContext().getUITaskDispatcher().delayDispatch(new Runnable() {
+ @Override
+ public void run() {
+ dlDialog.setVisibility(Component.HIDE);
+ mDSOne.setContentPosition(40, getDisplayHeightInPx(MainAbilitySlice.this) - 265);
+ mListContainerCircleRight.setContentPosition(220, getDisplayHeightInPx(MainAbilitySlice.this) - 265);
+ }
+ }, 2000);
+ }
+ } else if (listCircle.get(position).getId() == 4) {
+ if (!isYellow && !isDelete) {
+ isYellow = true;
+ isDelete = false;
+ listCircle.add(position + 1, new ListBeanCircle(5, ResourceTable.Media_six, "Replace action"));
+ System.out.println("1");
+ } else if (!isYellow && isDelete) {
+ isDouble = true;
+ isYellow = true;
+ isDelete = true;
+ listCircle.add(position + 1, new ListBeanCircle(5, ResourceTable.Media_six, "Replace action"));
+ System.out.println("9");
+ }
+ } else if (listCircle.get(position).getId() == 5) {
+ if (isYellow && isDelete) {
+ isYellow = false;
+ isDelete = true;
+ listCircle.remove(listCircle.get(position));
+ System.out.println("3");
+ } else if (isYellow && !isDelete) {
+ isYellow = false;
+ isDelete = true;
+ listCircle.remove(listCircle.get(position));
+ listCircle.add(position, new ListBeanCircle(6, ResourceTable.Media_seven, "Remove action"));
+ System.out.println("4");
+ }
+ } else if (listCircle.get(position).getId() == 6) {
+ if (isYellow && isDelete) {
+ isYellow = true;
+ isDelete = false;
+ listCircle.remove(listCircle.get(position));
+ System.out.println("6");
+ } else if (isYellow && !isDelete) {
+ isYellow = false;
+ isDelete = false;
+ listCircle.remove(listCircle.get(position));
+ System.out.println("7");
+ } else if (!isYellow && isDelete) {
+ isYellow = false;
+ isDelete = false;
+ isDouble = false;
+ listCircle.remove(listCircle.get(position));
+ }
+ } else if (listCircle.get(position).getId() == 7) {
+ DirectionalLayout toastLayout = (DirectionalLayout) LayoutScatter.getInstance(component.getContext())
+ .parse(ResourceTable.Layout_layout_toast_eight, null, false);
+ new ToastDialog(getContext())
+ .setContentCustomComponent(toastLayout)
+ .setSize(DirectionalLayout.LayoutConfig.MATCH_CONTENT, DirectionalLayout.LayoutConfig.MATCH_CONTENT)
+ .setAlignment(LayoutAlignment.BOTTOM)
+ .show();
+ }
+ mListItemProviderCircle.notifyDataChanged();
+ }
+ });
+ mMainImageBg.setClickedListener(new Component.ClickedListener() {
+ @Override
+ public void onClick(Component component) {
+ initOneHide();
+ mListContainer.setEnabled(true);
+ }
+ });
+ animatorPropertyAddPen = mImageAddPen.createAnimatorProperty();
+ animatorPropertyAdd = mImageAdd.createAnimatorProperty();
+ animatorPropertyAdd.rotate(45).setDuration(1);
+ mImageAdd.setBindStateChangedListener(new Component.BindStateChangedListener() {
+ @Override
+ public void onComponentBoundToWindow(Component component) {
+ animatorPropertyAdd.start();
+ }
+
+ @Override
+ public void onComponentUnboundFromWindow(Component component) {
+ animatorPropertyAdd.stop();
+ }
+ });
+ mDSOne.setClickedListener(new Component.ClickedListener() {
+ @Override
+ public void onClick(Component component) {
+ if (!isAddFloat) {
+ isOrange = true;
+ isDelete = false;
+ isYellow = false;
+ isFourTopSize = "0";
+ isAddFloat = true;
+ mListContainer.setEnabled(false);
+ mImageAdd.setVisibility(Component.HIDE);
+ mImageAddPen.setVisibility(Component.VISIBLE);
+ if (posDegree == 0) {
+ mImageAdd.setWidth(90);
+ mImageAdd.setHeight(90);
+ animatorPropertyAddPen.rotate(45).setDuration(10);
+ animatorPropertyAddPen.start();
+ } else if (posDegree == 1) {
+ animatorPropertyAdd.rotate(0).setDuration(1);
+ animatorPropertyAdd.start();
+ mImageAdd.setWidth(90);
+ mImageAdd.setHeight(90);
+ animatorPropertyAddPen.rotate(45).setDuration(300);
+ animatorPropertyAddPen.start();
+ } else if (posDegree == 2) {
+ animatorPropertyAdd.rotate(-45).setDuration(1);
+ animatorPropertyAdd.start();
+ PixelMapElement pixelMapElement = null;
+ try {
+ pixelMapElement = new PixelMapElement(mImageAddPen.getResourceManager()
+ .getResource(ResourceTable.Media_brush1));
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (NotExistException e) {
+ e.printStackTrace();
+ }
+ mImageAddPen.setBackground(pixelMapElement);
+ animatorPropertyAddPen.rotate(90).setDuration(300);
+ animatorPropertyAddPen.start();
+ } else if (posDegree == 3) {
+ animatorPropertyAdd.rotate(-45).setDuration(1);
+ animatorPropertyAdd.start();
+
+ PixelMapElement pixelMapElement = null;
+ try {
+ pixelMapElement = new PixelMapElement(mImageAddPen.getResourceManager()
+ .getResource(ResourceTable.Media_brush2));
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (NotExistException e) {
+ e.printStackTrace();
+ }
+ mImageAddPen.setBackground(pixelMapElement);
+ animatorPropertyAddPen.rotate(180).setDuration(300);
+ animatorPropertyAddPen.start();
+ }
+
+ if (colorIsShow == 0) {
+ shapeElement.setRgbColor(new RgbColor(221, 0, 0));
+ mDSOne.setBackground(shapeElement);
+ } else if (colorIsShow == 1) {
+ shapeElement.setRgbColor(new RgbColor(66, 133, 244));
+ mDSOne.setBackground(shapeElement);
+ } else if (colorIsShow == 2) {
+ shapeElement.setRgbColor(new RgbColor(255, 109, 0));
+ mDSOne.setBackground(shapeElement);
+ } else if (colorIsShow == 3) {
+ shapeElement.setRgbColor(new RgbColor(170, 0, 255));
+ mDSOne.setBackground(shapeElement);
+ } else if (colorIsShow == 4) {
+ shapeElement.setRgbColor(new RgbColor(255, 255, 255));
+ shapeElement.setStroke(1, new RgbColor(204, 204, 204));
+ mDSOne.setBackground(shapeElement);
+ } else if (colorIsShow == 5) {
+ PixelMapElement pixelMapElement = null;
+ try {
+ pixelMapElement = new PixelMapElement(mDSOne.getResourceManager()
+ .getResource(ResourceTable.Media_yy));
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (NotExistException e) {
+ e.printStackTrace();
+ }
+ mDSOne.setBackground(pixelMapElement);
+ }
+
+ if (pos == 0) {
+ mListContainerCircleLeft.setVisibility(Component.HIDE);
+ mListContainerCircleTop.setVisibility(Component.VISIBLE);
+ mListContainerCircleRight.setVisibility(Component.HIDE);
+ mListContainerCircleBottom.setVisibility(Component.HIDE);
+ isLeft = false;
+ isTop = true;
+ isRight = false;
+ isBottom = false;
+ if (isBank) {
+ } else {
+ listCircle = getDataCircle();
+ }
+ mListItemProviderCircle = new ListItemProviderCircle(listCircle,
+ MainAbilitySlice.this, "top");
+ mListContainerCircleTop.setItemProvider(mListItemProviderCircle);
+ mListContainerCircleTop.setOrientation(Component.VERTICAL);
+ mDSOne.setContentPosition(getDisplayWidthInPx(MainAbilitySlice.this) - 260, getDisplayHeightInPx(MainAbilitySlice.this) - 350);
+ } else if (pos == 1) {
+ mListContainerCircleLeft.setVisibility(Component.VISIBLE);
+ mListContainerCircleLeftTwo.setVisibility(Component.VISIBLE);
+ mListContainerCircleTop.setVisibility(Component.HIDE);
+ mListContainerCircleRight.setVisibility(Component.HIDE);
+ mListContainerCircleBottom.setVisibility(Component.HIDE);
+ isLeft = true;
+ isTop = false;
+ isRight = false;
+ isBottom = false;
+ if (isBank) {
+ mListItemProviderCircle = new ListItemProviderCircle(listCircle,
+ MainAbilitySlice.this, "left");
+ mListContainerCircleLeftTwo.setItemProvider(mListItemProviderCircle);
+ mListContainerCircleLeftTwo.setOrientation(Component.HORIZONTAL);
+ } else {
+ listCircle = getDataCircleLeft();
+ mListItemProviderCircle = new ListItemProviderCircle(listCircle, MainAbilitySlice.this, "left");
+ mListContainerCircleLeft.setItemProvider(mListItemProviderCircle);
+ mListContainerCircleLeft.setOrientation(Component.HORIZONTAL);
+ }
+ mDSOne.setContentPosition(getDisplayWidthInPx(MainAbilitySlice.this) - 200,
+ getDisplayHeightInPx(MainAbilitySlice.this) - 370);
+ } else if (pos == 2) {
+ mListContainerCircleLeft.setVisibility(Component.HIDE);
+ mListContainerCircleTop.setVisibility(Component.HIDE);
+ mListContainerCircleRight.setVisibility(Component.HIDE);
+ mListContainerCircleBottom.setVisibility(Component.VISIBLE);
+ isLeft = false;
+ isTop = false;
+ isRight = false;
+ isBottom = true;
+ if (isBank) {
+ } else {
+ listCircle = getDataCircleBottom();
+ }
+ mListItemProviderCircle = new ListItemProviderCircle(listCircle, MainAbilitySlice.this, "bottom");
+ mListContainerCircleBottom.setItemProvider(mListItemProviderCircle);
+ mListContainerCircleBottom.setOrientation(Component.VERTICAL);
+ mDSOne.setContentPosition(getDisplayWidthInPx(MainAbilitySlice.this) - vp2px(context, 90), getDisplayHeightInPx(MainAbilitySlice.this) - vp2px(context, 600));
+ } else if (pos == 3) {
+ mListContainerCircleLeft.setVisibility(Component.HIDE);
+ mListContainerCircleTop.setVisibility(Component.HIDE);
+ mListContainerCircleRight.setVisibility(Component.VISIBLE);
+ mListContainerCircleBottom.setVisibility(Component.HIDE);
+ isLeft = false;
+ isTop = false;
+ isRight = true;
+ isBottom = false;
+ if (isBank) {
+ } else {
+ listCircle = getDataCircleLeft();
+ }
+ mListItemProviderCircle = new ListItemProviderCircle(listCircle, MainAbilitySlice.this, "right");
+ mListContainerCircleRight.setItemProvider(mListItemProviderCircle);
+ mDSOne.setContentPosition(40, getDisplayHeightInPx(MainAbilitySlice.this) - 270);
+ mListContainerCircleRight.setContentPosition(220, getDisplayHeightInPx(MainAbilitySlice.this) - 260);
+ mListContainerCircleRight.setOrientation(Component.HORIZONTAL);
+ Collections.reverse(listCircle);
+ }
+ mMainImageBg.setVisibility(Component.VISIBLE);
+ } else {
+ isOrange = false;
+ isDelete = false;
+ isYellow = false;
+ isFourTopSize = "0";
+ DirectionalLayout toastLayout = (DirectionalLayout) LayoutScatter.getInstance(component.getContext()).parse(ResourceTable.Layout_layout_toast_dia, null, false);
+ new ToastDialog(getContext())
+ .setContentCustomComponent(toastLayout)
+ .setSize(DirectionalLayout.LayoutConfig.MATCH_CONTENT, DirectionalLayout.LayoutConfig.MATCH_CONTENT)
+ .setAlignment(LayoutAlignment.BOTTOM)
+ .show();
+ initOneHide();
+ }
+ }
+ });
+ mListContainer.setLongClickable(false);
+ mListContainer.setTouchEventListener(new Component.TouchEventListener() {
+ @Override
+ public boolean onTouchEvent(Component component, TouchEvent touchEvent) {
+ int action = touchEvent.getAction();
+ MmiPoint point = touchEvent.getPointerPosition(touchEvent.getIndex());
+ switch (action) {
+ case TouchEvent.PRIMARY_POINT_DOWN:
+ return true;
+ case TouchEvent.POINT_MOVE:
+ if (point.getY() > mDownY) {
+ scrollType = UPSCROLL;
+ } else if (point.getY() < mDownY) {
+ // 下滑事件
+ scrollType = DOWNSCROLL;
+ }
+ mDownY = point.getY();
+ break;
+ case TouchEvent.PRIMARY_POINT_UP:
+ mDownY = 0;
+ break;
+ case TouchEvent.NONE:
+ case TouchEvent.CANCEL:
+ mDownY = point.getY();
+ return true;
+ default:
+ break;
+ }
+ return false;
+ }
+ });
+ mListContainer.setScrolledListener(new Component.ScrolledListener() {
+ @Override
+ public void onContentScrolled(Component component, int i, int i1, int i2, int i3) {
+ if (scrollType == UPSCROLL) {
+ animatorProperty2.start();
+ initOneHide();
+ } else if (scrollType == DOWNSCROLL) {
+ animatorProperty.start();
+ initOneHide();
+ }
+ }
+ });
+ mDirectionalOne.setClickedListener(new Component.ClickedListener() {
+ @Override
+ public void onClick(Component component) {
+ mListContainer.setEnabled(true);
+ if (isFloat) {
+ isFloat = false;
+ animatorProperty.start();
+ initOneHide();
+ } else {
+ isFloat = true;
+ animatorProperty2.start();
+ }
+ }
+ });
+ //use case click
+ mImage.setClickedListener(new Component.ClickedListener() {
+ @Override
+ public void onClick(Component component) {
+ if (FastClickUtil.isFastClick()) {
+ return;
+ }
+ new XPopup.Builder(getContext())
+ .isDestroyOnDismiss(true) // 对于只使用一次的弹窗,推荐设置这个
+ .atView(component)
+ .hasShadowBg(false) // 去掉半透明背景
+ /* .asCustom(new CustomAttachPopup2(getContext())).show();*/
+ .asAttachList(new String[]{"Use cases"}, null, new OnSelectListener() {
+ @Override
+ public void onSelect(int position, String text) {
+ Intent intent = new Intent();
+ Operation openOption = new Intent.OperationBuilder()
+ .withDeviceId("")
+ .withBundleName("com.leinardi.ohos.speeddial.sample")
+ .withAbilityName("com.leinardi.ohos.speeddial.sample.UseCasesActivityAblity")
+ .build();
+ intent.setOperation(openOption);
+ startAbility(intent);
+ component.getContext().setTransitionAnimation(0, 0);
+ }
+ }, 0, 0).show();
+ }
+ });
+ mDirectionalTwo.setClickedListener(new Component.ClickedListener() {
+ @Override
+ public void onClick(Component component) {
+ top_dl_dialog_texttwo.setVisibility(Component.HIDE);
+ dlDialogText.setText("Test snackbar");
+ top_dl_dialog_texttwo.setVisibility(Component.VISIBLE);
+ dlDialog.setVisibility(Component.VISIBLE);
+ if (isDialogShow) {
+ top_dl_dialog_texttwo.setVisibility(Component.HIDE);
+ isDialogShow = true;
+ tvClose.setClickedListener(new Component.ClickedListener() {
+ @Override
+ public void onClick(Component component) {
+ dlDialog.setVisibility(Component.HIDE);
+ }
+ });
+ component.getContext().getUITaskDispatcher().delayDispatch(new Runnable() {
+ @Override
+ public void run() {
+ dlDialog.setVisibility(Component.HIDE);
+ }
+ }, 2000);
+ }
+ }
+ });
+ mDirectionalThree.setClickedListener(new Component.ClickedListener() {
+ @Override
+ public void onClick(Component component) {
+ if (FastClickUtil.isFastClick()) {
+ return;
+ }
+ new XPopup.Builder(getContext())
+ .isDarkTheme(true)
+ .hasShadowBg(false)
+ .isDestroyOnDismiss(true) // 对于只使用一次的弹窗,推荐设置这个
+ .atView(component) // 依附于所点击的View,内部会自动判断在上方或者下方显示
+ .asAttachList(new String[]{" Top ", " Left ", "Bottom ", " Right "},
+ null,
+ new OnSelectListener() {
+ @Override
+ public void onSelect(int position, String text) {
+ if (position == 0) {
+ pos = position;
+ } else if (position == 1) {
+ pos = position;
+ } else if (position == 2) {
+ pos = position;
+ } else if (position == 3) {
+ pos = position;
+ }
+ }
+ }, 0, 0).show();
+ }
+ });
+ mDirectionalFour.setClickedListener(new Component.ClickedListener() {
+ @Override
+ public void onClick(Component component) {
+ if (FastClickUtil.isFastClick()) {
+ return;
+ }
+ new XPopup.Builder(getContext())
+ .hasShadowBg(false)
+ .isDarkTheme(true)
+ .isDestroyOnDismiss(true) // 对于只使用一次的弹窗,推荐设置这个
+ .atView(component) // 依附于所点击的View,内部会自动判断在上方或者下方显示
+ .asAttachList(new String[]{"0 degrees", "45 degrees", "90 degrees", "180 degrees"},
+ null,
+ new OnSelectListener() {
+ @Override
+ public void onSelect(int position, String text) {
+ if (position == 0) {
+ posDegree = position;
+ } else if (position == 1) {
+ posDegree = position;
+ } else if (position == 2) {
+ posDegree = position;
+ } else if (position == 3) {
+ posDegree = position;
+ }
+ }
+ }, 0, 0).show();
+ }
+ });
+ mDirectionalFive.setClickedListener(new Component.ClickedListener() {
+ @Override
+ public void onClick(Component component) {
+ if (FastClickUtil.isFastClick()) {
+ return;
+ }
+ basePopupView = new XPopup.Builder(getContext())
+ .atView(component)
+ .hasShadowBg(false) // 去掉半透明背景
+ .asCustom(new CustomAttachDialogFive(getContext(),
+ new CustomAttachDialogFive.CustomAttachDialogListener() {
+ @Override
+ public void onClick(Component component) {
+ switch (component.getId()) {
+ //first main fab
+ case ResourceTable.Id_dl_main_fab:
+ showFive(component);
+ break;
+ //toggle list
+ case ResourceTable.Id_dl_toggle_list:
+ if (isShow) {
+ isShow = false;
+ mListContainer.setVisibility(Component.HIDE);
+ } else {
+ isShow = true;
+ mListContainer.setVisibility(Component.VISIBLE);
+ // initData();
+ }
+ break;
+ //view reverse
+ case ResourceTable.Id_dl_reverse_animation:
+
+ break;
+ //add action
+ case ResourceTable.Id_dl_add_action:
+ if (listCircle != null) {
+ if (listCircle.size() == 5) {
+ mDSOne.setContentPosition(getDisplayWidthInPx(MainAbilitySlice.this) - 70, getDisplayHeightInPx(
+ MainAbilitySlice.this) - 370);
+ } else if (listCircle.size() == 6) {
+ mDSOne.setContentPosition(getDisplayWidthInPx(MainAbilitySlice.this), getDisplayHeightInPx(MainAbilitySlice.this) - 370);
+ }
+ }
+ if (isBank) {
+ topNumSize += 1;
+ if (isTowShow) {
+ listCircle = new ArrayList<>();
+ isTowShow = false;
+ }
+ listCircle.add(new ListBeanCircle(topNumSize, ResourceTable.Media_nine, ""));
+ if (!isAddFloat) {
+ mListContainerCircleLeft.setVisibility(Component.HIDE);
+ mListContainerCircleTop.setVisibility(Component.HIDE);
+ mListContainerCircleRight.setVisibility(Component.HIDE);
+ mListContainerCircleBottom.setVisibility(Component.HIDE);
+ } else {
+ if (pos == 0) {
+ mListContainerCircleLeft.setVisibility(Component.HIDE);
+ mListContainerCircleTop.setVisibility(Component.VISIBLE);
+ mListContainerCircleRight.setVisibility(Component.HIDE);
+ mListContainerCircleBottom.setVisibility(Component.HIDE);
+ isLeft = false;
+ isTop = true;
+ isRight = false;
+ isBottom = false;
+ mListItemProviderCircle = new ListItemProviderCircle(listCircle, MainAbilitySlice.this, "top");
+ mListContainerCircleTop.setItemProvider(mListItemProviderCircle);
+ mListContainerCircleTop.setOrientation(Component.VERTICAL);
+ } else if (pos == 1) {
+ mListContainerCircleLeft.setVisibility(Component.VISIBLE);
+ mListContainerCircleTop.setVisibility(Component.HIDE);
+ mListContainerCircleRight.setVisibility(Component.HIDE);
+ mListContainerCircleBottom.setVisibility(Component.HIDE);
+ isLeft = true;
+ isTop = false;
+ isRight = false;
+ isBottom = false;
+ mListItemProviderCircle = new ListItemProviderCircle(listCircle, MainAbilitySlice.this, "left");
+ mListContainerCircleLeftTwo.setItemProvider(mListItemProviderCircle);
+ mListContainerCircleLeftTwo.setOrientation(Component.HORIZONTAL);
+ } else if (pos == 2) {
+ mListContainerCircleLeft.setVisibility(Component.HIDE);
+ mListContainerCircleTop.setVisibility(Component.HIDE);
+ mListContainerCircleRight.setVisibility(Component.HIDE);
+ mListContainerCircleBottom.setVisibility(Component.VISIBLE);
+ isLeft = false;
+ isTop = false;
+ isRight = false;
+ isBottom = true;
+ mListItemProviderCircle = new ListItemProviderCircle(listCircle, MainAbilitySlice.this, "bottom");
+ mListContainerCircleBottom.setItemProvider(mListItemProviderCircle);
+ mListContainerCircleBottom.setOrientation(Component.VERTICAL);
+ } else if (pos == 3) {
+ mListContainerCircleLeft.setVisibility(Component.HIDE);
+ mListContainerCircleTop.setVisibility(Component.HIDE);
+ mListContainerCircleRight.setVisibility(Component.VISIBLE);
+ mListContainerCircleBottom.setVisibility(Component.HIDE);
+ isLeft = false;
+ isTop = false;
+ isRight = true;
+ isBottom = false;
+ mListItemProviderCircle = new ListItemProviderCircle(listCircle, MainAbilitySlice.this, "right");
+ mListContainerCircleRight.setItemProvider(mListItemProviderCircle);
+ mListContainerCircleRight.setOrientation(Component.HORIZONTAL);
+ }
+ }
+ } else {
+ if (topNumSize == 6) {
+ topNumSize += 1;
+ }
+ topNumSize += 1;
+ System.out.println("top" + topNumSize);
+ if (isTop) {
+ listCircle.add(0, new ListBeanCircle(topNumSize, ResourceTable.Media_nine, ""));
+ } else if (isLeft) {
+ listCircle.add(0, new ListBeanCircle(topNumSize, ResourceTable.Media_nine, ""));
+ } else if (isBottom) {
+ listCircle.add(listCircle.size(), new ListBeanCircle(topNumSize, ResourceTable.Media_nine, ""));
+ } else if (isRight) {
+ listCircle.add(listCircle.size(), new ListBeanCircle(topNumSize, ResourceTable.Media_nine, ""));
+ }
+ if (listCircle != null) {
+ mListItemProviderCircle.notifyDataChanged();
+ }
+ }
+ break;
+ //remove action
+ case ResourceTable.Id_dl_remove_action:
+ if (isBank) {
+ if (listCircle != null && listCircle.size() != 0) {
+ listCircle.remove(0);
+ }
+ if (pos == 0) {
+ mListItemProviderCircle = new ListItemProviderCircle(listCircle, MainAbilitySlice.this, "top");
+ mListContainerCircleTop.setItemProvider(mListItemProviderCircle);
+ mListContainerCircleTop.setOrientation(Component.VERTICAL);
+ } else if (pos == 1) {
+ mListItemProviderCircle = new ListItemProviderCircle(listCircle, MainAbilitySlice.this, "left");
+ mListContainerCircleLeftTwo.setItemProvider(mListItemProviderCircle);
+ mListContainerCircleLeftTwo.setOrientation(Component.HORIZONTAL);
+ } else if (pos == 2) {
+ mListItemProviderCircle = new ListItemProviderCircle(listCircle, MainAbilitySlice.this, "bottom");
+ mListContainerCircleBottom.setItemProvider(mListItemProviderCircle);
+ mListContainerCircleBottom.setOrientation(Component.VERTICAL);
+ } else if (pos == 3) {
+ mListItemProviderCircle = new ListItemProviderCircle(listCircle, MainAbilitySlice.this, "right");
+ mListContainerCircleRight.setItemProvider(mListItemProviderCircle);
+ mListContainerCircleRight.setOrientation(Component.HORIZONTAL);
+ }
+ } else {
+ topNumSize -= 1;
+ if (isTop) {
+ if (listCircle.size() != 0) {
+ if (listCircle.get(0).getId() == 6 && isDouble) {
+ isDouble = true;
+ isDelete = false;
+ } else if (listCircle.get(0).getId() == 6 && !isDouble) {
+ isDouble = false;
+ isDelete = false;
+ } else if (listCircle.get(0).getId() == 5) {
+ isDouble = false;
+ isDelete = false;
+ isYellow = false;
+ topNumSize = 8;
+ } else if (listCircle.get(0).getId() == 4) {
+ isDouble = true;
+ isDelete = true;
+ isYellow = true;
+ topNumSize = 8;
+ } else if (listCircle.get(0).getId() == 3) {
+ isDouble = true;
+ isDelete = true;
+ isYellow = true;
+ topNumSize = 8;
+ } else if (listCircle.get(0).getId() == 2) {
+ isDouble = true;
+ isDelete = true;
+ isYellow = true;
+ topNumSize = 8;
+ } else if (listCircle.get(0).getId() == 1) {
+ topNumSize = 8;
+ }
+ listCircle.remove(0);
+ }
+ } else if (isLeft) {
+ if (listCircle.size() != 0) {
+ if (listCircle.get(0).getId() == 6 && isDouble) {
+ isDouble = true;
+ isDelete = false;
+ } else if (listCircle.get(0).getId() == 6 && !isDouble) {
+ isDouble = false;
+ isDelete = false;
+ } else if (listCircle.get(0).getId() == 5) {
+ isDouble = false;
+ isDelete = false;
+ isYellow = false;
+ topNumSize = 8;
+ } else if (listCircle.get(0).getId() == 4) {
+ isDouble = true;
+ isDelete = true;
+ isYellow = true;
+ topNumSize = 8;
+ } else if (listCircle.get(0).getId() == 3) {
+ isDouble = true;
+ isDelete = true;
+ isYellow = true;
+ topNumSize = 8;
+ } else if (listCircle.get(0).getId() == 2) {
+ isDouble = true;
+ isDelete = true;
+ isYellow = true;
+ topNumSize = 8;
+ } else if (listCircle.get(0).getId() == 1) {
+ topNumSize = 8;
+ }
+ listCircle.remove(0);
+ if (listCircle.size() == 5) {
+ mDSOne.setContentPosition(getDisplayWidthInPx(MainAbilitySlice.this) - 200, getDisplayHeightInPx(MainAbilitySlice.this) - 370);
+ } else if (listCircle.size() == 6) {
+ mDSOne.setContentPosition(getDisplayWidthInPx(MainAbilitySlice.this) - 70, getDisplayHeightInPx(MainAbilitySlice.this) - 370);
+ }
+ }
+ } else if (isBottom) {
+ if (listCircle.size() != 0) {
+ if (listCircle.get(0).getId() == 6 && isDouble) {
+ isDouble = true;
+ isDelete = false;
+ } else if (listCircle.get(0).getId() == 6 && !isDouble) {
+ isDouble = false;
+ isDelete = false;
+ } else if (listCircle.get(0).getId() == 5) {
+ isDouble = false;
+ isDelete = false;
+ isYellow = false;
+ topNumSize = 8;
+ } else if (listCircle.get(0).getId() == 4) {
+ isDouble = true;
+ isDelete = true;
+ isYellow = true;
+ topNumSize = 8;
+ } else if (listCircle.get(0).getId() == 3) {
+ isDouble = true;
+ isDelete = true;
+ isYellow = true;
+ topNumSize = 8;
+ } else if (listCircle.get(0).getId() == 2) {
+ isDouble = true;
+ isDelete = true;
+ isYellow = true;
+ topNumSize = 8;
+ } else if (listCircle.get(0).getId() == 1) {
+ topNumSize = 8;
+ }
+ listCircle.remove(listCircle.size() - 1);
+ }
+ } else if (isRight) {
+ if (listCircle.size() != 0) {
+ if (listCircle.get(0).getId() == 6 && isDouble) {
+ isDouble = true;
+ isDelete = false;
+ } else if (listCircle.get(0).getId() == 6 && !isDouble) {
+ isDouble = false;
+ isDelete = false;
+ } else if (listCircle.get(0).getId() == 5) {
+ isDouble = false;
+ isDelete = false;
+ isYellow = false;
+ topNumSize = 8;
+ } else if (listCircle.get(0).getId() == 4) {
+ isDouble = true;
+ isDelete = true;
+ isYellow = true;
+ topNumSize = 8;
+ } else if (listCircle.get(0).getId() == 3) {
+ isDouble = true;
+ isDelete = true;
+ isYellow = true;
+ topNumSize = 8;
+ } else if (listCircle.get(0).getId() == 2) {
+ isDouble = true;
+ isDelete = true;
+ isYellow = true;
+ topNumSize = 8;
+ } else if (listCircle.get(0).getId() == 1) {
+ topNumSize = 8;
+ }
+ listCircle.remove(listCircle.size() - 1);
+ }
+ }
+ if (listCircle != null) {
+ mListItemProviderCircle.notifyDataChanged();
+ }
+ }
+ break;
+ }
+ basePopupView.dismiss();
+ }
+ }));
+ basePopupView.show();
+ }
+ });
+ }
+
+ private int vp2px(Context context, float vp) {
+ DisplayAttributes attributes = DisplayManager.getInstance().getDefaultDisplay(context).get().getAttributes();
+ return (int) (attributes.densityPixels * vp);
+ }
+
+ private void initOneHide() {
+ mListContainer.setEnabled(true);
+ mDSOne.setContentPosition(getDisplayWidthInPx(MainAbilitySlice.this) - 260, getDisplayHeightInPx(MainAbilitySlice.this) - 350);
+ mListContainerCircleTop.setVisibility(Component.VERTICAL);
+ mListContainerCircleBottom.setVisibility(Component.VERTICAL);
+ mListContainerCircleLeft.setVisibility(Component.VERTICAL);
+ mListContainerCircleLeftTwo.setVisibility(Component.VERTICAL);
+ mListContainerCircleRight.setVisibility(Component.VERTICAL);
+ isAddFloat = false;
+ mMainImageBg.setVisibility(Component.HIDE);
+ mImageAdd.setVisibility(Component.VISIBLE);
+ mImageAddPen.setVisibility(Component.HIDE);
+ mImageAdd.setWidth(50);
+ mImageAdd.setHeight(50);
+ if (posDegree == 0) {
+ } else if (posDegree == 1) {
+ animatorPropertyAdd.rotate(-45).setDuration(300);
+ animatorPropertyAdd.start();
+ animatorPropertyAddPen.rotate(0).setDuration(1);
+ animatorPropertyAddPen.start();
+ } else if (posDegree == 2) {
+ animatorPropertyAdd.rotate(-135).setDuration(300);
+ animatorPropertyAdd.start();
+ animatorPropertyAddPen.rotate(0).setDuration(1);
+ animatorPropertyAddPen.start();
+ } else if (posDegree == 3) {
+ animatorPropertyAdd.rotate(-225).setDuration(300);
+ animatorPropertyAdd.start();
+ animatorPropertyAddPen.rotate(0).setDuration(1);
+ animatorPropertyAddPen.start();
+ }
+ if (colorClose == 0) {
+ shapeElement.setRgbColor(new RgbColor(221, 0, 0));
+ mDSOne.setBackground(shapeElement);
+ } else if (colorClose == 1) {
+ shapeElement.setRgbColor(new RgbColor(66, 133, 244));
+ mDSOne.setBackground(shapeElement);
+ } else if (colorClose == 2) {
+ shapeElement.setRgbColor(new RgbColor(255, 109, 0));
+ mDSOne.setBackground(shapeElement);
+ } else if (colorClose == 3) {
+ shapeElement.setRgbColor(new RgbColor(170, 0, 255));
+ mDSOne.setBackground(shapeElement);
+ } else if (colorClose == 4) {
+ shapeElement.setRgbColor(new RgbColor(255, 255, 255));
+ shapeElement.setStroke(1, new RgbColor(204, 204, 204));
+ mDSOne.setBackground(shapeElement);
+ } else if (colorClose == 5) {
+ PixelMapElement pixelMapElement = null;
+ try {
+ pixelMapElement = new PixelMapElement(mDSOne.getResourceManager().getResource(ResourceTable.Media_yy));
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (NotExistException e) {
+ e.printStackTrace();
+ }
+ mDSOne.setBackground(pixelMapElement);
+ }
+ //重新刷新适配器
+ isDouble = false;
+ if (listCircle != null) {
+ if (isBank) {
+ } else {
+ listCircle.clear();
+ listCircle = getDataCircle();
+ }
+ mListItemProviderCircle.notifyDataChanged();
+ }
+ }
+
+ private void showFive(Component component) {
+ basePopupViewFive = new XPopup.Builder(getContext())
+ .isDestroyOnDismiss(true)
+ .atView(component)
+ .hasShadowBg(false)
+ .asCustom(new CustomAttachDialogFiveItem(component.getContext(),
+ new CustomAttachDialogFiveItem.CustomAttachDialogListener() {
+ @Override
+ public void onClick(Component component) {
+ switch (component.getId()) {
+ //second open and close
+ case ResourceTable.Id_dl_main_fab_color_open:
+ showFiveItemOpen(component);
+ break;
+
+ case ResourceTable.Id_dl_main_fab_color_close:
+ showFiveItemClose(component);
+ break;
+ }
+ basePopupViewFive.dismiss();
+ }
+ }));
+ basePopupViewFive.show();
+ }
+
+ public void showFiveItemOpen(Component component) {
+ basePopupViewItemOpen = new XPopup.Builder(component.getContext())
+ .isDestroyOnDismiss(true)
+ .atView(component)
+ .hasShadowBg(false)
+ .asCustom(new CustomAttachDialogFiveItemOpen(getContext(), new CustomAttachDialogFiveItemOpen.CustomAttachDialogFiveItemListener() {
+ @Override
+ public void onClick(Component component) {
+ switch (component.getId()) {
+ case ResourceTable.Id_tv_primary:
+ if (isAddFloat) {
+ colorIsShow = 1;
+ shapeElement.setRgbColor(new RgbColor(66, 133, 244));
+ mDSOne.setBackground(shapeElement);
+ } else {
+ colorIsShow = 1;
+ }
+ break;
+ case ResourceTable.Id_tv_orange:
+ if (isAddFloat) {
+ colorIsShow = 2;
+ shapeElement.setRgbColor(new RgbColor(255, 109, 0));
+ mDSOne.setBackground(shapeElement);
+ } else {
+ colorIsShow = 2;
+ }
+ break;
+
+ case ResourceTable.Id_tv_purple:
+ if (isAddFloat) {
+ colorIsShow = 3;
+ shapeElement.setRgbColor(new RgbColor(170, 0, 255));
+ mDSOne.setBackground(shapeElement);
+ } else {
+ colorIsShow = 3;
+ }
+ break;
+ case ResourceTable.Id_tv_while:
+ if (isAddFloat) {
+ colorIsShow = 4;
+ shapeElement.setRgbColor(new RgbColor(255, 255, 255));
+ shapeElement.setStroke(1, new RgbColor(204, 204, 204));
+ mDSOne.setBackground(shapeElement);
+ } else {
+ colorIsShow = 4;
+ }
+ break;
+ case ResourceTable.Id_tv_none:
+ if (isAddFloat) {
+ colorIsShow = 5;
+ PixelMapElement pixelMapElement = null;
+ try {
+ pixelMapElement = new PixelMapElement(mDSOne.getResourceManager()
+ .getResource(ResourceTable.Media_yy));
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (NotExistException e) {
+ e.printStackTrace();
+ }
+ mDSOne.setBackground(pixelMapElement);
+ } else {
+ colorIsShow = 5;
+ }
+ break;
+ }
+ basePopupViewItemOpen.dismiss();
+ }
+ }));
+ basePopupViewItemOpen.show();
+ }
+
+ private void showFiveItemClose(Component component) {
+ basePopupViewItemClose = new XPopup.Builder(component.getContext())
+ .isDestroyOnDismiss(true)
+ .atView(component)
+ .hasShadowBg(false)
+ .asCustom(new CustomAttachDialogFiveItemClose(getContext(),
+ new CustomAttachDialogFiveItemClose.CustomFiveItemCloseListenner() {
+ @Override
+ public void onClick(Component component) {
+ switch (component.getId()) {
+ case ResourceTable.Id_tv_primary_close:
+ if (!isAddFloat) {
+ colorClose = 1;
+ shapeElement.setRgbColor(new RgbColor(66, 133, 244));
+ mDSOne.setBackground(shapeElement);
+ } else {
+ colorClose = 1;
+ }
+ break;
+ case ResourceTable.Id_tv_orange_close:
+ if (!isAddFloat) {
+ colorClose = 2;
+ shapeElement.setRgbColor(new RgbColor(255, 109, 0));
+ mDSOne.setBackground(shapeElement);
+ } else {
+ colorClose = 2;
+ }
+ break;
+ case ResourceTable.Id_tv_purple_close:
+ if (!isAddFloat) {
+ colorClose = 3;
+ shapeElement.setRgbColor(new RgbColor(170, 0, 255));
+ mDSOne.setBackground(shapeElement);
+ } else {
+ colorClose = 3;
+ }
+ break;
+ case ResourceTable.Id_tv_while_close:
+ if (!isAddFloat) {
+ colorClose = 4;
+ shapeElement.setRgbColor(new RgbColor(255, 255, 255));
+ shapeElement.setStroke(1, new RgbColor(204, 204, 204));
+ mDSOne.setBackground(shapeElement);
+ } else {
+ colorClose = 4;
+ }
+ break;
+ case ResourceTable.Id_tv_none_close:
+ if (!isAddFloat) {
+ colorClose = 5;
+ PixelMapElement pixelMapElement = null;
+ try {
+ pixelMapElement = new PixelMapElement(mDSOne.getResourceManager()
+ .getResource(ResourceTable.Media_yy));
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (NotExistException e) {
+ e.printStackTrace();
+ }
+ mDSOne.setBackground(pixelMapElement);
+ } else {
+ colorClose = 5;
+ }
+ break;
+ }
+ basePopupViewItemClose.dismiss();
+ }
+ }));
+ basePopupViewItemClose.show();
+ }
+
+ /**
+ * 获取屏幕宽度
+ *
+ * @return 屏幕宽度
+ */
+ public static int getDisplayWidthInPx(Context context) {
+ Display display = DisplayManager.getInstance().getDefaultDisplay(context).get();
+ return display.getAttributes().width;
+ }
+
+ /**
+ * 获取屏幕高度,不包含状态栏的高度
+ *
+ * @return 屏幕高度,不包含状态栏的高度
+ */
+ public static int getDisplayHeightInPx(Context context) {
+ Display display = DisplayManager.getInstance().getDefaultDisplay(context).get();
+ return display.getAttributes().height;
+ }
+
+ private ArrayList getData() {
+ ArrayList list = new ArrayList<>();
+ for (int i = 0; i < 60; i++) {
+ list.add(new ListBean("This is element # " + i));
+ }
+ return list;
+ }
+
+ private ArrayList getDataCircle() {
+ listCircle = new ArrayList<>();
+ listCircle.add(new ListBeanCircle(7, ResourceTable.Media_eight, "Custom theme"));
+ listCircle.add(new ListBeanCircle(4, ResourceTable.Media_five, "Add action"));
+ listCircle.add(new ListBeanCircle(3, ResourceTable.Media_four, "Lorem ipsum dolor sit amet,..."));
+ listCircle.add(new ListBeanCircle(2, ResourceTable.Media_three, "Custom colors"));
+ listCircle.add(new ListBeanCircle(1, ResourceTable.Media_two, ""));
+ return listCircle;
+ }
+
+ private ArrayList getDataCircleLeft() {
+ listCircle = new ArrayList<>();
+ listCircle.add(new ListBeanCircle(7, ResourceTable.Media_eight, ""));
+ listCircle.add(new ListBeanCircle(4, ResourceTable.Media_five, ""));
+ listCircle.add(new ListBeanCircle(3, ResourceTable.Media_four, ""));
+ listCircle.add(new ListBeanCircle(2, ResourceTable.Media_three, ""));
+ listCircle.add(new ListBeanCircle(1, ResourceTable.Media_two, ""));
+ return listCircle;
+ }
+
+ private ArrayList getDataCircleBottom() {
+ listCircle = new ArrayList<>();
+ listCircle.add(new ListBeanCircle(1, ResourceTable.Media_two, ""));
+ listCircle.add(new ListBeanCircle(2, ResourceTable.Media_three, "Custom colors"));
+ listCircle.add(new ListBeanCircle(3, ResourceTable.Media_four, "Lorem ipsum dolor sit amet,..."));
+ listCircle.add(new ListBeanCircle(4, ResourceTable.Media_five, "Add action"));
+ listCircle.add(new ListBeanCircle(7, ResourceTable.Media_eight, "Custom theme"));
+ return listCircle;
+ }
+
+ @Override
+ public void onActive() {
+ super.onActive();
+ }
+
+ @Override
+ public void onForeground(Intent intent) {
+ super.onForeground(intent);
+ }
+
+ @Override
+ protected void onStop() {
+ super.onStop();
+ EventBus.getDefault().unregister(this);
+ }
+}
\ No newline at end of file
diff --git a/entry/src/main/java/com/leinardi/ohos/speeddial/sample/slice/TestMainAbilitySlice.java b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/slice/TestMainAbilitySlice.java
new file mode 100644
index 0000000000000000000000000000000000000000..df82f24b1119a1c34ec7dee04d7e928414fdfdae
--- /dev/null
+++ b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/slice/TestMainAbilitySlice.java
@@ -0,0 +1,65 @@
+package com.leinardi.ohos.speeddial.sample.slice;
+
+import com.leinardi.ohos.speeddial.sample.ResourceTable;
+import ohos.aafwk.ability.AbilitySlice;
+import ohos.aafwk.content.Intent;
+import ohos.agp.colors.RgbColor;
+import ohos.agp.components.*;
+import ohos.agp.components.element.ShapeElement;
+import ohos.agp.components.element.VectorElement;
+import ohos.agp.utils.Color;
+
+/**
+ * TestMainAbilitySlice
+ *
+ * @since 2021-06-29
+ */
+public class TestMainAbilitySlice extends AbilitySlice {
+ private StackLayout stackLayout;
+ private DependentLayout dependentLayout;
+
+ @Override
+ public void onStart(Intent intent) {
+ super.onStart(intent);
+ super.setUIContent(ResourceTable.Layout_ability_test_main);
+ initView();
+ }
+
+ @Override
+ public void onActive() {
+ super.onActive();
+ }
+
+ @Override
+ public void onForeground(Intent intent) {
+ super.onForeground(intent);
+ }
+
+ private void initView() {
+ stackLayout = (StackLayout) findComponentById(ResourceTable.Id_st_layout);
+ dependentLayout = new DependentLayout(this);
+ Text text = new Text(this);
+ text.setText("Custom colors");
+ ShapeElement shapeElement = new ShapeElement();
+ shapeElement.setShape(ShapeElement.RECTANGLE);
+ shapeElement.setCornerRadius(10);
+ shapeElement.setRgbColor(new RgbColor(255, 255, 255));
+ shapeElement.setBounds(5, 5, 5, 5);
+ text.setBackground(shapeElement);
+ text.setTextColor(Color.BLACK);
+ text.setId(10);
+ DependentLayout.LayoutConfig lp = new DependentLayout.LayoutConfig(ComponentContainer.LayoutConfig.MATCH_CONTENT, ComponentContainer.LayoutConfig.MATCH_CONTENT);
+ lp.addRule(DependentLayout.LayoutConfig.ALIGN_RIGHT, DependentLayout.LayoutConfig.TRUE);
+ lp.addRule(DependentLayout.LayoutConfig.ALIGN_BOTTOM, DependentLayout.LayoutConfig.TRUE);
+ text.setLayoutConfig(lp);
+ dependentLayout.addComponent(text);
+
+ Image image = new Image(this);
+ image.setImageElement(new VectorElement(this, ResourceTable.Graphic_ic_add_white_24dp));
+ lp = new DependentLayout.LayoutConfig(ComponentContainer.LayoutConfig.MATCH_CONTENT, ComponentContainer.LayoutConfig.MATCH_CONTENT);
+ lp.addRule(DependentLayout.LayoutConfig.RIGHT_OF, text.getId());
+ image.setLayoutConfig(lp);
+ dependentLayout.addComponent(image);
+ stackLayout.addComponent(dependentLayout, 0);
+ }
+}
diff --git a/entry/src/main/java/com/leinardi/ohos/speeddial/sample/slice/UseCasesActivitySlice.java b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/slice/UseCasesActivitySlice.java
new file mode 100644
index 0000000000000000000000000000000000000000..4f79020124461ed628f9d028762f9ca4a188c5c8
--- /dev/null
+++ b/entry/src/main/java/com/leinardi/ohos/speeddial/sample/slice/UseCasesActivitySlice.java
@@ -0,0 +1,145 @@
+package com.leinardi.ohos.speeddial.sample.slice;
+
+import com.leinardi.ohos.speeddial.sample.ResourceTable;
+import ohos.aafwk.ability.AbilitySlice;
+import ohos.aafwk.content.Intent;
+import ohos.aafwk.content.Operation;
+import ohos.agp.animation.AnimatorProperty;
+import ohos.agp.colors.RgbColor;
+import ohos.agp.components.*;
+import ohos.agp.components.element.ShapeElement;
+import ohos.agp.components.element.VectorElement;
+import ohos.agp.utils.Color;
+import ohos.agp.window.service.Display;
+import ohos.agp.window.service.DisplayManager;
+import ohos.agp.window.service.WindowManager;
+import ohos.app.Context;
+
+public class UseCasesActivitySlice extends AbilitySlice {
+ private Image mImageAdd;
+ private DependentLayout mDSThree;
+ private DependentLayout mDSOne;
+ private DependentLayout dllayout;
+ private boolean isAddflaot = true;
+ private AnimatorProperty animatorProperty, animatorProperty2;
+ private AnimatorProperty animatorPropertyThree;
+ private AnimatorProperty animatorPropertyThreeTest;
+ private Context context = this;
+ private Text mDSThreeText;
+ private Image imaUseCase;
+
+ @Override
+ public void onStart(Intent intent) {
+ super.onStart(intent);
+ super.setUIContent(ResourceTable.Layout_ability_use_cases_activity);
+ WindowManager.getInstance().getTopWindow().get().setStatusBarColor(Color.getIntColor("#4285f4")); // 设置状态栏颜
+ initViews();
+ initListeners();
+ isAddflaot = false;
+ AnimatorTop();
+ }
+
+ @Override
+ public void onActive() {
+ super.onActive();
+ }
+
+ @Override
+ public void onForeground(Intent intent) {
+ super.onForeground(intent);
+ }
+
+ private void initViews() {
+ dllayout = (DependentLayout) findComponentById(ResourceTable.Id_dl_layout);
+ mDSOne = (DependentLayout) findComponentById(ResourceTable.Id_useCase_Suspension_one);
+ mDSThree = (DependentLayout) findComponentById(ResourceTable.Id_useCase_Suspension_three);
+ mImageAdd = (Image) findComponentById(ResourceTable.Id_useCase_Add);
+ mDSThreeText = (Text) findComponentById(ResourceTable.Id_useCase_Suspension_three_text);
+ imaUseCase = (Image) findComponentById(ResourceTable.Id_ima_use_case);
+ ShapeElement shapeElement = new ShapeElement();
+ shapeElement.setStroke(2, new RgbColor(204, 204, 204));
+ shapeElement.setCornerRadius(10);
+ mDSThreeText.setBackground(shapeElement);
+ }
+
+ private void initListeners() {
+ AnimatorTopOver();
+ mImageAdd.setImageElement(new VectorElement(UseCasesActivitySlice.this, ResourceTable.Graphic_ic_close_white_24dp));
+ mDSOne.setClickedListener(new Component.ClickedListener() {
+ @Override
+ public void onClick(Component component) {
+ if (isAddflaot) {
+ isAddflaot = false;
+ AnimatorTop();
+ animatorPropertyThree.start();
+ animatorPropertyThreeTest.start();
+ mImageAdd.setImageElement(new VectorElement(UseCasesActivitySlice.this, ResourceTable.Graphic_ic_close_white_24dp));
+ imaUseCase.setImageElement(new VectorElement(UseCasesActivitySlice.this, ResourceTable.Graphic_ic_close_white_24dp));
+ } else {
+ isAddflaot = true;
+ AnimatorTopOver();
+ mImageAdd.setImageElement(new VectorElement(UseCasesActivitySlice.this, ResourceTable.Graphic_ic_add_white_24dp));
+ }
+ }
+ });
+
+ animatorProperty = mDSOne.createAnimatorProperty();
+ animatorProperty.scaleX(0).scaleY(0).setDuration(200);
+ animatorProperty2 = mDSOne.createAnimatorProperty();
+ animatorProperty2.scaleX(1).scaleY(1).setDuration(200);
+
+ dllayout.setClickedListener(new Component.ClickedListener() {
+ @Override
+ public void onClick(Component component) {
+ Intent mIntent = new Intent();
+ Operation operation;
+ operation = new Intent.OperationBuilder()
+ .withDeviceId("")
+ .withBundleName("com.leinardi.ohos.speeddial.sample")
+ .withAbilityName("com.leinardi.ohos.speeddial.sample.MainAbility")
+ .build();
+ mIntent.setParam("flag", 1);
+ mIntent.setOperation(operation);
+ startAbility(mIntent);
+ component.getContext().setTransitionAnimation(0,0);
+ }
+ });
+ }
+
+ private void AnimatorTop() {
+ mDSThree.setVisibility(Component.VISIBLE);
+ mDSThreeText.setVisibility(Component.VISIBLE);
+ animatorPropertyThree = mDSThree.createAnimatorProperty();
+ animatorPropertyThreeTest = mDSThreeText.createAnimatorProperty();
+ }
+
+ private void AnimatorTopOver() {
+ mDSThree.setVisibility(Component.VERTICAL);
+ mDSThreeText.setVisibility(Component.VERTICAL);
+ }
+
+ /**
+ * 获取屏幕宽度
+ *
+ * @return 屏幕宽度
+ */
+ public static int getDisplayWidthInPx(Context context) {
+ Display display = DisplayManager.getInstance().getDefaultDisplay(context).get();
+ return display.getAttributes().width;
+ }
+
+ /**
+ * 获取屏幕高度,不包含状态栏的高度
+ *
+ * @return 屏幕高度,不包含状态栏的高度
+ */
+ public static int getDisplayHeightInPx(Context context) {
+ Display display = DisplayManager.getInstance().getDefaultDisplay(context).get();
+ return display.getAttributes().height;
+ }
+
+ @Override
+ protected void onStop() {
+ super.onStop();
+ }
+}
diff --git a/entry/src/main/resources/base/element/string.json b/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..eab8fce96c8e84b184b11bf1d665a1c55dd05172
--- /dev/null
+++ b/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,32 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "FloatingActionButtonSpeedDial"
+ },
+ {
+ "name": "mainability_description",
+ "value": "Java_Phone_Empty Feature Ability"
+ },
+ {
+ "name": "HelloWorld",
+ "value": "Hello World"
+ },
+ {
+ "name": "usecasesactivity_description",
+ "value": "Java_Phone_Empty Feature Ability"
+ },
+ {
+ "name": "HelloWorld",
+ "value": "Hello World"
+ },
+ {
+ "name": "testmainability_description",
+ "value": "Java_Phone_Empty Feature Ability"
+ },
+ {
+ "name": "testmainability_HelloWorld",
+ "value": "Hello World"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/entry/src/main/resources/base/graphic/bacground_minimul.xml b/entry/src/main/resources/base/graphic/bacground_minimul.xml
new file mode 100644
index 0000000000000000000000000000000000000000..2d55e81716c7db1daff0bbc852cb607a0bd09a90
--- /dev/null
+++ b/entry/src/main/resources/base/graphic/bacground_minimul.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/graphic/background_ability_main.xml b/entry/src/main/resources/base/graphic/background_ability_main.xml
new file mode 100644
index 0000000000000000000000000000000000000000..c0c0a3df480fa387a452b9c40ca191cc918a3fc0
--- /dev/null
+++ b/entry/src/main/resources/base/graphic/background_ability_main.xml
@@ -0,0 +1,6 @@
+
+
+
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/graphic/background_ability_test_main.xml b/entry/src/main/resources/base/graphic/background_ability_test_main.xml
new file mode 100644
index 0000000000000000000000000000000000000000..a002c2353e78af3a15235e00738328ff566bc085
--- /dev/null
+++ b/entry/src/main/resources/base/graphic/background_ability_test_main.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/graphic/background_ability_use_cases_activity.xml b/entry/src/main/resources/base/graphic/background_ability_use_cases_activity.xml
new file mode 100644
index 0000000000000000000000000000000000000000..a002c2353e78af3a15235e00738328ff566bc085
--- /dev/null
+++ b/entry/src/main/resources/base/graphic/background_ability_use_cases_activity.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/graphic/background_blue_text.xml b/entry/src/main/resources/base/graphic/background_blue_text.xml
new file mode 100644
index 0000000000000000000000000000000000000000..d0b604d87f92f1e37cb6c60c924f64c5f870f4db
--- /dev/null
+++ b/entry/src/main/resources/base/graphic/background_blue_text.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/graphic/background_toast_element.xml b/entry/src/main/resources/base/graphic/background_toast_element.xml
new file mode 100644
index 0000000000000000000000000000000000000000..83849f3c05f5996e9207429584c849d6e7cd1279
--- /dev/null
+++ b/entry/src/main/resources/base/graphic/background_toast_element.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/graphic/background_use_text.xml b/entry/src/main/resources/base/graphic/background_use_text.xml
new file mode 100644
index 0000000000000000000000000000000000000000..6c1be6294c1b65b7e3d67f864a03f568b294f2f2
--- /dev/null
+++ b/entry/src/main/resources/base/graphic/background_use_text.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/graphic/background_white_text.xml b/entry/src/main/resources/base/graphic/background_white_text.xml
new file mode 100644
index 0000000000000000000000000000000000000000..3c793263c0c56b8d51599b5e5155d3f280bb88e3
--- /dev/null
+++ b/entry/src/main/resources/base/graphic/background_white_text.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/graphic/bg_dialog.xml b/entry/src/main/resources/base/graphic/bg_dialog.xml
new file mode 100644
index 0000000000000000000000000000000000000000..96abcd8cd2bc61d261bab1ddee22b7b1aee8a534
--- /dev/null
+++ b/entry/src/main/resources/base/graphic/bg_dialog.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/graphic/blue_bg.xml b/entry/src/main/resources/base/graphic/blue_bg.xml
new file mode 100644
index 0000000000000000000000000000000000000000..99ea93bbcdc171e3a6999aee5103ce3d9f66b0b9
--- /dev/null
+++ b/entry/src/main/resources/base/graphic/blue_bg.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/graphic/coffee_bg.xml b/entry/src/main/resources/base/graphic/coffee_bg.xml
new file mode 100644
index 0000000000000000000000000000000000000000..2e1b936f38ee22a6549f0afeee45cf21f0250a88
--- /dev/null
+++ b/entry/src/main/resources/base/graphic/coffee_bg.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/sample/src/main/res/drawable/ic_animation_white_24dp.xml b/entry/src/main/resources/base/graphic/ic_add_action_white_24dp.xml
similarity index 55%
rename from sample/src/main/res/drawable/ic_animation_white_24dp.xml
rename to entry/src/main/resources/base/graphic/ic_add_action_white_24dp.xml
index ede59a716296df031f7cbeb63bf9629197b91691..0113513b0a9eedf1e247ae5700dc83f7a0343543 100644
--- a/sample/src/main/res/drawable/ic_animation_white_24dp.xml
+++ b/entry/src/main/resources/base/graphic/ic_add_action_white_24dp.xml
@@ -1,5 +1,5 @@
-
+
+ ohos:fillColor="#FFFFFF"
+ ohos:pathData="M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M13,7H11V11H7V13H11V17H13V13H17V11H13V7Z" />
diff --git a/sample/src/main/res/drawable/ic_add_white_24dp.xml b/entry/src/main/resources/base/graphic/ic_add_white_24dp.xml
old mode 100755
new mode 100644
similarity index 64%
rename from sample/src/main/res/drawable/ic_add_white_24dp.xml
rename to entry/src/main/resources/base/graphic/ic_add_white_24dp.xml
index b17f2fb745ac7b810a2f3331ea7636b185431449..ffb938251e0c41da4edcfd2c87864b29305aac9a
--- a/sample/src/main/res/drawable/ic_add_white_24dp.xml
+++ b/entry/src/main/resources/base/graphic/ic_add_white_24dp.xml
@@ -1,5 +1,5 @@
-
+
+ ohos:fillColor="#FFFFFFFF"
+ ohos:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z" />
diff --git a/sample/src/main/res/drawable/ic_close_white_24dp.xml b/entry/src/main/resources/base/graphic/ic_animation_white_24dp.xml
similarity index 56%
rename from sample/src/main/res/drawable/ic_close_white_24dp.xml
rename to entry/src/main/resources/base/graphic/ic_animation_white_24dp.xml
index 56536d7bdd9ce88a881da2b1bad62c9686d2be7f..4ee25d5d825577310a2cb7740a0eb6bab75f8996 100644
--- a/sample/src/main/res/drawable/ic_close_white_24dp.xml
+++ b/entry/src/main/resources/base/graphic/ic_animation_white_24dp.xml
@@ -1,5 +1,5 @@
-
+
+ ohos:fillColor="#FFFFFF"
+ ohos:pathData="M4,2C2.89,2 2,2.89 2,4V14H4V4H14V2H4M8,6C6.89,6 6,6.89 6,8V18H8V8H18V6H8M12,10C10.89,10 10,10.89 10,12V20C10,21.11 10.89,22 12,22H20C21.11,22 22,21.11 22,20V12C22,10.89 21.11,10 20,10H12Z" />
diff --git a/entry/src/main/resources/base/graphic/ic_close_white_24dp.xml b/entry/src/main/resources/base/graphic/ic_close_white_24dp.xml
new file mode 100644
index 0000000000000000000000000000000000000000..bdf4e9e0d2b5fce8d2e46de5cd0fb0e0c43fa151
--- /dev/null
+++ b/entry/src/main/resources/base/graphic/ic_close_white_24dp.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
diff --git a/sample/src/main/res/drawable/ic_delete_white_24dp.xml b/entry/src/main/resources/base/graphic/ic_delete_white_24dp.xml
similarity index 62%
rename from sample/src/main/res/drawable/ic_delete_white_24dp.xml
rename to entry/src/main/resources/base/graphic/ic_delete_white_24dp.xml
index 187bb722feab6deb62b16fcf15737ce8cd314a41..77d50dc6ed0c5e0cb6222b89388b884052de3f8c 100644
--- a/sample/src/main/res/drawable/ic_delete_white_24dp.xml
+++ b/entry/src/main/resources/base/graphic/ic_delete_white_24dp.xml
@@ -1,5 +1,5 @@
-
+
+ ohos:fillColor="#FFFFFF"
+ ohos:pathData="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z" />
diff --git a/sample/src/main/res/drawable/ic_add_action_white_24dp.xml b/entry/src/main/resources/base/graphic/ic_expansion_mode_white_24dp.xml
similarity index 54%
rename from sample/src/main/res/drawable/ic_add_action_white_24dp.xml
rename to entry/src/main/resources/base/graphic/ic_expansion_mode_white_24dp.xml
index 86abad2cb73a4a830f99be7cbe3554c3910e0014..c52383cf04b9e3e696f7a6a5a6ceaf71339bcf83 100644
--- a/sample/src/main/res/drawable/ic_add_action_white_24dp.xml
+++ b/entry/src/main/resources/base/graphic/ic_expansion_mode_white_24dp.xml
@@ -1,5 +1,5 @@
-
+
+ ohos:fillColor="#fff"
+ ohos:pathData="M9.5,13.09L10.91,14.5L6.41,19H10V21H3V14H5V17.59L9.5,13.09M10.91,9.5L9.5,10.91L5,6.41V10H3V3H10V5H6.41L10.91,9.5M14.5,13.09L19,17.59V14H21V21H14V19H17.59L13.09,14.5L14.5,13.09M13.09,9.5L17.59,5H14V3H21V10H19V6.41L14.5,10.91L13.09,9.5Z" />
diff --git a/entry/src/main/resources/base/graphic/ic_launcher_background.xml b/entry/src/main/resources/base/graphic/ic_launcher_background.xml
new file mode 100644
index 0000000000000000000000000000000000000000..f6ce951cc047819f3b403f2a4b861a96f03494fe
--- /dev/null
+++ b/entry/src/main/resources/base/graphic/ic_launcher_background.xml
@@ -0,0 +1,170 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/entry/src/main/resources/base/graphic/ic_link_white_24dp.xml b/entry/src/main/resources/base/graphic/ic_link_white_24dp.xml
new file mode 100644
index 0000000000000000000000000000000000000000..c409c79f01e2bee84074070bc51ff0b6711156af
--- /dev/null
+++ b/entry/src/main/resources/base/graphic/ic_link_white_24dp.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
diff --git a/sample/src/main/res/drawable/ic_list_white_24dp.xml b/entry/src/main/resources/base/graphic/ic_list_white_24dp.xml
old mode 100755
new mode 100644
similarity index 62%
rename from sample/src/main/res/drawable/ic_list_white_24dp.xml
rename to entry/src/main/resources/base/graphic/ic_list_white_24dp.xml
index cb3917b54c12b1e72cb994fa2f2c2a66a2e00096..610a7d5130904c2701f89988bb1498764b6f0f59
--- a/sample/src/main/res/drawable/ic_list_white_24dp.xml
+++ b/entry/src/main/resources/base/graphic/ic_list_white_24dp.xml
@@ -1,5 +1,5 @@
-
+
+ ohos:fillColor="#fff"
+ ohos:pathData="M9,5V9H21V5M9,19H21V15H9M9,14H21V10H9M4,9H8V5H4M4,19H8V15H4M4,14H8V10H4V14Z" />
diff --git a/sample/src/main/res/drawable/ic_pencil_alt_white_24dp.xml b/entry/src/main/resources/base/graphic/ic_pencil_alt_white_24dp.xml
old mode 100755
new mode 100644
similarity index 91%
rename from sample/src/main/res/drawable/ic_pencil_alt_white_24dp.xml
rename to entry/src/main/resources/base/graphic/ic_pencil_alt_white_24dp.xml
index d4228bdfc44c9748ce49fa553d808f51be0e4bd8..1905b159ba61ffca16189192b2f4ef182e25604c
--- a/sample/src/main/res/drawable/ic_pencil_alt_white_24dp.xml
+++ b/entry/src/main/resources/base/graphic/ic_pencil_alt_white_24dp.xml
@@ -1,5 +1,5 @@
-
+
+ ohos:fillColor="#FFFFFF"
+ ohos:pathData="M21,9L17,5V8H10V10H17V13M7,11L3,15L7,19V16H14V14H7V11Z" />
diff --git a/entry/src/main/resources/base/graphic/ic_rotation_angle_white_24dp.xml b/entry/src/main/resources/base/graphic/ic_rotation_angle_white_24dp.xml
new file mode 100644
index 0000000000000000000000000000000000000000..30cee492a941876cacd237a5248fd7f80e71e635
--- /dev/null
+++ b/entry/src/main/resources/base/graphic/ic_rotation_angle_white_24dp.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
diff --git a/entry/src/main/resources/base/graphic/ic_show_white_24dp.xml b/entry/src/main/resources/base/graphic/ic_show_white_24dp.xml
new file mode 100644
index 0000000000000000000000000000000000000000..b9776e078f70744120d56d043fcb8aefb10a09a6
--- /dev/null
+++ b/entry/src/main/resources/base/graphic/ic_show_white_24dp.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
diff --git a/entry/src/main/resources/base/graphic/ic_snack_white_24dp.xml b/entry/src/main/resources/base/graphic/ic_snack_white_24dp.xml
new file mode 100644
index 0000000000000000000000000000000000000000..13d2d361bb5de450e7365d8a8479ca19c847699c
--- /dev/null
+++ b/entry/src/main/resources/base/graphic/ic_snack_white_24dp.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
diff --git a/entry/src/main/resources/base/graphic/ic_theme_white_24dp.xml b/entry/src/main/resources/base/graphic/ic_theme_white_24dp.xml
new file mode 100644
index 0000000000000000000000000000000000000000..3992d6e20f0b5fa1127e4b89709febe2e6af5245
--- /dev/null
+++ b/entry/src/main/resources/base/graphic/ic_theme_white_24dp.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
diff --git a/entry/src/main/resources/base/graphic/ic_use_case_white_24dp.xml b/entry/src/main/resources/base/graphic/ic_use_case_white_24dp.xml
new file mode 100644
index 0000000000000000000000000000000000000000..4c903cb01a5bc0412e1c786c2896d4773afa5c4c
--- /dev/null
+++ b/entry/src/main/resources/base/graphic/ic_use_case_white_24dp.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
diff --git a/entry/src/main/resources/base/graphic/orange_bg.xml b/entry/src/main/resources/base/graphic/orange_bg.xml
new file mode 100644
index 0000000000000000000000000000000000000000..3848ba65caab5f3b74c62bc8cb5fb1c210ce698f
--- /dev/null
+++ b/entry/src/main/resources/base/graphic/orange_bg.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/graphic/red_bg.xml b/entry/src/main/resources/base/graphic/red_bg.xml
new file mode 100644
index 0000000000000000000000000000000000000000..4a7c3ecbc17b56c64b812b353bcd7bc80b87b177
--- /dev/null
+++ b/entry/src/main/resources/base/graphic/red_bg.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/graphic/white_bg.xml b/entry/src/main/resources/base/graphic/white_bg.xml
new file mode 100644
index 0000000000000000000000000000000000000000..9538c182430662fd460956a910bf3ce71a0f1201
--- /dev/null
+++ b/entry/src/main/resources/base/graphic/white_bg.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/graphic/yellow_bg.xml b/entry/src/main/resources/base/graphic/yellow_bg.xml
new file mode 100644
index 0000000000000000000000000000000000000000..41a8d6f7df66212efa91c0d07386e3b209ca1560
--- /dev/null
+++ b/entry/src/main/resources/base/graphic/yellow_bg.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/layout/ability_main.xml b/entry/src/main/resources/base/layout/ability_main.xml
new file mode 100644
index 0000000000000000000000000000000000000000..c380099188383c8e0de81d08aff09661c7813c62
--- /dev/null
+++ b/entry/src/main/resources/base/layout/ability_main.xml
@@ -0,0 +1,270 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/layout/ability_test_main.xml b/entry/src/main/resources/base/layout/ability_test_main.xml
new file mode 100644
index 0000000000000000000000000000000000000000..d8e4e3b90bdaca0253c1bf06d913bd278367b3ec
--- /dev/null
+++ b/entry/src/main/resources/base/layout/ability_test_main.xml
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/layout/ability_use_cases_activity.xml b/entry/src/main/resources/base/layout/ability_use_cases_activity.xml
new file mode 100644
index 0000000000000000000000000000000000000000..309d758bb2a25b7bcbdc3958b0eb0f9b12c0fed5
--- /dev/null
+++ b/entry/src/main/resources/base/layout/ability_use_cases_activity.xml
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/layout/custom_attach_popup2.xml b/entry/src/main/resources/base/layout/custom_attach_popup2.xml
new file mode 100644
index 0000000000000000000000000000000000000000..fc8f9a410bfa305a8e508a74eacc05e91cec836b
--- /dev/null
+++ b/entry/src/main/resources/base/layout/custom_attach_popup2.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/layout/custom_attach_popup_five.xml b/entry/src/main/resources/base/layout/custom_attach_popup_five.xml
new file mode 100644
index 0000000000000000000000000000000000000000..f740799ac3899eafc1bdd5085c57c1450926a0a6
--- /dev/null
+++ b/entry/src/main/resources/base/layout/custom_attach_popup_five.xml
@@ -0,0 +1,118 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/layout/custom_attach_popup_five_item.xml b/entry/src/main/resources/base/layout/custom_attach_popup_five_item.xml
new file mode 100644
index 0000000000000000000000000000000000000000..8a5307abb59de6052670fbfd384d4e1765cbd2fa
--- /dev/null
+++ b/entry/src/main/resources/base/layout/custom_attach_popup_five_item.xml
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/layout/custom_attach_popup_five_item_child.xml b/entry/src/main/resources/base/layout/custom_attach_popup_five_item_child.xml
new file mode 100644
index 0000000000000000000000000000000000000000..f2dedaa9e69dfb0c2bc8a3acfeeec49eefb8e6e2
--- /dev/null
+++ b/entry/src/main/resources/base/layout/custom_attach_popup_five_item_child.xml
@@ -0,0 +1,82 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/layout/custom_attach_popup_four.xml b/entry/src/main/resources/base/layout/custom_attach_popup_four.xml
new file mode 100644
index 0000000000000000000000000000000000000000..84a85347e039d3f5367065080f7655a9c3dce779
--- /dev/null
+++ b/entry/src/main/resources/base/layout/custom_attach_popup_four.xml
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/layout/custom_attach_popup_three.xml b/entry/src/main/resources/base/layout/custom_attach_popup_three.xml
new file mode 100644
index 0000000000000000000000000000000000000000..1934754a255c2b045db68a2377e04ede33e5fd98
--- /dev/null
+++ b/entry/src/main/resources/base/layout/custom_attach_popup_three.xml
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/layout/custom_five_item_child_close.xml b/entry/src/main/resources/base/layout/custom_five_item_child_close.xml
new file mode 100644
index 0000000000000000000000000000000000000000..11743f5dd90603205e4386b2ce491fcc2504f642
--- /dev/null
+++ b/entry/src/main/resources/base/layout/custom_five_item_child_close.xml
@@ -0,0 +1,82 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/layout/layout_item_circle.xml b/entry/src/main/resources/base/layout/layout_item_circle.xml
new file mode 100644
index 0000000000000000000000000000000000000000..6b086ed062ae4d39e373306d5aa7ddf247a02501
--- /dev/null
+++ b/entry/src/main/resources/base/layout/layout_item_circle.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/layout/layout_item_sample.xml b/entry/src/main/resources/base/layout/layout_item_sample.xml
new file mode 100644
index 0000000000000000000000000000000000000000..1e527515afeb276b552dd1c5c8cd92cfe83239c8
--- /dev/null
+++ b/entry/src/main/resources/base/layout/layout_item_sample.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/layout/layout_item_sample_circal.xml b/entry/src/main/resources/base/layout/layout_item_sample_circal.xml
new file mode 100644
index 0000000000000000000000000000000000000000..ed83495c69741988586599e4880a677383a7bc49
--- /dev/null
+++ b/entry/src/main/resources/base/layout/layout_item_sample_circal.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/layout/layout_item_sample_circal_lr.xml b/entry/src/main/resources/base/layout/layout_item_sample_circal_lr.xml
new file mode 100644
index 0000000000000000000000000000000000000000..dc3a618b4081ab44d2776d699cd34bc323ffb351
--- /dev/null
+++ b/entry/src/main/resources/base/layout/layout_item_sample_circal_lr.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/layout/layout_toast.xml b/entry/src/main/resources/base/layout/layout_toast.xml
new file mode 100644
index 0000000000000000000000000000000000000000..5e74a2971e0db78894655a9808e131dd6b9cce45
--- /dev/null
+++ b/entry/src/main/resources/base/layout/layout_toast.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/layout/layout_toast_dia.xml b/entry/src/main/resources/base/layout/layout_toast_dia.xml
new file mode 100644
index 0000000000000000000000000000000000000000..7096277b1476c9477278bb1931fa65dc961d9c21
--- /dev/null
+++ b/entry/src/main/resources/base/layout/layout_toast_dia.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/layout/layout_toast_dia_four.xml b/entry/src/main/resources/base/layout/layout_toast_dia_four.xml
new file mode 100644
index 0000000000000000000000000000000000000000..c9ed786abb39e94472dee2da49ebebc9a22fe1a0
--- /dev/null
+++ b/entry/src/main/resources/base/layout/layout_toast_dia_four.xml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/layout/layout_toast_dia_three.xml b/entry/src/main/resources/base/layout/layout_toast_dia_three.xml
new file mode 100644
index 0000000000000000000000000000000000000000..d0adbcd20369b23ec33a910fd9bc5697cfb06eef
--- /dev/null
+++ b/entry/src/main/resources/base/layout/layout_toast_dia_three.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/layout/layout_toast_eight.xml b/entry/src/main/resources/base/layout/layout_toast_eight.xml
new file mode 100644
index 0000000000000000000000000000000000000000..4d7505ecb62d9ef1644182107027f08a490abfe9
--- /dev/null
+++ b/entry/src/main/resources/base/layout/layout_toast_eight.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/entry/src/main/resources/base/media/bluePen.png b/entry/src/main/resources/base/media/bluePen.png
new file mode 100644
index 0000000000000000000000000000000000000000..6f2d2c8702c6bef36a12a47ca46cb59b026fec0e
Binary files /dev/null and b/entry/src/main/resources/base/media/bluePen.png differ
diff --git a/entry/src/main/resources/base/media/brush.png b/entry/src/main/resources/base/media/brush.png
new file mode 100644
index 0000000000000000000000000000000000000000..2a5c4a1f70fb20cf0c617c947c4a9d3d41c27eea
Binary files /dev/null and b/entry/src/main/resources/base/media/brush.png differ
diff --git a/entry/src/main/resources/base/media/brush1.png b/entry/src/main/resources/base/media/brush1.png
new file mode 100644
index 0000000000000000000000000000000000000000..64eee3609ca45e4e17e56a8344c7ea541d986a2e
Binary files /dev/null and b/entry/src/main/resources/base/media/brush1.png differ
diff --git a/entry/src/main/resources/base/media/brush2.png b/entry/src/main/resources/base/media/brush2.png
new file mode 100644
index 0000000000000000000000000000000000000000..bd8341739c3f217ac71f06344a8fa68be3094b73
Binary files /dev/null and b/entry/src/main/resources/base/media/brush2.png differ
diff --git a/entry/src/main/resources/base/media/circle_red.png b/entry/src/main/resources/base/media/circle_red.png
new file mode 100644
index 0000000000000000000000000000000000000000..370d2e356d71c247f4a3d3ee3cbeaa706c97b13e
Binary files /dev/null and b/entry/src/main/resources/base/media/circle_red.png differ
diff --git a/entry/src/main/resources/base/media/eight.png b/entry/src/main/resources/base/media/eight.png
new file mode 100644
index 0000000000000000000000000000000000000000..afa69052c3baff239a8527922c8a89220d266ec4
Binary files /dev/null and b/entry/src/main/resources/base/media/eight.png differ
diff --git a/entry/src/main/resources/base/media/five.png b/entry/src/main/resources/base/media/five.png
new file mode 100644
index 0000000000000000000000000000000000000000..713777959fea1d657de800c69f16101d49c3c4c8
Binary files /dev/null and b/entry/src/main/resources/base/media/five.png differ
diff --git a/entry/src/main/resources/base/media/fork.png b/entry/src/main/resources/base/media/fork.png
new file mode 100644
index 0000000000000000000000000000000000000000..8fc1d9eb67db6b1e4d49a0c917cd639ed2b7459a
Binary files /dev/null and b/entry/src/main/resources/base/media/fork.png differ
diff --git a/entry/src/main/resources/base/media/four.png b/entry/src/main/resources/base/media/four.png
new file mode 100644
index 0000000000000000000000000000000000000000..cd762bf07d04f40e1deff004eb36e6cd555928fa
Binary files /dev/null and b/entry/src/main/resources/base/media/four.png differ
diff --git a/entry/src/main/resources/base/media/huabiys.png b/entry/src/main/resources/base/media/huabiys.png
new file mode 100644
index 0000000000000000000000000000000000000000..2c0794fb2254218c101ac5ebe4c45c9b86b6300c
Binary files /dev/null and b/entry/src/main/resources/base/media/huabiys.png differ
diff --git a/sample/src/main/res/drawable-xxxhdpi/ic_custom_color.png b/entry/src/main/resources/base/media/ic_custom_color.png
similarity index 100%
rename from sample/src/main/res/drawable-xxxhdpi/ic_custom_color.png
rename to entry/src/main/resources/base/media/ic_custom_color.png
diff --git a/sample/src/main/res/drawable-xxxhdpi/ic_lorem_ipsum.png b/entry/src/main/resources/base/media/ic_lorem_ipsum.png
similarity index 100%
rename from sample/src/main/res/drawable-xxxhdpi/ic_lorem_ipsum.png
rename to entry/src/main/resources/base/media/ic_lorem_ipsum.png
diff --git a/entry/src/main/resources/base/media/icon.png b/entry/src/main/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/entry/src/main/resources/base/media/icon.png differ
diff --git a/entry/src/main/resources/base/media/nine.png b/entry/src/main/resources/base/media/nine.png
new file mode 100644
index 0000000000000000000000000000000000000000..eab33519495294bd456166583e3891310a259b00
Binary files /dev/null and b/entry/src/main/resources/base/media/nine.png differ
diff --git a/entry/src/main/resources/base/media/pen.png b/entry/src/main/resources/base/media/pen.png
new file mode 100644
index 0000000000000000000000000000000000000000..ca728b2c87221a3a35f5f8c4fc09e84a39c50192
Binary files /dev/null and b/entry/src/main/resources/base/media/pen.png differ
diff --git a/entry/src/main/resources/base/media/right_ima.png b/entry/src/main/resources/base/media/right_ima.png
new file mode 100644
index 0000000000000000000000000000000000000000..206ea99a49bd8d4148421e5713849e6bf824fe73
Binary files /dev/null and b/entry/src/main/resources/base/media/right_ima.png differ
diff --git a/entry/src/main/resources/base/media/seven.png b/entry/src/main/resources/base/media/seven.png
new file mode 100644
index 0000000000000000000000000000000000000000..fde9c74a7f87366b533d15b4359ed5868a49f0df
Binary files /dev/null and b/entry/src/main/resources/base/media/seven.png differ
diff --git a/entry/src/main/resources/base/media/sgd.png b/entry/src/main/resources/base/media/sgd.png
new file mode 100644
index 0000000000000000000000000000000000000000..39f904015d7967304c8ff2b317fb56f68625aac5
Binary files /dev/null and b/entry/src/main/resources/base/media/sgd.png differ
diff --git a/entry/src/main/resources/base/media/six.png b/entry/src/main/resources/base/media/six.png
new file mode 100644
index 0000000000000000000000000000000000000000..deae19212b9880cc3d4db2da2697ab4dc4923a62
Binary files /dev/null and b/entry/src/main/resources/base/media/six.png differ
diff --git a/entry/src/main/resources/base/media/three.png b/entry/src/main/resources/base/media/three.png
new file mode 100644
index 0000000000000000000000000000000000000000..8a8aee09489a6a8f757232ffc344c6f68afb39b9
Binary files /dev/null and b/entry/src/main/resources/base/media/three.png differ
diff --git a/entry/src/main/resources/base/media/two.png b/entry/src/main/resources/base/media/two.png
new file mode 100644
index 0000000000000000000000000000000000000000..d69b0189bb5bccddf9a820d85f6995a857960b36
Binary files /dev/null and b/entry/src/main/resources/base/media/two.png differ
diff --git a/entry/src/main/resources/base/media/yy.png b/entry/src/main/resources/base/media/yy.png
new file mode 100644
index 0000000000000000000000000000000000000000..ab792e86aa6da80815063538fea39666760e1c5b
Binary files /dev/null and b/entry/src/main/resources/base/media/yy.png differ
diff --git a/entry/src/ohosTest/config.json b/entry/src/ohosTest/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..c538320bfc235c37db0f0deac6c44620c32acb92
--- /dev/null
+++ b/entry/src/ohosTest/config.json
@@ -0,0 +1,41 @@
+{
+ "app": {
+ "bundleName": "com.leinardi.android.speeddial.sample",
+ "vendor": "leinardi",
+ "version": {
+ "code": 1,
+ "name": "1.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 5,
+ "releaseType": "Beta1"
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "com.leinardi.ohos.speeddial.sample",
+ "name": "testModule",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry_test",
+ "moduleType": "feature",
+ "installationFree": true
+ },
+ "abilities": [
+ {
+ "name": "decc.testkit.runner.EntryAbility",
+ "description": "Test Entry Ability",
+ "icon": "$media:icon",
+ "label": "$string:app_name",
+ "launchType": "standard",
+ "orientation": "landscape",
+ "visible": true,
+ "type": "page"
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/entry/src/ohosTest/java/com/leinardi/android/speeddial/sample/ExampleOhosTest.java b/entry/src/ohosTest/java/com/leinardi/android/speeddial/sample/ExampleOhosTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..c702d15107f619dd4d8e433f9db245f1bd1c5a94
--- /dev/null
+++ b/entry/src/ohosTest/java/com/leinardi/android/speeddial/sample/ExampleOhosTest.java
@@ -0,0 +1,14 @@
+package com.leinardi.android.speeddial.sample;
+
+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("com.leinardi.ohos.speeddial.sample", actualBundleName);
+ }
+}
\ No newline at end of file
diff --git a/entry/src/test/java/com/leinardi/android/speeddial/sample/ExampleTest.java b/entry/src/test/java/com/leinardi/android/speeddial/sample/ExampleTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..7dca161ad7933d635e94ae2509dea5bca714330f
--- /dev/null
+++ b/entry/src/test/java/com/leinardi/android/speeddial/sample/ExampleTest.java
@@ -0,0 +1,9 @@
+package com.leinardi.android.speeddial.sample;
+
+import org.junit.Test;
+
+public class ExampleTest {
+ @Test
+ public void onStart() {
+ }
+}
diff --git a/gradle.properties b/gradle.properties
deleted file mode 100755
index 13dc4fac869a549f05eada21fa8b25d9dbe6e393..0000000000000000000000000000000000000000
--- a/gradle.properties
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-# Copyright 2021 Roberto Leinardi.
-#
-# 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.
-#
-KEYSTORE_PATH=../keystore/release.keystore
-KEYSTORE_PROPERTIES_PATH=../keystore/keystore.properties
-org.gradle.jvmargs=-Xmx1536M
-org.gradle.parallel=true
-android.useAndroidX=true
-android.enableJetifier=true
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100755
index e708b1c023ec8b20f512888fe07c5bd3ff77bb8f..0000000000000000000000000000000000000000
Binary files a/gradle/wrapper/gradle-wrapper.jar and /dev/null differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100755
index 9c4821fd583ef6b8b424272b76d124a42594e9b1..0000000000000000000000000000000000000000
--- a/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-# Copyright 2021 Roberto Leinardi.
-#
-# 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.
-#
-
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
deleted file mode 100755
index 4f906e0c811fc9e230eb44819f509cd0627f2600..0000000000000000000000000000000000000000
--- a/gradlew
+++ /dev/null
@@ -1,185 +0,0 @@
-#!/usr/bin/env sh
-
-#
-# Copyright 2015 the original author or authors.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >/dev/null
-APP_HOME="`pwd -P`"
-cd "$SAVED" >/dev/null
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn () {
- echo "$*"
-}
-
-die () {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-nonstop=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
- NONSTOP* )
- nonstop=true
- ;;
-esac
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin or MSYS, switch paths to Windows format before running java
-if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-
- JAVACMD=`cygpath --unix "$JAVACMD"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=`expr $i + 1`
- done
- case $i in
- 0) set -- ;;
- 1) set -- "$args0" ;;
- 2) set -- "$args0" "$args1" ;;
- 3) set -- "$args0" "$args1" "$args2" ;;
- 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Escape application args
-save () {
- for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
- echo " "
-}
-APP_ARGS=`save "$@"`
-
-# Collect all arguments for the java command, following the shell quoting and substitution rules
-eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
-
-exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
deleted file mode 100755
index ac1b06f93825db68fb0c0b5150917f340eaa5d02..0000000000000000000000000000000000000000
--- a/gradlew.bat
+++ /dev/null
@@ -1,89 +0,0 @@
-@rem
-@rem Copyright 2015 the original author or authors.
-@rem
-@rem Licensed under the Apache License, Version 2.0 (the "License");
-@rem you may not use this file except in compliance with the License.
-@rem You may obtain a copy of the License at
-@rem
-@rem https://www.apache.org/licenses/LICENSE-2.0
-@rem
-@rem Unless required by applicable law or agreed to in writing, software
-@rem distributed under the License is distributed on an "AS IS" BASIS,
-@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-@rem See the License for the specific language governing permissions and
-@rem limitations under the License.
-@rem
-
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Resolve any "." and ".." in APP_HOME to make it shorter.
-for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto execute
-
-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 execute
-
-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
-
-: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 %*
-
-: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
diff --git a/img/demo.gif b/img/demo.gif
new file mode 100644
index 0000000000000000000000000000000000000000..fba4a8d4d1711309a3a0f3274862550d91cdd973
Binary files /dev/null and b/img/demo.gif differ
diff --git a/library/.gitignore b/library/.gitignore
deleted file mode 100644
index 796b96d1c402326528b4ba3c12ee9d92d0e212e9..0000000000000000000000000000000000000000
--- a/library/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build
diff --git a/library/build.gradle b/library/build.gradle
index bc9cd1d96a32fc1ee049cfccec8ce01813e0db7f..e1c0b274a6c5cb35b197a177a17684addf760676 100644
--- a/library/build.gradle
+++ b/library/build.gradle
@@ -1,65 +1,21 @@
-/*
- * Copyright 2021 Roberto Leinardi.
- *
- * 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.
- */
-
-apply plugin: 'com.android.library'
-apply from: rootProject.file('checkstyle.gradle')
-apply plugin: 'net.ltgt.errorprone'
-
-ext {
- PUBLISH_GROUP_ID = 'com.leinardi.android'
- PUBLISH_VERSION = build_versions.version_name
- PUBLISH_ARTIFACT_ID = 'speed-dial'
-}
-
-apply from: 'publish-module.gradle'
-
-android {
- compileSdkVersion build_versions.target_sdk
-
+apply plugin: 'com.huawei.ohos.library'
+ohos {
+ compileSdkVersion 5
defaultConfig {
- minSdkVersion build_versions.min_sdk
- targetSdkVersion build_versions.target_sdk
- versionCode build_versions.version_code
- versionName build_versions.version_name
- consumerProguardFiles 'consumer-proguard-rules.pro'
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
-
- }
-
- compileOptions {
- sourceCompatibility build_versions.java_version
- targetCompatibility build_versions.java_version
+ compatibleSdkVersion 4
}
-}
-
-tasks.withType(JavaCompile) {
- // remove the if condition if you want to run NullAway on test code
- if (!name.toLowerCase().contains("test")) {
- options.errorprone {
- check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR)
- option("NullAway:AnnotatedPackages", "com.leinardi.android.speeddial")
+ buildTypes {
+ release {
+ proguardOpt {
+ proguardEnabled false
+ rulesFiles 'proguard-rules.pro'
+ }
}
}
+
}
dependencies {
- api "androidx.appcompat:appcompat:$versions.androidx_appcompat"
- api "com.google.android.material:material:$versions.android_material"
- api "androidx.cardview:cardview:$versions.androidx_cardview"
- errorproneJavac "com.google.errorprone:javac:$versions.errorprone_javac"
- errorprone "com.google.errorprone:error_prone_core:$versions.errorprone_core"
- annotationProcessor "com.uber.nullaway:nullaway:$versions.nullaway"
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+ testImplementation 'junit:junit:4.13'
}
diff --git a/library/consumer-proguard-rules.pro b/library/consumer-proguard-rules.pro
deleted file mode 100644
index de9f47fd635c6523fa62630e53b989a1ec8d5e71..0000000000000000000000000000000000000000
--- a/library/consumer-proguard-rules.pro
+++ /dev/null
@@ -1,30 +0,0 @@
-# Add project specific ProGuard rules here.
-# By default, the flags in this file are appended to flags specified
-# in /home/arthur/Android/Sdk/tools/proguard/proguard-android.txt
-# You can edit the include path and order by changing the proguardFiles
-# directive in build.gradle.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# Add any project specific keep options here:
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
-
-# Uncomment this to preserve the line number information for
-# debugging stack traces.
-#-keepattributes SourceFile,LineNumberTable
-
-# If you keep the line number information, uncomment this to
-# hide the original source file name.
-#-renamesourcefileattribute SourceFile
-
--keepclassmembernames class com.google.android.material.floatingactionbutton.FloatingActionButton {
-com.google.android.material.floatingactionbutton.FloatingActionButtonImpl impl;
-}
--keepclassmembernames class com.google.android.material.floatingactionbutton.FloatingActionButtonImpl { void setImageMatrixScale(float); }
diff --git a/library/publish-module.gradle b/library/publish-module.gradle
deleted file mode 100644
index d37c36971d46a7071ce7bffa43bfb4d0d1101018..0000000000000000000000000000000000000000
--- a/library/publish-module.gradle
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright 2021 Roberto Leinardi.
- *
- * 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.
- */
-
-apply plugin: 'maven-publish'
-apply plugin: 'signing'
-apply plugin: 'org.jetbrains.dokka'
-
-task androidSourcesJar(type: Jar) {
- archiveClassifier.set('sources')
- if (project.plugins.findPlugin("com.android.library")) {
- from android.sourceSets.main.java.srcDirs
-// from android.sourceSets.main.kotlin.srcDirs
- } else {
- from sourceSets.main.java.srcDirs
-// from sourceSets.main.kotlin.srcDirs
- }
-}
-
-tasks.withType(dokkaHtmlPartial.getClass()).configureEach {
- pluginsMapConfiguration.set(
- ["org.jetbrains.dokka.base.DokkaBase": """{ "separateInheritedMembers": true}"""]
- )
-}
-
-task javadocJar(type: Jar, dependsOn: dokkaJavadoc) {
- archiveClassifier.set('javadoc')
- from dokkaJavadoc.outputDirectory
-}
-
-artifacts {
- archives androidSourcesJar
- archives javadocJar
-}
-
-group = PUBLISH_GROUP_ID
-version = PUBLISH_VERSION
-
-afterEvaluate {
- publishing {
- publications {
- release(MavenPublication) {
- groupId PUBLISH_GROUP_ID
- artifactId PUBLISH_ARTIFACT_ID
- version PUBLISH_VERSION
-
- if (project.plugins.findPlugin("com.android.library")) {
- from components.release
- } else {
- artifact("$buildDir/libs/${project.getName()}-${version}.jar")
- }
-
- artifact androidSourcesJar
- artifact javadocJar
-
- pom {
- name = PUBLISH_ARTIFACT_ID
- description = 'Android library providing an implementation of the Material Design Floating Action Button Speed Dial pattern.'
- url = 'https://github.com/leinardi/FloatingActionButtonSpeedDial'
- licenses {
- license {
- name = 'FloatingActionButtonSpeedDial License'
- url = 'https://github.com/leinardi/FloatingActionButtonSpeedDial/blob/release/LICENSE'
- }
- }
- developers {
- developer {
- id = 'leinardi'
- name = 'Roberto Leinardi'
- email = 'roberto@leinardi.com'
- }
- }
- scm {
- connection = 'scm:git:github.com/leinardi/FloatingActionButtonSpeedDial.git'
- developerConnection = 'scm:git:ssh://github.com/leinardi/FloatingActionButtonSpeedDial.git'
- url = 'https://github.com/leinardi/FloatingActionButtonSpeedDial/tree/release'
- }
- }
- }
- }
- }
-}
-
-ext["signing.keyId"] = rootProject.ext["signing.keyId"]
-ext["signing.password"] = rootProject.ext["signing.password"]
-ext["signing.secretKeyRingFile"] = rootProject.ext["signing.secretKeyRingFile"]
-
-signing {
- sign publishing.publications
-}
diff --git a/library/src/main/AndroidManifest.xml b/library/src/main/AndroidManifest.xml
deleted file mode 100644
index 7f57166a20462be13503648ae1b70872e03ad8b0..0000000000000000000000000000000000000000
--- a/library/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
diff --git a/library/src/main/config.json b/library/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..0453eae7ff1089ce9f0f59d4d90b663321d7bc2e
--- /dev/null
+++ b/library/src/main/config.json
@@ -0,0 +1,28 @@
+{
+ "app": {
+ "bundleName": "com.leinardi.ohos.speeddial.sample",
+ "vendor": "leinardi",
+ "version": {
+ "code": 1,
+ "name": "1.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 5,
+ "releaseType": "Beta1"
+ }
+ },
+ "deviceConfig": {
+ },
+ "module": {
+ "package": "com.leinardi.ohos.speeddial.library",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "library",
+ "moduleType": "har"
+ }
+ }
+}
\ No newline at end of file
diff --git a/library/src/main/java/com/leinardi/android/speeddial/FabWithLabelView.java b/library/src/main/java/com/leinardi/android/speeddial/FabWithLabelView.java
deleted file mode 100644
index 7d23ece6bb8bf1091e8f76096b0bcb777721bed8..0000000000000000000000000000000000000000
--- a/library/src/main/java/com/leinardi/android/speeddial/FabWithLabelView.java
+++ /dev/null
@@ -1,420 +0,0 @@
-/*
- * Copyright 2021 Roberto Leinardi.
- *
- * 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.
- */
-
-package com.leinardi.android.speeddial;
-
-import android.annotation.SuppressLint;
-import android.content.Context;
-import android.content.res.ColorStateList;
-import android.content.res.TypedArray;
-import android.graphics.Color;
-import android.graphics.drawable.Drawable;
-import android.os.Build;
-import android.text.TextUtils;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.Gravity;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-
-import androidx.annotation.ColorInt;
-import androidx.annotation.DrawableRes;
-import androidx.annotation.Nullable;
-import androidx.cardview.widget.CardView;
-import androidx.core.content.res.ResourcesCompat;
-import androidx.core.widget.ImageViewCompat;
-import com.google.android.material.floatingactionbutton.FloatingActionButton;
-import com.leinardi.android.speeddial.SpeedDialView.OnActionSelectedListener;
-
-import static com.google.android.material.floatingactionbutton.FloatingActionButton.SIZE_AUTO;
-import static com.google.android.material.floatingactionbutton.FloatingActionButton.SIZE_MINI;
-import static com.google.android.material.floatingactionbutton.FloatingActionButton.SIZE_NORMAL;
-import static com.leinardi.android.speeddial.SpeedDialActionItem.RESOURCE_NOT_SET;
-
-/**
- * View that contains fab button and its label.
- */
-@SuppressWarnings({"unused", "WeakerAccess"})
-public class FabWithLabelView extends LinearLayout {
- private static final String TAG = FabWithLabelView.class.getSimpleName();
-
- private TextView mLabelTextView;
- private FloatingActionButton mFab;
- private CardView mLabelCardView;
- private boolean mIsLabelEnabled;
- @Nullable
- private SpeedDialActionItem mSpeedDialActionItem;
- @Nullable
- private OnActionSelectedListener mOnActionSelectedListener;
- @FloatingActionButton.Size
- private int mCurrentFabSize;
- private float mLabelCardViewElevation;
- @Nullable
- private Drawable mLabelCardViewBackground;
-
- public FabWithLabelView(Context context) {
- super(context);
- init(context, null);
- }
-
- public FabWithLabelView(Context context, @Nullable AttributeSet attrs) {
- super(context, attrs);
- init(context, attrs);
- }
-
- public FabWithLabelView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
- super(context, attrs, defStyleAttr);
- init(context, attrs);
- }
-
- @SuppressLint("RestrictedApi")
- @Override
- public void setVisibility(int visibility) {
- super.setVisibility(visibility);
- getFab().setVisibility(visibility);
- if (isLabelEnabled()) {
- getLabelBackground().setVisibility(visibility);
- }
- }
-
- @Override
- public void setOrientation(int orientation) {
- super.setOrientation(orientation);
- setFabSize(mCurrentFabSize);
- if (orientation == VERTICAL) {
- setLabelEnabled(false);
- } else {
- setLabel(mLabelTextView.getText().toString());
- }
- }
-
- /**
- * Return true if button has label, false otherwise.
- */
- public boolean isLabelEnabled() {
- return mIsLabelEnabled;
- }
-
- /**
- * Enables or disables label of button.
- */
- private void setLabelEnabled(boolean enabled) {
- mIsLabelEnabled = enabled;
- mLabelCardView.setVisibility(enabled ? View.VISIBLE : View.GONE);
- }
-
- /**
- * Returns FAB labels background card.
- */
- public CardView getLabelBackground() {
- return mLabelCardView;
- }
-
- /**
- * Returns the {@link FloatingActionButton}.
- */
- public FloatingActionButton getFab() {
- return mFab;
- }
-
- public SpeedDialActionItem getSpeedDialActionItem() {
- if (mSpeedDialActionItem == null) {
- throw new IllegalStateException("SpeedDialActionItem not set yet!");
- }
- return mSpeedDialActionItem;
- }
-
- /**
- * Returns an instance of the {@link SpeedDialActionItem.Builder} initialized with the current instance of the
- * {@link SpeedDialActionItem} to make it easier to modify the current Action Item settings.
- */
- public SpeedDialActionItem.Builder getSpeedDialActionItemBuilder() {
- return new SpeedDialActionItem.Builder(getSpeedDialActionItem());
- }
-
- public void setSpeedDialActionItem(SpeedDialActionItem actionItem) {
- mSpeedDialActionItem = actionItem;
- if (actionItem.getFabType().equals(SpeedDialActionItem.TYPE_FILL)) {
- this.removeView(mFab);
- View view = inflate(getContext(), R.layout.sd_fill_fab, this);
- FloatingActionButton newFab = view.findViewById(R.id.sd_fab_fill);
- mFab = newFab;
- }
- setId(actionItem.getId());
- setLabel(actionItem.getLabel(getContext()));
- setFabContentDescription(actionItem.getContentDescription(getContext()));
- SpeedDialActionItem speedDialActionItem = getSpeedDialActionItem();
- setLabelClickable(speedDialActionItem != null && speedDialActionItem.isLabelClickable());
- setFabIcon(actionItem.getFabImageDrawable(getContext()));
- int imageTintColor = actionItem.getFabImageTintColor();
- if (imageTintColor == RESOURCE_NOT_SET) {
- imageTintColor = UiUtils.getOnSecondaryColor(getContext());
- }
- boolean imageTint = actionItem.getFabImageTint();
- if (imageTint) {
- setFabImageTintColor(imageTintColor);
- }
- int fabBackgroundColor = actionItem.getFabBackgroundColor();
- if (fabBackgroundColor == RESOURCE_NOT_SET) {
- fabBackgroundColor = UiUtils.getPrimaryColor(getContext());
- }
- setFabBackgroundColor(fabBackgroundColor);
- int labelColor = actionItem.getLabelColor();
- if (labelColor == RESOURCE_NOT_SET) {
- labelColor = ResourcesCompat.getColor(getResources(), R.color.sd_label_text_color,
- getContext().getTheme());
- }
- setLabelColor(labelColor);
- int labelBackgroundColor = actionItem.getLabelBackgroundColor();
- if (labelBackgroundColor == RESOURCE_NOT_SET) {
- labelBackgroundColor = ResourcesCompat.getColor(getResources(), R.color.sd_label_background_color,
- getContext().getTheme());
- }
- setLabelBackgroundColor(labelBackgroundColor);
- if (actionItem.getFabSize() == SIZE_AUTO || actionItem.getFabType().equals(SpeedDialActionItem.TYPE_FILL)) {
- getFab().setSize(SIZE_MINI);
- } else {
- getFab().setSize(actionItem.getFabSize());
- }
- setFabSize(actionItem.getFabSize());
- }
-
- /**
- * Set a listener that will be notified when a menu fab is selected.
- *
- * @param listener listener to set.
- */
- public void setOnActionSelectedListener(@Nullable OnActionSelectedListener listener) {
- mOnActionSelectedListener = listener;
- if (mOnActionSelectedListener != null) {
- setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View view) {
- SpeedDialActionItem speedDialActionItem = getSpeedDialActionItem();
- if (mOnActionSelectedListener != null
- && speedDialActionItem != null) {
- if (speedDialActionItem.isLabelClickable()) {
- UiUtils.performTap(getLabelBackground());
- } else {
- UiUtils.performTap(getFab());
- }
- }
- }
- });
- getFab().setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View view) {
- SpeedDialActionItem speedDialActionItem = getSpeedDialActionItem();
- if (mOnActionSelectedListener != null
- && speedDialActionItem != null) {
- mOnActionSelectedListener.onActionSelected(speedDialActionItem);
- }
- }
- });
-
- getLabelBackground().setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View view) {
- SpeedDialActionItem speedDialActionItem = getSpeedDialActionItem();
- if (mOnActionSelectedListener != null
- && speedDialActionItem != null
- && speedDialActionItem.isLabelClickable()) {
- mOnActionSelectedListener.onActionSelected(speedDialActionItem);
- }
- }
- });
- } else {
- getFab().setOnClickListener(null);
- getLabelBackground().setOnClickListener(null);
- }
-
- }
-
- /**
- * Init custom attributes.
- *
- * @param context context.
- * @param attrs attributes.
- */
- private void init(Context context, @Nullable AttributeSet attrs) {
- View rootView = inflate(context, R.layout.sd_fab_with_label_view, this);
- rootView.setFocusable(false);
- rootView.setFocusableInTouchMode(false);
-
- mFab = rootView.findViewById(R.id.sd_fab);
- mLabelTextView = rootView.findViewById(R.id.sd_label);
- mLabelCardView = rootView.findViewById(R.id.sd_label_container);
-
- setFabSize(SIZE_MINI);
- setOrientation(LinearLayout.HORIZONTAL);
- setClipChildren(false);
- setClipToPadding(false);
-
- TypedArray attr = context.obtainStyledAttributes(attrs,
- R.styleable.FabWithLabelView, 0, 0);
-
- try {
- @DrawableRes int src = attr.getResourceId(R.styleable.FabWithLabelView_srcCompat, RESOURCE_NOT_SET);
- if (src == RESOURCE_NOT_SET) {
- src = attr.getResourceId(R.styleable.FabWithLabelView_android_src, RESOURCE_NOT_SET);
- }
- SpeedDialActionItem.Builder builder = new SpeedDialActionItem.Builder(getId(), src);
- String labelText = attr.getString(R.styleable.FabWithLabelView_fabLabel);
- builder.setLabel(labelText);
- @ColorInt int fabBackgroundColor = UiUtils.getPrimaryColor(context);
- fabBackgroundColor = attr.getColor(R.styleable.FabWithLabelView_fabBackgroundColor, fabBackgroundColor);
- builder.setFabBackgroundColor(fabBackgroundColor);
- @ColorInt int labelColor = RESOURCE_NOT_SET;
- labelColor = attr.getColor(R.styleable.FabWithLabelView_fabLabelColor, labelColor);
- builder.setLabelColor(labelColor);
- @ColorInt int labelBackgroundColor = RESOURCE_NOT_SET;
- labelBackgroundColor = attr.getColor(R.styleable.FabWithLabelView_fabLabelBackgroundColor,
- labelBackgroundColor);
- builder.setLabelBackgroundColor(labelBackgroundColor);
- boolean labelClickable = attr.getBoolean(R.styleable.FabWithLabelView_fabLabelClickable, true);
- builder.setLabelClickable(labelClickable);
- setSpeedDialActionItem(builder.create());
- } catch (Exception e) {
- Log.e(TAG, "Failure setting FabWithLabelView icon", e);
- } finally {
- attr.recycle();
- }
- }
-
- private void setFabSize(@FloatingActionButton.Size int fabSize) {
- int normalFabSizePx = getContext().getResources().getDimensionPixelSize(R.dimen.sd_fab_normal_size);
- int miniFabSizePx = getContext().getResources().getDimensionPixelSize(R.dimen.sd_fab_mini_size);
- int fabSideMarginPx = getContext().getResources().getDimensionPixelSize(R.dimen.sd_fab_side_margin);
- int fabSizePx = fabSize == SIZE_NORMAL ? normalFabSizePx : miniFabSizePx;
- LayoutParams rootLayoutParams;
- LayoutParams fabLayoutParams = (LayoutParams) mFab.getLayoutParams();
- if (getOrientation() == HORIZONTAL) {
- rootLayoutParams = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, fabSizePx);
- rootLayoutParams.gravity = Gravity.END;
-
- if (fabSize == SIZE_NORMAL) {
- int excessMargin = (normalFabSizePx - miniFabSizePx) / 2;
- fabLayoutParams.setMargins(fabSideMarginPx - excessMargin, 0, fabSideMarginPx - excessMargin, 0);
- } else {
- fabLayoutParams.setMargins(fabSideMarginPx, 0, fabSideMarginPx, 0);
-
- }
- } else {
- rootLayoutParams = new LayoutParams(fabSizePx, ViewGroup.LayoutParams.WRAP_CONTENT);
- rootLayoutParams.gravity = Gravity.CENTER_VERTICAL;
- fabLayoutParams.setMargins(0, 0, 0, 0);
- }
-
- setLayoutParams(rootLayoutParams);
- mFab.setLayoutParams(fabLayoutParams);
- mCurrentFabSize = fabSize;
- }
-
- /**
- * Sets fab drawable.
- *
- * @param mDrawable drawable to set.
- */
- private void setFabIcon(@Nullable Drawable mDrawable) {
- mFab.setImageDrawable(mDrawable);
- }
-
- /**
- * Sets fab label․
- *
- * @param sequence label to set.
- */
- private void setLabel(@Nullable CharSequence sequence) {
- if (!TextUtils.isEmpty(sequence)) {
- mLabelTextView.setText(sequence);
- setLabelEnabled(getOrientation() == HORIZONTAL);
- } else {
- setLabelEnabled(false);
- }
- }
-
- private void setLabelClickable(boolean clickable) {
- getLabelBackground().setClickable(clickable);
- getLabelBackground().setFocusable(clickable);
- getLabelBackground().setEnabled(clickable);
- }
-
- /**
- * Sets fab content description․
- *
- * @param sequence content description to set.
- */
- private void setFabContentDescription(@Nullable CharSequence sequence) {
- if (!TextUtils.isEmpty(sequence)) {
- mFab.setContentDescription(sequence);
- }
- }
-
- /**
- * Sets fab image tint color in floating action menu.
- *
- * @param color color to set.
- */
- private void setFabImageTintColor(@ColorInt int color) {
- ImageViewCompat.setImageTintList(mFab, ColorStateList.valueOf(color));
- }
-
- /**
- * Sets fab color in floating action menu.
- *
- * @param color color to set.
- */
- private void setFabBackgroundColor(@ColorInt int color) {
- mFab.setBackgroundTintList(ColorStateList.valueOf(color));
- }
-
- private void setLabelColor(@ColorInt int color) {
- mLabelTextView.setTextColor(color);
- }
-
- private void setLabelBackgroundColor(@ColorInt int color) {
- if (color == Color.TRANSPARENT) {
- mLabelCardView.setCardBackgroundColor(Color.TRANSPARENT);
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
- mLabelCardViewElevation = mLabelCardView.getElevation();
- mLabelCardView.setElevation(0);
- } else {
- mLabelCardView.setBackgroundColor(Color.TRANSPARENT);
- mLabelCardViewBackground = mLabelCardView.getBackground();
- }
- } else {
- mLabelCardView.setCardBackgroundColor(ColorStateList.valueOf(color));
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
- if (mLabelCardViewElevation != 0) {
- mLabelCardView.setElevation(mLabelCardViewElevation);
- mLabelCardViewElevation = 0;
- }
- } else {
- if (mLabelCardViewBackground != null) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
- mLabelCardView.setBackground(mLabelCardViewBackground);
- } else {
- mLabelCardView.setBackgroundDrawable(mLabelCardViewBackground);
- }
- mLabelCardViewBackground = null;
- }
- }
- }
- }
-}
-
diff --git a/library/src/main/java/com/leinardi/android/speeddial/SpeedDialActionItem.java b/library/src/main/java/com/leinardi/android/speeddial/SpeedDialActionItem.java
deleted file mode 100644
index 0ef783fb14434df42199d6b2efd631ef25806352..0000000000000000000000000000000000000000
--- a/library/src/main/java/com/leinardi/android/speeddial/SpeedDialActionItem.java
+++ /dev/null
@@ -1,417 +0,0 @@
-/*
- * Copyright 2021 Roberto Leinardi.
- *
- * 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.
- */
-
-package com.leinardi.android.speeddial;
-
-import android.content.Context;
-import android.graphics.drawable.Drawable;
-import android.os.Parcel;
-import android.os.Parcelable;
-import android.view.ContextThemeWrapper;
-
-import androidx.annotation.ColorInt;
-import androidx.annotation.DrawableRes;
-import androidx.annotation.IdRes;
-import androidx.annotation.Nullable;
-import androidx.annotation.StringDef;
-import androidx.annotation.StringRes;
-import androidx.annotation.StyleRes;
-import androidx.appcompat.content.res.AppCompatResources;
-import com.google.android.material.floatingactionbutton.FloatingActionButton;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-import static com.google.android.material.floatingactionbutton.FloatingActionButton.SIZE_AUTO;
-
-@SuppressWarnings({"unused", "WeakerAccess"})
-public class SpeedDialActionItem implements Parcelable {
- public static final int RESOURCE_NOT_SET = Integer.MIN_VALUE;
-
- @StringDef({TYPE_NORMAL, TYPE_FILL})
- @Retention(RetentionPolicy.RUNTIME)
- public @interface FabType { };
- public static final String TYPE_NORMAL = "normal";
- public static final String TYPE_FILL = "fill";
-
- @IdRes
- private final int mId;
- @Nullable
- private final String mLabel;
- @StringRes
- private final int mLabelRes;
- @Nullable
- private final String mContentDescription;
- @StringRes
- private final int mContentDescriptionRes;
- @DrawableRes
- private final int mFabImageResource;
- @Nullable
- private final Drawable mFabImageDrawable;
- @ColorInt
- private final int mFabImageTintColor;
- private final boolean mFabImageTint;
- private final String mFabType;
- @ColorInt
- private final int mFabBackgroundColor;
- @ColorInt
- private final int mLabelColor;
- @ColorInt
- private final int mLabelBackgroundColor;
- private final boolean mLabelClickable;
- @FloatingActionButton.Size
- private final int mFabSize;
- @StyleRes
- private final int mTheme;
-
- private SpeedDialActionItem(Builder builder) {
- mId = builder.mId;
- mLabel = builder.mLabel;
- mLabelRes = builder.mLabelRes;
- mContentDescription = builder.mContentDescription;
- mContentDescriptionRes = builder.mContentDescriptionRes;
- mFabImageTintColor = builder.mFabImageTintColor;
- mFabImageTint = builder.mFabImageTint;
- mFabType = builder.mFabType;
- mFabImageResource = builder.mFabImageResource;
- mFabImageDrawable = builder.mFabImageDrawable;
- mFabBackgroundColor = builder.mFabBackgroundColor;
- mLabelColor = builder.mLabelColor;
- mLabelBackgroundColor = builder.mLabelBackgroundColor;
- mLabelClickable = builder.mLabelClickable;
- mFabSize = builder.mFabSize;
- mTheme = builder.mTheme;
- }
-
- public int getId() {
- return mId;
- }
-
- @Nullable
- public String getLabel(Context context) {
- if (mLabel != null) {
- return mLabel;
- } else if (mLabelRes != RESOURCE_NOT_SET) {
- return context.getString(mLabelRes);
- } else {
- return null;
- }
- }
-
- @Nullable
- public String getContentDescription(Context context) {
- if (mContentDescription != null) {
- return mContentDescription;
- } else if (mContentDescriptionRes != RESOURCE_NOT_SET) {
- return context.getString(mContentDescriptionRes);
- } else {
- return null;
- }
- }
-
- /**
- * Gets the current Drawable, or null if no Drawable has been assigned.
- *
- * @param context A context to retrieve the Drawable from (needed for SpeedDialActionItem.Builder(int, int).
- * @return the speed dial item drawable, or null if no drawable has been assigned.
- */
- @Nullable
- public Drawable getFabImageDrawable(Context context) {
- if (mFabImageDrawable != null) {
- return mFabImageDrawable;
- } else if (mFabImageResource != RESOURCE_NOT_SET) {
- return AppCompatResources.getDrawable(context, mFabImageResource);
- } else {
- return null;
- }
- }
-
- @ColorInt
- public int getFabImageTintColor() {
- return mFabImageTintColor;
- }
-
- public boolean getFabImageTint() {
- return mFabImageTint;
- }
-
- @FabType
- public String getFabType() {
- return mFabType;
- }
-
- @ColorInt
- public int getFabBackgroundColor() {
- return mFabBackgroundColor;
- }
-
- @ColorInt
- public int getLabelColor() {
- return mLabelColor;
- }
-
- public int getLabelBackgroundColor() {
- return mLabelBackgroundColor;
- }
-
- public boolean isLabelClickable() {
- return mLabelClickable;
- }
-
- @StyleRes
- public int getTheme() {
- return mTheme;
- }
-
- public FabWithLabelView createFabWithLabelView(Context context) {
- FabWithLabelView fabWithLabelView;
- int theme = getTheme();
- if (theme == RESOURCE_NOT_SET) {
- fabWithLabelView = new FabWithLabelView(context);
- } else {
- fabWithLabelView = new FabWithLabelView(new ContextThemeWrapper(context, theme), null, theme);
- }
- fabWithLabelView.setSpeedDialActionItem(this);
- return fabWithLabelView;
- }
-
- @FloatingActionButton.Size
- public int getFabSize() {
- return mFabSize;
- }
-
- public static class Builder {
- @IdRes
- private final int mId;
- @DrawableRes
- private final int mFabImageResource;
- @Nullable
- private Drawable mFabImageDrawable;
- @ColorInt
- private int mFabImageTintColor = RESOURCE_NOT_SET;
- private boolean mFabImageTint = true;
-
- private String mFabType = TYPE_NORMAL;
- @Nullable
- private String mLabel;
- @StringRes
- private int mLabelRes = RESOURCE_NOT_SET;
- @Nullable
- private String mContentDescription;
- @StringRes
- private int mContentDescriptionRes = RESOURCE_NOT_SET;
- @ColorInt
- private int mFabBackgroundColor = RESOURCE_NOT_SET;
- @ColorInt
- private int mLabelColor = RESOURCE_NOT_SET;
- @ColorInt
- private int mLabelBackgroundColor = RESOURCE_NOT_SET;
- private boolean mLabelClickable = true;
- @FloatingActionButton.Size
- private int mFabSize = SIZE_AUTO;
- @StyleRes
- private int mTheme = RESOURCE_NOT_SET;
-
- /**
- * Creates a builder for a speed dial action item that uses a {@link DrawableRes} as icon.
- *
- * @param id the identifier for this action item. The identifier must be unique to the instance
- * of {@link SpeedDialView}. The identifier should be a positive number.
- * @param fabImageResource resId the resource identifier of the drawable
- */
- public Builder(@IdRes int id, @DrawableRes int fabImageResource) {
- mId = id;
- mFabImageResource = fabImageResource;
- mFabImageDrawable = null;
- }
-
- /**
- * Creates a builder for a speed dial action item that uses a {@link Drawable} as icon.
- * {@link Drawable} are not parcelables so is not possible to restore them when the view is
- * recreated for example after an orientation change. If possible always use the {@link #Builder(int, int)}
- *
- * @param id the identifier for this action item. The identifier must be unique to the instance
- * of {@link SpeedDialView}. The identifier should be a positive number.
- * @param drawable the Drawable to set, or null to clear the content
- */
- public Builder(@IdRes int id, @Nullable Drawable drawable) {
- mId = id;
- mFabImageDrawable = drawable;
- mFabImageResource = RESOURCE_NOT_SET;
- }
-
- /**
- * Creates a builder for a speed dial action item that uses a {@link SpeedDialActionItem} instance to
- * initialize the default values.
- *
- * @param speedDialActionItem it will be used for the default values of the builder.
- */
- public Builder(SpeedDialActionItem speedDialActionItem) {
- mId = speedDialActionItem.mId;
- mLabel = speedDialActionItem.mLabel;
- mLabelRes = speedDialActionItem.mLabelRes;
- mContentDescription = speedDialActionItem.mContentDescription;
- mContentDescriptionRes = speedDialActionItem.mContentDescriptionRes;
- mFabImageResource = speedDialActionItem.mFabImageResource;
- mFabImageDrawable = speedDialActionItem.mFabImageDrawable;
- mFabImageTintColor = speedDialActionItem.mFabImageTintColor;
- mFabImageTint = speedDialActionItem.mFabImageTint;
- mFabType = speedDialActionItem.mFabType;
- mFabBackgroundColor = speedDialActionItem.mFabBackgroundColor;
- mLabelColor = speedDialActionItem.mLabelColor;
- mLabelBackgroundColor = speedDialActionItem.mLabelBackgroundColor;
- mLabelClickable = speedDialActionItem.mLabelClickable;
- mFabSize = speedDialActionItem.mFabSize;
- mTheme = speedDialActionItem.mTheme;
- }
-
- public Builder setLabel(@Nullable String label) {
- mLabel = label;
- if (mContentDescription == null || mContentDescriptionRes == RESOURCE_NOT_SET) {
- mContentDescription = label;
- }
- return this;
- }
-
- public Builder setLabel(@StringRes int labelRes) {
- mLabelRes = labelRes;
- if (mContentDescription == null || mContentDescriptionRes == RESOURCE_NOT_SET) {
- mContentDescriptionRes = labelRes;
- }
- return this;
- }
-
- public Builder setContentDescription(@Nullable String contentDescription) {
- mContentDescription = contentDescription;
- return this;
- }
-
- public Builder setContentDescription(@StringRes int contentDescriptionRes) {
- mContentDescriptionRes = contentDescriptionRes;
- return this;
- }
-
- public Builder setFabImageTintColor(@Nullable @ColorInt Integer fabImageTintColor) {
- if (fabImageTintColor == null) {
- mFabImageTint = false;
- } else {
- mFabImageTint = true;
- mFabImageTintColor = fabImageTintColor;
- }
- return this;
- }
-
- /**
- * set SpeedDialActionItem size.
- * SpeedDialActionItem.TYPE_NORMAL Use normal Fab.
- * SpeedDialActionItem.TYPE_FILL Set Floating Action Button image to fill the button.
- */
- public Builder setFabType(@FabType String fabType) {
- mFabType = fabType;
- return this;
- }
-
- public Builder setFabBackgroundColor(@ColorInt int fabBackgroundColor) {
- mFabBackgroundColor = fabBackgroundColor;
- return this;
- }
-
- public Builder setLabelColor(@ColorInt int labelColor) {
- mLabelColor = labelColor;
- return this;
- }
-
- public Builder setLabelBackgroundColor(@ColorInt int labelBackgroundColor) {
- mLabelBackgroundColor = labelBackgroundColor;
- return this;
- }
-
- public Builder setLabelClickable(boolean labelClickable) {
- mLabelClickable = labelClickable;
- return this;
- }
-
- public Builder setTheme(int mTheme) {
- this.mTheme = mTheme;
- return this;
- }
-
- public SpeedDialActionItem create() {
- return new SpeedDialActionItem(this);
- }
-
- public Builder setFabSize(@FloatingActionButton.Size int fabSize) {
- mFabSize = fabSize;
- return this;
- }
-
- }
-
- @Override
- public int describeContents() {
- return 0;
- }
-
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- dest.writeInt(this.mId);
- dest.writeString(this.mLabel);
- dest.writeInt(this.mLabelRes);
- dest.writeString(this.mContentDescription);
- dest.writeInt(this.mContentDescriptionRes);
- dest.writeInt(this.mFabImageResource);
- dest.writeInt(this.mFabImageTintColor);
- dest.writeByte(this.mFabImageTint ? (byte) 1 : (byte) 0);
- dest.writeString(this.mFabType);
- dest.writeInt(this.mFabBackgroundColor);
- dest.writeInt(this.mLabelColor);
- dest.writeInt(this.mLabelBackgroundColor);
- dest.writeByte(this.mLabelClickable ? (byte) 1 : (byte) 0);
- dest.writeInt(this.mFabSize);
- dest.writeInt(this.mTheme);
- }
-
- protected SpeedDialActionItem(Parcel in) {
- this.mId = in.readInt();
- this.mLabel = in.readString();
- this.mLabelRes = in.readInt();
- this.mContentDescription = in.readString();
- this.mContentDescriptionRes = in.readInt();
- this.mFabImageResource = in.readInt();
- this.mFabImageDrawable = null;
- this.mFabImageTintColor = in.readInt();
- this.mFabImageTint = in.readByte() != 0;
- this.mFabType = in.readString();
- this.mFabBackgroundColor = in.readInt();
- this.mLabelColor = in.readInt();
- this.mLabelBackgroundColor = in.readInt();
- this.mLabelClickable = in.readByte() != 0;
- this.mFabSize = in.readInt();
- this.mTheme = in.readInt();
- }
-
- public static final Creator CREATOR = new Creator() {
- @Override
- public SpeedDialActionItem createFromParcel(Parcel source) {
- return new SpeedDialActionItem(source);
- }
-
- @Override
- public SpeedDialActionItem[] newArray(int size) {
- return new SpeedDialActionItem[size];
- }
- };
-}
diff --git a/library/src/main/java/com/leinardi/android/speeddial/SpeedDialOverlayLayout.java b/library/src/main/java/com/leinardi/android/speeddial/SpeedDialOverlayLayout.java
deleted file mode 100755
index 84af38dae6dbac1899d3760a2c9033b2d37049d7..0000000000000000000000000000000000000000
--- a/library/src/main/java/com/leinardi/android/speeddial/SpeedDialOverlayLayout.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright 2021 Roberto Leinardi.
- *
- * 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.
- */
-
-package com.leinardi.android.speeddial;
-
-import android.content.Context;
-import android.content.res.TypedArray;
-import android.os.Build;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.View;
-import android.widget.RelativeLayout;
-
-import androidx.annotation.AttrRes;
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.core.content.res.ResourcesCompat;
-
-@SuppressWarnings({"unused", "WeakerAccess"})
-public class SpeedDialOverlayLayout extends RelativeLayout {
- private static final String TAG = SpeedDialOverlayLayout.class.getSimpleName();
- private boolean mClickableOverlay;
- private int mAnimationDuration;
- @Nullable
- private OnClickListener mClickListener;
-
- public SpeedDialOverlayLayout(@NonNull Context context) {
- super(context);
- }
-
- public SpeedDialOverlayLayout(@NonNull Context context, @Nullable AttributeSet attrs) {
- super(context, attrs);
- init(context, attrs);
- }
-
- public SpeedDialOverlayLayout(@NonNull Context context, @Nullable AttributeSet attrs, @AttrRes int
- defStyleAttr) {
- super(context, attrs, defStyleAttr);
- init(context, attrs);
- }
-
- public boolean hasClickableOverlay() {
- return mClickableOverlay;
- }
-
- /**
- * Enables or disables the click on the overlay view.
- *
- * @param clickableOverlay True to enable the click, false otherwise.
- */
- public void setClickableOverlay(boolean clickableOverlay) {
- mClickableOverlay = clickableOverlay;
- setOnClickListener(mClickListener);
- }
-
- public void setAnimationDuration(int animationDuration) {
- mAnimationDuration = animationDuration;
- }
-
- public void show() {
- show(true);
- }
-
- public void show(boolean animate) {
- if (animate) {
- UiUtils.fadeInAnim(this);
- } else {
- setVisibility(VISIBLE);
- }
- }
-
- public void hide() {
- hide(true);
- }
-
- public void hide(boolean animate) {
- if (animate) {
- UiUtils.fadeOutAnim(this);
- } else {
- setVisibility(GONE);
- }
- }
-
- @Override
- public void setOnClickListener(@Nullable OnClickListener clickListener) {
- mClickListener = clickListener;
- super.setOnClickListener(hasClickableOverlay() ? clickListener : null);
- }
-
- private void init(Context context, @Nullable AttributeSet attrs) {
- TypedArray attr = context.getTheme().obtainStyledAttributes(attrs, R.styleable.SpeedDialOverlayLayout, 0, 0);
- int overlayColor = ResourcesCompat.getColor(getResources(), R.color.sd_overlay_color, context.getTheme());
- try {
- overlayColor = attr.getColor(R.styleable.SpeedDialOverlayLayout_android_background, overlayColor);
- mClickableOverlay = attr.getBoolean(R.styleable.SpeedDialOverlayLayout_clickable_overlay, true);
- } catch (Exception e) {
- Log.e(TAG, "Failure setting FabOverlayLayout attrs", e);
- } finally {
- attr.recycle();
- }
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
- setElevation(getResources().getDimension(R.dimen.sd_overlay_elevation));
- }
- setBackgroundColor(overlayColor);
- setVisibility(View.GONE);
- mAnimationDuration = getResources().getInteger(android.R.integer.config_longAnimTime);
- }
-}
diff --git a/library/src/main/java/com/leinardi/android/speeddial/SpeedDialView.java b/library/src/main/java/com/leinardi/android/speeddial/SpeedDialView.java
deleted file mode 100755
index 0bacb0b003eb0806ec74ad03b1a92c721715a3df..0000000000000000000000000000000000000000
--- a/library/src/main/java/com/leinardi/android/speeddial/SpeedDialView.java
+++ /dev/null
@@ -1,1366 +0,0 @@
-/*
- * Copyright 2021 Roberto Leinardi.
- *
- * 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.
- */
-
-package com.leinardi.android.speeddial;
-
-import android.content.Context;
-import android.content.res.ColorStateList;
-import android.content.res.TypedArray;
-import android.graphics.Bitmap;
-import android.graphics.Rect;
-import android.graphics.drawable.AnimatedVectorDrawable;
-import android.graphics.drawable.AnimationDrawable;
-import android.graphics.drawable.Drawable;
-import android.os.Build;
-import android.os.Bundle;
-import android.os.Parcel;
-import android.os.Parcelable;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.Gravity;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.animation.Animation;
-import android.view.animation.AnimationUtils;
-import android.widget.LinearLayout;
-
-import androidx.annotation.ColorInt;
-import androidx.annotation.DrawableRes;
-import androidx.annotation.IdRes;
-import androidx.annotation.IntDef;
-import androidx.annotation.MenuRes;
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.annotation.VisibleForTesting;
-import androidx.appcompat.content.res.AppCompatResources;
-import androidx.appcompat.widget.PopupMenu;
-import androidx.cardview.widget.CardView;
-import androidx.coordinatorlayout.widget.CoordinatorLayout;
-import androidx.core.view.ViewCompat;
-import androidx.core.widget.ImageViewCompat;
-import androidx.recyclerview.widget.RecyclerView;
-import androidx.vectordrawable.graphics.drawable.AnimatedVectorDrawableCompat;
-import com.google.android.material.appbar.AppBarLayout;
-import com.google.android.material.bottomsheet.BottomSheetBehavior;
-import com.google.android.material.floatingactionbutton.FloatingActionButton;
-import com.google.android.material.floatingactionbutton.FloatingActionButton.OnVisibilityChangedListener;
-import com.google.android.material.snackbar.Snackbar;
-
-import java.lang.annotation.Retention;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
-import static com.leinardi.android.speeddial.SpeedDialActionItem.RESOURCE_NOT_SET;
-import static com.leinardi.android.speeddial.SpeedDialView.ExpansionMode.BOTTOM;
-import static com.leinardi.android.speeddial.SpeedDialView.ExpansionMode.LEFT;
-import static com.leinardi.android.speeddial.SpeedDialView.ExpansionMode.RIGHT;
-import static com.leinardi.android.speeddial.SpeedDialView.ExpansionMode.TOP;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-@SuppressWarnings({"unused", "WeakerAccess", "UnusedReturnValue"})
-public class SpeedDialView extends LinearLayout implements CoordinatorLayout.AttachedBehavior {
- private static final String TAG = SpeedDialView.class.getSimpleName();
- private static final String STATE_KEY_SUPER = "superState";
- private static final String STATE_KEY_IS_OPEN = "isOpen";
- private static final String STATE_KEY_EXPANSION_MODE = "expansionMode";
- private static final int DEFAULT_ROTATE_ANGLE = 45;
- private static final int ACTION_ANIM_DELAY = 25;
- private static final int MAIN_FAB_HORIZONTAL_MARGIN_IN_DP = 4;
- private static final int MAIN_FAB_VERTICAL_MARGIN_IN_DP = -2;
- private final InstanceState mInstanceState = new InstanceState();
- private List mFabWithLabelViews = new ArrayList<>();
- @Nullable
- private Drawable mMainFabClosedDrawable = null;
- @Nullable
- private Drawable mMainFabOpenedDrawable = null;
- @Nullable
- private Drawable mMainFabCloseOriginalDrawable;
- private FloatingActionButton mMainFab;
- @IdRes
- private int mOverlayLayoutId;
- @Nullable
- private SpeedDialOverlayLayout mOverlayLayout;
- @Nullable
- private OnChangeListener mOnChangeListener;
- @Nullable
- private OnActionSelectedListener mOnActionSelectedListener;
- private OnActionSelectedListener mOnActionSelectedProxyListener = new OnActionSelectedListener() {
- @Override
- public boolean onActionSelected(SpeedDialActionItem actionItem) {
- if (mOnActionSelectedListener != null) {
- boolean consumed = mOnActionSelectedListener.onActionSelected(actionItem);
- if (!consumed) {
- close(false);
- }
- return consumed;
- } else {
- return false;
- }
- }
- };
-
- public SpeedDialView(Context context) {
- super(context);
- init(context, null);
- }
-
- public SpeedDialView(Context context, AttributeSet attrs) {
- super(context, attrs);
- init(context, attrs);
- }
-
- public SpeedDialView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
- super(context, attrs, defStyleAttr);
- init(context, attrs);
- }
-
- public boolean getUseReverseAnimationOnClose() {
- return mInstanceState.mUseReverseAnimationOnClose;
- }
-
- public void setUseReverseAnimationOnClose(boolean useReverseAnimation) {
- mInstanceState.mUseReverseAnimationOnClose = useReverseAnimation;
- }
-
- @ExpansionMode
- public int getExpansionMode() {
- return mInstanceState.mExpansionMode;
- }
-
- public void setExpansionMode(@ExpansionMode int expansionMode) {
- setExpansionMode(expansionMode, false);
- }
-
- private void setExpansionMode(@ExpansionMode int expansionMode, boolean force) {
- if (mInstanceState.mExpansionMode != expansionMode || force) {
- mInstanceState.mExpansionMode = expansionMode;
- switch (expansionMode) {
- case TOP:
- case BOTTOM:
- setOrientation(VERTICAL);
- for (FabWithLabelView fabWithLabelView : mFabWithLabelViews) {
- fabWithLabelView.setOrientation(HORIZONTAL);
- }
- break;
- case LEFT:
- case RIGHT:
- setOrientation(HORIZONTAL);
- for (FabWithLabelView fabWithLabelView : mFabWithLabelViews) {
- fabWithLabelView.setOrientation(VERTICAL);
- }
- break;
- }
- close(false);
- ArrayList actionItems = getActionItems();
- clearActionItems();
- addAllActionItems(actionItems);
- }
- }
-
- @Override
- public void setOrientation(int orientation) {
- super.setOrientation(orientation);
- }
-
- public void show() {
- show(null);
- }
-
- public void show(@Nullable final OnVisibilityChangedListener listener) {
- setVisibility(VISIBLE);
- showFabWithWorkaround(mMainFab, listener);
- }
-
- /*
- * WORKAROUND: Remove if Google will finally fix this: https://issuetracker.google.com/issues/111316656
- */
- private void showFabWithWorkaround(FloatingActionButton fab, @Nullable final OnVisibilityChangedListener listener) {
- fab.show(new OnVisibilityChangedListener() {
- @SuppressWarnings("unchecked")
- @Override
- public void onShown(FloatingActionButton fab) {
- try {
- Field declaredField = fab.getClass().getDeclaredField("impl");
- declaredField.setAccessible(true);
- Object impl = declaredField.get(fab);
- Class implClass = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP
- ? impl.getClass().getSuperclass() : impl.getClass();
- Method scale = implClass.getDeclaredMethod("setImageMatrixScale", Float.TYPE);
- scale.setAccessible(true);
- scale.invoke(impl, 1.0F);
- } catch (NoSuchMethodException e) {
- Log.e(TAG, "Method setImageMatrixScale not found", e);
- } catch (IllegalAccessException e) {
- Log.e(TAG, "IllegalAccessException", e);
- } catch (InvocationTargetException e) {
- Log.e(TAG, "InvocationTargetException", e);
- } catch (NoSuchFieldException e) {
- Log.e(TAG, "Field impl not found", e);
- }
- if (listener != null) {
- listener.onShown(fab);
- }
- }
-
- @Override
- public void onHidden(FloatingActionButton fab) {
- if (listener != null) {
- listener.onHidden(fab);
- }
- }
- });
- }
-
- public void hide() {
- hide(null);
- }
-
- @Override
- public void setContentDescription(CharSequence contentDescription) {
- FloatingActionButton mainFab = getMainFab();
- if (mainFab != null) {
- mainFab.setContentDescription(contentDescription);
- }
- }
-
- public void hide(@Nullable final OnVisibilityChangedListener listener) {
- if (isOpen()) {
- close();
- // Workaround for mMainFab.hide() breaking the rotate anim
- ViewCompat.animate(mMainFab).rotation(0).setDuration(0).start();
- }
- mMainFab.hide(new OnVisibilityChangedListener() {
- @Override
- public void onShown(FloatingActionButton fab) {
- super.onShown(fab);
- if (listener != null) {
- listener.onShown(fab);
- }
- }
-
- @Override
- public void onHidden(FloatingActionButton fab) {
- super.onHidden(fab);
- setVisibility(INVISIBLE);
- if (listener != null) {
- listener.onHidden(fab);
- }
- }
- });
- }
-
- @Nullable
- public SpeedDialOverlayLayout getOverlayLayout() {
- return mOverlayLayout;
- }
-
- /**
- * Add the overlay/touch guard view to appear together with the speed dial menu.
- *
- * @param overlayLayout The view to add.
- */
- public void setOverlayLayout(@Nullable SpeedDialOverlayLayout overlayLayout) {
- if (mOverlayLayout != null) {
- setOnClickListener(null);
- }
- mOverlayLayout = overlayLayout;
- if (overlayLayout != null) {
- overlayLayout.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View view) {
- close();
- }
- });
- showHideOverlay(isOpen(), false);
- }
- }
-
- /**
- * Inflate a menu resource into this SpeedDialView. Any existing Action item will be removed.
- * Using the Menu resource it is possible to specify only the ID, the icon and the label of the
- * Action item. No color customization is available.
- *
- * @param menuRes Menu resource to inflate
- */
- public void inflate(@MenuRes int menuRes) {
- clearActionItems();
- PopupMenu popupMenu = new PopupMenu(getContext(), new View(getContext()));
- popupMenu.inflate(menuRes);
- Menu menu = popupMenu.getMenu();
- for (int i = 0; i < menu.size(); i++) {
- MenuItem menuItem = menu.getItem(i);
- SpeedDialActionItem actionItem = new SpeedDialActionItem.Builder(menuItem.getItemId(), menuItem.getIcon())
- .setLabel(menuItem.getTitle() != null ? menuItem.getTitle().toString() : null)
- .create();
- addActionItem(actionItem);
- }
- }
-
- /**
- * Appends all of the {@link SpeedDialActionItem} to the end of the list, in the order that they are returned by
- * the specified
- * collection's Iterator.
- *
- * @param actionItemCollection collection containing {@link SpeedDialActionItem} to be added to this list
- * @return a collection containing the instances of {@link FabWithLabelView} added.
- */
- public Collection addAllActionItems(Collection actionItemCollection) {
- ArrayList fabWithLabelViews = new ArrayList<>();
- for (SpeedDialActionItem speedDialActionItem : actionItemCollection) {
- fabWithLabelViews.add(addActionItem(speedDialActionItem));
- }
- return fabWithLabelViews;
- }
-
- /**
- * Appends the specified {@link SpeedDialActionItem} to the end of this list.
- *
- * @param speedDialActionItem {@link SpeedDialActionItem} to be appended to this list
- * @return the instance of the {@link FabWithLabelView} if the add was successful, null otherwise.
- */
- @Nullable
- public FabWithLabelView addActionItem(SpeedDialActionItem speedDialActionItem) {
- return addActionItem(speedDialActionItem, mFabWithLabelViews.size());
- }
-
- /**
- * Inserts the specified {@link SpeedDialActionItem} at the specified position in this list. Shifts the element
- * currently at that position (if any) and any subsequent elements to the right (adds one to their indices).
- *
- * @param actionItem {@link SpeedDialActionItem} to be appended to this list
- * @param position index at which the specified element is to be inserted
- * @return the instance of the {@link FabWithLabelView} if the add was successful, null otherwise.
- */
- @Nullable
- public FabWithLabelView addActionItem(SpeedDialActionItem actionItem, int position) {
- return addActionItem(actionItem, position, true);
- }
-
- /**
- * Inserts the specified {@link SpeedDialActionItem} at the specified position in this list. Shifts the element
- * currently at that position (if any) and any subsequent elements to the right (adds one to their indices).
- *
- * @param actionItem {@link SpeedDialActionItem} to be appended to this list
- * @param position index at which the specified element is to be inserted
- * @param animate true to animate the insertion, false to insert instantly
- * @return the instance of the {@link FabWithLabelView} if the add was successful, null otherwise.
- */
- @Nullable
- public FabWithLabelView addActionItem(SpeedDialActionItem actionItem, int position, boolean animate) {
- FabWithLabelView oldView = findFabWithLabelViewById(actionItem.getId());
- if (oldView != null) {
- return replaceActionItem(oldView.getSpeedDialActionItem(), actionItem);
- } else {
- FabWithLabelView newView = actionItem.createFabWithLabelView(getContext());
- newView.setOrientation(getOrientation() == VERTICAL ? HORIZONTAL : VERTICAL);
- newView.setOnActionSelectedListener(mOnActionSelectedProxyListener);
- int layoutPosition = getLayoutPosition(position);
- addView(newView, layoutPosition);
- mFabWithLabelViews.add(position, newView);
- if (isOpen()) {
- if (animate) {
- showWithAnimationFabWithLabelView(newView, 0);
- }
- } else {
- newView.setVisibility(GONE);
- }
- return newView;
- }
- }
-
- /**
- * Removes the {@link SpeedDialActionItem} at the specified position in this list. Shifts any subsequent elements
- * to the left (subtracts one from their indices).
- *
- * @param position the index of the {@link SpeedDialActionItem} to be removed
- * @return the {@link SpeedDialActionItem} that was removed from the list
- */
- @Nullable
- public SpeedDialActionItem removeActionItem(int position) {
- SpeedDialActionItem speedDialActionItem = mFabWithLabelViews.get(position).getSpeedDialActionItem();
- removeActionItem(speedDialActionItem);
- return speedDialActionItem;
- }
-
- /**
- * Removes the specified {@link SpeedDialActionItem} from this list, if it is present. If the list does not
- * contain the element, it is unchanged.
- *
- * Returns true if this list contained the specified element (or equivalently, if this list changed
- * as a result of the call).
- *
- * @param actionItem {@link SpeedDialActionItem} to be removed from this list, if present
- * @return true if this list contained the specified element
- */
- public boolean removeActionItem(@Nullable SpeedDialActionItem actionItem) {
- return actionItem != null && removeActionItemById(actionItem.getId()) != null;
- }
-
- /**
- * Finds and removes the first {@link SpeedDialActionItem} with the given ID, if it is present. If the list does not
- * contain the element, it is unchanged.
- *
- * @param idRes the ID to search for
- * @return the {@link SpeedDialActionItem} that was removed from the list, or null otherwise
- */
- @Nullable
- public SpeedDialActionItem removeActionItemById(@IdRes int idRes) {
- return removeActionItem(findFabWithLabelViewById(idRes));
- }
-
- /**
- * Replace the {@link SpeedDialActionItem} at the specified position in this list with the one provided as
- * parameter.
- *
- * @param newActionItem {@link SpeedDialActionItem} to use for the replacement
- * @param position the index of the {@link SpeedDialActionItem} to be replaced
- * @return the instance of the new {@link FabWithLabelView} if the replace was successful, null otherwise.
- */
- @Nullable
- public FabWithLabelView replaceActionItem(SpeedDialActionItem newActionItem, int position) {
- return replaceActionItem(mFabWithLabelViews.get(position).getSpeedDialActionItem(), newActionItem);
- }
-
- /**
- * Replace an already added {@link SpeedDialActionItem} with the one provided as parameter.
- *
- * @param oldSpeedDialActionItem the old {@link SpeedDialActionItem} to remove
- * @param newSpeedDialActionItem the new {@link SpeedDialActionItem} to add
- * @return the instance of the new {@link FabWithLabelView} if the replace was successful, null otherwise.
- */
- @Nullable
- public FabWithLabelView replaceActionItem(@Nullable SpeedDialActionItem oldSpeedDialActionItem,
- SpeedDialActionItem newSpeedDialActionItem) {
- if (oldSpeedDialActionItem == null) {
- return null;
- } else {
- FabWithLabelView oldView = findFabWithLabelViewById(oldSpeedDialActionItem.getId());
- if (oldView != null) {
- int index = mFabWithLabelViews.indexOf(oldView);
- if (index < 0) {
- return null;
- }
- removeActionItem(findFabWithLabelViewById(newSpeedDialActionItem.getId()), null, false);
- removeActionItem(findFabWithLabelViewById(oldSpeedDialActionItem.getId()), null, false);
- return addActionItem(newSpeedDialActionItem, index, false);
- } else {
- return null;
- }
- }
- }
-
- /**
- * Removes all of the {@link SpeedDialActionItem} from this list.
- */
- public void clearActionItems() {
- Iterator it = mFabWithLabelViews.iterator();
- while (it.hasNext()) {
- FabWithLabelView fabWithLabelView = it.next();
- removeActionItem(fabWithLabelView, it, true);
- }
- }
-
- @NonNull
- public ArrayList getActionItems() {
- ArrayList speedDialActionItems = new ArrayList<>(mFabWithLabelViews.size());
- for (FabWithLabelView fabWithLabelView : mFabWithLabelViews) {
- speedDialActionItems.add(fabWithLabelView.getSpeedDialActionItem());
- }
- return speedDialActionItems;
- }
-
- @NonNull
- @Override
- public CoordinatorLayout.Behavior getBehavior() {
- return new SnackbarBehavior();
- }
-
- /**
- * Set a listener that will be notified when a menu fab is selected.
- *
- * @param listener listener to set.
- */
- public void setOnActionSelectedListener(@Nullable OnActionSelectedListener listener) {
- mOnActionSelectedListener = listener;
-
- for (int index = 0; index < mFabWithLabelViews.size(); index++) {
- final FabWithLabelView fabWithLabelView = mFabWithLabelViews.get(index);
- fabWithLabelView.setOnActionSelectedListener(mOnActionSelectedProxyListener);
- }
- }
-
- /**
- * Set Main FloatingActionButton ClickMOnOptionFabSelectedListener.
- *
- * @param onChangeListener listener to set.
- */
- public void setOnChangeListener(@Nullable final OnChangeListener onChangeListener) {
- mOnChangeListener = onChangeListener;
- }
-
- /**
- * Opens speed dial menu.
- */
- public void open() {
- toggle(true, true);
- }
-
- public void open(boolean animate) {
- toggle(true, animate);
- }
-
- /**
- * Closes speed dial menu.
- */
- public void close() {
- toggle(false, true);
- }
-
- public void close(boolean animate) {
- toggle(false, animate);
- }
-
- /**
- * Toggles speed dial menu.
- */
- public void toggle() {
- toggle(!isOpen(), true);
- }
-
- public void toggle(boolean animate) {
- toggle(!isOpen(), animate);
- }
-
- /**
- * Return returns true if speed dial menu is open,false otherwise.
- */
- public boolean isOpen() {
- return mInstanceState.mIsOpen;
- }
-
- public FloatingActionButton getMainFab() {
- return mMainFab;
- }
-
- public float getMainFabAnimationRotateAngle() {
- return mInstanceState.mMainFabAnimationRotateAngle;
- }
-
- public void setMainFabAnimationRotateAngle(float mainFabAnimationRotateAngle) {
- mInstanceState.mMainFabAnimationRotateAngle = mainFabAnimationRotateAngle;
- setMainFabOpenedDrawable(mMainFabCloseOriginalDrawable);
- }
-
- public void setMainFabClosedDrawable(@Nullable Drawable drawable) {
- mMainFabClosedDrawable = drawable;
- updateMainFabDrawable(false);
- }
-
- public void setMainFabOpenedDrawable(@Nullable Drawable drawable) {
- mMainFabCloseOriginalDrawable = drawable;
- if (mMainFabCloseOriginalDrawable == null) {
- mMainFabOpenedDrawable = null;
- } else {
- mMainFabOpenedDrawable = UiUtils.getRotateDrawable(mMainFabCloseOriginalDrawable,
- -getMainFabAnimationRotateAngle());
- }
- updateMainFabDrawable(false);
- }
-
- @ColorInt
- public int getMainFabClosedBackgroundColor() {
- return mInstanceState.mMainFabClosedBackgroundColor;
- }
-
- public void setMainFabClosedBackgroundColor(@ColorInt int mainFabClosedBackgroundColor) {
- mInstanceState.mMainFabClosedBackgroundColor = mainFabClosedBackgroundColor;
- updateMainFabBackgroundColor();
- }
-
- @ColorInt
- public int getMainFabOpenedBackgroundColor() {
- return mInstanceState.mMainFabOpenedBackgroundColor;
- }
-
- public void setMainFabOpenedBackgroundColor(@ColorInt int mainFabOpenedBackgroundColor) {
- mInstanceState.mMainFabOpenedBackgroundColor = mainFabOpenedBackgroundColor;
- updateMainFabBackgroundColor();
- }
-
- @ColorInt
- public int getMainFabClosedIconColor() {
- return mInstanceState.mMainFabClosedIconColor;
- }
-
- public void setMainFabClosedIconColor(@ColorInt int mainFabClosedIconColor) {
- mInstanceState.mMainFabClosedIconColor = mainFabClosedIconColor;
- updateMainFabIconColor();
- }
-
- @ColorInt
- public int getMainFabOpenedIconColor() {
- return mInstanceState.mMainFabOpenedIconColor;
- }
-
- public void setMainFabOpenedIconColor(@ColorInt int mainFabOpenedIconColor) {
- mInstanceState.mMainFabOpenedIconColor = mainFabOpenedIconColor;
- updateMainFabIconColor();
- }
-
- @Override
- protected void onAttachedToWindow() {
- super.onAttachedToWindow();
- if (mOverlayLayout == null) {
- SpeedDialOverlayLayout overlayLayout = getRootView().findViewById(mOverlayLayoutId);
- setOverlayLayout(overlayLayout);
- }
- }
-
- @Nullable
- @Override
- protected Parcelable onSaveInstanceState() {
- Bundle bundle = new Bundle();
- mInstanceState.mSpeedDialActionItems = getActionItems();
- bundle.putParcelable(InstanceState.class.getName(), mInstanceState);
- bundle.putParcelable(STATE_KEY_SUPER, super.onSaveInstanceState());
- return bundle;
- }
-
- @Override
- protected void onRestoreInstanceState(Parcelable state) {
- if (state instanceof Bundle) {
- Bundle bundle = (Bundle) state;
- InstanceState instanceState = bundle.getParcelable(InstanceState.class.getName());
- if (instanceState != null
- && instanceState.mSpeedDialActionItems != null
- && !instanceState.mSpeedDialActionItems.isEmpty()) {
- setUseReverseAnimationOnClose(instanceState.mUseReverseAnimationOnClose);
- setMainFabAnimationRotateAngle(instanceState.mMainFabAnimationRotateAngle);
- setMainFabOpenedBackgroundColor(instanceState.mMainFabOpenedBackgroundColor);
- setMainFabClosedBackgroundColor(instanceState.mMainFabClosedBackgroundColor);
- setMainFabOpenedIconColor(instanceState.mMainFabOpenedIconColor);
- setMainFabClosedIconColor(instanceState.mMainFabClosedIconColor);
- setExpansionMode(instanceState.mExpansionMode, true);
- addAllActionItems(instanceState.mSpeedDialActionItems);
- toggle(instanceState.mIsOpen, false);
- }
- state = bundle.getParcelable(STATE_KEY_SUPER);
- }
- super.onRestoreInstanceState(state);
- }
-
- @Override
- public void setEnabled(boolean enabled) {
- super.setEnabled(enabled);
- getMainFab().setEnabled(enabled);
- }
-
- private int getLayoutPosition(int position) {
- if (getExpansionMode() == TOP || getExpansionMode() == LEFT) {
- return mFabWithLabelViews.size() - position;
- } else {
- return position + 1;
- }
- }
-
- @Nullable
- private SpeedDialActionItem removeActionItem(@Nullable FabWithLabelView view,
- @Nullable Iterator it,
- boolean animate) {
- if (view != null) {
- SpeedDialActionItem speedDialActionItem = view.getSpeedDialActionItem();
- if (it != null) {
- it.remove();
- } else {
- mFabWithLabelViews.remove(view);
- }
-
- if (isOpen()) {
- if (mFabWithLabelViews.isEmpty()) {
- close();
- }
- if (animate) {
- UiUtils.shrinkAnim(view, true);
- } else {
- removeView(view);
- }
- } else {
- removeView(view);
- }
- return speedDialActionItem;
- } else {
- return null;
- }
- }
-
- @Nullable
- private SpeedDialActionItem removeActionItem(@Nullable FabWithLabelView view) {
- return removeActionItem(view, null, true);
- }
-
- private void init(Context context, @Nullable AttributeSet attrs) {
- mMainFab = createMainFab();
- addView(mMainFab);
- setClipChildren(false);
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
- setElevation(getResources().getDimension(R.dimen.sd_close_elevation));
- }
- TypedArray styledAttrs = context.obtainStyledAttributes(attrs, R.styleable.SpeedDialView, 0, 0);
- try {
- setEnabled(styledAttrs.getBoolean(R.styleable.SpeedDialView_android_enabled, isEnabled()));
- setUseReverseAnimationOnClose(styledAttrs.getBoolean(R.styleable.SpeedDialView_sdUseReverseAnimationOnClose,
- getUseReverseAnimationOnClose()));
-
- setMainFabAnimationRotateAngle(styledAttrs.getFloat(R.styleable.SpeedDialView_sdMainFabAnimationRotateAngle,
- getMainFabAnimationRotateAngle()));
- @DrawableRes int openDrawableRes = styledAttrs.getResourceId(R.styleable.SpeedDialView_sdMainFabClosedSrc,
- RESOURCE_NOT_SET);
- if (openDrawableRes != RESOURCE_NOT_SET) {
- setMainFabClosedDrawable(AppCompatResources.getDrawable(getContext(), openDrawableRes));
- }
- int closeDrawableRes = styledAttrs.getResourceId(R.styleable.SpeedDialView_sdMainFabOpenedSrc,
- RESOURCE_NOT_SET);
- if (closeDrawableRes != RESOURCE_NOT_SET) {
- setMainFabOpenedDrawable(AppCompatResources.getDrawable(context, closeDrawableRes));
- }
- setExpansionMode(styledAttrs.getInt(R.styleable.SpeedDialView_sdExpansionMode, getExpansionMode()), true);
-
- setMainFabClosedBackgroundColor(styledAttrs.getColor(R.styleable
- .SpeedDialView_sdMainFabClosedBackgroundColor,
- getMainFabClosedBackgroundColor()));
- setMainFabOpenedBackgroundColor(styledAttrs.getColor(R.styleable
- .SpeedDialView_sdMainFabOpenedBackgroundColor,
- getMainFabOpenedBackgroundColor()));
- setMainFabClosedIconColor(styledAttrs.getColor(R.styleable
- .SpeedDialView_sdMainFabClosedIconColor,
- getMainFabClosedIconColor()));
- setMainFabOpenedIconColor(styledAttrs.getColor(R.styleable
- .SpeedDialView_sdMainFabOpenedIconColor,
- getMainFabOpenedIconColor()));
- mOverlayLayoutId = styledAttrs.getResourceId(R.styleable.SpeedDialView_sdOverlayLayout, RESOURCE_NOT_SET);
- } catch (Exception e) {
- Log.e(TAG, "Failure setting FabWithLabelView icon", e);
- } finally {
- styledAttrs.recycle();
- }
- }
-
- private FloatingActionButton createMainFab() {
- FloatingActionButton floatingActionButton = new FloatingActionButton(getContext());
- LayoutParams layoutParams = new LayoutParams(
- ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
- layoutParams.gravity = Gravity.END;
- int marginHorizontal = UiUtils.dpToPx(getContext(), MAIN_FAB_HORIZONTAL_MARGIN_IN_DP);
- int marginVertical = UiUtils.dpToPx(getContext(), MAIN_FAB_VERTICAL_MARGIN_IN_DP);
- layoutParams.setMargins(marginHorizontal, marginVertical, marginHorizontal, marginVertical);
- floatingActionButton.setId(R.id.sd_main_fab);
- floatingActionButton.setUseCompatPadding(true);
- floatingActionButton.setLayoutParams(layoutParams);
- floatingActionButton.setClickable(true);
- floatingActionButton.setFocusable(true);
- floatingActionButton.setSize(FloatingActionButton.SIZE_NORMAL);
- floatingActionButton.setContentDescription(getContentDescription());
- floatingActionButton.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(final View view) {
- if (isOpen()) {
- if (mOnChangeListener == null || !mOnChangeListener.onMainActionSelected()) {
- close();
- }
- } else {
- open();
- }
- }
- });
- return floatingActionButton;
- }
-
- private void toggle(boolean show, boolean animate) {
- if (show && mFabWithLabelViews.isEmpty()) {
- show = false;
- if (mOnChangeListener != null) {
- mOnChangeListener.onMainActionSelected();
- }
- }
- if (isOpen() == show) {
- return;
- }
- mInstanceState.mIsOpen = show;
- visibilitySetup(show, animate, mInstanceState.mUseReverseAnimationOnClose);
- updateMainFabDrawable(animate);
- updateMainFabBackgroundColor();
- updateMainFabIconColor();
- showHideOverlay(show, animate);
- if (mOnChangeListener != null) {
- mOnChangeListener.onToggleChanged(show);
- }
- }
-
- private void updateMainFabDrawable(boolean animate) {
- if (isOpen()) {
- if (mMainFabOpenedDrawable != null) {
- // This is a workaround. I don't know why I can't set the rotated bitmap with `setImageBitmap`
- // after set directly the rotated Drawable with `setImageDrawable`
- // on Android API 25 or lower (works on API 26 or higher).
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N &&
- mMainFabOpenedDrawable instanceof AnimatedVectorDrawable) {
- mMainFab.setImageDrawable(mMainFabOpenedDrawable);
- ((AnimatedVectorDrawable) mMainFabOpenedDrawable).start();
- } else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N &&
- mMainFabOpenedDrawable instanceof AnimatedVectorDrawableCompat) {
- mMainFab.setImageDrawable(mMainFabOpenedDrawable);
- ((AnimatedVectorDrawableCompat) mMainFabOpenedDrawable).start();
- } else if (mMainFabOpenedDrawable instanceof AnimationDrawable) {
- mMainFab.setImageDrawable(mMainFabOpenedDrawable);
- ((AnimationDrawable) mMainFabOpenedDrawable).start();
- } else {
- // This is a workaround.
- // I don't know why if I set directly the rotated Drawable with `setImageDrawable`
- // it will be transparent/empty on Android API 20 or lower (works on API 21 or higher).
-
- Bitmap bitmap = UiUtils.getBitmapFromDrawable(mMainFabOpenedDrawable);
- mMainFab.setImageBitmap(bitmap);
- }
- }
- UiUtils.rotateForward(mMainFab, getMainFabAnimationRotateAngle(), animate);
- } else {
- UiUtils.rotateBackward(mMainFab, animate);
- mMainFab.setImageDrawable(mMainFabClosedDrawable);
- if (mMainFabClosedDrawable != null) {
-
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N &&
- mMainFabClosedDrawable instanceof AnimatedVectorDrawable) {
- ((AnimatedVectorDrawable) mMainFabClosedDrawable).start();
- } else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N &&
- mMainFabClosedDrawable instanceof AnimatedVectorDrawableCompat) {
- ((AnimatedVectorDrawableCompat) mMainFabClosedDrawable).start();
- } else if (mMainFabClosedDrawable instanceof AnimationDrawable) {
- ((AnimationDrawable) mMainFabClosedDrawable).start();
- }
- }
- }
- }
-
- private void updateMainFabBackgroundColor() {
- int color;
- if (isOpen()) {
- color = getMainFabOpenedBackgroundColor();
- } else {
- color = getMainFabClosedBackgroundColor();
- }
- if (color != RESOURCE_NOT_SET) {
- mMainFab.setBackgroundTintList(ColorStateList.valueOf(color));
- } else {
- mMainFab.setBackgroundTintList(ColorStateList.valueOf(UiUtils.getAccentColor(getContext())));
- }
- }
-
- private void updateMainFabIconColor() {
- int color;
- if (isOpen()) {
- color = getMainFabOpenedIconColor();
- } else {
- color = getMainFabClosedIconColor();
- }
- if (color != RESOURCE_NOT_SET) {
- ImageViewCompat.setImageTintList(mMainFab, ColorStateList.valueOf(color));
- }
- }
-
- private void updateElevation() {
- if (isOpen()) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
- setElevation(getResources().getDimension(R.dimen.sd_open_elevation));
- } else {
- bringToFront();
- }
- } else {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
- setElevation(getResources().getDimension(R.dimen.sd_close_elevation));
- }
- }
- }
-
- private void showHideOverlay(boolean show, boolean animate) {
- if (mOverlayLayout != null) {
- if (show) {
- mOverlayLayout.show(animate);
- } else {
- mOverlayLayout.hide(animate);
- }
- }
- }
-
- @Nullable
- private FabWithLabelView findFabWithLabelViewById(@IdRes int id) {
- for (FabWithLabelView fabWithLabelView : mFabWithLabelViews) {
- if (fabWithLabelView.getId() == id) {
- return fabWithLabelView;
- }
- }
- return null;
- }
-
- /**
- * Set menus visibility (visible or invisible).
- */
- private void visibilitySetup(boolean visible, boolean animate, boolean reverseAnimation) {
- int size = mFabWithLabelViews.size();
- if (visible) {
- for (int i = 0; i < size; i++) {
- FabWithLabelView fabWithLabelView = mFabWithLabelViews.get(i);
- fabWithLabelView.setAlpha(1);
- fabWithLabelView.setVisibility(VISIBLE);
- if (animate) {
- showWithAnimationFabWithLabelView(fabWithLabelView, i * ACTION_ANIM_DELAY);
- }
- if (i == 0) {
- fabWithLabelView.getFab().requestFocus();
- }
- if (i == size - 1) {
- fabWithLabelView.getFab().setNextFocusUpId(fabWithLabelView.getFab().getId());
- getMainFab().setNextFocusDownId(getMainFab().getId());
- getMainFab().setNextFocusForwardId(getMainFab().getId());
- }
- }
- } else {
- for (int i = 0; i < size; i++) {
- int index = reverseAnimation ? size - 1 - i : i;
- FabWithLabelView fabWithLabelView = mFabWithLabelViews.get(index);
- if (animate) {
- if (reverseAnimation) {
- hideWithAnimationFabWithLabelView(fabWithLabelView, i * ACTION_ANIM_DELAY);
- } else {
- UiUtils.shrinkAnim(fabWithLabelView, false);
- }
- } else {
- fabWithLabelView.setAlpha(0);
- fabWithLabelView.setVisibility(GONE);
- }
- }
- }
- }
-
- private void showWithAnimationFabWithLabelView(FabWithLabelView fabWithLabelView, int delay) {
- ViewCompat.animate(fabWithLabelView).cancel();
- UiUtils.enlargeAnim(fabWithLabelView.getFab(), delay);
- if (fabWithLabelView.isLabelEnabled()) {
- CardView labelBackground = fabWithLabelView.getLabelBackground();
- ViewCompat.animate(labelBackground).cancel();
- Animation animation = AnimationUtils.loadAnimation(getContext(), R.anim.sd_fade_and_translate_in);
- animation.setStartOffset(delay);
- labelBackground.startAnimation(animation);
- }
- }
-
- private void hideWithAnimationFabWithLabelView(final FabWithLabelView fabWithLabelView, int delay) {
- ViewCompat.animate(fabWithLabelView).cancel();
- UiUtils.shrinkAnim(fabWithLabelView.getFab(), delay);
- if (fabWithLabelView.isLabelEnabled()) {
- final CardView labelBackground = fabWithLabelView.getLabelBackground();
- ViewCompat.animate(labelBackground).cancel();
- Animation animation = AnimationUtils.loadAnimation(getContext(), R.anim.sd_fade_and_translate_out);
- animation.setAnimationListener(new Animation.AnimationListener() {
- @Override
- public void onAnimationEnd(Animation animation) {
- labelBackground.setVisibility(View.GONE);
- }
-
- @Override
- public void onAnimationStart(Animation animation) {
- }
-
- @Override
- public void onAnimationRepeat(Animation animation) {
- }
- });
- animation.setStartOffset(delay);
- labelBackground.startAnimation(animation);
- }
- }
-
- /**
- * Listener for handling events on option fab's.
- */
- public interface OnChangeListener {
- /**
- * Called when the main action has been clicked.
- *
- * @return true to keep the Speed Dial open, false otherwise.
- */
- boolean onMainActionSelected();
-
- /**
- * Called when the toggle state of the speed dial menu changes (eg. it is opened or closed).
- *
- * @param isOpen true if the speed dial is open, false otherwise.
- */
- void onToggleChanged(boolean isOpen);
- }
-
- /**
- * Listener for handling events on option fab's.
- */
- public interface OnActionSelectedListener {
- /**
- * Called when a speed dial action has been clicked.
- *
- * @param actionItem the {@link SpeedDialActionItem} that was selected.
- * @return true to keep the Speed Dial open, false otherwise.
- */
- boolean onActionSelected(SpeedDialActionItem actionItem);
- }
-
- @Retention(SOURCE)
- @IntDef({TOP, BOTTOM, LEFT, RIGHT})
- public @interface ExpansionMode {
- int TOP = 0;
- int BOTTOM = 1;
- int LEFT = 2;
- int RIGHT = 3;
- }
-
- private static class InstanceState implements Parcelable {
- private boolean mIsOpen = false;
- @ColorInt
- private int mMainFabClosedBackgroundColor = RESOURCE_NOT_SET;
- @ColorInt
- private int mMainFabOpenedBackgroundColor = RESOURCE_NOT_SET;
- @ColorInt
- private int mMainFabClosedIconColor = RESOURCE_NOT_SET;
- @ColorInt
- private int mMainFabOpenedIconColor = RESOURCE_NOT_SET;
- @ExpansionMode
- private int mExpansionMode = TOP;
- private float mMainFabAnimationRotateAngle = DEFAULT_ROTATE_ANGLE;
- private boolean mUseReverseAnimationOnClose = false;
- private ArrayList mSpeedDialActionItems = new ArrayList<>();
-
- @Override
- public int describeContents() {
- return 0;
- }
-
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- dest.writeByte(this.mIsOpen ? (byte) 1 : (byte) 0);
- dest.writeInt(this.mMainFabClosedBackgroundColor);
- dest.writeInt(this.mMainFabOpenedBackgroundColor);
- dest.writeInt(this.mMainFabClosedIconColor);
- dest.writeInt(this.mMainFabOpenedIconColor);
- dest.writeInt(this.mExpansionMode);
- dest.writeFloat(this.mMainFabAnimationRotateAngle);
- dest.writeByte(this.mUseReverseAnimationOnClose ? (byte) 1 : (byte) 0);
- dest.writeTypedList(this.mSpeedDialActionItems);
- }
-
- public InstanceState() {
- }
-
- protected InstanceState(Parcel in) {
- this.mIsOpen = in.readByte() != 0;
- this.mMainFabClosedBackgroundColor = in.readInt();
- this.mMainFabOpenedBackgroundColor = in.readInt();
- this.mMainFabClosedIconColor = in.readInt();
- this.mMainFabOpenedIconColor = in.readInt();
- this.mExpansionMode = in.readInt();
- this.mMainFabAnimationRotateAngle = in.readFloat();
- this.mUseReverseAnimationOnClose = in.readByte() != 0;
- this.mSpeedDialActionItems = in.createTypedArrayList(SpeedDialActionItem.CREATOR);
- }
-
- public static final Creator CREATOR = new Creator() {
- @Override
- public InstanceState createFromParcel(Parcel source) {
- return new InstanceState(source);
- }
-
- @Override
- public InstanceState[] newArray(int size) {
- return new InstanceState[size];
- }
- };
- }
-
- /**
- * Behavior designed for use with {@link View} instances. Its main function
- * is to move {@link View} views so that any displayed {@link Snackbar}s do
- * not cover them.
- */
- @SuppressWarnings({"unused", "WeakerAccess"})
- public static class SnackbarBehavior extends CoordinatorLayout.Behavior {
- private static final boolean AUTO_HIDE_DEFAULT = true;
-
- @Nullable
- private Rect mTmpRect;
- @Nullable
- private OnVisibilityChangedListener mInternalAutoHideListener;
- private boolean mAutoHideEnabled;
-
- public SnackbarBehavior() {
- super();
- mAutoHideEnabled = AUTO_HIDE_DEFAULT;
- }
-
- public SnackbarBehavior(Context context, AttributeSet attrs) {
- super(context, attrs);
- TypedArray a = context.obtainStyledAttributes(attrs,
- R.styleable.FloatingActionButton_Behavior_Layout);
- mAutoHideEnabled = a.getBoolean(
- R.styleable.FloatingActionButton_Behavior_Layout_behavior_autoHide,
- AUTO_HIDE_DEFAULT);
- a.recycle();
- }
-
- private static boolean isBottomSheet(@NonNull View view) {
- final ViewGroup.LayoutParams lp = view.getLayoutParams();
- if (lp instanceof CoordinatorLayout.LayoutParams) {
- return ((CoordinatorLayout.LayoutParams) lp)
- .getBehavior() instanceof BottomSheetBehavior;
- }
- return false;
- }
-
- /**
- * Returns whether the associated View automatically hides when there is
- * not enough space to be displayed.
- *
- * @return true if enabled
- */
- public boolean isAutoHideEnabled() {
- return mAutoHideEnabled;
- }
-
- /**
- * Sets whether the associated View automatically hides when there is
- * not enough space to be displayed. This works with {@link AppBarLayout}
- * and {@link BottomSheetBehavior}.
- *
- * @param autoHide true to enable automatic hiding
- */
- public void setAutoHideEnabled(boolean autoHide) {
- mAutoHideEnabled = autoHide;
- }
-
- @Override
- public void onAttachedToLayoutParams(@NonNull CoordinatorLayout.LayoutParams lp) {
- if (lp.dodgeInsetEdges == Gravity.NO_GRAVITY) {
- // If the developer hasn't set dodgeInsetEdges, lets set it to BOTTOM so that
- // we dodge any Snackbars
- lp.dodgeInsetEdges = Gravity.BOTTOM;
- }
- }
-
- @Override
- public boolean onDependentViewChanged(CoordinatorLayout parent, View child,
- View dependency) {
- if (dependency instanceof AppBarLayout) {
- // If we're depending on an AppBarLayout we will show/hide it automatically
- // if the VIEW is anchored to the AppBarLayout
- updateFabVisibilityForAppBarLayout(parent, (AppBarLayout) dependency, child);
- } else if (isBottomSheet(dependency)) {
- updateFabVisibilityForBottomSheet(dependency, child);
- }
- return false;
- }
-
- @Override
- public boolean onLayoutChild(CoordinatorLayout parent, View child,
- int layoutDirection) {
- // First, let's make sure that the visibility of the VIEW is consistent
- final List dependencies = parent.getDependencies(child);
- for (int i = 0, count = dependencies.size(); i < count; i++) {
- final View dependency = dependencies.get(i);
- if (dependency instanceof AppBarLayout) {
- if (updateFabVisibilityForAppBarLayout(
- parent, (AppBarLayout) dependency, child)) {
- break;
- }
- } else if (isBottomSheet(dependency)) {
- if (updateFabVisibilityForBottomSheet(dependency, child)) {
- break;
- }
- }
- }
- // Now let the CoordinatorLayout lay out the VIEW
- parent.onLayoutChild(child, layoutDirection);
- return true;
- }
-
- @VisibleForTesting
- void setInternalAutoHideListener(@Nullable OnVisibilityChangedListener listener) {
- mInternalAutoHideListener = listener;
- }
-
- protected void show(View child) {
- if (child instanceof FloatingActionButton) {
- ((FloatingActionButton) child).show(mInternalAutoHideListener);
- } else if (child instanceof SpeedDialView) {
- ((SpeedDialView) child).show(mInternalAutoHideListener);
- } else {
- child.setVisibility(View.VISIBLE);
- }
- }
-
- protected void hide(View child) {
- if (child instanceof FloatingActionButton) {
- ((FloatingActionButton) child).hide(mInternalAutoHideListener);
- } else if (child instanceof SpeedDialView) {
- ((SpeedDialView) child).hide(mInternalAutoHideListener);
- } else {
- child.setVisibility(View.INVISIBLE);
- }
- }
-
- private boolean shouldUpdateVisibility(View dependency, View child) {
- final CoordinatorLayout.LayoutParams lp =
- (CoordinatorLayout.LayoutParams) child.getLayoutParams();
- if (!mAutoHideEnabled) {
- return false;
- }
-
- if (lp.getAnchorId() != dependency.getId()) {
- // The anchor ID doesn't match the dependency, so we won't automatically
- // show/hide the VIEW
- return false;
- }
-
- //noinspection RedundantIfStatement
- if (child.getVisibility() != VISIBLE) {
- // The view isn't set to be visible so skip changing its visibility
- return false;
- }
-
- return true;
- }
-
- private boolean updateFabVisibilityForAppBarLayout(CoordinatorLayout parent,
- AppBarLayout appBarLayout, View child) {
- if (!shouldUpdateVisibility(appBarLayout, child)) {
- return false;
- }
-
- if (mTmpRect == null) {
- mTmpRect = new Rect();
- }
-
- // First, let's get the visible rect of the dependency
- final Rect rect = mTmpRect;
- ViewGroupUtils.getDescendantRect(parent, appBarLayout, rect);
-
- if (rect.bottom <= getMinimumHeightForVisibleOverlappingContent(appBarLayout)) {
- // If the anchor's bottom is below the seam, we'll animate our VIEW out
- // child.hide(mInternalAutoHideListener);
- child.setVisibility(View.GONE);
- } else {
- // Else, we'll animate our VIEW back in
- // child.show(mInternalAutoHideListener);
- child.setVisibility(View.VISIBLE);
- }
- return true;
- }
-
- private int getMinimumHeightForVisibleOverlappingContent(AppBarLayout appBarLayout) {
- int minHeight = ViewCompat.getMinimumHeight(appBarLayout);
- if (minHeight != 0) {
- return minHeight * 2;
- } else {
- int childCount = appBarLayout.getChildCount();
- return childCount >= 1 ? ViewCompat.getMinimumHeight(appBarLayout.getChildAt(childCount - 1)) * 2 : 0;
- }
- }
-
- private boolean updateFabVisibilityForBottomSheet(View bottomSheet,
- View child) {
- if (!shouldUpdateVisibility(bottomSheet, child)) {
- return false;
- }
- CoordinatorLayout.LayoutParams lp =
- (CoordinatorLayout.LayoutParams) child.getLayoutParams();
- if (bottomSheet.getTop() < child.getHeight() / 2 + lp.topMargin) {
- hide(child);
- } else {
- show(child);
- }
- return true;
- }
- }
-
- /**
- * Behavior designed for use with {@link View} instances. Its main function
- * is to move {@link View} views so that any displayed {@link Snackbar}s do
- * not cover them.
- */
- @SuppressWarnings({"unused", "WeakerAccess"})
- public static class ScrollingViewSnackbarBehavior extends SnackbarBehavior {
- private boolean mWasShownAlready = false;
-
- public ScrollingViewSnackbarBehavior() {
- }
-
- public ScrollingViewSnackbarBehavior(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
- @Override
- public boolean onStartNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull View child, @NonNull
- View directTargetChild, @NonNull View target, int axes, int type) {
- return true;
- }
-
- @Override
- public boolean layoutDependsOn(CoordinatorLayout parent, View child, View dependency) {
- if (!mWasShownAlready
- && dependency instanceof RecyclerView
- && (
- ((RecyclerView) dependency).getAdapter() == null
- || ((RecyclerView) dependency).getAdapter().getItemCount() == 0)) {
- show(child);
- mWasShownAlready = true;
- }
- return dependency instanceof RecyclerView || super.layoutDependsOn(parent, child, dependency);
- }
-
- @Override
- public void onNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull View child, @NonNull View
- target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int type) {
- super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed,
- type);
- mWasShownAlready = false;
- if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) {
- hide(child);
- } else if (dyConsumed < 0) {
- show(child);
- }
- }
- }
-
- public static class NoBehavior extends CoordinatorLayout.Behavior {
- public NoBehavior() {
- }
-
- public NoBehavior(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
- }
-}
diff --git a/library/src/main/java/com/leinardi/android/speeddial/UiUtils.java b/library/src/main/java/com/leinardi/android/speeddial/UiUtils.java
deleted file mode 100644
index bb53c07a980d4aa3db63a4d81c19420cb4564715..0000000000000000000000000000000000000000
--- a/library/src/main/java/com/leinardi/android/speeddial/UiUtils.java
+++ /dev/null
@@ -1,353 +0,0 @@
-/*
- * Copyright 2021 Roberto Leinardi.
- *
- * 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.
- */
-
-package com.leinardi.android.speeddial;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.graphics.BitmapShader;
-import android.graphics.Canvas;
-import android.graphics.Paint;
-import android.graphics.Shader;
-import android.graphics.drawable.BitmapDrawable;
-import android.graphics.drawable.Drawable;
-import android.graphics.drawable.LayerDrawable;
-import android.os.Build;
-import android.util.DisplayMetrics;
-import android.util.Log;
-import android.util.TypedValue;
-import android.view.View;
-import android.view.ViewConfiguration;
-import android.view.ViewGroup;
-import android.view.animation.Animation;
-import android.view.animation.AnimationUtils;
-
-import androidx.annotation.Nullable;
-import androidx.core.view.ViewCompat;
-import androidx.interpolator.view.animation.FastOutSlowInInterpolator;
-
-import static android.content.ContentValues.TAG;
-import static android.view.View.GONE;
-import static android.view.View.VISIBLE;
-
-public class UiUtils {
-
- private UiUtils() {
- }
-
- public static int getPrimaryColor(Context context) {
- int colorAttr;
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
- colorAttr = android.R.attr.colorPrimary;
- } else {
- //Get colorAccent defined for AppCompat
- colorAttr = context.getResources().getIdentifier("colorPrimary", "attr", context.getPackageName());
- }
- TypedValue outValue = new TypedValue();
- context.getTheme().resolveAttribute(colorAttr, outValue, true);
- return outValue.data;
- }
-
- public static int getOnSecondaryColor(Context context) {
- int colorAttr;
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
- colorAttr = R.attr.colorOnSecondary;
- } else {
- //Get colorAccent defined for AppCompat
- colorAttr = context.getResources().getIdentifier("colorOnSecondary", "attr", context.getPackageName());
- }
- TypedValue outValue = new TypedValue();
- context.getTheme().resolveAttribute(colorAttr, outValue, true);
- return outValue.data;
- }
-
- public static int getAccentColor(Context context) {
- int colorAttr;
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
- colorAttr = android.R.attr.colorAccent;
- } else {
- //Get colorAccent defined for AppCompat
- colorAttr = context.getResources().getIdentifier("colorAccent", "attr", context.getPackageName());
- }
- TypedValue outValue = new TypedValue();
- context.getTheme().resolveAttribute(colorAttr, outValue, true);
- return outValue.data;
- }
-
- public static int dpToPx(Context context, float dp) {
- DisplayMetrics metrics = context.getResources().getDisplayMetrics();
- return Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, metrics));
- }
-
- public static int pxToDp(float px) {
- return Math.round(px / Resources.getSystem().getDisplayMetrics().density);
- }
-
- /**
- * Fade out animation.
- *
- * @param view view to animate.
- */
- public static void fadeOutAnim(final View view) {
- ViewCompat.animate(view).cancel();
- view.setAlpha(1F);
- view.setVisibility(VISIBLE);
- ViewCompat.animate(view)
- .alpha(0F)
- .withLayer()
- .setDuration(view.getContext().getResources().getInteger(R.integer.sd_close_animation_duration))
- .setInterpolator(new FastOutSlowInInterpolator())
- .withEndAction(new Runnable() {
- @Override
- public void run() {
- view.setVisibility(GONE);
- }
- })
- .start();
- }
-
- /**
- * Fade out animation.
- *
- * @param view view to animate.
- */
- public static void fadeInAnim(final View view) {
- ViewCompat.animate(view).cancel();
- view.setAlpha(0);
- view.setVisibility(VISIBLE);
- ViewCompat.animate(view)
- .alpha(1F)
- .withLayer()
- .setDuration(view.getContext().getResources().getInteger(R.integer.sd_open_animation_duration))
- .setInterpolator(new FastOutSlowInInterpolator())
- .start();
- }
-
- /**
- * SpeedDial opening animation.
- *
- * @param view view that starts that animation.
- * @param startOffset a delay in time to start the animation
- */
- public static void enlargeAnim(View view, long startOffset) {
- ViewCompat.animate(view).cancel();
- view.setVisibility(View.VISIBLE);
- Animation anim = AnimationUtils.loadAnimation(view.getContext(), R.anim.sd_scale_fade_and_translate_in);
- anim.setStartOffset(startOffset);
- view.startAnimation(anim);
- }
-
- /**
- * SpeedDial closing animation.
- *
- * @param view view that starts that animation.
- * @param startOffset a delay in time to start the animation
- */
- public static void shrinkAnim(final View view, long startOffset) {
- ViewCompat.animate(view).cancel();
- view.setVisibility(View.VISIBLE);
- Animation anim = AnimationUtils.loadAnimation(view.getContext(), R.anim.sd_scale_fade_and_translate_out);
- anim.setStartOffset(startOffset);
- anim.setAnimationListener(new Animation.AnimationListener() {
- @Override
- public void onAnimationEnd(Animation animation) {
- view.setVisibility(View.GONE);
- }
-
- @Override
- public void onAnimationStart(Animation animation) {
- }
-
- @Override
- public void onAnimationRepeat(Animation animation) {
- }
- });
- view.startAnimation(anim);
- }
-
- /**
- * Closing animation.
- *
- * @param view view that starts that animation.
- * @param removeView true to remove the view when the animation is over, false otherwise.
- */
- public static void shrinkAnim(final View view, final boolean removeView) {
- ViewCompat.animate(view).cancel();
- ViewCompat.animate(view)
- .alpha(0F)
- .withLayer()
- .setDuration(view.getContext().getResources().getInteger(R.integer.sd_close_animation_duration))
- .setInterpolator(new FastOutSlowInInterpolator())
- .withEndAction(new Runnable() {
- @Override
- public void run() {
- if (removeView) {
- ViewGroup parent = (ViewGroup) view.getParent();
- if (parent != null) {
- parent.removeView(view);
- }
- } else {
- view.setVisibility(GONE);
- }
- }
- })
- .start();
- }
-
- /**
- * Rotate a view of the specified degrees.
- *
- * @param view The view to rotate.
- * @param animate true to animate the rotation, false to be instant.
- * @see #rotateBackward(View, boolean)
- */
- public static void rotateForward(View view, float angle, boolean animate) {
- ViewCompat.animate(view)
- .rotation(angle)
- .withLayer()
- .setDuration(animate ?
- view.getContext().getResources().getInteger(R.integer.sd_rotate_animation_duration) : 0)
- .setInterpolator(new FastOutSlowInInterpolator())
- .start();
- }
-
- /**
- * Rotate a view back to its default angle (0°).
- *
- * @param view The view to rotate.
- * @param animate true to animate the rotation, false to be instant.
- * @see #rotateForward(View, float, boolean)
- */
- public static void rotateBackward(View view, boolean animate) {
- ViewCompat.animate(view)
- .rotation(0.0F)
- .withLayer()
- .setDuration(animate ?
- view.getContext().getResources().getInteger(R.integer.sd_rotate_animation_duration) : 0)
- .setInterpolator(new FastOutSlowInInterpolator())
- .start();
- }
-
- public static Drawable getRotateDrawable(final Drawable drawable, final float angle) {
- if (angle == 0) {
- return drawable;
- }
- final Drawable[] drawables = {drawable};
- return new LayerDrawable(drawables) {
- @Override
- public void draw(final Canvas canvas) {
- canvas.save();
- canvas.rotate(angle, drawable.getIntrinsicWidth() / 2f, drawable.getIntrinsicHeight() / 2f);
- super.draw(canvas);
- canvas.restore();
- }
- };
- }
-
- /**
- * Creates a {@link Bitmap} from a {@link Drawable}.
- */
- @Nullable
- public static Bitmap getBitmapFromDrawable(@Nullable Drawable drawable) {
- if (drawable == null) {
- return null;
- } else {
- Bitmap bitmap;
- if (drawable instanceof BitmapDrawable) {
- BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable;
- if (bitmapDrawable.getBitmap() != null) {
- return bitmapDrawable.getBitmap();
- }
- }
-
- if (drawable.getIntrinsicWidth() <= 0 || drawable.getIntrinsicHeight() <= 0) {
- // Single color bitmap will be created of 1x1 pixel
- bitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888);
- } else {
- bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap
- .Config.ARGB_8888);
- }
-
- Canvas canvas = new Canvas(bitmap);
- drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
- drawable.draw(canvas);
- return bitmap;
- }
- }
-
- /**
- * Creates a {@link Drawable} from a {@link Bitmap}.
- */
- @Nullable
- public static Drawable getDrawableFromBitmap(@Nullable Bitmap bitmap) {
- if (bitmap == null) {
- return null;
- } else {
- return new BitmapDrawable(bitmap);
- }
- }
-
- /**
- * Perform a tap of {@link ViewConfiguration#getTapTimeout()} milliseconds on the view.
- *
- * @param view the view you want to tap
- */
- public static void performTap(final View view) {
- view.setPressed(true);
- view.postDelayed(new Runnable() {
- @Override
- public void run() {
- view.setPressed(false);
- view.performClick();
- }
- }, ViewConfiguration.getTapTimeout());
- }
-
- /**
- * Crop the image into a circle
- */
- public static Drawable cropFabImageInCircle(Drawable fabIcon) {
- Bitmap bitmap = UiUtils.getBitmapFromDrawable(fabIcon);
- if (bitmap == null) {
- Log.e(TAG, "Couldn't crop the Image");
- return fabIcon;
- }
- int width = bitmap.getWidth();
- int height = bitmap.getHeight();
- if (width > height) {
- bitmap = Bitmap.createBitmap(bitmap, width / 2 - height / 2, 0, height, height);
- } else if (width < height) {
- bitmap = Bitmap.createBitmap(bitmap, 0, height / 2 - width / 2, width, width);
- }
-
- Bitmap circleBitmap = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_8888);
- BitmapShader shader;
- shader = new BitmapShader(bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
- Paint paint = new Paint();
- paint.setAntiAlias(true);
- paint.setShader(shader);
- int circleCenter = bitmap.getWidth() / 2;
- Canvas canvas = new Canvas(circleBitmap);
- canvas.drawCircle(circleCenter, circleCenter, circleCenter, paint);
- Drawable cropped = UiUtils.getDrawableFromBitmap(circleBitmap);
- if (cropped == null) {
- Log.e(TAG, "Couldn't crop the Image");
- return fabIcon;
- }
- return cropped;
- }
-}
diff --git a/library/src/main/java/com/leinardi/android/speeddial/ViewGroupUtils.java b/library/src/main/java/com/leinardi/android/speeddial/ViewGroupUtils.java
deleted file mode 100644
index d787b674d717f637f2a4d812b7a2e15a40d97742..0000000000000000000000000000000000000000
--- a/library/src/main/java/com/leinardi/android/speeddial/ViewGroupUtils.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright 2021 Roberto Leinardi.
- *
- * 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.
- */
-
-package com.leinardi.android.speeddial;
-
-import android.graphics.Matrix;
-import android.graphics.Rect;
-import android.graphics.RectF;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.ViewParent;
-
-class ViewGroupUtils {
- private static final ThreadLocal MATRIX_THREAD_LOCAL = new ThreadLocal<>();
- private static final ThreadLocal RECT_F = new ThreadLocal<>();
-
- private ViewGroupUtils() {
- }
-
- /**
- * This is a port of the common
- * {@link ViewGroup#offsetDescendantRectToMyCoords(View, Rect)}
- * from the framework, but adapted to take transformations into account. The result
- * will be the bounding rect of the real transformed rect.
- *
- * @param descendant view defining the original coordinate system of rect
- * @param rect (in/out) the rect to offset from descendant to this view's coordinate system
- */
- static void offsetDescendantRect(ViewGroup parent, View descendant, Rect rect) {
- Matrix m = MATRIX_THREAD_LOCAL.get();
- if (m == null) {
- m = new Matrix();
- MATRIX_THREAD_LOCAL.set(m);
- } else {
- m.reset();
- }
-
- offsetDescendantMatrix(parent, descendant, m);
-
- RectF rectF = RECT_F.get();
- if (rectF == null) {
- rectF = new RectF();
- RECT_F.set(rectF);
- }
- rectF.set(rect);
- m.mapRect(rectF);
- rect.set((int) (rectF.left + 0.5f), (int) (rectF.top + 0.5f),
- (int) (rectF.right + 0.5f), (int) (rectF.bottom + 0.5f));
- }
-
- /**
- * Retrieve the transformed bounding rect of an arbitrary descendant view.
- * This does not need to be a direct child.
- *
- * @param descendant descendant view to reference
- * @param out rect to set to the bounds of the descendant view
- */
- static void getDescendantRect(ViewGroup parent, View descendant, Rect out) {
- out.set(0, 0, descendant.getWidth(), descendant.getHeight());
- offsetDescendantRect(parent, descendant, out);
- }
-
- private static void offsetDescendantMatrix(ViewParent target, View view, Matrix m) {
- final ViewParent parent = view.getParent();
- if (parent instanceof View && parent != target) {
- final View vp = (View) parent;
- offsetDescendantMatrix(target, vp, m);
- m.preTranslate(-vp.getScrollX(), -vp.getScrollY());
- }
-
- m.preTranslate(view.getLeft(), view.getTop());
-
- if (!view.getMatrix().isIdentity()) {
- m.preConcat(view.getMatrix());
- }
- }
-}
diff --git a/checkstyle.gradle b/library/src/main/java/com/leinardi/ohos/speeddial/library/FabWithLabelView.java
similarity index 54%
rename from checkstyle.gradle
rename to library/src/main/java/com/leinardi/ohos/speeddial/library/FabWithLabelView.java
index b5cb3185ed15af90de9b468f2a9983f36412763e..5d2db7ad6ca6b384b450143c686119743b412756 100644
--- a/checkstyle.gradle
+++ b/library/src/main/java/com/leinardi/ohos/speeddial/library/FabWithLabelView.java
@@ -1,11 +1,11 @@
/*
- * Copyright 2021 Roberto Leinardi.
+ * Copyright 2019 Roberto Leinardi.
*
* 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
+ * 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,
@@ -14,11 +14,19 @@
* limitations under the License.
*/
-apply plugin: 'com.leinardi.android.checkstyle'
+package com.leinardi.ohos.speeddial.library;
-checkstyle {
- ignoreFailures = false // Whether this task will ignore failures and continue running the build.
- configFile rootProject.file('config/checkstyle/checkstyle.xml')
- // The Checkstyle configuration file to use.
- toolVersion = '8.32' // The version of Checkstyle you want to be used
+import ohos.agp.components.DirectionalLayout;
+
+import ohos.app.Context;
+
+/**
+ * View that contains fab button and its label.
+ */
+@SuppressWarnings({"unused", "WeakerAccess"})
+public class FabWithLabelView extends DirectionalLayout {
+ public FabWithLabelView(Context context) {
+ super(context);
+ }
}
+
diff --git a/sample/src/main/java/com/leinardi/android/speeddial/sample/usecases/UseCase1Activity.kt b/library/src/main/java/com/leinardi/ohos/speeddial/library/SpeedDialActionItem.java
similarity index 63%
rename from sample/src/main/java/com/leinardi/android/speeddial/sample/usecases/UseCase1Activity.kt
rename to library/src/main/java/com/leinardi/ohos/speeddial/library/SpeedDialActionItem.java
index 6cc1430f0337922d973bc5590c21df66b1d9dcd4..4980fcf250b8256adc4f082ee998d9129abb5147 100644
--- a/sample/src/main/java/com/leinardi/android/speeddial/sample/usecases/UseCase1Activity.kt
+++ b/library/src/main/java/com/leinardi/ohos/speeddial/library/SpeedDialActionItem.java
@@ -1,11 +1,11 @@
/*
- * Copyright 2021 Roberto Leinardi.
+ * Copyright 2019 Roberto Leinardi.
*
* 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
+ * 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,
@@ -14,10 +14,8 @@
* limitations under the License.
*/
-package com.leinardi.android.speeddial.sample.usecases
+package com.leinardi.ohos.speeddial.library;
-import com.leinardi.android.speeddial.sample.R
-
-class UseCase1Activity : BaseUseCaseActivity() {
- override val layoutRes = R.layout.activity_use_case_1
+@SuppressWarnings({"unused", "WeakerAccess"})
+public class SpeedDialActionItem {
}
diff --git a/library/src/main/java/com/leinardi/ohos/speeddial/library/SpeedDialOverlayLayout.java b/library/src/main/java/com/leinardi/ohos/speeddial/library/SpeedDialOverlayLayout.java
new file mode 100644
index 0000000000000000000000000000000000000000..2af7aa789de35a650b81b3bccc1093ef55e24f7a
--- /dev/null
+++ b/library/src/main/java/com/leinardi/ohos/speeddial/library/SpeedDialOverlayLayout.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2019 Roberto Leinardi.
+ * 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.
+ */
+
+package com.leinardi.ohos.speeddial.library;
+
+import ohos.agp.components.DependentLayout;
+import ohos.app.Context;
+
+@SuppressWarnings({"unused", "WeakerAccess"})
+public class SpeedDialOverlayLayout extends DependentLayout {
+ public SpeedDialOverlayLayout(Context context) {
+ super(context);
+ }
+}
diff --git a/detekt.gradle b/library/src/main/java/com/leinardi/ohos/speeddial/library/SpeedDialView.java
similarity index 53%
rename from detekt.gradle
rename to library/src/main/java/com/leinardi/ohos/speeddial/library/SpeedDialView.java
index ec0d7d695516a29565edab5e08deca8fdcc6288d..81d4e62a9abc2686f4e5d2584bf69c1014707ccd 100644
--- a/detekt.gradle
+++ b/library/src/main/java/com/leinardi/ohos/speeddial/library/SpeedDialView.java
@@ -1,11 +1,11 @@
/*
- * Copyright 2021 Roberto Leinardi.
+ * Copyright 2019 Roberto Leinardi.
*
* 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
+ * 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,
@@ -14,18 +14,14 @@
* limitations under the License.
*/
-apply plugin: 'io.gitlab.arturbosch.detekt'
+package com.leinardi.ohos.speeddial.library;
-detekt {
- toolVersion = rootProject.ext.versions.detekt
- input = files(rootDir)
- config = rootProject.files('config/detekt/config.yml')
-}
-
-dependencies {
- detektPlugins "io.gitlab.arturbosch.detekt:detekt-formatting:${versions.detekt}"
-}
+import ohos.agp.components.DirectionalLayout;
+import ohos.app.Context;
-tasks.getByName('detekt') {
- exclude("**/build/generated/**")
+@SuppressWarnings({"unused", "WeakerAccess", "UnusedReturnValue"})
+public class SpeedDialView extends DirectionalLayout {
+ public SpeedDialView(Context context) {
+ super(context);
+ }
}
diff --git a/versions-plugin.gradle b/library/src/main/java/com/leinardi/ohos/speeddial/library/ViewGroupUtils.java
similarity index 48%
rename from versions-plugin.gradle
rename to library/src/main/java/com/leinardi/ohos/speeddial/library/ViewGroupUtils.java
index 380ef249bfc3d13ca7308c431956fad68cbd2eeb..7ae1d15c15f9ca4a39decc69e80319414b5acdf5 100644
--- a/versions-plugin.gradle
+++ b/library/src/main/java/com/leinardi/ohos/speeddial/library/ViewGroupUtils.java
@@ -1,11 +1,11 @@
/*
- * Copyright 2021 Roberto Leinardi.
+ * Copyright 2019 Roberto Leinardi.
*
* 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
+ * 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,
@@ -14,17 +14,7 @@
* limitations under the License.
*/
-apply plugin: 'com.github.ben-manes.versions'
+package com.leinardi.ohos.speeddial.library;
-dependencyUpdates.resolutionStrategy = {
- componentSelection { rules ->
- rules.all { ComponentSelection selection ->
- boolean rejected = ['alpha', 'beta', 'rc', 'cr', 'm'].any { qualifier ->
- selection.candidate.version ==~ /(?i).*[.-]${qualifier}[.\d-]*/
- }
- if (rejected) {
- selection.reject('Release candidate')
- }
- }
- }
+class ViewGroupUtils {
}
diff --git a/library/src/main/res/anim/sd_fade_and_translate_in.xml b/library/src/main/res/anim/sd_fade_and_translate_in.xml
deleted file mode 100755
index 951c9519daa80c0a59863e24f4f7ef92083b302a..0000000000000000000000000000000000000000
--- a/library/src/main/res/anim/sd_fade_and_translate_in.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/library/src/main/res/anim/sd_fade_and_translate_out.xml b/library/src/main/res/anim/sd_fade_and_translate_out.xml
deleted file mode 100755
index 3f1d2ac65c3cc9f8cb5e89b00ae9c74e068e57dd..0000000000000000000000000000000000000000
--- a/library/src/main/res/anim/sd_fade_and_translate_out.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/library/src/main/res/anim/sd_scale_fade_and_translate_in.xml b/library/src/main/res/anim/sd_scale_fade_and_translate_in.xml
deleted file mode 100755
index c9c29b16b081b087a40731ce5c8ac3c59ee2973a..0000000000000000000000000000000000000000
--- a/library/src/main/res/anim/sd_scale_fade_and_translate_in.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/library/src/main/res/anim/sd_scale_fade_and_translate_out.xml b/library/src/main/res/anim/sd_scale_fade_and_translate_out.xml
deleted file mode 100755
index da4cb3c30ccb0f2028332946489cb513f4170b8d..0000000000000000000000000000000000000000
--- a/library/src/main/res/anim/sd_scale_fade_and_translate_out.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/library/src/main/res/layout/sd_fab_with_label_view.xml b/library/src/main/res/layout/sd_fab_with_label_view.xml
deleted file mode 100755
index f550b873e87f1d6061f9617413f261d3cdce6631..0000000000000000000000000000000000000000
--- a/library/src/main/res/layout/sd_fab_with_label_view.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/library/src/main/res/layout/sd_fill_fab.xml b/library/src/main/res/layout/sd_fill_fab.xml
deleted file mode 100644
index 890c250ef7f8072e065117e8167b57d6a579d112..0000000000000000000000000000000000000000
--- a/library/src/main/res/layout/sd_fill_fab.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/library/src/main/res/values-night/colors.xml b/library/src/main/res/values-night/colors.xml
deleted file mode 100644
index 044331f74e72d1ed5bbb1430f79912c4a6c41820..0000000000000000000000000000000000000000
--- a/library/src/main/res/values-night/colors.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
- #bdbdbd
- @color/cardview_dark_background
- #aa000000
-
diff --git a/library/src/main/res/values-v21/styles.xml b/library/src/main/res/values-v21/styles.xml
deleted file mode 100644
index 7c94a678f458c72f3fb52950df804fd1b1011030..0000000000000000000000000000000000000000
--- a/library/src/main/res/values-v21/styles.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
-
diff --git a/library/src/main/res/values/attrs.xml b/library/src/main/res/values/attrs.xml
deleted file mode 100755
index 83b6ecef15873bbd9c1a3ce8f72aae7adbdbc477..0000000000000000000000000000000000000000
--- a/library/src/main/res/values/attrs.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/library/src/main/res/values/colors.xml b/library/src/main/res/values/colors.xml
deleted file mode 100644
index 5b3463273d7fb055d9462cfddfdc360620f4a33c..0000000000000000000000000000000000000000
--- a/library/src/main/res/values/colors.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
- #757575
- @color/cardview_light_background
- #aaffffff
-
diff --git a/library/src/main/res/values/configs.xml b/library/src/main/res/values/configs.xml
deleted file mode 100644
index 8b903131763354c00529bac87423b615611900b6..0000000000000000000000000000000000000000
--- a/library/src/main/res/values/configs.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
- 200
- 150
- 200
-
diff --git a/library/src/main/res/values/dimens.xml b/library/src/main/res/values/dimens.xml
deleted file mode 100644
index b4e62f28e084a87017f0a3c49ca0b8cbd826cd09..0000000000000000000000000000000000000000
--- a/library/src/main/res/values/dimens.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
- 5dp
- 54dp
- 72dp
- 12dp|
- 160dp
- 8dp
- @dimen/sd_close_elevation
-
diff --git a/library/src/main/res/values/ids.xml b/library/src/main/res/values/ids.xml
deleted file mode 100644
index d5c883fcec795e44b6afa8c5df940962c53d42fe..0000000000000000000000000000000000000000
--- a/library/src/main/res/values/ids.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
diff --git a/library/src/main/res/values/strings.xml b/library/src/main/res/values/strings.xml
deleted file mode 100644
index ca46be40ef344efdf1e2eec86ad516e7f2a94265..0000000000000000000000000000000000000000
--- a/library/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
- com.leinardi.android.speeddial.SpeedDialView$SnackbarBehavior
-
-
- com.leinardi.android.speeddial.SpeedDialView$ScrollingViewSnackbarBehavior
-
-
diff --git a/library/src/main/res/values/styles.xml b/library/src/main/res/values/styles.xml
deleted file mode 100644
index 482864323f2f5b33283ae03edb3119fed68bf238..0000000000000000000000000000000000000000
--- a/library/src/main/res/values/styles.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/library/src/main/resources/base/element/string.json b/library/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..1e2b219ccdd1183e23968586e5e2e404b41c38c9
--- /dev/null
+++ b/library/src/main/resources/base/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "library"
+ }
+ ]
+}
diff --git a/library/src/main/resources/base/layout/text.xml b/library/src/main/resources/base/layout/text.xml
new file mode 100644
index 0000000000000000000000000000000000000000..e2636b8aa701b341372b2e1b9336ae8789a5afc1
--- /dev/null
+++ b/library/src/main/resources/base/layout/text.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
diff --git a/library/src/test/java/com/leinardi/android/speeddial/library/ExampleTest.java b/library/src/test/java/com/leinardi/android/speeddial/library/ExampleTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..c33e917983af7451a991bf8d22356a8191e87a8c
--- /dev/null
+++ b/library/src/test/java/com/leinardi/android/speeddial/library/ExampleTest.java
@@ -0,0 +1,9 @@
+package com.leinardi.android.speeddial.library;
+
+import org.junit.Test;
+
+public class ExampleTest {
+ @Test
+ public void onStart() {
+ }
+}
diff --git a/publish-root.gradle b/publish-root.gradle
deleted file mode 100644
index 5ca9053aa45e486aa61f050929b48c2a13a7ec04..0000000000000000000000000000000000000000
--- a/publish-root.gradle
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright 2021 Roberto Leinardi.
- *
- * 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.
- */
-
-apply plugin: 'io.github.gradle-nexus.publish-plugin'
-
-// Create variables with empty default values
-if (!project.hasProperty("ossrhUsername")){
- ext["ossrhUsername"] = ''
-}
-if (!project.hasProperty("ossrhPassword")){
- ext["ossrhPassword"] = ''
-}
-if (!project.hasProperty("sonatypeStagingProfileId")){
- ext["sonatypeStagingProfileId"] = ''
-}
-if (!project.hasProperty("signing.keyId")){
- ext["signing.keyId"] = ''
-}
-if (!project.hasProperty("signing.password")){
- ext["signing.password"] = ''
-}
-if (!project.hasProperty("signing.secretKeyRingFile")){
- ext["signing.secretKeyRingFile"] = ''
-}
-
-File secretPropsFile = project.rootProject.file('local.properties')
-if (secretPropsFile.exists()) {
- // Read local.properties file first if it exists
- Properties p = new Properties()
- new FileInputStream(secretPropsFile).withCloseable { is -> p.load(is) }
- p.each { name, value -> ext[name] = value }
-} else {
- // Use system environment variables
- ext["ossrhUsername"] = System.getenv('OSSRH_USERNAME')
- ext["ossrhPassword"] = System.getenv('OSSRH_PASSWORD')
- ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID')
- ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID')
- ext["signing.password"] = System.getenv('SIGNING_PASSWORD')
- ext["signing.secretKeyRingFile"] = System.getenv('SIGNING_SECRET_KEY_RING_FILE')
-}
-
-// Set up Sonatype repository
-nexusPublishing {
- repositories {
- sonatype {
- stagingProfileId = sonatypeStagingProfileId
- username = ossrhUsername
- password = ossrhPassword
- nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
- snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
- }
- }
-}
diff --git a/sample/.gitignore b/sample/.gitignore
deleted file mode 100755
index 796b96d1c402326528b4ba3c12ee9d92d0e212e9..0000000000000000000000000000000000000000
--- a/sample/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build
diff --git a/sample/build.gradle b/sample/build.gradle
deleted file mode 100755
index c8d25e85ba7e5b32eecaa58eebe09838410d6032..0000000000000000000000000000000000000000
--- a/sample/build.gradle
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright 2021 Roberto Leinardi.
- *
- * 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.
- */
-
-apply plugin: 'com.android.application'
-apply plugin: 'kotlin-android'
-apply plugin: 'kotlin-android-extensions'
-apply from: rootProject.file('checkstyle.gradle')
-
-android {
- compileSdkVersion build_versions.target_sdk
-
- defaultConfig {
- applicationId "com.leinardi.android.speeddial.sample"
- minSdkVersion build_versions.min_sdk
- targetSdkVersion build_versions.target_sdk
- versionCode build_versions.version_code
- versionName build_versions.version_name
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
- vectorDrawables.useSupportLibrary = true
- }
-
- compileOptions {
- sourceCompatibility build_versions.java_version
- targetCompatibility build_versions.java_version
- }
-
- def isKeystoreInfoAvailable = file(KEYSTORE_PATH).exists() && file(KEYSTORE_PROPERTIES_PATH).exists()
-
- signingConfigs {
- if (isKeystoreInfoAvailable) {
- release {
- Properties props = new Properties()
- props.load(new FileInputStream(file(KEYSTORE_PROPERTIES_PATH)))
- storeFile file(KEYSTORE_PATH)
- storePassword props['store.password']
- keyAlias props['key.alias']
- keyPassword props['key.password']
- }
- }
- }
-
- buildTypes {
- if (isKeystoreInfoAvailable) {
- release {
- minifyEnabled true
- shrinkResources true
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- signingConfig signingConfigs.release
- }
- }
- debug {
- applicationIdSuffix '.debug'
- versionNameSuffix '-DEBUG'
- }
- }
-}
-
-dependencies {
- implementation project(':library')
-// implementation "com.leinardi.android:speed-dial:${build_versions.version_name}"
- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$versions.kotlin"
- implementation "androidx.appcompat:appcompat:$versions.androidx_appcompat"
- implementation "androidx.recyclerview:recyclerview:$versions.androidx_recyclerview"
- implementation "androidx.constraintlayout:constraintlayout:$versions.androidx_constraintlayout"
- implementation "com.google.android.material:material:$versions.android_material"
-}
diff --git a/sample/proguard-rules.pro b/sample/proguard-rules.pro
deleted file mode 100755
index d40e473e10192ecf8fcc67c00569b7a7ef521cd7..0000000000000000000000000000000000000000
--- a/sample/proguard-rules.pro
+++ /dev/null
@@ -1,17 +0,0 @@
-# Add project specific ProGuard rules here.
-# By default, the flags in this file are appended to flags specified
-# in C:\Users\Admin\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt
-# You can edit the include path and order by changing the proguardFiles
-# directive in build.gradle.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# Add any project specific keep options here:
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml
deleted file mode 100755
index 83ec21306a1b85f54b6f9b351a264299141d57eb..0000000000000000000000000000000000000000
--- a/sample/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/sample/src/main/java/com/leinardi/android/speeddial/sample/CustomAdapter.kt b/sample/src/main/java/com/leinardi/android/speeddial/sample/CustomAdapter.kt
deleted file mode 100644
index d3dfc1662d7a1bd53c6200fae04add5f2ff52c83..0000000000000000000000000000000000000000
--- a/sample/src/main/java/com/leinardi/android/speeddial/sample/CustomAdapter.kt
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright 2021 Roberto Leinardi.
- *
- * 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.
- */
-
-package com.leinardi.android.speeddial.sample
-
-import android.util.Log
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import android.widget.TextView
-
-import androidx.recyclerview.widget.RecyclerView
-
-/**
- * Provide views to RecyclerView with data from dataSet.
- */
-class CustomAdapter(private val dataSet: Array) : RecyclerView.Adapter() {
-
- override fun onCreateViewHolder(viewGroup: ViewGroup, viewType: Int): ViewHolder {
- return ViewHolder(LayoutInflater.from(viewGroup.context)
- .inflate(R.layout.text_row_item, viewGroup, false))
- }
-
- override fun onBindViewHolder(viewHolder: ViewHolder, position: Int) {
- viewHolder.textView.text = dataSet[position]
- }
-
- override fun getItemCount() = dataSet.size
-
- /**
- * Provide a reference to the type of views that you are using (custom ViewHolder)
- */
- class ViewHolder(v: View) : RecyclerView.ViewHolder(v) {
- val textView: TextView
-
- init {
- // Define click listener for the ViewHolder's View.
- v.setOnClickListener { Log.d(TAG, "Element $adapterPosition clicked.") }
- textView = v.findViewById(R.id.textView)
- }
- }
-
- companion object {
- private const val TAG = "CustomAdapter"
- }
-}
diff --git a/sample/src/main/java/com/leinardi/android/speeddial/sample/MainActivity.kt b/sample/src/main/java/com/leinardi/android/speeddial/sample/MainActivity.kt
deleted file mode 100755
index 33042f2231e26ddcbaf5d358ed8f371d8ed8897f..0000000000000000000000000000000000000000
--- a/sample/src/main/java/com/leinardi/android/speeddial/sample/MainActivity.kt
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright 2021 Roberto Leinardi.
- *
- * 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.
- */
-
-package com.leinardi.android.speeddial.sample
-
-import android.content.Intent
-import android.graphics.Color
-import android.os.Bundle
-import android.util.Log
-import android.view.Menu
-import android.view.MenuItem
-import androidx.appcompat.content.res.AppCompatResources
-import androidx.core.content.res.ResourcesCompat
-import com.google.android.material.floatingactionbutton.FloatingActionButton
-import com.leinardi.android.speeddial.SpeedDialActionItem
-import com.leinardi.android.speeddial.SpeedDialView
-import com.leinardi.android.speeddial.sample.usecases.BaseUseCaseActivity
-import com.leinardi.android.speeddial.sample.usecases.UseCasesActivity
-
-/**
- * Sample project
- */
-@Suppress("LongMethod", "ComplexMethod", "MagicNumber") // sample project with long methods
-class MainActivity : BaseUseCaseActivity() {
- override val layoutRes = R.layout.activity_main
-
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- initSpeedDial(savedInstanceState == null)
- }
-
- private fun initSpeedDial(addActionItems: Boolean) {
- if (addActionItems) {
- speedDialView.addActionItem(SpeedDialActionItem.Builder(R.id.fab_no_label, R.drawable
- .ic_link_white_24dp)
- .create())
-
- var drawable = AppCompatResources.getDrawable(this@MainActivity, R.drawable.ic_custom_color)
- val fabWithLabelView = speedDialView.addActionItem(SpeedDialActionItem.Builder(R.id
- .fab_custom_color, drawable)
- .setFabImageTintColor(ResourcesCompat.getColor(resources, R.color.inbox_primary, theme))
- .setLabel(R.string.label_custom_color)
- .setLabelColor(Color.WHITE)
- .setLabelBackgroundColor(ResourcesCompat.getColor(resources, R.color.inbox_primary,
- theme))
- .create())
- fabWithLabelView?.apply {
- speedDialActionItem = speedDialActionItemBuilder
- .setFabBackgroundColor(ResourcesCompat.getColor(resources, R.color.material_white_1000, theme))
- .create()
- }
-
- speedDialView.addActionItem(SpeedDialActionItem.Builder(R.id.fab_long_label, R.drawable
- .ic_lorem_ipsum)
- .setFabSize(FloatingActionButton.SIZE_NORMAL)
- .setLabel("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor " +
- "incididunt ut labore et dolore magna aliqua.")
- .create())
-
- drawable = AppCompatResources.getDrawable(this@MainActivity, R.drawable.ic_add_white_24dp)
- speedDialView.addActionItem(SpeedDialActionItem.Builder(R.id.fab_add_action, drawable)
- .setFabBackgroundColor(ResourcesCompat.getColor(resources, R.color.material_green_500, theme))
- .setLabel(R.string.label_add_action)
- .setLabelBackgroundColor(Color.TRANSPARENT)
- .create())
-
- speedDialView.addActionItem(SpeedDialActionItem.Builder(R.id.fab_custom_theme, R.drawable
- .ic_theme_white_24dp)
- .setLabel(getString(R.string.label_custom_theme))
- .setTheme(R.style.Theme_MyApp_Purple)
- .create())
- }
-
- // Set main action clicklistener.
- speedDialView.setOnChangeListener(object : SpeedDialView.OnChangeListener {
- override fun onMainActionSelected(): Boolean {
- showToast("Main action clicked!")
- return false // True to keep the Speed Dial open
- }
-
- override fun onToggleChanged(isOpen: Boolean) {
- Log.d(TAG, "Speed dial toggle state changed. Open = $isOpen")
- }
- })
-
- // Set option fabs clicklisteners.
- speedDialView.setOnActionSelectedListener(SpeedDialView.OnActionSelectedListener { actionItem ->
- when (actionItem.id) {
- R.id.fab_no_label -> {
- showToast("No label action clicked!\nClosing with animation")
- speedDialView.close() // To close the Speed Dial with animation
- return@OnActionSelectedListener true // false will close it without animation
- }
- R.id.fab_long_label -> showSnackbar(actionItem.getLabel(this@MainActivity) + " clicked!")
- R.id.fab_custom_color -> {
- showToast(actionItem.getLabel(this@MainActivity) + " clicked!\nClosing without animation.")
- // closes without animation (same as speedDialView.close(false); return false;)
- return@OnActionSelectedListener false
- }
- R.id.fab_custom_theme -> showToast(actionItem.getLabel(this@MainActivity) + " clicked!")
- R.id.fab_add_action -> speedDialView.addActionItem(SpeedDialActionItem.Builder(R.id.fab_replace_action,
- R.drawable.ic_replace_white_24dp)
- .setFabBackgroundColor(ResourcesCompat.getColor(resources, R.color
- .material_orange_500,
- theme))
- .setLabel(getString(R.string.label_replace_action))
- .create(), ADD_ACTION_POSITION)
- R.id.fab_replace_action -> speedDialView.replaceActionItem(SpeedDialActionItem.Builder(R.id
- .fab_remove_action,
- R.drawable.ic_delete_white_24dp)
- .setLabel(getString(R.string.label_remove_action))
- .setFabBackgroundColor(ResourcesCompat.getColor(resources, R.color.inbox_accent,
- theme))
- .create(), ADD_ACTION_POSITION)
- R.id.fab_remove_action -> speedDialView.removeActionItemById(R.id.fab_remove_action)
- }
- true // To keep the Speed Dial open
- })
- }
-
- override fun onCreateOptionsMenu(menu: Menu): Boolean {
- menuInflater.inflate(R.menu.menu_main, menu)
- return true
- }
-
- override fun onBackPressed() {
- // Closes menu if its opened.
- if (speedDialView.isOpen) {
- speedDialView.close()
- } else {
- super.onBackPressed()
- }
- }
-
- override fun onOptionsItemSelected(item: MenuItem): Boolean {
- if (item.itemId == R.id.action_use_cases) {
- startActivity(Intent(this@MainActivity, UseCasesActivity::class.java))
- return true
- }
- return super.onOptionsItemSelected(item)
- }
-
- companion object {
- private val TAG = MainActivity::class.java.simpleName
- private const val ADD_ACTION_POSITION = 4
- }
-}
diff --git a/sample/src/main/java/com/leinardi/android/speeddial/sample/usecases/BaseUseCaseActivity.kt b/sample/src/main/java/com/leinardi/android/speeddial/sample/usecases/BaseUseCaseActivity.kt
deleted file mode 100644
index 08b8c9a68eb0b8739394723995f500d3ce1c5a67..0000000000000000000000000000000000000000
--- a/sample/src/main/java/com/leinardi/android/speeddial/sample/usecases/BaseUseCaseActivity.kt
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Copyright 2021 Roberto Leinardi.
- *
- * 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.
- */
-
-package com.leinardi.android.speeddial.sample.usecases
-
-import android.content.res.Configuration
-import android.os.Bundle
-import android.os.SystemClock
-import android.view.View
-import android.widget.Toast
-import androidx.annotation.LayoutRes
-import androidx.appcompat.app.AppCompatActivity
-import androidx.appcompat.app.AppCompatDelegate
-import androidx.appcompat.widget.ActionMenuView
-import androidx.appcompat.widget.Toolbar
-import androidx.coordinatorlayout.widget.CoordinatorLayout
-import androidx.core.content.res.ResourcesCompat
-import androidx.recyclerview.widget.LinearLayoutManager
-import androidx.recyclerview.widget.RecyclerView
-import com.google.android.material.snackbar.Snackbar
-import com.leinardi.android.speeddial.SpeedDialActionItem
-import com.leinardi.android.speeddial.SpeedDialView
-import com.leinardi.android.speeddial.UiUtils
-import com.leinardi.android.speeddial.sample.BuildConfig
-import com.leinardi.android.speeddial.sample.CustomAdapter
-import com.leinardi.android.speeddial.sample.R
-
-abstract class BaseUseCaseActivity : AppCompatActivity() {
- private val coordinatorLayout by lazy { findViewById(R.id.coordinatorLayout) }
- protected val speedDialView: SpeedDialView by lazy { findViewById(R.id.speedDial) }
- private val recyclerView by lazy { findViewById(R.id.recyclerView) }
- private var dataset = emptyArray()
- private var toast: Toast? = null
- private var snackbar: Snackbar? = null
- private var customAdapter: CustomAdapter? = null
-
- @get:LayoutRes
- protected abstract val layoutRes: Int
-
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(layoutRes)
- initToolbar()
- initRecyclerView()
- }
-
- @Suppress("LongMethod", "ComplexMethod", "MagicNumber")
- private fun initToolbar() {
- val toolbar = findViewById(R.id.toolbar)
- toolbar.subtitle = getString(R.string.app_version, BuildConfig.VERSION_NAME)
- setSupportActionBar(toolbar)
-
- val toolbarBottom = findViewById(R.id.toolbar_bottom)
- toolbarBottom.setContentInsetsAbsolute(0, 0)
- val actionMenuView = findViewById(R.id.amvMenu)
- if (actionMenuView != null) {
- actionMenuView.setOnMenuItemClickListener { item ->
- val id = item.itemId
-
- when (id) {
- R.id.action_show -> if (speedDialView.visibility == View.VISIBLE) {
- speedDialView.hide()
- } else {
- speedDialView.show()
- }
- R.id.action_snack -> showSnackbar("Test snackbar")
- R.id.action_add_item ->
- speedDialView.addActionItem(SpeedDialActionItem.Builder(
- SystemClock.uptimeMillis().toInt(),
- R.drawable.ic_pencil_alt_white_24dp).create()
- )
- R.id.action_remove_item -> {
- val size = speedDialView.actionItems.size
- if (size > 0) {
- speedDialView.removeActionItem(size - 1)
- }
- }
- R.id.action_expansion_mode_top ->
- speedDialView.expansionMode = SpeedDialView.ExpansionMode.TOP
- R.id.action_expansion_mode_left ->
- speedDialView.expansionMode = SpeedDialView.ExpansionMode.LEFT
- R.id.action_expansion_mode_bottom ->
- speedDialView.expansionMode = SpeedDialView.ExpansionMode.BOTTOM
- R.id.action_expansion_mode_right ->
- speedDialView.expansionMode = SpeedDialView.ExpansionMode.RIGHT
- R.id.action_rotation_angle_0 -> speedDialView.mainFabAnimationRotateAngle = 0f
- R.id.action_rotation_angle_45 -> speedDialView.mainFabAnimationRotateAngle = 45f
- R.id.action_rotation_angle_90 -> speedDialView.mainFabAnimationRotateAngle = 90f
- R.id.action_rotation_angle_180 -> speedDialView.mainFabAnimationRotateAngle = 180f
- R.id.action_toggle_day_night -> {
- val nightModeFlats = resources.configuration.uiMode and
- Configuration.UI_MODE_NIGHT_MASK
- if (nightModeFlats == Configuration.UI_MODE_NIGHT_NO) {
- AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
- } else {
- AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
- }
- }
- R.id.action_main_fab_background_color_closed_primary ->
- speedDialView.mainFabClosedBackgroundColor = UiUtils.getPrimaryColor(
- this@BaseUseCaseActivity)
- R.id.action_main_fab_background_color_closed_orange ->
- speedDialView.mainFabClosedBackgroundColor = ResourcesCompat.getColor(
- resources,
- R.color.material_orange_500,
- theme)
- R.id.action_main_fab_background_color_closed_purple ->
- speedDialView.mainFabClosedBackgroundColor = ResourcesCompat.getColor(
- resources,
- R.color.material_purple_500,
- theme)
- R.id.action_main_fab_background_color_closed_white ->
- speedDialView.mainFabClosedBackgroundColor = ResourcesCompat.getColor(
- resources,
- R.color.material_white_1000,
- theme)
- R.id.action_main_fab_background_color_closed_none ->
- speedDialView.mainFabClosedBackgroundColor = 0
- R.id.action_main_fab_background_color_opened_primary ->
- speedDialView.mainFabOpenedBackgroundColor = UiUtils.getPrimaryColor(
- this@BaseUseCaseActivity)
- R.id.action_main_fab_background_color_opened_orange ->
- speedDialView.mainFabOpenedBackgroundColor = ResourcesCompat.getColor(
- resources,
- R.color.material_orange_500,
- theme)
- R.id.action_main_fab_background_color_opened_purple ->
- speedDialView.mainFabOpenedBackgroundColor = ResourcesCompat.getColor(
- resources,
- R.color.material_purple_500,
- theme)
- R.id.action_main_fab_background_color_opened_white ->
- speedDialView.mainFabOpenedBackgroundColor = ResourcesCompat.getColor(
- resources,
- R.color.material_white_1000,
- theme)
- R.id.action_main_fab_background_color_opened_none ->
- speedDialView.mainFabOpenedBackgroundColor = 0
- R.id.action_toggle_list -> if (recyclerView.adapter == null) {
- recyclerView.adapter = customAdapter
- } else {
- recyclerView.adapter = null
- }
- R.id.action_toggle_reverse_animation ->
- speedDialView.useReverseAnimationOnClose = !speedDialView.useReverseAnimationOnClose
- }
- true
- }
-
- val inflater = menuInflater
- // use amvMenu here
- inflater.inflate(R.menu.menu_base_use_case, actionMenuView.menu)
- }
- }
-
- private fun initRecyclerView() {
- initDataset()
- customAdapter = CustomAdapter(dataset)
- // Set CustomAdapter as the adapter for RecyclerView.
- recyclerView.adapter = customAdapter
- val layoutManager = LinearLayoutManager(this)
- recyclerView.layoutManager = layoutManager
- }
-
- protected fun showToast(text: String) {
- toast?.cancel()
- toast = Toast.makeText(applicationContext, text, Toast.LENGTH_LONG)
- checkNotNull(toast).show()
- }
-
- protected fun showSnackbar(text: String) {
- snackbar = Snackbar.make(coordinatorLayout, text, Snackbar.LENGTH_SHORT)
- checkNotNull(snackbar).apply {
- setAction("Close") { dismiss() }
- show()
- }
- }
-
- /**
- * Generates Strings for RecyclerView's adapter. This data would usually come
- * from a local content provider or remote server.
- */
- private fun initDataset() {
- dataset = Array(DATASET_COUNT) { "This is element #$it" }
- }
-
- companion object {
- private const val DATASET_COUNT = 60
- }
-}
diff --git a/sample/src/main/java/com/leinardi/android/speeddial/sample/usecases/UseCasesActivity.kt b/sample/src/main/java/com/leinardi/android/speeddial/sample/usecases/UseCasesActivity.kt
deleted file mode 100644
index 41c066b516eb6cd7c47246189265b66ab4055d3d..0000000000000000000000000000000000000000
--- a/sample/src/main/java/com/leinardi/android/speeddial/sample/usecases/UseCasesActivity.kt
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2021 Roberto Leinardi.
- *
- * 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.
- */
-
-package com.leinardi.android.speeddial.sample.usecases
-
-import android.content.Intent
-import android.os.Bundle
-import androidx.appcompat.app.AppCompatActivity
-import androidx.appcompat.widget.Toolbar
-import com.leinardi.android.speeddial.SpeedDialView
-import com.leinardi.android.speeddial.sample.R
-
-class UseCasesActivity : AppCompatActivity() {
-
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_use_cases)
- setSupportActionBar(findViewById(R.id.toolbar))
- val speedDialView = findViewById(R.id.speedDial)
- speedDialView.inflate(R.menu.menu_use_cases)
- speedDialView.open()
- speedDialView.setOnActionSelectedListener {
- startActivity(Intent(this@UseCasesActivity, UseCase1Activity::class.java))
- true
- }
- }
-}
diff --git a/sample/src/main/res/anim/bottom_sheet_slide_in.xml b/sample/src/main/res/anim/bottom_sheet_slide_in.xml
deleted file mode 100644
index 3eda395c81b0bb6676ae00e4ff2f72bb9df62863..0000000000000000000000000000000000000000
--- a/sample/src/main/res/anim/bottom_sheet_slide_in.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/sample/src/main/res/anim/bottom_sheet_slide_out.xml b/sample/src/main/res/anim/bottom_sheet_slide_out.xml
deleted file mode 100644
index 2cd469004ff926bd58f0cbf5145a6139f0cf2222..0000000000000000000000000000000000000000
--- a/sample/src/main/res/anim/bottom_sheet_slide_out.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/sample/src/main/res/drawable-hdpi/ic_custom_color.png b/sample/src/main/res/drawable-hdpi/ic_custom_color.png
deleted file mode 100644
index 58b46e8107b2079730eda4780e9343b133184b84..0000000000000000000000000000000000000000
Binary files a/sample/src/main/res/drawable-hdpi/ic_custom_color.png and /dev/null differ
diff --git a/sample/src/main/res/drawable-hdpi/ic_lorem_ipsum.png b/sample/src/main/res/drawable-hdpi/ic_lorem_ipsum.png
deleted file mode 100644
index 4df9ff1de68a9f6d06d9f7cb14d52640a2c69f2f..0000000000000000000000000000000000000000
Binary files a/sample/src/main/res/drawable-hdpi/ic_lorem_ipsum.png and /dev/null differ
diff --git a/sample/src/main/res/drawable-mdpi/ic_custom_color.png b/sample/src/main/res/drawable-mdpi/ic_custom_color.png
deleted file mode 100644
index 1490966b105ebbcc528aaac9ca82b7d2c7076ac2..0000000000000000000000000000000000000000
Binary files a/sample/src/main/res/drawable-mdpi/ic_custom_color.png and /dev/null differ
diff --git a/sample/src/main/res/drawable-mdpi/ic_lorem_ipsum.png b/sample/src/main/res/drawable-mdpi/ic_lorem_ipsum.png
deleted file mode 100644
index 61c8f0b6a7738e49f519fbbf87ec418f6604f836..0000000000000000000000000000000000000000
Binary files a/sample/src/main/res/drawable-mdpi/ic_lorem_ipsum.png and /dev/null differ
diff --git a/sample/src/main/res/drawable-xhdpi/ic_custom_color.png b/sample/src/main/res/drawable-xhdpi/ic_custom_color.png
deleted file mode 100644
index e667b3febb6400612cd00f67fa40b87a92c89bcc..0000000000000000000000000000000000000000
Binary files a/sample/src/main/res/drawable-xhdpi/ic_custom_color.png and /dev/null differ
diff --git a/sample/src/main/res/drawable-xhdpi/ic_lorem_ipsum.png b/sample/src/main/res/drawable-xhdpi/ic_lorem_ipsum.png
deleted file mode 100644
index 77ec3339057dafb3cf23d320bca11f2433d5085d..0000000000000000000000000000000000000000
Binary files a/sample/src/main/res/drawable-xhdpi/ic_lorem_ipsum.png and /dev/null differ
diff --git a/sample/src/main/res/drawable-xxhdpi/ic_custom_color.png b/sample/src/main/res/drawable-xxhdpi/ic_custom_color.png
deleted file mode 100644
index b2c49f0d792b8c8afd10693252fa6587533ec9c8..0000000000000000000000000000000000000000
Binary files a/sample/src/main/res/drawable-xxhdpi/ic_custom_color.png and /dev/null differ
diff --git a/sample/src/main/res/drawable-xxhdpi/ic_lorem_ipsum.png b/sample/src/main/res/drawable-xxhdpi/ic_lorem_ipsum.png
deleted file mode 100644
index 16e93f181cff79956f9c521079b235c2989de933..0000000000000000000000000000000000000000
Binary files a/sample/src/main/res/drawable-xxhdpi/ic_lorem_ipsum.png and /dev/null differ
diff --git a/sample/src/main/res/drawable/ic_day_night_white_24dp.xml b/sample/src/main/res/drawable/ic_day_night_white_24dp.xml
deleted file mode 100644
index bb8df9de6af9bb7f83a5eaa6dd74e19d91a99940..0000000000000000000000000000000000000000
--- a/sample/src/main/res/drawable/ic_day_night_white_24dp.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
diff --git a/sample/src/main/res/drawable/ic_expansion_mode_white_24dp.xml b/sample/src/main/res/drawable/ic_expansion_mode_white_24dp.xml
deleted file mode 100755
index e1b520a1f0fc63b4fbb8e008ece340ef1188fac1..0000000000000000000000000000000000000000
--- a/sample/src/main/res/drawable/ic_expansion_mode_white_24dp.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
diff --git a/sample/src/main/res/drawable/ic_link_white_24dp.xml b/sample/src/main/res/drawable/ic_link_white_24dp.xml
deleted file mode 100755
index e0375a9c7a981cd5ca93b92a081ac2ec48b22df5..0000000000000000000000000000000000000000
--- a/sample/src/main/res/drawable/ic_link_white_24dp.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
diff --git a/sample/src/main/res/drawable/ic_rotation_angle_white_24dp.xml b/sample/src/main/res/drawable/ic_rotation_angle_white_24dp.xml
deleted file mode 100755
index d688376121690f0802b51bd730895ca2707b36e4..0000000000000000000000000000000000000000
--- a/sample/src/main/res/drawable/ic_rotation_angle_white_24dp.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
diff --git a/sample/src/main/res/drawable/ic_show_white_24dp.xml b/sample/src/main/res/drawable/ic_show_white_24dp.xml
deleted file mode 100755
index 016bb585e1b1d04276c2ecc24ac636ce6e763915..0000000000000000000000000000000000000000
--- a/sample/src/main/res/drawable/ic_show_white_24dp.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
diff --git a/sample/src/main/res/drawable/ic_snack_white_24dp.xml b/sample/src/main/res/drawable/ic_snack_white_24dp.xml
deleted file mode 100755
index f29365ea133ef0b41474467dc13cb46e687c6442..0000000000000000000000000000000000000000
--- a/sample/src/main/res/drawable/ic_snack_white_24dp.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
diff --git a/sample/src/main/res/drawable/ic_theme_white_24dp.xml b/sample/src/main/res/drawable/ic_theme_white_24dp.xml
deleted file mode 100644
index bc197fd6e6c3178515716a6210844294f86c87a9..0000000000000000000000000000000000000000
--- a/sample/src/main/res/drawable/ic_theme_white_24dp.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
diff --git a/sample/src/main/res/drawable/ic_use_case_white_24dp.xml b/sample/src/main/res/drawable/ic_use_case_white_24dp.xml
deleted file mode 100644
index b527eee1083949cc3f98b1f10196f46edfc6a638..0000000000000000000000000000000000000000
--- a/sample/src/main/res/drawable/ic_use_case_white_24dp.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
diff --git a/sample/src/main/res/layout/activity_main.xml b/sample/src/main/res/layout/activity_main.xml
deleted file mode 100644
index 1f18fc9205ecb49fef20590b9ebbae3421876b9e..0000000000000000000000000000000000000000
--- a/sample/src/main/res/layout/activity_main.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/sample/src/main/res/layout/activity_use_case_1.xml b/sample/src/main/res/layout/activity_use_case_1.xml
deleted file mode 100644
index e9dae422982acde549c7ea00b26abbc1cf257941..0000000000000000000000000000000000000000
--- a/sample/src/main/res/layout/activity_use_case_1.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/sample/src/main/res/layout/activity_use_cases.xml b/sample/src/main/res/layout/activity_use_cases.xml
deleted file mode 100644
index bab3980c1ae58fcb0f6a25355adf89554b25d455..0000000000000000000000000000000000000000
--- a/sample/src/main/res/layout/activity_use_cases.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/sample/src/main/res/layout/appbarlayout.xml b/sample/src/main/res/layout/appbarlayout.xml
deleted file mode 100644
index c957cb55d838d12ce200731f0aa12ce0976f9397..0000000000000000000000000000000000000000
--- a/sample/src/main/res/layout/appbarlayout.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/sample/src/main/res/layout/text_row_item.xml b/sample/src/main/res/layout/text_row_item.xml
deleted file mode 100644
index 12baa27fb960b96a297f6d50f37a205b1669ae7f..0000000000000000000000000000000000000000
--- a/sample/src/main/res/layout/text_row_item.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
-
-
-
diff --git a/sample/src/main/res/menu/menu_base_use_case.xml b/sample/src/main/res/menu/menu_base_use_case.xml
deleted file mode 100644
index a1d2e7bac25de27878d919b884e03d2026f58e2d..0000000000000000000000000000000000000000
--- a/sample/src/main/res/menu/menu_base_use_case.xml
+++ /dev/null
@@ -1,157 +0,0 @@
-
-
-
-
diff --git a/sample/src/main/res/menu/menu_main.xml b/sample/src/main/res/menu/menu_main.xml
deleted file mode 100755
index 7274dcda4cb3bad0699561d9f30136f1a984e3cf..0000000000000000000000000000000000000000
--- a/sample/src/main/res/menu/menu_main.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
diff --git a/sample/src/main/res/menu/menu_use_cases.xml b/sample/src/main/res/menu/menu_use_cases.xml
deleted file mode 100644
index f0b02d4163b87470c1a9f79b9b6009cd307ba9a3..0000000000000000000000000000000000000000
--- a/sample/src/main/res/menu/menu_use_cases.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
-
-
diff --git a/sample/src/main/res/mipmap-hdpi/ic_launcher.png b/sample/src/main/res/mipmap-hdpi/ic_launcher.png
deleted file mode 100755
index 853fa4c56b1e185549f4e26e41fc01e4f4b56bd1..0000000000000000000000000000000000000000
Binary files a/sample/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ
diff --git a/sample/src/main/res/mipmap-mdpi/ic_launcher.png b/sample/src/main/res/mipmap-mdpi/ic_launcher.png
deleted file mode 100755
index 1f8c35fc8ff235e930d2e281ff24f97b0c6fcd26..0000000000000000000000000000000000000000
Binary files a/sample/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ
diff --git a/sample/src/main/res/mipmap-xhdpi/ic_launcher.png b/sample/src/main/res/mipmap-xhdpi/ic_launcher.png
deleted file mode 100755
index f9c2b6e5fc74b41bcf122d018c1379d06a69a050..0000000000000000000000000000000000000000
Binary files a/sample/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ
diff --git a/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png b/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png
deleted file mode 100755
index 101fded63a9a40b8185cf9af67eb8dc2615a3e51..0000000000000000000000000000000000000000
Binary files a/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ
diff --git a/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png
deleted file mode 100755
index 74e484d2d460a04113629f6ebb7974554f1fcb8b..0000000000000000000000000000000000000000
Binary files a/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ
diff --git a/sample/src/main/res/values-it/strings.xml b/sample/src/main/res/values-it/strings.xml
deleted file mode 100755
index 6388678a411174c1de159c3f7f98e63f4ae9b403..0000000000000000000000000000000000000000
--- a/sample/src/main/res/values-it/strings.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-
- Aggiungi action item
- Rimuovi action item
- Mostra/Nascondi FAB
- Mostra snackbar
- Alterna modalità Day/Night
- Toggle lista
- Toggle reverse animation in chiususa
- Casi d\'uso
- FAB Speed Dial Sample
- v%1$s
- Basso
- Chiudi menu Speed Dial
- Modalità espansione
- 45 gradi
- Aggiungi action
- Colori custom
- Tema custom
- Rimuovi action
- Sostituisci action
- Sinistra
- Colore Main FAB
- Colore Main FAB chiuso
- Colore Main FAB aperto
- 90 gradi
- Nessuno
- 180 gradi
- Arancione
- Primary
- Viola
- Destra
- Angolo rotazione
- Alto
- Setup minimo
- Bianco
- 0 gradi
-
diff --git a/sample/src/main/res/values-night/themes.xml b/sample/src/main/res/values-night/themes.xml
deleted file mode 100644
index 33d269222b1672ce50dfeb393e96d05cec920030..0000000000000000000000000000000000000000
--- a/sample/src/main/res/values-night/themes.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
-
-
-
diff --git a/sample/src/main/res/values-w820dp/dimens.xml b/sample/src/main/res/values-w820dp/dimens.xml
deleted file mode 100755
index 11f0d58f4ec72133fcc2513b77099e5b157ec54a..0000000000000000000000000000000000000000
--- a/sample/src/main/res/values-w820dp/dimens.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
- 64dp
-
diff --git a/sample/src/main/res/values/colors.xml b/sample/src/main/res/values/colors.xml
deleted file mode 100755
index 43c717403174df5c5f952f96182b66fe2e768e5e..0000000000000000000000000000000000000000
--- a/sample/src/main/res/values/colors.xml
+++ /dev/null
@@ -1,161 +0,0 @@
-
-
-
- #4285f4
- #3367d6
- #db4437
-
-
- #FAFAFA
- #F5F5F5
- #EEEEEE
- #E0E0E0
- #BDBDBD
- #9E9E9E
- #757575
- #616161
- #424242
- #212121
- #000000
- #ffffff
-
- #FFEBEE
- #FFCDD2
- #EF9A9A
- #E57373
- #EF5350
- #F44336
- #E53935
- #D32F2F
- #C62828
- #B71C1C
- #FF8A80
- #FF5252
- #FF1744
- #D50000
-
- #FFF3E0
- #FFE0B2
- #FFCC80
- #FFB74D
- #FFA726
- #FF9800
- #FB8C00
- #F57C00
- #EF6C00
- #E65100
- #FFD180
- #FFAB40
- #FF9100
- #FF6D00
-
- #F9FBE7
- #F0F4C3
- #E6EE9C
- #DCE775
- #D4E157
- #CDDC39
- #C0CA33
- #AFB42B
- #9E9D24
- #827717
- #F4FF81
- #EEFF41
- #C6FF00
- #AEEA00
-
- #E8F5E9
- #C8E6C9
- #A5D6A7
- #81C784
- #66BB6A
- #4CAF50
- #43A047
- #388E3C
- #2E7D32
- #1B5E20
- #B9F6CA
- #69F0AE
- #00E676
- #00C853
-
- #E0F2F1
- #B2DFDB
- #80CBC4
- #4DB6AC
- #26A69A
- #009688
- #00897B
- #00796B
- #00695C
- #004D40
- #A7FFEB
- #64FFDA
- #1DE9B6
- #00BFA5
-
- #E3F2FD
- #BBDEFB
- #90CAF9
- #64B5F6
- #42A5F5
- #2196F3
- #1E88E5
- #1976D2
- #1565C0
- #0D47A1
- #82B1FF
- #448AFF
- #2979FF
- #2962FF
-
- #F3E5F5
- #E1BEE7
- #CE93D8
- #BA68C8
- #AB47BC
- #9C27B0
- #8E24AA
- #7B1FA2
- #6A1B9A
- #4A148C
- #EA80FC
- #E040FB
- #D500F9
- #AA00FF
-
-
- @android:color/transparent
- #22FFFFFF
- #33FFFFFF
- #12000000
- #1F000000
- #22D50000
- #44D50000
- #22FF6D00
- #44FF6D00
- #22AEEA00
- #44AEEA00
- #2200C853
- #4400C853
- #2200BFA5
- #4400BFA5
- #222962FF
- #442962FF
- #22AA00FF
- #44AA00FF
-
diff --git a/sample/src/main/res/values/dimens.xml b/sample/src/main/res/values/dimens.xml
deleted file mode 100755
index f399e19b00e062cd8300231cfb2bc27be168c4e9..0000000000000000000000000000000000000000
--- a/sample/src/main/res/values/dimens.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
- 16dp
- 16dp
- 16dp
- 200dp
-
diff --git a/sample/src/main/res/values/ids.xml b/sample/src/main/res/values/ids.xml
deleted file mode 100644
index ff816e82e2c1f1140e1a9a8ea84a25dece11a2b4..0000000000000000000000000000000000000000
--- a/sample/src/main/res/values/ids.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/sample/src/main/res/values/motion.xml b/sample/src/main/res/values/motion.xml
deleted file mode 100644
index 5817b82643c672af65e12e9398424027e667032f..0000000000000000000000000000000000000000
--- a/sample/src/main/res/values/motion.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/sample/src/main/res/values/shape.xml b/sample/src/main/res/values/shape.xml
deleted file mode 100644
index 89c58505d00a1adb0d282c175b8e6f94a1e58abd..0000000000000000000000000000000000000000
--- a/sample/src/main/res/values/shape.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/sample/src/main/res/values/strings.xml b/sample/src/main/res/values/strings.xml
deleted file mode 100755
index 379f695c17a52ce60ef9a63ea4b87b2ce9b811b5..0000000000000000000000000000000000000000
--- a/sample/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-
- Add action item
- Remove action item
- Show/hide FAB
- Show snackbar
- Toggle Day/Night mode
- Toggle list
- Toggle reverse animation on close
- Use cases
- FAB Speed Dial Sample
- v%1$s
- Bottom
- Close Speed Dial menu
- Expansion mode
- 45 degrees
- Add action
- Custom colors
- Custom theme
- Remove action
- Replace action
- Left
- Main FAB color
- Main FAB color close
- Main FAB color open
- 90 degrees
- None
- 180 degrees
- Orange
- Primary
- Purple
- Right
- Rotation angle
- Top
- Minimal setup
- White
- 0 degrees
-
diff --git a/sample/src/main/res/values/styles.xml b/sample/src/main/res/values/styles.xml
deleted file mode 100644
index 38e52bdf599918e362e73fb15e2e4b515f458640..0000000000000000000000000000000000000000
--- a/sample/src/main/res/values/styles.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/sample/src/main/res/values/themes.xml b/sample/src/main/res/values/themes.xml
deleted file mode 100644
index abfbf3ebfee1b3bd4a18208809a7e2e87f289e09..0000000000000000000000000000000000000000
--- a/sample/src/main/res/values/themes.xml
+++ /dev/null
@@ -1,91 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/sample/src/main/res/values/type.xml b/sample/src/main/res/values/type.xml
deleted file mode 100644
index 894affcc5309041c54068fa6c472833281c48de8..0000000000000000000000000000000000000000
--- a/sample/src/main/res/values/type.xml
+++ /dev/null
@@ -1,92 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/settings.gradle b/settings.gradle
old mode 100755
new mode 100644
index 4ef8a896563585bf87f768e0c4740f1c0a6a8f9a..d0c7ee8440156d4a9324ac5357770747425fef57
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,17 +1 @@
-/*
- * Copyright 2021 Roberto Leinardi.
- *
- * 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.
- */
-
-include ':library', ':sample'
+include ':entry', ':library'