{"id":21130346,"url":"https://github.com/raphaelbussa/HeaderView","last_synced_at":"2025-07-09T01:33:19.597Z","repository":{"id":80777147,"uuid":"38938576","full_name":"raphaelbussa/HeaderView","owner":"raphaelbussa","description":"Create an header for com.google.android.material.navigation.NavigationView","archived":false,"fork":false,"pushed_at":"2020-05-07T12:14:01.000Z","size":9795,"stargazers_count":107,"open_issues_count":4,"forks_count":22,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-20T05:32:47.400Z","etag":null,"topics":["android","customview","drawerlayout","headerview"],"latest_commit_sha":null,"homepage":"https://raphaelbussa.github.io/HeaderView/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/raphaelbussa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-07-11T19:56:00.000Z","updated_at":"2024-11-19T11:46:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"965b1dbf-0905-44fc-b477-b1c557d8d272","html_url":"https://github.com/raphaelbussa/HeaderView","commit_stats":null,"previous_names":["rebus007/header-view"],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/raphaelbussa/HeaderView","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphaelbussa%2FHeaderView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphaelbussa%2FHeaderView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphaelbussa%2FHeaderView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphaelbussa%2FHeaderView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raphaelbussa","download_url":"https://codeload.github.com/raphaelbussa/HeaderView/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphaelbussa%2FHeaderView/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264375529,"owners_count":23598393,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","customview","drawerlayout","headerview"],"created_at":"2024-11-20T05:32:38.082Z","updated_at":"2025-07-09T01:33:19.585Z","avatar_url":"https://github.com/raphaelbussa.png","language":"Java","funding_links":[],"categories":["Libs"],"sub_categories":["\u003cA NAME=\"Widget\"\u003e\u003c/A\u003eWidget"],"readme":"# Header View\n\n[ ![Download](https://api.bintray.com/packages/raphaelbussa/maven/header-view/images/download.svg) ](https://bintray.com/raphaelbussa/maven/header-view/_latestVersion) [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Header--View-brightgreen.svg?style=flat)](http://android-arsenal.com/details/1/2123)\n\n![Logo](https://raw.githubusercontent.com/rebus007/HeaderView/master/img/ic_launcher-web.png)\n\nThis is a view for NavigationView in android.support.design library\n\n### Import\nAt the moment the library is in my personal maven repo\n```Gradle\nrepositories {\n    maven {\n        url 'http://dl.bintray.com/raphaelbussa/maven'\n    }\n}\n```\n```Gradle\ndependencies {\n    implementation 'rebus:header-view:3.0.2'\n}\n```\n### How to use\n#### Via XML\nCreate a layout named like this header_drawer.xml\n```XML\n\u003crebus.header.view.HeaderView xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    android:id=\"@+id/header_view\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\"\n    app:hv_add_icon=\"@drawable/ic_action_settings\"\n    app:hv_add_status_bar_height=\"true\"\n    app:hv_background_color=\"@color/colorPrimaryDark\"\n    app:hv_dialog_title=\"@string/account\"\n    app:hv_highlight_color=\"@color/colorAccent\"\n    app:hv_profile_avatar=\"@drawable/ic_placeholder\"\n    app:hv_profile_background=\"@drawable/ic_placeholder_bg\"\n    app:hv_profile_email=\"batman@gotham.city\"\n    app:hv_profile_username=\"Bruce Wayne\"\n    app:hv_show_add_button=\"true\"\n    app:hv_show_arrow=\"true\"\n    app:hv_show_gradient=\"true\"\n    app:hv_style=\"normal\"\n    app:hv_theme=\"light\" /\u003e\n```\nAnd in your NavigationView\n\n```XML\n\u003candroid.support.design.widget.NavigationView\n    android:id=\"@+id/nav_view\"\n    android:layout_width=\"wrap_content\"\n    android:layout_height=\"match_parent\"\n    android:layout_gravity=\"start\"\n    app:headerLayout=\"@layout/header_drawer\"\n    app:menu=\"@menu/drawer\" /\u003e\n```\n#### Manage Profiles\nThe new HeaderView manage different profile and a new profile chooser inspired from YouTube android app\n- Create a profile\n```Java\nProfile profile = new Profile.Builder()\n        .setId(2)\n        .setUsername(\"Raphaël Bussa\")\n        .setEmail(\"raphaelbussa@gmail.com\")\n        .setAvatar(\"https://github.com/rebus007.png?size=512\")\n        .setBackground(\"https://images.unsplash.com/photo-1473220464492-452fb02e6221?dpr=2\u0026auto=format\u0026fit=crop\u0026w=767\u0026h=512\u0026q=80\u0026cs=tinysrgb\u0026crop=\")\n        .build();\n```\n- Add a profile\n```Java\nheaderView.addProfile(profile);\n```\n- Set a profile active\n```Java\nheaderView.setProfileActive(2);\n```\n- Remove a profile\n```Java\nheaderView.removeProfile(2);\n```\n- Get actual active profile\n```Java\nint activeProfileId = headerView.getProfileActive();\n```\n\n#### Customize Profile Chooser\nYou can also customize the profile chooser\n- Add bottom items\n```Java\nItem item = new Item.Builder()\n        .setId(1)\n        .setTitle(\"Remove all profile\")\n        .build();\n\nheaderView.addDialogItem(item);\n```\n- HighlightColor in dialog\n```\nheaderView.setHighlightColor(ContextCompat.getColor(this, R.color.colorAccent));\napp:hv_highlight_color=\"@color/colorAccent\"\n```\n- Change dialog title\n```\nheaderView.setDialogTitle(\"Choose account\");\napp:hv_dialog_title=\"Dialog title\"\n```\n- Change dialog top icon\n```\nheaderView.setAddIconDrawable(R.drawable.ic_action_settings);\napp:hv_add_icon=\"@drawable/ic_action_settings\"\n```\n- Or hide dialog top icon\n```\nheaderView.setShowAddButton(true);\napp:hv_show_add_button=\"true\"\n```\n- Dismiss profile chooser dialog\n```Java\nheaderView.dismissProfileChooser();\n```\n#### Callback\n```Java\nheaderView.setCallback(new HeaderCallback() {\n\n    @Override\n    public boolean onSelect(int id, boolean isActive) {\n        //return profile id selected and if is the active profile\n        return true; //true for close the dialog, false for do nothing\n    }\n\n    @Override\n    public boolean onItem(int id) {\n        //return witch buttom item is selected\n        return true; //true for close the dialog, false for do nothing\n    }\n\n    @Override\n    public boolean onAdd() {\n        return true; //true for close the dialog, false for do nothing\n    }\n});\n```\n#### Loading image from network\nJust add this in your class Application (of course you can use your preferred libs for load images)\n```Java\nImageLoader.init(new ImageLoader.ImageLoaderInterface() {\n    @Override\n    public void loadImage(Uri url, ImageView imageView, @ImageLoader.Type int type) {\n        switch (type) {\n            case ImageLoader.AVATAR:\n                Glide.with(imageView.getContext())\n                        .load(url)\n                        .asBitmap()\n                        .placeholder(R.drawable.ic_placeholder)\n                        .error(R.drawable.ic_placeholder)\n                        .into(imageView);\n                break;\n             case ImageLoader.HEADER:\n                Glide.with(imageView.getContext())\n                        .load(url)\n                        .asBitmap()\n                        .placeholder(R.drawable.ic_placeholder_bg)\n                        .error(R.drawable.ic_placeholder_bg)\n                        .into(imageView);\n                break;\n        }\n    }\n\n});\n```\n#### Use custom font with Calligraphy\nYou can set a custom font with [Calligraphy](https://github.com/chrisjenx/Calligraphy) just add a CustomViewTypeface with HeaderView.class in CalligraphyConfig\n```Java\nCalligraphyConfig.initDefault(new CalligraphyConfig.Builder()\n        .setDefaultFontPath(\"Oswald-Stencbab.ttf\")\n        .setFontAttrId(R.attr.fontPath)\n        .addCustomViewWithSetTypeface(HeaderView.class)\n        .build()\n);\n```\n### Screen\n![Screen](https://raw.githubusercontent.com/rebus007/HeaderView/master/img/screen.png)\n\n### Sample\nBrowse the sample code [here](https://github.com/rebus007/HeaderView/tree/master/sample) or download sample app from the [Play Store](https://play.google.com/store/apps/details?id=rebus.header.view.sample) \n\n### Javadoc\nBrowse Javadoc [here](https://rebus007.github.io/HeaderView/javadoc/)\n\n### App using Header View\nIf you use this lib [contact me](mailto:raphaelbussa@gmail.com) and I will add it to the list below:\n- [Mister Gadget](https://play.google.com/store/apps/details?id=rebus.mister.gadget)\n- [Git Chat](https://github.com/rebus007/Git-Chat)\n- [The Coding Love](https://play.google.com/store/apps/details?id=rebus.thecodinglove)\n- [Romanews.eu](https://play.google.com/store/apps/details?id=it.daigan.romanews)\n- [Mob@rt](https://play.google.com/store/apps/details?id=it.artigiancassa.mobile.android.mobart)\n\n### Developed By\nRaphaël Bussa - [raphaelbussa@gmail.com](mailto:raphaelbussa@gmail.com)\n\n[ ![Twitter](https://raw.githubusercontent.com/raphaelbussa/HeaderView/master/img/social/twitter-icon.png) ](https://twitter.com/raphaelbussa)[ ![Linkedin](https://raw.githubusercontent.com/raphaelbussa/HeaderView/master/img/social/linkedin-icon.png) ](https://www.linkedin.com/in/raphaelbussa)\n\n### License\n```\nThe MIT License (MIT)\n\nCopyright (c) 2017 Raphaël Bussa \u003craphaelbussa@gmail.com\u003e\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraphaelbussa%2FHeaderView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraphaelbussa%2FHeaderView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraphaelbussa%2FHeaderView/lists"}