{"id":13604873,"url":"https://github.com/zendesk/belvedere","last_synced_at":"2025-04-11T18:30:59.916Z","repository":{"id":38953431,"uuid":"59029808","full_name":"zendesk/belvedere","owner":"zendesk","description":"An image picker library for Android","archived":true,"fork":false,"pushed_at":"2024-10-08T09:47:21.000Z","size":3286,"stargazers_count":145,"open_issues_count":14,"forks_count":24,"subscribers_count":97,"default_branch":"master","last_synced_at":"2025-03-13T08:04:13.724Z","etag":null,"topics":["android","images","java","library","media","picker"],"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/zendesk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-05-17T14:27:23.000Z","updated_at":"2024-11-21T03:53:01.000Z","dependencies_parsed_at":"2024-01-16T23:30:09.803Z","dependency_job_id":"4ae3e33a-4129-4613-ac56-1b82c23dc626","html_url":"https://github.com/zendesk/belvedere","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zendesk%2Fbelvedere","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zendesk%2Fbelvedere/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zendesk%2Fbelvedere/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zendesk%2Fbelvedere/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zendesk","download_url":"https://codeload.github.com/zendesk/belvedere/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248458373,"owners_count":21107064,"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","images","java","library","media","picker"],"created_at":"2024-08-01T19:00:52.229Z","updated_at":"2025-04-11T18:30:57.410Z","avatar_url":"https://github.com/zendesk.png","language":"Java","funding_links":[],"categories":["Java"],"sub_categories":[],"readme":":warning: As of October 8th, the repository has been made read-only and will not receive any future updates. We recommend using the official [Google Photo Picker library](https://developer.android.com/training/data-storage/shared/photopicker), as this will help ensure compliance with privacy best practices. :warning:\n\n\u003cp align=\"center\"\u003e\n\n# Belvedere\n\u003cp align=\"left\"\u003e\n\u003ca href=\"https://travis-ci.org/zendesk/belvedere\"\u003e\u003cimg src=\"https://travis-ci.org/zendesk/belvedere.svg?branch=master\" alt=\"Build Status\" /\u003e\u003c/a\u003e \u003ca href=\"http://zendesk.github.io/belvedere\"\u003e\u003cimg src=\"https://img.shields.io/readthedocs/pip.svg\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://raw.githubusercontent.com/zendesk/belvedere/master/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/badge/License-Apache%202.0-blue.svg\" alt=\"License\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nA file picker for Android.\n\u003cbr /\u003e\n\n\u003cp align=\"center\"\u003e\n\u003cimg width=\"300\" src=\"https://raw.githubusercontent.com/zendesk/belvedere/master/media/belvedere_stream_demo.gif\"/\u003e\n\u003c/p\u003e\n\n### Overview\nBelvedere gives you the power to easily integrate file selection from third party apps and the camera without the need to take care of permissions, ContentProvider, Intent permissions, and so on.\n\n### Download\n\nFirst add the Zendesk maven repository. This is a new step for versions 3.0.0-RC and newer.\n\n```\nmaven {\n    url 'https://zendesk.jfrog.io/zendesk/oss-releases-local'\n}\n```\n\nSecondly, add Belvedere as a dependency:\n\n```\nimplementation ‘com.zendesk.belvedere2:belvedere:3.0.0-RC’\n```\n\nBelvedere 3.0.0-RC and newer uses AndroidX and is recommended for use with Android 11.\n\n### How to use Belvedere\n\n#### ImageStream\n\nA simple implementation of the ImageStream looks like this:\n\n```java\npublic class TestActivity extends AppCompatActivity implements ImageStream.Listener {\n\n    private ImageStream imageStream;\n    private Button selectAttachment;\n\n    @Override\n    protected void onCreate(@Nullable Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        // ...\n\n        imageStream = BelvedereUi.install(this);\n        imageStream.addListener(this);\n\n        selectAttachment.setOnClickListener(new View.OnClickListener() {\n            @Override\n            public void onClick(View view) {\n                BelvedereUi.imageStream(getApplicationContext())\n                        .withCameraIntent()\n                        .withDocumentIntent(\"*/*\", true)\n                        .showPopup(TestActivity.this);\n            }\n        });\n    }\n\n    @Override\n    public void onDismissed() {\n        // Image Stream was dismissed\n    }\n\n    @Override\n    public void onVisible() {\n        // Image Stream was shown\n    }\n\n    @Override\n    public void onMediaSelected(List\u003cMediaResult\u003e mediaResults) {\n        // The user selected attachments\n    }\n\n    @Override\n    public void onMediaDeselected(List\u003cMediaResult\u003e mediaResults) {\n        // The user deselected attachments\n    }\n}\n```\n\n#### Dialog (from 1.x)\n\n\n```java\npublic class TestActivity extends AppCompatActivity {\n\n    private ImageStream imageStream;\n    private Button selectAttachment;\n    \n    // Make sure to manage a strong reference to the callback because Belvedere uses\n    // a WeakReference to avoid memory leaks\n    private Callback\u003cList\u003cMediaResult\u003e\u003e callback; \n\n    @Override\n    protected void onCreate(@Nullable Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        // ...\n\n        selectAttachment.setOnClickListener(new View.OnClickListener() {\n            @Override\n            public void onClick(View view) {\n                Belvedere belvedere = Belvedere.from(this);\n                MediaIntent document = belvedere.document().build();\n                MediaIntent camera = belvedere.camera().build();\n\n                BelvedereUi.showDialog(getSupportFragmentManager(), document, camera);\n            }\n        });\n    }\n\n    @Override\n    protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n        super.onActivityResult(requestCode, resultCode, data);\n        \n        callback = new Callback\u003cList\u003cMediaResult\u003e\u003e () {\n            @Override\n            public void success(List\u003cMediaResult\u003e result) {\n                // Handle selected files                \n            }\n        };\n        \n        Belvedere.from(this).getFilesFromActivityOnResult(requestCode, resultCode, data, callback);\n    }\n}\n```\n\n#### API only\n\nSelect an image from the camera.\n\n```java\npublic class TestActivity extends AppCompatActivity {\n\n    private ImageStream imageStream;\n    private Button selectAttachmentFromCamera;\n    private Button selectAttachmentFromDocuments;\n    \n    // Make sure to manage a strong reference to the callback because Belvedere uses\n    // a WeakReference to avoid memory leaks\n    private Callback\u003cList\u003cMediaResult\u003e\u003e callback; \n\n    @Override\n    protected void onCreate(@Nullable Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        // ...\n\n        selectAttachmentFromCamera.setOnClickListener(new View.OnClickListener() {\n            @Override\n            public void onClick(View view) {\n                Belvedere.from(TestActivity.this)\n                        .camera()\n                        .open(TestActivity.this);\n            }\n        });\n\n        selectAttachmentFromDocuments.setOnClickListener(new View.OnClickListener() {\n            @Override\n            public void onClick(View view) {\n                Belvedere.from(TestActivity.this)\n                        .document()\n                        .open(TestActivity.this);\n            }\n        });\n    }\n\n    @Override\n    protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n        super.onActivityResult(requestCode, resultCode, data);\n        \n        callback = new Callback\u003cList\u003cMediaResult\u003e\u003e () {\n            @Override\n            public void success(List\u003cMediaResult\u003e result) {\n                // Handle selected files                \n            }\n        };\n        \n        Belvedere.from(this).getFilesFromActivityOnResult(requestCode, resultCode, data, callback);\n    }\n}\n```\n\n\n#### Place a file into Belvedere’s internal storage\nMoreover, it’s possible to put your own data into Belvedere’s cache. To get access to an internal file, call:\n\n```java\nMediaResult mediaResult = Belvedere.from(this).getFile(\"dire_name\", \"file_name.jpg\");\n```\nAgain, you’ll get a file object and a `Uri`. For example, you can use the file to open a `FileOutputStream`.\n\n#### Open or share an internal file\nFiles that are available through Belvedere could be opened or shared with other apps. To do that, use the `Uri` you get from a `BelvedereResult`.\n\nUse the first code snippet to open a file and the second one to share a file:\n\n```java\nIntent viewIntent = Belvedere.from(this).getViewIntent(mediaResult.getUri(), mediaResult.getMimeType());\nstartActivity(viewIntent);\n```\n\n```java\nIntent shareIntent = Belvedere.from(this).getShareIntent(mediaResult.getUri(), mediaResult.getMimeType());\nstartActivity(shareIntent);\n```\n\n### Picasso Compatibility\nSince version 3.0.0 Belvedere requires Picasso 2.8 or higher because of the migration to AndroidX.\n\n\n### Contributing\n\nBug reports, feature requests and contributions are very welcome. Please follow these steps to contribute:\n - Submit a Pull Request with a detailed explanation of changes and screenshots (if UI is changing). Tests would be great too!\n - One of the core team members will review your changes.\n - After successful code review, you’ll receive a :+1: and the changes will be merged by one of the core members.\n\nIf you’re submitting a bug report, please try to follow these steps:\n - Search through the open and closed issues, maybe there is already an issue describing exactly the same problem.\n - Describe the issue as detailed as possible. Try to describe the expected and the actual outcome.\n - Add reproduction steps. If possible provide sample code that showcases the issue.\n - Provide a failing test.\n\n### License\n```\nCopyright 2018 Zendesk\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzendesk%2Fbelvedere","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzendesk%2Fbelvedere","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzendesk%2Fbelvedere/lists"}