diff --git a/README.md b/README.md index 56b66223..dd6e9c3e 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ ## Latest releases 🛠 -- Kotlin Next Gen | [v5.3.2](https://github.com/mikepenz/Android-Iconics/tree/v5.3.2) +- Kotlin Next Gen | [v5.3.3](https://github.com/mikepenz/Android-Iconics/tree/v5.3.3) - Kotlin | [v4.0.2](https://github.com/mikepenz/Android-Iconics/tree/v4.0.2) - Java AndroidX | [v3.2.5](https://github.com/mikepenz/Android-Iconics/tree/v3.2.5) - Java Appcompat | [v3.0.4](https://github.com/mikepenz/Android-Iconics/tree/v3.0.4) @@ -84,7 +84,7 @@ implementation 'com.mikepenz:material-design-iconic-typeface:2.2.0.8-kotlin@aar' implementation 'com.mikepenz:fontawesome-typeface:5.9.0.2-kotlin@aar' implementation 'com.mikepenz:octicons-typeface:11.1.0.0-kotlin@aar' implementation 'com.mikepenz:meteocons-typeface:1.1.0.7-kotlin@aar' -implementation 'com.mikepenz:community-material-typeface:5.8.55.0-kotlin@aar' // note 5.3.45.1 alphabetically sorts, and merges in 3 sections +implementation 'com.mikepenz:community-material-typeface:6.4.95.0-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.7-kotlin@aar' implementation 'com.mikepenz:typeicons-typeface:2.0.7.7-kotlin@aar' implementation 'com.mikepenz:entypo-typeface:1.0.0.7-kotlin@aar' @@ -96,6 +96,10 @@ implementation 'com.mikepenz:material-design-icons-dx-typeface:5.0.1.2-kotlin@aa implementation 'com.mikepenz:phosphor-typeface:1.0.0.0-kotlin@aar' ``` +## Note + +⚠️ The fonts use the `jetpack startup` library to automatically register themself. If `jetpack startup` is disabled, it is required to manually register the fonts. Please find additional details in the [Register fonts](#register-fonts). + # Usage ## Use as drawable diff --git a/app/build.gradle b/app/build.gradle index ceb0c50d..3deb36d0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -34,7 +34,7 @@ android { buildToolsVersion setup.buildTools defaultConfig { - minSdkVersion setup.minSdk + minSdkVersion setup.composeMinSdk targetSdkVersion setup.targetSdk versionCode release.versionCode versionName release.versionName diff --git a/app/src/main/java/com/mikepenz/iconics/sample/CustomApplication.kt b/app/src/main/java/com/mikepenz/iconics/sample/CustomApplication.kt index 5416f617..d8e681f3 100644 --- a/app/src/main/java/com/mikepenz/iconics/sample/CustomApplication.kt +++ b/app/src/main/java/com/mikepenz/iconics/sample/CustomApplication.kt @@ -17,6 +17,7 @@ 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 @@ -25,6 +26,8 @@ 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) diff --git a/app/src/main/java/com/mikepenz/iconics/sample/MainActivity.kt b/app/src/main/java/com/mikepenz/iconics/sample/MainActivity.kt index 82c85b16..67c27d86 100644 --- a/app/src/main/java/com/mikepenz/iconics/sample/MainActivity.kt +++ b/app/src/main/java/com/mikepenz/iconics/sample/MainActivity.kt @@ -31,10 +31,10 @@ import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.widget.SearchView import androidx.drawerlayout.widget.DrawerLayout import com.mikepenz.aboutlibraries.LibsBuilder -import com.mikepenz.aboutlibraries.util.getThemeColor 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 @@ -217,7 +217,6 @@ class MainActivity : AppCompatActivity() { } R.id.action_opensource -> { LibsBuilder() - .withFields(R.string::class.java.fields) .withLicenseShown(true) .withActivityTitle(getString(R.string.action_opensource)) .withEdgeToEdge(true) diff --git a/app/src/main/java/com/mikepenz/iconics/sample/PlaygroundActivity.kt b/app/src/main/java/com/mikepenz/iconics/sample/PlaygroundActivity.kt index 0edf4628..cd4c731c 100644 --- a/app/src/main/java/com/mikepenz/iconics/sample/PlaygroundActivity.kt +++ b/app/src/main/java/com/mikepenz/iconics/sample/PlaygroundActivity.kt @@ -25,7 +25,12 @@ import android.os.Bundle import android.text.Spannable import android.text.SpannableString import android.text.SpannableStringBuilder -import android.text.style.* +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 @@ -36,12 +41,12 @@ import android.widget.ImageView import androidx.appcompat.app.AppCompatActivity import androidx.databinding.BindingAdapter import androidx.databinding.DataBindingUtil -import com.mikepenz.aboutlibraries.util.getThemeColor 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 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 index c076aee5..925e4953 100644 --- a/app/src/main/java/com/mikepenz/iconics/sample/item/IconItem.kt +++ b/app/src/main/java/com/mikepenz/iconics/sample/item/IconItem.kt @@ -20,10 +20,10 @@ import android.graphics.Color import android.view.View import android.widget.TextView import androidx.recyclerview.widget.RecyclerView -import com.mikepenz.aboutlibraries.util.getThemeColor 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 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/layout/activity_playground.xml b/app/src/main/res/layout/activity_playground.xml index ba661afe..85573213 100644 --- a/app/src/main/res/layout/activity_playground.xml +++ b/app/src/main/res/layout/activity_playground.xml @@ -25,6 +25,7 @@ -