diff --git a/.bundle/config b/.bundle/config new file mode 100644 index 00000000..23692288 --- /dev/null +++ b/.bundle/config @@ -0,0 +1,2 @@ +--- +BUNDLE_PATH: "vendor/bundle" diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000..13fadd22 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,3 @@ +# These are supported funding model platforms + +github: [mikepenz] diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 00000000..af449e5b --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,20 @@ +## About this issue + +- Briefly describe the issue +- How can the issue be reproduced / sample code + +## Details +- [ ] Used library version +- [ ] Used support library version +- [ ] Used gradle build tools version +- [ ] Used tooling / Android Studio version +- [ ] Other used libraries, potential conflicting libraries + +## Checklist + +- [ ] Searched for [similar issues](https://github.com/mikepenz/Android-Iconics/issues) +- [ ] Checked out the [sample application](https://github.com/mikepenz/Android-Iconics/tree/develop/app) +- [ ] Read the [README](https://github.com/mikepenz/Android-Iconics/blob/develop/README.md) +- [ ] Checked out the [CHANGELOG](https://github.com/mikepenz/Android-Iconics/releases) +- [ ] Read the [FAQ](https://github.com/mikepenz/Android-Iconics/blob/develop/FAQ.md) +- [ ] Checked out the [MIGRATION GUIDE](https://github.com/mikepenz/Android-Iconics/blob/develop/MIGRATION.md) diff --git a/.github/ci-gradle.properties b/.github/ci-gradle.properties new file mode 100644 index 00000000..e716081b --- /dev/null +++ b/.github/ci-gradle.properties @@ -0,0 +1,3 @@ +org.gradle.daemon=true +org.gradle.parallel=true +org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=2048m diff --git a/.github/config/configuration.json b/.github/config/configuration.json new file mode 100644 index 00000000..f2d88f19 --- /dev/null +++ b/.github/config/configuration.json @@ -0,0 +1,28 @@ +{ + "categories": [ + { + "title": "## 🚀 Features", + "labels": [ + "feature" + ] + }, + { + "title": "## 🐛 Fixes", + "labels": [ + "fix" + ] + }, + { + "title": "## 🧪 Tests", + "labels": [ + "test" + ] + }, + { + "title": "## 💬 Other", + "labels": [ + "other" + ] + } + ] +} \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..9df537b9 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,120 @@ +# Thanks to https://github.com/coil-kt/coil/blob/master/.github/workflows/ci.yml +name: CI + +on: + push: + tags: + - '*' + pull_request: + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 100 + + - uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: | + 17 + + - name: Copy CI gradle.properties + run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: Validate gradle wrapper + uses: gradle/actions/wrapper-validation@v5 + + - name: Build Debug + run: ./gradlew clean app:assembleDebug + + - name: Run Lint + if: github.event_name == 'pull_request' + run: ./gradlew lintDebug + + - name: Detekt + if: github.event_name == 'pull_request' + run: ./gradlew detekt + + - name: Setup Ruby + if: github.event_name == 'pull_request' + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.0' + bundler-cache: true + + - name: Run Danger + if: github.event_name == 'pull_request' + run: | + gem install danger + bundle exec danger --dangerfile=Dangerfile --danger_id=danger-pr + env: + DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Prepare Keystore and Local. + if: startsWith(github.ref, 'refs/tags/') + run: | + echo "${{ secrets.KEYSTORE }}" > opensource.jks.asc + gpg -d --passphrase "${{ secrets.KEYSTORE_PASSPHRASE }}" --batch "opensource.jks.asc" > "app/opensource.jks" + echo "${{ secrets.SIGNING_GRADLE }}" > signing.gradle.asc + gpg -d --passphrase "${{ secrets.KEYSTORE_PASSPHRASE }}" --batch "signing.gradle.asc" > "app/signing.gradle" + echo "openSource.signing.file=signing.gradle" >> local.properties + + - name: Build Release App + if: startsWith(github.ref, 'refs/tags/') + run: ./gradlew app:assembleRelease app:bundleRelease + + - name: Relase Sonatype + if: startsWith(github.ref, 'refs/tags/') + run: | + ./gradlew build -x test -x lint + ./gradlew :iconics-core:publishToMavenCentral -x test -x lint --no-configure-on-demand --no-parallel + ./gradlew :iconics-typeface-api:publishToMavenCentral -x test -x lint --no-configure-on-demand --no-parallel + ./gradlew :iconics-views:publishToMavenCentral -x test -x lint --no-configure-on-demand --no-parallel + ./gradlew :iconics-compose:publishToMavenCentral -x test -x lint --no-configure-on-demand --no-parallel + env: + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.NEXUS_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.NEXUS_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_PRIVATE_KEY }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} + + - name: Collect artifacts + run: | + COLLECT_PWD=${PWD} + mkdir -p "artifacts" + find . -name "*.apk" -type f -exec cp {} "artifacts" \; + find . -name "*.aab" -type f -exec cp {} "artifacts" \; + + - name: Archive Artifacts + uses: actions/upload-artifact@v4 + with: + name: "App-Artifacts" + path: artifacts/* + + - name: Build Changelog + id: github_release + uses: mikepenz/release-changelog-builder-action@v4 + if: startsWith(github.ref, 'refs/tags/') + with: + configuration: ".github/config/configuration.json" + ignorePreReleases: ${{ !contains(github.ref, '-') }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Release + uses: softprops/action-gh-release@69320dbe05506a9a39fc8ae11030b214ec2d1f87 + if: startsWith(github.ref, 'refs/tags/') + with: + body: ${{steps.github_release.outputs.changelog}} + prerelease: ${{ contains(github.event.inputs.version, '-rc') || contains(github.event.inputs.version, '-b') || contains(github.event.inputs.version, '-a') }} + files: artifacts/* + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 24354fc3..9810628b 100644 --- a/.gitignore +++ b/.gitignore @@ -11,8 +11,8 @@ # Generated files bin/ gen/ -.idea/* *.iml +.idea/* # Gradle files .gradle/ @@ -20,9 +20,14 @@ build/ # Local configuration file (sdk path, etc) local.properties +/captures # Proguard folder generated by Eclipse proguard/ # Log Files *.log +functiongraphic.psd + +vendor/* +.kotlin \ No newline at end of file diff --git a/DEV/default-detekt-config.yml b/DEV/default-detekt-config.yml new file mode 100644 index 00000000..9c1dcf56 --- /dev/null +++ b/DEV/default-detekt-config.yml @@ -0,0 +1,530 @@ +build: + maxIssues: 0 + weights: + # complexity: 2 + # LongParameterList: 1 + # style: 1 + # comments: 1 + +processors: + active: true + exclude: + # - 'FunctionCountProcessor' + # - 'PropertyCountProcessor' + # - 'ClassCountProcessor' + # - 'PackageCountProcessor' + # - 'KtFileCountProcessor' + +console-reports: + active: true + exclude: + # - 'ProjectStatisticsReport' + # - 'ComplexityReport' + # - 'NotificationReport' + # - 'FindingsReport' + # - 'BuildFailureReport' + +comments: + active: true + excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" + 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: 4 + ComplexInterface: + active: false + threshold: 10 + includeStaticDeclarations: false + ComplexMethod: + active: false + threshold: 10 + ignoreSingleWhenExpression: false + ignoreSimpleWhenEntries: false + LabeledExpression: + active: false + ignoredLabels: "" + LargeClass: + active: true + threshold: 600 + LongMethod: + active: false + threshold: 60 + LongParameterList: + active: true + threshold: 25 + ignoreDefaultParameters: false + MethodOverloading: + active: false + threshold: 6 + NestedBlockDepth: + active: false + threshold: 4 + StringLiteralDuplication: + active: false + excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" + threshold: 3 + ignoreAnnotation: true + excludeStringsWithLessThan5Characters: true + ignoreStringsRegex: '$^' + TooManyFunctions: + active: false + excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" + 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: false + 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: false + methodNames: 'toString,hashCode,equals,finalize' + InstanceOfCheckForException: + active: false + excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" + NotImplementedDeclaration: + active: false + PrintStackTrace: + active: false + RethrowCaughtException: + active: false + ReturnFromFinally: + active: false + SwallowedException: + active: false + ignoredExceptionTypes: 'InterruptedException,NumberFormatException,ParseException,MalformedURLException' + ThrowingExceptionFromFinally: + active: false + ThrowingExceptionInMain: + active: false + ThrowingExceptionsWithoutMessageOrCause: + active: false + exceptions: 'IllegalArgumentException,IllegalStateException,IOException' + ThrowingNewInstanceOfSameException: + active: false + TooGenericExceptionCaught: + active: false + excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" + exceptionNames: + - ArrayIndexOutOfBoundsException + - Error + - Exception + - IllegalMonitorStateException + - NullPointerException + - IndexOutOfBoundsException + - RuntimeException + - Throwable + allowedExceptionNameRegex: "^(_|(ignore|expected).*)" + TooGenericExceptionThrown: + active: false + exceptionNames: + - Error + - Exception + - Throwable + - RuntimeException + +formatting: + active: true + android: true + autoCorrect: true + ChainWrapping: + active: false + autoCorrect: true + CommentSpacing: + active: false + autoCorrect: true + Filename: + active: true + FinalNewline: + active: false + autoCorrect: true + ImportOrdering: + active: false + Indentation: + active: false + autoCorrect: true + indentSize: 4 + continuationIndentSize: 8 + MaximumLineLength: + active: false + maxLineLength: 120 + ModifierOrdering: + active: true + autoCorrect: true + NoBlankLineBeforeRbrace: + active: true + autoCorrect: true + NoConsecutiveBlankLines: + active: false + autoCorrect: true + NoEmptyClassBody: + active: true + autoCorrect: true + NoItParamInMultilineLambda: + active: false + NoLineBreakAfterElse: + active: true + autoCorrect: true + NoLineBreakBeforeAssignment: + active: true + autoCorrect: true + NoMultipleSpaces: + active: false + autoCorrect: true + NoSemicolons: + active: true + autoCorrect: true + NoTrailingSpaces: + active: false + autoCorrect: true + NoUnitReturn: + active: true + autoCorrect: true + NoUnusedImports: + active: true + autoCorrect: true + NoWildcardImports: + active: false + autoCorrect: true + PackageName: + active: true + autoCorrect: true + ParameterListWrapping: + active: false + autoCorrect: true + indentSize: 4 + SpacingAroundColon: + active: true + autoCorrect: true + SpacingAroundComma: + active: true + autoCorrect: true + SpacingAroundCurly: + active: true + autoCorrect: true + SpacingAroundKeyword: + active: true + autoCorrect: true + SpacingAroundOperators: + active: true + autoCorrect: true + SpacingAroundParens: + active: true + autoCorrect: true + SpacingAroundRangeOperator: + active: true + autoCorrect: true + StringTemplate: + active: true + autoCorrect: true + +naming: + active: true + ClassNaming: + active: true + excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" + classPattern: '[A-Z$][a-zA-Z0-9$]*' + ConstructorParameterNaming: + active: true + excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" + parameterPattern: '[a-z][A-Za-z0-9]*' + privateParameterPattern: '[a-z][A-Za-z0-9]*' + excludeClassPattern: '$^' + EnumNaming: + active: false + excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" + enumEntryPattern: '^[A-Z][_a-zA-Z0-9]*' + ForbiddenClassName: + active: false + excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" + forbiddenName: '' + FunctionMaxLength: + active: false + excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" + maximumFunctionNameLength: 30 + FunctionMinLength: + active: false + excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" + minimumFunctionNameLength: 3 + FunctionNaming: + active: true + excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" + functionPattern: '^([a-z$][a-zA-Z$0-9]*)|(`.*`)$' + excludeClassPattern: '$^' + ignoreOverridden: true + FunctionParameterNaming: + active: false + excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" + parameterPattern: '[a-z][A-Za-z0-9]*' + excludeClassPattern: '$^' + ignoreOverriddenFunctions: true + InvalidPackageDeclaration: + active: false + rootPackage: '' + MatchingDeclarationName: + active: true + MemberNameEqualsClassName: + active: false + ignoreOverriddenFunction: true + ObjectPropertyNaming: + active: true + excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" + 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: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" + packagePattern: '^[a-z]+(\.[a-z][A-Za-z0-9]*)*$' + TopLevelPropertyNaming: + active: true + excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" + constantPattern: '[A-Z][_A-Z0-9]*' + propertyPattern: '[A-Za-z][_A-Za-z0-9]*' + privatePropertyPattern: '_?[A-Za-z][_A-Za-z0-9]*' + VariableMaxLength: + active: false + excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" + maximumVariableNameLength: 64 + VariableMinLength: + active: false + excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" + minimumVariableNameLength: 1 + VariableNaming: + active: true + excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" + variablePattern: '[a-z][A-Za-z0-9]*' + privateVariablePattern: '(_)?[a-z][A-Za-z0-9]*' + excludeClassPattern: '$^' + ignoreOverridden: true + +performance: + active: true + ArrayPrimitive: + active: false + ForEachOnRange: + active: true + excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" + SpreadOperator: + active: false + excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" + UnnecessaryTemporaryInstantiation: + active: true + +potential-bugs: + active: true + DuplicateCaseInWhenExpression: + active: true + EqualsAlwaysReturnsTrueOrFalse: + active: false + EqualsWithHashCodeExist: + active: true + ExplicitGarbageCollectionCall: + active: true + InvalidRange: + active: false + IteratorHasNextCallsNextMethod: + active: false + IteratorNotThrowingNoSuchElementException: + active: false + LateinitUsage: + active: false + excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" + excludeAnnotatedProperties: "" + ignoreOnClassesPattern: "" + MissingWhenCase: + active: false + UnconditionalJumpStatementInLoop: + active: false + UnreachableCode: + active: true + UnsafeCallOnNullableType: + active: false + UnsafeCast: + active: false + UselessPostfixExpression: + active: false + WrongEqualsTypeParameter: + active: false + +style: + active: true + CollapsibleIfStatements: + active: false + DataClassContainsFunctions: + active: false + conversionFunctionPrefix: 'to' + DataClassShouldBeImmutable: + active: false + EqualsNullCall: + active: false + EqualsOnSignatureLine: + active: false + ExplicitItLambdaParameter: + active: false + ExpressionBodySyntax: + active: false + includeLineWrapping: false + ForbiddenComment: + active: true + values: 'TODO:,FIXME:,STOPSHIP:' + ForbiddenImport: + active: false + imports: '' + ForbiddenVoid: + active: false + ignoreOverridden: false + FunctionOnlyReturningConstant: + active: false + ignoreOverridableFunction: true + excludedFunctions: 'describeContents' + LoopWithTooManyJumpStatements: + active: false + maxJumpCount: 1 + MagicNumber: + active: false + excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" + ignoreNumbers: '-1,0,1,2' + ignoreHashCodeFunction: true + ignorePropertyDeclaration: false + ignoreConstantDeclaration: true + ignoreCompanionObjectPropertyDeclaration: true + ignoreAnnotation: false + ignoreNamedArgument: true + ignoreEnums: false + ignoreRanges: false + MandatoryBracesIfStatements: + active: false + MaxLineLength: + active: false + MayBeConst: + active: false + ModifierOrder: + active: true + NestedClassesVisibility: + active: false + NewLineAtEndOfFile: + active: false + NoTabs: + active: false + OptionalAbstractKeyword: + active: true + OptionalUnit: + active: false + OptionalWhenBraces: + active: false + PreferToOverPairSyntax: + active: false + ProtectedMemberInFinalClass: + active: false + RedundantVisibilityModifierRule: + active: false + ReturnCount: + active: false + max: 2 + excludedFunctions: "equals" + excludeLabeled: false + excludeReturnFromLambda: true + SafeCast: + active: true + SerialVersionUIDInSerializableClass: + active: false + SpacingBetweenPackageAndImports: + active: false + ThrowsCount: + active: true + max: 2 + TrailingWhitespace: + active: false + UnderscoresInNumericLiterals: + active: false + acceptableDecimalLength: 5 + UnnecessaryAbstractClass: + active: false + excludeAnnotatedClasses: "dagger.Module" + UnnecessaryApply: + active: false + UnnecessaryInheritance: + active: false + UnnecessaryLet: + active: false + UnnecessaryParentheses: + active: false + UntilInsteadOfRangeTo: + active: false + UnusedImports: + active: false + UnusedPrivateClass: + active: false + UnusedPrivateMember: + active: false + allowedNames: "(_|ignored|expected|serialVersionUID)" + UseCheckOrError: + active: false + UseDataClass: + active: false + excludeAnnotatedClasses: "" + UseRequire: + active: false + UselessCallOnNotNull: + active: false + UtilityClassWithPublicConstructor: + active: false + VarCouldBeVal: + active: false + WildcardImport: + active: false diff --git a/DEV/functiongraphic/functiongraphic.png b/DEV/functiongraphic/functiongraphic.png index c4992040..e531d0dc 100644 Binary files a/DEV/functiongraphic/functiongraphic.png and b/DEV/functiongraphic/functiongraphic.png differ diff --git a/DEV/functiongraphic/functiongraphic.psd b/DEV/functiongraphic/functiongraphic.psd deleted file mode 100644 index c812c359..00000000 Binary files a/DEV/functiongraphic/functiongraphic.psd and /dev/null differ diff --git a/DEV/github/2017-11-18 12.39.39.jpg b/DEV/github/2017-11-18 12.39.39.jpg new file mode 100644 index 00000000..ad2a250b Binary files /dev/null and b/DEV/github/2017-11-18 12.39.39.jpg differ diff --git a/DEV/github/2017-11-18 12.39.46.jpg b/DEV/github/2017-11-18 12.39.46.jpg new file mode 100644 index 00000000..9a1c7b19 Binary files /dev/null and b/DEV/github/2017-11-18 12.39.46.jpg differ diff --git a/DEV/github/2017-11-18 12.39.48.jpg b/DEV/github/2017-11-18 12.39.48.jpg new file mode 100644 index 00000000..70ff0865 Binary files /dev/null and b/DEV/github/2017-11-18 12.39.48.jpg differ diff --git a/DEV/github/2017-11-18 12.39.54.jpg b/DEV/github/2017-11-18 12.39.54.jpg new file mode 100644 index 00000000..c6b60b5c Binary files /dev/null and b/DEV/github/2017-11-18 12.39.54.jpg differ diff --git a/DEV/github/2017-11-18 12.39.57.jpg b/DEV/github/2017-11-18 12.39.57.jpg new file mode 100644 index 00000000..1ef8cff9 Binary files /dev/null and b/DEV/github/2017-11-18 12.39.57.jpg differ diff --git a/DEV/github/2017-11-18 12.40.00.jpg b/DEV/github/2017-11-18 12.40.00.jpg new file mode 100644 index 00000000..395c6cee Binary files /dev/null and b/DEV/github/2017-11-18 12.40.00.jpg differ diff --git a/DEV/github/2017-11-18 12.40.04.jpg b/DEV/github/2017-11-18 12.40.04.jpg new file mode 100644 index 00000000..8e16178d Binary files /dev/null and b/DEV/github/2017-11-18 12.40.04.jpg differ diff --git a/DEV/github/Screenshot_2015-08-12-19-30-01.png b/DEV/github/Screenshot_2015-08-12-19-30-01.png deleted file mode 100755 index 27641908..00000000 Binary files a/DEV/github/Screenshot_2015-08-12-19-30-01.png and /dev/null differ diff --git a/DEV/github/Screenshot_2015-08-12-19-30-15.png b/DEV/github/Screenshot_2015-08-12-19-30-15.png deleted file mode 100755 index 7f74d764..00000000 Binary files a/DEV/github/Screenshot_2015-08-12-19-30-15.png and /dev/null differ diff --git a/DEV/github/Screenshot_2015-08-12-19-30-24.png b/DEV/github/Screenshot_2015-08-12-19-30-24.png deleted file mode 100755 index 36da3a75..00000000 Binary files a/DEV/github/Screenshot_2015-08-12-19-30-24.png and /dev/null differ diff --git a/DEV/github/Screenshot_2015-08-12-19-30-41.png b/DEV/github/Screenshot_2015-08-12-19-30-41.png deleted file mode 100755 index 2ac19e0d..00000000 Binary files a/DEV/github/Screenshot_2015-08-12-19-30-41.png and /dev/null differ diff --git a/DEV/github/Screenshot_2015-08-12-19-30-47.png b/DEV/github/Screenshot_2015-08-12-19-30-47.png deleted file mode 100755 index e3f726ca..00000000 Binary files a/DEV/github/Screenshot_2015-08-12-19-30-47.png and /dev/null differ diff --git a/DEV/github/screenshots1.jpg b/DEV/github/screenshots1.jpg index 7abf9f92..531b1981 100644 Binary files a/DEV/github/screenshots1.jpg and b/DEV/github/screenshots1.jpg differ diff --git a/DEV/github/screenshots1.png b/DEV/github/screenshots1.png deleted file mode 100644 index cfd89b74..00000000 Binary files a/DEV/github/screenshots1.png and /dev/null differ diff --git a/DEV/github/wiki/button_sample_1.PNG b/DEV/github/wiki/button_sample_1.PNG new file mode 100644 index 00000000..efb8a925 Binary files /dev/null and b/DEV/github/wiki/button_sample_1.PNG differ diff --git a/DEV/github/wiki/button_sample_2.PNG b/DEV/github/wiki/button_sample_2.PNG new file mode 100644 index 00000000..e8d7a1f8 Binary files /dev/null and b/DEV/github/wiki/button_sample_2.PNG differ diff --git a/DEV/github/wiki/check_box_sample_1.PNG b/DEV/github/wiki/check_box_sample_1.PNG new file mode 100644 index 00000000..76b1c377 Binary files /dev/null and b/DEV/github/wiki/check_box_sample_1.PNG differ diff --git a/DEV/github/wiki/check_box_sample_2.PNG b/DEV/github/wiki/check_box_sample_2.PNG new file mode 100644 index 00000000..28222b16 Binary files /dev/null and b/DEV/github/wiki/check_box_sample_2.PNG differ diff --git a/DEV/github/wiki/checkable_text_view_sample_1.PNG b/DEV/github/wiki/checkable_text_view_sample_1.PNG new file mode 100644 index 00000000..19f2d172 Binary files /dev/null and b/DEV/github/wiki/checkable_text_view_sample_1.PNG differ diff --git a/DEV/github/wiki/checkable_text_view_sample_2.PNG b/DEV/github/wiki/checkable_text_view_sample_2.PNG new file mode 100644 index 00000000..282bc89c Binary files /dev/null and b/DEV/github/wiki/checkable_text_view_sample_2.PNG differ diff --git a/DEV/github/wiki/image_button_sample_1.PNG b/DEV/github/wiki/image_button_sample_1.PNG new file mode 100644 index 00000000..25817723 Binary files /dev/null and b/DEV/github/wiki/image_button_sample_1.PNG differ diff --git a/DEV/github/wiki/image_view_sample_1.PNG b/DEV/github/wiki/image_view_sample_1.PNG new file mode 100644 index 00000000..813f11fb Binary files /dev/null and b/DEV/github/wiki/image_view_sample_1.PNG differ diff --git a/DEV/github/wiki/text_view_sample_1.PNG b/DEV/github/wiki/text_view_sample_1.PNG new file mode 100644 index 00000000..b4b6171c Binary files /dev/null and b/DEV/github/wiki/text_view_sample_1.PNG differ diff --git a/DEV/github/wiki/text_view_sample_2.PNG b/DEV/github/wiki/text_view_sample_2.PNG new file mode 100644 index 00000000..3f4defe4 Binary files /dev/null and b/DEV/github/wiki/text_view_sample_2.PNG differ diff --git a/DEV/github/wiki/text_view_sample_3.PNG b/DEV/github/wiki/text_view_sample_3.PNG new file mode 100644 index 00000000..96082342 Binary files /dev/null and b/DEV/github/wiki/text_view_sample_3.PNG differ diff --git a/DEV/screenshots/screenshot1.png b/DEV/screenshots/screenshot1.png deleted file mode 100755 index 0372159a..00000000 Binary files a/DEV/screenshots/screenshot1.png and /dev/null differ diff --git a/DEV/screenshots/screenshot2.png b/DEV/screenshots/screenshot2.png deleted file mode 100755 index 7b59bf7f..00000000 Binary files a/DEV/screenshots/screenshot2.png and /dev/null differ diff --git a/DEV/screenshots/screenshot3.png b/DEV/screenshots/screenshot3.png deleted file mode 100755 index c4fa5961..00000000 Binary files a/DEV/screenshots/screenshot3.png and /dev/null differ diff --git a/DEV/screenshots/screenshot4.png b/DEV/screenshots/screenshot4.png deleted file mode 100755 index 84878f82..00000000 Binary files a/DEV/screenshots/screenshot4.png and /dev/null differ diff --git a/DEV/screenshots/screenshot_1_small.png b/DEV/screenshots/screenshot_1_small.png deleted file mode 100644 index b9a89261..00000000 Binary files a/DEV/screenshots/screenshot_1_small.png and /dev/null differ diff --git a/DEV/screenshots/screenshot_2_small.png b/DEV/screenshots/screenshot_2_small.png deleted file mode 100644 index 1a235718..00000000 Binary files a/DEV/screenshots/screenshot_2_small.png and /dev/null differ diff --git a/Dangerfile b/Dangerfile new file mode 100644 index 00000000..61bb9d63 --- /dev/null +++ b/Dangerfile @@ -0,0 +1,48 @@ +github.dismiss_out_of_range_messages + +# Make it more obvious that a PR is a work in progress and shouldn't be merged yet. +has_wip_label = github.pr_labels.any? { |label| label.include? "Engineers at work" } +has_wip_title = github.pr_title.include? "[WIP]" + +if has_wip_label || has_wip_title + warn("PR is marked as Work in Progress") +end + +# Ensure the PR is not marked as DO NOT MERGE +fail("PR specifies label DO NOT MERGE") if github.pr_labels.any? { |label| label.include? "DO NOT MERGE" } + +# Warn when there is a big PR +warn("Big PR") if git.lines_of_code > 5000 + +File.open("settings.gradle", "r") do |file_handle| + file_handle.each_line do |setting| + if setting.include? "include" + gradleModule = setting[10, setting.length-12] + + # AndroidLint + androidLintFile = String.new(gradleModule + "/build/reports/lint-results.xml") + androidLintDebugFile = String.new(gradleModule + "/build/reports/lint-results-debug.xml") + if File.file?(androidLintFile) || File.file?(androidLintDebugFile) + android_lint.skip_gradle_task = true + android_lint.severity = "Warning" + if File.file?(androidLintFile) + android_lint.report_file = androidLintFile + else + android_lint.report_file = androidLintDebugFile + end + android_lint.filtering = true + android_lint.lint(inline_mode: true) + end + + # Detekt + detektFile = String.new(gradleModule + "/build/reports/detekt.xml") + if File.file?(detektFile) + kotlin_detekt.report_file = detektFile + kotlin_detekt.skip_gradle_task = true + kotlin_detekt.severity = "warning" + kotlin_detekt.filtering = true + kotlin_detekt.detekt(inline_mode: true) + end + end + end +end \ No newline at end of file diff --git a/FAQ.md b/FAQ.md new file mode 100644 index 00000000..cba0c5a2 --- /dev/null +++ b/FAQ.md @@ -0,0 +1,8 @@ +# FAQ / WIKI + +This is the official **Android-Iconics** FAQ/Wiki. People can contribute to it through pull requests. +Each question and it's answer is hosted in a separate file within the FAQ folder. + +## Overview + +* [TextView crashes with IOOBE using the IconicsLayoutInflator2](FAQ/textview_ioobe.md) \ No newline at end of file diff --git a/FAQ/textview_ioobe.md b/FAQ/textview_ioobe.md new file mode 100644 index 00000000..d8c059eb --- /dev/null +++ b/FAQ/textview_ioobe.md @@ -0,0 +1,71 @@ +### Q: IndexOutOfBoundsException internally of the `TextView` when using `setText` with the `IconicsLayoutInflator2` applied? + +``` +FATAL EXCEPTION: main +Process: com.mikepenz.iconics.sample.debug, PID: 23793 +java.lang.IndexOutOfBoundsException: charAt: 4 >= length 2 + at android.text.SpannableStringBuilder.charAt(SpannableStringBuilder.java:123) + at android.widget.TextView.desired(TextView.java:8049) + at android.widget.TextView.onMeasure(TextView.java:8121) + at android.view.View.measure(View.java:22071) + at android.widget.LinearLayout.measureHorizontal(LinearLayout.java:1148) + at android.widget.LinearLayout.onMeasure(LinearLayout.java:687) + at android.view.View.measure(View.java:22071) + at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715) + at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461) + at android.view.View.measure(View.java:22071) + at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6602) + at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) + at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:139) + at android.view.View.measure(View.java:22071) + at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6602) + at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1514) + at android.widget.LinearLayout.measureVertical(LinearLayout.java:806) + at android.widget.LinearLayout.onMeasure(LinearLayout.java:685) + at android.view.View.measure(View.java:22071) + at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6602) + at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) + at android.view.View.measure(View.java:22071) + at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6602) + at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1514) + at android.widget.LinearLayout.measureVertical(LinearLayout.java:806) + at android.widget.LinearLayout.onMeasure(LinearLayout.java:685) + at android.view.View.measure(View.java:22071) + at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6602) + at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) + at com.android.internal.policy.DecorView.onMeasure(DecorView.java:724) + at android.view.View.measure(View.java:22071) + at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2422) + at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1504) + at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1761) + at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1392) + at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6752) + at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911) + at android.view.Choreographer.doCallbacks(Choreographer.java:723) + at android.view.Choreographer.doFrame(Choreographer.java:658) + at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897) + at android.os.Handler.handleCallback(Handler.java:790) + at android.os.Handler.dispatchMessage(Handler.java:99) + at android.os.Looper.loop(Looper.java:164) + at android.app.ActivityThread.main(ActivityThread.java:6494) + at java.lang.reflect.Method.invoke(Native Method) + at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) + at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) +``` + +### A: +The issue is caused by the following: +WIth the `IconicsLayoutInflater2` I'll automatically replace text with the icon + attach a text listener to the textview. + +When we then adjust the text the normal `draw` logic instantly kicks in of the textview, during this time we get the event of the `TextWatcher` with the editable, which we modify to be the icon. +The problem here is though, that the `draw` logic of the `TextView` is too stupid and does not detect that instead of multiple lines (the text for the icon would result in 4 lines) is now only 1 line (the icon is super short, the text behind is also super short, so no line break necessary) So it will blow up. There's sadly not much we can do about this (setting the lines, and line number to 1 surprisingly does not change the internal line calculation :D) + +The easiest approach to get around this is use the `IconicsTextView` as this will adjust the icon during `setText`, another approach (but not so handy) would be to apply the styling to the text as spannable, and apply this then to the normal `TextView` (so it would have the short string from the beginning) + +Another nice workaround is to add `android:ellipsize="start"` to that `TextView` as this will change the way it calculates line breaks, and it won't crash anymore. + +### Related issue: +https://github.com/mikepenz/Android-Iconics/issues/350 + +### Branch with issue showcase + fix: +https://github.com/mikepenz/Android-Iconics/tree/feature/fix_textview_ioobe \ No newline at end of file diff --git a/Gemfile b/Gemfile new file mode 100644 index 00000000..f2dcc83f --- /dev/null +++ b/Gemfile @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } + +gem 'danger' +gem 'danger-android_lint' +gem 'danger-kotlin_detekt' \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 00000000..aae0954d --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,103 @@ +GEM + remote: https://rubygems.org/ + specs: + addressable (2.8.1) + public_suffix (>= 2.0.2, < 6.0) + ansi (1.5.0) + ast (2.4.2) + claide (1.1.0) + claide-plugins (0.9.2) + cork + nap + open4 (~> 1.3) + colored2 (3.1.2) + cork (0.3.0) + colored2 (~> 3.1) + danger (9.0.0) + claide (~> 1.0) + claide-plugins (>= 0.9.2) + colored2 (~> 3.1) + cork (~> 0.1) + faraday (>= 0.9.0, < 2.0) + faraday-http-cache (~> 2.0) + git (~> 1.7) + kramdown (~> 2.3) + kramdown-parser-gfm (~> 1.0) + no_proxy_fix + octokit (~> 5.0) + terminal-table (>= 1, < 4) + danger-android_lint (0.0.11) + danger-plugin-api (~> 1.0) + oga + danger-kotlin_detekt (0.0.3) + danger-plugin-api (~> 1.0) + danger-plugin-api (1.0.0) + danger (> 2.0) + faraday (1.10.2) + faraday-em_http (~> 1.0) + faraday-em_synchrony (~> 1.0) + faraday-excon (~> 1.1) + faraday-httpclient (~> 1.0) + faraday-multipart (~> 1.0) + faraday-net_http (~> 1.0) + faraday-net_http_persistent (~> 1.0) + faraday-patron (~> 1.0) + faraday-rack (~> 1.0) + faraday-retry (~> 1.0) + ruby2_keywords (>= 0.0.4) + faraday-em_http (1.0.0) + faraday-em_synchrony (1.0.0) + faraday-excon (1.1.0) + faraday-http-cache (2.4.1) + faraday (>= 0.8) + faraday-httpclient (1.0.1) + faraday-multipart (1.0.4) + multipart-post (~> 2) + faraday-net_http (1.0.1) + faraday-net_http_persistent (1.2.0) + faraday-patron (1.0.0) + faraday-rack (1.0.0) + faraday-retry (1.0.3) + git (1.13.0) + addressable (~> 2.8) + rchardet (~> 1.8) + kramdown (2.4.0) + rexml + kramdown-parser-gfm (1.1.0) + kramdown (~> 2.0) + multipart-post (2.2.3) + nap (1.1.0) + no_proxy_fix (0.1.2) + octokit (5.6.1) + faraday (>= 1, < 3) + sawyer (~> 0.9) + oga (3.4) + ast + ruby-ll (~> 2.1) + open4 (1.3.4) + public_suffix (5.0.1) + rchardet (1.8.0) + rexml (3.2.8) + strscan (>= 3.0.9) + ruby-ll (2.1.2) + ansi + ast + ruby2_keywords (0.0.5) + sawyer (0.9.2) + addressable (>= 2.3.5) + faraday (>= 0.17.3, < 3) + strscan (3.1.0) + terminal-table (3.0.2) + unicode-display_width (>= 1.1.1, < 3) + unicode-display_width (2.3.0) + +PLATFORMS + ruby + +DEPENDENCIES + danger + danger-android_lint + danger-kotlin_detekt + +BUNDLED WITH + 2.3.22 diff --git a/LICENSE b/LICENSE index e06d2081..37e27364 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ Apache License same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright {yyyy} {name of copyright owner} + Copyright 2021 Mike Penz Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/MIGRATION.md b/MIGRATION.md index b90d84dc..d486d25f 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -1,6 +1,54 @@ -##Upgrade Notes +## Upgrade Notes ### Library + +### core v4.x.x -> 5.x.x + +- All `with*` methods of the `IconicsDrawable` were replaced with properties +- Raw setters are now direct (int color, string, pixel values), all other properties were moved into extension functions to clean up the `IconicsDrawable` +- The `IconcisDrawable` now depends on the ressources and theme, and tries to eliminate dependency on the `Context` + - All according methods were refactored to take Resources and Theme +- Use `IconcisDrawable` via XML for API 24+ +- `.apply` is specialized and will not invalidate the drawable until all changes were made + +### core v3.x.x -> 4.x.x +Now libray is kotlin-first + +* Font files + * Font's store now based on default way to store fonts. (moved from common assets to font-specific resource assets) +* `Iconics` + * No context from now required. We get the application context via ContentProvider +* `Iconics.IconicsBuilder` + * Renamed to `Iconics.Builder` + * Removed `ctx(Context)` method +* `IconicsDrawable` + * Replaced all `*Res(int)`, `*Px(int)`, `*Dp(int)` method to use `IconicsSize` and `IconicsColor` classes instead + * Constants `TOOLBAR_ICON_SIZE` and `TOOLBAR_ICON_PADDING` moved to `IconicsSize` + * All getters now have property-syntax + * All producer-provided methods from [Android-Iconics Kt](https://github.com/zTrap/Android-Iconics-Kt) are included in class and can return nullable value (value will be set only when not null) + * `enableShadowSupport(View)` moved to `IconicsUtils` +* All `utils` classes and typeface libraries now can not be instantiated +* `ITypeface` + * Method `getTypeface(Context)` replaced with field `rawTypeface` + * Automatically retrieves raw font from file by provided `fontRes` (see [GenericFont.kt](/library-core/src/main/java/com/mikepenz/iconics/typeface/GenericFont.kt) if You wont to use old scheme) + +#### Community Material Icons > v2.7.94 +* With the update of the community material icons, the amount of icons exceeded the allowed length of an enum. Thus it was split up in `CommunityMaterial.Icon` and `CommunityMaterial.Icon2` if you use the icons via code, please use the depending enum. + * The icons were split apart by the letter `h`. All icons starting from `a` to `g` are in the `CommunityMaterial.Icon` enum, all icons from `h` to `z` are in the `CommunityMaterial.Icon2` enum. + +#### v3.1.x +* Upgraded the library to use `androidX` dependencies. This means your project will need to depend on `androidX` dependencies too. If you still use appcompat please consider using a version older than v3.1.x. +* Further details about migrating to androidX and a overview can be found on the official docs. https://developer.android.com/topic/libraries/support-library/refactor + +#### 2.9.5 +* the attributes for the `IconicsMenuInflaterUtil` start now with `ico_` instead of `iiv_` +* the `IconicsMenuInflaterUtil` was moved into the `core` module to simplify code + +#### 2.9.0 +* The library-core was split apart into **iconics-core** and **iconics-views** to slim down the **iconics-core** and allow more advanced UI features in the **iconics-views** +* the core dep stays the same: `compile "com.mikepenz:iconics-core:2.9.0@aar"` +* for all UI widgets add `compile "com.mikepenz:iconics-views:2.9.0@aar"` + #### 2.8.0 * Dropping support for API < 14. New `MinSdkVersion` is now 14 @@ -43,4 +91,4 @@ protected void attachBaseContext(Context newBase) { * package name `com.mikepenz.material_design_iconic_typeface_library.MaterialDesignIconic` #### Google Material font 1.2.0.1 --> 2.1.2.1 -* the mapping of some icons changed \ No newline at end of file +* the mapping of some icons changed diff --git a/README.md b/README.md index c0f3407b..cf357ee0 100644 --- a/README.md +++ b/README.md @@ -1,31 +1,40 @@ -# Android-Iconics [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.mikepenz/iconics-core/badge.svg?style=flat)](https://maven-badges.herokuapp.com/maven-central/com.mikepenz/iconics-core) [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Android--Iconics-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/1164) +# Android-Iconics -![Image](https://raw.githubusercontent.com/mikepenz/Android-Iconics/feature/next-generation/DEV/github/banner.png) +... allows to include any icon font with all its vector icons in your project. No limits. **Scale with no limit**, use **any color** at any time, provide a **contour**, and many additional customizations... -> If you are an app developer you will know the problem. You start an app but require many different icons, in different sizes (**ldpi, mdpi, hdpi, xhdpi, xxhdpi, xxxhdpi**), **different colors**, and **different variants**. -If you get the icons as **vector** (.svg) or there are many changes over the time, you will always have to get the correct drawables again. +------- -> **This consumes a lot of time!** +

