{"id":13644037,"url":"https://github.com/lopei/collageview","last_synced_at":"2025-04-21T06:32:47.919Z","repository":{"id":40063957,"uuid":"75927812","full_name":"lopei/collageview","owner":"lopei","description":null,"archived":false,"fork":false,"pushed_at":"2022-11-24T20:15:37.000Z","size":272,"stargazers_count":243,"open_issues_count":2,"forks_count":35,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-11-09T16:43:39.279Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lopei.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-12-08T10:29:20.000Z","updated_at":"2024-09-13T10:22:12.000Z","dependencies_parsed_at":"2022-06-26T10:09:46.601Z","dependency_job_id":null,"html_url":"https://github.com/lopei/collageview","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lopei%2Fcollageview","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lopei%2Fcollageview/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lopei%2Fcollageview/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lopei%2Fcollageview/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lopei","download_url":"https://codeload.github.com/lopei/collageview/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250008273,"owners_count":21359956,"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-08-02T01:01:56.746Z","updated_at":"2025-04-21T06:32:42.909Z","avatar_url":"https://github.com/lopei.png","language":"Java","readme":"# collageview\n\n[![](https://jitpack.io/v/lopei/collageview.svg)](https://jitpack.io/#lopei/collageview)\n\nCollageView is a library for creating simple photo collages in your applications. Would be great, for example, in profile page or feed page.\n\n\n## What's new in version 0.2.0?\n- Updated project libraries, updated build.gradle, removed sample images\n\n## How to use?\nStep 1. Add the JitPack repository to your build file\n\nGradle:\n\nFor gradle version 6.8 and above:\n- settings.gradle, project level:\n\n```\ndependencyResolutionManagement {\n    repositories {\n        maven { url \"https://jitpack.io\" }\n    }\n}\n```\n\n- build.gradle, project level:\n```\nallprojects {\n  repositories {\n    maven { url \"https://jitpack.io\" }\n  }\n}\n```\n\nMaven:\n\n```\n\u003crepositories\u003e\n  \u003crepository\u003e\n    \u003cid\u003ejitpack.io\u003c/id\u003e\n    \u003curl\u003ehttps://jitpack.io\u003c/url\u003e\n  \u003c/repository\u003e\n\u003c/repositories\u003e\n\n```\nStep 2. Add the dependency\n\nGradle:\n- build.gradle, module level:\n\n```\ndependencies {\n  implementation 'com.github.lopei:collageview:0.2.0'\n}\n```\n\nMaven:\n\n```\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.github.lopei\u003c/groupId\u003e\n  \u003cartifactId\u003ecollageview\u003c/artifactId\u003e\n  \u003cversion\u003e0.2.0\u003c/version\u003e\n\u003c/dependency\u003e\n  \n```\n\n\nStep 3. Add Collage view to your layout resource file:\n```\n\u003ccom.lopei.collageview.CollageView\n  android:id=\"@+id/collageView\"\n  android:layout_width=\"match_parent\"\n  android:layout_height=\"match_parent\" /\u003e\n```\n\nStep 4. Setup needed parameters and load photos:\n```\nCollageView collageView = (CollageView) findViewById(R.id.collageView);\n\n  collageView\n    .photoMargin(1)\n    .photoPadding(3)\n    .backgroundColor(Color.RED)\n    .photoFrameColor(Color.BLUE)\n    .useFirstAsHeader(true) // makes first photo fit device widtdh and use full line\n    .defaultPhotosForLine(5) // sets default photos number for line of photos (can be changed by program at runtime)\n    .iconSelector(this, getResources().getDimensionPixelSize(R.dimen.icon_size)) (or use 0 as size to wrap content)\n    .useCards(true) // adds cardview backgrounds to all photos\n    .maxWidth(100) // will resize images if their side is bigger than 100\n    .placeHolder(R.drawable.placeholder_photo) //adds placeholder resource\n    .headerForm(CollageView.ImageForm.IMAGE_FORM_SQUARE) // sets form of image for header (if useFirstAsHeader == true)\n    .photosForm(CollageView.ImageForm.IMAGE_FORM_HALF_HEIGHT) //sets form of image for other photos\n    .loadPhotos(urls); // here you can use Array/List of photo urls or array of resource ids\n```\n\nStep 5. Setup On Photo Click Listener (if needed)\n```\ncollageView.setOnPhotoClickListener(new CollageView.OnPhotoClickListener() {\n  @Override\n  public void onPhotoClick(int position) {\n     // do random stuff here\n   }\n});\n```\n\nStep 6. Setup icons for your images (if needed, to be used with .iconSelector(IconSelector))\n```\ncollageView.iconSelector(new CollageView.IconSelector() {\n                    @Override\n                    public int getIconResId(int pos) {\n                        if (pos == 0 || pos  == 4) {\n                            return R.mipmap.ic_launcher;\n                        }\n                        return 0;\n                    }\n                }\n, getResources().getDimensionPixelSize(R.dimen.icon_size));\n```\n\n## Contrubution\n\nContributions are always welcome\n\n## Licence\n\nCopyright 2016 lopei\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\n## Screenshots\n\u003cimg src=\"https://pp.vk.me/c626823/v626823371/2947c/ZO5N0vDiaT4.jpg\" width=\"400\"/\u003e\n\n\n\u003cimg src=\"https://pp.vk.me/c626823/v626823371/29407/fyIqt_C1uWQ.jpg\" width=\"400\"/\u003e\n\n\n\u003cimg src=\"https://pp.vk.me/c636817/v636817371/4548f/UQ9aVtDpgtU.jpg\" width=\"400\"/\u003e\n\n\n\u003cimg src=\"https://pp.vk.me/c636817/v636817371/45499/g-4JTsHli5A.jpg\" width=\"400\"/\u003e\n\n\n\u003cimg src=\"https://pp.vk.me/c636818/v636818371/40af0/_sxbhRCQifE.jpg\" width=\"400\"/\u003e\n\n\n\u003cimg src=\"https://pp.vk.me/c636818/v636818371/40afa/QcjVfRKo0_A.jpg\" width=\"400\"/\u003e\n","funding_links":[],"categories":["图片"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flopei%2Fcollageview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flopei%2Fcollageview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flopei%2Fcollageview/lists"}