{"id":13989376,"url":"https://github.com/500px/greedo-layout-for-android","last_synced_at":"2025-05-15T02:08:02.351Z","repository":{"id":37579937,"uuid":"51173511","full_name":"500px/greedo-layout-for-android","owner":"500px","description":"Full aspect ratio grid LayoutManager for Android's RecyclerView","archived":false,"fork":false,"pushed_at":"2022-06-21T21:20:31.000Z","size":1771,"stargazers_count":1630,"open_issues_count":20,"forks_count":156,"subscribers_count":84,"default_branch":"master","last_synced_at":"2025-04-13T23:55:42.475Z","etag":null,"topics":["android","android-recyclerview","aspect-ratio","greedo-layout","grid","layout","recyclerview"],"latest_commit_sha":null,"homepage":"","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/500px.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":"2016-02-05T20:57:07.000Z","updated_at":"2025-03-30T00:20:38.000Z","dependencies_parsed_at":"2022-07-19T18:04:31.895Z","dependency_job_id":null,"html_url":"https://github.com/500px/greedo-layout-for-android","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/500px%2Fgreedo-layout-for-android","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/500px%2Fgreedo-layout-for-android/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/500px%2Fgreedo-layout-for-android/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/500px%2Fgreedo-layout-for-android/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/500px","download_url":"https://codeload.github.com/500px/greedo-layout-for-android/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254259383,"owners_count":22040820,"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","android-recyclerview","aspect-ratio","greedo-layout","grid","layout","recyclerview"],"created_at":"2024-08-09T13:01:37.586Z","updated_at":"2025-05-15T02:07:57.338Z","avatar_url":"https://github.com/500px.png","language":"Java","funding_links":[],"categories":["Java"],"sub_categories":[],"readme":"# Greedo Layout for Android\nA drop-in custom layout manager for Android RecyclerViews to layout a grid of photos while respecting their aspect ratios.\n\n![image](screenshot.png)\n\n## Setup\nDownload the latest release via Gradle:\n``` groovy\nrepositories {\n\tmaven { url 'https://github.com/500px/greedo-layout-for-android/raw/master/releases/' }\n}\n\ndependencies {\n\tcompile 'com.fivehundredpx:greedo-layout:1.5.1'\n}\n```\n\n## Usage\nSee the sample project for a complete solution on how to use GreedoLayout. Below are the specific steps.\n\n```java\n// Create an instance of the GreedoLayoutManager and pass it to the RecyclerView\nMyRecyclerAdapter recyclerAdapter = new MyRecyclerAdapter(this);\nGreedoLayoutManager layoutManager = new GreedoLayoutManager(recyclerAdapter);\n\nRecyclerView recyclerView = (RecyclerView)findViewById(R.id.recycler_view);\nrecyclerView.setLayoutManager(layoutManager);\nrecyclerView.setAdapter(recyclerAdapter);\n\n// Set the max row height in pixels\nlayoutManager.setMaxRowHeight(300);\n\n// If you would like to add spacing between items (Note, MeasUtils is in the sample project)\nint spacing = MeasUtils.dpToPx(4, this);\nrecyclerView.addItemDecoration(new GreedoSpacingItemDecoration(spacing));\n```\n\nAnd then, in your RecyclerView adapter, or some other class of your choosing, implement `SizeCalculatorDelegate`. This implementation got passed to the layout manager above.\n```java\npublic class MyRecyclerAdapter extends RecyclerView.Adapter\u003cViewHolder\u003e implements SizeCalculatorDelegate {\n    @Override\n    public double aspectRatioForIndex(int index) {\n    \t// Return the aspect ratio of your image at the given index\n    }\n}\n```\n\n## License\nGreedoLayout is released under the MIT license. See LICENSE for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F500px%2Fgreedo-layout-for-android","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F500px%2Fgreedo-layout-for-android","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F500px%2Fgreedo-layout-for-android/lists"}