├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE.md ├── ci-gradle.properties ├── config │ └── configuration.json ├── dependabot.yml └── workflows │ ├── ci.yml │ └── gradle-dependency-submission.yml ├── .gitignore ├── DEV ├── functiongraphic │ └── functiongraphic.jpg ├── github │ ├── 2018-08-18 20.14.34.jpg │ ├── 2018-08-18 20.14.36.jpg │ ├── 2018-08-18 20.14.38.jpg │ ├── 2018-08-18 20.14.42.jpg │ ├── 2018-08-18 20.14.47.jpg │ ├── 2018-08-18 20.14.49.jpg │ ├── banner.png │ ├── screenshots1.png │ ├── screenshots2.png │ └── screenshots_combined.jpg └── screenshots │ ├── screenshot1.png │ ├── screenshot1_small.png │ ├── screenshot2.png │ ├── screenshot2_small.png │ ├── screenshot3.png │ ├── screenshot3_small.png │ ├── screenshot4.png │ └── screenshot4_small.png ├── Dangerfile ├── FAQ.md ├── FAQ ├── accountheader_single_profile_without_dropdown.md ├── howto_modify_add_custom_draweritems.md ├── howto_use_different_sub_library_version.md ├── opening-drawer-from-espresso.md └── when_to_use_this_library.md ├── Gemfile ├── Gemfile.lock ├── LICENSE ├── MIGRATION.md ├── README.md ├── app ├── .gitignore ├── build.gradle.kts ├── gradle.properties ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── ic_launcher-web.png │ ├── java │ └── com │ │ └── mikepenz │ │ └── materialdrawer │ │ └── app │ │ ├── ActionBarActivity.kt │ │ ├── AdvancedActivity.kt │ │ ├── CollapsingToolbarActivity.kt │ │ ├── CompactHeaderDrawerActivity.kt │ │ ├── CrossfadeDrawerLayoutActvitiy.kt │ │ ├── CustomApplication.kt │ │ ├── DrawerActivity.kt │ │ ├── EmbeddedDrawerActivity.kt │ │ ├── FragmentActivity.kt │ │ ├── FullscreenDrawerActivity.kt │ │ ├── MenuDrawerActivity.kt │ │ ├── MiniDrawerActivity.kt │ │ ├── MultiDrawerActivity.kt │ │ ├── NavControllerActivity.kt │ │ ├── PersistentDrawerActivity.kt │ │ ├── drawerItems │ │ ├── AccountDividerDrawerItem.kt │ │ ├── CustomBaseViewHolder.kt │ │ ├── CustomCenteredPrimaryDrawerItem.kt │ │ ├── CustomPrimaryDrawerItem.kt │ │ ├── CustomUrlBasePrimaryDrawerItem.kt │ │ ├── CustomUrlPrimaryDrawerItem.kt │ │ ├── GmailDrawerItem.kt │ │ ├── IconDrawerItem.kt │ │ └── OverflowMenuDrawerItem.kt │ │ ├── fragment │ │ ├── DemoFragment.kt │ │ ├── DemoMessageFragment.kt │ │ ├── DrawerFragment.kt │ │ └── SecondDrawerFragment.kt │ │ ├── utils │ │ ├── CrossfadeWrapper.kt │ │ ├── SystemUtils.kt │ │ └── UIUtils.kt │ │ └── widget │ │ └── CrossfadeDrawerLayout.kt │ └── res │ ├── drawable │ ├── header.jpg │ ├── profile.jpg │ ├── profile2.jpg │ ├── profile3.jpg │ ├── profile4.jpg │ ├── profile5.jpg │ └── profile6.jpg │ ├── layout │ ├── activity_embedded.xml │ ├── activity_mini_drawer.xml │ ├── activity_multi_sample.xml │ ├── activity_persistent_drawer.xml │ ├── activity_sample.xml │ ├── activity_sample_actionbar.xml │ ├── activity_sample_collapsing_toolbar.xml │ ├── activity_sample_crossfader.xml │ ├── activity_sample_fragment.xml │ ├── activity_sample_fullscreen.xml │ ├── activity_sample_nav.xml │ ├── footer.xml │ ├── fragment_message_sample.xml │ ├── fragment_sample.xml │ ├── fragment_simple_sample.xml │ ├── header.xml │ ├── material_drawer_compact_persistent_header.xml │ ├── material_drawer_item_icon_only.xml │ ├── material_drawer_item_overflow_menu_primary.xml │ └── material_drawer_item_primary_centered.xml │ ├── menu │ ├── cab.xml │ ├── embedded.xml │ ├── example_menu.xml │ ├── fragment_menu.xml │ └── main.xml │ ├── mipmap-anydpi-v26 │ ├── ic_launcher.xml │ └── ic_launcher_round.xml │ ├── mipmap-hdpi │ ├── ic_launcher.png │ ├── ic_launcher_foreground.png │ └── ic_launcher_round.png │ ├── mipmap-mdpi │ ├── ic_launcher.png │ ├── ic_launcher_foreground.png │ └── ic_launcher_round.png │ ├── mipmap-xhdpi │ ├── ic_launcher.png │ ├── ic_launcher_foreground.png │ └── ic_launcher_round.png │ ├── mipmap-xxhdpi │ ├── ic_launcher.png │ ├── ic_launcher_foreground.png │ └── ic_launcher_round.png │ ├── mipmap-xxxhdpi │ ├── ic_launcher.png │ ├── ic_launcher_foreground.png │ └── ic_launcher_round.png │ ├── navigation │ └── navigation.xml │ └── values │ ├── colors.xml │ ├── dimens.xml │ ├── ic_launcher_background.xml │ ├── ids.xml │ ├── strings.xml │ ├── styles.xml │ └── themes.xml ├── build.gradle.kts ├── gradle.properties ├── gradle ├── libs.versions.toml └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── materialdrawer-iconics ├── .gitignore ├── build.gradle.kts ├── gradle.properties └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── com │ └── mikepenz │ └── materialdrawer │ └── iconics │ ├── IconicsExtension.kt │ └── IconicsImageHolder.kt ├── materialdrawer-nav ├── .gitignore ├── build.gradle.kts ├── consumer-rules.pro ├── gradle.properties ├── proguard-rules.pro ├── proguard-rules.txt └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── com │ └── mikepenz │ └── materialdrawer │ ├── model │ └── NavigationDrawerItem.kt │ └── util │ └── DrawerNavigationUI.kt ├── materialdrawer ├── .gitignore ├── build.gradle.kts ├── gradle.properties ├── proguard-rules.txt └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── mikepenz │ │ └── materialdrawer │ │ ├── holder │ │ ├── BadgeStyle.kt │ │ ├── ColorHolder.kt │ │ ├── DimenHolder.kt │ │ ├── ImageHolder.kt │ │ └── StringHolder.kt │ │ ├── interfaces │ │ ├── ICrossfader.kt │ │ ├── OnCheckedChangeListener.kt │ │ └── OnPostBindViewListener.kt │ │ ├── model │ │ ├── AbstractBadgeableDrawerItem.kt │ │ ├── AbstractDrawerItem.kt │ │ ├── AbstractSwitchableDrawerItem.kt │ │ ├── AbstractToggleableDrawerItem.kt │ │ ├── BaseDescribeableDrawerItem.kt │ │ ├── BaseDrawerItem.kt │ │ ├── BaseViewHolder.kt │ │ ├── ContainerDrawerItem.kt │ │ ├── DividerDrawerItem.kt │ │ ├── ExpandableBadgeDrawerItem.kt │ │ ├── ExpandableDrawerItem.kt │ │ ├── MiniDrawerItem.kt │ │ ├── MiniProfileDrawerItem.kt │ │ ├── PrimaryDrawerItem.kt │ │ ├── ProfileDrawerItem.kt │ │ ├── ProfileSettingDrawerItem.kt │ │ ├── SecondaryDrawerItem.kt │ │ ├── SecondarySwitchDrawerItem.kt │ │ ├── SecondaryToggleDrawerItem.kt │ │ ├── SectionDrawerItem.kt │ │ ├── SwitchDrawerItem.kt │ │ ├── ToggleDrawerItem.kt │ │ ├── interfaces │ │ │ ├── Badgeable.kt │ │ │ ├── Checkable.kt │ │ │ ├── ColorfulBadgeable.kt │ │ │ ├── Describable.kt │ │ │ ├── DescribableColor.kt │ │ │ ├── IDrawerItem.kt │ │ │ ├── IProfile.kt │ │ │ ├── Iconable.kt │ │ │ ├── Nameable.kt │ │ │ ├── NameableColor.kt │ │ │ ├── SelectIconable.kt │ │ │ ├── Selectable.kt │ │ │ ├── SelectableColor.kt │ │ │ ├── Tagable.kt │ │ │ └── Typefaceable.kt │ │ └── utils │ │ │ ├── BadgeDrawableBuilder.kt │ │ │ └── DrawerItemExtensions.kt │ │ ├── util │ │ ├── AbstractDrawerImageLoader.kt │ │ ├── DrawerImageLoader.kt │ │ ├── DrawerItemViewHelper.kt │ │ ├── DrawerUtils.kt │ │ ├── Extensions.kt │ │ ├── FixStateListDrawable.kt │ │ ├── MaterialDrawerSliderViewExtensions.kt │ │ ├── MenuDrawerUtils.kt │ │ └── Utils.kt │ │ ├── view │ │ └── BezelImageView.kt │ │ └── widget │ │ ├── AccountHeaderView.kt │ │ ├── MaterialDrawerSliderView.kt │ │ └── MiniDrawerSliderView.kt │ └── res │ ├── color │ └── color_drawer_item_text.xml │ ├── drawable-v21 │ └── material_drawer_ico_account.xml │ ├── drawable │ ├── material_drawer_badge.xml │ ├── material_drawer_circle_mask.xml │ ├── material_drawer_ico_account.png │ ├── material_drawer_ico_account_layer.xml │ ├── material_drawer_ico_chevron_down.xml │ ├── material_drawer_ico_menu_down.xml │ ├── material_drawer_rectangle_mask.xml │ ├── material_drawer_shadow_bottom.xml │ ├── material_drawer_shadow_left.9.png │ ├── material_drawer_shadow_right.9.png │ └── material_drawer_shadow_top.xml │ ├── layout │ ├── material_drawer.xml │ ├── material_drawer_compact_header.xml │ ├── material_drawer_fits_not.xml │ ├── material_drawer_header.xml │ ├── material_drawer_inner_shadow.xml │ ├── material_drawer_item_container.xml │ ├── material_drawer_item_divider.xml │ ├── material_drawer_item_expandable.xml │ ├── material_drawer_item_expandable_badge.xml │ ├── material_drawer_item_mini.xml │ ├── material_drawer_item_mini_profile.xml │ ├── material_drawer_item_primary.xml │ ├── material_drawer_item_profile.xml │ ├── material_drawer_item_profile_setting.xml │ ├── material_drawer_item_secondary.xml │ ├── material_drawer_item_secondary_switch.xml │ ├── material_drawer_item_secondary_toggle.xml │ ├── material_drawer_item_section.xml │ ├── material_drawer_item_switch.xml │ ├── material_drawer_item_toggle.xml │ └── material_drawer_recycler_view.xml │ ├── values-fr │ └── strings.xml │ ├── values-pt │ └── strings.xml │ ├── values-sw600dp │ └── dimens.xml │ └── values │ ├── attrs.xml │ ├── colors.xml │ ├── dimens.xml │ ├── ids.xml │ ├── strings.xml │ └── styles.xml └── settings.gradle.kts /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [mikepenz] 4 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## About this issue 2 | 3 | - Briefly describe the issue 4 | - How can the issue be reproduced / sample code 5 | 6 | ## Details 7 | - [ ] Used library version 8 | - [ ] Used support library version 9 | - [ ] Used gradle build tools version 10 | - [ ] Used tooling / Android Studio version 11 | - [ ] Other used libraries, potential conflicting libraries 12 | 13 | ## Checklist 14 | 15 | - [ ] Searched for [similar issues](https://github.com/mikepenz/MaterialDrawer/issues) 16 | - [ ] Checked out the [sample application](https://github.com/mikepenz/MaterialDrawer/tree/develop/app) 17 | - [ ] Read the [README](https://github.com/mikepenz/MaterialDrawer/blob/develop/README.md) 18 | - [ ] Checked out the [CHANGELOG](https://github.com/mikepenz/MaterialDrawer/releases) 19 | - [ ] Read the [FAQ](https://github.com/mikepenz/MaterialDrawer/blob/develop/FAQ.md) 20 | - [ ] Checked out the [MIGRATION GUIDE](https://github.com/mikepenz/MaterialDrawer/blob/develop/MIGRATION.md) 21 | -------------------------------------------------------------------------------- /.github/ci-gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.daemon=true 2 | org.gradle.parallel=true 3 | org.gradle.workers.max=2 4 | org.gradle.jvmargs=-Xmx6G 5 | org.gradle.caching=true 6 | org.gradle.configureondemand=true 7 | # parallel kapt 8 | kapt.use.worker.api=true 9 | -------------------------------------------------------------------------------- /.github/config/configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | "categories": [ 3 | { 4 | "title": "## 🚀 Features", 5 | "labels": [ 6 | "feature" 7 | ] 8 | }, 9 | { 10 | "title": "## 🐛 Fixes", 11 | "labels": [ 12 | "fix" 13 | ] 14 | }, 15 | { 16 | "title": "## 🧪 Tests", 17 | "labels": [ 18 | "test" 19 | ] 20 | }, 21 | { 22 | "title": "## 💬 Other", 23 | "labels": [ 24 | "other", 25 | "dependencies" 26 | ] 27 | } 28 | ] 29 | } -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "github-actions" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" -------------------------------------------------------------------------------- /.github/workflows/gradle-dependency-submission.yml: -------------------------------------------------------------------------------- 1 | name: Gradle Dependency Submission 2 | on: 3 | push: 4 | branches: 5 | - develop 6 | 7 | jobs: 8 | gradle-dependency-detection: 9 | runs-on: ubuntu-latest 10 | # The Dependency Submission API requires write permission 11 | permissions: 12 | contents: write 13 | steps: 14 | - name: 'Checkout Repository' 15 | uses: actions/checkout@v4 16 | 17 | - uses: actions/setup-java@v4 18 | with: 19 | distribution: 'zulu' 20 | java-version: | 21 | 11 22 | 15 23 | 17 24 | 25 | - name: Copy CI gradle.properties 26 | run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties 27 | 28 | - name: Checkout Gradle Build Cache 29 | uses: actions/cache@v4 30 | with: 31 | path: | 32 | ~/.gradle/caches 33 | ~/.gradle/wrapper 34 | !~/.gradle/wrapper/dists/**/gradle*.zip 35 | key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} 36 | restore-keys: | 37 | gradle-${{ runner.os }}- 38 | 39 | - name: Submit Dependency Graph 40 | uses: mikepenz/gradle-dependency-submission@main 41 | with: 42 | gradle-build-module: :app 43 | gradle-build-configuration: debugCompileClasspath 44 | sub-module-mode: INDIVIDUAL_DEEP -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | 15 | # Gradle files 16 | .gradle/ 17 | build/ 18 | /*/build/ 19 | 20 | # Local configuration file (sdk path, etc) 21 | local.properties 22 | 23 | # Proguard folder generated by Eclipse 24 | proguard/ 25 | 26 | # Log Files 27 | *.log 28 | 29 | #IntelliJ files 30 | *.iml 31 | .idea/ 32 | functiongraphic.psd 33 | 34 | /.kotlin -------------------------------------------------------------------------------- /DEV/functiongraphic/functiongraphic.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/DEV/functiongraphic/functiongraphic.jpg -------------------------------------------------------------------------------- /DEV/github/2018-08-18 20.14.34.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/DEV/github/2018-08-18 20.14.34.jpg -------------------------------------------------------------------------------- /DEV/github/2018-08-18 20.14.36.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/DEV/github/2018-08-18 20.14.36.jpg -------------------------------------------------------------------------------- /DEV/github/2018-08-18 20.14.38.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/DEV/github/2018-08-18 20.14.38.jpg -------------------------------------------------------------------------------- /DEV/github/2018-08-18 20.14.42.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/DEV/github/2018-08-18 20.14.42.jpg -------------------------------------------------------------------------------- /DEV/github/2018-08-18 20.14.47.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/DEV/github/2018-08-18 20.14.47.jpg -------------------------------------------------------------------------------- /DEV/github/2018-08-18 20.14.49.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/DEV/github/2018-08-18 20.14.49.jpg -------------------------------------------------------------------------------- /DEV/github/banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/DEV/github/banner.png -------------------------------------------------------------------------------- /DEV/github/screenshots1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/DEV/github/screenshots1.png -------------------------------------------------------------------------------- /DEV/github/screenshots2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/DEV/github/screenshots2.png -------------------------------------------------------------------------------- /DEV/github/screenshots_combined.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/DEV/github/screenshots_combined.jpg -------------------------------------------------------------------------------- /DEV/screenshots/screenshot1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/DEV/screenshots/screenshot1.png -------------------------------------------------------------------------------- /DEV/screenshots/screenshot1_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/DEV/screenshots/screenshot1_small.png -------------------------------------------------------------------------------- /DEV/screenshots/screenshot2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/DEV/screenshots/screenshot2.png -------------------------------------------------------------------------------- /DEV/screenshots/screenshot2_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/DEV/screenshots/screenshot2_small.png -------------------------------------------------------------------------------- /DEV/screenshots/screenshot3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/DEV/screenshots/screenshot3.png -------------------------------------------------------------------------------- /DEV/screenshots/screenshot3_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/DEV/screenshots/screenshot3_small.png -------------------------------------------------------------------------------- /DEV/screenshots/screenshot4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/DEV/screenshots/screenshot4.png -------------------------------------------------------------------------------- /DEV/screenshots/screenshot4_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/DEV/screenshots/screenshot4_small.png -------------------------------------------------------------------------------- /Dangerfile: -------------------------------------------------------------------------------- 1 | github.dismiss_out_of_range_messages 2 | 3 | # Make it more obvious that a PR is a work in progress and shouldn't be merged yet. 4 | has_wip_label = github.pr_labels.any? { |label| label.include? "Engineers at work" } 5 | has_wip_title = github.pr_title.include? "[WIP]" 6 | 7 | if has_wip_label || has_wip_title 8 | warn("PR is marked as Work in Progress") 9 | end 10 | 11 | # Ensure the PR is not marked as DO NOT MERGE 12 | fail("PR specifies label DO NOT MERGE") if github.pr_labels.any? { |label| label.include? "DO NOT MERGE" } 13 | 14 | # Warn when there is a big PR 15 | warn("Big PR") if git.lines_of_code > 5000 16 | 17 | File.open("settings.gradle.kts", "r") do |file_handle| 18 | file_handle.each_line do |setting| 19 | if setting.include? "include" 20 | gradleModule = setting[10, setting.length-13] 21 | 22 | # AndroidLint 23 | androidLintFile = String.new(gradleModule + "/build/reports/lint-results.xml") 24 | androidLintDebugFile = String.new(gradleModule + "/build/reports/lint-results-debug.xml") 25 | if File.file?(androidLintFile) || File.file?(androidLintDebugFile) 26 | android_lint.skip_gradle_task = true 27 | android_lint.severity = "Warning" 28 | if File.file?(androidLintFile) 29 | android_lint.report_file = androidLintFile 30 | else 31 | android_lint.report_file = androidLintDebugFile 32 | end 33 | android_lint.filtering = true 34 | android_lint.lint(inline_mode: true) 35 | end 36 | 37 | # Detekt 38 | detektFile = String.new(gradleModule + "/build/reports/detekt.xml") 39 | if File.file?(detektFile) 40 | kotlin_detekt.report_file = detektFile 41 | kotlin_detekt.skip_gradle_task = true 42 | kotlin_detekt.severity = "warning" 43 | kotlin_detekt.filtering = true 44 | kotlin_detekt.detekt(inline_mode: true) 45 | end 46 | end 47 | end 48 | end -------------------------------------------------------------------------------- /FAQ.md: -------------------------------------------------------------------------------- 1 | # FAQ / WIKI 2 | 3 | This is the official **MaterialDrawer** FAQ/Wiki. People can contribute to it through pull requests. 4 | Each question and it's answer is hosted in a separate file within the FAQ folder. 5 | 6 | ## MaterialDrawer 7 | 8 | * [Should I use this library or Material Drawer from the Support library?](FAQ/when_to_use_this_library.md) 9 | * [How do I make the drawer appear underneath the Toolbar?](FAQ/howto_show_drawer_under_toolbar.md) 10 | * [How do I create a Multi-pane layout with MaterialDrawer for tablets?](FAQ/howto_show_drawer_in_tablet_multipane.md) 11 | * [Why is there whitespace where the status bar should be while my theme is set as fullscreen ?](FAQ/status_bar_whitespace.md) 12 | * [How do I change existing or add my own CustomDrawerItems to the MaterialDrawer?](FAQ/howto_modify_add_custom_draweritems.md) 13 | * [How to use different dependency library versions](FAQ/howto_use_different_sub_library_version.md) 14 | 15 | ## AccountHeader 16 | 17 | * [How can I use the AccountHeader with just one profile and disable the dropdown?](FAQ/accountheader_single_profile_without_dropdown.md) 18 | 19 | ## Testing 20 | 21 | * [How can I open the drawer from an instrumental test written with Espresso?](FAQ/opening-drawer-from-espresso.md) 22 | 23 | 24 | ## CustomDrawerItem's 25 | 26 | * [A custom SecondaryDrawerItem that takes different name when its on disabled state](https://gist.github.com/AngleV/400377184386193c985d905bd97f2d40) 27 | 28 | ## Asked super frequently 29 | 30 | ### How can i create a drawer without a default selection 31 | ```kotlin 32 | //just set the selection to -1 33 | slider.setSelectionAtPosition(-1) 34 | ``` 35 | 36 | ### Can I lock the Drawer 37 | As the MaterialDrawer will just create a normal DrawerLayout (with some magic around it) everything a normal 38 | DrawerLayout can do is also available in the MaterialDrawer. 39 | ```kotlin 40 | drawerLayout.setDrawerLockMode(int lockMode); //or (int lockMode, int edgeGravity) 41 | ``` -------------------------------------------------------------------------------- /FAQ/accountheader_single_profile_without_dropdown.md: -------------------------------------------------------------------------------- 1 | # How can i use the AccountHeader with just one profile and disable the dropdown? 2 | 3 | This can be simply achieved by adding `headerView.selectionListEnabledForSingleProfile = false` to the 4 | `Builder` of the `AccountHeader`. This will then disable the dropdown and hide the arrow from the 5 | header. 6 | 7 | ## Sample code 8 | 9 | ```kotlin 10 | headerView.selectionListEnabledForSingleProfile = false 11 | ``` 12 | 13 | ## Links 14 | * https://github.com/mikepenz/MaterialDrawer/issues/615 15 | * https://github.com/mikepenz/MaterialDrawer/issues/454 16 | * https://github.com/mikepenz/MaterialDrawer/issues/443 17 | * https://github.com/mikepenz/MaterialDrawer/issues/350 18 | -------------------------------------------------------------------------------- /FAQ/howto_modify_add_custom_draweritems.md: -------------------------------------------------------------------------------- 1 | # How do I change existing or add my own CustomDrawerItems to the MaterialDrawer? 2 | 3 | Please head over here on how to implement a proper CustomDrawerItem: 4 | - http://stackoverflow.com/a/32543209/325479 5 | - http://stackoverflow.com/a/32542999/325479 6 | 7 | Or you check out custom drawer item implementations here: 8 | - https://github.com/mikepenz/MaterialDrawer/tree/develop/app/src/main/java/com/mikepenz/materialdrawer/app/drawerItems 9 | 10 | You might also find some answers here: 11 | - https://github.com/mikepenz/MaterialDrawer/issues?utf8=%E2%9C%93&q=CustomDrawerItem 12 | -------------------------------------------------------------------------------- /FAQ/howto_use_different_sub_library_version.md: -------------------------------------------------------------------------------- 1 | # How do I use different versions of the sub dependencies like the support libraries? 2 | 3 | This can be really easy achieved by providing a resolutionStrategy to your build. 4 | 5 | ## Sample code 6 | Simple add the following to your modules build.gradle. It allows you to define whatever version you need for the sub dependencies. 7 | 8 | ```xml 9 | 10 | configurations.all { 11 | resolutionStrategy.force "com.android.support:support-v4:${versions.androidX}" 12 | resolutionStrategy.force "com.android.support:appcompat-v7:${versions.androidX}" 13 | resolutionStrategy.force "com.android.support:cardview-v7:${versions.androidX}" 14 | resolutionStrategy.force "com.android.support:recyclerview-v7:${versions.androidX}" 15 | resolutionStrategy.force "com.android.support:design:${versions.androidX}" 16 | resolutionStrategy.force "com.android.support:support-annotations:${versions.androidX}" 17 | } 18 | ``` 19 | 20 | https://github.com/mikepenz/MaterialDrawer/blob/develop/app/build.gradle 21 | -------------------------------------------------------------------------------- /FAQ/opening-drawer-from-espresso.md: -------------------------------------------------------------------------------- 1 | ### Q: How to open the drawer from an instrumental test written with Espresso? 2 | ### A: 3 | 4 | First, you need a add `espresso-contrib` to your project. It has the needed `DrawerActions` class. 5 | 6 | `androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.2.2'` 7 | 8 | Then, you need to open the drawer with his `openDrawer()` method and the drawer layout ID. The generated one is `R.id.material_drawer_layout` 9 | 10 | `onView(withId(R.id.material_drawer_layout)).perform(DrawerActions.open());` 11 | -------------------------------------------------------------------------------- /FAQ/when_to_use_this_library.md: -------------------------------------------------------------------------------- 1 | ### Developer: 2 | Since there is MaterialDrawer in Support Library, could you give a couple of points why to use your library instead of from Support Library one? 3 | 4 | ### Author: 5 | Well, that really depends on the use case of the drawer in this project, and which functionalities + which customizations are needed. 6 | The MaterialDrawer was created long before Google came up with their drawer in the design support libraries. 7 | 8 | Basically, the one of Google is definitely great and I recommend it to being used in all cases where it is enough. I am a fan of keeping 9 | things as simple as possible, as it will have the great effect on the user experience. So if this project only needs a very minimal drawer 10 | implementation, with just `Main` items, no `profile` functionality, and no great flexibility (no custom items, no custom styles, ... no advanced API for doing stuff programmatically) then you should definitely consider using the one from the design library. 11 | 12 | If you have a more advanced use case, like using the profile switcher, the profile page, custom items like different sizes, or checkboxes, etc then you might want to stay with my library. 13 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | source "https://rubygems.org" 4 | 5 | git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } 6 | 7 | gem 'danger' 8 | gem 'danger-android_lint' 9 | gem 'danger-kotlin_detekt' -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | addressable (2.8.7) 5 | public_suffix (>= 2.0.2, < 7.0) 6 | ansi (1.5.0) 7 | ast (2.4.2) 8 | base64 (0.2.0) 9 | claide (1.1.0) 10 | claide-plugins (0.9.2) 11 | cork 12 | nap 13 | open4 (~> 1.3) 14 | colored2 (3.1.2) 15 | cork (0.3.0) 16 | colored2 (~> 3.1) 17 | danger (9.5.1) 18 | base64 (~> 0.2) 19 | claide (~> 1.0) 20 | claide-plugins (>= 0.9.2) 21 | colored2 (~> 3.1) 22 | cork (~> 0.1) 23 | faraday (>= 0.9.0, < 3.0) 24 | faraday-http-cache (~> 2.0) 25 | git (~> 1.13) 26 | kramdown (~> 2.3) 27 | kramdown-parser-gfm (~> 1.0) 28 | octokit (>= 4.0) 29 | pstore (~> 0.1) 30 | terminal-table (>= 1, < 4) 31 | danger-android_lint (0.0.12) 32 | danger-plugin-api (~> 1.0) 33 | oga 34 | danger-kotlin_detekt (0.0.3) 35 | danger-plugin-api (~> 1.0) 36 | danger-plugin-api (1.0.0) 37 | danger (> 2.0) 38 | faraday (2.12.2) 39 | faraday-net_http (>= 2.0, < 3.5) 40 | json 41 | logger 42 | faraday-http-cache (2.5.1) 43 | faraday (>= 0.8) 44 | faraday-net_http (3.4.0) 45 | net-http (>= 0.5.0) 46 | git (1.19.1) 47 | addressable (~> 2.8) 48 | rchardet (~> 1.8) 49 | json (2.9.1) 50 | kramdown (2.5.1) 51 | rexml (>= 3.3.9) 52 | kramdown-parser-gfm (1.1.0) 53 | kramdown (~> 2.0) 54 | logger (1.6.4) 55 | nap (1.1.0) 56 | net-http (0.6.0) 57 | uri 58 | octokit (9.2.0) 59 | faraday (>= 1, < 3) 60 | sawyer (~> 0.9) 61 | oga (3.4) 62 | ast 63 | ruby-ll (~> 2.1) 64 | open4 (1.3.4) 65 | pstore (0.1.4) 66 | public_suffix (6.0.1) 67 | rchardet (1.8.0) 68 | rexml (3.4.0) 69 | ruby-ll (2.1.3) 70 | ansi 71 | ast 72 | sawyer (0.9.2) 73 | addressable (>= 2.3.5) 74 | faraday (>= 0.17.3, < 3) 75 | terminal-table (3.0.2) 76 | unicode-display_width (>= 1.1.1, < 3) 77 | unicode-display_width (2.6.0) 78 | uri (1.0.2) 79 | 80 | PLATFORMS 81 | ruby 82 | 83 | DEPENDENCIES 84 | danger 85 | danger-android_lint 86 | danger-kotlin_detekt 87 | 88 | BUNDLED WITH 89 | 2.6.2 90 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("com.mikepenz.convention.android-application") 3 | id("com.mikepenz.convention.kotlin") 4 | id("com.mikepenz.aboutlibraries.plugin") 5 | id("androidx.navigation.safeargs.kotlin") 6 | } 7 | 8 | android { 9 | namespace = "com.mikepenz.materialdrawer.app" 10 | 11 | defaultConfig { 12 | multiDexEnabled = true 13 | setProperty("archivesBaseName", "MaterialDrawer-v$versionName-c$versionCode") 14 | } 15 | 16 | productFlavors { 17 | } 18 | 19 | buildFeatures { 20 | viewBinding = true 21 | } 22 | 23 | packaging { 24 | resources { 25 | excludes.add("META-INF/library-core_release.kotlin_module") 26 | excludes.add("META-INF/library_release.kotlin_module") 27 | } 28 | } 29 | } 30 | 31 | dependencies { 32 | implementation(project(":materialdrawer")) 33 | implementation(project(":materialdrawer-iconics")) 34 | implementation(project(":materialdrawer-nav")) 35 | 36 | implementation(libs.google.material) 37 | 38 | implementation(libs.androidx.cardView) 39 | implementation(libs.androidx.recyclerView) 40 | implementation(libs.androidx.navigation.fragment) 41 | implementation(libs.androidx.navigation.ui) 42 | 43 | // used to showcase how to load images 44 | implementation("io.coil-kt:coil:2.7.0") 45 | 46 | //used to provide different itemAnimators for the RecyclerView 47 | //https://github.com/mikepenz/ItemAnimators 48 | implementation(libs.itemAnimators.core) 49 | 50 | // used to provide out of the box icon font support. simplifies development, 51 | // and provides scalable icons. the core is very very light 52 | // https://github.com/mikepenz/Android-Iconics 53 | implementation(libs.iconics.core) 54 | 55 | // used to generate the Open Source section 56 | // https://github.com/mikepenz/AboutLibraries 57 | implementation(baseLibs.aboutlibraries.view) 58 | 59 | // used to provide the MiniDrawer to normal Drawer crossfade effect via a SlidingPane layout 60 | // --> https://github.com/mikepenz/MaterialDrawer/blob/develop/app/src/main/java/com/mikepenz/materialdrawer/app/MiniDrawerActivity.java 61 | // https://github.com/mikepenz/Crossfader 62 | implementation("com.mikepenz:crossfader:1.6.0@aar") 63 | // used to provide the two step crossfade DrawerLayout. Which allows to have a mini layout which transforms to a normal layout within the drawer 64 | // --> https://github.com/mikepenz/MaterialDrawer/blob/develop/app/src/main/java/com/mikepenz/materialdrawer/app/CrossfadeDrawerLayoutActvitiy.java 65 | // https://github.com/mikepenz/CrossfadeDrawerLayout 66 | implementation("com.mikepenz:crossfadedrawerlayout:1.1.0@aar") 67 | 68 | // icon fonts used inside the sample 69 | // https://github.com/mikepenz/Android-Iconics 70 | implementation("com.mikepenz:google-material-typeface:4.0.0.2-kotlin@aar") 71 | implementation("com.mikepenz:fontawesome-typeface:5.13.3.0-kotlin@aar") 72 | implementation("com.mikepenz:octicons-typeface:11.1.0.0-kotlin@aar") 73 | 74 | 75 | implementation("androidx.multidex:multidex:2.0.1") 76 | 77 | implementation("androidx.slidingpanelayout:slidingpanelayout:1.1.0") { 78 | version { 79 | strictly("1.1.0") 80 | } 81 | } 82 | implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0") 83 | 84 | 85 | } 86 | 87 | configurations.configureEach { 88 | resolutionStrategy.force(libs.fastAdapter.core) 89 | resolutionStrategy.force(libs.iconics.core) 90 | } -------------------------------------------------------------------------------- /app/gradle.properties: -------------------------------------------------------------------------------- 1 | com.mikepenz.compose.enabled=false -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Entwicklung/android-sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" 3 | xmlns:tools="http://schemas.android.com/tools"> 4 | 5 | <uses-permission android:name="android.permission.INTERNET" /> 6 | 7 | <application 8 | android:name=".CustomApplication" 9 | android:allowBackup="true" 10 | android:icon="@mipmap/ic_launcher" 11 | android:label="@string/app_name" 12 | android:roundIcon="@mipmap/ic_launcher_round" 13 | android:theme="@style/SampleApp.DayNight" 14 | tools:ignore="GoogleAppIndexingWarning"> 15 | <!-- android:supportsRtl="true" --> 16 | <activity 17 | android:name=".DrawerActivity" 18 | android:label="@string/app_name" 19 | android:exported="true" 20 | android:theme="@style/SampleApp.DayNight"> 21 | <intent-filter> 22 | <action android:name="android.intent.action.MAIN" /> 23 | 24 | <category android:name="android.intent.category.LAUNCHER" /> 25 | </intent-filter> 26 | </activity> 27 | <activity 28 | android:name=".CompactHeaderDrawerActivity" 29 | android:label="@string/app_name" 30 | android:theme="@style/SampleApp.DayNight.Compact" /> 31 | <activity 32 | android:name=".PersistentDrawerActivity" 33 | android:label="@string/app_name" 34 | android:theme="@style/SampleApp.DayNight.Persistent" /> 35 | <activity 36 | android:name=".ActionBarActivity" 37 | android:theme="@style/SampleApp.DayNight.DarkActionBar" /> 38 | <activity 39 | android:name=".MenuDrawerActivity" 40 | android:theme="@style/SampleApp.DayNight" /> 41 | <activity 42 | android:name=".MultiDrawerActivity" 43 | android:theme="@style/SampleApp.DayNight" /> 44 | <activity 45 | android:name=".AdvancedActivity" 46 | android:theme="@style/SampleApp.DayNight" /> 47 | <activity 48 | android:name=".EmbeddedDrawerActivity" 49 | android:theme="@style/SampleApp.DayNight" /> 50 | <activity 51 | android:name=".MiniDrawerActivity" 52 | android:theme="@style/SampleApp.DayNight" /> 53 | <activity 54 | android:name=".FullscreenDrawerActivity" 55 | android:theme="@style/SampleApp.DayNight" /> 56 | <activity 57 | android:name=".FragmentActivity" 58 | android:theme="@style/SampleApp.DayNight" /> 59 | <activity 60 | android:name=".CollapsingToolbarActivity" 61 | android:theme="@style/SampleApp.DayNight" /> 62 | <activity 63 | android:name=".CrossfadeDrawerLayoutActvitiy" 64 | android:theme="@style/SampleApp.DayNight" /> 65 | <activity 66 | android:name=".NavControllerActivity" 67 | android:label="NavControllerExample" 68 | android:theme="@style/SampleApp.DayNight" /> 69 | </application> 70 | 71 | </manifest> -------------------------------------------------------------------------------- /app/src/main/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/app/src/main/ic_launcher-web.png -------------------------------------------------------------------------------- /app/src/main/java/com/mikepenz/materialdrawer/app/ActionBarActivity.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.app 2 | 3 | import android.os.Bundle 4 | import android.view.MenuItem 5 | import android.widget.Toast 6 | import androidx.appcompat.app.AppCompatActivity 7 | import com.mikepenz.iconics.typeface.library.fontawesome.FontAwesome 8 | import com.mikepenz.materialdrawer.app.databinding.ActivitySampleActionbarBinding 9 | import com.mikepenz.materialdrawer.iconics.iconicsIcon 10 | import com.mikepenz.materialdrawer.model.PrimaryDrawerItem 11 | import com.mikepenz.materialdrawer.model.SecondaryDrawerItem 12 | import com.mikepenz.materialdrawer.model.interfaces.Nameable 13 | import com.mikepenz.materialdrawer.model.interfaces.nameRes 14 | 15 | class ActionBarActivity : AppCompatActivity() { 16 | private lateinit var binding: ActivitySampleActionbarBinding 17 | 18 | override fun onCreate(savedInstanceState: Bundle?) { 19 | //supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); 20 | super.onCreate(savedInstanceState) 21 | binding = ActivitySampleActionbarBinding.inflate(layoutInflater).also { 22 | setContentView(it.root) 23 | } 24 | setTitle(R.string.drawer_item_action_bar_drawer) 25 | 26 | binding.slider.apply { 27 | itemAdapter.add( 28 | PrimaryDrawerItem().apply { 29 | nameRes = R.string.drawer_item_home 30 | iconicsIcon = FontAwesome.Icon.faw_home 31 | }, 32 | SecondaryDrawerItem().apply { 33 | nameRes = R.string.drawer_item_settings 34 | iconicsIcon = FontAwesome.Icon.faw_cog 35 | } 36 | ) 37 | onDrawerItemClickListener = { _, drawerItem, _ -> 38 | if (drawerItem is Nameable) { 39 | Toast.makeText(this@ActionBarActivity, (drawerItem as Nameable).name!!.getText(this@ActionBarActivity), Toast.LENGTH_SHORT).show() 40 | } 41 | false 42 | } 43 | setSavedInstance(savedInstanceState) 44 | } 45 | 46 | supportActionBar?.setDisplayHomeAsUpEnabled(true) 47 | supportActionBar?.setHomeButtonEnabled(false) 48 | } 49 | 50 | override fun onSaveInstanceState(_outState: Bundle) { 51 | //add the values which need to be saved from the drawer to the bundle 52 | super.onSaveInstanceState(binding.slider.saveInstanceState(_outState)) 53 | } 54 | 55 | override fun onOptionsItemSelected(item: MenuItem): Boolean { 56 | return when (item.itemId) { 57 | android.R.id.home -> { 58 | onBackPressed() 59 | true 60 | } 61 | else -> super.onOptionsItemSelected(item) 62 | } 63 | } 64 | 65 | override fun onBackPressed() { 66 | //handle the back press :D close the drawer first and if the drawer is closed close the activity 67 | if (binding.root.isDrawerOpen(binding.slider)) { 68 | binding.root.closeDrawer(binding.slider) 69 | } else { 70 | super.onBackPressed() 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /app/src/main/java/com/mikepenz/materialdrawer/app/CustomApplication.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.app 2 | 3 | import android.content.Context 4 | import android.graphics.drawable.Drawable 5 | import android.net.Uri 6 | import android.widget.ImageView 7 | import androidx.multidex.MultiDexApplication 8 | import coil.dispose 9 | import coil.load 10 | import com.google.android.material.color.DynamicColors 11 | import com.mikepenz.iconics.Iconics 12 | import com.mikepenz.iconics.IconicsDrawable 13 | import com.mikepenz.iconics.utils.backgroundColorRes 14 | import com.mikepenz.iconics.utils.sizeDp 15 | import com.mikepenz.materialdrawer.util.AbstractDrawerImageLoader 16 | import com.mikepenz.materialdrawer.util.DrawerImageLoader 17 | import com.mikepenz.materialdrawer.util.getPlaceHolder 18 | 19 | /** 20 | * Created by mikepenz on 27.03.15. 21 | */ 22 | class CustomApplication : MultiDexApplication() { 23 | override fun onCreate() { 24 | super.onCreate() 25 | 26 | Iconics.init(this) 27 | 28 | DynamicColors.applyToActivitiesIfAvailable(this) 29 | 30 | //initialize and create the image loader logic 31 | /* 32 | DrawerImageLoader.init(object : AbstractDrawerImageLoader() { 33 | override fun set(imageView: ImageView, uri: Uri, placeholder: Drawable) { 34 | Picasso.get().load(uri).placeholder(placeholder).into(imageView) 35 | } 36 | 37 | override fun cancel(imageView: ImageView) { 38 | Picasso.get().cancelRequest(imageView) 39 | } 40 | }) 41 | */ 42 | 43 | //initialize and create the image loader logic 44 | DrawerImageLoader.init(object : AbstractDrawerImageLoader() { 45 | override fun set(imageView: ImageView, uri: Uri, placeholder: Drawable, tag: String?) { 46 | imageView.load(uri) { 47 | allowHardware(false) 48 | placeholder(placeholder) 49 | } 50 | } 51 | 52 | override fun cancel(imageView: ImageView) { 53 | imageView.dispose() 54 | } 55 | 56 | override fun placeholder(ctx: Context, tag: String?): Drawable { 57 | //define different placeholders for different imageView targets 58 | //default tags are accessible via the DrawerImageLoader.Tags 59 | //custom ones can be checked via string. see the CustomUrlBasePrimaryDrawerItem LINE 111 60 | return when (tag) { 61 | DrawerImageLoader.Tags.PROFILE.name -> getPlaceHolder(ctx) 62 | DrawerImageLoader.Tags.ACCOUNT_HEADER.name -> IconicsDrawable(ctx, " ").apply { backgroundColorRes = R.color.colorPrimary; sizeDp = 56 } 63 | "customUrlItem" -> IconicsDrawable(ctx, " ").apply { backgroundColorRes = R.color.colorAccent; sizeDp = 56 } 64 | //we use the default one for 65 | //DrawerImageLoader.Tags.PROFILE_DRAWER_ITEM.name() 66 | else -> super.placeholder(ctx, tag) 67 | } 68 | } 69 | }) 70 | } 71 | } 72 | 73 | -------------------------------------------------------------------------------- /app/src/main/java/com/mikepenz/materialdrawer/app/FragmentActivity.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.app 2 | 3 | import android.os.Bundle 4 | import android.view.Menu 5 | import android.view.MenuItem 6 | import androidx.appcompat.app.AppCompatActivity 7 | import com.mikepenz.materialdrawer.app.databinding.ActivitySampleFragmentBinding 8 | import com.mikepenz.materialdrawer.app.fragment.DrawerFragment 9 | import com.mikepenz.materialdrawer.app.fragment.SecondDrawerFragment 10 | 11 | class FragmentActivity : AppCompatActivity() { 12 | private lateinit var binding: ActivitySampleFragmentBinding 13 | 14 | override fun onCreate(savedInstanceState: Bundle?) { 15 | super.onCreate(savedInstanceState) 16 | binding = ActivitySampleFragmentBinding.inflate(layoutInflater).also { 17 | setContentView(it.root) 18 | } 19 | 20 | // Handle Toolbar 21 | setSupportActionBar(binding.toolbar) 22 | supportActionBar?.setTitle(R.string.drawer_item_fragment_drawer) 23 | 24 | //ignore the DemoFragment and it's layout it's just to showcase the handle with an keyboard 25 | if (savedInstanceState == null) { 26 | val f = DrawerFragment.newInstance("Demo") 27 | supportFragmentManager.beginTransaction().replace(R.id.fragment_container, f).commit() 28 | } 29 | } 30 | 31 | override fun onCreateOptionsMenu(menu: Menu): Boolean { 32 | val inflater = menuInflater 33 | inflater.inflate(R.menu.fragment_menu, menu) 34 | return true 35 | } 36 | 37 | override fun onOptionsItemSelected(item: MenuItem): Boolean { 38 | //handle the click on the back arrow click 39 | when (item.itemId) { 40 | R.id.menu_1 -> { 41 | val f = DrawerFragment.newInstance("Demo") 42 | supportFragmentManager.beginTransaction().replace(R.id.fragment_container, f).commit() 43 | return true 44 | } 45 | R.id.menu_2 -> { 46 | val f2 = SecondDrawerFragment.newInstance("Demo 2") 47 | supportFragmentManager.beginTransaction().replace(R.id.fragment_container, f2).commit() 48 | return true 49 | } 50 | android.R.id.home -> { 51 | onBackPressed() 52 | return true 53 | } 54 | else -> return super.onOptionsItemSelected(item) 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /app/src/main/java/com/mikepenz/materialdrawer/app/MenuDrawerActivity.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.app 2 | 3 | import android.content.res.Configuration 4 | import android.os.Bundle 5 | import android.view.MenuItem 6 | import android.widget.Toast 7 | import androidx.appcompat.app.ActionBarDrawerToggle 8 | import androidx.appcompat.app.AppCompatActivity 9 | import com.mikepenz.materialdrawer.app.databinding.ActivitySampleBinding 10 | import com.mikepenz.materialdrawer.model.interfaces.Nameable 11 | import com.mikepenz.materialdrawer.util.inflateMenu 12 | 13 | class MenuDrawerActivity : AppCompatActivity() { 14 | private lateinit var binding: ActivitySampleBinding 15 | private lateinit var actionBarDrawerToggle: ActionBarDrawerToggle 16 | 17 | override fun onCreate(savedInstanceState: Bundle?) { 18 | super.onCreate(savedInstanceState) 19 | binding = ActivitySampleBinding.inflate(layoutInflater).also { 20 | setContentView(it.root) 21 | } 22 | 23 | // Handle Toolbar 24 | setSupportActionBar(binding.toolbar) 25 | supportActionBar?.setTitle(R.string.drawer_item_menu_drawer) 26 | supportActionBar?.setDisplayHomeAsUpEnabled(true) 27 | supportActionBar?.setHomeButtonEnabled(true) 28 | 29 | actionBarDrawerToggle = ActionBarDrawerToggle(this, binding.root, binding.toolbar, com.mikepenz.materialdrawer.R.string.material_drawer_open, com.mikepenz.materialdrawer.R.string.material_drawer_close) 30 | 31 | binding.slider.apply { 32 | inflateMenu(R.menu.example_menu) 33 | onDrawerItemClickListener = { v, drawerItem, position -> 34 | if (drawerItem is Nameable) { 35 | Toast.makeText(this@MenuDrawerActivity, (drawerItem as Nameable).name!!.getText(this@MenuDrawerActivity), Toast.LENGTH_SHORT).show() 36 | } 37 | false 38 | } 39 | setSavedInstance(savedInstanceState) 40 | } 41 | 42 | // set the selection to the item with the identifier 5 43 | if (savedInstanceState == null) { 44 | binding.slider.setSelection(5, false) 45 | } 46 | } 47 | 48 | override fun onConfigurationChanged(newConfig: Configuration) { 49 | super.onConfigurationChanged(newConfig) 50 | actionBarDrawerToggle.onConfigurationChanged(newConfig) 51 | } 52 | 53 | override fun onPostCreate(savedInstanceState: Bundle?) { 54 | super.onPostCreate(savedInstanceState) 55 | actionBarDrawerToggle.syncState() 56 | } 57 | 58 | override fun onOptionsItemSelected(item: MenuItem): Boolean { 59 | if (actionBarDrawerToggle.onOptionsItemSelected(item)) { 60 | return true 61 | } 62 | return super.onOptionsItemSelected(item) 63 | } 64 | 65 | override fun onSaveInstanceState(_outState: Bundle) { 66 | var outState = _outState 67 | //add the values which need to be saved from the drawer to the bundle 68 | outState = binding.slider.saveInstanceState(outState) 69 | super.onSaveInstanceState(outState) 70 | } 71 | 72 | override fun onBackPressed() { 73 | //handle the back press :D close the drawer first and if the drawer is closed close the activity 74 | if (binding.root.isDrawerOpen(binding.slider)) { 75 | binding.root.closeDrawer(binding.slider) 76 | } else { 77 | super.onBackPressed() 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /app/src/main/java/com/mikepenz/materialdrawer/app/NavControllerActivity.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.app 2 | 3 | import android.os.Bundle 4 | import androidx.appcompat.app.AppCompatActivity 5 | import androidx.appcompat.widget.Toolbar 6 | import androidx.core.os.bundleOf 7 | import androidx.navigation.findNavController 8 | import com.mikepenz.aboutlibraries.LibsBuilder 9 | import com.mikepenz.materialdrawer.app.databinding.ActivitySampleNavBinding 10 | import com.mikepenz.materialdrawer.model.DividerDrawerItem 11 | import com.mikepenz.materialdrawer.model.NavigationDrawerItem 12 | import com.mikepenz.materialdrawer.model.PrimaryDrawerItem 13 | import com.mikepenz.materialdrawer.model.interfaces.withName 14 | import com.mikepenz.materialdrawer.util.addItems 15 | import com.mikepenz.materialdrawer.util.addStickyDrawerItems 16 | import com.mikepenz.materialdrawer.util.setupWithNavController 17 | import java.io.Serializable 18 | 19 | class NavControllerActivity : AppCompatActivity() { 20 | private lateinit var binding: ActivitySampleNavBinding 21 | 22 | override fun onCreate(savedInstanceState: Bundle?) { 23 | super.onCreate(savedInstanceState) 24 | binding = ActivitySampleNavBinding.inflate(layoutInflater).also { 25 | setContentView(it.root) 26 | } 27 | val toolbar = findViewById<Toolbar>(R.id.toolbar) 28 | setSupportActionBar(toolbar) 29 | 30 | val navController = findNavController(R.id.nav_host_fragment) 31 | 32 | binding.slider.apply { 33 | addItems( 34 | NavigationDrawerItem(R.id.action_global_fragmentHome, PrimaryDrawerItem().withName("Home"), null, null), 35 | DividerDrawerItem(), 36 | NavigationDrawerItem(R.id.messageFragment1, PrimaryDrawerItem().withName("Fragment1")), 37 | NavigationDrawerItem(R.id.messageFragment2, PrimaryDrawerItem().withName("Fragment2")) 38 | ) 39 | addStickyDrawerItems( 40 | NavigationDrawerItem(R.id.messageFragment3, PrimaryDrawerItem().withName("Fragment3")), 41 | NavigationDrawerItem(R.id.about_libraries, PrimaryDrawerItem().withName("AboutLibs"), bundleOf("data" to (LibsBuilder() as Serializable))) 42 | ) 43 | } 44 | 45 | 46 | // setup the drawer with navigation controller 47 | binding.slider.setupWithNavController(navController) 48 | } 49 | } -------------------------------------------------------------------------------- /app/src/main/java/com/mikepenz/materialdrawer/app/drawerItems/AccountDividerDrawerItem.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.app.drawerItems 2 | 3 | import android.content.res.ColorStateList 4 | import android.view.View 5 | import androidx.annotation.LayoutRes 6 | import androidx.core.view.ViewCompat 7 | import androidx.recyclerview.widget.RecyclerView 8 | import com.mikepenz.materialdrawer.app.R 9 | import com.mikepenz.materialdrawer.holder.ImageHolder 10 | import com.mikepenz.materialdrawer.holder.StringHolder 11 | import com.mikepenz.materialdrawer.model.AbstractDrawerItem 12 | import com.mikepenz.materialdrawer.model.interfaces.IProfile 13 | import com.mikepenz.materialdrawer.util.getDividerColor 14 | 15 | class AccountDividerDrawerItem : AbstractDrawerItem<AccountDividerDrawerItem, AccountDividerDrawerItem.ViewHolder>(), IProfile { 16 | override val type: Int 17 | get() = R.id.material_drawer_profile_item_divider 18 | 19 | override val layoutRes: Int 20 | @LayoutRes 21 | get() = com.mikepenz.materialdrawer.R.layout.material_drawer_item_divider 22 | 23 | override var name: StringHolder? = null 24 | override var description: StringHolder? = null 25 | override var icon: ImageHolder? = null 26 | override var iconColor: ColorStateList? = null 27 | 28 | override fun bindView(holder: ViewHolder, payloads: List<Any>) { 29 | super.bindView(holder, payloads) 30 | 31 | val ctx = holder.itemView.context 32 | 33 | //set the identifier from the drawerItem here. It can be used to run tests 34 | holder.itemView.id = hashCode() 35 | 36 | //define how the divider should look like 37 | holder.view.isClickable = false 38 | holder.view.isEnabled = false 39 | holder.view.minimumHeight = 1 40 | ViewCompat.setImportantForAccessibility(holder.view, 41 | ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_NO) 42 | 43 | //set the color for the divider 44 | holder.divider.setBackgroundColor(ctx.getDividerColor()) 45 | 46 | //call the onPostBindView method to trigger post bind view actions (like the listener to modify the item if required) 47 | onPostBindView(this, holder.itemView) 48 | } 49 | 50 | override fun getViewHolder(v: View): ViewHolder { 51 | return ViewHolder(v) 52 | } 53 | 54 | class ViewHolder internal constructor(internal val view: View) : RecyclerView.ViewHolder(view) { 55 | internal val divider: View = view.findViewById(com.mikepenz.materialdrawer.R.id.material_drawer_divider) 56 | } 57 | } -------------------------------------------------------------------------------- /app/src/main/java/com/mikepenz/materialdrawer/app/drawerItems/CustomBaseViewHolder.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.app.drawerItems 2 | 3 | import android.view.View 4 | import android.widget.ImageView 5 | import android.widget.TextView 6 | import androidx.recyclerview.widget.RecyclerView 7 | import com.mikepenz.materialdrawer.app.R 8 | 9 | open class CustomBaseViewHolder(var view: View) : RecyclerView.ViewHolder(view) { 10 | var icon: ImageView = view.findViewById<ImageView>(R.id.material_drawer_icon) 11 | var name: TextView = view.findViewById<TextView>(R.id.material_drawer_name) 12 | var description: TextView = view.findViewById<TextView>(R.id.material_drawer_description) 13 | } -------------------------------------------------------------------------------- /app/src/main/java/com/mikepenz/materialdrawer/app/drawerItems/CustomCenteredPrimaryDrawerItem.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.app.drawerItems 2 | 3 | import com.mikepenz.materialdrawer.app.R 4 | import com.mikepenz.materialdrawer.model.PrimaryDrawerItem 5 | 6 | class CustomCenteredPrimaryDrawerItem : PrimaryDrawerItem() { 7 | 8 | override val layoutRes: Int 9 | get() = R.layout.material_drawer_item_primary_centered 10 | 11 | override val type: Int 12 | get() = R.id.material_drawer_item_centered_primary 13 | } 14 | -------------------------------------------------------------------------------- /app/src/main/java/com/mikepenz/materialdrawer/app/drawerItems/CustomPrimaryDrawerItem.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.app.drawerItems 2 | 3 | import com.mikepenz.materialdrawer.holder.ColorHolder 4 | import com.mikepenz.materialdrawer.model.AbstractBadgeableDrawerItem 5 | 6 | class CustomPrimaryDrawerItem : AbstractBadgeableDrawerItem<CustomPrimaryDrawerItem>() { 7 | 8 | var background: ColorHolder? = null 9 | 10 | fun withBackgroundColor(backgroundColor: Int): CustomPrimaryDrawerItem { 11 | this.background = ColorHolder.fromColor(backgroundColor) 12 | return this 13 | } 14 | 15 | fun withBackgroundRes(backgroundRes: Int): CustomPrimaryDrawerItem { 16 | this.background = ColorHolder.fromColorRes(backgroundRes) 17 | return this 18 | } 19 | 20 | override fun bindView(holder: AbstractBadgeableDrawerItem.ViewHolder, payloads: List<Any>) { 21 | super.bindView(holder, payloads) 22 | background?.applyToBackground(holder.itemView) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/java/com/mikepenz/materialdrawer/app/drawerItems/CustomUrlPrimaryDrawerItem.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.app.drawerItems 2 | 3 | import android.view.View 4 | import android.widget.TextView 5 | import androidx.annotation.LayoutRes 6 | import com.mikepenz.materialdrawer.app.R 7 | import com.mikepenz.materialdrawer.holder.BadgeStyle 8 | import com.mikepenz.materialdrawer.holder.StringHolder 9 | import com.mikepenz.materialdrawer.model.interfaces.ColorfulBadgeable 10 | 11 | /** 12 | * Created by mikepenz on 03.02.15. 13 | */ 14 | class CustomUrlPrimaryDrawerItem : CustomUrlBasePrimaryDrawerItem<CustomUrlPrimaryDrawerItem, CustomUrlPrimaryDrawerItem.ViewHolder>(), ColorfulBadgeable { 15 | override var badge: StringHolder? = null 16 | override var badgeStyle: BadgeStyle? = BadgeStyle() 17 | 18 | override val type: Int 19 | get() = R.id.material_drawer_item_custom_url_item 20 | 21 | override val layoutRes: Int 22 | @LayoutRes 23 | get() = com.mikepenz.materialdrawer.R.layout.material_drawer_item_primary 24 | 25 | override fun bindView(holder: ViewHolder, payloads: List<Any>) { 26 | super.bindView(holder, payloads) 27 | 28 | val ctx = holder.itemView.context 29 | 30 | //bind the basic view parts 31 | bindViewHelper(holder) 32 | 33 | //set the text for the badge or hide 34 | val badgeVisible = StringHolder.applyToOrHide(badge, holder.badge) 35 | //style the badge if it is visible 36 | if (badgeVisible) { 37 | badgeStyle!!.style(holder.badge, getColor(ctx)) 38 | holder.badge.visibility = View.VISIBLE 39 | } else { 40 | holder.badge.visibility = View.GONE 41 | } 42 | 43 | //define the typeface for our textViews 44 | if (typeface != null) { 45 | holder.badge.typeface = typeface 46 | } 47 | 48 | //call the onPostBindView method to trigger post bind view actions (like the listener to modify the item if required) 49 | onPostBindView(this, holder.itemView) 50 | } 51 | 52 | override fun getViewHolder(v: View): ViewHolder { 53 | return ViewHolder(v) 54 | } 55 | 56 | class ViewHolder(view: View) : CustomBaseViewHolder(view) { 57 | internal val badge: TextView = view.findViewById(R.id.material_drawer_badge) 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /app/src/main/java/com/mikepenz/materialdrawer/app/drawerItems/GmailDrawerItem.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.app.drawerItems 2 | 3 | import android.content.Context 4 | import android.view.View 5 | import com.google.android.material.shape.CornerFamily 6 | import com.google.android.material.shape.ShapeAppearanceModel 7 | import com.mikepenz.materialdrawer.app.R 8 | import com.mikepenz.materialdrawer.model.PrimaryDrawerItem 9 | import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem 10 | import com.mikepenz.materialdrawer.util.themeDrawerItem 11 | 12 | /** 13 | * Describes the main [IDrawerItem] bing used as primary item, following the guidelines 14 | */ 15 | open class GmailDrawerItem : PrimaryDrawerItem() { 16 | 17 | override val type: Int 18 | get() = R.id.material_drawer_item_gmail_item 19 | 20 | override fun applyDrawerItemTheme(ctx: Context, view: View, selected_color: Int, animate: Boolean, shapeAppearanceModel: ShapeAppearanceModel) { 21 | themeDrawerItem(ctx, view, selected_color, animate, shapeAppearanceModel, R.dimen.gmail_material_drawer_item_background_padding_top_bottom, R.dimen.gmail_material_drawer_item_background_padding_start, R.dimen.gmail_material_drawer_item_background_padding_end, isSelected = isSelected) 22 | } 23 | 24 | override fun getShapeAppearanceModel(ctx: Context): ShapeAppearanceModel { 25 | val cornerRadius = ctx.resources.getDimensionPixelSize(R.dimen.gmail_material_drawer_item_corner_radius) 26 | return ShapeAppearanceModel.builder() 27 | .setTopRightCorner(CornerFamily.ROUNDED, cornerRadius.toFloat()) 28 | .setBottomRightCorner(CornerFamily.ROUNDED, cornerRadius.toFloat()) 29 | .build() 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/src/main/java/com/mikepenz/materialdrawer/app/drawerItems/IconDrawerItem.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.app.drawerItems 2 | 3 | import android.content.Context 4 | import android.content.res.ColorStateList 5 | import android.view.View 6 | import android.widget.ImageView 7 | import androidx.annotation.LayoutRes 8 | import androidx.recyclerview.widget.RecyclerView 9 | import com.mikepenz.materialdrawer.app.R 10 | import com.mikepenz.materialdrawer.holder.ImageHolder 11 | import com.mikepenz.materialdrawer.model.AbstractDrawerItem 12 | import com.mikepenz.materialdrawer.model.interfaces.Iconable 13 | import com.mikepenz.materialdrawer.model.interfaces.SelectIconable 14 | import com.mikepenz.materialdrawer.util.createDrawerItemColorStateList 15 | 16 | /** 17 | * Created by mikepenz on 03.02.15. 18 | */ 19 | class IconDrawerItem : AbstractDrawerItem<IconDrawerItem, IconDrawerItem.ViewHolder>(), Iconable, SelectIconable { 20 | override var icon: ImageHolder? = null 21 | override var iconColor: ColorStateList? = null 22 | override var selectedIcon: ImageHolder? = null 23 | override var isIconTinted = false 24 | 25 | override val type: Int 26 | get() = R.id.material_drawer_item_icon_only 27 | 28 | override val layoutRes: Int 29 | @LayoutRes 30 | get() = R.layout.material_drawer_item_icon_only 31 | 32 | override fun bindView(holder: ViewHolder, payloads: List<Any>) { 33 | super.bindView(holder, payloads) 34 | 35 | val ctx = holder.itemView.context 36 | 37 | //set the identifier from the drawerItem here. It can be used to run tests 38 | holder.itemView.id = hashCode() 39 | 40 | //get the correct color for the icon 41 | val iconColor = this.iconColor ?: ctx.getPrimaryDrawerIconColor() 42 | 43 | //get the drawables for our icon and set it) 44 | val icon = ImageHolder.decideIcon(icon, ctx, iconColor, isIconTinted, 1) 45 | val selectedIcon = ImageHolder.decideIcon(selectedIcon, ctx, iconColor, isIconTinted, 1) 46 | ImageHolder.applyMultiIconTo(icon, selectedIcon, iconColor, isIconTinted, holder.icon) 47 | 48 | //call the onPostBindView method to trigger post bind view actions (like the listener to modify the item if required) 49 | onPostBindView(this, holder.itemView) 50 | } 51 | 52 | override fun getViewHolder(v: View): ViewHolder { 53 | return ViewHolder(v) 54 | } 55 | 56 | class ViewHolder internal constructor(private val view: View) : RecyclerView.ViewHolder(view) { 57 | var icon: ImageView = view.findViewById<ImageView>(R.id.material_drawer_icon) 58 | } 59 | } 60 | 61 | internal fun Context.getPrimaryDrawerIconColor(): ColorStateList { 62 | return createDrawerItemColorStateList(this, com.mikepenz.materialdrawer.R.styleable.MaterialDrawerSliderView_materialDrawerPrimaryIcon)!! 63 | } -------------------------------------------------------------------------------- /app/src/main/java/com/mikepenz/materialdrawer/app/drawerItems/OverflowMenuDrawerItem.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.app.drawerItems 2 | 3 | import android.view.View 4 | import android.widget.ImageButton 5 | import androidx.annotation.LayoutRes 6 | import androidx.appcompat.widget.PopupMenu 7 | import com.mikepenz.iconics.IconicsDrawable 8 | import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial 9 | import com.mikepenz.iconics.utils.sizeDp 10 | import com.mikepenz.materialdrawer.app.R 11 | import com.mikepenz.materialdrawer.model.BaseDescribeableDrawerItem 12 | import com.mikepenz.materialdrawer.model.BaseViewHolder 13 | 14 | /** 15 | * Created by mikepenz on 03.02.15. 16 | */ 17 | class OverflowMenuDrawerItem : BaseDescribeableDrawerItem<OverflowMenuDrawerItem, OverflowMenuDrawerItem.ViewHolder>() { 18 | var menu: Int = 0 19 | var onMenuItemClickListener: PopupMenu.OnMenuItemClickListener? = null 20 | var onDismissListener: PopupMenu.OnDismissListener? = null 21 | 22 | override val type: Int 23 | get() = R.id.material_drawer_item_overflow_menu 24 | 25 | override val layoutRes: Int 26 | @LayoutRes 27 | get() = R.layout.material_drawer_item_overflow_menu_primary 28 | 29 | @Deprecated("Use property setter instead") 30 | fun withMenu(menu: Int): OverflowMenuDrawerItem { 31 | this.menu = menu 32 | return this 33 | } 34 | 35 | @Deprecated("Use property setter instead") 36 | fun withOnMenuItemClickListener(onMenuItemClickListener: PopupMenu.OnMenuItemClickListener): OverflowMenuDrawerItem { 37 | this.onMenuItemClickListener = onMenuItemClickListener 38 | return this 39 | } 40 | 41 | @Deprecated("Use property setter instead") 42 | fun withOnDismissListener(onDismissListener: PopupMenu.OnDismissListener): OverflowMenuDrawerItem { 43 | this.onDismissListener = onDismissListener 44 | return this 45 | } 46 | 47 | override fun bindView(holder: ViewHolder, payloads: List<Any>) { 48 | super.bindView(holder, payloads) 49 | 50 | val ctx = holder.itemView.context 51 | 52 | //bind the basic view parts 53 | bindViewHelper(holder) 54 | 55 | //handle menu click 56 | holder.menu.setOnClickListener { view -> 57 | val popup = PopupMenu(view.context, view) 58 | val inflater = popup.menuInflater 59 | inflater.inflate(menu, popup.menu) 60 | 61 | popup.setOnMenuItemClickListener(onMenuItemClickListener) 62 | popup.setOnDismissListener(onDismissListener) 63 | 64 | popup.show() 65 | } 66 | 67 | //handle image 68 | holder.menu.setImageDrawable(IconicsDrawable(ctx, GoogleMaterial.Icon.gmd_more_vert).apply { sizeDp = 12; colorList = getIconColor(ctx) }) 69 | 70 | //call the onPostBindView method to trigger post bind view actions (like the listener to modify the item if required) 71 | onPostBindView(this, holder.itemView) 72 | } 73 | 74 | override fun getViewHolder(v: View): ViewHolder { 75 | return ViewHolder(v) 76 | } 77 | 78 | class ViewHolder(view: View) : BaseViewHolder(view) { 79 | internal val menu: ImageButton = view.findViewById<ImageButton>(R.id.material_drawer_menu_overflow) 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /app/src/main/java/com/mikepenz/materialdrawer/app/fragment/DemoFragment.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.app.fragment 2 | 3 | 4 | import android.os.Bundle 5 | import android.view.LayoutInflater 6 | import android.view.View 7 | import android.view.ViewGroup 8 | import androidx.fragment.app.Fragment 9 | import com.mikepenz.materialdrawer.app.databinding.FragmentSampleBinding 10 | 11 | 12 | /** 13 | * A simple [Fragment] subclass. 14 | * This is just a demo fragment with a long scrollable view of editTexts. Don't see this as a reference for anything 15 | */ 16 | class DemoFragment : Fragment() { 17 | private var _binding: FragmentSampleBinding? = null 18 | private val binding get() = _binding!! 19 | 20 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { 21 | // Inflate the layout for this fragment 22 | // don't look at this layout it's just a listView to show how to handle the keyboard 23 | _binding = FragmentSampleBinding.inflate(inflater, container, false) 24 | binding.title.text = arguments?.getString(KEY_TITLE) 25 | return binding.root 26 | } 27 | 28 | companion object { 29 | private val KEY_TITLE = "title" 30 | fun newInstance(title: String): DemoFragment { 31 | return DemoFragment().apply { 32 | arguments = Bundle().apply { putString(KEY_TITLE, title) } 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/java/com/mikepenz/materialdrawer/app/fragment/DemoMessageFragment.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.app.fragment 2 | 3 | import android.os.Bundle 4 | import android.view.LayoutInflater 5 | import android.view.View 6 | import android.view.ViewGroup 7 | import androidx.fragment.app.Fragment 8 | import androidx.navigation.fragment.findNavController 9 | import com.mikepenz.materialdrawer.app.R 10 | import com.mikepenz.materialdrawer.app.databinding.FragmentMessageSampleBinding 11 | 12 | class DemoMessageFragment : Fragment() { 13 | 14 | private var _binding: FragmentMessageSampleBinding? = null 15 | private val binding get() = _binding!! 16 | 17 | private var message: String? = null 18 | 19 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { 20 | message = arguments?.let { DemoMessageFragmentArgs.fromBundle(it).message } 21 | _binding = FragmentMessageSampleBinding.inflate(inflater, container, false) 22 | return binding.root 23 | } 24 | 25 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 26 | super.onViewCreated(view, savedInstanceState) 27 | binding.messageTextView.text = "$message" 28 | binding.btnFragmentHome.setOnClickListener { navigateTo(R.id.fragmentHome) } 29 | binding.btnFragment1.setOnClickListener { navigateTo(R.id.messageFragment1) } 30 | binding.btnFragment2.setOnClickListener { navigateTo(R.id.messageFragment2) } 31 | binding.btnFragment3.setOnClickListener { navigateTo(R.id.messageFragment3) } 32 | binding.btnPopup.setOnClickListener { navigateTo(R.id.action_global_fragmentHome) } 33 | } 34 | 35 | private fun navigateTo(destination: Int) { 36 | findNavController().navigate(destination) 37 | } 38 | } -------------------------------------------------------------------------------- /app/src/main/java/com/mikepenz/materialdrawer/app/fragment/SecondDrawerFragment.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.app.fragment 2 | 3 | 4 | import android.os.Bundle 5 | import android.view.LayoutInflater 6 | import android.view.View 7 | import android.view.ViewGroup 8 | import androidx.fragment.app.Fragment 9 | import com.mikepenz.iconics.typeface.library.fontawesome.FontAwesome 10 | import com.mikepenz.materialdrawer.app.R 11 | import com.mikepenz.materialdrawer.app.databinding.FragmentSimpleSampleBinding 12 | import com.mikepenz.materialdrawer.iconics.withIcon 13 | import com.mikepenz.materialdrawer.model.PrimaryDrawerItem 14 | import com.mikepenz.materialdrawer.model.interfaces.withIdentifier 15 | import com.mikepenz.materialdrawer.model.interfaces.withName 16 | 17 | 18 | /** 19 | * A simple [Fragment] subclass. 20 | * This is just a demo fragment with a long scrollable view of editTexts. Don't see this as a reference for anything 21 | */ 22 | class SecondDrawerFragment : Fragment() { 23 | private var _binding: FragmentSimpleSampleBinding? = null 24 | private val binding get() = _binding!! 25 | 26 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { 27 | // Inflate the layout for this fragment 28 | // don't look at this layout it's just a listView to show how to handle the keyboard 29 | _binding = FragmentSimpleSampleBinding.inflate(inflater, container, false) 30 | binding.title.text = arguments?.getString(KEY_TITLE) 31 | return binding.root 32 | } 33 | 34 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 35 | super.onViewCreated(view, savedInstanceState) 36 | 37 | binding.slider.apply { 38 | itemAdapter.add( 39 | PrimaryDrawerItem().withName(R.string.drawer_item_home).withIcon(FontAwesome.Icon.faw_home).withIdentifier(1), 40 | PrimaryDrawerItem().withName(R.string.drawer_item_free_play).withIcon(FontAwesome.Icon.faw_gamepad), 41 | PrimaryDrawerItem().withName(R.string.drawer_item_custom).withIcon(FontAwesome.Icon.faw_eye) 42 | ) 43 | setSavedInstance(savedInstanceState) 44 | setSelection(1) 45 | } 46 | } 47 | 48 | override fun onSaveInstanceState(_outState: Bundle) { 49 | var outState = _outState 50 | //add the values which need to be saved from the drawer to the bundle 51 | outState = binding.slider.saveInstanceState(outState) 52 | super.onSaveInstanceState(outState) 53 | } 54 | 55 | companion object { 56 | private val KEY_TITLE = "title" 57 | 58 | fun newInstance(title: String): SecondDrawerFragment { 59 | return SecondDrawerFragment().apply { 60 | arguments = Bundle().apply { putString(KEY_TITLE, title) } 61 | } 62 | } 63 | } 64 | } -------------------------------------------------------------------------------- /app/src/main/java/com/mikepenz/materialdrawer/app/utils/CrossfadeWrapper.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.app.utils 2 | 3 | import com.mikepenz.crossfader.Crossfader 4 | import com.mikepenz.materialdrawer.interfaces.ICrossfader 5 | 6 | /** 7 | * Created by mikepenz on 18.07.15. 8 | */ 9 | class CrossfadeWrapper(private val crossfader: Crossfader<*>) : ICrossfader { 10 | 11 | override val isCrossfaded: Boolean 12 | get() = crossfader.isCrossFaded() 13 | 14 | override fun crossfade() { 15 | crossfader.crossFade() 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app/src/main/java/com/mikepenz/materialdrawer/app/utils/SystemUtils.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.app.utils 2 | 3 | import android.content.res.Resources 4 | 5 | object SystemUtils { 6 | val screenOrientation: Int 7 | get() = Resources.getSystem().configuration.orientation 8 | } 9 | -------------------------------------------------------------------------------- /app/src/main/java/com/mikepenz/materialdrawer/app/utils/UIUtils.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.app.utils 2 | 3 | import android.content.Context 4 | import android.content.res.Resources 5 | import android.util.DisplayMetrics 6 | 7 | 8 | /** 9 | * This method converts dp unit to equivalent pixels, depending on device density. 10 | * 11 | * @param dp A value in dp (density independent pixels) unit. Which we need to convert into pixels 12 | * @param context Context to get resources and device specific display metrics 13 | * @return A float value to represent px equivalent to dp depending on device density 14 | */ 15 | fun convertDpToPixel(dp: Float, context: Context): Float { 16 | val resources: Resources = context.resources 17 | val metrics: DisplayMetrics = resources.displayMetrics 18 | return dp * (metrics.densityDpi / 160f) 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/header.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/app/src/main/res/drawable/header.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/profile.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/app/src/main/res/drawable/profile.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/profile2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/app/src/main/res/drawable/profile2.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/profile3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/app/src/main/res/drawable/profile3.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/profile4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/app/src/main/res/drawable/profile4.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/profile5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/app/src/main/res/drawable/profile5.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/profile6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/app/src/main/res/drawable/profile6.jpg -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_embedded.xml: -------------------------------------------------------------------------------- 1 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 | xmlns:app="http://schemas.android.com/apk/res-auto" 3 | android:layout_width="match_parent" 4 | android:layout_height="match_parent" 5 | android:gravity="center"> 6 | 7 | <androidx.appcompat.widget.Toolbar 8 | android:id="@+id/toolbar" 9 | android:layout_width="0dp" 10 | android:layout_height="wrap_content" 11 | android:background="?attr/colorPrimary" 12 | android:elevation="4dp" 13 | android:fitsSystemWindows="true" 14 | android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 15 | app:layout_constraintEnd_toEndOf="parent" 16 | app:layout_constraintStart_toStartOf="parent" 17 | app:layout_constraintTop_toTopOf="parent" /> 18 | 19 | <FrameLayout 20 | android:id="@+id/frame_container" 21 | android:layout_width="0dp" 22 | android:layout_height="0dp" 23 | app:layout_constraintBottom_toBottomOf="parent" 24 | app:layout_constraintEnd_toEndOf="parent" 25 | app:layout_constraintStart_toStartOf="parent" 26 | app:layout_constraintTop_toBottomOf="@id/toolbar"> 27 | 28 | <com.mikepenz.materialdrawer.widget.MaterialDrawerSliderView 29 | android:id="@+id/slider" 30 | android:layout_width="match_parent" 31 | android:layout_height="match_parent" /> 32 | </FrameLayout> 33 | </androidx.constraintlayout.widget.ConstraintLayout> -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_mini_drawer.xml: -------------------------------------------------------------------------------- 1 | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 | android:layout_width="match_parent" 3 | android:layout_height="match_parent" 4 | android:fitsSystemWindows="true" 5 | android:gravity="center"> 6 | 7 | <androidx.appcompat.widget.Toolbar 8 | android:id="@+id/toolbar" 9 | android:layout_width="match_parent" 10 | android:layout_height="wrap_content" 11 | android:elevation="4dp" 12 | android:theme="@style/ThemeOverlay.Material3.Dark" /> 13 | 14 | <FrameLayout 15 | android:layout_width="match_parent" 16 | android:layout_height="match_parent" 17 | android:layout_below="@id/toolbar"> 18 | 19 | <TextView 20 | android:id="@+id/crossfade_content" 21 | android:layout_width="match_parent" 22 | android:layout_height="match_parent" 23 | android:layout_gravity="center" 24 | android:gravity="center" 25 | android:text="@string/drawer_item_embedded_drawer" 26 | android:textSize="16sp" /> 27 | </FrameLayout> 28 | </RelativeLayout> -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_multi_sample.xml: -------------------------------------------------------------------------------- 1 | <androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 | xmlns:app="http://schemas.android.com/apk/res-auto" 3 | android:id="@+id/root" 4 | android:layout_width="match_parent" 5 | android:layout_height="match_parent" 6 | android:fitsSystemWindows="true"> 7 | 8 | <androidx.constraintlayout.widget.ConstraintLayout 9 | android:layout_width="match_parent" 10 | android:layout_height="match_parent" 11 | android:gravity="center"> 12 | 13 | <androidx.appcompat.widget.Toolbar 14 | android:id="@+id/toolbar" 15 | android:layout_width="0dp" 16 | android:layout_height="wrap_content" 17 | android:background="?attr/colorPrimary" 18 | android:elevation="4dp" 19 | android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 20 | app:layout_constraintEnd_toEndOf="parent" 21 | app:layout_constraintStart_toStartOf="parent" 22 | app:layout_constraintTop_toTopOf="parent" /> 23 | 24 | <FrameLayout 25 | android:id="@+id/frame_container" 26 | android:layout_width="0dp" 27 | android:layout_height="match_parent" 28 | android:layout_below="@id/toolbar" 29 | app:layout_constraintBottom_toBottomOf="parent" 30 | app:layout_constraintEnd_toEndOf="parent" 31 | app:layout_constraintStart_toStartOf="parent" 32 | app:layout_constraintTop_toBottomOf="@id/toolbar"> 33 | 34 | <TextView 35 | android:id="@+id/txtLabel" 36 | android:layout_width="wrap_content" 37 | android:layout_height="wrap_content" 38 | android:layout_gravity="center" 39 | android:text="Test" 40 | android:textSize="16sp" /> 41 | </FrameLayout> 42 | </androidx.constraintlayout.widget.ConstraintLayout> 43 | 44 | <com.mikepenz.materialdrawer.widget.MaterialDrawerSliderView 45 | android:id="@+id/slider" 46 | android:layout_width="wrap_content" 47 | android:layout_height="match_parent" 48 | android:layout_gravity="start" 49 | android:fitsSystemWindows="true" /> 50 | 51 | <com.mikepenz.materialdrawer.widget.MaterialDrawerSliderView 52 | android:id="@+id/slider_end" 53 | android:layout_width="wrap_content" 54 | android:layout_height="match_parent" 55 | android:layout_gravity="end" 56 | android:fitsSystemWindows="true" /> 57 | </androidx.drawerlayout.widget.DrawerLayout> -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_persistent_drawer.xml: -------------------------------------------------------------------------------- 1 | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 | xmlns:app="http://schemas.android.com/apk/res-auto" 3 | xmlns:tools="http://schemas.android.com/tools" 4 | android:id="@+id/root" 5 | android:layout_width="match_parent" 6 | android:layout_height="match_parent" 7 | android:gravity="center"> 8 | 9 | <LinearLayout 10 | android:id="@+id/crossfade_content" 11 | android:layout_width="match_parent" 12 | android:layout_height="match_parent" 13 | android:orientation="vertical"> 14 | 15 | <androidx.appcompat.widget.Toolbar 16 | android:id="@+id/toolbar" 17 | android:layout_width="match_parent" 18 | android:layout_height="wrap_content" 19 | android:background="?attr/colorPrimary" 20 | android:elevation="4dp" 21 | android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 22 | app:popupTheme="@style/ThemeOverlay.AppCompat.Light" 23 | tools:targetApi="lollipop" /> 24 | 25 | <TextView 26 | android:layout_width="match_parent" 27 | android:layout_height="match_parent" 28 | android:layout_gravity="center" 29 | android:gravity="center" 30 | android:text="@string/drawer_item_embedded_drawer" 31 | android:textSize="16sp" /> 32 | </LinearLayout> 33 | </RelativeLayout> -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_sample.xml: -------------------------------------------------------------------------------- 1 | <androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 | xmlns:app="http://schemas.android.com/apk/res-auto" 3 | android:id="@+id/root" 4 | android:layout_width="match_parent" 5 | android:layout_height="match_parent" 6 | android:fitsSystemWindows="true"> 7 | 8 | <androidx.constraintlayout.widget.ConstraintLayout 9 | android:layout_width="match_parent" 10 | android:layout_height="match_parent" 11 | android:gravity="center"> 12 | 13 | <androidx.appcompat.widget.Toolbar 14 | android:id="@+id/toolbar" 15 | android:layout_width="0dp" 16 | android:layout_height="wrap_content" 17 | android:elevation="4dp" 18 | app:layout_constraintEnd_toEndOf="parent" 19 | app:layout_constraintStart_toStartOf="parent" 20 | app:layout_constraintTop_toTopOf="parent" /> 21 | 22 | <FrameLayout 23 | android:id="@+id/frame_container" 24 | android:layout_width="0dp" 25 | android:layout_height="match_parent" 26 | app:layout_constraintBottom_toBottomOf="parent" 27 | app:layout_constraintEnd_toEndOf="parent" 28 | app:layout_constraintStart_toStartOf="parent" 29 | app:layout_constraintTop_toBottomOf="@id/toolbar"> 30 | 31 | <TextView 32 | android:id="@+id/txtLabel" 33 | android:layout_width="wrap_content" 34 | android:layout_height="wrap_content" 35 | android:layout_gravity="center" 36 | android:text="Test" 37 | android:textSize="16sp" /> 38 | </FrameLayout> 39 | </androidx.constraintlayout.widget.ConstraintLayout> 40 | 41 | <com.mikepenz.materialdrawer.widget.MaterialDrawerSliderView 42 | android:id="@+id/slider" 43 | android:layout_width="wrap_content" 44 | android:layout_height="match_parent" 45 | android:layout_gravity="start" 46 | android:fitsSystemWindows="true" /> 47 | </androidx.drawerlayout.widget.DrawerLayout> -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_sample_actionbar.xml: -------------------------------------------------------------------------------- 1 | <androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 | android:id="@+id/root" 3 | android:layout_width="match_parent" 4 | android:layout_height="match_parent" 5 | android:fitsSystemWindows="true"> 6 | 7 | <FrameLayout 8 | android:id="@+id/frame_container" 9 | android:layout_width="match_parent" 10 | android:layout_height="match_parent"> 11 | 12 | <TextView 13 | android:id="@+id/txtLabel" 14 | android:layout_width="wrap_content" 15 | android:layout_height="wrap_content" 16 | android:layout_gravity="center" 17 | android:text="test" 18 | android:textSize="16sp" /> 19 | </FrameLayout> 20 | 21 | <com.mikepenz.materialdrawer.widget.MaterialDrawerSliderView 22 | android:id="@+id/slider" 23 | android:layout_width="wrap_content" 24 | android:layout_height="match_parent" 25 | android:layout_gravity="start" 26 | android:fitsSystemWindows="true" /> 27 | </androidx.drawerlayout.widget.DrawerLayout> -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_sample_crossfader.xml: -------------------------------------------------------------------------------- 1 | <com.mikepenz.materialdrawer.app.widget.CrossfadeDrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 | xmlns:app="http://schemas.android.com/apk/res-auto" 3 | android:id="@+id/root" 4 | android:layout_width="match_parent" 5 | android:layout_height="match_parent" 6 | android:fitsSystemWindows="true"> 7 | 8 | <androidx.constraintlayout.widget.ConstraintLayout 9 | android:layout_width="match_parent" 10 | android:layout_height="match_parent" 11 | android:gravity="center"> 12 | 13 | <androidx.appcompat.widget.Toolbar 14 | android:id="@+id/toolbar" 15 | android:layout_width="0dp" 16 | android:layout_height="wrap_content" 17 | android:elevation="4dp" 18 | app:layout_constraintEnd_toEndOf="parent" 19 | app:layout_constraintStart_toStartOf="parent" 20 | app:layout_constraintTop_toTopOf="parent" /> 21 | 22 | <FrameLayout 23 | android:id="@+id/frame_container" 24 | android:layout_width="0dp" 25 | android:layout_height="match_parent" 26 | app:layout_constraintBottom_toBottomOf="parent" 27 | app:layout_constraintEnd_toEndOf="parent" 28 | app:layout_constraintStart_toStartOf="parent" 29 | app:layout_constraintTop_toBottomOf="@id/toolbar"> 30 | 31 | <TextView 32 | android:id="@+id/txtLabel" 33 | android:layout_width="wrap_content" 34 | android:layout_height="wrap_content" 35 | android:layout_gravity="center" 36 | android:text="Test" 37 | android:textSize="16sp" /> 38 | </FrameLayout> 39 | </androidx.constraintlayout.widget.ConstraintLayout> 40 | 41 | <androidx.constraintlayout.widget.ConstraintLayout 42 | android:id="@+id/crossFadeSlider" 43 | android:layout_width="72dp" 44 | android:layout_height="match_parent" 45 | android:layout_gravity="start" 46 | android:fitsSystemWindows="true"> 47 | 48 | <com.mikepenz.materialdrawer.widget.MaterialDrawerSliderView 49 | android:id="@+id/crossFadeLargeView" 50 | android:layout_width="72dp" 51 | android:layout_height="0dp" 52 | android:fitsSystemWindows="true" 53 | app:layout_constraintBottom_toBottomOf="parent" 54 | app:layout_constraintEnd_toEndOf="parent" 55 | app:layout_constraintStart_toStartOf="parent" 56 | app:layout_constraintTop_toTopOf="parent" /> 57 | 58 | <com.mikepenz.materialdrawer.widget.MiniDrawerSliderView 59 | android:id="@+id/crossFadeSmallView" 60 | android:layout_width="72dp" 61 | android:layout_height="0dp" 62 | android:fitsSystemWindows="true" 63 | app:layout_constraintBottom_toBottomOf="parent" 64 | app:layout_constraintStart_toStartOf="parent" 65 | app:layout_constraintTop_toTopOf="parent" /> 66 | 67 | </androidx.constraintlayout.widget.ConstraintLayout> 68 | </com.mikepenz.materialdrawer.app.widget.CrossfadeDrawerLayout> -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_sample_fragment.xml: -------------------------------------------------------------------------------- 1 | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 | android:layout_width="match_parent" 3 | android:layout_height="match_parent" 4 | android:fitsSystemWindows="true" 5 | android:gravity="center"> 6 | 7 | <androidx.appcompat.widget.Toolbar 8 | android:id="@+id/toolbar" 9 | android:layout_width="match_parent" 10 | android:layout_height="wrap_content" 11 | android:elevation="4dp" 12 | android:theme="@style/ThemeOverlay.Material3.Dark" /> 13 | 14 | <FrameLayout 15 | android:id="@+id/fragment_container" 16 | android:layout_width="match_parent" 17 | android:layout_height="match_parent" 18 | android:layout_below="@id/toolbar" /> 19 | </RelativeLayout> -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_sample_fullscreen.xml: -------------------------------------------------------------------------------- 1 | <androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 | xmlns:app="http://schemas.android.com/apk/res-auto" 3 | android:id="@+id/root" 4 | android:layout_width="match_parent" 5 | android:layout_height="match_parent" 6 | android:fitsSystemWindows="false"> 7 | 8 | <androidx.constraintlayout.widget.ConstraintLayout 9 | android:layout_width="match_parent" 10 | android:layout_height="match_parent" 11 | android:gravity="center"> 12 | 13 | <androidx.appcompat.widget.Toolbar 14 | android:id="@+id/toolbar" 15 | android:layout_width="0dp" 16 | android:layout_height="wrap_content" 17 | android:elevation="4dp" 18 | android:theme="@style/ThemeOverlay.Material3.Dark" 19 | app:layout_constraintEnd_toEndOf="parent" 20 | app:layout_constraintStart_toStartOf="parent" 21 | app:layout_constraintTop_toTopOf="parent" /> 22 | 23 | <FrameLayout 24 | android:id="@+id/frame_container" 25 | android:layout_width="0dp" 26 | android:layout_height="match_parent" 27 | android:background="#ff4444" 28 | android:fitsSystemWindows="false" 29 | app:layout_constraintBottom_toBottomOf="parent" 30 | app:layout_constraintEnd_toEndOf="parent" 31 | app:layout_constraintStart_toStartOf="parent" 32 | app:layout_constraintTop_toBottomOf="@id/toolbar"> 33 | 34 | <TextView 35 | android:id="@+id/txtLabel" 36 | android:layout_width="wrap_content" 37 | android:layout_height="wrap_content" 38 | android:layout_gravity="center" 39 | android:text="Test" 40 | android:textSize="16sp" /> 41 | </FrameLayout> 42 | </androidx.constraintlayout.widget.ConstraintLayout> 43 | 44 | <com.mikepenz.materialdrawer.widget.MaterialDrawerSliderView 45 | android:id="@+id/slider" 46 | android:layout_width="wrap_content" 47 | android:layout_height="match_parent" 48 | android:layout_gravity="start" 49 | android:fitsSystemWindows="true" /> 50 | </androidx.drawerlayout.widget.DrawerLayout> -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_sample_nav.xml: -------------------------------------------------------------------------------- 1 | <androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 | xmlns:app="http://schemas.android.com/apk/res-auto" 3 | android:id="@+id/root" 4 | android:layout_width="match_parent" 5 | android:layout_height="match_parent" 6 | android:fitsSystemWindows="true"> 7 | 8 | <androidx.constraintlayout.widget.ConstraintLayout 9 | android:layout_width="match_parent" 10 | android:layout_height="match_parent" 11 | android:gravity="center"> 12 | 13 | <androidx.appcompat.widget.Toolbar 14 | android:id="@+id/toolbar" 15 | android:layout_width="0dp" 16 | android:layout_height="wrap_content" 17 | android:elevation="4dp" 18 | android:theme="@style/ThemeOverlay.Material3.Dark" 19 | app:layout_constraintEnd_toEndOf="parent" 20 | app:layout_constraintStart_toStartOf="parent" 21 | app:layout_constraintTop_toTopOf="parent" /> 22 | 23 | 24 | <fragment 25 | android:id="@+id/nav_host_fragment" 26 | android:name="androidx.navigation.fragment.NavHostFragment" 27 | android:layout_width="0dp" 28 | android:layout_height="0dp" 29 | app:defaultNavHost="true" 30 | app:layout_constraintBottom_toBottomOf="parent" 31 | app:layout_constraintLeft_toLeftOf="parent" 32 | app:layout_constraintRight_toRightOf="parent" 33 | app:layout_constraintTop_toBottomOf="@+id/toolbar" 34 | app:navGraph="@navigation/navigation" /> 35 | </androidx.constraintlayout.widget.ConstraintLayout> 36 | 37 | <com.mikepenz.materialdrawer.widget.MaterialDrawerSliderView 38 | android:id="@+id/slider" 39 | android:layout_width="wrap_content" 40 | android:layout_height="match_parent" 41 | android:layout_gravity="start" 42 | android:fitsSystemWindows="true" /> 43 | </androidx.drawerlayout.widget.DrawerLayout> -------------------------------------------------------------------------------- /app/src/main/res/layout/footer.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <ImageView xmlns:android="http://schemas.android.com/apk/res/android" 3 | android:orientation="vertical" 4 | android:layout_width="match_parent" 5 | android:layout_height="wrap_content" 6 | android:src="@drawable/header" 7 | android:adjustViewBounds="true" 8 | android:scaleType="fitCenter"></ImageView> -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_simple_sample.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 | xmlns:app="http://schemas.android.com/apk/res-auto" 4 | android:id="@+id/root" 5 | android:layout_width="match_parent" 6 | android:layout_height="match_parent" 7 | android:fitsSystemWindows="true"> 8 | 9 | <androidx.constraintlayout.widget.ConstraintLayout 10 | android:layout_width="match_parent" 11 | android:layout_height="match_parent" 12 | android:gravity="center"> 13 | 14 | <TextView 15 | android:id="@+id/title" 16 | android:layout_width="wrap_content" 17 | android:layout_height="wrap_content" 18 | android:text="Test" 19 | android:textSize="16sp" 20 | app:layout_constraintBottom_toBottomOf="parent" 21 | app:layout_constraintEnd_toEndOf="parent" 22 | app:layout_constraintStart_toStartOf="parent" 23 | app:layout_constraintTop_toTopOf="parent" /> 24 | 25 | </androidx.constraintlayout.widget.ConstraintLayout> 26 | 27 | <com.mikepenz.materialdrawer.widget.MaterialDrawerSliderView 28 | android:id="@+id/slider" 29 | android:layout_width="wrap_content" 30 | android:layout_height="match_parent" 31 | android:layout_gravity="start" 32 | android:fitsSystemWindows="true" /> 33 | </androidx.drawerlayout.widget.DrawerLayout> -------------------------------------------------------------------------------- /app/src/main/res/layout/header.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <ImageView xmlns:android="http://schemas.android.com/apk/res/android" 3 | android:orientation="vertical" 4 | android:layout_width="match_parent" 5 | android:layout_height="wrap_content" 6 | android:src="@drawable/header" 7 | android:adjustViewBounds="true" 8 | android:scaleType="fitCenter"></ImageView> -------------------------------------------------------------------------------- /app/src/main/res/layout/material_drawer_item_icon_only.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 | android:layout_width="match_parent" 4 | android:layout_height="@dimen/material_drawer_item_primary" 5 | android:gravity="center" 6 | android:orientation="horizontal"> 7 | 8 | <ImageView 9 | android:id="@+id/material_drawer_icon" 10 | android:layout_width="@dimen/material_drawer_item_primary" 11 | android:layout_height="@dimen/material_drawer_item_primary" 12 | android:layout_gravity="center" 13 | android:paddingBottom="@dimen/material_drawer_item_primary_icon_padding" 14 | android:paddingEnd="@dimen/material_drawer_item_primary_icon_padding" 15 | android:paddingLeft="@dimen/material_drawer_item_primary_icon_padding" 16 | android:paddingRight="@dimen/material_drawer_item_primary_icon_padding" 17 | android:paddingStart="@dimen/material_drawer_item_primary_icon_padding" 18 | android:paddingTop="@dimen/material_drawer_item_primary_icon_padding" /> 19 | </LinearLayout> -------------------------------------------------------------------------------- /app/src/main/res/layout/material_drawer_item_overflow_menu_primary.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 | xmlns:tools="http://schemas.android.com/tools" 4 | android:layout_width="match_parent" 5 | android:layout_height="@dimen/material_drawer_item_primary" 6 | android:orientation="horizontal" 7 | android:paddingEnd="@dimen/material_drawer_vertical_padding" 8 | android:paddingLeft="@dimen/material_drawer_vertical_padding" 9 | android:paddingRight="@dimen/material_drawer_vertical_padding" 10 | android:paddingStart="@dimen/material_drawer_vertical_padding"> 11 | 12 | <ImageView 13 | android:id="@+id/material_drawer_icon" 14 | android:layout_width="@dimen/material_drawer_item_primary_icon" 15 | android:layout_height="@dimen/material_drawer_item_primary" 16 | android:layout_gravity="center_vertical" 17 | android:paddingBottom="@dimen/material_drawer_item_primary_icon_padding" 18 | android:paddingEnd="@dimen/material_drawer_item_primary_icon_padding_right" 19 | android:paddingLeft="0dp" 20 | android:paddingRight="@dimen/material_drawer_item_primary_icon_padding_right" 21 | android:paddingStart="0dp" 22 | android:paddingTop="@dimen/material_drawer_item_primary_icon_padding" /> 23 | 24 | <LinearLayout 25 | android:layout_width="0dp" 26 | android:layout_height="match_parent" 27 | android:layout_weight="1" 28 | android:gravity="center_vertical|start" 29 | android:orientation="vertical"> 30 | 31 | <TextView 32 | android:id="@+id/material_drawer_name" 33 | android:layout_width="match_parent" 34 | android:layout_height="wrap_content" 35 | android:fontFamily="sans-serif-medium" 36 | android:gravity="center_vertical|start" 37 | android:lines="1" 38 | android:singleLine="true" 39 | android:textDirection="anyRtl" 40 | android:textSize="@dimen/material_drawer_item_primary_text" 41 | tools:text="Some drawer text" /> 42 | 43 | <TextView 44 | android:id="@+id/material_drawer_description" 45 | android:layout_width="match_parent" 46 | android:layout_height="wrap_content" 47 | android:fontFamily="sans-serif" 48 | android:gravity="center_vertical|start" 49 | android:lines="1" 50 | android:singleLine="true" 51 | android:textDirection="anyRtl" 52 | android:textSize="@dimen/material_drawer_item_primary_description" 53 | tools:text="Some drawer text" /> 54 | </LinearLayout> 55 | 56 | <ImageButton 57 | android:id="@+id/material_drawer_menu_overflow" 58 | android:layout_width="wrap_content" 59 | android:layout_height="match_parent" 60 | android:background="@android:color/transparent" 61 | android:gravity="center" 62 | android:paddingEnd="0dp" 63 | android:paddingLeft="@dimen/material_drawer_vertical_padding" 64 | android:paddingRight="0dp" 65 | android:paddingStart="@dimen/material_drawer_vertical_padding" 66 | android:scaleType="fitCenter" /> 67 | </LinearLayout> -------------------------------------------------------------------------------- /app/src/main/res/layout/material_drawer_item_primary_centered.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 | xmlns:tools="http://schemas.android.com/tools" 4 | android:layout_width="match_parent" 5 | android:layout_height="@dimen/material_drawer_item_primary" 6 | android:gravity="center" 7 | android:orientation="horizontal" 8 | android:paddingStart="@dimen/material_drawer_vertical_padding" 9 | android:paddingLeft="@dimen/material_drawer_vertical_padding" 10 | android:paddingEnd="@dimen/material_drawer_vertical_padding" 11 | android:paddingRight="@dimen/material_drawer_vertical_padding"> 12 | 13 | <ImageView 14 | android:id="@+id/material_drawer_icon" 15 | android:layout_width="@dimen/material_drawer_item_primary_icon" 16 | android:layout_height="@dimen/material_drawer_item_primary" 17 | android:layout_gravity="center_vertical" 18 | android:paddingStart="0dp" 19 | android:paddingLeft="0dp" 20 | android:paddingTop="@dimen/material_drawer_item_primary_icon_padding" 21 | android:paddingEnd="@dimen/material_drawer_item_primary_icon_padding_right" 22 | android:paddingRight="@dimen/material_drawer_item_primary_icon_padding_right" 23 | android:paddingBottom="@dimen/material_drawer_item_primary_icon_padding" /> 24 | 25 | <LinearLayout 26 | android:layout_width="wrap_content" 27 | android:layout_height="match_parent" 28 | android:gravity="center_vertical|start" 29 | android:orientation="vertical"> 30 | 31 | <TextView 32 | android:id="@+id/material_drawer_name" 33 | android:layout_width="match_parent" 34 | android:layout_height="wrap_content" 35 | android:fontFamily="sans-serif-medium" 36 | android:gravity="center_vertical|start" 37 | android:lines="1" 38 | android:singleLine="true" 39 | android:textDirection="anyRtl" 40 | android:textSize="@dimen/material_drawer_item_primary_text" 41 | tools:text="Some drawer text" /> 42 | 43 | <TextView 44 | android:id="@+id/material_drawer_description" 45 | android:layout_width="match_parent" 46 | android:layout_height="wrap_content" 47 | android:fontFamily="sans-serif" 48 | android:gravity="center_vertical|start" 49 | android:lines="1" 50 | android:singleLine="true" 51 | android:textDirection="anyRtl" 52 | android:textSize="@dimen/material_drawer_item_primary_description" 53 | tools:text="Some drawer text" /> 54 | </LinearLayout> 55 | 56 | <TextView 57 | android:id="@+id/material_drawer_badge" 58 | android:layout_width="wrap_content" 59 | android:layout_height="wrap_content" 60 | android:layout_marginStart="@dimen/material_drawer_padding" 61 | android:layout_marginLeft="@dimen/material_drawer_padding" 62 | android:layout_marginEnd="@dimen/material_drawer_padding" 63 | android:layout_marginRight="@dimen/material_drawer_padding" 64 | android:fontFamily="sans-serif" 65 | android:gravity="center" 66 | android:lines="1" 67 | android:minWidth="20dp" 68 | android:paddingLeft="1dp" 69 | android:paddingRight="1dp" 70 | android:singleLine="true" 71 | android:textSize="@dimen/material_drawer_item_primary_text" 72 | tools:text="99" /> 73 | 74 | </LinearLayout> -------------------------------------------------------------------------------- /app/src/main/res/menu/cab.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <menu xmlns:android="http://schemas.android.com/apk/res/android" 3 | xmlns:app="http://schemas.android.com/apk/res-auto"> 4 | 5 | <item 6 | android:id="@+id/item_delete" 7 | android:icon="@android:drawable/ic_menu_delete" 8 | app:showAsAction="ifRoom|withText" 9 | android:title="Delete" 10 | android:titleCondensed="Delete"></item> 11 | 12 | </menu> -------------------------------------------------------------------------------- /app/src/main/res/menu/embedded.xml: -------------------------------------------------------------------------------- 1 | <menu xmlns:android="http://schemas.android.com/apk/res/android" 2 | xmlns:app="http://schemas.android.com/apk/res-auto"> 3 | 4 | <item 5 | android:id="@+id/menu_1" 6 | android:orderInCategory="1" 7 | android:title="Toggle Side Panel" 8 | app:showAsAction="ifRoom" /> 9 | </menu> 10 | -------------------------------------------------------------------------------- /app/src/main/res/menu/example_menu.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <menu xmlns:android="http://schemas.android.com/apk/res/android" 3 | xmlns:app="http://schemas.android.com/apk/res-auto"> 4 | 5 | <item 6 | android:id="@+id/menu_1" 7 | android:title="Menu 1" 8 | app:showAsAction="never" /> 9 | 10 | <group android:id="@id/material_drawer_menu_default_group"> 11 | <item 12 | android:id="@+id/menu_2" 13 | android:title="Menu 2" 14 | app:showAsAction="never"> 15 | <menu> 16 | <item 17 | android:id="@+id/sub_menu_1" 18 | android:title="Submenu 1" 19 | app:showAsAction="never" /> 20 | <item 21 | android:id="@+id/sub_menu_2" 22 | android:title="Submenu 2" 23 | app:showAsAction="never" /> 24 | <item 25 | android:id="@+id/sub_menu_3" 26 | android:title="Submenu 3" 27 | app:showAsAction="never" /> 28 | </menu> 29 | </item> 30 | <item 31 | android:id="@+id/menu_3" 32 | android:title="Menu 3" 33 | app:showAsAction="never" /> 34 | <item 35 | android:id="@+id/menu_4" 36 | android:title="Menu 4" 37 | app:showAsAction="never"> 38 | <menu> 39 | <item 40 | android:id="@+id/sub_menu2_1" 41 | android:title="Submenu 1" 42 | app:showAsAction="never" /> 43 | <item 44 | android:id="@+id/sub_menu2_2" 45 | android:title="Submenu 2" 46 | app:showAsAction="never" /> 47 | </menu> 48 | </item> 49 | </group> 50 | <group android:id="@+id/md_menu_second_group"> 51 | <item 52 | android:id="@+id/action_settings" 53 | android:orderInCategory="100" 54 | android:title="@string/action_settings" 55 | app:showAsAction="ifRoom" /> 56 | </group> 57 | </menu> -------------------------------------------------------------------------------- /app/src/main/res/menu/fragment_menu.xml: -------------------------------------------------------------------------------- 1 | <menu xmlns:android="http://schemas.android.com/apk/res/android" 2 | xmlns:app="http://schemas.android.com/apk/res-auto"> 3 | 4 | <item 5 | android:id="@+id/menu_1" 6 | android:orderInCategory="1" 7 | android:title="Fragment 1" 8 | app:showAsAction="never" /> 9 | <item 10 | android:id="@+id/menu_2" 11 | android:orderInCategory="1" 12 | android:title="Fragment 2" 13 | app:showAsAction="never" /> 14 | </menu> 15 | -------------------------------------------------------------------------------- /app/src/main/res/menu/main.xml: -------------------------------------------------------------------------------- 1 | <menu xmlns:android="http://schemas.android.com/apk/res/android" 2 | xmlns:app="http://schemas.android.com/apk/res-auto"> 3 | 4 | <item 5 | android:id="@+id/menu_1" 6 | android:orderInCategory="1" 7 | android:title="Update Profile" 8 | app:showAsAction="never" /> 9 | <item 10 | android:id="@+id/menu_4" 11 | android:orderInCategory="4" 12 | android:title="CompactHeader" 13 | app:showAsAction="never" /> 14 | <item 15 | android:id="@+id/menu_5" 16 | android:orderInCategory="5" 17 | android:title="NormalHeader" 18 | app:showAsAction="never" /> 19 | </menu> 20 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> 3 | <background android:drawable="@color/ic_launcher_background" /> 4 | <foreground android:drawable="@mipmap/ic_launcher_foreground" /> 5 | </adaptive-icon> -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> 3 | <background android:drawable="@color/ic_launcher_background" /> 4 | <foreground android:drawable="@mipmap/ic_launcher_foreground" /> 5 | </adaptive-icon> -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/navigation/navigation.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <navigation xmlns:android="http://schemas.android.com/apk/res/android" 3 | xmlns:app="http://schemas.android.com/apk/res-auto" 4 | xmlns:tools="http://schemas.android.com/tools" 5 | android:id="@+id/navigation" 6 | app:startDestination="@id/fragmentHome"> 7 | 8 | <fragment 9 | android:id="@+id/fragmentHome" 10 | android:name="com.mikepenz.materialdrawer.app.fragment.DemoMessageFragment" 11 | android:label="DemoMessageFragment" 12 | tools:layout="@layout/fragment_message_sample"> 13 | <argument 14 | android:name="message" 15 | android:defaultValue="Fragment Home" 16 | app:argType="string" /> 17 | <action 18 | android:id="@+id/action_fragmentHome_to_messageFragment1" 19 | app:destination="@id/messageFragment1" /> 20 | <action 21 | android:id="@+id/action_fragmentHome_to_messageFragment2" 22 | app:destination="@id/messageFragment2" /> 23 | <action 24 | android:id="@+id/action_fragmentHome_to_messageFragment3" 25 | app:destination="@id/messageFragment3" /> 26 | <action 27 | android:id="@+id/action_fragmentHome_to_aboutLibsFragment" 28 | app:destination="@id/about_libraries" /> 29 | </fragment> 30 | <fragment 31 | android:id="@+id/messageFragment1" 32 | android:name="com.mikepenz.materialdrawer.app.fragment.DemoMessageFragment" 33 | android:label="DemoMessageFragment" 34 | tools:layout="@layout/fragment_message_sample"> 35 | <argument 36 | android:name="message" 37 | android:defaultValue="Fragment1" 38 | app:argType="string" /> 39 | </fragment> 40 | <fragment 41 | android:id="@+id/messageFragment2" 42 | android:name="com.mikepenz.materialdrawer.app.fragment.DemoMessageFragment" 43 | android:label="DemoMessageFragment" 44 | tools:layout="@layout/fragment_message_sample"> 45 | <argument 46 | android:name="message" 47 | android:defaultValue="Fragment2" 48 | app:argType="string" /> 49 | </fragment> 50 | <fragment 51 | android:id="@+id/messageFragment3" 52 | android:name="com.mikepenz.materialdrawer.app.fragment.DemoMessageFragment" 53 | android:label="DemoMessageFragment" 54 | tools:layout="@layout/fragment_message_sample"> 55 | <argument 56 | android:name="message" 57 | android:defaultValue="Fragment3" 58 | app:argType="string" /> 59 | </fragment> 60 | <action 61 | android:id="@+id/action_global_fragmentHome" 62 | app:popUpTo="@id/fragmentHome" /> 63 | 64 | <include app:graph="@navigation/aboutlibs_navigation" /> 65 | </navigation> -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <resources> 3 | <!-- 4 | Just set custom primary and accent color. 5 | Looks best with a light theme. see the AndroidManifest 6 | 7 | android:theme="@style/MaterialDrawerTheme.Light.DarkActionBar.TranslucentStatus" 8 | --> 9 | <color name="colorPrimary">#039be5</color> 10 | <color name="colorPrimaryDark">#006db3</color> 11 | <color name="colorPrimaryLight">#63ccff</color> 12 | <color name="colorAccent">#2196F3</color> 13 | <!-- overwrite the selected colors because the primary color is to dark --> 14 | <color name="material_drawer_selected_text">#039be5</color> 15 | <color name="material_drawer_dark_selected_text">#039be5</color> 16 | </resources> -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <resources> 3 | <dimen name="material_drawer_padding_half">4dp</dimen> 4 | <dimen name="material_drawer_persistent_height">48dp</dimen> 5 | <dimen name="material_drawer_persistent_height_icon">32dp</dimen> 6 | 7 | <dimen name="gmail_material_drawer_item_corner_radius">20dp</dimen> 8 | <dimen name="gmail_material_drawer_item_background_padding_start">0dp</dimen> 9 | <dimen name="gmail_material_drawer_item_background_padding_end">8dp</dimen> 10 | <dimen name="gmail_material_drawer_item_background_padding_top_bottom">4dp</dimen> 11 | </resources> -------------------------------------------------------------------------------- /app/src/main/res/values/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <resources> 3 | <color name="ic_launcher_background">#3F51B5</color> 4 | </resources> -------------------------------------------------------------------------------- /app/src/main/res/values/ids.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | 3 | <resources> 4 | <item name="material_drawer_item_gmail_item" type="id" /> 5 | <item name="material_drawer_item_custom_url_item" type="id" /> 6 | <item name="material_drawer_item_icon_only" type="id" /> 7 | <item name="material_drawer_item_centered_primary" type="id" /> 8 | <item name="material_drawer_item_overflow_menu" type="id" /> 9 | <item name="material_drawer_profile_item_divider" type="id" /> 10 | 11 | <item name="crossFadeSlider" type="id" /> 12 | <item name="crossFadeSmallView" type="id" /> 13 | <item name="crossFadeLargeView" type="id" /> 14 | 15 | <item name="about_libraries" type="id"/> 16 | </resources> -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <resources> 3 | 4 | <style name="Widget.MaterialDrawerStyleCustom" parent="Widget.MaterialDrawerStyle"> 5 | <!-- MaterialDrawer specific values --> 6 | <item name="materialDrawerBackground">#303030</item> 7 | <item name="materialDrawerPrimaryText">?android:textColorPrimary</item> 8 | <item name="materialDrawerSecondaryText">?android:textColorSecondary</item> 9 | <item name="materialDrawerDividerColor">#1FFFFFFF</item> 10 | <item name="materialDrawerSelectedBackgroundColor">#1FF1433C</item> 11 | </style> 12 | 13 | <!-- 14 | Overwrite the Style of the BezelImageView for the whole MaterialDrawer 15 | <style name="BezelImageView"> 16 | <item name="biv_maskDrawable">@drawable/material_drawer_square_mask</item> 17 | <item name="biv_drawCircularShadow">false</item> 18 | <item name="biv_selectorOnPress">@color/material_drawer_primary</item> 19 | <item name="android:scaleType">centerInside</item> 20 | </style> 21 | --> 22 | 23 | <style name="Widget.MaterialDrawerHeaderStyleCustom" parent=""> 24 | <item name="materialDrawerCompactStyle">true</item> 25 | <item name="materialDrawerHeaderSelectionText">?colorOnSurface</item> 26 | <item name="materialDrawerHeaderSelectionSubtext">?colorOnSurface</item> 27 | </style> 28 | 29 | <style name="Widget.MaterialDrawerHeaderStylePersistent" parent=""> 30 | <item name="materialDrawerCompactStyle">true</item> 31 | <item name="materialDrawerHeaderLayout">@layout/material_drawer_compact_persistent_header 32 | </item> 33 | <item name="materialDrawerHeaderSelectionText">?colorOnSurface</item> 34 | <item name="materialDrawerHeaderSelectionSubtext">?colorOnSurface</item> 35 | </style> 36 | </resources> -------------------------------------------------------------------------------- /app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <resources> 3 | 4 | <!-- LIGHT --> 5 | <style name="SampleApp.DayNight" parent="Theme.Material3.DayNight.NoActionBar"> 6 | <item name="materialDrawerStyle">@style/Widget.MaterialDrawerStyle</item> 7 | <item name="materialDrawerHeaderStyle">@style/Widget.MaterialDrawerHeaderStyle</item> 8 | 9 | <item name="android:windowTranslucentStatus">true</item> 10 | 11 | <!-- CAB :D --> 12 | <item name="windowActionModeOverlay">true</item> 13 | </style> 14 | 15 | <style name="SampleApp.DayNight.Compact" parent="Theme.Material3.Light.NoActionBar"> 16 | <item name="materialDrawerStyle">@style/Widget.MaterialDrawerStyle</item> 17 | <item name="materialDrawerHeaderStyle">@style/Widget.MaterialDrawerHeaderStyleCustom</item> 18 | 19 | <item name="android:windowTranslucentStatus">true</item> 20 | 21 | <!-- CAB :D --> 22 | <item name="windowActionModeOverlay">true</item> 23 | </style> 24 | 25 | <style name="SampleApp.DayNight.Persistent" parent="Theme.Material3.Light.NoActionBar"> 26 | <item name="materialDrawerStyle">@style/Widget.MaterialDrawerStyle</item> 27 | <item name="materialDrawerHeaderStyle">@style/Widget.MaterialDrawerHeaderStylePersistent</item> 28 | 29 | <item name="android:windowTranslucentStatus">true</item> 30 | 31 | <!-- CAB :D --> 32 | <item name="windowActionModeOverlay">true</item> 33 | </style> 34 | 35 | 36 | <style name="SampleApp.DayNight.DarkActionBar" parent="Theme.Material3.DayNight" /> 37 | </resources> -------------------------------------------------------------------------------- /build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | alias(baseLibs.plugins.conventionPlugin) 3 | 4 | alias(baseLibs.plugins.kotlinAndroid) apply false 5 | alias(baseLibs.plugins.androidApplication) apply false 6 | alias(baseLibs.plugins.androidLibrary) apply false 7 | 8 | alias(baseLibs.plugins.dokka) 9 | alias(baseLibs.plugins.aboutLibraries) apply false 10 | alias(baseLibs.plugins.mavenPublish) apply false 11 | 12 | alias(libs.plugins.navSafeArgs) apply false 13 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Maven stuff 2 | GROUP=com.mikepenz 3 | VERSION_NAME=10.0.0-b01 4 | VERSION_CODE=10000 5 | 6 | POM_URL=https://github.com/mikepenz/MaterialDrawer 7 | POM_SCM_URL=https://github.com/mikepenz/MaterialDrawer 8 | POM_SCM_CONNECTION=scm:git@github.com:mikepenz/MaterialDrawer.git 9 | POM_SCM_DEV_CONNECTION=scm:git@github.com:mikepenz/MaterialDrawer.git 10 | POM_SCM_URL_ISSUES=https://github.com/mikepenz/MaterialDrawer/issues 11 | POM_GITHUB_REPO=mikepenz/MaterialDrawer 12 | POM_GITHUB_README=README.md 13 | POM_LICENCE_NAME=Apache-2.0 14 | POM_LICENCE_URL=https://www.apache.org/licenses/LICENSE-2.0.txt 15 | POM_LICENCE_DIST=repo 16 | POM_DEVELOPER_ID=mikepenz 17 | POM_DEVELOPER_NAME=Mike Penz 18 | # Project-wide Gradle settings. 19 | org.gradle.jvmargs=-Xmx1536m 20 | android.useAndroidX=true 21 | android.enableJetifier=false 22 | org.gradle.caching=true 23 | org.gradle.configuration-cache=false 24 | android.suppressUnsupportedCompileSdk=34 25 | # Dokka 26 | org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled 27 | org.jetbrains.dokka.experimental.gradle.pluginMode.noWarn=true 28 | # convention plugin 29 | com.mikepenz.kotlin.warningsAsErrors.enabled=false -------------------------------------------------------------------------------- /gradle/libs.versions.toml: -------------------------------------------------------------------------------- 1 | [versions] 2 | # androidx 3 | appcompat = "1.7.0" 4 | cardview = "1.0.0" 5 | constraintLayout = "2.2.0" 6 | core = "1.15.0" 7 | drawerlayout = "1.2.0" 8 | navigation = "2.8.6" 9 | recyclerView = "1.4.0" 10 | # google 11 | material = "1.12.0" 12 | # other 13 | fastAdapter = "5.7.0" 14 | iconics = "5.4.0" 15 | itemAnimators = "1.1.0" 16 | 17 | [plugins] 18 | navSafeArgs = { id = "androidx.navigation.safeargs", version.ref = "navigation" } 19 | 20 | [libraries] 21 | # androidx 22 | androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "appcompat" } 23 | androidx-cardView = { module = "androidx.cardview:cardview", version.ref = "cardview" } 24 | androidx-constraintLayout = { module = "androidx.constraintlayout:constraintlayout", version.ref = "constraintLayout" } 25 | androidx-core-ktx = { module = "androidx.core:core-ktx", version.ref = "core" } 26 | androidx-drawerlayout = { module = "androidx.drawerlayout:drawerlayout", version.ref = "drawerlayout" } 27 | androidx-navigation-fragment = { module = "androidx.navigation:navigation-fragment", version.ref = "navigation" } 28 | androidx-navigation-runtime = { module = "androidx.navigation:navigation-runtime-ktx", version.ref = "navigation" } 29 | androidx-navigation-ui = { module = "androidx.navigation:navigation-ui-ktx", version.ref = "navigation" } 30 | androidx-recyclerView = { module = "androidx.recyclerview:recyclerview", version.ref = "recyclerView" } 31 | # google 32 | google-material = { module = "com.google.android.material:material", version.ref = "material" } 33 | # other 34 | fastAdapter-core = { module = "com.mikepenz:fastadapter", version.ref = "fastAdapter" } 35 | fastAdapter-expandable = { module = "com.mikepenz:fastadapter-extensions-expandable", version.ref = "fastAdapter" } 36 | iconics-core = { module = "com.mikepenz:iconics-core", version.ref = "iconics" } 37 | itemAnimators-core = { module = "com.mikepenz:itemanimators", version.ref = "itemAnimators" } 38 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | @rem SPDX-License-Identifier: Apache-2.0 17 | @rem 18 | 19 | @if "%DEBUG%"=="" @echo off 20 | @rem ########################################################################## 21 | @rem 22 | @rem Gradle startup script for Windows 23 | @rem 24 | @rem ########################################################################## 25 | 26 | @rem Set local scope for the variables with windows NT shell 27 | if "%OS%"=="Windows_NT" setlocal 28 | 29 | set DIRNAME=%~dp0 30 | if "%DIRNAME%"=="" set DIRNAME=. 31 | @rem This is normally unused 32 | set APP_BASE_NAME=%~n0 33 | set APP_HOME=%DIRNAME% 34 | 35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 37 | 38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 40 | 41 | @rem Find java.exe 42 | if defined JAVA_HOME goto findJavaFromJavaHome 43 | 44 | set JAVA_EXE=java.exe 45 | %JAVA_EXE% -version >NUL 2>&1 46 | if %ERRORLEVEL% equ 0 goto execute 47 | 48 | echo. 1>&2 49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 50 | echo. 1>&2 51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 52 | echo location of your Java installation. 1>&2 53 | 54 | goto fail 55 | 56 | :findJavaFromJavaHome 57 | set JAVA_HOME=%JAVA_HOME:"=% 58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 59 | 60 | if exist "%JAVA_EXE%" goto execute 61 | 62 | echo. 1>&2 63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 64 | echo. 1>&2 65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 66 | echo location of your Java installation. 1>&2 67 | 68 | goto fail 69 | 70 | :execute 71 | @rem Setup the command line 72 | 73 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 74 | 75 | 76 | @rem Execute Gradle 77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 78 | 79 | :end 80 | @rem End local scope for the variables with windows NT shell 81 | if %ERRORLEVEL% equ 0 goto mainEnd 82 | 83 | :fail 84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 85 | rem the _cmd.exe /c_ return code! 86 | set EXIT_CODE=%ERRORLEVEL% 87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 89 | exit /b %EXIT_CODE% 90 | 91 | :mainEnd 92 | if "%OS%"=="Windows_NT" endlocal 93 | 94 | :omega 95 | -------------------------------------------------------------------------------- /materialdrawer-iconics/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /materialdrawer-iconics/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("com.mikepenz.convention.android-library") 3 | id("com.mikepenz.convention.kotlin") 4 | id("com.mikepenz.convention.publishing") 5 | } 6 | 7 | android { 8 | namespace = "com.mikepenz.materialdrawer.iconics" 9 | } 10 | 11 | dependencies { 12 | implementation(project(":materialdrawer")) 13 | 14 | // used to provide out of the box icon font support. simplifies development, 15 | // and provides scalable icons. the core is very very light 16 | // https://github.com/mikepenz/Android-Iconics 17 | implementation(libs.iconics.core) 18 | } -------------------------------------------------------------------------------- /materialdrawer-iconics/gradle.properties: -------------------------------------------------------------------------------- 1 | POM_NAME=MaterialDrawer Iconics-Extension 2 | POM_DESCRIPTION=Extension for the MaterialDrawer library to add Android-Iconics support. 3 | POM_ARTIFACT_ID=materialdrawer-iconics 4 | POM_PACKAGING=aar -------------------------------------------------------------------------------- /materialdrawer-iconics/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | <manifest/> 2 | -------------------------------------------------------------------------------- /materialdrawer-iconics/src/main/java/com/mikepenz/materialdrawer/iconics/IconicsExtension.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.iconics 2 | 3 | import android.os.Build 4 | import com.mikepenz.iconics.typeface.IIcon 5 | import com.mikepenz.materialdrawer.model.BaseDrawerItem 6 | import com.mikepenz.materialdrawer.model.interfaces.Iconable 7 | import com.mikepenz.materialdrawer.model.interfaces.withIconTintingEnabled 8 | 9 | var <T : BaseDrawerItem<*, *>> T.iconicsIcon: IIcon 10 | @Deprecated(level = DeprecationLevel.ERROR, message = "Not readable") 11 | get() = throw UnsupportedOperationException("Please use the direct property") 12 | set(value) { 13 | this.iconicsIconHolder = IconicsImageHolder(value) 14 | } 15 | 16 | var <T : BaseDrawerItem<*, *>> T.iconicsIconHolder: IconicsImageHolder? 17 | get() = icon as? IconicsImageHolder 18 | set(value) { 19 | this.icon = value 20 | //if we are on api 21 or higher we use the IconicsDrawable for selection too and color it with the correct color 21 | //else we use just the one drawable and enable tinting on press 22 | if (Build.VERSION.SDK_INT >= 21) { 23 | this.selectedIcon = value 24 | } else if (value != null) { 25 | this.withIconTintingEnabled(true) 26 | } 27 | } 28 | 29 | @Deprecated("Please consider to replace with the actual property setter") 30 | fun <T : BaseDrawerItem<*, *>> T.withIcon(icon: IIcon): T { 31 | this.iconicsIconHolder = IconicsImageHolder(icon) 32 | return this 33 | } 34 | 35 | var <T : Iconable> T.iconicsIcon: IIcon 36 | @Deprecated(level = DeprecationLevel.ERROR, message = "Not readable") 37 | get() = throw UnsupportedOperationException("Please use the direct property") 38 | set(value) { 39 | this.icon = IconicsImageHolder(value) 40 | } 41 | 42 | @Deprecated("Please consider to replace with the actual property setter") 43 | fun <T : Iconable> T.withIcon(icon: IIcon): T { 44 | this.icon = IconicsImageHolder(icon) 45 | return this 46 | } -------------------------------------------------------------------------------- /materialdrawer-iconics/src/main/java/com/mikepenz/materialdrawer/iconics/IconicsImageHolder.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.iconics 2 | 3 | import android.content.Context 4 | import android.content.res.ColorStateList 5 | import android.graphics.PorterDuff 6 | import android.graphics.drawable.Drawable 7 | import android.widget.ImageView 8 | import androidx.appcompat.content.res.AppCompatResources 9 | import com.mikepenz.iconics.IconicsDrawable 10 | import com.mikepenz.iconics.typeface.IIcon 11 | import com.mikepenz.iconics.utils.actionBar 12 | import com.mikepenz.iconics.utils.paddingDp 13 | import com.mikepenz.iconics.utils.sizeDp 14 | import com.mikepenz.materialdrawer.holder.ImageHolder 15 | import com.mikepenz.materialdrawer.util.DrawerImageLoader 16 | import java.io.FileNotFoundException 17 | 18 | class IconicsImageHolder(iicon: IIcon) : ImageHolder() { 19 | 20 | var iicon: IIcon? = iicon 21 | internal set 22 | 23 | 24 | /** 25 | * sets an existing image to the imageView 26 | * 27 | * @param imageView 28 | * @param tag used to identify imageViews and define different placeholders 29 | * @return true if an image was set 30 | */ 31 | override fun applyTo(imageView: ImageView, tag: String?): Boolean { 32 | val ii = iicon 33 | val uri = uri 34 | 35 | if (uri != null) { 36 | val consumed = DrawerImageLoader.instance.setImage(imageView, uri, tag) 37 | if (!consumed) { 38 | imageView.setImageURI(uri) 39 | } 40 | } else if (icon != null) { 41 | imageView.setImageDrawable(icon) 42 | } else if (bitmap != null) { 43 | imageView.setImageBitmap(bitmap) 44 | } else if (iconRes != -1) { 45 | imageView.setImageResource(iconRes) 46 | } else if (ii != null) { 47 | imageView.setImageDrawable(IconicsDrawable(imageView.context, ii).actionBar()) 48 | } else { 49 | imageView.setImageBitmap(null) 50 | return false 51 | } 52 | return true 53 | } 54 | 55 | /** 56 | * this only handles Drawables 57 | * 58 | * @param ctx 59 | * @param iconColor 60 | * @param tint 61 | * @return 62 | */ 63 | override fun decideIcon(ctx: Context, iconColor: ColorStateList, tint: Boolean, paddingDp: Int): Drawable? { 64 | var icon: Drawable? = icon 65 | val ii = iicon 66 | val uri = uri 67 | 68 | when { 69 | ii != null -> icon = IconicsDrawable(ctx, ii).apply { 70 | colorList = iconColor 71 | sizeDp = 24 72 | this.paddingDp = paddingDp 73 | } 74 | iconRes != -1 -> icon = AppCompatResources.getDrawable(ctx, iconRes) 75 | uri != null -> try { 76 | val inputStream = ctx.contentResolver.openInputStream(uri) 77 | icon = Drawable.createFromStream(inputStream, uri.toString()) 78 | } catch (e: FileNotFoundException) { 79 | //no need to handle this 80 | } 81 | } 82 | //if we got an icon AND we have auto tinting enabled AND it is no IIcon, tint it ;) 83 | if (icon != null && tint && iicon == null) { 84 | icon = icon.mutate() 85 | icon.setColorFilter(iconColor.defaultColor, PorterDuff.Mode.SRC_IN) 86 | } 87 | return icon 88 | } 89 | } -------------------------------------------------------------------------------- /materialdrawer-nav/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /materialdrawer-nav/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("com.mikepenz.convention.android-library") 3 | id("com.mikepenz.convention.kotlin") 4 | id("com.mikepenz.convention.publishing") 5 | id("androidx.navigation.safeargs.kotlin") 6 | } 7 | 8 | android { 9 | namespace = "com.mikepenz.materialdrawer.nav" 10 | } 11 | 12 | dependencies { 13 | implementation(project(":materialdrawer")) 14 | 15 | implementation(libs.androidx.navigation.runtime) 16 | implementation(libs.androidx.navigation.ui) 17 | } -------------------------------------------------------------------------------- /materialdrawer-nav/consumer-rules.pro: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/materialdrawer-nav/consumer-rules.pro -------------------------------------------------------------------------------- /materialdrawer-nav/gradle.properties: -------------------------------------------------------------------------------- 1 | POM_NAME=MaterialDrawer NavController-Extension 2 | POM_DESCRIPTION=Extension for the MaterialDrawer library to add NavController support. 3 | POM_ARTIFACT_ID=materialdrawer-nav 4 | POM_PACKAGING=aar -------------------------------------------------------------------------------- /materialdrawer-nav/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /materialdrawer-nav/proguard-rules.txt: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Entwicklung/android-sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the ProGuard 5 | # include property in project.properties. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} -------------------------------------------------------------------------------- /materialdrawer-nav/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | <manifest/> 2 | -------------------------------------------------------------------------------- /materialdrawer-nav/src/main/java/com/mikepenz/materialdrawer/model/NavigationDrawerItem.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.model 2 | 3 | import android.content.Context 4 | import android.os.Bundle 5 | import android.view.LayoutInflater 6 | import android.view.View 7 | import android.view.ViewGroup 8 | import androidx.annotation.CallSuper 9 | import androidx.annotation.IdRes 10 | import androidx.navigation.NavOptions 11 | import androidx.recyclerview.widget.RecyclerView 12 | import com.mikepenz.materialdrawer.R 13 | import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem 14 | 15 | class NavigationDrawerItem<VH : RecyclerView.ViewHolder>( 16 | @IdRes val resId: Int, 17 | val item: IDrawerItem<VH>, 18 | val args: Bundle? = null, 19 | val options: NavOptions? = defaultOptions 20 | ) : IDrawerItem<VH> by item { 21 | 22 | init { 23 | item.identifier = resId.toLong() 24 | } 25 | 26 | /** 27 | * generates a view by the defined LayoutRes 28 | */ 29 | override fun generateView(ctx: Context): View { 30 | val viewHolder = getViewHolder(LayoutInflater.from(ctx).inflate(layoutRes, null, false) as ViewGroup) 31 | bindView(viewHolder, mutableListOf()) 32 | return viewHolder.itemView 33 | } 34 | 35 | /** 36 | * generates a view by the defined LayoutRes and pass the LayoutParams from the parent 37 | */ 38 | override fun generateView(ctx: Context, parent: ViewGroup): View { 39 | val viewHolder = getViewHolder(LayoutInflater.from(ctx).inflate(layoutRes, parent, false) as ViewGroup) 40 | bindView(viewHolder, mutableListOf()) 41 | return viewHolder.itemView 42 | } 43 | 44 | @CallSuper 45 | override fun bindView(holder: VH, payloads: List<Any>) { 46 | item.bindView(holder, payloads) 47 | holder.itemView.setTag(R.id.material_drawer_item, this) 48 | } 49 | 50 | companion object { 51 | val defaultOptions = NavOptions.Builder() 52 | .setLaunchSingleTop(true) 53 | .setEnterAnim(androidx.navigation.ui.R.anim.nav_default_enter_anim) 54 | .setExitAnim(androidx.navigation.ui.R.anim.nav_default_exit_anim) 55 | .setPopEnterAnim(androidx.navigation.ui.R.anim.nav_default_pop_enter_anim) 56 | .setPopExitAnim(androidx.navigation.ui.R.anim.nav_default_pop_exit_anim) 57 | .build() 58 | } 59 | } -------------------------------------------------------------------------------- /materialdrawer/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /materialdrawer/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("com.mikepenz.convention.android-library") 3 | id("com.mikepenz.convention.kotlin") 4 | id("com.mikepenz.convention.publishing") 5 | } 6 | 7 | android { 8 | namespace = "com.mikepenz.materialdrawer" 9 | } 10 | 11 | dependencies { 12 | implementation(libs.androidx.appcompat) 13 | implementation(libs.androidx.core.ktx) 14 | 15 | api(libs.androidx.drawerlayout) 16 | api(libs.androidx.recyclerView) 17 | implementation(libs.androidx.cardView) 18 | implementation(libs.google.material) 19 | 20 | // add the constraintLayout used to create the items and headers 21 | implementation(libs.androidx.constraintLayout) 22 | 23 | // used to fill the RecyclerView with the items 24 | // and provides single and multi selection, expandable items 25 | // https://github.com/mikepenz/FastAdapter 26 | api(libs.fastAdapter.core) 27 | api(libs.fastAdapter.expandable) 28 | } -------------------------------------------------------------------------------- /materialdrawer/gradle.properties: -------------------------------------------------------------------------------- 1 | POM_NAME=MaterialDrawer Library 2 | POM_DESCRIPTION=The flexible, easy to use, all in one drawer library for your Android project. 3 | POM_ARTIFACT_ID=materialdrawer 4 | POM_PACKAGING=aar -------------------------------------------------------------------------------- /materialdrawer/proguard-rules.txt: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Entwicklung/android-sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the ProGuard 5 | # include property in project.properties. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} -------------------------------------------------------------------------------- /materialdrawer/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <manifest/> 3 | -------------------------------------------------------------------------------- /materialdrawer/src/main/java/com/mikepenz/materialdrawer/holder/DimenHolder.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.holder 2 | 3 | import android.content.Context 4 | import android.content.res.Resources 5 | import android.util.DisplayMetrics 6 | import androidx.annotation.DimenRes 7 | import androidx.annotation.Dimension 8 | import androidx.annotation.Dimension.Companion.DP 9 | import androidx.annotation.Dimension.Companion.PX 10 | 11 | 12 | /** 13 | * Defines a custom holder class to support providing dimension either as pixel, dp or dimensRes. Does not require a [Context] and will resolve the value when applying. 14 | */ 15 | open class DimenHolder { 16 | /** Defines the pixel dimension */ 17 | var pixel = Int.MIN_VALUE 18 | internal set 19 | /** Defines the dp dimension */ 20 | var dp = Int.MIN_VALUE 21 | internal set 22 | /** Defines the resource dimension */ 23 | var resource = Int.MIN_VALUE 24 | internal set 25 | 26 | /** Resturns this [DimenHolder]`s dimension as pixel value */ 27 | open fun asPixel(ctx: Context): Int { 28 | return when { 29 | pixel != Int.MIN_VALUE -> pixel 30 | dp != Int.MIN_VALUE -> ctx.convertDpToPixel(dp) 31 | resource != Int.MIN_VALUE -> ctx.resources.getDimensionPixelSize(resource) 32 | else -> 0 33 | } 34 | } 35 | 36 | companion object { 37 | /** 38 | * Constructs a [DimenHolder] given a pixel value 39 | */ 40 | fun fromPixel(@Dimension(unit = PX) pixel: Int): DimenHolder { 41 | val dimenHolder = DimenHolder() 42 | dimenHolder.pixel = pixel 43 | return dimenHolder 44 | } 45 | 46 | /** 47 | * Constructs a [DimenHolder] given a dp value 48 | */ 49 | fun fromDp(@Dimension(unit = DP) dp: Int): DimenHolder { 50 | val dimenHolder = DimenHolder() 51 | dimenHolder.dp = dp 52 | return dimenHolder 53 | } 54 | 55 | /** 56 | * Constructs a [DimenHolder] given a resource id 57 | */ 58 | fun fromResource(@DimenRes resource: Int): DimenHolder { 59 | val dimenHolder = DimenHolder() 60 | dimenHolder.resource = resource 61 | return dimenHolder 62 | } 63 | } 64 | } 65 | 66 | 67 | /** 68 | * This method converts dp unit to equivalent pixels, depending on device density. 69 | */ 70 | private fun Context.convertDpToPixel(dp: Int): Int { 71 | val resources: Resources = resources 72 | val metrics: DisplayMetrics = resources.displayMetrics 73 | return (dp * (metrics.densityDpi / 160.0)).toInt() 74 | } 75 | -------------------------------------------------------------------------------- /materialdrawer/src/main/java/com/mikepenz/materialdrawer/holder/StringHolder.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.holder 2 | 3 | import android.content.Context 4 | import android.view.View 5 | import android.widget.TextView 6 | import androidx.annotation.StringRes 7 | 8 | /** 9 | * Defines a custom holder class to support providing strings either as string or resource. Does not require a [Context] and will resolve the value when applying. 10 | */ 11 | open class StringHolder { 12 | /** Defines the string text */ 13 | var textString: CharSequence? = null 14 | internal set 15 | /** Defines the string resource */ 16 | var textRes = -1 17 | internal set 18 | 19 | constructor(text: CharSequence?) { 20 | this.textString = text 21 | } 22 | 23 | constructor(@StringRes textRes: Int) { 24 | this.textRes = textRes 25 | } 26 | 27 | /** 28 | * Applies the text to a [TextView] 29 | */ 30 | open fun applyTo(textView: TextView?) { 31 | when { 32 | textString != null -> textView?.text = textString 33 | textRes != -1 -> textView?.setText(textRes) 34 | else -> textView?.text = "" 35 | } 36 | } 37 | 38 | /** 39 | * Applies the [TextView] if no text given, hide the textView 40 | */ 41 | open fun applyToOrHide(textView: TextView?): Boolean { 42 | textView ?: return false 43 | return when { 44 | textString != null -> { 45 | textView.text = textString 46 | textView.visibility = View.VISIBLE 47 | true 48 | } 49 | textRes != -1 -> { 50 | textView.setText(textRes) 51 | textView.visibility = View.VISIBLE 52 | true 53 | } 54 | else -> { 55 | textView.visibility = View.GONE 56 | false 57 | } 58 | } 59 | } 60 | 61 | /** 62 | * Returns the text as [String] 63 | */ 64 | open fun getText(ctx: Context): String? { 65 | if (textString != null) { 66 | return textString.toString() 67 | } else if (textRes != -1) { 68 | return ctx.getString(textRes) 69 | } 70 | return null 71 | } 72 | 73 | companion object { 74 | /** 75 | * Helper to apply the text to a [TextView] 76 | */ 77 | fun applyTo(text: StringHolder?, textView: TextView?) { 78 | text?.applyTo(textView) 79 | } 80 | 81 | /** 82 | * Helper to apply the text to a [TextView] or hide if null 83 | */ 84 | fun applyToOrHide(text: StringHolder?, textView: TextView?): Boolean { 85 | return if (text != null) { 86 | text.applyToOrHide(textView) 87 | } else { 88 | textView?.visibility = View.GONE 89 | false 90 | } 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /materialdrawer/src/main/java/com/mikepenz/materialdrawer/interfaces/ICrossfader.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.interfaces 2 | 3 | /** 4 | * Helper interface to allow providing crossfade functionality with different implementations to the drawer 5 | */ 6 | interface ICrossfader { 7 | 8 | /** 9 | * returns true if currently crossfaded 10 | */ 11 | val isCrossfaded: Boolean 12 | 13 | /** 14 | * allows to toggle the crossfade state 15 | */ 16 | fun crossfade() 17 | } 18 | -------------------------------------------------------------------------------- /materialdrawer/src/main/java/com/mikepenz/materialdrawer/interfaces/OnCheckedChangeListener.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.interfaces 2 | 3 | import android.widget.CompoundButton 4 | 5 | import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem 6 | 7 | /** 8 | * Interface definition for a callback to be invoked when the checked state 9 | * of a compound button changed. 10 | */ 11 | interface OnCheckedChangeListener { 12 | /** 13 | * Called when the checked state of a compound button has changed. 14 | */ 15 | fun onCheckedChanged(drawerItem: IDrawerItem<*>, buttonView: CompoundButton, isChecked: Boolean) 16 | } -------------------------------------------------------------------------------- /materialdrawer/src/main/java/com/mikepenz/materialdrawer/interfaces/OnPostBindViewListener.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.interfaces 2 | 3 | import android.view.View 4 | import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem 5 | 6 | /** 7 | * Defines the listener fired after binding a view 8 | */ 9 | interface OnPostBindViewListener { 10 | /** 11 | * allows you to hook in the BindView method and modify the view after binding 12 | */ 13 | fun onBindView(drawerItem: IDrawerItem<*>, view: View) 14 | } 15 | -------------------------------------------------------------------------------- /materialdrawer/src/main/java/com/mikepenz/materialdrawer/model/AbstractBadgeableDrawerItem.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.model 2 | 3 | import android.view.View 4 | import android.widget.TextView 5 | import androidx.annotation.LayoutRes 6 | import com.mikepenz.materialdrawer.R 7 | import com.mikepenz.materialdrawer.holder.BadgeStyle 8 | import com.mikepenz.materialdrawer.holder.StringHolder 9 | import com.mikepenz.materialdrawer.model.interfaces.ColorfulBadgeable 10 | import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem 11 | 12 | /** 13 | * An abstract [IDrawerItem] implementation describing an element which supports badges 14 | */ 15 | abstract class AbstractBadgeableDrawerItem<Item : AbstractBadgeableDrawerItem<Item>> : BaseDescribeableDrawerItem<Item, AbstractBadgeableDrawerItem.ViewHolder>(), ColorfulBadgeable { 16 | override var badge: StringHolder? = null 17 | override var badgeStyle: BadgeStyle? = BadgeStyle() 18 | 19 | override/*"PRIMARY_ITEM"*/ val type: Int 20 | get() = R.id.material_drawer_item_primary 21 | 22 | override val layoutRes: Int 23 | @LayoutRes 24 | get() = R.layout.material_drawer_item_primary 25 | 26 | override fun bindView(holder: ViewHolder, payloads: List<Any>) { 27 | super.bindView(holder, payloads) 28 | 29 | val ctx = holder.itemView.context 30 | //bind the basic view parts 31 | bindViewHelper(holder) 32 | 33 | //set the text for the badge or hide 34 | val badgeVisible = StringHolder.applyToOrHide(badge, holder.badge) 35 | //style the badge if it is visible 36 | if (badgeVisible) { 37 | badgeStyle?.style(holder.badge, getColor(ctx)) 38 | holder.badge.visibility = View.VISIBLE 39 | } else { 40 | holder.badge.visibility = View.GONE 41 | } 42 | 43 | //define the typeface for our textViews 44 | if (typeface != null) { 45 | holder.badge.typeface = typeface 46 | } 47 | 48 | //call the onPostBindView method to trigger post bind view actions (like the listener to modify the item if required) 49 | onPostBindView(this, holder.itemView) 50 | } 51 | 52 | override fun getViewHolder(v: View): ViewHolder { 53 | return ViewHolder(v) 54 | } 55 | 56 | open class ViewHolder(view: View) : BaseViewHolder(view) { 57 | internal val badge: TextView = view.findViewById(R.id.material_drawer_badge) 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /materialdrawer/src/main/java/com/mikepenz/materialdrawer/model/BaseDrawerItem.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.model 2 | 3 | import android.content.Context 4 | import android.content.res.ColorStateList 5 | import androidx.recyclerview.widget.RecyclerView 6 | import com.mikepenz.materialdrawer.holder.ImageHolder 7 | import com.mikepenz.materialdrawer.holder.StringHolder 8 | import com.mikepenz.materialdrawer.model.interfaces.* 9 | import com.mikepenz.materialdrawer.util.getPrimaryDrawerIconColor 10 | 11 | /** 12 | * An abstract [IDrawerItem] implementation providing the base properties with their default value 13 | */ 14 | abstract class BaseDrawerItem<T, VH : RecyclerView.ViewHolder> : AbstractDrawerItem<T, VH>(), Nameable, NameableColor, Iconable, SelectIconable, Tagable { 15 | override var icon: ImageHolder? = null 16 | override var iconColor: ColorStateList? = null 17 | override var selectedIcon: ImageHolder? = null 18 | override var name: StringHolder? = null 19 | override var textColor: ColorStateList? = null 20 | override var isIconTinted = false 21 | 22 | /** Allows to set the 'level' of this item */ 23 | var level = 1 24 | 25 | @Deprecated("Please consider to replace with the actual property setter") 26 | fun withLevel(level: Int): T { 27 | this.level = level 28 | return this as T 29 | } 30 | 31 | /** 32 | * helper method to decide for the correct color 33 | * 34 | * @param ctx 35 | * @return 36 | */ 37 | open fun getIconColor(ctx: Context): ColorStateList { 38 | return ctx.getPrimaryDrawerIconColor() 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /materialdrawer/src/main/java/com/mikepenz/materialdrawer/model/BaseViewHolder.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.model 2 | 3 | import android.view.View 4 | import android.widget.ImageView 5 | import android.widget.TextView 6 | import androidx.recyclerview.widget.RecyclerView 7 | import com.mikepenz.materialdrawer.R 8 | 9 | /** 10 | *the base [RecyclerView.ViewHolder] for drawerItems 11 | */ 12 | open class BaseViewHolder(internal var view: View) : RecyclerView.ViewHolder(view) { 13 | internal var icon: ImageView = view.findViewById(R.id.material_drawer_icon) 14 | internal var name: TextView = view.findViewById(R.id.material_drawer_name) 15 | internal var description: TextView = view.findViewById(R.id.material_drawer_description) 16 | } -------------------------------------------------------------------------------- /materialdrawer/src/main/java/com/mikepenz/materialdrawer/model/DividerDrawerItem.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.model 2 | 3 | import android.view.View 4 | import androidx.annotation.LayoutRes 5 | import androidx.core.view.ViewCompat 6 | import androidx.recyclerview.widget.RecyclerView 7 | import com.mikepenz.materialdrawer.R 8 | import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem 9 | import com.mikepenz.materialdrawer.util.getDividerColor 10 | 11 | /** 12 | * Describes a [IDrawerItem] acting as a divider in between items 13 | */ 14 | open class DividerDrawerItem : AbstractDrawerItem<DividerDrawerItem, DividerDrawerItem.ViewHolder>() { 15 | override val type: Int 16 | get() = R.id.material_drawer_item_divider 17 | 18 | override val layoutRes: Int 19 | @LayoutRes 20 | get() = R.layout.material_drawer_item_divider 21 | 22 | override fun bindView(holder: ViewHolder, payloads: List<Any>) { 23 | super.bindView(holder, payloads) 24 | 25 | val ctx = holder.itemView.context 26 | 27 | //set the identifier from the drawerItem here. It can be used to run tests 28 | holder.itemView.id = hashCode() 29 | 30 | //define how the divider should look like 31 | holder.itemView.isClickable = false 32 | holder.itemView.isEnabled = false 33 | holder.itemView.minimumHeight = 1 34 | ViewCompat.setImportantForAccessibility(holder.itemView, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_NO) 35 | 36 | //set the color for the divider 37 | holder.itemView.setBackgroundColor(ctx.getDividerColor()) 38 | 39 | //call the onPostBindView method to trigger post bind view actions (like the listener to modify the item if required) 40 | onPostBindView(this, holder.itemView) 41 | } 42 | 43 | override fun getViewHolder(v: View): ViewHolder { 44 | return ViewHolder(v) 45 | } 46 | 47 | class ViewHolder internal constructor(view: View) : RecyclerView.ViewHolder(view) 48 | } 49 | -------------------------------------------------------------------------------- /materialdrawer/src/main/java/com/mikepenz/materialdrawer/model/PrimaryDrawerItem.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.model 2 | 3 | import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem 4 | 5 | /** 6 | * Describes the main [IDrawerItem] bing used as primary item, following the guidelines 7 | */ 8 | open class PrimaryDrawerItem : AbstractBadgeableDrawerItem<PrimaryDrawerItem>() 9 | -------------------------------------------------------------------------------- /materialdrawer/src/main/java/com/mikepenz/materialdrawer/model/SecondaryDrawerItem.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.model 2 | 3 | import android.content.Context 4 | import android.content.res.ColorStateList 5 | import androidx.annotation.LayoutRes 6 | import com.mikepenz.materialdrawer.R 7 | import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem 8 | import com.mikepenz.materialdrawer.util.getSecondaryDrawerIconColor 9 | import com.mikepenz.materialdrawer.util.getSecondaryDrawerTextColor 10 | 11 | /** 12 | * Describes the secondary [IDrawerItem] bing used as primary item. Slightly smaller than the primary items 13 | */ 14 | open class SecondaryDrawerItem : AbstractBadgeableDrawerItem<SecondaryDrawerItem>() { 15 | 16 | override val type: Int 17 | get() = R.id.material_drawer_item_secondary 18 | 19 | override val layoutRes: Int 20 | @LayoutRes 21 | get() = R.layout.material_drawer_item_secondary 22 | 23 | override fun getColor(ctx: Context): ColorStateList { 24 | return ctx.getSecondaryDrawerTextColor() 25 | } 26 | 27 | override fun getIconColor(ctx: Context): ColorStateList { 28 | return ctx.getSecondaryDrawerIconColor() 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /materialdrawer/src/main/java/com/mikepenz/materialdrawer/model/SecondarySwitchDrawerItem.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.model 2 | 3 | import android.content.Context 4 | import android.content.res.ColorStateList 5 | import androidx.annotation.LayoutRes 6 | import com.mikepenz.materialdrawer.R 7 | import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem 8 | import com.mikepenz.materialdrawer.util.getSecondaryDrawerIconColor 9 | import com.mikepenz.materialdrawer.util.getSecondaryDrawerTextColor 10 | 11 | /** 12 | * Describes a [IDrawerItem] bing used as secondary item, offering a switch. 13 | */ 14 | open class SecondarySwitchDrawerItem : AbstractSwitchableDrawerItem<SecondarySwitchDrawerItem>() { 15 | 16 | override val type: Int 17 | get() = R.id.material_drawer_item_secondary_switch 18 | 19 | override val layoutRes: Int 20 | @LayoutRes 21 | get() = R.layout.material_drawer_item_secondary_switch 22 | 23 | override fun getColor(ctx: Context): ColorStateList { 24 | return ctx.getSecondaryDrawerTextColor() 25 | } 26 | 27 | override fun getIconColor(ctx: Context): ColorStateList { 28 | return ctx.getSecondaryDrawerIconColor() 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /materialdrawer/src/main/java/com/mikepenz/materialdrawer/model/SecondaryToggleDrawerItem.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.model 2 | 3 | import android.content.Context 4 | import android.content.res.ColorStateList 5 | import androidx.annotation.LayoutRes 6 | import com.mikepenz.materialdrawer.R 7 | import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem 8 | import com.mikepenz.materialdrawer.util.getSecondaryDrawerIconColor 9 | import com.mikepenz.materialdrawer.util.getSecondaryDrawerTextColor 10 | 11 | /** 12 | * Describes a [IDrawerItem] bing used as secondary item, offering a toggle. 13 | */ 14 | open class SecondaryToggleDrawerItem : AbstractToggleableDrawerItem<SecondaryToggleDrawerItem>() { 15 | 16 | override val type: Int 17 | get() = R.id.material_drawer_item_secondary_toggle 18 | 19 | override val layoutRes: Int 20 | @LayoutRes 21 | get() = R.layout.material_drawer_item_secondary_toggle 22 | 23 | override fun getColor(ctx: Context): ColorStateList { 24 | return ctx.getSecondaryDrawerTextColor() 25 | } 26 | 27 | override fun getIconColor(ctx: Context): ColorStateList { 28 | return ctx.getSecondaryDrawerIconColor() 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /materialdrawer/src/main/java/com/mikepenz/materialdrawer/model/SwitchDrawerItem.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.model 2 | 3 | import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem 4 | 5 | /** 6 | * Describes the main [IDrawerItem] bing used as primary item, offering a switch. 7 | */ 8 | open class SwitchDrawerItem : AbstractSwitchableDrawerItem<SwitchDrawerItem>() 9 | -------------------------------------------------------------------------------- /materialdrawer/src/main/java/com/mikepenz/materialdrawer/model/ToggleDrawerItem.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.model 2 | 3 | import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem 4 | 5 | /** 6 | * Describes the main [IDrawerItem] bing used as primary item, offering a toggle. 7 | */ 8 | open class ToggleDrawerItem : AbstractToggleableDrawerItem<ToggleDrawerItem>() 9 | -------------------------------------------------------------------------------- /materialdrawer/src/main/java/com/mikepenz/materialdrawer/model/interfaces/Badgeable.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.model.interfaces 2 | 3 | import com.mikepenz.materialdrawer.holder.StringHolder 4 | 5 | /** 6 | * Defines a [IDrawerItem] which allows to have a badge 7 | */ 8 | interface Badgeable { 9 | /** the badge text to show for this item */ 10 | var badge: StringHolder? 11 | } 12 | 13 | @Deprecated("Please consider to replace with the actual property setter") 14 | fun <T : Badgeable> T.withBadge(badge: String): T { 15 | this.badge = StringHolder(badge) 16 | return this 17 | } 18 | 19 | @Deprecated("Please consider to replace with the actual property setter") 20 | fun <T : Badgeable> T.withBadge(badgeRes: Int): T { 21 | this.badge = StringHolder(badgeRes) 22 | return this 23 | } 24 | 25 | @Deprecated("Please consider to replace with the actual property setter") 26 | fun <T : Badgeable> T.withBadge(badge: StringHolder?): T { 27 | this.badge = badge 28 | return this 29 | } 30 | 31 | /** Set the badge name */ 32 | var Badgeable.badgeRes: Int 33 | @Deprecated(level = DeprecationLevel.ERROR, message = "Not readable") 34 | get() = throw UnsupportedOperationException("Please use the direct property") 35 | set(value) { 36 | badge = StringHolder(value) 37 | } 38 | 39 | /** Set the badge name */ 40 | var Badgeable.badgeText: CharSequence 41 | @Deprecated(level = DeprecationLevel.ERROR, message = "Not readable") 42 | get() = throw UnsupportedOperationException("Please use the direct property") 43 | set(value) { 44 | badge = StringHolder(value) 45 | } 46 | -------------------------------------------------------------------------------- /materialdrawer/src/main/java/com/mikepenz/materialdrawer/model/interfaces/Checkable.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.model.interfaces 2 | 3 | /** 4 | * Defines a [IDrawerItem] with support for being selected 5 | */ 6 | interface Checkable : Selectable { 7 | var isChecked: Boolean 8 | } 9 | 10 | @Deprecated("Please consider to replace with the actual property setter") 11 | fun <T : Checkable> T.withChecked(checked: Boolean): T { 12 | this.isChecked = checked 13 | return this 14 | } 15 | 16 | 17 | @Deprecated("Please consider to replace with the actual property setter") 18 | fun <T : Checkable> T.withCheckable(checkable: Boolean): T { 19 | this.isSelectable = checkable 20 | return this 21 | } 22 | -------------------------------------------------------------------------------- /materialdrawer/src/main/java/com/mikepenz/materialdrawer/model/interfaces/ColorfulBadgeable.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.model.interfaces 2 | 3 | import com.mikepenz.materialdrawer.holder.BadgeStyle 4 | 5 | /** 6 | * Defines a [IDrawerItem] which allows to have a colorful badge 7 | */ 8 | interface ColorfulBadgeable : Badgeable { 9 | /** defines the style for the badge in the item */ 10 | var badgeStyle: BadgeStyle? 11 | } 12 | 13 | @Deprecated("Please consider to replace with the actual property setter") 14 | fun <T : ColorfulBadgeable> T.withBadgeStyle(badgeStyle: BadgeStyle?): T { 15 | this.badgeStyle = badgeStyle 16 | return this 17 | } -------------------------------------------------------------------------------- /materialdrawer/src/main/java/com/mikepenz/materialdrawer/model/interfaces/Describable.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.model.interfaces 2 | 3 | import androidx.annotation.StringRes 4 | import com.mikepenz.materialdrawer.holder.StringHolder 5 | 6 | /** 7 | * Defines a [IDrawerItem] with support for defining a description 8 | */ 9 | interface Describable { 10 | /** The text to show as description */ 11 | var description: StringHolder? 12 | } 13 | 14 | @Deprecated("Please consider to replace with the actual property setter") 15 | fun <T : Describable> T.withDescription(description: String): T { 16 | this.description = StringHolder(description) 17 | return this 18 | } 19 | 20 | @Deprecated("Please consider to replace with the actual property setter") 21 | fun <T : Describable> T.withDescription(@StringRes descriptionRes: Int): T { 22 | this.description = StringHolder(descriptionRes) 23 | return this 24 | } 25 | 26 | /** Set the description */ 27 | var Describable.descriptionRes: Int 28 | @Deprecated(level = DeprecationLevel.ERROR, message = "Not readable") 29 | get() = throw UnsupportedOperationException("Please use the direct property") 30 | set(value) { 31 | description = StringHolder(value) 32 | } 33 | 34 | /** Set the description */ 35 | var Describable.descriptionText: CharSequence 36 | @Deprecated(level = DeprecationLevel.ERROR, message = "Not readable") 37 | get() = throw UnsupportedOperationException("Please use the direct property") 38 | set(value) { 39 | description = StringHolder(value) 40 | } -------------------------------------------------------------------------------- /materialdrawer/src/main/java/com/mikepenz/materialdrawer/model/interfaces/DescribableColor.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.model.interfaces 2 | 3 | import android.content.res.ColorStateList 4 | import androidx.annotation.ColorInt 5 | import androidx.annotation.ColorRes 6 | 7 | /** 8 | * Defines a [IDrawerItem] with support for defining a description 9 | */ 10 | interface DescribableColor { 11 | /** The color for the description text */ 12 | var descriptionTextColor: ColorStateList? 13 | } 14 | 15 | /** 16 | * Set the description color as color resource. 17 | * 18 | * This method is deprecated and no-op. 19 | * 20 | * @deprecated 21 | */ 22 | var DescribableColor.descriptionTextColorRes: Int 23 | @Deprecated(level = DeprecationLevel.ERROR, message = "Not readable") 24 | get() = throw UnsupportedOperationException("Please use the direct property") 25 | @Deprecated( 26 | "Please use `descriptionTextColor` directly, as [ColorStateList] can't be resolved without [Context].", 27 | level = DeprecationLevel.WARNING, 28 | replaceWith = ReplaceWith("descriptionTextColor") 29 | ) 30 | set(@ColorRes value) { 31 | // no-op 32 | } 33 | 34 | /** Set the description color as color int */ 35 | var DescribableColor.descriptionTextColorInt: Int 36 | @Deprecated(level = DeprecationLevel.ERROR, message = "Not readable") 37 | get() = throw UnsupportedOperationException("Please use the direct property") 38 | set(@ColorInt value) { 39 | descriptionTextColor = ColorStateList.valueOf(value) 40 | } 41 | -------------------------------------------------------------------------------- /materialdrawer/src/main/java/com/mikepenz/materialdrawer/model/interfaces/IDrawerItem.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.model.interfaces 2 | 3 | import android.content.Context 4 | import android.view.View 5 | import android.view.ViewGroup 6 | import androidx.recyclerview.widget.RecyclerView 7 | import com.mikepenz.fastadapter.* 8 | 9 | /** 10 | * Defines a general [IDrawerItem] to be displayed in the [com.mikepenz.materialdrawer.widget.MaterialDrawerSliderView] 11 | */ 12 | interface IDrawerItem<VH : RecyclerView.ViewHolder> : IItem<VH>, IItemVHFactory<VH>, IItemViewGenerator, IExpandable<VH>, IIdentifyable, Selectable, Tagable { 13 | 14 | override var isEnabled: Boolean 15 | 16 | override var isSelected: Boolean 17 | 18 | override val type: Int 19 | 20 | val layoutRes: Int 21 | 22 | override var identifier: Long 23 | 24 | override var isExpanded: Boolean 25 | 26 | override val isAutoExpanding: Boolean 27 | 28 | override fun generateView(ctx: Context): View 29 | 30 | override fun generateView(ctx: Context, parent: ViewGroup): View 31 | 32 | override fun getViewHolder(parent: ViewGroup): VH 33 | 34 | override fun unbindView(holder: VH) 35 | 36 | override fun bindView(holder: VH, payloads: List<Any>) 37 | 38 | fun equals(id: Long): Boolean 39 | } 40 | 41 | @Deprecated("Please consider to replace with the actual property setter") 42 | fun <T : IDrawerItem<*>> T.withIdentifier(identifier: Long): T { 43 | this.identifier = identifier 44 | return this 45 | } 46 | 47 | @Deprecated("Please consider to replace with the actual property setter") 48 | fun <T : IDrawerItem<*>> T.withEnabled(enabled: Boolean): T { 49 | this.isEnabled = enabled 50 | return this 51 | } 52 | 53 | @Deprecated("Please consider to replace with the actual property setter") 54 | fun <T : IDrawerItem<*>> T.withSelected(selected: Boolean): T { 55 | this.isSelected = selected 56 | return this 57 | } -------------------------------------------------------------------------------- /materialdrawer/src/main/java/com/mikepenz/materialdrawer/model/interfaces/IProfile.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.model.interfaces 2 | 3 | import androidx.annotation.StringRes 4 | import com.mikepenz.fastadapter.IIdentifyable 5 | import com.mikepenz.materialdrawer.holder.StringHolder 6 | 7 | /** 8 | * Defines a general [IProfile] to be displayed in the [com.mikepenz.materialdrawer.widget.MaterialDrawerSliderView] with the [com.mikepenz.materialdrawer.widget.AccountHeaderView] 9 | */ 10 | interface IProfile : IIdentifyable, Nameable, Iconable, Selectable, Tagable, Describable 11 | 12 | @Deprecated("Please consider to replace with the actual property setter") 13 | fun <T : IProfile> T.withEmail(@StringRes emailRes: Int): T { 14 | this.description = StringHolder(emailRes) 15 | return this 16 | } 17 | 18 | @Deprecated("Please consider to replace with the actual property setter") 19 | fun <T : IProfile> T.withEmail(email: String?): T { 20 | this.description = StringHolder(email) 21 | return this 22 | } 23 | -------------------------------------------------------------------------------- /materialdrawer/src/main/java/com/mikepenz/materialdrawer/model/interfaces/Iconable.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.model.interfaces 2 | 3 | import android.content.res.ColorStateList 4 | import android.graphics.Bitmap 5 | import android.graphics.drawable.Drawable 6 | import android.net.Uri 7 | import androidx.annotation.DrawableRes 8 | import com.mikepenz.materialdrawer.holder.ImageHolder 9 | 10 | /** 11 | * Defines a [IDrawerItem] with support for an icon 12 | */ 13 | interface Iconable { 14 | /** the icon to show in the drawer */ 15 | var icon: ImageHolder? 16 | 17 | /** the color of the icon */ 18 | var iconColor: ColorStateList? 19 | } 20 | 21 | @Deprecated("Please consider to replace with the actual property setter") 22 | fun <T : Iconable> T.withIconColor(iconColor: ColorStateList): T { 23 | this.iconColor = iconColor 24 | return this 25 | } 26 | 27 | var <T : Iconable> T.iconDrawable: Drawable? 28 | @Deprecated(level = DeprecationLevel.ERROR, message = "Not readable") 29 | get() = throw UnsupportedOperationException("Please use the direct property") 30 | set(value) { 31 | if (value != null) { 32 | this.icon = ImageHolder(value) 33 | } else { 34 | this.icon = null 35 | } 36 | } 37 | 38 | var <T : Iconable> T.iconBitmap: Bitmap 39 | @Deprecated(level = DeprecationLevel.ERROR, message = "Not readable") 40 | get() = throw UnsupportedOperationException("Please use the direct property") 41 | set(value) { 42 | this.icon = ImageHolder(value) 43 | } 44 | 45 | var <T : Iconable> T.iconRes: Int 46 | @Deprecated(level = DeprecationLevel.ERROR, message = "Not readable") 47 | get() = throw UnsupportedOperationException("Please use the direct property") 48 | set(@DrawableRes value) { 49 | this.icon = ImageHolder(value) 50 | } 51 | 52 | var <T : Iconable> T.iconUrl: String 53 | @Deprecated(level = DeprecationLevel.ERROR, message = "Not readable") 54 | get() = throw UnsupportedOperationException("Please use the direct property") 55 | set(value) { 56 | this.icon = ImageHolder(value) 57 | } 58 | 59 | @Deprecated("Please consider to replace with the actual property setter") 60 | fun <T : Iconable> T.withIcon(icon: Drawable?): T { 61 | this.icon = ImageHolder(icon) 62 | return this 63 | } 64 | 65 | @Deprecated("Please consider to replace with the actual property setter") 66 | fun <T : Iconable> T.withIcon(icon: Bitmap): T { 67 | this.icon = ImageHolder(icon) 68 | return this 69 | } 70 | 71 | @Deprecated("Please consider to replace with the actual property setter") 72 | fun <T : Iconable> T.withIcon(@DrawableRes imageRes: Int): T { 73 | this.icon = ImageHolder(imageRes) 74 | return this 75 | } 76 | 77 | @Deprecated("Please consider to replace with the actual property setter") 78 | fun <T : Iconable> T.withIcon(url: String): T { 79 | this.icon = ImageHolder(url) 80 | return this 81 | } 82 | 83 | @Deprecated("Please consider to replace with the actual property setter") 84 | fun <T : Iconable> T.withIcon(uri: Uri): T { 85 | this.icon = ImageHolder(uri) 86 | return this 87 | } 88 | 89 | @Deprecated("Please consider to replace with the actual property setter") 90 | fun <T : Iconable> T.withIcon(icon: ImageHolder?): T { 91 | this.icon = icon 92 | return this 93 | } 94 | -------------------------------------------------------------------------------- /materialdrawer/src/main/java/com/mikepenz/materialdrawer/model/interfaces/Nameable.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.model.interfaces 2 | 3 | import androidx.annotation.StringRes 4 | import com.mikepenz.materialdrawer.holder.StringHolder 5 | 6 | /** 7 | * Defines a [IDrawerItem] with support for defining a name 8 | */ 9 | interface Nameable { 10 | /** the name to show for the item */ 11 | var name: StringHolder? 12 | } 13 | 14 | @Deprecated("Please consider to replace with the actual property setter") 15 | fun <T : Nameable> T.withName(name: String?): T { 16 | this.name = StringHolder(name) 17 | return this 18 | } 19 | 20 | @Deprecated("Please consider to replace with the actual property setter") 21 | fun <T : Nameable> T.withName(@StringRes name: Int): T { 22 | this.name = StringHolder(name) 23 | return this 24 | } 25 | 26 | @Deprecated("Please consider to replace with the actual property setter") 27 | fun <T : Nameable> T.withName(name: StringHolder?): T { 28 | this.name = name 29 | return this 30 | } 31 | 32 | /** Set the name */ 33 | var Nameable.nameRes: Int 34 | @Deprecated(level = DeprecationLevel.ERROR, message = "Not readable") 35 | get() = throw UnsupportedOperationException("Please use the direct property") 36 | set(value) { 37 | name = StringHolder(value) 38 | } 39 | 40 | /** Set the name */ 41 | var Nameable.nameText: CharSequence 42 | @Deprecated(level = DeprecationLevel.ERROR, message = "Not readable") 43 | get() = throw UnsupportedOperationException("Please use the direct property") 44 | set(value) { 45 | name = StringHolder(value) 46 | } 47 | -------------------------------------------------------------------------------- /materialdrawer/src/main/java/com/mikepenz/materialdrawer/model/interfaces/NameableColor.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.model.interfaces 2 | 3 | import android.content.res.ColorStateList 4 | import androidx.annotation.ColorInt 5 | import androidx.annotation.ColorRes 6 | 7 | /** 8 | * Defines a [IDrawerItem] with support for defining a name 9 | */ 10 | interface NameableColor { 11 | /** defines the color for the text */ 12 | var textColor: ColorStateList? 13 | } 14 | 15 | /** 16 | * Set the selected text color as color resource. 17 | * 18 | * This method is deprecated and no-op. 19 | * 20 | * @deprecated 21 | */ 22 | var NameableColor.textColorRes: Int 23 | @Deprecated(level = DeprecationLevel.ERROR, message = "Not readable") 24 | get() = throw UnsupportedOperationException("Please use the direct property") 25 | @Deprecated( 26 | "Please use `textColor` directly, as [ColorStateList] can't be resolved without [Context].", 27 | level = DeprecationLevel.WARNING, 28 | replaceWith = ReplaceWith("descriptionTextColor") 29 | ) 30 | set(@ColorRes value) { 31 | // no-op 32 | } 33 | 34 | /** Set the selected text color as color int */ 35 | var NameableColor.textColorInt: Int 36 | @Deprecated(level = DeprecationLevel.ERROR, message = "Not readable") 37 | get() = throw UnsupportedOperationException("Please use the direct property") 38 | set(@ColorInt value) { 39 | textColor = ColorStateList.valueOf(value) 40 | } 41 | -------------------------------------------------------------------------------- /materialdrawer/src/main/java/com/mikepenz/materialdrawer/model/interfaces/SelectIconable.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.model.interfaces 2 | 3 | import android.graphics.Bitmap 4 | import android.graphics.drawable.Drawable 5 | import androidx.annotation.DrawableRes 6 | import com.mikepenz.materialdrawer.holder.ImageHolder 7 | 8 | /** 9 | * Defines a [IDrawerItem] with support for an icon 10 | */ 11 | interface SelectIconable { 12 | /** the icon to show when this item gets selected */ 13 | var selectedIcon: ImageHolder? 14 | 15 | /** defines if the icon should get proper tinting with the defined color */ 16 | var isIconTinted: Boolean 17 | } 18 | 19 | var <T : Iconable> T.selectedIconDrawable: Drawable 20 | @Deprecated(level = DeprecationLevel.ERROR, message = "Not readable") 21 | get() = throw UnsupportedOperationException("Please use the direct property") 22 | set(value) { 23 | this.icon = ImageHolder(value) 24 | } 25 | 26 | var <T : Iconable> T.selectedIconBitmap: Bitmap 27 | @Deprecated(level = DeprecationLevel.ERROR, message = "Not readable") 28 | get() = throw UnsupportedOperationException("Please use the direct property") 29 | set(value) { 30 | this.icon = ImageHolder(value) 31 | } 32 | 33 | var <T : Iconable> T.selectedIconRes: Int 34 | @Deprecated(level = DeprecationLevel.ERROR, message = "Not readable") 35 | get() = throw UnsupportedOperationException("Please use the direct property") 36 | set(@DrawableRes value) { 37 | this.icon = ImageHolder(value) 38 | } 39 | 40 | var <T : Iconable> T.selectedIconUrl: String 41 | @Deprecated(level = DeprecationLevel.ERROR, message = "Not readable") 42 | get() = throw UnsupportedOperationException("Please use the direct property") 43 | set(value) { 44 | this.icon = ImageHolder(value) 45 | } 46 | 47 | @Deprecated("Please consider to replace with the actual property setter") 48 | fun <T : SelectIconable> T.withSelectedIcon(selectedIcon: Drawable): T { 49 | this.selectedIcon = ImageHolder(selectedIcon) 50 | return this as T 51 | } 52 | 53 | @Deprecated("Please consider to replace with the actual property setter") 54 | fun <T : SelectIconable> T.withSelectedIcon(@DrawableRes selectedIconRes: Int): T { 55 | this.selectedIcon = ImageHolder(selectedIconRes) 56 | return this as T 57 | } 58 | 59 | /** will tint the icon with the default (or set) colors (default and selected state) */ 60 | @Deprecated("Please consider to replace with the actual property setter") 61 | fun <T : SelectIconable> T.withIconTintingEnabled(iconTintingEnabled: Boolean): T { 62 | this.isIconTinted = iconTintingEnabled 63 | return this as T 64 | } 65 | 66 | /** will tint the icon with the default (or set) colors (default and selected state) */ 67 | @Deprecated("Please consider to replace with the actual property setter") 68 | fun <T : SelectIconable> T.withIconTinted(iconTintingEnabled: Boolean): T { 69 | this.isIconTinted = iconTintingEnabled 70 | return this as T 71 | } -------------------------------------------------------------------------------- /materialdrawer/src/main/java/com/mikepenz/materialdrawer/model/interfaces/Selectable.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.model.interfaces 2 | 3 | /** 4 | * Defines a [IDrawerItem] with support for being selected 5 | */ 6 | interface Selectable { 7 | /** If the item is selectable */ 8 | var isSelectable: Boolean 9 | } 10 | 11 | @Deprecated("Please consider to replace with the actual property setter") 12 | fun <T : Selectable> T.withSelectable(selectable: Boolean): T { 13 | this.isSelectable = selectable 14 | return this 15 | } 16 | -------------------------------------------------------------------------------- /materialdrawer/src/main/java/com/mikepenz/materialdrawer/model/interfaces/SelectableColor.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.model.interfaces 2 | 3 | import androidx.annotation.ColorInt 4 | import androidx.annotation.ColorRes 5 | import com.mikepenz.materialdrawer.holder.ColorHolder 6 | 7 | /** 8 | * Defines a [IDrawerItem] with support for having a different color when selected 9 | */ 10 | interface SelectableColor { 11 | /** The background color of a selectable item */ 12 | var selectedColor: ColorHolder? 13 | } 14 | 15 | 16 | @Deprecated("Please consider to replace with the actual property setter") 17 | fun <T : SelectableColor> T.withSelectedColor(@ColorInt selectedColor: Int): T { 18 | this.selectedColor = ColorHolder.fromColor(selectedColor) 19 | return this 20 | } 21 | 22 | @Deprecated("Please consider to replace with the actual property setter") 23 | fun <T : SelectableColor> T.withSelectedColorRes(@ColorRes selectedColorRes: Int): T { 24 | this.selectedColor = ColorHolder.fromColorRes(selectedColorRes) 25 | return this 26 | } 27 | 28 | /** Set the selected color as color resource */ 29 | var SelectableColor.selectedColorRes: Int 30 | @Deprecated(level = DeprecationLevel.ERROR, message = "Not readable") 31 | get() = throw UnsupportedOperationException("Please use the direct property") 32 | set(@ColorRes value) { 33 | selectedColor = ColorHolder.fromColorRes(value) 34 | } 35 | 36 | /** Set the selected color as color int */ 37 | var SelectableColor.selectedColorInt: Int 38 | @Deprecated(level = DeprecationLevel.ERROR, message = "Not readable") 39 | get() = throw UnsupportedOperationException("Please use the direct property") 40 | set(@ColorInt value) { 41 | selectedColor = ColorHolder.fromColor(value) 42 | } 43 | -------------------------------------------------------------------------------- /materialdrawer/src/main/java/com/mikepenz/materialdrawer/model/interfaces/Tagable.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.model.interfaces 2 | 3 | /** 4 | * Defines a [IDrawerItem] with support for being tagged 5 | */ 6 | interface Tagable { 7 | /** specify a tag attached to the item to use for different situations */ 8 | var tag: Any? 9 | } 10 | 11 | @Deprecated("Please consider to replace with the actual property setter") 12 | fun <T : Tagable> T.withTag(tag: Any?): T { 13 | this.tag = tag 14 | return this 15 | } -------------------------------------------------------------------------------- /materialdrawer/src/main/java/com/mikepenz/materialdrawer/model/interfaces/Typefaceable.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.model.interfaces 2 | 3 | import android.graphics.Typeface 4 | 5 | /** 6 | * Defines a [IDrawerItem] with support for defining the [Typeface] 7 | */ 8 | interface Typefaceable { 9 | /** the typeface used for texts */ 10 | var typeface: Typeface? 11 | } 12 | 13 | @Deprecated("Please consider to replace with the actual property setter") 14 | fun <T : Typefaceable> T.withTypeface(typeface: Typeface?): T { 15 | this.typeface = typeface 16 | return this 17 | } 18 | -------------------------------------------------------------------------------- /materialdrawer/src/main/java/com/mikepenz/materialdrawer/model/utils/BadgeDrawableBuilder.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.model.utils 2 | 3 | import android.content.Context 4 | import android.graphics.drawable.GradientDrawable 5 | import android.graphics.drawable.StateListDrawable 6 | import android.util.StateSet 7 | import androidx.appcompat.content.res.AppCompatResources 8 | import com.mikepenz.materialdrawer.holder.BadgeStyle 9 | import com.mikepenz.materialdrawer.holder.ColorHolder 10 | 11 | /** 12 | * Builder to construct the [StateListDrawable] given a [BadgeStyle] 13 | */ 14 | class BadgeDrawableBuilder(private val style: BadgeStyle) { 15 | 16 | /** creates the [StateListDrawable] given the provided [BadgeStyle] */ 17 | fun build(ctx: Context): StateListDrawable { 18 | val stateListDrawable = StateListDrawable() 19 | val normal = AppCompatResources.getDrawable(ctx, style.gradientDrawable) as GradientDrawable? 20 | val selected = normal?.constantState?.newDrawable()?.mutate() as GradientDrawable? 21 | 22 | ColorHolder.applyToOrTransparent(style.color, ctx, normal) 23 | if (style.colorPressed == null) { 24 | ColorHolder.applyToOrTransparent(style.color, ctx, selected) 25 | } else { 26 | ColorHolder.applyToOrTransparent(style.colorPressed, ctx, selected) 27 | } 28 | 29 | style.corners?.let { 30 | normal?.cornerRadius = it.asPixel(ctx).toFloat() 31 | selected?.cornerRadius = it.asPixel(ctx).toFloat() 32 | } 33 | 34 | stateListDrawable.addState(intArrayOf(android.R.attr.state_pressed), selected) 35 | stateListDrawable.addState(StateSet.WILD_CARD, normal) 36 | 37 | return stateListDrawable 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /materialdrawer/src/main/java/com/mikepenz/materialdrawer/model/utils/DrawerItemExtensions.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.model.utils 2 | 3 | import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem 4 | 5 | /** Define tags associated to specific tag items */ 6 | private val drawerItemTags = mutableMapOf<Any, Any>() 7 | 8 | /** Define if this IDrawerItem should / can be shown inside the MiniDrawer */ 9 | var <T : IDrawerItem<*>> T.hiddenInMiniDrawer: Boolean 10 | get() = drawerItemTags[this] as? Boolean == true 11 | set(value) { 12 | drawerItemTags[this] = value 13 | } 14 | 15 | @Deprecated("Please consider to replace with the actual property setter") 16 | fun <T : IDrawerItem<*>> T.withIsHiddenInMiniDrawer(hidden: Boolean): T { 17 | hiddenInMiniDrawer = hidden 18 | return this 19 | } 20 | -------------------------------------------------------------------------------- /materialdrawer/src/main/java/com/mikepenz/materialdrawer/util/AbstractDrawerImageLoader.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.util 2 | 3 | import android.content.Context 4 | import android.graphics.drawable.Drawable 5 | import android.net.Uri 6 | import android.util.Log 7 | import android.widget.ImageView 8 | 9 | /** 10 | * This abstract class provides functionality to add custom image loader implementations, based on the image loader used in the app. 11 | */ 12 | abstract class AbstractDrawerImageLoader : DrawerImageLoader.IDrawerImageLoader { 13 | /** 14 | * Start loading the image [uri] for the given [imageView] providing the [placeholder], allowing to identify the location it is gonna be used via the [tag] 15 | */ 16 | override fun set(imageView: ImageView, uri: Uri, placeholder: Drawable, tag: String?) { 17 | //this won't do anything 18 | Log.i("MaterialDrawer", "You have not specified a ImageLoader implementation through the DrawerImageLoader.init() method, or you are still overriding the deprecated method set(ImageView iv, Uri u, Drawable d) instead of set(ImageView iv, Uri u, Drawable d, String tag)") 19 | } 20 | 21 | /** 22 | * Cancel loading images for the imageView 23 | */ 24 | override fun cancel(imageView: ImageView) {} 25 | 26 | /** 27 | * Retrieve the placeholder to display 28 | */ 29 | override fun placeholder(ctx: Context): Drawable { 30 | return getPlaceHolder(ctx) 31 | } 32 | 33 | /** 34 | * Retrieve the placeholder to display, using the [tag] to identify the location it is gonna be used 35 | */ 36 | override fun placeholder(ctx: Context, tag: String?): Drawable { 37 | return placeholder(ctx) 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /materialdrawer/src/main/java/com/mikepenz/materialdrawer/util/DrawerImageLoader.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.util 2 | 3 | import android.content.Context 4 | import android.graphics.drawable.Drawable 5 | import android.net.Uri 6 | import android.widget.ImageView 7 | import com.mikepenz.materialdrawer.util.DrawerImageLoader.IDrawerImageLoader 8 | 9 | /** 10 | * The general management class for the [IDrawerImageLoader] support, to offer support for any image loading library. 11 | */ 12 | open class DrawerImageLoader private constructor(var imageLoader: IDrawerImageLoader?) { 13 | 14 | /** 15 | * defines if we accept any protocol 16 | */ 17 | var handleAllProtocols = false 18 | 19 | /** 20 | * supported protocols 21 | */ 22 | var handledProtocols = listOf<String?>("http", "https") 23 | 24 | /** 25 | * The possible tags we currently support. 26 | */ 27 | enum class Tags { 28 | PRIMARY_ITEM, 29 | MINI_ITEM, 30 | PROFILE, 31 | PROFILE_DRAWER_ITEM, 32 | ACCOUNT_HEADER 33 | } 34 | 35 | /** 36 | * @param imageView 37 | * @param uri 38 | * @param tag 39 | * @return false if not consumed 40 | */ 41 | open fun setImage(imageView: ImageView, uri: Uri, tag: String?): Boolean { 42 | // If we do not handle this protocol we keep the original behavior 43 | return if (handleAllProtocols || uri.scheme in handledProtocols) { 44 | imageLoader?.let { 45 | val placeHolder = it.placeholder(imageView.context, tag) 46 | it[imageView, uri, placeHolder] = tag 47 | } 48 | true 49 | } else false 50 | } 51 | 52 | /** 53 | * Cancel loading for the given [ImageView] 54 | */ 55 | fun cancelImage(imageView: ImageView) { 56 | imageLoader?.cancel(imageView) 57 | } 58 | 59 | interface IDrawerImageLoader { 60 | /** 61 | * Start loading the image [uri] for the given [imageView] providing the [placeholder], allowing to identify the location it is gonna be used via the [tag] 62 | */ 63 | operator fun set(imageView: ImageView, uri: Uri, placeholder: Drawable, tag: String?) 64 | 65 | /** 66 | * Cancel loading images for the imageView 67 | */ 68 | fun cancel(imageView: ImageView) 69 | 70 | @Deprecated("Please use the placeholder method with the provided tag instead") 71 | fun placeholder(ctx: Context): Drawable 72 | 73 | /** 74 | * Retrieve the placeholder to display, using the [tag] to identify the location it is gonna be used 75 | */ 76 | fun placeholder(ctx: Context, tag: String?): Drawable 77 | } 78 | 79 | companion object { 80 | 81 | private var SINGLETON: DrawerImageLoader? = null 82 | 83 | fun init(loaderImpl: IDrawerImageLoader): DrawerImageLoader { 84 | SINGLETON = DrawerImageLoader(loaderImpl) 85 | return SINGLETON as DrawerImageLoader 86 | } 87 | 88 | val instance: DrawerImageLoader 89 | get() { 90 | if (SINGLETON == null) { 91 | SINGLETON = DrawerImageLoader(object : AbstractDrawerImageLoader() {}) 92 | } 93 | return SINGLETON as DrawerImageLoader 94 | } 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /materialdrawer/src/main/java/com/mikepenz/materialdrawer/util/DrawerItemViewHelper.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.util 2 | 3 | import android.content.Context 4 | import android.view.View 5 | import android.view.ViewGroup 6 | import android.widget.LinearLayout 7 | import com.mikepenz.materialdrawer.R 8 | import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem 9 | import java.util.* 10 | 11 | /** 12 | * Custom helper class allowing to construct a view hierarchy just by using [IDrawerItem]s 13 | */ 14 | open class DrawerItemViewHelper(private val context: Context) { 15 | 16 | val drawerItems = ArrayList<IDrawerItem<*>>() 17 | var divider = true 18 | var onDrawerItemClickListener: ((View, IDrawerItem<*>) -> Unit)? = null 19 | 20 | fun build(): View { 21 | //create the container view 22 | val linearLayout = LinearLayout(context) 23 | linearLayout.layoutParams = LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) 24 | linearLayout.orientation = LinearLayout.VERTICAL 25 | 26 | //create the divider 27 | if (divider) { 28 | val divider = LinearLayout(context) 29 | divider.layoutParams = LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) 30 | divider.minimumHeight = context.resources.getDimensionPixelSize(R.dimen.material_drawer_sticky_footer_divider) 31 | divider.orientation = LinearLayout.VERTICAL 32 | divider.setBackgroundColor(context.getDividerColor()) 33 | linearLayout.addView(divider) 34 | } 35 | 36 | //add all drawer items 37 | for (drawerItem in drawerItems) { 38 | val view = drawerItem.generateView(context) 39 | view.tag = drawerItem 40 | 41 | if (drawerItem.isEnabled) { 42 | view.setBackgroundResource(context.getSelectableBackgroundRes()) 43 | view.setOnClickListener { v -> 44 | onDrawerItemClickListener?.invoke(v, v.getTag(R.id.material_drawer_item) as IDrawerItem<*>) 45 | } 46 | } 47 | 48 | linearLayout.addView(view) 49 | } 50 | 51 | return linearLayout 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /materialdrawer/src/main/java/com/mikepenz/materialdrawer/util/FixStateListDrawable.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.util 2 | 3 | import android.R 4 | import android.annotation.SuppressLint 5 | import android.content.res.ColorStateList 6 | import android.graphics.PorterDuff 7 | import android.graphics.drawable.Drawable 8 | import android.graphics.drawable.StateListDrawable 9 | 10 | /** 11 | * http://stackoverflow.com/questions/7979440/android-cloning-a-drawable-in-order-to-make-a-statelistdrawable-with-filters 12 | * http://stackoverflow.com/users/2075875/malachiasz 13 | */ 14 | @SuppressLint("InlinedApi") 15 | class FixStateListDrawable : StateListDrawable { 16 | var color: ColorStateList? 17 | 18 | constructor(drawable: Drawable, color: ColorStateList?) : super() { 19 | var drawable = drawable 20 | drawable = drawable.mutate() 21 | addState(intArrayOf(R.attr.state_selected), drawable) 22 | addState(intArrayOf(), drawable) 23 | this.color = color 24 | } 25 | 26 | constructor(drawable: Drawable, selectedDrawable: Drawable, color: ColorStateList?) : super() { 27 | var drawable = drawable 28 | var selectedDrawable = selectedDrawable 29 | drawable = drawable.mutate() 30 | selectedDrawable = selectedDrawable.mutate() 31 | addState(intArrayOf(R.attr.state_selected), selectedDrawable) 32 | addState(intArrayOf(), drawable) 33 | this.color = color 34 | } 35 | 36 | override fun onStateChange(states: IntArray): Boolean { 37 | val color = color 38 | if (color != null) { 39 | super.setColorFilter(color.getColorForState(states, color.defaultColor), PorterDuff.Mode.SRC_IN) 40 | } 41 | return super.onStateChange(states) 42 | } 43 | 44 | override fun isStateful(): Boolean { 45 | return true 46 | } 47 | } -------------------------------------------------------------------------------- /materialdrawer/src/main/java/com/mikepenz/materialdrawer/util/MenuDrawerUtils.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.materialdrawer.util 2 | 3 | import android.annotation.SuppressLint 4 | import android.view.Menu 5 | import androidx.annotation.MenuRes 6 | import androidx.appcompat.view.SupportMenuInflater 7 | import androidx.appcompat.view.menu.MenuBuilder 8 | import com.mikepenz.materialdrawer.R 9 | import com.mikepenz.materialdrawer.model.DividerDrawerItem 10 | import com.mikepenz.materialdrawer.model.PrimaryDrawerItem 11 | import com.mikepenz.materialdrawer.model.SecondaryDrawerItem 12 | import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem 13 | import com.mikepenz.materialdrawer.model.interfaces.iconDrawable 14 | import com.mikepenz.materialdrawer.model.interfaces.nameText 15 | import com.mikepenz.materialdrawer.widget.MaterialDrawerSliderView 16 | 17 | /** 18 | * Inflates the DrawerItems from a menu.xml 19 | */ 20 | @SuppressLint("RestrictedApi") 21 | fun MaterialDrawerSliderView.inflateMenu(@MenuRes menuRes: Int) { 22 | val menuInflater = SupportMenuInflater(context) 23 | val mMenu = MenuBuilder(context) 24 | 25 | menuInflater.inflate(menuRes, mMenu) 26 | 27 | addMenuItems(mMenu, false) 28 | } 29 | 30 | /** 31 | * helper method to init the drawerItems from a menu 32 | */ 33 | private fun MaterialDrawerSliderView.addMenuItems(mMenu: Menu?, subMenu: Boolean) { 34 | mMenu ?: return 35 | var groupId = R.id.material_drawer_menu_default_group 36 | for (i in 0 until mMenu.size()) { 37 | val mMenuItem = mMenu.getItem(i) 38 | var iDrawerItem: IDrawerItem<*> 39 | if (!subMenu && mMenuItem.groupId != groupId && mMenuItem.groupId != 0) { 40 | groupId = mMenuItem.groupId 41 | iDrawerItem = DividerDrawerItem() 42 | itemAdapter.add(iDrawerItem) 43 | } 44 | if (mMenuItem.hasSubMenu()) { 45 | iDrawerItem = PrimaryDrawerItem().apply { 46 | nameText = mMenuItem.title ?: "" 47 | iconDrawable = mMenuItem.icon 48 | identifier = mMenuItem.itemId.toLong() 49 | isEnabled = mMenuItem.isEnabled 50 | isSelectable = false 51 | } 52 | itemAdapter.add(iDrawerItem) 53 | addMenuItems(mMenuItem.subMenu, true) 54 | } else if (mMenuItem.groupId != 0 || subMenu) { 55 | iDrawerItem = SecondaryDrawerItem().apply { 56 | nameText = mMenuItem.title ?: "" 57 | iconDrawable = mMenuItem.icon 58 | identifier = mMenuItem.itemId.toLong() 59 | isEnabled = mMenuItem.isEnabled 60 | } 61 | itemAdapter.add(iDrawerItem) 62 | } else { 63 | iDrawerItem = PrimaryDrawerItem().apply { 64 | nameText = mMenuItem.title ?: "" 65 | iconDrawable = mMenuItem.icon 66 | identifier = mMenuItem.itemId.toLong() 67 | isEnabled = mMenuItem.isEnabled 68 | } 69 | itemAdapter.add(iDrawerItem) 70 | } 71 | } 72 | } -------------------------------------------------------------------------------- /materialdrawer/src/main/res/color/color_drawer_item_text.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <selector xmlns:android="http://schemas.android.com/apk/res/android"> 3 | <item android:color="?colorOnSecondaryContainer" android:state_selected="true" /> 4 | <item android:color="?colorOnSurfaceVariant" /> 5 | </selector> -------------------------------------------------------------------------------- /materialdrawer/src/main/res/drawable-v21/material_drawer_ico_account.xml: -------------------------------------------------------------------------------- 1 | <!-- drawable/account.xml --> 2 | <vector xmlns:android="http://schemas.android.com/apk/res/android" 3 | android:width="24dp" 4 | android:height="24dp" 5 | android:viewportWidth="24" 6 | android:viewportHeight="24"> 7 | <path 8 | android:fillColor="#000" 9 | android:pathData="M12,4A4,4 0 0,1 16,8A4,4 0 0,1 12,12A4,4 0 0,1 8,8A4,4 0 0,1 12,4M12,14C16.42,14 20,15.79 20,18V20H4V18C4,15.79 7.58,14 12,14Z" /> 10 | </vector> -------------------------------------------------------------------------------- /materialdrawer/src/main/res/drawable/material_drawer_badge.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <shape xmlns:android="http://schemas.android.com/apk/res/android"> 3 | <corners android:radius="5dp" /> 4 | <solid android:color="@android:color/black" /> 5 | </shape> -------------------------------------------------------------------------------- /materialdrawer/src/main/res/drawable/material_drawer_circle_mask.xml: -------------------------------------------------------------------------------- 1 | <!-- 2 | Copyright 2014 Google Inc. All rights reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | --> 16 | 17 | <shape xmlns:android="http://schemas.android.com/apk/res/android" 18 | android:shape="oval"> 19 | <solid android:color="#000" /> 20 | </shape> -------------------------------------------------------------------------------- /materialdrawer/src/main/res/drawable/material_drawer_ico_account.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/materialdrawer/src/main/res/drawable/material_drawer_ico_account.png -------------------------------------------------------------------------------- /materialdrawer/src/main/res/drawable/material_drawer_ico_account_layer.xml: -------------------------------------------------------------------------------- 1 | <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> 2 | <item android:id="@+id/background"> 3 | <shape android:shape="rectangle"> 4 | <solid android:color="#000" /> 5 | </shape> 6 | </item> 7 | <item 8 | android:id="@+id/account" 9 | android:drawable="@drawable/material_drawer_ico_account" 10 | android:gravity="center" /> 11 | </layer-list> -------------------------------------------------------------------------------- /materialdrawer/src/main/res/drawable/material_drawer_ico_chevron_down.xml: -------------------------------------------------------------------------------- 1 | <!-- drawable/chevron_down.xml --> 2 | <vector xmlns:android="http://schemas.android.com/apk/res/android" 3 | android:width="24dp" 4 | android:height="24dp" 5 | android:viewportWidth="24" 6 | android:viewportHeight="24"> 7 | <group 8 | android:pivotX="12" 9 | android:pivotY="12" 10 | android:scaleX="1.5" 11 | android:scaleY="1.5"> 12 | <path 13 | android:fillColor="#000" 14 | android:pathData="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z" /> 15 | </group> 16 | </vector> -------------------------------------------------------------------------------- /materialdrawer/src/main/res/drawable/material_drawer_ico_menu_down.xml: -------------------------------------------------------------------------------- 1 | <!-- drawable/menu_down.xml --> 2 | <vector xmlns:android="http://schemas.android.com/apk/res/android" 3 | android:width="24dp" 4 | android:height="24dp" 5 | android:viewportWidth="24" 6 | android:viewportHeight="24"> 7 | 8 | <group 9 | android:pivotX="12" 10 | android:pivotY="12" 11 | android:scaleX="1.5" 12 | android:scaleY="1.5"> 13 | <path 14 | android:fillColor="#000" 15 | android:pathData="M7,10L12,15L17,10H7Z" /> 16 | </group> 17 | </vector> -------------------------------------------------------------------------------- /materialdrawer/src/main/res/drawable/material_drawer_rectangle_mask.xml: -------------------------------------------------------------------------------- 1 | <shape xmlns:android="http://schemas.android.com/apk/res/android" 2 | android:shape="rectangle"> 3 | <solid android:color="#000" /> 4 | </shape> -------------------------------------------------------------------------------- /materialdrawer/src/main/res/drawable/material_drawer_shadow_bottom.xml: -------------------------------------------------------------------------------- 1 | <shape xmlns:android="http://schemas.android.com/apk/res/android" 2 | android:shape="rectangle"> 3 | <gradient 4 | android:angle="90" 5 | android:endColor="#40000000" 6 | android:startColor="@android:color/transparent" /> 7 | </shape> -------------------------------------------------------------------------------- /materialdrawer/src/main/res/drawable/material_drawer_shadow_left.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/materialdrawer/src/main/res/drawable/material_drawer_shadow_left.9.png -------------------------------------------------------------------------------- /materialdrawer/src/main/res/drawable/material_drawer_shadow_right.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/MaterialDrawer/8ea711404d90b5cb6bc851530292c3c54d68aa8d/materialdrawer/src/main/res/drawable/material_drawer_shadow_right.9.png -------------------------------------------------------------------------------- /materialdrawer/src/main/res/drawable/material_drawer_shadow_top.xml: -------------------------------------------------------------------------------- 1 | <shape xmlns:android="http://schemas.android.com/apk/res/android" 2 | android:shape="rectangle"> 3 | <gradient 4 | android:angle="270" 5 | android:endColor="#40000000" 6 | android:startColor="@android:color/transparent" /> 7 | </shape> -------------------------------------------------------------------------------- /materialdrawer/src/main/res/layout/material_drawer.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 | android:id="@+id/material_drawer_layout" 4 | android:layout_width="match_parent" 5 | android:layout_height="match_parent" 6 | android:fitsSystemWindows="true" /> -------------------------------------------------------------------------------- /materialdrawer/src/main/res/layout/material_drawer_fits_not.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 | android:id="@+id/material_drawer_layout" 4 | android:layout_width="match_parent" 5 | android:layout_height="match_parent" 6 | android:clickable="true" 7 | android:focusable="true" /> -------------------------------------------------------------------------------- /materialdrawer/src/main/res/layout/material_drawer_inner_shadow.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <View xmlns:android="http://schemas.android.com/apk/res/android" 3 | android:id="@+id/material_drawer_inner_shadow" 4 | android:layout_width="wrap_content" 5 | android:layout_height="match_parent" 6 | android:layout_alignParentStart="false" 7 | android:layout_alignParentLeft="false" 8 | android:layout_alignParentEnd="true" 9 | android:layout_alignParentRight="true" 10 | android:background="@drawable/material_drawer_shadow_left" 11 | android:visibility="gone" /> -------------------------------------------------------------------------------- /materialdrawer/src/main/res/layout/material_drawer_item_container.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 | android:layout_width="match_parent" 4 | android:layout_height="wrap_content" 5 | android:orientation="vertical"> 6 | 7 | </LinearLayout> 8 | -------------------------------------------------------------------------------- /materialdrawer/src/main/res/layout/material_drawer_item_divider.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <View xmlns:android="http://schemas.android.com/apk/res/android" 3 | android:id="@+id/material_drawer_divider" 4 | android:layout_width="match_parent" 5 | android:layout_height="1dp" 6 | android:layout_marginLeft="@dimen/material_drawer_vertical_item_padding" 7 | android:layout_marginTop="@dimen/material_drawer_padding" 8 | android:layout_marginRight="@dimen/material_drawer_vertical_item_padding" 9 | android:layout_marginBottom="@dimen/material_drawer_padding" /> 10 | -------------------------------------------------------------------------------- /materialdrawer/src/main/res/layout/material_drawer_item_mini.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 | xmlns:tools="http://schemas.android.com/tools" 4 | android:layout_width="@dimen/material_mini_drawer_item" 5 | android:layout_height="@dimen/material_mini_drawer_item" 6 | android:paddingBottom="@dimen/material_mini_drawer_item_padding" 7 | android:paddingEnd="@dimen/material_mini_drawer_item_padding_sides" 8 | android:paddingLeft="@dimen/material_mini_drawer_item_padding_sides" 9 | android:paddingRight="@dimen/material_mini_drawer_item_padding_sides" 10 | android:paddingStart="@dimen/material_mini_drawer_item_padding_sides" 11 | android:paddingTop="@dimen/material_mini_drawer_item_padding"> 12 | 13 | <androidx.appcompat.widget.AppCompatImageView 14 | android:id="@+id/material_drawer_icon" 15 | android:layout_width="@dimen/material_mini_drawer_item_icon" 16 | android:layout_height="@dimen/material_mini_drawer_item_icon" 17 | android:layout_gravity="center" 18 | android:padding="@dimen/material_mini_drawer_item_icon_padding" 19 | android:scaleType="fitXY" /> 20 | 21 | <androidx.appcompat.widget.AppCompatTextView 22 | android:id="@+id/material_drawer_badge" 23 | android:layout_width="wrap_content" 24 | android:layout_height="wrap_content" 25 | android:layout_gravity="top|end" 26 | android:fontFamily="sans-serif" 27 | android:gravity="center" 28 | android:lines="1" 29 | android:maxLines="1" 30 | android:padding="1dp" 31 | android:paddingLeft="1dp" 32 | android:paddingRight="1dp" 33 | android:textSize="@dimen/material_drawer_item_badge_text" 34 | tools:text="99" /> 35 | </FrameLayout> -------------------------------------------------------------------------------- /materialdrawer/src/main/res/layout/material_drawer_item_mini_profile.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 | android:layout_width="@dimen/material_mini_drawer_item" 4 | android:layout_height="@dimen/material_mini_drawer_item"> 5 | 6 | <com.mikepenz.materialdrawer.view.BezelImageView 7 | android:id="@+id/material_drawer_icon" 8 | style="@style/BezelImageView" 9 | android:layout_width="@dimen/material_mini_drawer_item_profile_icon" 10 | android:layout_height="@dimen/material_mini_drawer_item_profile_icon" 11 | android:layout_gravity="center_vertical" 12 | android:layout_marginStart="@dimen/material_mini_drawer_item_profile_icon_padding" 13 | android:layout_marginLeft="@dimen/material_mini_drawer_item_profile_icon_padding" 14 | android:layout_marginTop="@dimen/material_mini_drawer_item_profile_icon_padding" 15 | android:layout_marginEnd="@dimen/material_mini_drawer_item_profile_icon_padding" 16 | android:layout_marginRight="@dimen/material_mini_drawer_item_profile_icon_padding" 17 | android:layout_marginBottom="@dimen/material_mini_drawer_item_profile_icon_padding" 18 | android:clickable="false" 19 | android:elevation="1dp" /> 20 | </LinearLayout> -------------------------------------------------------------------------------- /materialdrawer/src/main/res/layout/material_drawer_item_section.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 | android:layout_width="match_parent" 4 | android:layout_height="wrap_content" 5 | android:orientation="vertical"> 6 | 7 | <View 8 | android:id="@+id/material_drawer_divider" 9 | android:layout_width="match_parent" 10 | android:layout_height="1dp" 11 | android:layout_marginTop="@dimen/material_drawer_padding" 12 | android:layout_marginLeft="@dimen/material_drawer_vertical_item_padding" 13 | android:layout_marginRight="@dimen/material_drawer_vertical_item_padding" /> 14 | 15 | <androidx.appcompat.widget.AppCompatTextView 16 | android:id="@+id/material_drawer_name" 17 | android:layout_width="match_parent" 18 | android:layout_height="@dimen/material_drawer_item_primary" 19 | android:fontFamily="sans-serif-medium" 20 | android:gravity="center_vertical|start" 21 | android:lines="1" 22 | android:paddingLeft="@dimen/material_drawer_vertical_item_padding" 23 | android:paddingRight="@dimen/material_drawer_vertical_item_padding" 24 | android:singleLine="true" 25 | android:textSize="@dimen/material_drawer_item_section_text" /> 26 | </LinearLayout> -------------------------------------------------------------------------------- /materialdrawer/src/main/res/layout/material_drawer_recycler_view.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android" 3 | android:id="@+id/material_drawer_recycler_view" 4 | android:layout_width="match_parent" 5 | android:layout_height="match_parent" 6 | android:clickable="true" 7 | android:clipToPadding="false" 8 | android:focusable="true" 9 | android:paddingTop="@dimen/material_drawer_padding_top_bottom" 10 | android:paddingBottom="@dimen/material_drawer_padding_top_bottom" 11 | android:scrollbars="vertical" /> -------------------------------------------------------------------------------- /materialdrawer/src/main/res/values-fr/strings.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <resources> 3 | <string name="material_drawer_open">Ouvrir</string> 4 | <string name="material_drawer_close">Fermer</string> 5 | <string name="material_drawer_profile_content_description">Profile icon</string> 6 | </resources> 7 | -------------------------------------------------------------------------------- /materialdrawer/src/main/res/values-pt/strings.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <resources> 3 | <string name="material_drawer_open">Abrir</string> 4 | <string name="material_drawer_close">Fechar</string> 5 | <string name="material_drawer_profile_content_description">Profile icon</string> 6 | </resources> 7 | -------------------------------------------------------------------------------- /materialdrawer/src/main/res/values-sw600dp/dimens.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <resources> 3 | <dimen name="material_drawer_vertical_padding">24dp</dimen> 4 | </resources> -------------------------------------------------------------------------------- /materialdrawer/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <resources> 3 | <declare-styleable name="MaterialDrawerTheme"> 4 | <attr name="materialDrawerStyle" format="reference" /> 5 | <attr name="materialDrawerHeaderStyle" format="reference" /> 6 | </declare-styleable> 7 | 8 | <declare-styleable name="MaterialDrawerSliderView"> 9 | <attr name="materialDrawerInsetForeground" format="color|reference" /> 10 | 11 | <attr name="materialDrawerBackground" format="color|reference" /> 12 | 13 | <attr name="materialDrawerPrimaryText" format="color|reference" /> 14 | <attr name="materialDrawerPrimaryIcon" format="color|reference" /> 15 | <attr name="materialDrawerSecondaryText" format="color|reference" /> 16 | <attr name="materialDrawerSecondaryIcon" format="color|reference" /> 17 | 18 | <attr name="materialDrawerDividerColor" format="color|reference" /> 19 | 20 | <attr name="materialDrawerSelectedBackgroundColor" format="color|reference" /> 21 | </declare-styleable> 22 | 23 | <declare-styleable name="AccountHeaderView"> 24 | <attr name="materialDrawerHeaderLayout" format="reference" /> 25 | <attr name="materialDrawerCompactStyle" format="boolean" /> 26 | 27 | <!-- material drawer header attrs--> 28 | <attr name="materialDrawerHeaderSelectionText" format="color|reference" /> 29 | <attr name="materialDrawerHeaderSelectionSubtext" format="color|reference" /> 30 | </declare-styleable> 31 | 32 | <declare-styleable name="BezelImageView"> 33 | <attr name="materialDrawerMaskDrawable" format="reference" /> 34 | <attr name="materialDrawerDrawCircularShadow" format="boolean" /> 35 | <attr name="materialDrawerSelectorOnPress" format="color|reference" /> 36 | </declare-styleable> 37 | </resources> -------------------------------------------------------------------------------- /materialdrawer/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <resources> 3 | <!-- MaterialDrawer DEFAULT text / items colors --> 4 | <color name="material_drawer_divider">#1F000000</color> 5 | <!-- MaterialDrawer DEFAULT drawer colors --> 6 | <color name="material_drawer_selected">#1F2196F3</color> 7 | </resources> 8 | -------------------------------------------------------------------------------- /materialdrawer/src/main/res/values/ids.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | 3 | <resources> 4 | <item name="material_drawer_item" type="id" /> 5 | <item name="material_drawer_menu_default_group" type="id" /> 6 | <item name="material_drawer_sticky_footer" type="id" /> 7 | <item name="material_drawer_sticky_header" type="id" /> 8 | <item name="material_drawer_animation" type="id" /> 9 | <item name="material_drawer_profile_header" type="id" /> 10 | <item name="material_drawer_slider_layout" type="id" /> 11 | 12 | <item name="material_drawer_item_primary" type="id" /> 13 | <item name="material_drawer_item_primary_switch" type="id" /> 14 | <item name="material_drawer_item_primary_toggle" type="id" /> 15 | <item name="material_drawer_item_secondary" type="id" /> 16 | <item name="material_drawer_item_secondary_switch" type="id" /> 17 | <item name="material_drawer_item_secondary_toggle" type="id" /> 18 | <item name="material_drawer_item_container" type="id" /> 19 | <item name="material_drawer_item_divider" type="id" /> 20 | <item name="material_drawer_item_mini" type="id" /> 21 | <item name="material_drawer_item_mini_profile" type="id" /> 22 | <item name="material_drawer_item_profile" type="id" /> 23 | <item name="material_drawer_item_profile_setting" type="id" /> 24 | <item name="material_drawer_item_section" type="id" /> 25 | <item name="material_drawer_item_expandable" type="id" /> 26 | <item name="material_drawer_item_expandable_badge" type="id" /> 27 | </resources> -------------------------------------------------------------------------------- /materialdrawer/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <resources> 3 | <string name="material_drawer_open">Open</string> 4 | <string name="material_drawer_close">Close</string> 5 | <string name="material_drawer_profile_content_description">Profile icon</string> 6 | </resources> 7 | -------------------------------------------------------------------------------- /materialdrawer/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <resources> 3 | 4 | <style name="Widget.MaterialDrawerStyle" parent=""> 5 | <item name="materialDrawerInsetForeground">#4000</item> 6 | <!-- MaterialDrawer specific values --> 7 | <item name="materialDrawerBackground">?colorSurface</item> 8 | <item name="materialDrawerPrimaryText">@color/color_drawer_item_text</item> 9 | <item name="materialDrawerPrimaryIcon">@color/color_drawer_item_text</item> 10 | <item name="materialDrawerSecondaryText">@color/color_drawer_item_text</item> 11 | <item name="materialDrawerSecondaryIcon">@color/color_drawer_item_text</item> 12 | <item name="materialDrawerDividerColor">?colorOutline</item> 13 | <item name="materialDrawerSelectedBackgroundColor">?colorSecondaryContainer</item> 14 | </style> 15 | 16 | <style name="Widget.MaterialDrawerHeaderStyle" parent=""> 17 | <item name="materialDrawerCompactStyle">false</item> 18 | <item name="materialDrawerHeaderSelectionText">@color/color_drawer_item_text</item> 19 | <item name="materialDrawerHeaderSelectionSubtext">@color/color_drawer_item_text</item> 20 | </style> 21 | 22 | <!-- BezelImageView --> 23 | <style name="BezelImageView"> 24 | <item name="materialDrawerMaskDrawable">@drawable/material_drawer_circle_mask</item> 25 | <item name="materialDrawerDrawCircularShadow">true</item> 26 | <item name="materialDrawerSelectorOnPress">?colorOnSurfaceVariant</item> 27 | <item name="android:scaleType">centerInside</item> 28 | </style> 29 | </resources> -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | rootProject.name = "MaterialDrawer" 2 | 3 | // enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") 4 | 5 | pluginManagement { 6 | repositories { 7 | google() 8 | gradlePluginPortal() 9 | mavenCentral() 10 | mavenLocal() 11 | } 12 | } 13 | 14 | dependencyResolutionManagement { 15 | repositories { 16 | google() 17 | mavenCentral() 18 | mavenLocal() 19 | } 20 | 21 | versionCatalogs { 22 | create("baseLibs") { 23 | from("com.mikepenz:version-catalog:0.1.3") 24 | } 25 | } 26 | } 27 | 28 | 29 | include(":app") 30 | include(":materialdrawer") 31 | include(":materialdrawer-iconics") 32 | include(":materialdrawer-nav") --------------------------------------------------------------------------------