+ What's included 🚀 • + Setup 🛠️ • + Migration Guide 🧬 • + WIKI / FAQ 📖 • + Custom Font 🖍️ • + Sample App +

-Now there's an **easy, fast, and small** solution for this! The **Android-Iconics** library. +------- -This library allows you to include vector icons everywhere in your project. No limits are given. -**Scale with no limit**, use **any color** at any time, provide a **contour**, and many additional customizations... - -Use the icons in the variation you need them. - -**What do you get** +### What's included 🚀 - No customization limitations (size, color, contour, background, padding, positioning, ...) +- Shadow support +- Use as XML Drawable starting API 24 - One icon source (no more mdpi, hdpi, ...) - Flexibility + - Size + - Colors + - Contour + - Shadow + - Auto mirroring for RTL (opt-in) - If it takes a Drawable, it will also work with the IconicsDrawable! - Save in APK size -- All licenses included, best used with [AboutLibraries](https://github.com/mikepenz/AboutLibraries) +- Compose support **Already available fonts** - [Google Material Design Icons](https://github.com/google/material-design-icons) +- [Google Material Symbols](https://github.com/google/material-design-icons) - [Material Design Iconic Font](http://zavoloklom.github.io/material-design-iconic-font) -- [Fontawesome](http://fontawesome.io) +- [Fontawesome](https://fontawesome.com/) - [Meteocons](http://www.alessioatzeni.com/meteocons/) - [Octicons](https://github.com/github/octicons) - [Community Material](http://materialdesignicons.com/) @@ -35,74 +44,90 @@ Use the icons in the variation you need them. - [Devicon](http://devicon.fr/) - [Foundation Icons](http://zurb.com/playground/foundation-icon-fonts-3) - [Ionicons](http://ionicons.com/) +- [Material Design DX](https://jossef.github.io/material-design-icons-iconfont/) +- [Pixeden 7 Stroke](https://themes-pixeden.com/font-demos/7-stroke/) +- [Phosphor](https://phosphoricons.com/) +- [Simple Icons](https://simpleicons.org/) +- Or create your own font with any icon needed. -**Need more?** -Provide additional fonts for you project, or even create your custom font with just the icons you need. +# Setup -# Migration -- [MIGRATION GUIDE](https://github.com/mikepenz/Android-Iconics/blob/develop/MIGRATION.md) +## Latest releases 🛠 -# Setup +- Kotlin | [v5.5.0](https://github.com/mikepenz/Android-Iconics/tree/v5.5.0) ## 1. Provide the gradle dependency ```gradle -compile "com.mikepenz:iconics-core:2.8.6@aar" -compile "com.android.support:appcompat-v7:${supportLibVersion}" +dependencies { + //the core iconics library (without any widgets) + implementation "com.mikepenz:iconics-core:${latestAndroidIconicsRelease}" + implementation "androidx.appcompat:appcompat:${versions.appCompat}" +} ``` -## 2. Choose your desired fonts +## 1b. (optional) Add the view's dependency ```gradle -compile 'com.mikepenz:google-material-typeface:3.0.1.0.original@aar' -compile 'com.mikepenz:material-design-iconic-typeface:2.2.0.2@aar' -compile 'com.mikepenz:fontawesome-typeface:4.7.0.0@aar' -compile 'com.mikepenz:octicons-typeface:3.2.0.2@aar' -compile 'com.mikepenz:meteocons-typeface:1.1.0.2@aar' -compile 'com.mikepenz:community-material-typeface:1.9.32.1@aar' -compile 'com.mikepenz:weather-icons-typeface:2.0.10.2@aar' -compile 'com.mikepenz:typeicons-typeface:2.0.7.2@aar' -compile 'com.mikepenz:entypo-typeface:1.0.0.2@aar' -compile 'com.mikepenz:devicon-typeface:2.0.0.2@aar' -compile 'com.mikepenz:foundation-icons-typeface:3.0.0.2@aar' -compile 'com.mikepenz:ionicons-typeface:2.0.1.2@aar' -compile 'com.mikepenz:pixeden-7-stroke-typeface:1.2.0.0@aar' +//this adds all ui view widgets (IconicsButton, IconicsImageView, ...) +implementation "com.mikepenz:iconics-views:${latestAndroidIconicsRelease}" ``` -## 3. Define IconicsLayoutInflater to enable automatic xml icons detection (optional) -Set the `IconicsLayoutInflater` as new `LayoutInflaterFactory`. This will enable automatic icon detection for `TextViews`,`Buttons`, and allow you to set icons on `ImageView`'s via xml. This is compatible with libs which wrap the `baseContext` like [Calligraphy](https://github.com/chrisjenx/Calligraphy). This does not work on FAB's please use the `Context-Injection` instead. -```java -@Override -protected void onCreate(Bundle savedInstanceState) { - LayoutInflaterCompat.setFactory(getLayoutInflater(), new IconicsLayoutInflater(getDelegate())); - //... - super.onCreate(savedInstanceState); - //... -} -``` +## 2. Choose your desired fonts -### 3. ALTERNATIVE: Inject into Context (optional) -Wrap the `Activity` context. This will enable the same features as Step 3.1., but is not compatible with other libs wrapping the `baseContext`. -```java -@Override -protected void attachBaseContext(Context newBase) { - super.attachBaseContext(IconicsContextWrapper.wrap(newBase)); -} +> [!NOTE] +> Fonts ending with `-kotlin` require at least v4.x of Android-Iconics +> v5.1.x or newer requires the latest font versions + +```gradle +implementation 'com.mikepenz:google-material-typeface:4.0.0.3-kotlin@aar' +implementation 'com.mikepenz:google-material-typeface-{outlined|rounded|sharp}:4.0.0.2-kotlin@aar' +implementation 'com.mikepenz:material-design-iconic-typeface:2.2.0.9-kotlin@aar' +implementation 'com.mikepenz:fontawesome-typeface:5.9.0.3-kotlin@aar' +implementation 'com.mikepenz:octicons-typeface:11.1.0.1-kotlin@aar' +implementation 'com.mikepenz:meteocons-typeface:1.1.0.8-kotlin@aar' +implementation 'com.mikepenz:community-material-typeface:7.0.96.1-kotlin@aar' // note 5.3.45.1 and newer alphabetically sorts, and merges in 3 sections +implementation 'com.mikepenz:weather-icons-typeface:2.0.10.8-kotlin@aar' +implementation 'com.mikepenz:typeicons-typeface:2.0.7.8-kotlin@aar' +implementation 'com.mikepenz:entypo-typeface:1.0.0.8-kotlin@aar' +implementation 'com.mikepenz:devicon-typeface:2.0.0.8-kotlin@aar' +implementation 'com.mikepenz:foundation-icons-typeface:3.0.0.8-kotlin@aar' +implementation 'com.mikepenz:ionicons-typeface:2.0.1.8-kotlin@aar' +implementation 'com.mikepenz:pixeden-7-stroke-typeface:1.2.0.6-kotlin@aar' +implementation 'com.mikepenz:material-design-icons-dx-typeface:5.0.1.3-kotlin@aar' +implementation 'com.mikepenz:phosphor-typeface:1.0.0.1-kotlin@aar' +implementation 'com.mikepenz:simple-icons-typeface:17.0.0.3@aar' ``` +> [!NOTE] +> For users of the version catalog, it is not possible to add the type, however you can do so via +> the implementation definition. +> `implementation(libs.material.typeface) { artifact { type = "aar" } }` + +> [!WARNING] +> The fonts use the `jetpack startup` library to automatically register themselves. +> If `jetpack startup` is disabled, +> it is required to manually register the fonts. Please find additional details in +> the [Register fonts](#register-fonts). + # Usage + +> [!NOTE] +> It might be required to call `Iconics.init(applicationContext)` if no context based APIs are used +> from the library otherwise. + ## Use as drawable -```java -new IconicsDrawable(this) - .icon(FontAwesome.Icon.faw_android) - .color(Color.RED) - .sizeDp(24) +```kotlin +IconicsDrawable(this, FontAwesome.Icon.faw_android).apply { + colorInt = Color.RED + sizeDp = 24 +} ``` ## Use via XML If you use the Iconics library via XML provide the icon you want to use in the following syntax: `gmd-favorite` --> `fontId`-`iconName`. A list of the -available fonts and their `fontId` can be found near the end of the README.md +available fonts and their `fontId` can be found [here](#available-fonts). All icon names from the default fonts can be found via the [DEMO](https://play.google.com/store/apps/details?id=com.mikepenz.iconics.sample) application. #### Notation within text @@ -111,158 +136,164 @@ Use the `{` icon-definer `}` syntax Some great text with a {faw-android} font awesome icon and {met-wind} meteocons icons. ``` -### As ImageView (only available if you follow Step 3 or inject the context) +### Drawable XML (API 24+) + +Specify the drawable in your `drawable` folder. + ```xml - - - //other possible attributes - //app:ico_background_color="@android:color/transparent" - //app:ico_color="@color/md_red_100" - //app:ico_contour_color="@android:color/transparent" - //app:ico_contour_width="0dp" - //app:ico_corner_radius="0dp" - //app:ico_icon="gmd-plus-circle" - //app:ico_offset_x="0dp" - //app:ico_offset_y="0dp" - //app:ico_padding="0dp" - //app:ico_size="48dp" -``` -### As TextView (only available if you inject the context) -```xml - + + // all custom theming attributes supported ``` -### Custom Views (if you do NOT follow Step 3 or inject the context) +Use like any normal drawable in your application. +This feature was suggested and initially provided by @dzamlo + +### Custom Views #### As IconicsImageView ```xml + app:iiv_icon="gmd-favorite" /> // or @string/gmd_favorite with our generator + //app:iiv_size="12dp" + //app:iiv_padding="2dp" + //app:iiv_contour_color="#FF0000" + //app:iiv_contour_width="2dp" + //app:iiv_background_color="#FFFF00" + //app:iiv_corner_radius="2dp" + //app:iiv_background_contour_color="#FF0000" + //app:iiv_background_contour_width="1dp" + //app:iiv_shadow_radius="4dp" + //app:iiv_shadow_dx="1dp" + //app:iiv_shadow_dy="1dp" + //app:iiv_animations="spin|blink_alpha|blink_scale" ``` #### As IconicsTextView ```xml + android:text="abc{hif-test}defgh{faw-adjust}ijk{fon-test1}lmnopqrstuv{fon-test2}wxyz" + android:textColor="@android:color/black" + android:layout_width="wrap_content" + android:layout_height="56dp" + android:textSize="16sp"/> ``` #### As IconicsButton ```xml + android:text="{faw-adjust} Button" + android:layout_width="120dp" + android:layout_height="60dp"/> ``` -### Automatic XML +## Compose + +To include the experimental compose support in your project add the following dependency to your project (since v5.2.0) + +```gradle +implementation "com.mikepenz:iconics-compose:${latestAndroidIconicsRelease}" +``` +Use the provided `Image` wrapper and set the icon. + +```kotlin +Image( + GoogleMaterial.Icon.gmd_access_alarm, + colorFilter = ColorFilter.tint(MaterialTheme.colors.primary), +) +``` # Screenshots ![Image](https://raw.githubusercontent.com/mikepenz/Android-Iconics/develop/DEV/github/screenshots1.jpg) - # Available fonts -* [Google Material Design Icons](https://github.com/google/material-design-icons) - * "gmd" - * **ORIGINAL by Google** compile 'com.mikepenz:google-material-typeface:+.original@aar' -* [Material Design Iconic Font](http://zavoloklom.github.io/material-design-iconic-font) - * "gmi" - * **Google Material Iconic** compile 'com.mikepenz:material-design-iconic-typeface:+@aar' -* [Fontawesome](http://fontawesome.io) - * "faw" - * compile 'com.mikepenz:fontawesome-typeface:+@aar' -* [Meteocons](http://www.alessioatzeni.com/meteocons/) - * "met" - * compile 'com.mikepenz:meteocons-typeface:+@aar' -* [Octicons](https://github.com/github/octicons) - * "oct" - * compile 'com.mikepenz:octicons-typeface:+@aar' -* [Community Material](http://materialdesignicons.com/) - * "cmd" - * compile 'com.mikepenz:community-material-typeface:+@aar' -* [Weather Icons](https://erikflowers.github.io/weather-icons/) - * "wic" - * compile 'com.mikepenz:weather-icons-typeface:+@aar' -* [Typeicons](http://typicons.com/) - * "typ" - * compile 'com.mikepenz:typeicons-typeface:+@aar' -* [Entypo](http://www.entypo.com/) - * "ent" - * compile 'com.mikepenz:entypo-typeface:+@aar' -* [Devicon](http://devicon.fr/) - * "dev" - * compile 'com.mikepenz:devicon-typeface:+@aar' -* [Foundation Icons](http://zurb.com/playground/foundation-icon-fonts-3) - * "fou" - * compile 'com.mikepenz:foundation-icons-typeface:+@aar' -* [Ionicons](http://ionicons.com/) - * "ion" - * compile 'com.mikepenz:ionicons-typeface:+@aar' -* [Pixden7Stroke](http://themes-pixeden.com/font-demos/7-stroke/) - * "pe7" - * compile 'com.mikepenz:pixeden-7-stroke-typeface:+@aar' - -Licenses for all included fonts are linked inside the class or can be found on the coresponding repoistories. + +| Link | Prefix | Dependency | +|-------------------------------------------------------------------------------------------------------------------|-----------------|---------------------------------------------------------------------------------------| +| [Google Material Design Icons](https://github.com/google/material-design-icons) **ORIGINAL by Google** | gmd,gmo,gmr,gms | implementation 'com.mikepenz:google-material-typeface{-outlined,rounded,sharp}:+@aar' | +| [Material Design Iconic Font](http://zavoloklom.github.io/material-design-iconic-font) **Google Material Iconic** | gmi | implementation 'com.mikepenz:material-design-iconic-typeface:+@aar' | +| [Fontawesome](https://fontawesome.com/) | faw | implementation 'com.mikepenz:fontawesome-typeface:+@aar' | +| [FontawesomeBrand](https://fontawesome.com/) | fab | implementation 'com.mikepenz:fontawesome-typeface:+@aar' | +| [FontawesomeRegular](https://fontawesome.com/) | far | implementation 'com.mikepenz:fontawesome-typeface:+@aar' | +| [Meteocons](http://www.alessioatzeni.com/meteocons/) | met | implementation 'com.mikepenz:meteocons-typeface:+@aar' | +| [Octicons](https://github.com/github/octicons) | oct | implementation 'com.mikepenz:octicons-typeface:+@aar' | +| [Community Material](http://materialdesignicons.com/) | cmd | implementation 'com.mikepenz:community-material-typeface:+@aar' | +| [Weather Icons](https://erikflowers.github.io/weather-icons/) | wic | implementation 'com.mikepenz:weather-icons-typeface:+@aar' | +| [Typeicons](http://typicons.com/) | typ | implementation 'com.mikepenz:typeicons-typeface:+@aar' | +| [Entypo](http://www.entypo.com/) | ent | implementation 'com.mikepenz:entypo-typeface:+@aar' | +| [Devicon](http://devicon.fr/) | dev | implementation 'com.mikepenz:devicon-typeface:+@aar' | +| [Foundation Icons](https://github.com/zurb/foundation-icon-fonts) | fou | implementation 'com.mikepenz:foundation-icons-typeface:+@aar' | +| [Ionicons](http://ionicons.com/) | ion | implementation 'com.mikepenz:ionicons-typeface:+@aar' | +| [Pixden7Stroke](http://themes-pixeden.com/font-demos/7-stroke/) | pe7 | implementation 'com.mikepenz:pixeden-7-stroke-typeface:+@aar' | +| [Material Design DX](https://jossef.github.io/material-design-icons-iconfont/) | cmf | implementation 'com.mikepenz:material-design-icons-dx-typeface:+@aar' | +| [Phosphor Icons](https://phosphoricons.com/) | pho | implementation 'com.mikepenz:phosphor-typeface:+@aar' | +| [Simple Icons](https://simpleicons.org/) | sim | implementation 'com.mikepenz:simple-icons-typeface:+@aar' | + +Licenses for all included fonts are linked inside the class or can be found on the coresponding repositories. + +# Compatibility Note + +### appcompat:1.4.x + +Appcompat v1.4.x introduces default enabled emoji support into all `AppCompat*` views, which prevents the `IconicsView*` views (iconics-views module) from properly applying the spannable style. +To fix this problem, emoji support has to be disabled by doing: + +```xml +app:emojiCompatEnabled="false" +``` + +More information on the appcompat emoji support: https://developer.android.com/jetpack/androidx/releases/appcompat#1.4.0-alpha01 # Advanced Usage ### Register fonts If you want to add your own custom font, or a GenericFont you have to register this font (before using it). The best place to do this is the `Application`. -```java -public class CustomApplication extends Application { - @Override - public void onCreate() { - super.onCreate(); - //only required if you add a custom or generic font on your own - Iconics.init(getApplicationContext()); +And initialize Iconics as you wish +```kotlin +class CustomApplication : Application() { + override fun onCreate() { + super.onCreate() //register custom fonts like this (or also provide a font definition file) - Iconics.registerFont(new CustomFont()); + Iconics.registerFont(CustomFont()) } } - ``` ### Advanced IconicsBuilder Everything is easy and simple. Right? But now you got a single icon within your textview and you need additional styling? Just define the style for all icons or only a specific one. You can find this in the PlaygroundActivity of the sample too. -```java -new Iconics.IconicsBuilder().ctx(this) - .style(new ForegroundColorSpan(Color.WHITE), new BackgroundColorSpan(Color.BLACK), new RelativeSizeSpan(2f)) - .styleFor(FontAwesome.Icon.faw_adjust, new BackgroundColorSpan(Color.RED)) - .on(tv1) - .build(); +```kotlin +Iconics.Builder() + .style(ForegroundColorSpan(Color.WHITE), BackgroundColorSpan(Color.BLACK), RelativeSizeSpan(2f)) + .styleFor(FontAwesome.Icon.faw_adjust, BackgroundColorSpan(Color.RED)) + .on(tv1) + .build() ``` ### String icon-key or typeface enum Sometimes you won't like to use the icon-key ("faw-adjust") like this, but use the enum provided by a specific font. Both is valid: -```java - new IconicsDrawable(this, "faw-adjust").actionBarSize() +```kotlin +IconicsDrawable(this, "faw-adjust").actionBar() ``` -```java - new IconicsDrawable(this, FontAwesome.Icon.faw_adjust).sizeDp(24) +```kotlin +IconicsDrawable(this, FontAwesome.Icon.faw_adjust).apply { + sizeDp = 24 + paddingDp = 1 +} ``` - ## Create custom fonts This is possible with only the *.ttf and *.css mapping file. And will take you 2 minutes. @@ -273,24 +304,26 @@ own custom icon font from *.svg files then you can use following tools: * [Fontastic](http://app.fontastic.me) * let me know if you find other tools. -After you got those two files, head over to the icon addon creation tool [android-iconics.mikepenz.com](http://android-iconics.mikepenz.com). +After you got those two files, head over to the icon addon creation tool [android-iconics.mikepenz.com](https://android-iconics.mikepenz.com). Enter all the information. Add the *.ttf and *.css and click the button. It will generate and download the icon font addon as zip. (this tool is local only, no files are sent to a server, you can safely use it with any icons) -# ProGuard -Exclude `R` from ProGuard to enable the font addon auto detection -```proguard --keep class .R --keep class **.R$* { - ; -} -``` -All other ProGuard rules are now bundled internally with each font. +## String fields for icons +For generating string field for each of icons of your font, you can use this simple generator: +[Android-Iconics String Generator](https://github.com/zTrap/Android-Iconics-String-Generator) -# Demo -You can try the sample application out. It's on Google Play ;) -https://play.google.com/store/apps/details?id=com.mikepenz.iconics.sample +## Android module generator +A awesome gradle plugin which can automatically fetch a font from Fontastic, and generate the Android Module for your project. +[Iconics-Font-Generator](https://github.com/ligol/IconicsFontGenerator) + +# ProGuard / R8 + +ProGuard / R8 rules are bundled internally with each font. + +# Special Contributor +- [Baptiste Lagache](https://github.com/ligol) Thanks for the gradle font module generator +- Also thanks for all the other contributors. # Credits - [Joan Zapata](https://github.com/JoanZapata) He is the creator of [Android-Iconify](https://github.com/JoanZapata/android-iconify) which gave me the idea of this project. Some core concepts and ideas were reused, but everything is written from scratch. @@ -299,13 +332,17 @@ https://play.google.com/store/apps/details?id=com.mikepenz.iconics.sample # Developed By -* Mike Penz - * [mikepenz.com](http://mikepenz.com) - - * [paypal.me/mikepenz](http://paypal.me/mikepenz) +- Mike Penz + - [mikepenz.dev](https://mikepenz.dev) - [blog.mikepenz.dev](https://blog.mikepenz.dev) - + - [paypal.me/mikepenz](http://paypal.me/mikepenz) + - [Automatic changelog generation action](https://github.com/marketplace/actions/release-changelog-builder) + +- Peter Gulko + - [github.com/zTrap](https://github.com/zTrap) # License - Copyright 2016 Mike Penz + Copyright 2021 Mike Penz Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -318,5 +355,3 @@ https://play.google.com/store/apps/details?id=com.mikepenz.iconics.sample 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. - - diff --git a/_config.yml b/_config.yml new file mode 100644 index 00000000..96139e71 --- /dev/null +++ b/_config.yml @@ -0,0 +1,8 @@ +title: Android-Iconics +description: Android-Iconics - Use any icon font, or vector (.svg) as drawable in your application. +show_downloads: true +theme: jekyll-theme-minimal + +gems: + - jekyll-mentions + - jekyll-readme-index \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 7a72fb13..6293e3ee 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,102 +1,142 @@ apply plugin: 'com.android.application' -//wrap with try and catch so the build is working even if the signing stuff is missing -try { - apply from: '../../../signing.gradle' -} catch (ex) { +apply plugin: 'kotlin-android' +apply plugin: 'kotlin-kapt' +apply plugin: 'com.mikepenz.aboutlibraries.plugin' +apply plugin: 'com.mikepenz.aboutlibraries.plugin.android' +apply from: "$rootDir/gradle/compile.groovy" + +/* + * Copyright (c) 2020 Mike Penz + * + * 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. + */ + +if (getSigningFile() != null) { + apply from: "${getSigningFile()}" } android { - compileSdkVersion rootProject.ext.compileSdkVersion - buildToolsVersion rootProject.ext.buildToolsVersion + compileSdkVersion setup.compileSdk + buildToolsVersion setup.buildTools + + namespace = "com.mikepenz.iconics.sample" defaultConfig { - minSdkVersion rootProject.ext.minSdkVersion - targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 28601 - versionName "2.8.6" - enforceUniquePackageName false + minSdkVersion setup.composeMinSdk + targetSdkVersion setup.targetSdk + versionCode release.versionCode + versionName release.versionName + + multiDexEnabled true + + setProperty("archivesBaseName", "Android Iconics-v$versionName-c$versionCode") } buildTypes { debug { applicationIdSuffix = ".debug" versionNameSuffix = "-DEBUG" - try { + if (getSigningFile() != null) { signingConfig signingConfigs.debug - } catch (ex) { } minifyEnabled false } release { - try { + if (getSigningFile() != null) { signingConfig signingConfigs.release - } catch (ex) { } zipAlignEnabled true minifyEnabled false } - - applicationVariants.all { variant -> - variant.outputs.each { output -> - def outputFile = output.outputFile - if (outputFile != null && outputFile.name.endsWith('.apk')) { - def fileName = outputFile.name.replace(".apk", "-v" + defaultConfig.versionName + "-c" + defaultConfig.versionCode + ".apk") - output.outputFile = new File(outputFile.parent, fileName) - } - } - } } - productFlavors { + + buildFeatures { + viewBinding true + dataBinding true } + lintOptions { abortOnError false } + + packagingOptions { + exclude 'META-INF/library-core_release.kotlin_module' + exclude 'META-INF/library_release.kotlin_module' + } } dependencies { - compile "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" - compile "com.android.support:recyclerview-v7:${rootProject.ext.supportLibVersion}" - compile "com.android.support:cardview-v7:${rootProject.ext.supportLibVersion}" + implementation 'androidx.multidex:multidex:2.0.1' + + implementation "androidx.appcompat:appcompat:${versions.appcompat}" + implementation "com.google.android.material:material:${versions.material}" + implementation "androidx.recyclerview:recyclerview:${versions.recyclerView}" + implementation "androidx.cardview:cardview:${versions.cardview}" - // used to base on some backwards compatible themes - // contains util classes to support various android versions, and clean up code - // comes with the awesome "Holder"-Pattern - // https://github.com/mikepenz/Materialize - compile 'com.mikepenz:materialize:1.0.2@aar' + implementation "androidx.core:core-ktx:${versions.ktx.core}" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${versions.kotlin}" // used to fill the RecyclerView with the DrawerItems // and provides single and multi selection, expandable items // https://github.com/mikepenz/FastAdapter - compile 'com.mikepenz:fastadapter:2.5.3@aar' - compile 'com.mikepenz:fastadapter-commons:2.5.3@aar' + implementation "com.mikepenz:fastadapter:${versions.fastAdapter}" + implementation "com.mikepenz:fastadapter-extensions-utils:${versions.fastAdapter}" + implementation "com.mikepenz:fastadapter-extensions-ui:${versions.fastAdapter}" + implementation "com.mikepenz:fastadapter-extensions-expandable:${versions.fastAdapter}" - //used to generate the drawer on the left - //https://github.com/mikepenz/MaterialDrawer - compile('com.mikepenz:materialdrawer:5.9.2@aar') { + // used to generating string fields for icons (sample - test/java/StringFieldGenerator.java) + // https://github.com/zTrap/Android-Iconics-String-Generator + testImplementation 'ru.ztrap.iconics:string-generator:1.0.4' + + + // used to generate the drawer on the left + // https://github.com/mikepenz/MaterialDrawer + implementation("com.mikepenz:materialdrawer:${versions.materialDrawer}") { transitive = true exclude module: "fastadapter" - exclude module: "iconics-core" + exclude module: "fastadapter-extensions-expandable" } // used to generate the Open Source section // https://github.com/mikepenz/AboutLibraries - compile('com.mikepenz:aboutlibraries:5.9.5@aar') { + implementation("com.mikepenz:aboutlibraries:${versions.aboutLibraries}") { transitive = true exclude module: "fastadapter" - exclude module: "iconics-core" } - compile project(':fontawesome-typeface-library') - compile project(':material-design-iconic-typeface-library') - compile project(':google-material-typeface-library') - compile project(':meteocons-typeface-library') - compile project(':weather-icons-typeface-library') - compile project(':octicons-typeface-library') - compile project(':community-material-typeface-library') - compile project(':entypo-typeface-library') - compile project(':typeicons-typeface-library') - compile project(':devicon-typeface-library') - compile project(':foundation-icons-typeface-library') - compile project(':ionicons-typeface-library') - compile project(':pixeden-7-stroke-typeface-library') + implementation project(':iconics-core') + implementation project(':iconics-views') + + implementation project(':community-material-typeface-library') + implementation project(':devicon-typeface-library') + implementation project(':entypo-typeface-library') + implementation project(':fontawesome-typeface-library') + implementation project(':foundation-icons-typeface-library') + implementation project(':google-material-typeface-library') + implementation project(':google-material-typeface-outlined-library') + implementation project(':google-material-typeface-rounded-library') + implementation project(':google-material-typeface-sharp-library') + implementation project(':material-symbols-typeface-outlined-library') + implementation project(':ionicons-typeface-library') + implementation project(':material-design-dx-typeface-library') + implementation project(':material-design-iconic-typeface-library') + implementation project(':meteocons-typeface-library') + implementation project(':octicons-typeface-library') + implementation project(':phosphor-typeface-library') + implementation project(':pixeden-7-stroke-typeface-library') + implementation project(':simple-icons-typeface-library') + implementation project(':typeicons-typeface-library') + implementation project(':weather-icons-typeface-library') + + testImplementation 'junit:junit:4.13.2' } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index f523c2c6..88c423c5 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,31 +1,48 @@ - - + + + - + android:roundIcon="@mipmap/ic_launcher_round" + android:theme="@style/AppTheme" + android:supportsRtl="true" + tools:ignore="GoogleAppIndexingWarning"> + - - + + - + android:theme="@style/AppTheme" + android:exported="false"/> + android:name="com.mikepenz.aboutlibraries.ui.LibsActivity" + android:label="@string/title_activity_playground" + android:theme="@style/AppTheme" + android:exported="false"/> diff --git a/app/src/main/assets/fonts/materialdrawerfont.ttf b/app/src/main/assets/font/materialdrawerfont.ttf similarity index 100% rename from app/src/main/assets/fonts/materialdrawerfont.ttf rename to app/src/main/assets/font/materialdrawerfont.ttf diff --git a/app/src/main/ic_launcher-web.png b/app/src/main/ic_launcher-web.png new file mode 100644 index 00000000..6cbdbb9a Binary files /dev/null and b/app/src/main/ic_launcher-web.png differ diff --git a/app/src/main/java/com/mikepenz/iconics/sample/AutomaticActivity.java b/app/src/main/java/com/mikepenz/iconics/sample/AutomaticActivity.java deleted file mode 100644 index 51b63f65..00000000 --- a/app/src/main/java/com/mikepenz/iconics/sample/AutomaticActivity.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2014 Mike Penz - * - * 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.mikepenz.iconics.sample; - -import android.os.Bundle; -import android.support.v4.view.LayoutInflaterCompat; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.Toolbar; -import android.widget.TextView; - -import com.mikepenz.iconics.context.IconicsLayoutInflater; - - -public class AutomaticActivity extends AppCompatActivity { - @Override - protected void onCreate(Bundle savedInstanceState) { - //define the IconicsLayoutInflater - //this is compatible with calligraphy and other libs which wrap the baseContext - LayoutInflaterCompat.setFactory(getLayoutInflater(), new IconicsLayoutInflater(getDelegate())); - - //call super.onCreate - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_automatic); - - // Handle Toolbar - final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); - setSupportActionBar(toolbar); - getSupportActionBar().setDisplayHomeAsUpEnabled(false); - - //set a new text on the textView and set the icon font on it - ((TextView) findViewById(R.id.test4)).setText("{gmd-favorite} GIF"); - } -} diff --git a/app/src/main/java/com/mikepenz/iconics/sample/CustomApplication.java b/app/src/main/java/com/mikepenz/iconics/sample/CustomApplication.java deleted file mode 100644 index f67a3336..00000000 --- a/app/src/main/java/com/mikepenz/iconics/sample/CustomApplication.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.mikepenz.iconics.sample; - - -import android.app.Application; - -import com.mikepenz.iconics.Iconics; -import com.mikepenz.iconics.sample.typeface.CustomFont; -import com.mikepenz.iconics.typeface.GenericFont; - -public class CustomApplication extends Application { - - @Override - public void onCreate() { - super.onCreate(); - - //register custom fonts like this (or also provide a font definition file) - Iconics.registerFont(new CustomFont()); - - //Generic font creation process - GenericFont gf2 = new GenericFont("GenericFont", "SampleGenericFont", "gmf", "fonts/materialdrawerfont.ttf"); - gf2.registerIcon("person", '\ue800'); - gf2.registerIcon("up", '\ue801'); - gf2.registerIcon("down", '\ue802'); - Iconics.registerFont(gf2); - } - -} diff --git a/app/src/main/java/com/mikepenz/iconics/sample/CustomApplication.kt b/app/src/main/java/com/mikepenz/iconics/sample/CustomApplication.kt new file mode 100644 index 00000000..d8e681f3 --- /dev/null +++ b/app/src/main/java/com/mikepenz/iconics/sample/CustomApplication.kt @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2019 Mike Penz + * + * 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.mikepenz.iconics.sample + +import androidx.multidex.MultiDexApplication +import com.google.android.material.color.DynamicColors +import com.mikepenz.iconics.Iconics +import com.mikepenz.iconics.sample.typeface.CustomFont +import com.mikepenz.iconics.typeface.GenericFont + +class CustomApplication : MultiDexApplication() { + override fun onCreate() { + super.onCreate() + + DynamicColors.applyToActivitiesIfAvailable(this) + + //register custom fonts like this (or also provide a font definition file) + Iconics.registerFont(CustomFont) + + //Generic font creation process + GenericFont("GenericFont", "SampleGenericFont", "gnf", "font/materialdrawerfont.ttf") + .also { + it.registerIcon("person", '\ue800') + it.registerIcon("up", '\ue801') + it.registerIcon("down", '\ue802') + Iconics.registerFont(it) + } + } +} diff --git a/app/src/main/java/com/mikepenz/iconics/sample/IconsFragment.java b/app/src/main/java/com/mikepenz/iconics/sample/IconsFragment.java deleted file mode 100644 index d9c7af7c..00000000 --- a/app/src/main/java/com/mikepenz/iconics/sample/IconsFragment.java +++ /dev/null @@ -1,238 +0,0 @@ -package com.mikepenz.iconics.sample; - -import android.content.Context; -import android.graphics.Color; -import android.os.Build; -import android.os.Bundle; -import android.support.annotation.Nullable; -import android.support.v4.app.Fragment; -import android.support.v7.widget.DefaultItemAnimator; -import android.support.v7.widget.GridLayoutManager; -import android.support.v7.widget.RecyclerView; -import android.text.TextUtils; -import android.view.LayoutInflater; -import android.view.MotionEvent; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ImageView; -import android.widget.PopupWindow; - -import com.mikepenz.fastadapter.FastAdapter; -import com.mikepenz.fastadapter.IAdapter; -import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter; -import com.mikepenz.iconics.Iconics; -import com.mikepenz.iconics.IconicsDrawable; -import com.mikepenz.iconics.sample.item.IconItem; -import com.mikepenz.iconics.typeface.ITypeface; -import com.mikepenz.materialize.util.UIUtils; - -import java.util.AbstractList; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - -/** - * Created by a557114 on 16/04/2015. - */ -public class IconsFragment extends Fragment { - - private static final String FONT_NAME = "FONT_NAME"; - private ArrayList icons = new ArrayList<>(); - private FastItemAdapter mAdapter; - private boolean randomize; - private String search; - private PopupWindow popup; - private Random random = new Random(); - - public static IconsFragment newInstance(String fontName) { - Bundle bundle = new Bundle(); - - IconsFragment fragment = new IconsFragment(); - bundle.putString(FONT_NAME, fontName); - fragment.setArguments(bundle); - - return fragment; - } - - public void randomize(boolean randomize) { - this.randomize = randomize; - if (this.mAdapter != null) { - this.mAdapter.notifyAdapterDataSetChanged(); - } - } - - @Override - public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { - return inflater.inflate(R.layout.icons_fragment, null, false); - } - - @Override - public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { - super.onViewCreated(view, savedInstanceState); - - // Init and Setup RecyclerView - RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.list); - recyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 2)); - //animator not yet working - recyclerView.setItemAnimator(new DefaultItemAnimator()); - mAdapter = new FastItemAdapter<>(); - configAdapter(); - recyclerView.setAdapter(mAdapter); - - if (getArguments() != null) { - String fontName = getArguments().getString(FONT_NAME); - - for (ITypeface iTypeface : Iconics.getRegisteredFonts(getActivity())) { - if (iTypeface.getFontName().equalsIgnoreCase(fontName)) { - if (iTypeface.getIcons() != null) { - for (String icon : iTypeface.getIcons()) { - icons.add(new IconItem(icon)); - } - mAdapter.set(icons); - break; - } - } - } - } - //filter if a search param was provided - onSearch(search); - } - - private void configAdapter() { - //our popup on touch - mAdapter.withOnTouchListener(new FastAdapter.OnTouchListener() { - @Override - public boolean onTouch(View v, MotionEvent motionEvent, IAdapter adapter, IconItem item, int position) { - int a = motionEvent.getAction(); - if (a == MotionEvent.ACTION_DOWN) { - if (popup != null && popup.isShowing()) { - popup.dismiss(); - } - IconicsDrawable icon = new IconicsDrawable(v.getContext()).icon(item.getIcon()).sizeDp(144).paddingDp(8).backgroundColor(Color.parseColor("#DDFFFFFF")).roundedCornersDp(12); - ImageView imageView = new ImageView(v.getContext()); - imageView.setImageDrawable( - icon - ); - int size = (int) UIUtils.convertDpToPixel(144, v.getContext()); - popup = new PopupWindow(imageView, size, size); - popup.showAsDropDown(v); - - //copy to clipboard - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { - android.text.ClipboardManager clipboard = (android.text.ClipboardManager) v.getContext().getSystemService(Context.CLIPBOARD_SERVICE); - clipboard.setText(icon.getIcon().getFormattedName()); - } else { - android.content.ClipboardManager clipboard = (android.content.ClipboardManager) v.getContext().getSystemService(Context.CLIPBOARD_SERVICE); - android.content.ClipData clip = android.content.ClipData.newPlainText("Android-Iconics icon", icon.getIcon().getFormattedName()); - clipboard.setPrimaryClip(clip); - } - } else if (a == MotionEvent.ACTION_UP || a == MotionEvent.ACTION_CANCEL || a == MotionEvent.ACTION_OUTSIDE) { - if (popup != null && popup.isShowing()) { - popup.dismiss(); - } - } - return false; - } - }); - - mAdapter.withOnBindViewHolderListener(new FastAdapter.OnBindViewHolderListener() { - @Override - public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position, List payloads) { - IconItem.ViewHolder holder = (IconItem.ViewHolder) viewHolder; - - //as we overwrite the default listener - mAdapter.getItem(position).bindView(holder, payloads); - - if (randomize) { - holder.image.setColorRes(getRandomColor(position)); - holder.image.setPaddingDp(random.nextInt(12)); - - holder.image.setContourWidthDp(random.nextInt(2)); - holder.image.setContourColor(getRandomColor(position - 2)); - - - int y = random.nextInt(10); - if (y % 4 == 0) { - holder.image.setBackgroundColorRes(getRandomColor(position - 4)); - holder.image.setRoundedCornersDp(2 + random.nextInt(10)); - } - } - } - - @Override - public void unBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) { - IconItem item = mAdapter.getItem(position); - if (item != null) { - item.unbindView((IconItem.ViewHolder) viewHolder); - } - } - - @Override - public void onViewAttachedToWindow(RecyclerView.ViewHolder viewHolder, int position) { - - } - - @Override - public void onViewDetachedFromWindow(RecyclerView.ViewHolder viewHolder, int position) { - - } - - @Override - public boolean onFailedToRecycleView(RecyclerView.ViewHolder viewHolder, int position) { - return false; - } - }); - } - - void onSearch(String s) { - search = s; - - if (mAdapter != null) { - if (TextUtils.isEmpty(s)) { - mAdapter.clear(); - mAdapter.setNewList(icons); - } else { - AbstractList tmpList = new ArrayList<>(); - for (IconItem icon : icons) { - if (icon.getIcon().toLowerCase().contains(s.toLowerCase())) { - tmpList.add(icon); - } - } - mAdapter.setNewList(tmpList); - } - } - } - - - private int getRandomColor(int i) { - //make sure w are > 0 - if (i < 0) { - i = i * (-1); - } - - //get a random color - if (i % 10 == 0) { - return R.color.md_black_1000; - } else if (i % 10 == 1) { - return R.color.md_blue_500; - } else if (i % 10 == 2) { - return R.color.md_green_500; - } else if (i % 10 == 3) { - return R.color.md_red_500; - } else if (i % 10 == 4) { - return R.color.md_orange_500; - } else if (i % 10 == 5) { - return R.color.md_pink_500; - } else if (i % 10 == 6) { - return R.color.md_amber_500; - } else if (i % 10 == 7) { - return R.color.md_blue_grey_500; - } else if (i % 10 == 8) { - return R.color.md_orange_500; - } else if (i % 10 == 9) { - return R.color.md_yellow_500; - } - - return 0; - } -} diff --git a/app/src/main/java/com/mikepenz/iconics/sample/IconsFragment.kt b/app/src/main/java/com/mikepenz/iconics/sample/IconsFragment.kt new file mode 100644 index 00000000..ca1c59fa --- /dev/null +++ b/app/src/main/java/com/mikepenz/iconics/sample/IconsFragment.kt @@ -0,0 +1,295 @@ +/* + * Copyright (c) 2019 Mike Penz + * + * 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.mikepenz.iconics.sample + +import android.content.ClipData +import android.content.ClipboardManager +import android.content.Context +import android.graphics.Color +import android.os.Bundle +import android.view.View +import android.widget.ImageView +import android.widget.PopupWindow +import androidx.core.os.bundleOf +import androidx.fragment.app.Fragment +import androidx.recyclerview.widget.DefaultItemAnimator +import androidx.recyclerview.widget.GridLayoutManager +import androidx.recyclerview.widget.RecyclerView +import com.mikepenz.fastadapter.adapters.FastItemAdapter +import com.mikepenz.fastadapter.listeners.OnBindViewHolderListener +import com.mikepenz.iconics.Iconics +import com.mikepenz.iconics.IconicsColor +import com.mikepenz.iconics.IconicsDrawable +import com.mikepenz.iconics.IconicsSize +import com.mikepenz.iconics.sample.databinding.IconsFragmentBinding +import com.mikepenz.iconics.sample.item.IconItem +import com.mikepenz.iconics.utils.IconicsUtils +import com.mikepenz.iconics.utils.backgroundColorRes +import com.mikepenz.iconics.utils.backgroundColorString +import com.mikepenz.iconics.utils.backgroundContourColorString +import com.mikepenz.iconics.utils.colorRes +import com.mikepenz.iconics.utils.contourColorRes +import com.mikepenz.iconics.utils.contourWidthDp +import com.mikepenz.iconics.utils.enableShadowSupport +import com.mikepenz.iconics.utils.icon +import com.mikepenz.iconics.utils.paddingDp +import com.mikepenz.iconics.utils.roundedCorners +import com.mikepenz.iconics.utils.roundedCornersDp +import com.mikepenz.iconics.utils.shadowColor +import com.mikepenz.iconics.utils.shadowDx +import com.mikepenz.iconics.utils.shadowDy +import com.mikepenz.iconics.utils.shadowRadius +import com.mikepenz.iconics.utils.sizeDp +import java.util.ArrayList +import java.util.Random +import kotlin.math.abs + +/** + * Created by a557114 on 16/04/2015. + */ +class IconsFragment : Fragment(R.layout.icons_fragment) { + private lateinit var binding: IconsFragmentBinding + + private val random = Random() + private val icons = ArrayList() + private val adapter by lazy { FastItemAdapter() } + private var randomize: Boolean = false + private var shadow: Boolean = false + private var search: String? = null + private lateinit var popup: PopupWindow + + fun randomize(randomize: Boolean) { + this.randomize = randomize + adapter.notifyAdapterDataSetChanged() + } + + fun shadow(shadow: Boolean) { + this.shadow = shadow + adapter.notifyAdapterDataSetChanged() + } + + fun respectFontBounds() { + adapter.notifyAdapterDataSetChanged() + } + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + binding = IconsFragmentBinding.bind(view) + // Init and Setup RecyclerView + binding.list.apply { + layoutManager = GridLayoutManager(activity, 2) + addItemDecoration(SpaceItemDecoration()) + //animator not yet working + itemAnimator = DefaultItemAnimator() + configAdapter() + adapter = this@IconsFragment.adapter + + addOnScrollListener(object : RecyclerView.OnScrollListener() { + override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) { + super.onScrolled(recyclerView, dx, dy) + dismissPopup() + } + }) + } + + arguments?.let { arguments -> + arguments.getString(FONT_NAME).let { fontName -> + icons.clear() + Iconics.getRegisteredFonts(context) + .firstOrNull { it.fontName.equals(fontName, true) } + ?.let { iTypeface -> + val iconItems = iTypeface.icons.asSequence().map(::IconItem) + + icons.addAll(iconItems) + adapter.set(icons) + } + } + } + //filter if a search param was provided + onSearch(search) + } + + private fun configAdapter() { + //our popup on touch + adapter.onClickListener = { v, _, item, _ -> + dismissPopup() + + val ctx = v?.context + if (ctx != null) { + val i = item.icon + if (i != null) { + val icon = IconicsDrawable(ctx).apply { + icon(i) + sizeDp = 144 + paddingDp = 8 + backgroundColorString = "#DDFFFFFF" + backgroundContourColorString = "#DD000000" + backgroundContourWidthPx = 4 + roundedCornersDp = 12 + } + + ImageView(ctx).let { imageView -> + imageView.setImageDrawable(icon) + + if (!::popup.isInitialized) { + val size = IconicsUtils.convertDpToPx(ctx, 144) + + PopupWindow(size, size).let { popup -> + this@IconsFragment.popup = popup + } + } + popup.contentView = imageView + popup.showAsDropDown(v) + } + + //copy to clipboard + (ctx.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager).run { + setPrimaryClip( + ClipData.newPlainText( + "Android-Iconics icon", + icon.icon?.formattedName + ) + ) + } + } + } + false + } + + adapter.onBindViewHolderListener = object : OnBindViewHolderListener { + + override fun onBindViewHolder(viewHolder: RecyclerView.ViewHolder, position: Int, payloads: List) { + val holder = viewHolder as IconItem.ViewHolder + + val item = adapter.getItem(position) + + if (item != null) { + //set the R.id.fastadapter_item tag of this item to the item object (can be used when retrieving the view) + holder.itemView.setTag(com.mikepenz.fastadapter.R.id.fastadapter_item, item) + + //as we overwrite the default listener + item.bindView(holder, payloads) + + holder.image.icon?.let { + if (randomize) { + it.apply { + colorRes = getRandomColor(position) + paddingDp = random.nextInt(12) + contourWidthDp = random.nextInt(2) + contourColorRes = getRandomColor(position - 2) + + val y = random.nextInt(10) + if (y % 4 == 0) { + backgroundColorRes = getRandomColor(position - 4) + roundedCorners = IconicsSize.dp((2 + random.nextInt(10))) + } + } + } + } + + if (shadow) { + holder.image.enableShadowSupport() + //holder.image.getIcon().shadowDp(1, 1, 1, Color.argb(200, 0, 0, 0)); + holder.image.icon?.applyShadow { + shadowRadius = IconicsSize.dp(1) + shadowDx = IconicsSize.dp(1) + shadowDy = IconicsSize.dp(1) + shadowColor = IconicsColor.colorInt(Color.argb(200, 0, 0, 0)) + } + } + } + } + + override fun unBindViewHolder(viewHolder: RecyclerView.ViewHolder, position: Int) { + val item = + viewHolder.itemView.getTag(com.mikepenz.fastadapter.R.id.fastadapter_item) as IconItem + item.unbindView(viewHolder as IconItem.ViewHolder) + //remove set tag's + viewHolder.itemView.setTag(com.mikepenz.fastadapter.R.id.fastadapter_item, null) + viewHolder.itemView.setTag( + com.mikepenz.fastadapter.R.id.fastadapter_item_adapter, + null + ) + } + + override fun onFailedToRecycleView( + viewHolder: RecyclerView.ViewHolder, + position: Int + ): Boolean { + return false + } + + override fun onViewAttachedToWindow( + viewHolder: RecyclerView.ViewHolder, + position: Int + ) { + } + + override fun onViewDetachedFromWindow( + viewHolder: RecyclerView.ViewHolder, + position: Int + ) { + } + } + } + + internal fun onSearch(s: String?) { + search = s + + if (s.isNullOrBlank()) { + adapter.clear() + adapter.setNewList(icons) + } else { + val tmpList = icons.filter { it.icon?.contains(s, true) == true } + adapter.setNewList(tmpList) + } + } + + private fun dismissPopup() { + if (::popup.isInitialized && popup.isShowing) { + popup.dismiss() + } + } + + private fun getRandomColor(i: Int): Int { + //get a random color + return when (abs(i) % 10) { + 0 -> android.R.color.black + 1 -> R.color.md_blue_500 + 2 -> R.color.md_green_500 + 3 -> R.color.md_red_500 + 4 -> R.color.md_orange_500 + 5 -> R.color.md_pink_500 + 6 -> R.color.md_amber_500 + 7 -> R.color.md_blue_grey_500 + 8 -> R.color.md_orange_500 + 9 -> R.color.md_yellow_500 + else -> 0 + } + } + + companion object { + + private const val FONT_NAME = "FONT_NAME" + + fun newInstance(fontName: String): IconsFragment { + return IconsFragment().apply { + arguments = bundleOf(FONT_NAME to fontName) + } + } + } +} diff --git a/app/src/main/java/com/mikepenz/iconics/sample/MainActivity.java b/app/src/main/java/com/mikepenz/iconics/sample/MainActivity.java deleted file mode 100644 index 93f17f39..00000000 --- a/app/src/main/java/com/mikepenz/iconics/sample/MainActivity.java +++ /dev/null @@ -1,250 +0,0 @@ -/* - * Copyright 2014 Mike Penz - * - * 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.mikepenz.iconics.sample; - -import android.content.Intent; -import android.graphics.Color; -import android.os.Build; -import android.os.Bundle; -import android.support.v4.app.FragmentTransaction; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.SearchView; -import android.support.v7.widget.Toolbar; -import android.text.TextUtils; -import android.view.Menu; -import android.view.MenuInflater; -import android.view.MenuItem; -import android.view.View; - -import com.mikepenz.aboutlibraries.Libs; -import com.mikepenz.aboutlibraries.LibsBuilder; -import com.mikepenz.fontawesome_typeface_library.FontAwesome; -import com.mikepenz.iconics.Iconics; -import com.mikepenz.iconics.IconicsDrawable; -import com.mikepenz.iconics.typeface.IIcon; -import com.mikepenz.iconics.typeface.ITypeface; -import com.mikepenz.material_design_iconic_typeface_library.MaterialDesignIconic; -import com.mikepenz.materialdrawer.Drawer; -import com.mikepenz.materialdrawer.DrawerBuilder; -import com.mikepenz.materialdrawer.holder.BadgeStyle; -import com.mikepenz.materialdrawer.holder.StringHolder; -import com.mikepenz.materialdrawer.model.PrimaryDrawerItem; -import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; -import com.mikepenz.materialdrawer.util.KeyboardUtil; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.Iterator; -import java.util.List; -import java.util.Random; - - -public class MainActivity extends AppCompatActivity { - - private IconsFragment mIconsFragment; - private boolean mRandomize; - private List mFonts; - private int mIdentifierGmd = 0; - private String mCurrentSearch = null; - private Drawer mDrawer; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); - - // Handle Toolbar - final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); - setSupportActionBar(toolbar); - getSupportActionBar().setDisplayHomeAsUpEnabled(false); - - //order fonts by their name - mFonts = new ArrayList<>(Iconics.getRegisteredFonts(this)); - Collections.sort(mFonts, new Comparator() { - @Override - public int compare(final ITypeface object1, final ITypeface object2) { - return object1.getFontName().compareTo(object2.getFontName()); - } - }); - - //add all icons of all registered Fonts to the list - ArrayList items = new ArrayList<>(Iconics.getRegisteredFonts(this).size()); - int count = 0; - for (ITypeface font : mFonts) { - PrimaryDrawerItem pdi = new PrimaryDrawerItem() - .withName(font.getFontName()) - .withBadge("" + font.getIcons().size()) - .withDescription(TextUtils.isEmpty(font.getAuthor()) ? font.getVersion() : font.getVersion() + " - " + font.getAuthor()) - .withBadgeStyle( - new BadgeStyle().withColorRes(R.color.md_grey_200) - ) - .withIcon( - getRandomIcon(font) - ) - .withIdentifier(count); - - if (font.getMappingPrefix().equals("gmd")) { - mIdentifierGmd = count; - } - items.add(pdi); - count++; - } - - mDrawer = new DrawerBuilder().withActivity(this) - .withToolbar(toolbar) - .withDrawerItems(items) - .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() { - @Override - public boolean onItemClick(View view, int i, IDrawerItem iDrawerItem) { - loadIcons(mFonts.get(i).getFontName()); - getSupportActionBar().setTitle(mFonts.get(i).getFontName()); - - return false; - } - }) - .withOnDrawerListener(new Drawer.OnDrawerListener() { - @Override - public void onDrawerOpened(View drawerView) { - KeyboardUtil.hideKeyboard(MainActivity.this); - } - - @Override - public void onDrawerClosed(View drawerView) { - } - - @Override - public void onDrawerSlide(View drawerView, float slideOffset) { - } - }) - .withFireOnInitialOnClick(true) - .withSelectedItem(mIdentifierGmd) - .build(); - } - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - // Inflate the menu items for use in the action bar - MenuInflater inflater = getMenuInflater(); - inflater.inflate(R.menu.menu_main, menu); - - // - menu.findItem(R.id.search).setIcon(new IconicsDrawable(this, MaterialDesignIconic.Icon.gmi_search).color(Color.WHITE).sizeDp(24).respectFontBounds(true)); - - if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { - final SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView(); - searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { - - @Override - public boolean onQueryTextSubmit(String s) { - search(s); - return true; - } - - - @Override - public boolean onQueryTextChange(String s) { - search(s); - return true; - } - - - private void search(String s) { - mCurrentSearch = s; - - if (mDrawer != null) { - int count = 0; - for (ITypeface font : mFonts) { - int foundCount = 0; - if (font.getIcons() != null) { - for (String icon : font.getIcons()) { - if (icon.toLowerCase().contains(s.toLowerCase())) { - foundCount++; - } - } - } - mDrawer.updateBadge(count, new StringHolder(foundCount + "")); - - count++; - } - } - - //filter out the current fragment - if (mIconsFragment != null) mIconsFragment.onSearch(s); - } - }); - } else { - menu.findItem(R.id.search).setVisible(false); - } - - MenuItem menuItem = menu.findItem(R.id.action_opensource); - menuItem.setIcon(new IconicsDrawable(this, FontAwesome.Icon.faw_github).actionBar().color(Color.WHITE)); - return super.onCreateOptionsMenu(menu); - } - - private IIcon getRandomIcon(ITypeface typeface) { - int random = new Random().nextInt(typeface.getIcons().size()); - Iterator icons = typeface.getIcons().iterator(); - for (int i = 1; i < random; i++) { - icons.next(); - } - return typeface.getIcon(icons.next()); - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - // Handle presses on the action bar items - switch (item.getItemId()) { - case R.id.action_randomize: - item.setChecked(!item.isChecked()); - mIconsFragment.randomize(item.isChecked()); - mRandomize = item.isChecked(); - return true; - case R.id.action_opensource: - new LibsBuilder() - .withFields(R.string.class.getFields()) - .withLicenseShown(true) - .withActivityTitle(getString(R.string.action_opensource)) - .withActivityTheme(R.style.AppTheme) - .withActivityStyle(Libs.ActivityStyle.LIGHT_DARK_TOOLBAR) - .start(MainActivity.this); - - return true; - case R.id.action_playground: - startActivity(new Intent(getApplicationContext(), PlaygroundActivity.class)); - return true; - case R.id.action_automatic: - startActivity(new Intent(getApplicationContext(), AutomaticActivity.class)); - return true; - case R.id.action_old_automatic: - startActivity(new Intent(getApplicationContext(), OldAutomaticActivity.class)); - return true; - default: - return super.onOptionsItemSelected(item); - } - } - - - private void loadIcons(String fontName) { - FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); - mIconsFragment = IconsFragment.newInstance(fontName); - mIconsFragment.randomize(mRandomize); - mIconsFragment.onSearch(mCurrentSearch); - ft.replace(R.id.content, mIconsFragment); - ft.commit(); - } -} diff --git a/app/src/main/java/com/mikepenz/iconics/sample/MainActivity.kt b/app/src/main/java/com/mikepenz/iconics/sample/MainActivity.kt new file mode 100644 index 00000000..67c27d86 --- /dev/null +++ b/app/src/main/java/com/mikepenz/iconics/sample/MainActivity.kt @@ -0,0 +1,247 @@ +/* + * Copyright (c) 2019 Mike Penz + * + * 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.mikepenz.iconics.sample + +import android.app.Activity +import android.content.Intent +import android.content.res.ColorStateList +import android.content.res.Configuration +import android.graphics.Color +import android.os.Bundle +import android.view.Menu +import android.view.MenuItem +import android.view.View +import android.view.inputmethod.InputMethodManager +import androidx.appcompat.app.ActionBarDrawerToggle +import androidx.appcompat.app.AppCompatActivity +import androidx.appcompat.widget.SearchView +import androidx.drawerlayout.widget.DrawerLayout +import com.mikepenz.aboutlibraries.LibsBuilder +import com.mikepenz.iconics.Iconics +import com.mikepenz.iconics.IconicsDrawable +import com.mikepenz.iconics.sample.databinding.ActivityMainBinding +import com.mikepenz.iconics.sample.utils.getThemeColor +import com.mikepenz.iconics.typeface.IIcon +import com.mikepenz.iconics.typeface.ITypeface +import com.mikepenz.iconics.typeface.library.fontawesome.FontAwesomeBrand +import com.mikepenz.iconics.typeface.library.materialdesigniconic.MaterialDesignIconic +import com.mikepenz.iconics.utils.actionBar +import com.mikepenz.iconics.utils.colorInt +import com.mikepenz.iconics.utils.paddingDp +import com.mikepenz.iconics.utils.sizeDp +import com.mikepenz.materialdrawer.holder.BadgeStyle +import com.mikepenz.materialdrawer.holder.ColorHolder +import com.mikepenz.materialdrawer.holder.ImageHolder +import com.mikepenz.materialdrawer.holder.StringHolder +import com.mikepenz.materialdrawer.model.PrimaryDrawerItem +import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem +import com.mikepenz.materialdrawer.util.updateBadge +import java.util.Random + +class MainActivity : AppCompatActivity() { + private lateinit var binding: ActivityMainBinding + private lateinit var actionBarDrawerToggle: ActionBarDrawerToggle + + private lateinit var fonts: List + private var iconsFragment: IconsFragment? = null + private var isRandomize: Boolean = false + private var isShadowEnabled: Boolean = false + private var identifierGmd = 0 + private var currentSearch: String? = null + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + binding = ActivityMainBinding.inflate(layoutInflater).also { + setContentView(it.root) + } + + // Handle Toolbar + setSupportActionBar(binding.toolbar) + supportActionBar?.setDisplayHomeAsUpEnabled(true) + supportActionBar?.setHomeButtonEnabled(true) + + actionBarDrawerToggle = ActionBarDrawerToggle(this, binding.root, binding.toolbar, R.string.material_drawer_open, R.string.material_drawer_close) + + //order fonts by their name + fonts = Iconics.getRegisteredFonts(this).sortedBy { it.fontName } + + //add all icons of all registered Fonts to the list + val items = ArrayList>(fonts.size) + fonts.forEachIndexed { index, font -> + val pdi = PrimaryDrawerItem().apply { + name = StringHolder(font.fontName) + badge = StringHolder(font.icons.size.toString()) + description = StringHolder(if (font.author.isEmpty()) font.version else font.version + " - " + font.author) + identifier = index.toLong() + badgeStyle = BadgeStyle().apply { + color = ColorHolder.fromColor(getThemeColor(R.attr.colorBackgroundFloating)) + textColor = ColorHolder.fromColor(getThemeColor(R.attr.colorOnBackground)) + } + icon = ImageHolder(IconicsDrawable(this@MainActivity, getRandomIcon(font)).apply { + colorList = ColorStateList.valueOf(getThemeColor(android.R.attr.textColorPrimary)) + sizeDp = 24 + paddingDp = 1 + }) + } + if (font.mappingPrefix == "gmd") { + identifierGmd = index + } + items.add(pdi) + } + + binding.root.addDrawerListener(object : DrawerLayout.DrawerListener { + override fun onDrawerStateChanged(newState: Int) {} + + override fun onDrawerSlide(drawerView: View, slideOffset: Float) {} + + override fun onDrawerClosed(drawerView: View) {} + + override fun onDrawerOpened(drawerView: View) { + val inputMethodManager: InputMethodManager = getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager + inputMethodManager.hideSoftInputFromWindow(currentFocus?.windowToken, 0) + } + }) + binding.slider.onDrawerItemClickListener = { _, _, position -> + fonts[position].fontName.also { + loadIcons(it) + supportActionBar?.title = it + } + false + } + binding.slider.itemAdapter.add(items) + binding.slider.setSelection(identifierGmd.toLong(), true) + } + + override fun onConfigurationChanged(newConfig: Configuration) { + super.onConfigurationChanged(newConfig) + actionBarDrawerToggle.onConfigurationChanged(newConfig) + } + + override fun onPostCreate(savedInstanceState: Bundle?) { + super.onPostCreate(savedInstanceState) + actionBarDrawerToggle.syncState() + } + + override fun onCreateOptionsMenu(menu: Menu): Boolean { + // Inflate the menu items for use in the action bar + menuInflater.inflate(R.menu.menu_main, menu) + + // + menu.findItem(R.id.search).icon = IconicsDrawable(this, MaterialDesignIconic.Icon.gmi_search).apply { + colorInt = Color.WHITE + sizeDp = 24 + respectFontBounds = true + } + + val searchView = menu.findItem(R.id.search).actionView as SearchView + searchView.setOnQueryTextListener(object : SearchView.OnQueryTextListener { + + override fun onQueryTextSubmit(s: String): Boolean { + search(s) + return true + } + + override fun onQueryTextChange(s: String): Boolean { + search(s) + return true + } + + private fun search(s: String) { + currentSearch = s + + fonts.forEachIndexed { index, font -> + val foundCount = font.icons.count { it.contains(s, true) } + binding.slider.updateBadge(index.toLong(), StringHolder(foundCount.toString())) + } + + //filter out the current fragment + iconsFragment?.onSearch(s) + } + }) + + val menuItem = menu.findItem(R.id.action_opensource) + menuItem.icon = IconicsDrawable(this, FontAwesomeBrand.Icon.fab_github).apply { + actionBar() + colorInt = Color.WHITE + } + + menu.findItem(R.id.action_respect_bounds).isChecked = Iconics.respectFontBoundsDefault + + return super.onCreateOptionsMenu(menu) + } + + private fun getRandomIcon(typeface: ITypeface): IIcon { + val random = Random().nextInt(typeface.icons.size) + val icon = typeface.icons.toList()[random] + return typeface.getIcon(icon) + } + + override fun onOptionsItemSelected(item: MenuItem): Boolean { + if (actionBarDrawerToggle.onOptionsItemSelected(item)) { + return true + } + + // Handle presses on the action bar items + when (item.itemId) { + R.id.action_randomize -> { + item.isChecked = !item.isChecked + iconsFragment?.randomize(item.isChecked) + isRandomize = item.isChecked + return true + } + R.id.action_shadow -> { + item.isChecked = !item.isChecked + iconsFragment?.shadow(item.isChecked) + isShadowEnabled = item.isChecked + return true + } + R.id.action_respect_bounds -> { + item.isChecked = !item.isChecked + iconsFragment?.respectFontBounds() + Iconics.respectFontBoundsDefault = item.isChecked + return true + } + R.id.action_opensource -> { + LibsBuilder() + .withLicenseShown(true) + .withActivityTitle(getString(R.string.action_opensource)) + .withEdgeToEdge(true) + .start(this@MainActivity) + + return true + } + R.id.action_playground -> { + startActivity(Intent(applicationContext, PlaygroundActivity::class.java)) + return true + } + else -> return super.onOptionsItemSelected(item) + } + } + + private fun loadIcons(fontName: String) { + supportFragmentManager.beginTransaction().also { + val iconsFragment = IconsFragment.newInstance(fontName).apply { + randomize(isRandomize) + shadow(isShadowEnabled) + onSearch(currentSearch) + } + it.replace(R.id.content, iconsFragment) + it.commit() + this.iconsFragment = iconsFragment + } + } +} diff --git a/app/src/main/java/com/mikepenz/iconics/sample/OldAutomaticActivity.java b/app/src/main/java/com/mikepenz/iconics/sample/OldAutomaticActivity.java deleted file mode 100644 index 901e9d4e..00000000 --- a/app/src/main/java/com/mikepenz/iconics/sample/OldAutomaticActivity.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2014 Mike Penz - * - * 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.mikepenz.iconics.sample; - -import android.app.Activity; -import android.content.Context; -import android.os.Bundle; -import android.widget.TextView; - -import com.mikepenz.iconics.context.IconicsContextWrapper; - - -public class OldAutomaticActivity extends Activity { - @Override - protected void attachBaseContext(Context newBase) { - //not compatible with Calligraphy - super.attachBaseContext(IconicsContextWrapper.wrap(newBase)); - } - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_automatic); - - //set a new text on the textView and set the icon font on it - ((TextView) findViewById(R.id.test4)).setText("{gmd-favorite} GIF"); - } -} diff --git a/app/src/main/java/com/mikepenz/iconics/sample/PlaygroundActivity.java b/app/src/main/java/com/mikepenz/iconics/sample/PlaygroundActivity.java deleted file mode 100644 index 70a530c5..00000000 --- a/app/src/main/java/com/mikepenz/iconics/sample/PlaygroundActivity.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright 2014 Mike Penz - * - * 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.mikepenz.iconics.sample; - -import android.app.Activity; -import android.content.Context; -import android.graphics.Color; -import android.graphics.drawable.StateListDrawable; -import android.os.Bundle; -import android.text.Spannable; -import android.text.SpannableString; -import android.text.style.BackgroundColorSpan; -import android.text.style.DynamicDrawableSpan; -import android.text.style.ForegroundColorSpan; -import android.text.style.ImageSpan; -import android.text.style.RelativeSizeSpan; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ArrayAdapter; -import android.widget.Button; -import android.widget.ImageButton; -import android.widget.ImageView; -import android.widget.ListView; -import android.widget.TextView; - -import com.mikepenz.fontawesome_typeface_library.FontAwesome; -import com.mikepenz.iconics.Iconics; -import com.mikepenz.iconics.IconicsArrayBuilder; -import com.mikepenz.iconics.IconicsDrawable; -import com.mikepenz.octicons_typeface_library.Octicons; - - -public class PlaygroundActivity extends Activity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_playground); - - //Show how to style the text of an existing TextView - TextView tv1 = (TextView) findViewById(R.id.test1); - new Iconics.IconicsBuilder().ctx(this) - .style(new ForegroundColorSpan(Color.WHITE), new BackgroundColorSpan(Color.BLACK), new RelativeSizeSpan(2f)) - .styleFor("faw-adjust", new BackgroundColorSpan(Color.RED), new ForegroundColorSpan(Color.parseColor("#33000000")), new RelativeSizeSpan(2f)) - .on(tv1) - .build(); - - //You can also do some advanced stuff like setting an image within a text - TextView tv2 = (TextView) findViewById(R.id.test5); - SpannableString sb = new SpannableString(tv2.getText()); - IconicsDrawable d = new IconicsDrawable(this, FontAwesome.Icon.faw_android).sizeDp(48).paddingDp(4); - sb.setSpan(new ImageSpan(d, DynamicDrawableSpan.ALIGN_BOTTOM), 1, 2, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); - tv2.setText(sb); - - //Set the icon of an ImageView (or something else) as drawable - ImageView iv2 = (ImageView) findViewById(R.id.test2); - iv2.setImageDrawable(new IconicsDrawable(this, FontAwesome.Icon.faw_thumbs_o_up).sizeDp(48).color(Color.parseColor("#aaFF0000")).contourWidthDp(1)); - - //Set the icon of an ImageView (or something else) as bitmap - ImageView iv3 = (ImageView) findViewById(R.id.test3); - iv3.setImageBitmap(new IconicsDrawable(this, FontAwesome.Icon.faw_android).sizeDpX(48).sizeDpY(32).paddingDp(4).roundedCornersDp(8).color(Color.parseColor("#deFF0000")).toBitmap()); - - //Show how to style the text of an existing button - Button b4 = (Button) findViewById(R.id.test4); - new Iconics.IconicsBuilder().ctx(this) - .style(new BackgroundColorSpan(Color.BLACK)) - .style(new RelativeSizeSpan(2f)) - .style(new ForegroundColorSpan(Color.WHITE)) - .on(b4) - .build(); - - //Show how to style the text of an existing button - ImageButton b6 = (ImageButton) findViewById(R.id.test6); - StateListDrawable iconStateListDrawable = new StateListDrawable(); - iconStateListDrawable.addState(new int[]{android.R.attr.state_pressed}, new IconicsDrawable(this, FontAwesome.Icon.faw_thumbs_o_up).sizeDp(48).color(Color.parseColor("#aaFF0000")).contourWidthDp(1)); - iconStateListDrawable.addState(new int[]{}, new IconicsDrawable(this, FontAwesome.Icon.faw_thumbs_o_up).sizeDp(48).color(Color.parseColor("#aa00FF00")).contourWidthDp(2)); - b6.setImageDrawable(iconStateListDrawable); - - ListView listView = (ListView) findViewById(R.id.list); - - IconicsDrawable iconicsDrawableBase = new IconicsDrawable(this).actionBar().color(Color.GREEN).backgroundColor(Color.RED); - IconicsDrawable[] array = new IconicsArrayBuilder(iconicsDrawableBase) - .add(FontAwesome.Icon.faw_android) - .add(Octicons.Icon.oct_octoface) - .add("Hallo") - .add('A') - .add(";)") - .build(); - - listView.setAdapter(new IconsAdapter(this, array)); - - } - - private class IconsAdapter extends ArrayAdapter { - - private final LayoutInflater mInflater; - - public IconsAdapter(Context context, IconicsDrawable[] objects) { - super(context, 0, objects); - mInflater = LayoutInflater.from(context); - } - - @Override - public View getView(int position, View convertView, ViewGroup parent) { - View v = mInflater.inflate(R.layout.row_icon_array, parent, false); - - ImageView icon = (ImageView) v.findViewById(android.R.id.icon); - icon.setImageDrawable(getItem(position)); - - return v; - } - } -} diff --git a/app/src/main/java/com/mikepenz/iconics/sample/PlaygroundActivity.kt b/app/src/main/java/com/mikepenz/iconics/sample/PlaygroundActivity.kt new file mode 100644 index 00000000..cd4c731c --- /dev/null +++ b/app/src/main/java/com/mikepenz/iconics/sample/PlaygroundActivity.kt @@ -0,0 +1,243 @@ +/* + * Copyright (c) 2019 Mike Penz + * + * 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.mikepenz.iconics.sample + +import android.annotation.SuppressLint +import android.content.Context +import android.graphics.Color +import android.graphics.Typeface +import android.graphics.drawable.StateListDrawable +import android.os.Bundle +import android.text.Spannable +import android.text.SpannableString +import android.text.SpannableStringBuilder +import android.text.style.BackgroundColorSpan +import android.text.style.DynamicDrawableSpan +import android.text.style.ForegroundColorSpan +import android.text.style.ImageSpan +import android.text.style.RelativeSizeSpan +import android.text.style.StyleSpan +import android.view.LayoutInflater +import android.view.Menu +import android.view.MenuItem +import android.view.View +import android.view.ViewGroup +import android.widget.ArrayAdapter +import android.widget.ImageView +import androidx.appcompat.app.AppCompatActivity +import androidx.databinding.BindingAdapter +import androidx.databinding.DataBindingUtil +import com.mikepenz.iconics.Iconics +import com.mikepenz.iconics.IconicsArrayBuilder +import com.mikepenz.iconics.IconicsDrawable +import com.mikepenz.iconics.IconicsSize +import com.mikepenz.iconics.sample.databinding.ActivityPlaygroundBinding +import com.mikepenz.iconics.sample.utils.getThemeColor +import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial +import com.mikepenz.iconics.typeface.library.fontawesome.FontAwesome +import com.mikepenz.iconics.typeface.library.fontawesome.FontAwesomeBrand +import com.mikepenz.iconics.typeface.library.octicons.Octicons +import com.mikepenz.iconics.utils.actionBar +import com.mikepenz.iconics.utils.backgroundColorInt +import com.mikepenz.iconics.utils.colorInt +import com.mikepenz.iconics.utils.colorString +import com.mikepenz.iconics.utils.contourWidthDp +import com.mikepenz.iconics.utils.paddingDp +import com.mikepenz.iconics.utils.parseXmlAndSetIconicsDrawables +import com.mikepenz.iconics.utils.roundedCornersDp +import com.mikepenz.iconics.utils.sizeDp +import com.mikepenz.iconics.utils.sizeX +import com.mikepenz.iconics.utils.sizeY + +class PlaygroundActivity : AppCompatActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + val binding: ActivityPlaygroundBinding = + DataBindingUtil.setContentView(this, R.layout.activity_playground) + + // Handle Toolbar + setSupportActionBar(binding.toolbar) + supportActionBar?.setDisplayHomeAsUpEnabled(true) + + val themeValue1 = getThemeColor(android.R.attr.textColorPrimary) + val themeValue2 = getThemeColor(android.R.attr.textColorPrimaryInverse) + + //Show how to style the text of an existing TextView + Iconics.Builder() + .style( + ForegroundColorSpan(themeValue2), + BackgroundColorSpan(themeValue1), + RelativeSizeSpan(2f) + ) + .styleFor( + "faw-adjust", + BackgroundColorSpan(Color.RED), + ForegroundColorSpan(Color.parseColor("#33000000")), + RelativeSizeSpan(2f) + ) + .on(binding.test1) + .build() + + //You can also do some advanced stuff like setting an image within a text + val sb = SpannableString(binding.test5.text) + val d = IconicsDrawable(this, FontAwesomeBrand.Icon.fab_android).apply { + sizeDp = 48 + paddingDp = 4 + colorInt = themeValue1 + } + + sb.setSpan( + ImageSpan(d, DynamicDrawableSpan.ALIGN_BOTTOM), + 1, + 2, + Spannable.SPAN_EXCLUSIVE_EXCLUSIVE + ) + binding.test5.text = sb + + //Set the icon of an ImageView (or something else) as drawable + binding.test2.setImageDrawable( + IconicsDrawable(this, FontAwesome.Icon.faw_thumbs_up).apply { + sizeDp = 48 + colorString = "#aaFF0000" + contourWidthDp = 1 + } + ) + + //Set the icon of an ImageView (or something else) as bitmap + binding.test3.setImageBitmap( + IconicsDrawable(this, FontAwesomeBrand.Icon.fab_android).apply { + sizeX = IconicsSize.dp(48) + sizeY = IconicsSize.dp(32) + paddingDp = 4 + roundedCornersDp = 8 + colorString = "#deFF0000" + }.toBitmap() + ) + + //Show how to style the text of an existing button + Iconics.Builder() + .style(BackgroundColorSpan(themeValue1)) + .style(RelativeSizeSpan(2f)) + .style(ForegroundColorSpan(themeValue2)) + .on(binding.test4) + .build() + + //Show how to style the text of an existing button + val iconStateListDrawable = StateListDrawable() + iconStateListDrawable.addState( + intArrayOf(android.R.attr.state_pressed), + IconicsDrawable(this, FontAwesome.Icon.faw_thumbs_up).apply { + sizeDp = 48 + colorString = "#aaFF0000" + contourWidthDp = 1 + } + ) + iconStateListDrawable.addState( + intArrayOf(), + IconicsDrawable(this, FontAwesome.Icon.faw_thumbs_up).apply { + sizeDp = 48 + colorString = "#aa00FF00" + contourWidthDp = 2 + } + ) + binding.test6.setImageDrawable(iconStateListDrawable) + + val span = SpannableStringBuilder(binding.test10.text) + span.setSpan( + StyleSpan(Typeface.BOLD), + 3, + 6, + Spannable.SPAN_EXCLUSIVE_EXCLUSIVE + ) + span.insert(20, "{fab-android}") + binding.test10.text = span + binding.test10.text = binding.test10.text + + val iconicsDrawableBase = IconicsDrawable(this).apply { + actionBar() + colorInt = Color.GREEN + backgroundColorInt = Color.RED + } + val array = IconicsArrayBuilder(iconicsDrawableBase) + .add(FontAwesomeBrand.Icon.fab_android) + .add(Octicons.Icon.oct_octoface) + .add("Hallo") + .add('A') + .add(";)") + .build() + binding.list.adapter = IconsAdapter(this, array) + + // Create icons for menu_navigation + val planningIcon = IconicsDrawable(this, CommunityMaterial.Icon2.cmd_history) + val homeIcon = IconicsDrawable(this, CommunityMaterial.Icon2.cmd_home) + val calendarIcon = IconicsDrawable(this, CommunityMaterial.Icon.cmd_calendar) + + // Set icons + binding.navigation.menu.apply { + findItem(R.id.navigation_home).icon = planningIcon + findItem(R.id.navigation_dashboard).icon = homeIcon + findItem(R.id.navigation_notifications).icon = calendarIcon + } + + // Automatically process all icons in menu + binding.navigationAuto.menu.parseXmlAndSetIconicsDrawables(this, R.menu.menu_playground) + } + + override fun onOptionsItemSelected(item: MenuItem): Boolean { + if (item.itemId == android.R.id.home) { + onBackPressed() + return true + } + return super.onOptionsItemSelected(item) + } + + override fun onCreateOptionsMenu(menu: Menu): Boolean { + + menuInflater.inflate(R.menu.menu_playground, menu) + return super.onCreateOptionsMenu(menu) + } + + private inner class IconsAdapter internal constructor( + context: Context, + objects: Array + ) : ArrayAdapter(context, 0, objects) { + + private val inflater: LayoutInflater = LayoutInflater.from(context) + + @SuppressLint("ViewHolder") + override fun getView(position: Int, convertView: View?, parent: ViewGroup): View { + val v = inflater.inflate(R.layout.row_icon_array, parent, false) + val icon = v.findViewById(android.R.id.icon) + icon.setImageDrawable(getItem(position)) + return v + } + } + + companion object { + @BindingAdapter("iconicsSrc", "iconicsColor") + @JvmStatic + fun loadIconicsImage(view: ImageView, name: String, color: Int?) { + view.setImageDrawable(IconicsDrawable(view.context, name).apply { + if (color != null) { + colorInt = color + } + }) + } + } +} diff --git a/app/src/main/java/com/mikepenz/iconics/sample/SpaceItemDecoration.kt b/app/src/main/java/com/mikepenz/iconics/sample/SpaceItemDecoration.kt new file mode 100644 index 00000000..0814440e --- /dev/null +++ b/app/src/main/java/com/mikepenz/iconics/sample/SpaceItemDecoration.kt @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2019 Mike Penz + * + * 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.mikepenz.iconics.sample + +import android.graphics.Rect +import android.view.View +import androidx.recyclerview.widget.RecyclerView +import com.mikepenz.iconics.utils.IconicsUtils + +/** + * @author pa.gulko zTrap (28.10.2017) + */ +class SpaceItemDecoration : RecyclerView.ItemDecoration() { + override fun getItemOffsets( + outRect: Rect, + view: View, + parent: RecyclerView, + state: RecyclerView.State + ) { + val space = IconicsUtils.convertDpToPx(view.context, 8) + val position = parent.getChildAdapterPosition(view) + if (position < 2) { + outRect.top = space + } + if ((position + 1) % 2 == 0) { + outRect.right = space + } + outRect.left = space + outRect.bottom = outRect.left + } +} diff --git a/app/src/main/java/com/mikepenz/iconics/sample/item/IconItem.java b/app/src/main/java/com/mikepenz/iconics/sample/item/IconItem.java deleted file mode 100644 index 7f9f3d39..00000000 --- a/app/src/main/java/com/mikepenz/iconics/sample/item/IconItem.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.mikepenz.iconics.sample.item; - -import android.graphics.Color; -import android.support.v7.widget.RecyclerView; -import android.view.View; -import android.widget.TextView; - -import com.mikepenz.fastadapter.items.AbstractItem; -import com.mikepenz.iconics.sample.R; -import com.mikepenz.iconics.view.IconicsImageView; - -import java.util.List; - -/** - * Created by mikepenz on 26.07.16. - */ - -public class IconItem extends AbstractItem { - private String icon; - - public String getIcon() { - return icon; - } - - public IconItem withIcon(String icon) { - this.icon = icon; - return this; - } - - public IconItem(String icon) { - this.icon = icon; - } - - @Override - public int getType() { - return R.id.item_row_icon; - } - - @Override - public int getLayoutRes() { - return R.layout.row_icon; - } - - @Override - public void bindView(ViewHolder holder, List payloads) { - super.bindView(holder, payloads); - - holder.image.setIcon(icon); - holder.name.setText(icon); - - holder.image.setColor(Color.BLACK); - holder.image.setPaddingDp(0); - holder.image.setContourWidthDp(0); - holder.image.setContourColor(Color.TRANSPARENT); - holder.image.setBackgroundColor(Color.TRANSPARENT); - - //as we want to respect the bounds of the original font in the icon list - holder.image.getIcon().respectFontBounds(true); - } - - @Override - public ViewHolder getViewHolder(View v) { - return new ViewHolder(v); - } - - public static class ViewHolder extends RecyclerView.ViewHolder { - public TextView name; - public IconicsImageView image; - - - ViewHolder(final View itemView) { - super(itemView); - name = (TextView) itemView.findViewById(R.id.name); - image = (IconicsImageView) itemView.findViewById(R.id.icon); - } - } -} diff --git a/app/src/main/java/com/mikepenz/iconics/sample/item/IconItem.kt b/app/src/main/java/com/mikepenz/iconics/sample/item/IconItem.kt new file mode 100644 index 00000000..925e4953 --- /dev/null +++ b/app/src/main/java/com/mikepenz/iconics/sample/item/IconItem.kt @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2019 Mike Penz + * + * 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.mikepenz.iconics.sample.item + +import android.graphics.Color +import android.view.View +import android.widget.TextView +import androidx.recyclerview.widget.RecyclerView +import com.mikepenz.fastadapter.items.AbstractItem +import com.mikepenz.iconics.IconicsDrawable +import com.mikepenz.iconics.sample.R +import com.mikepenz.iconics.sample.utils.getThemeColor +import com.mikepenz.iconics.utils.colorInt +import com.mikepenz.iconics.utils.contourColorInt +import com.mikepenz.iconics.utils.contourWidthDp +import com.mikepenz.iconics.utils.paddingDp +import com.mikepenz.iconics.view.IconicsImageView + +/** + * Created by mikepenz on 26.07.16. + */ + +class IconItem(icon: String) : AbstractItem() { + var icon: String? = null + private set + + fun withIcon(icon: String): IconItem { + this.icon = icon + return this + } + + init { + this.icon = icon + } + + override val layoutRes: Int + get() = R.layout.row_icon + + override val type: Int + get() = R.id.item_row_icon + + override fun bindView(holder: ViewHolder, payloads: List) { + super.bindView(holder, payloads) + + val ctx = holder.image.context + val icon = IconicsDrawable(ctx, this.icon ?: " ") + holder.image.icon = icon + holder.name.text = this.icon + + icon.apply { + colorInt = ctx.getThemeColor(android.R.attr.textColorPrimary) + paddingDp = 0 + contourWidthDp = 0 + contourColorInt = Color.TRANSPARENT + respectFontBounds = true + } + + holder.image.setBackgroundColor(Color.TRANSPARENT) + } + + override fun getViewHolder(v: View): ViewHolder { + return ViewHolder(v) + } + + class ViewHolder internal constructor(itemView: View) : RecyclerView.ViewHolder(itemView) { + var name: TextView = itemView.findViewById(R.id.name) + var image: IconicsImageView = itemView.findViewById(R.id.icon) + } +} diff --git a/app/src/main/java/com/mikepenz/iconics/sample/typeface/CustomFont.java b/app/src/main/java/com/mikepenz/iconics/sample/typeface/CustomFont.java deleted file mode 100644 index ad61a9dc..00000000 --- a/app/src/main/java/com/mikepenz/iconics/sample/typeface/CustomFont.java +++ /dev/null @@ -1,142 +0,0 @@ -package com.mikepenz.iconics.sample.typeface; - -import android.content.Context; -import android.graphics.Typeface; - -import com.mikepenz.iconics.typeface.IIcon; -import com.mikepenz.iconics.typeface.ITypeface; - -import java.util.Collection; -import java.util.HashMap; -import java.util.LinkedList; - -/** - * Created by mikepenz on 01.11.14. - */ -public class CustomFont implements ITypeface { - private static final String TTF_FILE = "fontello.ttf"; - - private static Typeface typeface = null; - - private static HashMap mChars; - - @Override - public IIcon getIcon(String key) { - return Icon.valueOf(key); - } - - @Override - public HashMap getCharacters() { - if (mChars == null) { - HashMap aChars = new HashMap(); - for (Icon v : Icon.values()) { - aChars.put(v.name(), v.character); - } - mChars = aChars; - } - - return mChars; - } - - @Override - public String getMappingPrefix() { - return "fon"; - } - - @Override - public String getFontName() { - return "CustomFont"; - } - - @Override - public String getVersion() { - return "1.0.0"; - } - - @Override - public int getIconCount() { - return mChars.size(); - } - - @Override - public Collection getIcons() { - Collection icons = new LinkedList(); - - for (Icon value : Icon.values()) { - icons.add(value.name()); - } - - return icons; - } - - - @Override - public String getAuthor() { - return "SampleCustomFont"; - } - - @Override - public String getUrl() { - return ""; - } - - @Override - public String getDescription() { - return ""; - } - - @Override - public String getLicense() { - return ""; - } - - @Override - public String getLicenseUrl() { - return ""; - } - - @Override - public Typeface getTypeface(Context context) { - if (typeface == null) { - try { - typeface = Typeface.createFromAsset(context.getAssets(), "fonts/" + TTF_FILE); - } catch (Exception e) { - return null; - } - } - return typeface; - } - - public static enum Icon implements IIcon { - fon_test1('\ue800'), - fon_test2('\ue801'); - - char character; - - Icon(char character) { - this.character = character; - } - - public String getFormattedName() { - return "{" + name() + "}"; - } - - public char getCharacter() { - return character; - } - - public String getName() { - return name(); - } - - // remember the typeface so we can use it later - private static ITypeface typeface; - - public ITypeface getTypeface() { - if (typeface == null) { - typeface = new CustomFont(); - } - return typeface; - } - } -} diff --git a/app/src/main/java/com/mikepenz/iconics/sample/typeface/CustomFont.kt b/app/src/main/java/com/mikepenz/iconics/sample/typeface/CustomFont.kt new file mode 100644 index 00000000..15146fde --- /dev/null +++ b/app/src/main/java/com/mikepenz/iconics/sample/typeface/CustomFont.kt @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2019 Mike Penz + * + * 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.mikepenz.iconics.sample.typeface + +import com.mikepenz.iconics.sample.R +import com.mikepenz.iconics.typeface.IIcon +import com.mikepenz.iconics.typeface.ITypeface +import java.util.LinkedList + +/** + * Created by mikepenz on 01.11.14. + */ +@Suppress("EnumEntryName") +object CustomFont : ITypeface { + + override val fontRes: Int + get() = R.font.fontello + + override val characters: Map by lazy { + Icon.values().associate { it.name to it.character } + } + + override val mappingPrefix: String + get() = "fon" + + override val fontName: String + get() = "CustomFont" + + override val version: String + get() = "1.0.0" + + override val iconCount: Int + get() = characters.size + + override val icons: List + get() = characters.keys.toCollection(LinkedList()) + + override val author: String + get() = "SampleCustomFont" + + override val url: String + get() = "" + + override val description: String + get() = "" + + override val license: String + get() = "" + + override val licenseUrl: String + get() = "" + + override fun getIcon(key: String): IIcon = Icon.valueOf(key) + + enum class Icon constructor(override val character: Char) : IIcon { + fon_test1('\ue800'), + fon_test2('\ue801'); + + override val typeface: ITypeface by lazy { CustomFont } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/mikepenz/iconics/sample/utils/getThemeColor.kt b/app/src/main/java/com/mikepenz/iconics/sample/utils/getThemeColor.kt new file mode 100644 index 00000000..b91a9bd9 --- /dev/null +++ b/app/src/main/java/com/mikepenz/iconics/sample/utils/getThemeColor.kt @@ -0,0 +1,18 @@ +package com.mikepenz.iconics.sample.utils + +import android.content.Context +import android.util.TypedValue +import androidx.core.content.ContextCompat + +fun Context.getThemeColor(attr: Int): Int { + val tv = TypedValue() + return if (this.theme.resolveAttribute(attr, tv, true)) { + if (tv.resourceId != 0) { + ContextCompat.getColor(this, tv.resourceId) + } else { + tv.data + } + } else { + 0 + } +} \ No newline at end of file diff --git a/app/src/main/res/color/color_states_bg.xml b/app/src/main/res/color/color_states_bg.xml new file mode 100644 index 00000000..c3b98aa1 --- /dev/null +++ b/app/src/main/res/color/color_states_bg.xml @@ -0,0 +1,21 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/color/color_states_bg_contour.xml b/app/src/main/res/color/color_states_bg_contour.xml new file mode 100644 index 00000000..d60ddb03 --- /dev/null +++ b/app/src/main/res/color/color_states_bg_contour.xml @@ -0,0 +1,21 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/color/color_states_bottom_navigation_icons.xml b/app/src/main/res/color/color_states_bottom_navigation_icons.xml new file mode 100644 index 00000000..1a7d6fbd --- /dev/null +++ b/app/src/main/res/color/color_states_bottom_navigation_icons.xml @@ -0,0 +1,21 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/color/color_states_contour.xml b/app/src/main/res/color/color_states_contour.xml new file mode 100644 index 00000000..31548cac --- /dev/null +++ b/app/src/main/res/color/color_states_contour.xml @@ -0,0 +1,21 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/color/color_states_icon.xml b/app/src/main/res/color/color_states_icon.xml new file mode 100644 index 00000000..d3827a74 --- /dev/null +++ b/app/src/main/res/color/color_states_icon.xml @@ -0,0 +1,21 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable-hdpi/ic_launcher.png b/app/src/main/res/drawable-hdpi/ic_launcher.png deleted file mode 100644 index 1eba6475..00000000 Binary files a/app/src/main/res/drawable-hdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/main/res/drawable-v21/button_rect_list_normal.xml b/app/src/main/res/drawable-v21/button_rect_list_normal.xml index 8b3ae899..676d1f29 100755 --- a/app/src/main/res/drawable-v21/button_rect_list_normal.xml +++ b/app/src/main/res/drawable-v21/button_rect_list_normal.xml @@ -1,12 +1,28 @@ - + + + - + \ No newline at end of file diff --git a/app/src/main/res/drawable-v24/gmd_favorite.xml b/app/src/main/res/drawable-v24/gmd_favorite.xml new file mode 100644 index 00000000..f6e739ec --- /dev/null +++ b/app/src/main/res/drawable-v24/gmd_favorite.xml @@ -0,0 +1,8 @@ + + \ No newline at end of file diff --git a/app/src/main/res/drawable-xhdpi/ic_launcher.png b/app/src/main/res/drawable-xhdpi/ic_launcher.png deleted file mode 100644 index 36a78ef8..00000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_launcher.png b/app/src/main/res/drawable-xxhdpi/ic_launcher.png deleted file mode 100644 index b0c32097..00000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_launcher.png b/app/src/main/res/drawable-xxxhdpi/ic_launcher.png deleted file mode 100644 index 9abcf4d6..00000000 Binary files a/app/src/main/res/drawable-xxxhdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/main/res/drawable/button_rect_list_normal.xml b/app/src/main/res/drawable/button_rect_list_normal.xml index 5e7a5029..c44481ba 100644 --- a/app/src/main/res/drawable/button_rect_list_normal.xml +++ b/app/src/main/res/drawable/button_rect_list_normal.xml @@ -1,6 +1,22 @@ + + - - - + android:exitFadeDuration="@android:integer/config_mediumAnimTime"> + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/gmd_favorite.png b/app/src/main/res/drawable/gmd_favorite.png new file mode 100644 index 00000000..48e29ad7 Binary files /dev/null and b/app/src/main/res/drawable/gmd_favorite.png differ diff --git a/app/src/main/assets/fonts/fontello.ttf b/app/src/main/res/font/fontello.ttf similarity index 100% rename from app/src/main/assets/fonts/fontello.ttf rename to app/src/main/res/font/fontello.ttf diff --git a/app/src/main/res/layout/activity_automatic.xml b/app/src/main/res/layout/activity_automatic.xml deleted file mode 100644 index 937a1933..00000000 --- a/app/src/main/res/layout/activity_automatic.xml +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -