Compare commits

...

26 Commits

Author SHA1 Message Date
Kuba Szczodrzyński
a5a1597e40 Bump version to 0.8.0 2021-03-29 21:51:53 +02:00
Kuba Szczodrzyński
60cc1171f9 Set all icon sizes to 24dp 2021-03-29 21:44:28 +02:00
Kuba Szczodrzyński
8f10321820 Update Iconics to 5.3.0-b01 2021-03-29 21:43:49 +02:00
Kuba Szczodrzyński
30d86d9618 Bump version to 0.7.2 2021-03-21 22:22:03 +01:00
Kuba Szczodrzyński
556d568228 Fix changing drawer selection instead of adding another 2021-03-21 22:21:51 +01:00
Kuba Szczodrzyński
8a0e0438a5 Bump version to 0.7.1 2021-03-21 21:46:58 +01:00
Kuba Szczodrzyński
578306480b Fix setting drawer drag margin on Android 10+ 2021-03-21 21:46:04 +01:00
Kuba Szczodrzyński
7430169359 Update Kotlin, replace MaterialDrawer with a forked version 2021-03-21 21:33:35 +01:00
Kuba Szczodrzyński
4f08f171d6 Bump version to 0.7.0 2021-03-21 14:22:12 +01:00
Kuba Szczodrzyński
15c95baa6a Update MaterialDrawer to v8.3.3 2021-03-21 14:17:59 +01:00
Kuba Szczodrzyński
43fc2f10df Update Gradle and libraries, migrate Iconics to v5 2021-03-21 14:11:26 +01:00
Kuba Szczodrzyński
642d297cd0 Add navlib-font 2021-03-21 13:19:28 +01:00
kubasz
28cdab3414 Add exception catching in reflection. Fix deselecting mini drawer. 2020-03-26 18:18:19 +01:00
kubasz
43f5ecdef5 Fix currently selected item not displaying selection background. Add support for profile unread badges. 2020-03-24 15:38:43 +01:00
kuba2k2
1d0e98a90e Revert 'Update Community Material font to 5.0.45.' because I'm dumb. 2020-03-23 22:33:43 +01:00
kubasz
3873fa4b04 Update Community Material font to 5.0.45. 2020-03-23 22:10:33 +01:00
kubasz
fd757f4228 Update MaterialDrawer to v8.0.0. Update gradle and libraries. 2020-03-23 16:02:20 +01:00
kubasz
5c8b13c0d9 Update gradle and libraries. 2020-01-19 14:39:31 +01:00
kubasz
9002237a02 Fix for items not showing selection background. Inline some extensions. Update gradle. 2020-01-19 14:15:47 +01:00
kubasz
9c8fb47c52 Update IDrawerProfile 2020-01-03 10:04:45 +01:00
kubasz
8b31921697 Update gradle & libraries. Fix removing badges on incorrect profile. 2019-12-02 21:53:37 +01:00
kubasz
8ae5e2b87a Update dependencies 2019-11-12 22:49:50 +01:00
kubasz
e4ad01dc87 Make FAB on click listener nullable 2019-09-27 22:41:22 +02:00
kubasz
84d6447887 Optimized toolbar code 2019-09-14 14:31:12 +02:00
kalucky0
01c787405e Fixed cropped subtitle issue 2019-09-14 14:19:13 +02:00
kubasz
8a707ebec7 Fix removing badges on other profiles. Deselect mini drawer if item not present. 2019-09-13 16:53:54 +02:00
42 changed files with 787 additions and 499 deletions

4
.gitignore vendored

@ -11,4 +11,6 @@
/build
/captures
.externalNativeBuild
/_hakerskie
/_hakerskie
*.apk
app/release/

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

@ -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

@ -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">

@ -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" />

@ -1,17 +1,18 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion setup.compileSdk
defaultConfig {
applicationId "pl.szczodrzynski.navigation"
minSdkVersion setup.minSdk
targetSdkVersion setup.targetSdk
versionCode release.versionCode
versionName release.versionName
multiDexEnabled true
}
buildTypes {
release {
@ -32,17 +33,18 @@ 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}"
implementation "com.github.kuba2k2:MaterialDrawer:${versions.materialdrawer}"
//implementation "com.mikepenz:crossfader:1.6.0" // do not update
implementation "com.mikepenz:iconics-core:${versions.iconics}" // do not update. >3.1.0 Breaks jelly bean
implementation "com.mikepenz:iconics-views:${versions.iconics}" // do not update
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 "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "androidx.appcompat:appcompat:1.2.0"
implementation "androidx.legacy:legacy-support-v4:1.0.0"
implementation "androidx.constraintlayout:constraintlayout:2.0.4"
implementation "androidx.core:core-ktx:1.3.2"
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
implementation "com.google.android.material:material:1.3.0"
implementation 'androidx.multidex:multidex:2.0.1'
implementation "com.mikepenz:iconics-views:5.3.0-b01"
implementation "com.mikepenz:community-material-typeface:5.8.55.0-kotlin@aar"
// implementation "pl.droidsonroids.gif:android-gif-drawable:1.2.15"
implementation project(":navlib")
}

@ -12,6 +12,7 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:name="androidx.multidex.MultiDexApplication"
android:theme="@style/AppTheme.Light"><!--
android:windowSoftInputMode="adjustResize"-->
<activity android:name=".MainActivity"
@ -24,4 +25,4 @@
</activity>
</application>
</manifest>
</manifest>

@ -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
@ -17,8 +16,8 @@ import pl.szczodrzynski.navlib.getDrawableFromRes
Example IDrawerProfile implementation
*/
class DrawerProfile(
override var id: Int,
override var name: String?,
override val id: Int,
override var name: String,
override var subname: String?,
override var image: String?
) : 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 ?: "")
@ -89,4 +88,4 @@ class DrawerProfile(
override fun applyImageTo(imageView: ImageView) {
getImageHolder(imageView.context).applyTo(imageView)
}
}
}

@ -8,16 +8,15 @@ 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.Iconics
import com.mikepenz.iconics.IconicsDrawable
import com.mikepenz.iconics.IconicsSize
import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
import com.mikepenz.materialdrawer.Drawer
import com.mikepenz.iconics.utils.actionBar
import com.mikepenz.iconics.utils.paddingDp
import com.mikepenz.materialdrawer.holder.StringHolder
import com.mikepenz.materialdrawer.model.PrimaryDrawerItem
import com.mikepenz.materialdrawer.model.ProfileDrawerItem
import com.mikepenz.materialdrawer.model.ProfileSettingDrawerItem
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem
import com.mikepenz.materialdrawer.model.interfaces.*
import com.mikepenz.materialdrawer.model.utils.withIsHiddenInMiniDrawer
import kotlinx.android.synthetic.main.sample_nav_view.*
import pl.szczodrzynski.navlib.SystemBarsUtil
import pl.szczodrzynski.navlib.SystemBarsUtil.Companion.COLOR_DO_NOT_CHANGE
@ -29,9 +28,10 @@ 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.drawer.IDrawerProfile
import pl.szczodrzynski.navlib.colorAttr
import pl.szczodrzynski.navlib.drawer.items.DrawerPrimaryItem
import pl.szczodrzynski.navlib.getColorFromAttr
import pl.szczodrzynski.navlib.withIcon
class MainActivity : AppCompatActivity() {
@ -43,6 +43,8 @@ class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Iconics.respectFontBoundsDefault = true
if (darkTheme == null)
darkTheme = getSharedPreferences("prefs", Context.MODE_PRIVATE).getBoolean("darkTheme", false)
@ -213,7 +215,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
@ -241,13 +243,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)
@ -262,10 +264,10 @@ class MainActivity : AppCompatActivity() {
DrawerPrimaryItem().withName("Lock screen")
.withDescription("aaand not visible in Mini Drawer")
.withHiddenInMiniDrawer(true)
.withIdentifier(62)
.withIsHiddenInMiniDrawer(true)
.withBadgeStyle(badgeStyle)
.withIcon(CommunityMaterial.Icon.cmd_fingerprint),
.withIcon(CommunityMaterial.Icon2.cmd_fingerprint),
DrawerPrimaryItem().withName("HDR enable/disable")
.withTag(0)
@ -278,17 +280,14 @@ 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)
)
setUnreadCount(2, 20, 30) // phil swift has 30 unreads on "Settings item"
setUnreadCount(4, 40, 1000) // mark has 99+ unreads on "Lock screen item"
//setAccountHeaderBackground("/sdcard/ban.gif")
appendProfiles(
@ -300,25 +299,27 @@ class MainActivity : AppCompatActivity() {
DrawerProfile(6, "Gandalf", "http://sax.hol.es/", null)
)
setUnreadCount(2, 20, 30) // phil swift has 30 unreads on "Settings item"
setUnreadCount(4, 40, 1000) // mark has 99+ unreads on "Lock screen item"
addProfileSettings(
ProfileSettingDrawerItem()
.withName("Add Account")
.withDescription("Add new GitHub Account")
.withIcon(
IconicsDrawable(context, CommunityMaterial.Icon2.cmd_plus)
.actionBar()
.padding(IconicsSize.dp(5))
.color(IconicsColor.colorRes(pl.szczodrzynski.navlib.R.color.material_drawer_dark_primary_text))
)
.withOnDrawerItemClickListener(object : Drawer.OnDrawerItemClickListener {
override fun onItemClick(view: View?, position: Int, drawerItem: IDrawerItem<*>): Boolean {
Toast.makeText(context, "Add account", Toast.LENGTH_SHORT).show()
return true
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()
true
},
ProfileSettingDrawerItem()
.withName("Manage Account")
.withIcon(CommunityMaterial.Icon2.cmd_settings)
.withIcon(CommunityMaterial.Icon.cmd_cog_outline)
)
drawerItemSelectedListener = { id, position, drawerItem ->
@ -358,12 +359,16 @@ class MainActivity : AppCompatActivity() {
}
}
setSelection.setOnClickListener {
navView.drawer.setSelection(id = 1, fireOnClick = false)
}
navView.bottomSheet.apply {
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 +376,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 +408,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

@ -35,6 +35,12 @@
android:layout_height="48dp"
android:text="Ripple bottombar" />
<Button
android:id="@+id/setSelection"
android:layout_width="wrap_content"
android:layout_height="48dp"
android:text="Set selection" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"

@ -2,50 +2,18 @@
buildscript {
ext {
kotlin_version = '1.3.50'
kotlin_version = '1.4.31'
release = [
// major.minor.patch.rc.beta
versionName: "0.5.0",
versionCode: 50099
versionName: "0.8.0",
versionCode: 80099
]
setup = [
compileSdk: 28,
buildTools: "28.0.3",
compileSdk: 30,
minSdk : 16,
targetSdk : 28
]
versions = [
kotlin : "1.3.50",
ktx : "1.0.2",
androidX : '1.0.0',
annotation : '1.1.0',
recyclerView : '1.1.0-beta03',
material : '1.1.0-alpha09',
appcompat : '1.1.0-rc01',
constraintLayout : '2.0.0-beta2',
cardview : '1.0.0',
gridLayout : '1.0.0',
navigation : "2.0.0",
navigationFragment: "1.0.0",
legacy : "1.0.0",
room : "2.2.0-beta01",
lifecycle : "2.2.0-alpha03",
firebase : '17.2.0',
firebasemessaging: "20.0.0",
play_services : "17.0.0",
materialdialogs : "0.9.6.0",
materialdrawer : "62b24da031",
iconics : "4.0.1-b02",
font_cmd : "3.5.95.1-kotlin",
gifdrawable : "1.2.15"
targetSdk : 30
]
}
@ -54,7 +22,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
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

@ -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-5.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip

1
navlib-font/.gitignore vendored Normal file

@ -0,0 +1 @@
/build

44
navlib-font/build.gradle Normal file

@ -0,0 +1,44 @@
/*
* Copyright 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.
*/
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
android {
compileSdkVersion setup.compileSdk
defaultConfig {
minSdkVersion setup.minSdk
targetSdkVersion setup.targetSdk
consumerProguardFiles 'consumer-proguard-rules.pro'
versionCode 10
versionName "1.0"
resValue "string", "NavLibFont_version", "${versionName}"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation "com.mikepenz:iconics-typeface-api:5.3.0-b01"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
}

@ -0,0 +1 @@
-keep class com.mikepenz.iconics.typeface.library.navlibfont.NavLibFont { *; }

@ -0,0 +1,18 @@
#
# Copyright 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.
#
POM_NAME=Android-Iconics NavLibFont Typeface Library
POM_ARTIFACT_ID=navlibfont-typeface
POM_PACKAGING=aar

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright 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.
-->
<manifest package="com.mikepenz.iconics.typeface.library.navlibfont" />

@ -0,0 +1,72 @@
/*
* Copyright 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.typeface.library.navlibfont
import com.mikepenz.iconics.typeface.IIcon
import com.mikepenz.iconics.typeface.ITypeface
import java.util.LinkedList
@Suppress("EnumEntryName")
object NavLibFont : ITypeface {
override val fontRes: Int
get() = R.font.navlibfont_font_v1_0
override val characters: Map<String, Char> by lazy {
Icon.values().associate { it.name to it.character }
}
override val mappingPrefix: String
get() = "nav"
override val fontName: String
get() = "NavLibFont"
override val version: String
get() = "1.0"
override val iconCount: Int
get() = characters.size
override val icons: List<String>
get() = characters.keys.toCollection(LinkedList())
override val author: String
get() = "Kuba Szczodrzyński"
override val url: String
get() = "https://github.com/kuba2k2/NavLib"
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 {
nav_dots_vertical('\ue801'),
nav_menu('\ue800'),
nav_sort_ascending('\ue803'),
nav_sort_descending('\ue802');
override val typeface: ITypeface by lazy { NavLibFont }
}
}

Binary file not shown.

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ 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.
-->
<resources>
<string name="define_font_NavLibFont">com.mikepenz.iconics.typeface.library.navlibfont.NavLibFont</string>
</resources>

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ 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.
-->
<resources>
<string name="define_FontAwesome">year;author;libraryName;libraryWebsite</string>
<string name="library_FontAwesome_author">Kuba Szczodrzyński</string>
<string name="library_FontAwesome_authorWebsite">https://github.com/kuba2k2/NavLib</string>
<string name="library_FontAwesome_libraryName">NavLibFont</string>
<string name="library_FontAwesome_libraryDescription"></string>
<string name="library_FontAwesome_libraryWebsite">https://github.com/kuba2k2/NavLib</string>
<string name="library_FontAwesome_libraryVersion">@string/NavLibFont_version</string>
<string name="library_FontAwesome_licenseId"></string>
<string name="library_FontAwesome_isOpenSource">true</string>
<string name="library_FontAwesome_repositoryLink">https://github.com/kuba2k2/NavLib</string>
<!-- Custom variables section -->
<string name="library_FontAwesome_year">2018</string>
</resources>

@ -2,6 +2,7 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion setup.compileSdk
@ -23,8 +24,8 @@ android {
}
}
dataBinding {
enabled = true
buildFeatures {
dataBinding = true
}
packagingOptions {
@ -35,21 +36,20 @@ 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 "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
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.mikepenz:community-material-typeface:${versions.font_cmd}@aar"
api "com.mikepenz:iconics-core:${versions.iconics}"
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}"
api "com.mikepenz:materialize:1.2.1"
api "com.mikepenz:materialdrawer:8.3.3"
api "com.mikepenz:iconics-core:5.3.0-b01"
api "com.mikepenz:itemanimators:1.1.0"
implementation 'com.balysv:material-ripple:1.0.2'
compileOnly "pl.droidsonroids.gif:android-gif-drawable:1.2.15"
implementation "com.balysv:material-ripple:1.0.2"
implementation project(":navlib-font")
}

@ -1,2 +1 @@
-keep class androidx.drawerlayout.widget.DrawerLayout { *; }
-keep class androidx.customview.widget.ViewDragHelper { *; }

@ -21,4 +21,3 @@
#-renamesourcefileattribute SourceFile
-keep class androidx.drawerlayout.widget.DrawerLayout { *; }
-keep class androidx.customview.widget.ViewDragHelper { *; }

@ -10,7 +10,6 @@ import android.util.AttributeSet
import android.view.MotionEvent
import android.view.View
import android.view.ViewOutlineProvider
import androidx.appcompat.widget.AppCompatImageView
import androidx.core.view.ViewCompat
import com.mikepenz.materialdrawer.R
import com.mikepenz.materialdrawer.util.DrawerImageLoader
@ -22,7 +21,7 @@ import pl.droidsonroids.gif.GifImageView
* drawable on top. This is useful for applying a beveled look to image contents, but is also
* flexible enough for use with other desired aesthetics.
*/
open class BezelGifImageView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyle: Int = 0) : GifImageView(context, attrs, defStyle) {
open class BezelImageView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyle: Int = 0) : GifImageView(context, attrs, defStyle) {
private val mBlackPaint: Paint
private val mMaskedPaint: Paint
@ -54,14 +53,14 @@ open class BezelGifImageView @JvmOverloads constructor(context: Context, attrs:
// Attribute initialization
val a = context.obtainStyledAttributes(attrs, R.styleable.BezelImageView, defStyle, R.style.BezelImageView)
mMaskDrawable = a.getDrawable(R.styleable.BezelImageView_biv_maskDrawable)
mMaskDrawable = a.getDrawable(R.styleable.BezelImageView_materialDrawerMaskDrawable)
if (mMaskDrawable != null) {
mMaskDrawable.callback = this
}
mDrawCircularShadow = a.getBoolean(R.styleable.BezelImageView_biv_drawCircularShadow, true)
mDrawCircularShadow = a.getBoolean(R.styleable.BezelImageView_materialDrawerDrawCircularShadow, true)
mSelectorColor = a.getColor(R.styleable.BezelImageView_biv_selectorOnPress, 0)
mSelectorColor = a.getColor(R.styleable.BezelImageView_materialDrawerSelectorOnPress, 0)
a.recycle()

@ -1,11 +1,18 @@
package pl.szczodrzynski.navlib
import android.view.View
import androidx.recyclerview.widget.RecyclerView
import com.mikepenz.iconics.typeface.IIcon
import com.mikepenz.materialdrawer.*
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem
import com.mikepenz.materialdrawer.model.interfaces.IProfile
import com.mikepenz.materialdrawer.holder.StringHolder
import com.mikepenz.materialdrawer.model.AbstractDrawerItem
import com.mikepenz.materialdrawer.model.BaseDrawerItem
import com.mikepenz.materialdrawer.model.interfaces.*
import com.mikepenz.materialdrawer.util.getDrawerItem
import com.mikepenz.materialdrawer.util.updateItem
import com.mikepenz.materialdrawer.widget.MaterialDrawerSliderView
fun DrawerBuilder.withOnDrawerItemClickListener(listener: (view: View?, position: Int, drawerItem: IDrawerItem<*>) -> Boolean): DrawerBuilder {
/*inline fun DrawerBuilder.withOnDrawerItemClickListener(crossinline listener: (view: View?, position: Int, drawerItem: IDrawerItem<*>) -> Boolean): DrawerBuilder {
return this.withOnDrawerItemClickListener(object : Drawer.OnDrawerItemClickListener {
override fun onItemClick(view: View?, position: Int, drawerItem: IDrawerItem<*>): Boolean {
return listener(view, position, drawerItem)
@ -13,7 +20,7 @@ fun DrawerBuilder.withOnDrawerItemClickListener(listener: (view: View?, position
})
}
fun DrawerBuilder.withOnDrawerItemLongClickListener(listener: (view: View, position: Int, drawerItem: IDrawerItem<*>) -> Boolean): DrawerBuilder {
inline fun DrawerBuilder.withOnDrawerItemLongClickListener(crossinline listener: (view: View, position: Int, drawerItem: IDrawerItem<*>) -> Boolean): DrawerBuilder {
return this.withOnDrawerItemLongClickListener(object : Drawer.OnDrawerItemLongClickListener {
override fun onItemLongClick(view: View, position: Int, drawerItem: IDrawerItem<*>): Boolean {
return listener(view, position, drawerItem)
@ -21,7 +28,7 @@ fun DrawerBuilder.withOnDrawerItemLongClickListener(listener: (view: View, posit
})
}
fun AccountHeaderBuilder.withOnAccountHeaderListener(listener: (view: View?, profile: IProfile<*>, current: Boolean) -> Boolean): AccountHeaderBuilder {
inline fun AccountHeaderBuilder.withOnAccountHeaderListener(crossinline listener: (view: View?, profile: IProfile<*>, current: Boolean) -> Boolean): AccountHeaderBuilder {
return this.withOnAccountHeaderListener(object : AccountHeader.OnAccountHeaderListener {
override fun onProfileChanged(view: View?, profile: IProfile<*>, current: Boolean): Boolean {
return listener(view, profile, current)
@ -29,7 +36,7 @@ fun AccountHeaderBuilder.withOnAccountHeaderListener(listener: (view: View?, pro
})
}
fun AccountHeaderBuilder.withOnAccountHeaderItemLongClickListener(listener: (view: View, profile: IProfile<*>, current: Boolean) -> Boolean): AccountHeaderBuilder {
inline fun AccountHeaderBuilder.withOnAccountHeaderItemLongClickListener(crossinline listener: (view: View, profile: IProfile<*>, current: Boolean) -> Boolean): AccountHeaderBuilder {
return this.withOnAccountHeaderItemLongClickListener(object : AccountHeader.OnAccountHeaderItemLongClickListener {
override fun onProfileLongClick(view: View, profile: IProfile<*>, current: Boolean): Boolean {
return listener(view, profile, current)
@ -37,13 +44,13 @@ fun AccountHeaderBuilder.withOnAccountHeaderItemLongClickListener(listener: (vie
})
}
fun AccountHeaderBuilder.withOnAccountHeaderProfileImageListener(
onClick: (
inline fun AccountHeaderBuilder.withOnAccountHeaderProfileImageListener(
crossinline onClick: (
view: View,
profile: IProfile<*>,
current: Boolean
) -> Boolean,
onLongClick: (
crossinline onLongClick: (
view: View,
profile: IProfile<*>,
current: Boolean
@ -59,10 +66,20 @@ fun AccountHeaderBuilder.withOnAccountHeaderProfileImageListener(
})
}
fun MiniDrawer.withOnMiniDrawerItemClickListener(listener: (view: View?, position: Int, drawerItem: IDrawerItem<*>, type: Int) -> Boolean): MiniDrawer {
inline fun MiniDrawer.withOnMiniDrawerItemClickListener(crossinline listener: (view: View?, position: Int, drawerItem: IDrawerItem<*>, type: Int) -> Boolean): MiniDrawer {
return this.withOnMiniDrawerItemClickListener(object : MiniDrawer.OnMiniDrawerItemClickListener {
override fun onItemClick(view: View?, position: Int, drawerItem: IDrawerItem<*>, type: Int): Boolean {
return listener(view, position, drawerItem, type)
}
})
}
}*/
fun MaterialDrawerSliderView.updateBadge(identifier: Long, badge: StringHolder?) {
val drawerItem = getDrawerItem(identifier)
if (drawerItem is Badgeable) {
drawerItem.withBadge(badge)
updateItem(drawerItem)
}
}
fun <T : Iconable> T.withIcon(icon: IIcon) = withIcon(pl.szczodrzynski.navlib.ImageHolder(icon))

@ -1,20 +1,20 @@
package pl.szczodrzynski.navlib
import android.content.Context
import android.content.res.ColorStateList
import android.graphics.Bitmap
import android.graphics.PorterDuff
import android.graphics.PorterDuffColorFilter
import android.graphics.drawable.Drawable
import android.net.Uri
import android.view.View
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.IconicsSize
import com.mikepenz.iconics.typeface.IIcon
import com.mikepenz.iconics.utils.actionBar
import com.mikepenz.iconics.utils.sizeDp
import com.mikepenz.materialdrawer.util.DrawerImageLoader
import pl.droidsonroids.gif.GifDrawable
import java.io.FileNotFoundException
@ -25,31 +25,24 @@ import java.io.FileNotFoundException
open class ImageHolder : com.mikepenz.materialdrawer.holder.ImageHolder {
constructor(url: String) : super(url) {}
constructor(uri: Uri) : super(uri) {}
constructor(icon: Drawable?) : super(icon) {}
constructor(bitmap: Bitmap?) : super(bitmap) {}
constructor(@DrawableRes iconRes: Int) : super(iconRes) {}
constructor(@DrawableRes iconRes: Int, colorFilter: Int?) : super(iconRes) {
this.colorFilter = colorFilter
}
constructor(iicon: IIcon) : super(null as Bitmap?) {
this.iIcon = iicon
constructor(iicon: IIcon) : super(null as Drawable?) {
this.iicon = iicon
}
constructor() : super()
constructor(url: String) : super(url)
constructor(uri: Uri) : super(uri)
constructor(icon: Drawable?) : super(icon)
constructor(bitmap: Bitmap) : super(bitmap)
constructor(iconRes: Int) : super(iconRes)
var iicon: IIcon? = null
@ColorInt
var colorFilter: Int? = null
var colorFilterMode: PorterDuff.Mode = PorterDuff.Mode.DST_OVER
override fun applyTo(imageView: ImageView): Boolean {
return applyTo(imageView, null)
}
/**
* sets an existing image to the imageView
@ -59,14 +52,14 @@ open class ImageHolder : com.mikepenz.materialdrawer.holder.ImageHolder {
* @return true if an image was set
*/
override fun applyTo(imageView: ImageView, tag: String?): Boolean {
val ii = iIcon
val ii = iicon
if (uri != null) {
if (uri.toString().endsWith(".gif", true)) {
imageView.setImageDrawable(GifDrawable(uri.toString()))
}
else {
val consumed = DrawerImageLoader.instance.setImage(imageView, uri, tag)
val consumed = DrawerImageLoader.instance.setImage(imageView, uri!!, tag)
if (!consumed) {
imageView.setImageURI(uri)
}
@ -90,4 +83,39 @@ open class ImageHolder : com.mikepenz.materialdrawer.holder.ImageHolder {
return true
}
/**
* this only handles Drawables
*
* @param ctx
* @param iconColor
* @param tint
* @return
*/
override fun decideIcon(ctx: Context, iconColor: ColorStateList, tint: Boolean, paddingDp: Int): Drawable? {
var icon: Drawable? = icon
val ii = iicon
val uri = uri
when {
ii != null -> icon = IconicsDrawable(ctx).apply {
this.icon = ii
colorList = iconColor
sizeDp = 24
}
iconRes != -1 -> icon = AppCompatResources.getDrawable(ctx, iconRes)
uri != null -> try {
val inputStream = ctx.contentResolver.openInputStream(uri)
icon = Drawable.createFromStream(inputStream, uri.toString())
} catch (e: FileNotFoundException) {
//no need to handle this
}
}
//if we got an icon AND we have auto tinting enabled AND it is no IIcon, tint it ;)
if (icon != null && tint && iicon == null) {
icon = icon.mutate()
icon.setColorFilter(iconColor.defaultColor, PorterDuff.Mode.SRC_IN)
}
return icon
}
}

@ -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.
@ -104,6 +112,15 @@ class NavBottomBar : BottomAppBar {
fabExtendedView?.text = value
}
/**
* Set the FAB's on click listener
*/
fun setFabOnClickListener(onClickListener: OnClickListener?) {
fabView?.setOnClickListener(onClickListener)
fabExtendedView?.setOnClickListener(onClickListener)
}
@SuppressLint("ClickableViewAccessibility")
private fun create(attrs: AttributeSet?, defStyle: Int) {
setOnTouchListener { _, event ->
if (bottomSheet?.enable != true || bottomSheet?.enableDragToOpen != true)
@ -117,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 = 24
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 = 24
colorAttr(context, R.attr.colorOnPrimary)
})
.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS)
setNavigationOnClickListener {
@ -190,4 +208,4 @@ class NavBottomBar : BottomAppBar {
override fun setOnMenuItemClickListener(listener: OnMenuItemClickListener?) {
onMenuItemClickListener = listener
}
}
}

@ -3,10 +3,10 @@ package pl.szczodrzynski.navlib
import android.content.Context
import android.util.AttributeSet
import android.widget.ImageView
import androidx.core.view.children
import com.google.android.material.appbar.MaterialToolbar
class NavToolbar : MaterialToolbar {
constructor(context: Context) : super(context) {
create(null, 0)
}
@ -27,6 +27,17 @@ class NavToolbar : MaterialToolbar {
}
}
override fun setSubtitle(subtitle: CharSequence?) {
if(subtitle.isNullOrEmpty()) {
setPadding(0, 0, 0, 0)
toolbarImage?.translationY = 0f
} else {
setPadding(0, -1, 0, 5)
toolbarImage?.translationY = 6f
}
super.setSubtitle(subtitle)
}
private fun create(attrs: AttributeSet?, defStyle: Int) {
}

@ -13,15 +13,12 @@ import android.view.ViewGroup.LayoutParams.MATCH_PARENT
import android.widget.FrameLayout
import android.widget.LinearLayout
import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.core.view.children
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
import com.google.android.material.floatingactionbutton.FloatingActionButton
import kotlinx.android.synthetic.main.nav_view.view.*
import pl.szczodrzynski.navlib.bottomsheet.NavBottomSheet
import pl.szczodrzynski.navlib.drawer.NavDrawer
import android.graphics.drawable.RippleDrawable
import android.os.Build
import androidx.core.view.children
import com.mikepenz.materialize.util.UIUtils
class NavView : FrameLayout {
@ -82,9 +79,8 @@ class NavView : FrameLayout {
drawer = NavDrawer(
context,
findViewById(R.id.nv_drawerContainer),
findViewById(R.id.nv_fixedDrawerContainer),
findViewById(R.id.nv_miniDrawerContainerLandscape),
findViewById(R.id.nv_drawerLayout),
findViewById(R.id.nv_drawerContainerLandscape),
findViewById(R.id.nv_miniDrawerContainerPortrait),
findViewById(R.id.nv_miniDrawerElevation)
)
@ -108,11 +104,17 @@ class NavView : FrameLayout {
//bottomSheetBehavior.peekHeight = displayHeight
}
private fun convertDpToPixel(dp: Float): Float {
val resources = context.resources
val metrics = resources.displayMetrics
return dp * (metrics.densityDpi / 160f)
}
fun gainAttentionOnBottomBar() {
var x = ripple.width.toFloat()
var y = ripple.height.toFloat()
x -= UIUtils.convertDpToPixel(56f, context) / 2
y -= UIUtils.convertDpToPixel(56f, context) / 2
x -= convertDpToPixel(56f) / 2
y -= convertDpToPixel(56f) / 2
ripple.performRipple(Point(x.toInt(), y.toInt()))
}
@ -122,7 +124,7 @@ class NavView : FrameLayout {
this.navigationBarBgView = navigationBarBackground
this.statusBarDarkView = nv_statusBarDarker
//this.navigationBarDarkView = navigationBarBackground
this.insetsListener = nv_drawerContainer
this.insetsListener = nv_drawerLayout
this.marginBySystemBars = mainView
this.paddingByNavigationBar = bottomSheet.getContentView()
}
@ -153,9 +155,8 @@ class NavView : FrameLayout {
/**
* Set the FAB's on click listener
*/
fun setFabOnClickListener(onClickListener: OnClickListener) {
floatingActionButton.setOnClickListener(onClickListener)
extendedFloatingActionButton.setOnClickListener(onClickListener)
fun setFabOnClickListener(onClickListener: OnClickListener?) {
bottomBar.setFabOnClickListener(onClickListener)
}
internal var systemBarsUtil: SystemBarsUtil? = null
@ -186,7 +187,7 @@ class NavView : FrameLayout {
}
fun onBackPressed(): Boolean {
if (drawer.isOpen) {
if (drawer.isOpen && !drawer.fixedDrawerEnabled()) {
if (drawer.profileSelectionIsOpen) {
drawer.profileSelectionClose()
return true

@ -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) {
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)
@ -374,4 +373,4 @@ class SystemBarsUtil(private val activity: Activity) {
keyboardUtil?.disable()
}
}
}
}

@ -5,20 +5,18 @@ import android.content.Context
import android.content.res.Configuration
import android.graphics.drawable.Drawable
import android.os.Build
import android.util.DisplayMetrics
import android.util.TypedValue
import android.view.View
import android.view.WindowManager
import androidx.annotation.AttrRes
import androidx.annotation.ColorInt
import androidx.annotation.ColorRes
import androidx.annotation.DrawableRes
import com.google.android.material.elevation.ElevationOverlayProvider
import com.mikepenz.iconics.IconicsColor
import com.mikepenz.iconics.IconicsDrawable
import android.util.DisplayMetrics
import android.view.WindowManager
import androidx.annotation.ColorInt
import androidx.annotation.ColorRes
import com.mikepenz.materialdrawer.Drawer
import com.mikepenz.materialdrawer.holder.StringHolder
import com.mikepenz.materialdrawer.model.interfaces.Badgeable
import com.mikepenz.iconics.utils.colorInt
/*private val displayMetrics by lazy {
@ -122,7 +120,9 @@ fun hasNavigationBar(context: Context): Boolean {
return hasNavigationBar
}
fun IconicsDrawable.colorAttr(context: Context, @AttrRes attrRes: Int) = color(IconicsColor.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()
@ -149,14 +149,6 @@ fun Context.getColorFromRes(@ColorRes id: Int): Int {
}
}
fun Drawer.updateBadge(identifier: Long, badge: StringHolder?) {
val drawerItem = getDrawerItem(identifier)
if (drawerItem is Badgeable<*>) {
drawerItem.withBadge(badge)
updateItem(drawerItem)
}
}
fun crc16(buffer: String): Int {
/* Note the change here */
var crc = 0x1D0F
@ -169,4 +161,4 @@ fun crc16(buffer: String): Int {
}
crc = crc and 0xffff
return crc
}
}

@ -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,9 @@ 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
}
}
fun toggleGroupAddItem(id: Int, text: String, @DrawableRes icon: Int, defaultSortOrder: Int = SORT_MODE_ASCENDING) {
@ -337,8 +337,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 +386,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 = 24
// colorInt = Color.BLACK
}
is Int -> context.getDrawableFromRes(value)
else -> null
}
@ -431,4 +435,4 @@ class NavBottomSheet : CoordinatorLayout {
return
isOpen = !isOpen
}
}
}

@ -9,10 +9,8 @@ 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.colorInt
import com.mikepenz.iconics.utils.sizeDp
import com.mikepenz.materialize.holder.ImageHolder
import pl.szczodrzynski.navlib.ImageHolder
import pl.szczodrzynski.navlib.R
import pl.szczodrzynski.navlib.colorAttr
import pl.szczodrzynski.navlib.getColorFromAttr
@ -43,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, R.attr.material_drawer_primary_icon)
.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 {
@ -59,7 +58,7 @@ data class BottomSheetPrimaryItem(override val isContextual: Boolean = true) : I
titleRes != null -> viewHolder.text.setText(titleRes!!)
else -> viewHolder.text.text = title
}
viewHolder.text.setTextColor(getColorFromAttr(viewHolder.text.context, R.attr.material_drawer_primary_text))
viewHolder.text.setTextColor(getColorFromAttr(viewHolder.text.context, android.R.attr.textColorPrimary))
}
/*_____ _
@ -122,4 +121,4 @@ data class BottomSheetPrimaryItem(override val isContextual: Boolean = true) : I
this.onClickListener = onClickListener
return this
}
}
}

@ -6,8 +6,8 @@ import android.widget.ImageView
import pl.szczodrzynski.navlib.ImageHolder
interface IDrawerProfile {
var id: Int
var name: String?
val id: Int
var name: String
var subname: String?
var image: String?

@ -9,32 +9,42 @@ import android.graphics.Color
import android.graphics.PorterDuff
import android.graphics.drawable.LayerDrawable
import android.util.Log
import android.view.Gravity
import android.view.View
import android.view.ViewGroup
import android.view.ViewGroup.LayoutParams.MATCH_PARENT
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
import android.widget.FrameLayout
import android.widget.LinearLayout
import android.widget.Toast
import androidx.core.content.ContextCompat
import androidx.customview.widget.ViewDragHelper
import androidx.drawerlayout.widget.DrawerLayout
import com.mikepenz.fastadapter.IAdapter
import com.mikepenz.itemanimators.AlphaCrossFadeAnimator
import com.mikepenz.materialdrawer.*
import com.mikepenz.materialdrawer.holder.BadgeStyle
import com.mikepenz.materialdrawer.holder.ColorHolder
import com.mikepenz.materialdrawer.holder.StringHolder
import com.mikepenz.materialdrawer.model.BaseDrawerItem
import com.mikepenz.materialdrawer.model.MiniProfileDrawerItem
import com.mikepenz.materialdrawer.model.ProfileDrawerItem
import com.mikepenz.materialdrawer.model.ProfileSettingDrawerItem
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem
import com.mikepenz.materialdrawer.model.interfaces.IProfile
import com.mikepenz.materialdrawer.model.interfaces.*
import com.mikepenz.materialdrawer.util.*
import com.mikepenz.materialdrawer.widget.AccountHeaderView
import com.mikepenz.materialdrawer.widget.MaterialDrawerSliderView
import com.mikepenz.materialdrawer.widget.MiniDrawerSliderView
import com.mikepenz.materialize.util.UIUtils
import pl.szczodrzynski.navlib.*
import pl.szczodrzynski.navlib.R
import pl.szczodrzynski.navlib.drawer.items.DrawerPrimaryItem
class NavDrawer(
val context: Context,
val drawerContainer: LinearLayout,
val fixedDrawerContainer: FrameLayout,
val miniDrawerContainerLandscape: FrameLayout,
val miniDrawerContainerPortrait: FrameLayout,
val drawerLayout: DrawerLayout,
val drawerContainerLandscape: FrameLayout,
val drawerContainerPortrait: FrameLayout,
val miniDrawerElevation: View
) {
companion object {
@ -50,11 +60,9 @@ class NavDrawer(
internal lateinit var toolbar: NavToolbar
internal lateinit var bottomBar: NavBottomBar
private var drawer: Drawer? = null
private var drawerView: View? = null
private var accountHeader: AccountHeader? = null
private var miniDrawer: MiniDrawer? = null
private var miniDrawerView: View? = null
private lateinit var drawer: MaterialDrawerSliderView
private lateinit var accountHeader: AccountHeaderView
private lateinit var miniDrawer: MiniDrawerSliderView
private var drawerMode: Int = DRAWER_MODE_NORMAL
private var selection: Int = -1
@ -72,123 +80,111 @@ class NavDrawer(
getColorFromAttr(context, R.attr.colorOnError)
)*/
badgeStyle = BadgeStyle()
.withTextColor(Color.WHITE)
.withColorRes(R.color.md_red_700)
val drawerBuilder = DrawerBuilder()
.withActivity(activity)
.withDrawerLayout(R.layout.material_drawer_fits_not)
.withHasStableIds(true)
.withItemAnimator(AlphaCrossFadeAnimator())
.withRootView(drawerContainer)
.withFullscreen(true)
.withTranslucentStatusBar(false)
.withTranslucentNavigationBar(true)
.withTranslucentNavigationBarProgrammatically(false)
//.withToolbar(bottomBar)
.withDisplayBelowStatusBar(false)
//.withActionBarDrawerToggleAnimated(true)
.withShowDrawerOnFirstLaunch(true)
//.withShowDrawerUntilDraggedOpened(true)
.withGenerateMiniDrawer(true /* if it is not showing on screen, clicking items throws an exception */)
.withOnDrawerListener(object : Drawer.OnDrawerListener {
override fun onDrawerSlide(drawerView: View, slideOffset: Float) {}
override fun onDrawerOpened(drawerView: View) {
drawerOpenedListener?.invoke()
}
override fun onDrawerClosed(drawerView: View) {
drawerClosedListener?.invoke()
profileSelectionClose()
}
})
.withOnDrawerItemClickListener { _, position, drawerItem ->
if (drawerItem.identifier.toInt() == selection) {
return@withOnDrawerItemClickListener false
}
when (drawerItemSelectedListener?.invoke(drawerItem.identifier.toInt(), position, drawerItem)) {
true -> {
when {
!drawerItem.isSelectable -> {
setSelection(selection, false)
return@withOnDrawerItemClickListener false
}
drawerItem is DrawerPrimaryItem -> toolbar.title = drawerItem.appTitle ?: drawerItem.name?.getText(context) ?: ""
drawerItem is BaseDrawerItem<*, *> -> toolbar.title = drawerItem.name?.getText(context) ?: ""
}
//setSelection(drawerItem.identifier.toInt(), false)
return@withOnDrawerItemClickListener false
}
false -> {
setSelection(selection, false)
return@withOnDrawerItemClickListener true
}
else -> {
return@withOnDrawerItemClickListener false
}
}
}
.withOnDrawerItemLongClickListener { _, position, drawerItem ->
drawerItemLongClickListener?.invoke(drawerItem.identifier.toInt(), position, drawerItem) ?: true
}
val accountHeaderBuilder = AccountHeaderBuilder()
.withActivity(activity)
.withTranslucentStatusBar(true)
.withOnAccountHeaderListener { view, profile, current ->
if (profile is ProfileSettingDrawerItem) {
return@withOnAccountHeaderListener drawerProfileSettingClickListener?.invoke(profile.identifier.toInt(), view) ?: false
}
updateBadges()
if (current) {
close()
profileSelectionClose()
return@withOnAccountHeaderListener true
}
(drawerProfileSelectedListener?.invoke(profile.identifier.toInt(), profile, current, view) ?: false).also {
setToolbarProfileImage(profileList.singleOrNull { it.id == profile.identifier.toInt() })
}
}
.withOnAccountHeaderItemLongClickListener { view, profile, current ->
if (profile is ProfileSettingDrawerItem) {
return@withOnAccountHeaderItemLongClickListener drawerProfileSettingLongClickListener?.invoke(profile.identifier.toInt(), view) ?: true
}
drawerProfileLongClickListener?.invoke(profile.identifier.toInt(), profile, current, view) ?: false
}
.withOnAccountHeaderProfileImageListener(
onClick = { view, profile, current ->
drawerProfileImageClickListener?.invoke(profile.identifier.toInt(), profile, current, view) ?: false
},
onLongClick = { view, profile, current ->
drawerProfileImageLongClickListener?.invoke(profile.identifier.toInt(), profile, current, view) ?: false
}
)
.withHeaderBackground(R.drawable.header)
.withTextColor(ContextCompat.getColor(context, R.color.material_drawer_dark_primary_text))
accountHeader = accountHeaderBuilder.build()
drawerBuilder.withAccountHeader(accountHeader!!)
drawer = drawerBuilder.build()
drawerView = drawer?.slider
miniDrawer = drawer?.miniDrawer
miniDrawer?.withOnMiniDrawerItemClickListener { _, _, _, type ->
if (type == MiniDrawer.PROFILE) {
profileSelectionOpen()
open()
return@withOnMiniDrawerItemClickListener true
}
return@withOnMiniDrawerItemClickListener false
badgeStyle = BadgeStyle().apply {
textColor = ColorHolder.fromColor(Color.WHITE)
color = ColorHolder.fromColor(0xffd32f2f.toInt())
}
drawerLayout.addDrawerListener(object : DrawerLayout.DrawerListener {
override fun onDrawerStateChanged(newState: Int) {}
override fun onDrawerSlide(drawerView: View, slideOffset: Float) {}
override fun onDrawerClosed(drawerView: View) {
drawerClosedListener?.invoke()
profileSelectionClose()
}
override fun onDrawerOpened(drawerView: View) {
drawerOpenedListener?.invoke()
}
})
accountHeader = AccountHeaderView(context).apply {
headerBackground = ImageHolder(R.drawable.header)
displayBadgesOnSmallProfileImages = true
onAccountHeaderListener = { view, profile, current ->
if (profile is ProfileSettingDrawerItem) {
drawerProfileSettingClickListener?.invoke(profile.identifier.toInt(), view) ?: false
}
else {
updateBadges()
if (current) {
close()
profileSelectionClose()
true
}
else {
(drawerProfileSelectedListener?.invoke(profile.identifier.toInt(), profile, current, view) ?: false).also {
setToolbarProfileImage(profileList.singleOrNull { it.id == profile.identifier.toInt() })
}
}
}
}
onAccountHeaderItemLongClickListener = { view, profile, current ->
if (profile is ProfileSettingDrawerItem) {
drawerProfileSettingLongClickListener?.invoke(profile.identifier.toInt(), view) ?: true
}
else {
drawerProfileLongClickListener?.invoke(profile.identifier.toInt(), profile, current, view) ?: false
}
}
onAccountHeaderProfileImageListener = { view, profile, current ->
drawerProfileImageClickListener?.invoke(profile.identifier.toInt(), profile, current, view) ?: false
}
//.withTextColor(ContextCompat.getColor(context, R.color.material_drawer_dark_primary_text))
}
drawer = MaterialDrawerSliderView(context).apply {
accountHeader = this@NavDrawer.accountHeader
itemAnimator = AlphaCrossFadeAnimator()
//hasStableIds = true
onDrawerItemClickListener = { _, drawerItem, position ->
if (drawerItem.identifier.toInt() == selection) {
false
}
else {
val consumed = drawerItemSelectedListener?.invoke(drawerItem.identifier.toInt(), position, drawerItem)
if (consumed == false || !drawerItem.isSelectable) {
setSelection(selection, false)
consumed == false
}
else if (consumed == true) {
when (drawerItem) {
is DrawerPrimaryItem -> toolbar.title = drawerItem.appTitle ?: drawerItem.name?.getText(context) ?: ""
is BaseDrawerItem<*, *> -> toolbar.title = drawerItem.name?.getText(context) ?: ""
}
false
}
else {
false
}
}
}
onDrawerItemLongClickListener = { _, drawerItem, position ->
drawerItemLongClickListener?.invoke(drawerItem.identifier.toInt(), position, drawerItem) ?: true
}
}
miniDrawer = MiniDrawerSliderView(context).apply {
drawer = this@NavDrawer.drawer
includeSecondaryDrawerItems = false
try {
this::class.java.getDeclaredField("onMiniDrawerItemClickListener").let {
it.isAccessible = true
it.set(this, { v: View?, position: Int, item: IDrawerItem<*>, type: Int ->
if (item is MiniProfileDrawerItem) {
profileSelectionOpen()
open()
true
} else false
})
}
} catch (_: Exception) { }
}
miniDrawer?.withIncludeSecondaryDrawerItems(false)
// TODO 2019-08-27 build miniDrawerView only if needed
// building in decideDrawerMode causes an exception when clicking drawer items
// also update method updateMiniDrawer...
miniDrawerView = miniDrawer?.build(context)
updateMiniDrawer()
toolbar.profileImageClickListener = {
@ -214,62 +210,62 @@ class NavDrawer(
appendItem(item)
}
fun appendItem(item: IDrawerItem<*>) {
drawer?.addItem(item)
drawer.addItems(item)
updateMiniDrawer()
}
fun appendItems(vararg items: IDrawerItem<*>) {
drawer?.addItems(*items)
drawer.addItems(*items)
updateMiniDrawer()
}
fun prependItem(item: IDrawerItem<*>) {
drawer?.addItemAtPosition(item, 0)
drawer.addItemAtPosition(0, item)
updateMiniDrawer()
}
fun prependItems(vararg items: IDrawerItem<*>) {
drawer?.addItemsAtPosition(0, *items)
drawer.addItemsAtPosition(0, *items)
updateMiniDrawer()
}
fun addItemAt(index: Int, item: IDrawerItem<*>) {
drawer?.addItemAtPosition(item, index)
drawer.addItemAtPosition(index, item)
updateMiniDrawer()
}
fun addItemsAt(index: Int, vararg items: IDrawerItem<*>) {
drawer?.addItemsAtPosition(index, *items)
drawer.addItemsAtPosition(index, *items)
updateMiniDrawer()
}
fun removeItemById(id: Int) {
drawer?.removeItem(id.toLong())
drawer.removeItems(id.toLong())
updateMiniDrawer()
}
fun removeItemAt(index: Int) {
drawer?.removeItemByPosition(index)
drawer.removeItemByPosition(index)
updateMiniDrawer()
}
fun removeAllItems() {
drawer?.removeAllItems()
drawer.removeAllItems()
updateMiniDrawer()
}
fun getItemById(id: Int, run: (it: IDrawerItem<*>?) -> Unit) {
drawer?.getDrawerItem(id.toLong()).also {
drawer.getDrawerItem(id.toLong()).also {
run(it)
if (it != null)
drawer?.updateItem(it)
drawer.updateItem(it)
updateMiniDrawer()
}
}
fun getItemByIndex(index: Int, run: (it: IDrawerItem<*>?) -> Unit) {
drawer?.drawerItems?.getOrNull(index).also {
drawer.itemAdapter.itemList.get(index).also {
run(it)
if (it != null)
drawer?.updateItem(it)
drawer.updateItem(it)
updateMiniDrawer()
}
}
fun setItems(vararg items: IDrawerItem<*>) {
drawer?.removeAllItems()
drawer?.addItems(*items)
drawer.removeAllItems()
drawer.addItems(*items)
updateMiniDrawer()
}
@ -281,22 +277,20 @@ class NavDrawer(
|_| |_| |_| \_/ \__,_|\__\___| |_| |_| |_|\___|\__|_| |_|\___/ \__,_|__*/
private fun drawerSetDragMargin(size: Float) {
try {
val mDrawerLayout = drawer?.drawerLayout
val mDragger = mDrawerLayout?.javaClass?.getDeclaredField(
val mDrawerLayout = drawerLayout
val mDragger = mDrawerLayout::class.java.getDeclaredField(
"mLeftDragger"
)//mRightDragger for right obviously
mDragger?.isAccessible = true
val draggerObj = mDragger?.get(mDrawerLayout) as ViewDragHelper?
val mEdgeSize = draggerObj?.javaClass?.getDeclaredField(
"mEdgeSize"
)
mEdgeSize?.isAccessible = true
mDragger.isAccessible = true
val draggerObj = mDragger.get(mDrawerLayout) as ViewDragHelper?
draggerObj?.edgeSize = size.toInt()
mEdgeSize?.setInt(
draggerObj,
size.toInt()
) //optimal value as for me, you may set any constant in dp
// update for SDK >= 29 (Android 10)
val useSystemInsets = mDrawerLayout::class.java.getDeclaredField(
"sEdgeSizeUsingSystemGestureInsets"
)
useSystemInsets.isAccessible = true
useSystemInsets.set(null, false)
}
catch (e: Exception) {
e.printStackTrace()
@ -326,36 +320,37 @@ class NavDrawer(
}
internal fun decideDrawerMode(orientation: Int, widthDp: Int, heightDp: Int) {
val drawerLayoutParams = DrawerLayout.LayoutParams(WRAP_CONTENT, MATCH_PARENT).apply {
gravity = Gravity.START
}
val fixedLayoutParams = FrameLayout.LayoutParams(UIUtils.convertDpToPixel(300f, context).toInt(), MATCH_PARENT)
Log.d("NavLib", "Deciding drawer mode:")
if (orientation == Configuration.ORIENTATION_PORTRAIT) {
if (fixedDrawerContainer.childCount > 0) {
fixedDrawerContainer.removeAllViews()
}
Log.d("NavLib", "- fixed container disabled")
drawer?.drawerLayout?.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED)
if (drawer?.drawerLayout?.indexOfChild(drawerView) == -1) {
drawer?.drawerLayout?.addView(drawerView)
}
Log.d("NavLib", "- slider enabled")
if (miniDrawerContainerLandscape.childCount > 0) {
miniDrawerContainerLandscape.removeAllViews()
if (drawerContainerLandscape.childCount > 0) {
drawerContainerLandscape.removeAllViews()
}
Log.d("NavLib", "- mini drawer land disabled")
if (drawerLayout.indexOfChild(drawer) == -1) {
drawerLayout.addView(drawer, drawerLayoutParams)
}
drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED)
Log.d("NavLib", "- slider enabled")
if ((widthDp >= 480 && miniDrawerVisiblePortrait != false) || miniDrawerVisiblePortrait == true) {
if (miniDrawerView == null)
miniDrawerView = miniDrawer?.build(context)
if (miniDrawerContainerPortrait.indexOfChild(miniDrawerView) == -1)
miniDrawerContainerPortrait.addView(miniDrawerView)
if (drawerContainerPortrait.indexOfChild(miniDrawer) == -1)
drawerContainerPortrait.addView(miniDrawer)
Log.d("NavLib", "- mini drawer port enabled")
drawerSetDragMargin(72 * resources.displayMetrics.density)
drawerMode = DRAWER_MODE_MINI
updateMiniDrawer()
}
else {
if (miniDrawerContainerPortrait.childCount > 0) {
miniDrawerContainerPortrait.removeAllViews()
if (drawerContainerPortrait.childCount > 0) {
drawerContainerPortrait.removeAllViews()
}
Log.d("NavLib", "- mini drawer port disabled")
drawerSetDragMargin(20 * resources.displayMetrics.density)
@ -363,68 +358,67 @@ class NavDrawer(
}
}
else {
if (miniDrawerContainerPortrait.childCount > 0) {
miniDrawerContainerPortrait.removeAllViews()
if (drawerContainerPortrait.childCount > 0) {
drawerContainerPortrait.removeAllViews()
}
Log.d("NavLib", "- mini drawer port disabled")
if ((widthDp in 480 until 9000 && miniDrawerVisibleLandscape != false) || miniDrawerVisibleLandscape == true) {
if (miniDrawerView == null)
miniDrawerView = miniDrawer?.build(context)
if (miniDrawerContainerLandscape.indexOfChild(miniDrawerView) == -1)
miniDrawerContainerLandscape.addView(miniDrawerView)
if ((widthDp in 480 until 900 && miniDrawerVisibleLandscape != false) || miniDrawerVisibleLandscape == true) {
if (drawerContainerLandscape.indexOfChild(miniDrawer) == -1)
drawerContainerLandscape.addView(miniDrawer)
Log.d("NavLib", "- mini drawer land enabled")
drawerSetDragMargin(72 * resources.displayMetrics.density)
drawerMode = DRAWER_MODE_MINI
updateMiniDrawer()
}
else {
if (miniDrawerContainerLandscape.childCount > 0) {
miniDrawerContainerLandscape.removeAllViews()
if (drawerContainerLandscape.childCount > 0) {
drawerContainerLandscape.removeAllViews()
}
Log.d("NavLib", "- mini drawer land disabled")
drawerSetDragMargin(20 * resources.displayMetrics.density)
drawerMode = DRAWER_MODE_NORMAL
}
if (widthDp >= 9000) {
if (widthDp >= 900) {
// screen is big enough to show fixed drawer
if (drawer?.drawerLayout?.indexOfChild(drawerView) != -1) {
if (drawerLayout.indexOfChild(drawer) != -1) {
// remove from slider
drawer?.drawerLayout?.removeView(drawerView)
drawerLayout.removeView(drawer)
}
// lock the slider
drawer?.drawerLayout?.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED)
drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED)
Log.d("NavLib", "- slider disabled")
// add to fixed container
if (fixedDrawerContainer.indexOfChild(drawerView) == -1)
fixedDrawerContainer.addView(drawerView)
if (drawerContainerLandscape.indexOfChild(drawer) == -1)
drawerContainerLandscape.addView(drawer, fixedLayoutParams)
drawer.visibility = View.VISIBLE
Log.d("NavLib", "- fixed container enabled")
drawerMode = DRAWER_MODE_FIXED
}
else {
// screen is too small for the fixed drawer
if (fixedDrawerContainer.childCount > 0) {
if (drawerContainerLandscape.indexOfChild(drawer) != -1) {
// remove from fixed container
fixedDrawerContainer.removeAllViews()
drawerContainerLandscape.removeView(drawer)
}
Log.d("NavLib", "- fixed container disabled")
// unlock the slider
drawer?.drawerLayout?.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED)
if (drawer?.drawerLayout?.indexOfChild(drawerView) == -1) {
drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED)
if (drawerLayout.indexOfChild(drawer) == -1) {
// add to slider
drawer?.drawerLayout?.addView(drawerView)
drawerLayout.addView(drawer, drawerLayoutParams)
}
Log.d("NavLib", "- slider enabled")
}
}
miniDrawerElevation.visibility = if (drawerMode == DRAWER_MODE_MINI) View.VISIBLE else View.GONE
miniDrawerElevation.visibility = if (drawerMode == DRAWER_MODE_MINI || drawerMode == DRAWER_MODE_FIXED) View.VISIBLE else View.GONE
}
private fun updateMiniDrawer() {
selection = drawer?.currentSelection?.toInt() ?: -1
selection = drawer.selectedItemIdentifier.toInt()
//if (drawerMode == DRAWER_MODE_MINI)
miniDrawer?.createItems()
miniDrawer.createItems()
}
/* _____ _ _ _ _ _ _
@ -434,45 +428,37 @@ class NavDrawer(
| | | |_| | |_) | | | (__ | | | | | | __/ |_| | | | (_) | (_| \__ \
|_| \__,_|_.__/|_|_|\___| |_| |_| |_|\___|\__|_| |_|\___/ \__,_|__*/
var isOpen
get() = drawer?.isDrawerOpen ?: false || drawerMode == DRAWER_MODE_FIXED
get() = drawerLayout.isOpen || drawerMode == DRAWER_MODE_FIXED
set(value) {
if (drawerMode == DRAWER_MODE_FIXED)
return
if (value && !isOpen) drawer?.openDrawer() else if (!value && isOpen) drawer?.closeDrawer()
if (value && !isOpen) drawerLayout.open() else if (!value && isOpen) drawerLayout.close()
}
fun open() { isOpen = true }
fun close() { isOpen = false }
fun toggle() {
if (drawer == null)
return
isOpen = !isOpen
}
fun toggle() { isOpen = !isOpen }
var profileSelectionIsOpen
get() = accountHeader?.isSelectionListShown == true
get() = accountHeader.selectionListShown
set(value) {
if (value != profileSelectionIsOpen)
profileSelectionToggle()
}
fun profileSelectionOpen() { profileSelectionIsOpen = true }
fun profileSelectionClose() { profileSelectionIsOpen = false }
fun profileSelectionToggle() {
accountHeader?.let {
it.toggleSelectionList(it.view.context)
}
}
fun profileSelectionToggle() { accountHeader.selectionListShown = !accountHeader.selectionListShown }
var drawerOpenedListener: (() -> Unit)? = null
var drawerClosedListener: (() -> Unit)? = null
var drawerItemSelectedListener: ((id: Int, position: Int, drawerItem: IDrawerItem<*>) -> Boolean)? = null
var drawerItemLongClickListener: ((id: Int, position: Int, drawerItem: IDrawerItem<*>) -> Boolean)? = null
var drawerProfileSelectedListener: ((id: Int, profile: IProfile<*>, current: Boolean, view: View?) -> Boolean)? = null
var drawerProfileLongClickListener: ((id: Int, profile: IProfile<*>, current: Boolean, view: View) -> Boolean)? = null
var drawerProfileImageClickListener: ((id: Int, profile: IProfile<*>, current: Boolean, view: View) -> Boolean)? = null
var drawerProfileImageLongClickListener: ((id: Int, profile: IProfile<*>, current: Boolean, view: View) -> Boolean)? = null
var drawerProfileSelectedListener: ((id: Int, profile: IProfile, current: Boolean, view: View?) -> Boolean)? = null
var drawerProfileLongClickListener: ((id: Int, profile: IProfile, current: Boolean, view: View?) -> Boolean)? = null
var drawerProfileImageClickListener: ((id: Int, profile: IProfile, current: Boolean, view: View) -> Boolean)? = null
var drawerProfileImageLongClickListener: ((id: Int, profile: IProfile, current: Boolean, view: View) -> Boolean)? = null
var drawerProfileListEmptyListener: (() -> Unit)? = null
var drawerProfileSettingClickListener: ((id: Int, view: View?) -> Boolean)? = null
var drawerProfileSettingLongClickListener: ((id: Int, view: View) -> Boolean)? = null
var drawerProfileSettingLongClickListener: ((id: Int, view: View?) -> Boolean)? = null
fun miniDrawerEnabled(): Boolean = drawerMode == DRAWER_MODE_MINI
fun fixedDrawerEnabled(): Boolean = drawerMode == DRAWER_MODE_FIXED
@ -484,25 +470,26 @@ class NavDrawer(
profileSelectionClose()
selection = id
if (drawer?.currentSelection != id.toLong()) {
if (drawer.selectedItemIdentifier != id.toLong()) {
}
if (drawer?.currentSelection != id.toLong() || !fireOnClick)
drawer?.setSelection(id.toLong(), fireOnClick)
if (drawer.selectedItemIdentifier != id.toLong() || !fireOnClick)
drawer.setSelectionAtPosition(drawer.getPosition(id.toLong()), fireOnClick)
miniDrawer.setSelection(-1L)
if (drawerMode == DRAWER_MODE_MINI)
miniDrawer?.setSelection(id.toLong())
miniDrawer.setSelection(id.toLong())
}
fun getSelection(): Int = selection
// TODO 2019-08-27 add methods for Drawable, @DrawableRes
fun setAccountHeaderBackground(path: String?) {
if (path == null) {
accountHeader?.setBackgroundRes(R.drawable.header)
accountHeader.headerBackground = ImageHolder(R.drawable.header)
return
}
accountHeader?.setHeaderBackground(ImageHolder(path))
accountHeader.headerBackground = ImageHolder(path)
}
/* _____ __ _ _
@ -514,12 +501,12 @@ class NavDrawer(
private var profileList: MutableList<IDrawerProfile> = mutableListOf()
fun addProfileSettings(vararg items: ProfileSettingDrawerItem) {
accountHeader?.profiles?.addAll(items)
accountHeader.profiles?.addAll(items)
}
private fun updateProfileList() {
// remove all profile items
val profiles = accountHeader?.profiles?.filterNot { it is ProfileDrawerItem } as MutableList<IProfile<*>>?
val profiles = accountHeader.profiles?.filterNot { it is ProfileDrawerItem } as MutableList<IProfile>?
if (profileList.isEmpty())
drawerProfileListEmptyListener?.invoke()
@ -531,12 +518,14 @@ class NavDrawer(
.withName(profile.name)
.withEmail(profile.subname)
.also { it.icon = image }
.withBadgeStyle(badgeStyle)
.withNameShown(true)
.also { profiles?.add(index, it) }
}
accountHeader?.profiles = profiles
accountHeader.profiles = profiles
updateBadges()
updateMiniDrawer()
}
@ -548,10 +537,10 @@ class NavDrawer(
val profileListEmpty: Boolean
get() = profileList.isEmpty()
var currentProfile: Int
get() = accountHeader?.activeProfile?.identifier?.toInt() ?: -1
get() = accountHeader.activeProfile?.identifier?.toInt() ?: -1
set(value) {
Log.d("NavDebug", "currentProfile = $value")
accountHeader?.setActiveProfile(value.toLong(), false)
accountHeader.setActiveProfile(value.toLong(), false)
currentProfileObj = profileList.singleOrNull { it.id == value }
setToolbarProfileImage(currentProfileObj)
updateBadges()
@ -593,7 +582,7 @@ class NavDrawer(
updateProfileList()
}
fun removeAllProfileSettings() {
accountHeader?.profiles = accountHeader?.profiles?.filterNot { it is ProfileSettingDrawerItem }?.toMutableList()
accountHeader.profiles = accountHeader.profiles?.filterNot { it is ProfileSettingDrawerItem }?.toMutableList()
}
fun getProfileById(id: Int, run: (it: IDrawerProfile?) -> Unit) {
@ -629,21 +618,48 @@ class NavDrawer(
currentProfileObj = profileList.singleOrNull { it.id == currentProfile }
drawer.itemAdapter.itemList.items.forEachIndexed { index, item ->
if (item is Badgeable) {
item.badge = null
drawer.updateItem(item)
}
}
var profileCounters = listOf<IUnreadCounter>()
accountHeader.profiles?.forEach { profile ->
if (profile !is ProfileDrawerItem) return@forEach
val counters = unreadCounterList.filter { it.profileId == profile.identifier.toInt() }
val count = counters.sumBy { it.count }
val badge = when {
count == 0 -> null
count >= 99 -> StringHolder("99+")
else -> StringHolder(count.toString())
}
if (profile.badge != badge) {
profile.badge = badge
accountHeader.updateProfile(profile)
}
if (currentProfile == profile.identifier.toInt())
profileCounters = counters
}
Log.d("NavDebug", "updateBadges()")
unreadCounterList.map {
profileCounters.map {
it.drawerItemId = unreadCounterTypeMap[it.type]
}
var totalCount = 0
unreadCounterList.forEach {
profileCounters.forEach {
if (it.drawerItemId == null)
return@forEach
if (it.profileId != currentProfile) {
Log.d("NavDebug", "- Remove badge for ${it.drawerItemId}")
drawer?.updateBadge(it.drawerItemId?.toLong() ?: 0, null)
//Log.d("NavDebug", "- Remove badge for ${it.drawerItemId}")
//drawer?.updateBadge(it.drawerItemId?.toLong() ?: 0, null)
return@forEach
}
Log.d("NavDebug", "- Set badge ${it.count} for ${it.drawerItemId}")
drawer?.updateBadge(
drawer.updateBadge(
it.drawerItemId?.toLong() ?: 0,
when {
it.count == 0 -> null
@ -705,10 +721,10 @@ class NavDrawer(
}
if (item != null) {
item.count = count
updateBadges()
}
else {
unreadCounterList.add(UnreadCounter(profileId, type, null, count))
}
updateBadges()
}
}
}

@ -32,8 +32,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bottom_sheet_background"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:paddingHorizontal="8dp"
tools:paddingBottom="48dp"
android:orientation="vertical">
@ -107,4 +106,4 @@
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</layout>
</layout>

@ -7,8 +7,8 @@
android:orientation="horizontal"
tools:parentTag="FrameLayout">
<LinearLayout
android:id="@+id/nv_drawerContainer"
<androidx.drawerlayout.widget.DrawerLayout
android:id="@+id/nv_drawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
@ -37,10 +37,11 @@
tools:paddingBottom="48dp">
<FrameLayout
android:id="@+id/nv_miniDrawerContainerLandscape"
android:id="@+id/nv_drawerContainerLandscape"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@color/colorSurface_4dp"/><!--tools:layout_width="72dp"-->
android:background="@color/colorSurface_4dp"
tools:layout_width="72dp" />
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/nv_coordinator"
@ -49,22 +50,26 @@
<pl.szczodrzynski.navlib.NavToolbar
android:id="@+id/nv_toolbar"
style="@style/Widget.MaterialComponents.Toolbar.Surface"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_height="wrap_content"
android:background="?actionBarBackground"
android:clipToPadding="false"
android:elevation="4dp"
android:minHeight="?attr/actionBarSize"
app:title="@string/app_name"
app:titleMargin="0dp"
tools:targetApi="lollipop">
<com.mikepenz.materialdrawer.view.BezelImageView
android:id="@+id/nv_toolbar_image"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="end"
android:layout_gravity="center_vertical|end"
android:layout_marginEnd="13dp"
android:layout_marginRight="13dp"
android:scaleType="centerCrop"
app:biv_selectorOnPress="#80ffffff"
app:materialDrawerSelectorOnPress="#80ffffff"
tools:src="@tools:sample/backgrounds/scenic" />
</pl.szczodrzynski.navlib.NavToolbar>
@ -90,7 +95,8 @@
android:id="@+id/nv_miniDrawerContainerPortrait"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@color/colorSurface_4dp" /><!--tools:layout_width="72dp"-->
android:background="@color/colorSurface_4dp"
tools:layout_width="72dp" /><!--tools:layout_width="72dp"-->
<View
android:id="@+id/nv_miniDrawerElevation"
@ -174,13 +180,7 @@
</FrameLayout>
<FrameLayout
android:id="@+id/nv_fixedDrawerContainer"
android:layout_width="wrap_content"
android:layout_height="match_parent"
tools:background="#4caf50"/><!--tools:layout_width="300dp"-->
</LinearLayout>
</androidx.drawerlayout.widget.DrawerLayout>
<View
android:id="@+id/nv_statusBarDarker"
@ -208,4 +208,4 @@
android:layout_height="match_parent" />
</merge>
</merge>

@ -95,16 +95,9 @@
<item name="android:textViewStyle">@style/NavView.TextView</item>
<!-- drawer & bottom sheet styling -->
<item name="material_drawer_background">?android:colorBackground</item>
<item name="material_drawer_primary_text">?android:textColorPrimary</item>
<item name="material_drawer_primary_icon">#5F6368</item>
<item name="material_drawer_secondary_text">?android:textColorSecondary</item>
<item name="material_drawer_hint_text">@color/material_drawer_hint_text</item>
<item name="material_drawer_divider">@color/material_drawer_divider</item>
<item name="material_drawer_selected">@color/material_drawer_selected</item> <!-- Material 2 defines 12% alpha, primary color -->
<item name="material_drawer_selected_text">#242424</item>
<item name="material_drawer_header_selection_text">@color/material_drawer_header_selection_text</item>
<item name="material_drawer_header_selection_subtext">@color/material_drawer_dark_header_selection_subtext</item>
<item name="materialDrawerStyle">@style/Widget.MaterialDrawerStyle</item>
<item name="materialDrawerHeaderStyle">@style/Widget.MaterialDrawerHeaderStyle</item>
<!--<item name="materialDrawerPrimaryIcon">#5F6368</item>-->
</style>
<style name="NavView.Dark" parent="Theme.MaterialComponents.NoActionBar">
@ -148,16 +141,9 @@
<item name="android:textViewStyle">@style/NavView.TextView</item>
<!-- drawer & bottom sheet styling -->
<item name="material_drawer_background">?android:colorBackground</item>
<item name="material_drawer_primary_text">?android:textColorPrimary</item>
<item name="material_drawer_primary_icon">#9AA0A6</item>
<item name="material_drawer_secondary_text">?android:textColorSecondary</item>
<item name="material_drawer_hint_text">@color/material_drawer_dark_hint_text</item>
<item name="material_drawer_divider">@color/material_drawer_dark_divider</item>
<item name="material_drawer_selected">@color/material_drawer_dark_selected</item> <!-- Material 2 defines 12% alpha, primary color -->
<item name="material_drawer_selected_text">#FFFFFF</item>
<item name="material_drawer_header_selection_text">@color/material_drawer_dark_header_selection_text</item>
<item name="material_drawer_header_selection_subtext">@color/material_drawer_dark_header_selection_subtext</item>
<item name="materialDrawerStyle">@style/Widget.MaterialDrawerStyle</item>
<item name="materialDrawerHeaderStyle">@style/Widget.MaterialDrawerHeaderStyle</item>
<!--<item name="material_drawer_primary_icon">#9AA0A6</item>-->
</style>
<style name="NavView.Black" parent="NavView.Dark">
@ -170,4 +156,4 @@
<style name="width_max_600dp">
<item name="android:layout_width">match_parent</item>
</style>
</resources>
</resources>

@ -1 +1 @@
include ':app', ':navlib'
include ':app', ':navlib', ':navlib-font'