{"id":21130148,"url":"https://github.com/lewisjdeane/L-Dialogs","last_synced_at":"2025-07-09T01:32:32.191Z","repository":{"id":19637414,"uuid":"22889461","full_name":"lewisjdeane/L-Dialogs","owner":"lewisjdeane","description":"A small library replicating the new dialogs in android L.","archived":false,"fork":false,"pushed_at":"2014-11-08T12:41:24.000Z","size":3542,"stargazers_count":567,"open_issues_count":13,"forks_count":106,"subscribers_count":27,"default_branch":"master","last_synced_at":"2024-04-28T04:47:16.832Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lewisjdeane.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-08-12T19:21:57.000Z","updated_at":"2024-01-25T03:26:31.000Z","dependencies_parsed_at":"2022-08-24T02:50:16.007Z","dependency_job_id":null,"html_url":"https://github.com/lewisjdeane/L-Dialogs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lewisjdeane%2FL-Dialogs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lewisjdeane%2FL-Dialogs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lewisjdeane%2FL-Dialogs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lewisjdeane%2FL-Dialogs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lewisjdeane","download_url":"https://codeload.github.com/lewisjdeane/L-Dialogs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225476373,"owners_count":17480215,"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":[],"created_at":"2024-11-20T05:32:19.639Z","updated_at":"2024-11-20T05:32:27.720Z","avatar_url":"https://github.com/lewisjdeane.png","language":"Java","funding_links":[],"categories":["Libs","\u003ca name=\"Dialog\"\u003eDialog\u003c/a\u003e"],"sub_categories":["\u003cA NAME=\"Widget\"\u003e\u003c/A\u003eWidget","Personal Blog"],"readme":"# L-Dialogs\n\n* * *\n\nA small library replicating the new dialogs in android L.\n\n![\"Screenshot 1\"](https://github.com/lewisjdeane/L-Dialogs/raw/master/screenshots/banner.jpg)\n\n* * *\n\n# Set Up (Android Studio):\n\nDownload the aar here: https://www.dropbox.com/s/276bhapr2g50cak/ldialogs.aar?dl=0\n\nMaven central support will be coming soon.\n\nYou can rename the aar and then place it in the libs directory of your project.\n\nGo into your build.gradle and add the following:\n```java\n\ndependencies {\n    compile fileTree(dir: 'libs', include: ['*.jar'])\n    compile 'uk.me.lewisdeane.ldialogs:RENAMED_FILE_NAME_HERE@aar'\n}\n\nrepositories{\n    flatDir{\n        dirs 'libs'\n    }\n}\n\n```\n\n# Usage\n\n##Normal Dialogs\n\nYou should now be able to access the class CustomDialog from one of your java files.\n\nTo create a new CustomDialog we need to use a builder as so:\n\n```java\n// Create the builder with required paramaters - Context, Title, Positive Text\nCustomDialog.Builder builder = new CustomDialog.Builder(Context context, String title, String positiveText);\n\n// Now we can any of the following methods.\nbuilder.content(String content);\nbuilder.negativeText(String negativeText);\nbuilder.darkTheme(boolean isDark);\nbuilder.typeface(Typeface typeface);\nbuilder.titleTextSize(int size);\nbuilder.contentTextSize(int size);\nbuilder.buttonTextSize(int size);\nbuilder.titleAlignment(Alignment alignment); // Use either Alignment.LEFT, Alignment.CENTER or Alignment.RIGHT\nbuilder.titleColor(String hex); // int res, or int colorRes parameter versions available as well.\nbuilder.contentColor(String hex); // int res, or int colorRes parameter versions available as well.\nbuilder.positiveColor(String hex); // int res, or int colorRes parameter versions available as well.\nbuilder.negativeColor(String hex); // int res, or int colorRes parameter versions available as well.\nbuilder.positiveBackground(Drawable drawable); // int res parameter version also available.\nbuilder.rightToLeft(boolean rightToLeft); // Enables right to left positioning for languages that may require so.\n\n// Now we can build the dialog.\nCustomDialog customDialog = builder.build();\n\n// Show the dialog.\ncustomDialog.show();\n```\n\nTo handle the button clicks you can use the following code:\n\n```java\ncustomDialog.setClickListener(new CustomDialog.ClickListener() {\n            @Override\n            public void onConfirmClick() {\n\n            }\n\n            @Override\n            public void onCancelClick() {\n\n            }\n        });\n```\n\nIf you want to set a custom view in the dialog you can use the following method.\n\n```java\ncustomDialog.setCustomView(View customView);\n```\n\nThen do what you need to do with the custom views content in onConfirmClick or onCancelClick.\n\n\n##List Dialogs\n\nTo use the CustomListDialog we need to use a builder again, this is done as follows:\n\n```java\n// Create list dialog with required parameters - context, title, and our array of items to fill the list.\nCustomListDialog.Builder builder = new CustomListDialog.Builder(Context context, String title, String[] items);\n\n// Now again we can use some extra methods on the builder to customise it more.\nbuilder.darkTheme(boolean isDark);\nbuilder.typeface(Typeface typeface);\nbuilder.titleAlignment(Alignment alignment); // Use either Alignment.LEFT, Alignment.CENTER or Alignment.RIGHT\nbuilder.itemAlignment(Alignment alignment); // Use either Alignment.LEFT, Alignment.CENTER or Alignment.RIGHT\nbuilder.titleColor(String hex); // int res, or int colorRes parameter versions available as well.\nbuilder.itemColor(String hex); // int res, or int colorRes parameter versions available as well.\nbuilder.titleTextSize(int size);\nbuilder.itemTextSize(int size);\nbuilder.rightToLeft(boolean rightToLeft); // Enables right to left positioning for languages that may require so.\n\n// Now we can build our dialog.\nCustomListDialog customListDialog = builder.build();\n\n// Finally we can show it.\ncustomListDialog.show();\n```\n\nIn order to recieve the click events from the dialog, simply use the following method on your customListDialog:\n```java\ncustomListDialog.setListClickListener(new CustomListDialog.ListClickListener() {\n            @Override\n            public void onListItemSelected(int i, String[] strings, String s) {\n                // i is the position clicked.\n                // strings is the array of items in the list.\n                // s is the item selected.\n            }\n        });\n``` \n\nTo add a listview selector use the following code:\n```java\nStateListDrawable selector = new StateListDrawable();\nselector.addState(new int[]{android.R.attr.state_pressed}, new ColorDrawable(R.color.color1));\nselector.addState(new int[]{-android.R.attr.state_pressed}, new ColorDrawable(R.color.color2));\n\n// The important part:\ncustomListDialog.getListView().setSelector(selector);\n```\n\n* * *\n\nThis library will be updated often, enjoy!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flewisjdeane%2FL-Dialogs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flewisjdeane%2FL-Dialogs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flewisjdeane%2FL-Dialogs/lists"}