mirror of
https://github.com/kuba2k2/NavLib.git
synced 2025-01-17 22:06:44 -06:00
Update Gradle and libraries, migrate Iconics to v5
This commit is contained in:
parent
642d297cd0
commit
43fc2f10df
4
.idea/gradle.xml
generated
4
.idea/gradle.xml
generated
@ -1,8 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="testRunner" value="PLATFORM" />
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="modules">
|
||||
@ -10,10 +12,10 @@
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
<option value="$PROJECT_DIR$/navlib" />
|
||||
<option value="$PROJECT_DIR$/navlib-font" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
<option name="testRunner" value="PLATFORM" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
|
30
.idea/jarRepositories.xml
generated
Normal file
30
.idea/jarRepositories.xml
generated
Normal file
@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="BintrayJCenter" />
|
||||
<option name="name" value="BintrayJCenter" />
|
||||
<option name="url" value="https://jcenter.bintray.com/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="maven" />
|
||||
<option name="name" value="maven" />
|
||||
<option name="url" value="https://jitpack.io" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="Google" />
|
||||
<option name="name" value="Google" />
|
||||
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@ -5,7 +5,7 @@
|
||||
<configuration PROFILE_NAME="Debug" CONFIG_NAME="Debug" />
|
||||
</configurations>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="JDK" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="false" project-jdk-name="JDK" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
1
.idea/runConfigurations.xml
generated
1
.idea/runConfigurations.xml
generated
@ -3,6 +3,7 @@
|
||||
<component name="RunConfigurationProducerService">
|
||||
<option name="ignoredProducers">
|
||||
<set>
|
||||
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
|
||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
|
||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
|
||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
|
||||
|
@ -34,18 +34,19 @@ android {
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
implementation "androidx.appcompat:appcompat:${versions.appcompat}"
|
||||
implementation "androidx.legacy:legacy-support-v4:${versions.legacy}"
|
||||
api("com.github.kuba2k2:MaterialDrawer:${versions.materialdrawer}") {
|
||||
implementation "androidx.appcompat:appcompat:1.2.0"
|
||||
implementation "androidx.legacy:legacy-support-v4:1.0.0"
|
||||
api("com.github.kuba2k2:MaterialDrawer:817e45765c") {
|
||||
exclude module: 'library-iconics'
|
||||
}
|
||||
implementation "com.mikepenz:iconics-core:${versions.iconics}"
|
||||
implementation "com.mikepenz:iconics-views:${versions.iconics}"
|
||||
implementation "com.mikepenz:community-material-typeface:${versions.font_cmd}@aar"
|
||||
implementation "androidx.core:core-ktx:${versions.ktx}"
|
||||
implementation "androidx.constraintlayout:constraintlayout:${versions.constraintLayout}"
|
||||
implementation "com.google.android.material:material:${versions.material}"
|
||||
implementation "pl.droidsonroids.gif:android-gif-drawable:${versions.gifdrawable}"
|
||||
implementation "com.mikepenz:iconics-core:5.2.8"
|
||||
implementation "com.mikepenz:iconics-views:5.2.8"
|
||||
implementation "com.mikepenz:community-material-typeface:5.8.55.0-kotlin@aar"
|
||||
implementation "androidx.core:core-ktx:1.3.2"
|
||||
implementation "androidx.constraintlayout:constraintlayout:2.0.4"
|
||||
implementation "com.google.android.material:material:1.3.0"
|
||||
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
|
||||
// implementation "pl.droidsonroids.gif:android-gif-drawable:1.2.15"
|
||||
implementation 'androidx.multidex:multidex:2.0.1'
|
||||
implementation project(":navlib")
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import android.graphics.PorterDuffColorFilter
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.widget.ImageView
|
||||
import androidx.core.graphics.drawable.RoundedBitmapDrawableFactory
|
||||
import pl.droidsonroids.gif.GifDrawable
|
||||
import pl.szczodrzynski.navlib.ImageHolder
|
||||
import pl.szczodrzynski.navlib.crc16
|
||||
import pl.szczodrzynski.navlib.drawer.IDrawerProfile
|
||||
@ -57,7 +56,7 @@ class DrawerProfile(
|
||||
/* if you want to use GIFs as profile drawables, add
|
||||
implementation "pl.droidsonroids.gif:android-gif-drawable:${versions.gifdrawable}"
|
||||
*/
|
||||
return GifDrawable(image ?: "")
|
||||
return null//GifDrawable(image ?: "")
|
||||
}
|
||||
else {
|
||||
return RoundedBitmapDrawableFactory.create(context.resources, image ?: "")
|
||||
|
@ -8,10 +8,10 @@ import android.view.Gravity
|
||||
import android.view.View
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.mikepenz.iconics.IconicsColor
|
||||
import com.mikepenz.iconics.IconicsDrawable
|
||||
import com.mikepenz.iconics.IconicsSize
|
||||
import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
|
||||
import com.mikepenz.iconics.utils.actionBar
|
||||
import com.mikepenz.iconics.utils.paddingDp
|
||||
import com.mikepenz.materialdrawer.holder.StringHolder
|
||||
import com.mikepenz.materialdrawer.model.ProfileSettingDrawerItem
|
||||
import com.mikepenz.materialdrawer.model.interfaces.*
|
||||
@ -27,6 +27,7 @@ import pl.szczodrzynski.navlib.bottomsheet.NavBottomSheet.Companion.SORT_MODE_DE
|
||||
import pl.szczodrzynski.navlib.bottomsheet.NavBottomSheet.Companion.TOGGLE_GROUP_SORTING_ORDER
|
||||
import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetPrimaryItem
|
||||
import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetSeparatorItem
|
||||
import pl.szczodrzynski.navlib.colorAttr
|
||||
import pl.szczodrzynski.navlib.drawer.items.DrawerPrimaryItem
|
||||
import pl.szczodrzynski.navlib.getColorFromAttr
|
||||
import pl.szczodrzynski.navlib.withIcon
|
||||
@ -211,7 +212,7 @@ class MainActivity : AppCompatActivity() {
|
||||
navView.bottomSheet.enableDragToOpen = isChecked
|
||||
}
|
||||
|
||||
navView.bottomBar.fabIcon = CommunityMaterial.Icon2.cmd_pencil
|
||||
navView.bottomBar.fabIcon = CommunityMaterial.Icon3.cmd_pencil
|
||||
navView.bottomBar.fabExtendedText = "Compose"
|
||||
navView.bottomBar.fabExtended = false
|
||||
|
||||
@ -239,13 +240,13 @@ class MainActivity : AppCompatActivity() {
|
||||
.withSelected(true)
|
||||
.withIdentifier(1)
|
||||
.withBadgeStyle(badgeStyle)
|
||||
.withIcon(CommunityMaterial.Icon.cmd_google_home),
|
||||
.withIcon(CommunityMaterial.Icon2.cmd_google_home),
|
||||
|
||||
DrawerPrimaryItem()
|
||||
.withIdentifier(2)
|
||||
.withName("Settings")
|
||||
.withBadgeStyle(badgeStyle)
|
||||
.withIcon(CommunityMaterial.Icon2.cmd_settings),
|
||||
.withIcon(CommunityMaterial.Icon.cmd_cog_outline),
|
||||
|
||||
DrawerPrimaryItem().withName("iOS")
|
||||
.withIdentifier(60)
|
||||
@ -263,7 +264,7 @@ class MainActivity : AppCompatActivity() {
|
||||
.withIdentifier(62)
|
||||
.withIsHiddenInMiniDrawer(true)
|
||||
.withBadgeStyle(badgeStyle)
|
||||
.withIcon(CommunityMaterial.Icon.cmd_fingerprint),
|
||||
.withIcon(CommunityMaterial.Icon2.cmd_fingerprint),
|
||||
|
||||
DrawerPrimaryItem().withName("HDR enable/disable")
|
||||
.withTag(0)
|
||||
@ -276,12 +277,12 @@ class MainActivity : AppCompatActivity() {
|
||||
.withDescription("Because we all hate ads")
|
||||
.withIdentifier(64)
|
||||
.withBadgeStyle(badgeStyle)
|
||||
.withIcon(CommunityMaterial.Icon.cmd_adchoices),
|
||||
.withIcon(CommunityMaterial.Icon2.cmd_google_ads),
|
||||
|
||||
DrawerPrimaryItem().withName("Wonderful browsing experience and this is a long string")
|
||||
.withIdentifier(65)
|
||||
.withBadgeStyle(badgeStyle)
|
||||
.withIcon(CommunityMaterial.Icon2.cmd_internet_explorer)
|
||||
.withIcon(CommunityMaterial.Icon3.cmd_microsoft_internet_explorer)
|
||||
)
|
||||
|
||||
//setAccountHeaderBackground("/sdcard/ban.gif")
|
||||
@ -303,10 +304,11 @@ class MainActivity : AppCompatActivity() {
|
||||
.withName("Add Account")
|
||||
.withDescription("Add new GitHub Account")
|
||||
.withIcon(
|
||||
IconicsDrawable(context, CommunityMaterial.Icon2.cmd_plus)
|
||||
.actionBar()
|
||||
.padding { IconicsSize.dp(5) }
|
||||
.color { IconicsColor.colorInt(getColorFromAttr(context, R.attr.materialDrawerPrimaryText)) }
|
||||
IconicsDrawable(context, CommunityMaterial.Icon3.cmd_plus).apply {
|
||||
actionBar()
|
||||
paddingDp = 5
|
||||
colorAttr(context, R.attr.materialDrawerPrimaryText)
|
||||
}
|
||||
)
|
||||
.withOnDrawerItemClickListener { v, item, position ->
|
||||
Toast.makeText(context, "Add account", Toast.LENGTH_SHORT).show()
|
||||
@ -314,7 +316,7 @@ class MainActivity : AppCompatActivity() {
|
||||
},
|
||||
ProfileSettingDrawerItem()
|
||||
.withName("Manage Account")
|
||||
.withIcon(CommunityMaterial.Icon2.cmd_settings)
|
||||
.withIcon(CommunityMaterial.Icon.cmd_cog_outline)
|
||||
)
|
||||
|
||||
drawerItemSelectedListener = { id, position, drawerItem ->
|
||||
@ -363,7 +365,7 @@ class MainActivity : AppCompatActivity() {
|
||||
this += BottomSheetPrimaryItem(true)
|
||||
.withId(1)
|
||||
.withTitle("Compose")
|
||||
.withIcon(CommunityMaterial.Icon2.cmd_pencil)
|
||||
.withIcon(CommunityMaterial.Icon3.cmd_pencil)
|
||||
.withOnClickListener(View.OnClickListener {
|
||||
Toast.makeText(this@MainActivity, "Compose message", Toast.LENGTH_SHORT).show()
|
||||
})
|
||||
@ -371,7 +373,7 @@ class MainActivity : AppCompatActivity() {
|
||||
this += BottomSheetPrimaryItem(false)
|
||||
.withId(3)
|
||||
.withTitle("Synchronise")
|
||||
.withIcon(CommunityMaterial.Icon2.cmd_sync)
|
||||
.withIcon(CommunityMaterial.Icon3.cmd_sync)
|
||||
.withOnClickListener(View.OnClickListener {
|
||||
Toast.makeText(this@MainActivity, "Synchronising...", Toast.LENGTH_SHORT).show()
|
||||
})
|
||||
@ -403,7 +405,7 @@ class MainActivity : AppCompatActivity() {
|
||||
textInputEnabled = true
|
||||
textInputHint = "Search"
|
||||
textInputHelperText = "0 messages found"
|
||||
textInputIcon = CommunityMaterial.Icon2.cmd_magnify
|
||||
textInputIcon = CommunityMaterial.Icon3.cmd_magnify
|
||||
textInputChangedListener = object : NavBottomSheet.OnTextInputChangedListener {
|
||||
override fun onTextChanged(s: String, start: Int, before: Int, count: Int) {
|
||||
navView.toolbar.subtitle = s
|
||||
|
47
build.gradle
47
build.gradle
@ -2,7 +2,7 @@
|
||||
|
||||
buildscript {
|
||||
ext {
|
||||
kotlin_version = '1.3.61'
|
||||
kotlin_version = '1.4.30'
|
||||
|
||||
release = [
|
||||
// major.minor.patch.rc.beta
|
||||
@ -11,46 +11,9 @@ buildscript {
|
||||
]
|
||||
|
||||
setup = [
|
||||
compileSdk: 28,
|
||||
buildTools: "28.0.3",
|
||||
compileSdk: 30,
|
||||
minSdk : 16,
|
||||
targetSdk : 28
|
||||
]
|
||||
|
||||
versions = [
|
||||
gradleAndroid : "4.0.0-beta03",
|
||||
|
||||
kotlin : ext.kotlin_version,
|
||||
ktx : "1.2.0",
|
||||
|
||||
androidX : '1.0.0',
|
||||
annotation : '1.1.0',
|
||||
recyclerView : '1.2.0-alpha01',
|
||||
material : '1.2.0-alpha05',
|
||||
appcompat : '1.2.0-alpha03',
|
||||
constraintLayout : '2.0.0-beta4',
|
||||
cardview : '1.0.0',
|
||||
gridLayout : '1.0.0',
|
||||
navigation : "2.0.0",
|
||||
navigationFragment: "1.0.0",
|
||||
legacy : "1.0.0",
|
||||
|
||||
room : "2.2.5",
|
||||
lifecycle : "2.2.0",
|
||||
work : "2.3.4",
|
||||
|
||||
firebase : '17.2.2',
|
||||
firebasemessaging: "20.1.3",
|
||||
play_services : "17.0.0",
|
||||
|
||||
materialdialogs : "0.9.6.0",
|
||||
materialdrawer : "817e45765c367034b03046aaea6e95eeabcb40e9",
|
||||
iconics : "4.0.1",
|
||||
font_cmd : "3.5.95.1-kotlin",
|
||||
|
||||
gifdrawable : "1.2.15",
|
||||
|
||||
retrofit : "2.6.4"
|
||||
targetSdk : 30
|
||||
]
|
||||
}
|
||||
|
||||
@ -59,8 +22,8 @@ buildscript {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath "com.android.tools.build:gradle:${versions.gradleAndroid}"
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}"
|
||||
classpath "com.android.tools.build:gradle:4.2.0-beta06"
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
|
||||
|
1
navlib-font/.gitignore
vendored
Normal file
1
navlib-font/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/build
|
@ -24,8 +24,8 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
dataBinding {
|
||||
enabled = true
|
||||
buildFeatures {
|
||||
dataBinding = true
|
||||
}
|
||||
|
||||
packagingOptions {
|
||||
@ -36,24 +36,21 @@ android {
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
|
||||
implementation "androidx.annotation:annotation:${versions.annotation}"
|
||||
implementation "androidx.appcompat:appcompat:${versions.appcompat}"
|
||||
implementation "androidx.constraintlayout:constraintlayout:${versions.constraintLayout}"
|
||||
implementation "androidx.core:core-ktx:${versions.ktx}"
|
||||
implementation "androidx.gridlayout:gridlayout:1.0.0"
|
||||
implementation "androidx.legacy:legacy-support-v4:${versions.legacy}"
|
||||
implementation "androidx.recyclerview:recyclerview:${versions.recyclerView}"
|
||||
implementation "com.google.android.material:material:${versions.material}"
|
||||
implementation "androidx.appcompat:appcompat:1.2.0"
|
||||
implementation "androidx.core:core-ktx:1.3.2"
|
||||
implementation "androidx.recyclerview:recyclerview:1.1.0"
|
||||
implementation "com.google.android.material:material:1.3.0"
|
||||
|
||||
api("com.github.kuba2k2:MaterialDrawer:${versions.materialdrawer}") {
|
||||
api("com.github.kuba2k2:MaterialDrawer:817e45765c") {
|
||||
exclude module: 'library-iconics'
|
||||
}
|
||||
api "com.mikepenz:community-material-typeface:${versions.font_cmd}@aar"
|
||||
api "com.mikepenz:iconics-core:${versions.iconics}"
|
||||
implementation "com.mikepenz:materialize:1.2.1"
|
||||
api "com.mikepenz:iconics-core:5.2.8"
|
||||
implementation "com.mikepenz:itemanimators:1.1.0"
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${versions.kotlin}"
|
||||
implementation "pl.droidsonroids.gif:android-gif-drawable:${versions.gifdrawable}"
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
compileOnly "pl.droidsonroids.gif:android-gif-drawable:1.2.15"
|
||||
api "com.mikepenz:materialize:1.2.1"
|
||||
|
||||
implementation 'com.balysv:material-ripple:1.0.2'
|
||||
implementation "com.balysv:material-ripple:1.0.2"
|
||||
|
||||
implementation project(":navlib-font")
|
||||
}
|
||||
|
@ -11,9 +11,9 @@ import android.widget.ImageView
|
||||
import androidx.annotation.ColorInt
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.appcompat.content.res.AppCompatResources
|
||||
import com.mikepenz.iconics.IconicsColor
|
||||
import com.mikepenz.iconics.IconicsDrawable
|
||||
import com.mikepenz.iconics.typeface.IIcon
|
||||
import com.mikepenz.iconics.utils.actionBar
|
||||
import com.mikepenz.iconics.utils.paddingDp
|
||||
import com.mikepenz.iconics.utils.sizeDp
|
||||
import com.mikepenz.materialdrawer.util.DrawerImageLoader
|
||||
@ -99,10 +99,11 @@ open class ImageHolder : com.mikepenz.materialdrawer.holder.ImageHolder {
|
||||
val uri = uri
|
||||
|
||||
when {
|
||||
ii != null -> icon = IconicsDrawable(ctx, ii).apply {
|
||||
color(IconicsColor.colorList(iconColor))
|
||||
sizeDp(24)
|
||||
paddingDp(paddingDp)
|
||||
ii != null -> icon = IconicsDrawable(ctx).apply {
|
||||
this.icon = ii
|
||||
colorList = iconColor
|
||||
sizeDp = 24
|
||||
this.paddingDp = paddingDp
|
||||
}
|
||||
iconRes != -1 -> icon = AppCompatResources.getDrawable(ctx, iconRes)
|
||||
uri != null -> try {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package pl.szczodrzynski.navlib
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.graphics.drawable.LayerDrawable
|
||||
import android.util.AttributeSet
|
||||
@ -13,8 +14,7 @@ import com.google.android.material.floatingactionbutton.ExtendedFloatingActionBu
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
import com.mikepenz.iconics.IconicsDrawable
|
||||
import com.mikepenz.iconics.typeface.IIcon
|
||||
import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
|
||||
import com.mikepenz.iconics.utils.colorInt
|
||||
import com.mikepenz.iconics.typeface.library.navlibfont.NavLibFont
|
||||
import com.mikepenz.iconics.utils.sizeDp
|
||||
import pl.szczodrzynski.navlib.bottomsheet.NavBottomSheet
|
||||
import pl.szczodrzynski.navlib.drawer.NavDrawer
|
||||
@ -89,11 +89,19 @@ class NavBottomBar : BottomAppBar {
|
||||
/**
|
||||
* Set the FAB's icon.
|
||||
*/
|
||||
var fabIcon: IIcon = CommunityMaterial.Icon.cmd_android
|
||||
var fabIcon: IIcon? = null
|
||||
set(value) {
|
||||
field = value
|
||||
fabView?.setImageDrawable(IconicsDrawable(context, value).colorInt(R.attr.colorFabIcon).sizeDp(24))
|
||||
fabExtendedView?.icon = IconicsDrawable(context, value).colorInt(R.attr.colorFabIcon).sizeDp(24)
|
||||
fabView?.setImageDrawable(IconicsDrawable(context).apply {
|
||||
icon = value
|
||||
colorAttr(context, R.attr.colorFabIcon)
|
||||
sizeDp = 24
|
||||
})
|
||||
fabExtendedView?.icon = IconicsDrawable(context).apply {
|
||||
icon = value
|
||||
colorAttr(context, R.attr.colorFabIcon)
|
||||
sizeDp = 24
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Set the ExtendedFAB's text.
|
||||
@ -112,6 +120,7 @@ class NavBottomBar : BottomAppBar {
|
||||
fabExtendedView?.setOnClickListener(onClickListener)
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
private fun create(attrs: AttributeSet?, defStyle: Int) {
|
||||
setOnTouchListener { _, event ->
|
||||
if (bottomSheet?.enable != true || bottomSheet?.enableDragToOpen != true)
|
||||
@ -125,20 +134,21 @@ class NavBottomBar : BottomAppBar {
|
||||
val icon = ContextCompat.getDrawable(context, R.drawable.ic_menu_badge) as LayerDrawable?
|
||||
icon?.apply {
|
||||
mutate()
|
||||
setDrawableByLayerId(R.id.ic_menu, IconicsDrawable(context)
|
||||
.icon(CommunityMaterial.Icon2.cmd_menu)
|
||||
.sizeDp(20)
|
||||
.colorInt(getColorFromAttr(context, R.attr.colorOnPrimary)))
|
||||
setDrawableByLayerId(R.id.ic_menu, IconicsDrawable(context).apply {
|
||||
this.icon = NavLibFont.Icon.nav_menu
|
||||
sizeDp = 20
|
||||
colorAttr(context, R.attr.colorOnPrimary)
|
||||
})
|
||||
setDrawableByLayerId(R.id.ic_badge, BadgeDrawable(context))
|
||||
}
|
||||
navigationIcon = icon
|
||||
|
||||
menu.add(0, -1, 0, "Menu")
|
||||
.setIcon(
|
||||
IconicsDrawable(context)
|
||||
.icon(CommunityMaterial.Icon.cmd_dots_vertical)
|
||||
.sizeDp(20)
|
||||
.colorInt(getColorFromAttr(context, R.attr.colorOnPrimary)))
|
||||
.setIcon(IconicsDrawable(context).apply {
|
||||
this.icon = NavLibFont.Icon.nav_dots_vertical
|
||||
sizeDp = 20
|
||||
colorAttr(context, R.attr.colorOnPrimary)
|
||||
})
|
||||
.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS)
|
||||
|
||||
setNavigationOnClickListener {
|
||||
|
@ -5,13 +5,12 @@ import android.content.res.Configuration.ORIENTATION_PORTRAIT
|
||||
import android.content.res.Resources
|
||||
import android.graphics.Color
|
||||
import android.os.Build.VERSION.SDK_INT
|
||||
import android.os.Build.VERSION_CODES.*
|
||||
import android.os.Build.VERSION_CODES
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import android.view.View.*
|
||||
import android.view.Window
|
||||
import android.view.WindowManager
|
||||
import android.widget.Toast
|
||||
import androidx.core.graphics.ColorUtils
|
||||
import androidx.core.view.ViewCompat
|
||||
import com.mikepenz.materialize.util.KeyboardUtil
|
||||
@ -185,12 +184,12 @@ class SystemBarsUtil(private val activity: Activity) {
|
||||
// #3 SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN makes the activity not resize when keyboard is open
|
||||
// Samsung TouchWiz - app will go fullscreen. There is a problem though, see #3.
|
||||
var targetAppFullscreen = false
|
||||
if (SDK_INT >= KITKAT) {
|
||||
if (SDK_INT >= VERSION_CODES.KITKAT) {
|
||||
targetAppFullscreen = true
|
||||
}
|
||||
|
||||
|
||||
if (SDK_INT in KITKAT until LOLLIPOP) {
|
||||
if (SDK_INT in VERSION_CODES.KITKAT until VERSION_CODES.LOLLIPOP) {
|
||||
// API 19-20 (KitKat 4.4) - set gradient status bar
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
|
||||
// take FallbackGradient color
|
||||
@ -198,7 +197,7 @@ class SystemBarsUtil(private val activity: Activity) {
|
||||
// disable darker even if [statusBarDarker] == true BUT gradient fallback is not COLOR_HALF_TRANSPARENT
|
||||
//targetStatusBarDarker = targetStatusBarDarker && targetStatusBarFallbackGradient == COLOR_HALF_TRANSPARENT
|
||||
}
|
||||
else if (SDK_INT >= LOLLIPOP) {
|
||||
else if (SDK_INT >= VERSION_CODES.LOLLIPOP) {
|
||||
// API 21+ (Lollipop 5.0+) - set transparent status bar
|
||||
if (statusBarTranslucent) {
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
|
||||
@ -206,17 +205,17 @@ class SystemBarsUtil(private val activity: Activity) {
|
||||
else {
|
||||
window.statusBarColor = Color.TRANSPARENT
|
||||
}
|
||||
if (SDK_INT < M && targetStatusBarLight) {
|
||||
if (SDK_INT < VERSION_CODES.M && targetStatusBarLight) {
|
||||
// take FallbackLight color
|
||||
targetStatusBarMode = TARGET_MODE_LIGHT
|
||||
}
|
||||
}
|
||||
if (SDK_INT >= M && targetStatusBarLight) {
|
||||
if (SDK_INT >= VERSION_CODES.M && targetStatusBarLight) {
|
||||
// API 23+ (Marshmallow 6.0+) - set the status bar icons to dark color if [statusBarLight] is true
|
||||
window.decorView.systemUiVisibility = window.decorView.systemUiVisibility or SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
|
||||
}
|
||||
// FOR SAMSUNG/SONY DEVICES (TouchWiz 4.1-4.3)
|
||||
if (SDK_INT < KITKAT) {
|
||||
if (SDK_INT < VERSION_CODES.KITKAT) {
|
||||
val libs = activity.packageManager.systemSharedLibraryNames
|
||||
var reflect: String? = null
|
||||
// TODO galaxy s3 - opening keyboard does not resize activity if fullscreen
|
||||
@ -282,20 +281,20 @@ class SystemBarsUtil(private val activity: Activity) {
|
||||
|
||||
// TODO navigation bar options like status bar
|
||||
// NAVIGATION BAR
|
||||
if (SDK_INT >= KITKAT && (SDK_INT < LOLLIPOP || !navigationBarTransparent)) {
|
||||
if (SDK_INT >= VERSION_CODES.KITKAT && (SDK_INT < VERSION_CODES.LOLLIPOP || !navigationBarTransparent)) {
|
||||
// API 19-20 (KitKat 4.4) - set gradient navigation bar
|
||||
// API 21+ (Lollipop 5.0+) - set half-transparent navigation bar if [navigationBarTransparent] is false
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION)
|
||||
}
|
||||
|
||||
if (SDK_INT >= LOLLIPOP && navigationBarTransparent) {
|
||||
if (SDK_INT >= VERSION_CODES.LOLLIPOP && navigationBarTransparent) {
|
||||
// API 21+ (Lollipop 5.0+) - set fully transparent navigation bar if [navigationBarTransparent] is true
|
||||
window.navigationBarColor = Color.TRANSPARENT
|
||||
}
|
||||
|
||||
// PADDING
|
||||
if (insetsListener != null) {
|
||||
if (SDK_INT >= LOLLIPOP && false) {
|
||||
if (SDK_INT >= VERSION_CODES.LOLLIPOP && false) {
|
||||
ViewCompat.setOnApplyWindowInsetsListener(insetsListener!!) { _, insets ->
|
||||
Log.d("NavLib", "Got insets left = ${insets.systemWindowInsetLeft}, top = ${insets.systemWindowInsetTop}, right = ${insets.systemWindowInsetRight}, bottom = ${insets.systemWindowInsetBottom}")
|
||||
if (insetsApplied)
|
||||
|
@ -120,7 +120,9 @@ fun hasNavigationBar(context: Context): Boolean {
|
||||
return hasNavigationBar
|
||||
}
|
||||
|
||||
fun IconicsDrawable.colorAttr(context: Context, @AttrRes attrRes: Int) = colorInt(getColorFromAttr(context, attrRes))
|
||||
fun IconicsDrawable.colorAttr(context: Context, @AttrRes attrRes: Int) {
|
||||
colorInt = getColorFromAttr(context, attrRes)
|
||||
}
|
||||
|
||||
fun getColorFromAttr(context: Context, @AttrRes color: Int): Int {
|
||||
val typedValue = TypedValue()
|
||||
|
@ -5,7 +5,6 @@ import android.content.Context
|
||||
import android.graphics.PorterDuff
|
||||
import android.graphics.PorterDuffColorFilter
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.system.Os.close
|
||||
import android.text.Editable
|
||||
import android.text.TextWatcher
|
||||
import android.util.AttributeSet
|
||||
@ -28,13 +27,12 @@ import com.google.android.material.textfield.TextInputEditText
|
||||
import com.google.android.material.textfield.TextInputLayout
|
||||
import com.mikepenz.iconics.IconicsDrawable
|
||||
import com.mikepenz.iconics.typeface.IIcon
|
||||
import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
|
||||
import com.mikepenz.iconics.typeface.library.navlibfont.NavLibFont
|
||||
import com.mikepenz.iconics.utils.paddingDp
|
||||
import com.mikepenz.iconics.utils.sizeDp
|
||||
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem
|
||||
import pl.szczodrzynski.navlib.*
|
||||
import pl.szczodrzynski.navlib.bottomsheet.items.IBottomSheetItem
|
||||
import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetSeparatorItem
|
||||
import pl.szczodrzynski.navlib.bottomsheet.items.IBottomSheetItem
|
||||
|
||||
|
||||
class NavBottomSheet : CoordinatorLayout {
|
||||
@ -280,7 +278,10 @@ class NavBottomSheet : CoordinatorLayout {
|
||||
private fun toggleGroupGetIconicsDrawable(context: Context, icon: IIcon?): Drawable? {
|
||||
if (icon == null)
|
||||
return null
|
||||
return IconicsDrawable(context, icon).sizeDp(24).paddingDp(4)
|
||||
return IconicsDrawable(context, icon).apply {
|
||||
sizeDp = 24
|
||||
paddingDp = 4
|
||||
}
|
||||
}
|
||||
|
||||
fun toggleGroupAddItem(id: Int, text: String, @DrawableRes icon: Int, defaultSortOrder: Int = SORT_MODE_ASCENDING) {
|
||||
@ -337,8 +338,8 @@ class NavBottomSheet : CoordinatorLayout {
|
||||
}
|
||||
button.tag = tag
|
||||
button.icon = toggleGroupGetIconicsDrawable(context, when (sortingMode) {
|
||||
SORT_MODE_ASCENDING -> CommunityMaterial.Icon2.cmd_sort_ascending
|
||||
SORT_MODE_DESCENDING -> CommunityMaterial.Icon2.cmd_sort_descending
|
||||
SORT_MODE_ASCENDING -> NavLibFont.Icon.nav_sort_ascending
|
||||
SORT_MODE_DESCENDING -> NavLibFont.Icon.nav_sort_descending
|
||||
else -> null
|
||||
})
|
||||
if (sortingMode != null) {
|
||||
@ -386,7 +387,11 @@ class NavBottomSheet : CoordinatorLayout {
|
||||
set(value) {
|
||||
textInputLayout.startIconDrawable = when (value) {
|
||||
is Drawable -> value
|
||||
is IIcon -> IconicsDrawable(context, value).sizeDp(24)/*.colorInt(Color.BLACK)*/
|
||||
is IIcon -> IconicsDrawable(context).apply {
|
||||
icon = value
|
||||
sizeDp = 34
|
||||
// colorInt = Color.BLACK
|
||||
}
|
||||
is Int -> context.getDrawableFromRes(value)
|
||||
else -> null
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import androidx.annotation.StringRes
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mikepenz.iconics.IconicsDrawable
|
||||
import com.mikepenz.iconics.typeface.IIcon
|
||||
import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
|
||||
import com.mikepenz.iconics.utils.sizeDp
|
||||
import pl.szczodrzynski.navlib.ImageHolder
|
||||
import pl.szczodrzynski.navlib.R
|
||||
@ -42,10 +41,11 @@ data class BottomSheetPrimaryItem(override val isContextual: Boolean = true) : I
|
||||
override fun bindViewHolder(viewHolder: ViewHolder) {
|
||||
viewHolder.root.setOnClickListener(onClickListener)
|
||||
|
||||
viewHolder.image.setImageDrawable(IconicsDrawable(viewHolder.text.context)
|
||||
.icon(iconicsIcon ?: CommunityMaterial.Icon.cmd_android)
|
||||
.colorAttr(viewHolder.text.context, android.R.attr.textColorSecondary)
|
||||
.sizeDp(24))
|
||||
viewHolder.image.setImageDrawable(IconicsDrawable(viewHolder.text.context).apply {
|
||||
icon = iconicsIcon
|
||||
colorAttr(viewHolder.text.context, android.R.attr.textColorSecondary)
|
||||
sizeDp = 24
|
||||
})
|
||||
|
||||
viewHolder.description.visibility = View.VISIBLE
|
||||
when {
|
||||
|
@ -1 +1 @@
|
||||
include ':app', ':navlib'
|
||||
include ':app', ':navlib', ':navlib-font'
|
||||
|
Loading…
x
Reference in New Issue
Block a user