{"id":13396343,"url":"https://github.com/orhanobut/dialogplus","last_synced_at":"2025-05-14T12:06:45.203Z","repository":{"id":24508081,"uuid":"27913753","full_name":"orhanobut/dialogplus","owner":"orhanobut","description":"Advanced dialog solution for android","archived":false,"fork":false,"pushed_at":"2022-01-17T09:57:28.000Z","size":6790,"stargazers_count":4993,"open_issues_count":54,"forks_count":791,"subscribers_count":137,"default_branch":"master","last_synced_at":"2025-04-19T09:22:54.558Z","etag":null,"topics":["android","bottom-sheet","dialog","java","kotlin"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/orhanobut.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}},"created_at":"2014-12-12T09:24:44.000Z","updated_at":"2025-04-03T13:08:53.000Z","dependencies_parsed_at":"2022-08-23T00:01:02.966Z","dependency_job_id":null,"html_url":"https://github.com/orhanobut/dialogplus","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orhanobut%2Fdialogplus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orhanobut%2Fdialogplus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orhanobut%2Fdialogplus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orhanobut%2Fdialogplus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/orhanobut","download_url":"https://codeload.github.com/orhanobut/dialogplus/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254140739,"owners_count":22021218,"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","bottom-sheet","dialog","java","kotlin"],"created_at":"2024-07-30T18:00:46.228Z","updated_at":"2025-05-14T12:06:45.141Z","avatar_url":"https://github.com/orhanobut.png","language":"Java","readme":"[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-dialogplus-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/1413)    [![API](https://img.shields.io/badge/API-10%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=10) [![Join the chat at https://gitter.im/orhanobut/dialogplus](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/orhanobut/dialogplus?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge) [![](https://img.shields.io/badge/AndroidWeekly-%23144-blue.svg)](http://androidweekly.net/issues/issue-144)\n\n\u003cimg align='right' src='https://github.com/orhanobut/dialogplus/blob/master/art/DP1.png' height='128'/\u003e\n\nDialogPlus\n==========\nSimple and advanced dialog solution.\n\n- Uses normal view as dialog\n- Provides expandable option\n- Multiple positioning\n- Built-in options for easy implementation\n\n\n\n\u003cimg src='https://github.com/nr4bt/dialogplus/blob/master/art/dialogplus.gif' height='400'/\u003e \u003cimg src='https://github.com/nr4bt/dialogplus/blob/master/art/dialogplusanim.gif' height='400'/\u003e\n\n##### DialogPlus provides android L dialog animation\n\n##### DialogPlus provides 3 position:\n- Top : Dialog will appear at top with animation\n- Center : Dialog will appear in the center with animation\n- Bottom : Dialog will appear at the bottom of the screen with animation\n\n##### DialogPlus provides 3 content types:\n- ListHolder : Items will be shown in a listview\n- GridHolder : Items will be shown in a gridview\n- ViewHolder : Your customized view will be shown in the content\n\n### Gradle\n```groovy\nimplementation 'com.orhanobut:dialogplus:1.11@aar'\n```\n\n### Usage\nUse the builder to create the dialog.\n\nBasic usage\n```java\nDialogPlus dialog = DialogPlus.newDialog(this)\n  .setAdapter(adapter)\n  .setOnItemClickListener(new OnItemClickListener() {\n    @Override\n    public void onItemClick(DialogPlus dialog, Object item, View view, int position) {\n    }\n  })\n  .setExpanded(true)  // This will enable the expand feature, (similar to android L share dialog)\n  .create();\ndialog.show();\n```\n\n### More options\nEnable expand animation same as Android L share dialog\n```java\n.setExpanded(true) // default is false, only works for grid and list\n```\nSet expand animation default height\n```java\n.setExpanded(true, 300)\n```\n\nSelect different holder.\n\n- Use ListView as content holder, note that this is default content type.\n```java\nsetContentHolder(new ListHolder())\n```\n- Use ViewHolder as content holder if you want to use a custom view for your dialog. Pass resource id\n```java\n.setContentHolder(new ViewHolder(R.layout.content))\n```\nor pass view itself\n```java\n.setContentHolder(new ViewHolder(view))\n```\n- Use GridHolder if you want to use GridView for the dialog. You must set column number.\n```java\n.setContentHolder(new GridHolder(COLUMN_NUMBER))\n```\n- Get the holder view, ListView, GridView or your custom view\n```java\nView view = dialogPlus.getHolderView();\n```\n- Set dialog position. BOTTOM (default), TOP or CENTER. You can also combine other Gravity options.\n```java\n.setGravity(Gravity.CENTER)\n```\n- Define if the dialog is cancelable and should be closed when back pressed or out of dialog is clicked\n```java\n.setCancelable(true)\n```\n- Set Adapter, this adapter will be used to fill the content for ListHolder and GridHolder. This is required if the content holder is ListHolder or GridHolder. It is not required if the content holder is ViewHolder.\n```java\n.setAdapter(adapter);\n```\n- Set an item click listener when list or grid holder is chosen. In that way you can have callbacks when one of your items is clicked\n```java\n.setOnItemClickListener(new OnItemClickListener() {\n  @Override\n  public void onItemClick(DialogPlus dialog, Object item, View view, int position) {\n  }\n})\n```\n- Set a global click listener to you dialog in order to handle all the possible click events. You can then identify the view by using its id and handle the correct behaviour. Only views which has id will trigger this event.\n```java\n.setOnClickListener(new OnClickListener() {\n    @Override\n    public void onClick(DialogPlus dialog, View view) {\n\n    }\n})\n```\n- Add margins to your dialog. They are set to 0 except when gravity is center. In that case basic margins are applied\n```java\n.setMargin(left, top, right, bottom)\n```\n- Set padding to the holder\n```java\n.setPadding(left, top, right, bottom)\n```\n- Set the footer view using the id of the layout resource\n```java\n.setFooter(R.layout.footer)\n```\nor use view\n```java\n.setFooter(view)\n```\n- Get the footer view\n```java\nView view = dialogPlus.getFooterView();\n```\n- Set the header view using the id of the layout resource\n```java\n.setHeader(R.layout.header)\n```\nor use view\n```java\n.setHeader(view)\n```\n- Get the header view\n```java\nView view = dialogPlus.getHeaderView();\n```\n- Set animation resources\n```java\n.setInAnimation(R.anim.abc_fade_in)\n.setOutAnimation(R.anim.abc_fade_out)\n```\n- Set width and height for the content\n```java\n.setContentWidth(ViewGroup.LayoutParams.WRAP_CONTENT)  // or any custom width ie: 300\n.setContentHeight(ViewGroup.LayoutParams.WRAP_CONTENT)\n```\n\n- Dismiss Listener, triggered when the dialog is dismissed\n```java\n.setOnDismissListener(new OnDismissListener() {\n    @Override\n    public void onDismiss(DialogPlus dialog) {\n\n    }\n})\n```\n\n- Cancel Listener, triggered when the dialog is cancelled by back button or clicking outside\n```java\n.setOnCancelListener(new OnCancelListener() {\n    @Override\n    public void onCancel(DialogPlus dialog) {\n\n    }\n})\n```\n\n- BackPress Listener, triggered when the back button is pressed\n```java\n.setOnBackPressListener(new OnBackPressListener() {\n    @Override\n    public void onBackPressed(DialogPlus dialog) {\n\n    }\n})\n```\n\n- Change content container background, as default white\n```java\n.setContentBackgroundResource(resource)\n```\n\n- Change overlay container background, as default it's semi-transparent black\n```java\n.setOverlayBackgroundResource(resource)\n```\n\n#### License\n\u003cpre\u003e\nCopyright 2016 Orhan Obut\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\u003c/pre\u003e\n","funding_links":[],"categories":["Index `(light-weight pages)`","Java","对话框","Index","Libs"],"sub_categories":["\u003cA NAME=\"Widget\"\u003e\u003c/A\u003eWidget"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forhanobut%2Fdialogplus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Forhanobut%2Fdialogplus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forhanobut%2Fdialogplus/lists"}