{"id":13395926,"url":"https://github.com/fengdai/AlertDialogPro","last_synced_at":"2025-03-13T22:31:16.289Z","repository":{"id":20264852,"uuid":"23537841","full_name":"fengdai/AlertDialogPro","owner":"fengdai","description":"[Deprecated] This project can make it easy to theme and custom Android's dialog. Also provides Holo and Material themes for old devices.","archived":false,"fork":false,"pushed_at":"2020-04-14T11:02:21.000Z","size":4678,"stargazers_count":468,"open_issues_count":13,"forks_count":122,"subscribers_count":29,"default_branch":"master","last_synced_at":"2024-07-31T18:16:01.214Z","etag":null,"topics":["android","dialog","material-theme"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fengdai.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-09-01T09:43:12.000Z","updated_at":"2024-07-26T10:15:48.000Z","dependencies_parsed_at":"2022-08-07T09:15:59.948Z","dependency_job_id":null,"html_url":"https://github.com/fengdai/AlertDialogPro","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fengdai%2FAlertDialogPro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fengdai%2FAlertDialogPro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fengdai%2FAlertDialogPro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fengdai%2FAlertDialogPro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fengdai","download_url":"https://codeload.github.com/fengdai/AlertDialogPro/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221417257,"owners_count":16816845,"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","dialog","material-theme"],"created_at":"2024-07-30T18:00:35.695Z","updated_at":"2024-10-25T10:31:00.694Z","avatar_url":"https://github.com/fengdai.png","language":"Java","readme":"[![Build Status](https://travis-ci.org/fengdai/AlertDialogPro.svg?branch=master)](https://travis-ci.org/fengdai/AlertDialogPro)\n[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-AlertDialogPro-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/1178)\n\n# Deprecated\n\nPlease use `android.support.v7.app.AlertDialog` of support-v7.\n\n# AlertDialogPro\n\nWhy AlertDialogPro?\n\nTheming Android's AlertDialog is not an easy thing. Because some of its attributes are not avaliable on old platform. Even on newer you still can't use ```android:layout``` to specify your own layout, since your views' ids should be consistant with Android's, some of which are not public... AlertDialogPro can make theming a lot easier.\n\n ![holo-light](https://github.com/fengdai/AlertDialogPro/raw/master/image/holo_light_dialog_only.png)\n   ![mtrl-light](https://github.com/fengdai/AlertDialogPro/raw/master/image/material_light_dialog_only.png)\n   ![flavored-mtrl-light](https://github.com/fengdai/AlertDialogPro/raw/master/image/flavored_material_light.png)\n   ![mtrl-dark](https://github.com/fengdai/AlertDialogPro/raw/master/image/material_dark_dialog_only.png)\n\n# Structure\n\n### alertdialogpro-core\n\nContains core codes for building an AlertDialogPro. Most of it's codes are ported from the latest Android Platform. It doesn't contain any resource file. If you want to implement a brand new theme, use this project directly. Otherwise, you should use alertdialogpro-theme-material or alertdialogpro-theme-holo.\n\n### alertdialogpro-theme-material\n\nBased on alertdialogpro-core, gives AlertDialogPro a Material theme.\n\n### alertdialogpro-theme-holo (Obsolete)\n\nAlso based on alertdialogpro-core, gives AlertDialogPro a Holo theme.\n\n# Quick Start\nTake **alertdialogpro-theme-material** for example.\n\n### Download\n\nGrab latest version via Gradle:\n```groovy\ndependencies {\n  compile 'com.github.fengdai:alertdialogpro-theme-material:0.2.6'\n}\n```\n\nor Maven:\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.github.fengdai\u003c/groupId\u003e\n  \u003cartifactId\u003ealertdialogpro-theme-material\u003c/artifactId\u003e\n  \u003cversion\u003e0.2.6\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### Specify AlertDialogPro's theme\n\nIn your app's xml file, use attribute ```alertDialogProTheme``` to specify your AlertDialogPro's theme. **alertdialogpro-theme-material** contains two built-in theme: ```Theme.AlertDialogPro.Material``` and ```Theme.AlertDialogPro.Material.Light```. Here, we use the light version:\n```xml\n\u003cstyle name=\"YourAppTheme\"\u003e\n   ...\n  \u003citem name=\"alertDialogProTheme\"\u003e@style/Theme.AlertDialogPro.Material.Light\u003c/item\u003e\n\u003c/style\u003e\n```\n\n### Build an AlertDialogPro\n\nUse ```AlertDialogPro.Builder``` to build an AlertDialogPro:\n```java\nAlertDialogPro.Builder builder = new AlertDialogPro.Builder(getContext());\nbuilder.setIcon(R.drawable.icon).\n        setTitle(\"Title\").\n        setMessage(\"Message Body\").\n        setNeutralButton(\"Neutral\", null).\n        setPositiveButton(\"Positive\", null).\n        setNegativeButton(\"Negative\", null).\n        show();\n```\nWith the example codes above, you can create an AlertDialogPro which has an icon, a title, a message body and three option buttons. Look into the [sample](https://github.com/fengdai/AlertDialogPro/blob/master/alertdialogpro-demo/src/main/java/com/alertdialogpro/demo/MainActivity.java) to see more usages.\n\n### Flavor built-in themes\n\nBuilt-in themes can't meet your requirement? There are [several attributes](https://github.com/fengdai/AlertDialogPro/blob/master/alertdialogpro-core/src/main/res/values/adp_core_attrs.xml) that you can use to make some slight changes. Here is an example to show how to change the positive button's color:\n\n1. Define your positive button's style:\n```xml\n\u003cstyle name=\"YourButtonStyle\" parent=\"Widget.AlertDialogPro.Material.Light.Button\"\u003e\n     \u003citem name=\"android:textColor\"\u003e@color/adp_positive_button_color\u003c/item\u003e\n\u003c/style\u003e\n```\n\n2. Specify button style to your AlertDialogPro's theme with attribute ```adpButtonBarPositiveButtonStyle```:\n```xml\n\u003cstyle name=\"FlavoredMaterialLight\" parent=\"Theme.AlertDialogPro.Material.Light\"\u003e\n      ...\n     \u003citem name=\"adpButtonBarPositiveButtonStyle\"\u003e@style/YourButtonStyle\u003c/item\u003e\n\u003c/style\u003e\n```\n3. Use it in your app's theme:\n```xml\n\u003citem name=\"alertDialogProTheme\"\u003e@style/FlavoredMaterialLight\u003c/item\u003e\n```\n\nLook into [here](https://github.com/fengdai/AlertDialogPro/blob/master/alertdialogpro-core/src/main/res/values/adp_core_attrs.xml) to see all attributes.\n\n### Advanced customization\nYou can specify your own layout to AlertDialogPro. This can be very useful when you want to use custom views or you want a special dialog layout. Remember to keep your views' ids consistant with [AlertDialogPro's ids](https://github.com/fengdai/AlertDialogPro/blob/master/alertdialogpro-core/src/main/res/values/adp_core_ids.xml).\n\n1. Define your AlertDialogPro's style:\n```xml\n\u003cstyle name=\"YourAlertDialogProStyle\" parent=\"AlertDialogPro.Material.Light\"\u003e\n  \u003c!-- Specify your AlertDialogPro's layout --\u003e\n  \u003citem name=\"adpLayout\"\u003e@layout/your_alert_dialog\u003c/item\u003e\n  \u003c!-- Specify your AlertDialogPro's ListView layout. --\u003e\n  \u003citem name=\"adpListLayout\"\u003e@layout/your_list_layout\u003c/item\u003e\n  \u003c!-- Specify your AlertDialogPro's list item layout. --\u003e\n  \u003citem name=\"adpListItemLayout\"\u003e@layout/your_dialog_item\u003c/item\u003e\n  \u003c!-- Specify your AlertDialogPro's multi choice list item layout. --\u003e\n  \u003citem name=\"adpMultiChoiceItemLayout\"\u003e@layout/your_multichoice_dialog_item\u003c/item\u003e\n  \u003c!-- Specify your AlertDialogPro's single choice list item layout. --\u003e\n  \u003citem name=\"adpSingleChoiceItemLayout\"\u003e@layout/your_singlechoice_dialog_item\u003c/item\u003e\n\u003c/style\u003e\n```\n2. And add it to your AlertDialogPro's theme:\n```xml\n\u003cstyle name=\"YourAlertDialogProTheme\" parent=\"Theme.AlertDialogPro.Material.Light\"\u003e\n  ...\n  \u003citem name=\"alertDialogProStyle\"\u003e@style/YourAlertDialogProStyle\u003c/item\u003e\n\u003c/style\u003e\n```\n\n3. Use your AlertDialogPro theme in your app's theme:\n```xml\n\u003citem name=\"alertDialogProTheme\"\u003e@style/YourAlertDialogProTheme\u003c/item\u003e\n```\n\n# Migrate From AlertDialog\n\nAlertDialogPro's Java API is exactly the same as [AlertDialog's](http://developer.android.com/reference/android/app/AlertDialog.Builder.html). In fact, most of AlertDialogPro's codes are ported from the latest AlertDialog. So the only thing you need to do in your Java codes is replacing ```AlertDialog.Builder``` with ```AlertDialogPro.Builder```.\n\n# Requirements\n\nAlertDialogPro requires at minimum Android 2.1 (API level 7).\n\n# Thanks\n\n   * This project contains some code ported from The Android Open Source Project. [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)\n   * Thank [vbauer](https://github.com/vbauer) and his awesome site [Android-Arsenal](https://android-arsenal.com/)\n\n# License\n\n    Copyright (C) 2014 Feng Dai\n    Copyright (C) 2007 The Android Open Source Project\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n","funding_links":[],"categories":["Index `(light-weight pages)`","Index","Java","\u003ca name=\"Dialog\"\u003eDialog\u003c/a\u003e"],"sub_categories":["Personal Blog"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffengdai%2FAlertDialogPro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffengdai%2FAlertDialogPro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffengdai%2FAlertDialogPro/lists"}