{"id":20447210,"url":"https://github.com/stfalcon-studio/contentmanager","last_synced_at":"2025-04-13T01:07:18.553Z","repository":{"id":77717301,"uuid":"63158494","full_name":"stfalcon-studio/ContentManager","owner":"stfalcon-studio","description":"Android library for getting photo or video from a device gallery, cloud or camera. Working with samsung devices. Made by Stfalcon","archived":false,"fork":false,"pushed_at":"2017-07-19T08:04:57.000Z","size":72,"stargazers_count":109,"open_issues_count":4,"forks_count":23,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-10T18:06:43.173Z","etag":null,"topics":["android","camera","files","images","picker","videos"],"latest_commit_sha":null,"homepage":"https://stfalcon.com","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/stfalcon-studio.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,"governance":null}},"created_at":"2016-07-12T13:05:21.000Z","updated_at":"2024-09-21T12:52:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"428e2cc4-d794-45e9-a1fd-2538f3528de2","html_url":"https://github.com/stfalcon-studio/ContentManager","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/stfalcon-studio%2FContentManager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stfalcon-studio%2FContentManager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stfalcon-studio%2FContentManager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stfalcon-studio%2FContentManager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stfalcon-studio","download_url":"https://codeload.github.com/stfalcon-studio/ContentManager/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248650727,"owners_count":21139680,"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","camera","files","images","picker","videos"],"created_at":"2024-11-15T10:25:11.798Z","updated_at":"2025-04-13T01:07:18.526Z","avatar_url":"https://github.com/stfalcon-studio.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ContentManager\nLibrary for getting photos, videos or files of any type from a device gallery, external storage, cloud(Google Drive, Dropbox and etc) or camera. With asynchronous load from the cloud and fixed bugs for some problem devices like Samsung or Sony.\n\n### Who we are\nNeed iOS and Android apps, MVP development or prototyping? Contact us via info@stfalcon.com. We develop software since 2009, and we're known experts in this field. Check out our [portfolio](https://stfalcon.com/en/portfolio) and see more libraries from [stfalcon-studio](https://stfalcon-studio.github.io/).\n\n### Download\n\nDownload via Gradle:\n```gradle\ncompile 'com.github.stfalcon:contentmanager:0.5'\n```\n\nor Maven:\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.github.stfalcon\u003c/groupId\u003e\n  \u003cartifactId\u003econtentmanager\u003c/artifactId\u003e\n  \u003cversion\u003e0.5\u003c/version\u003e\n  \u003ctype\u003epom\u003c/type\u003e\n\u003c/dependency\u003e\n```\n\n### Migration to version 0.5\n\nIn version 0.5 we have removed callback ```onLoadContentProgress(int loadPercent)```(because it is very hard to calculate loadPercent correctly) and replaced it with callback ```onStartContentLoading()``` to handle a start of loading content. So if you are using ContentManager previous version, you need to make some correction after updating ContentManager version to 0.5.\nAlso, we have added new cool feature: picking files with any types.\n\n### Usage\n\nAdd the folowing permission to AndroidManifest.xml:\n```xml\n\u003cuses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\" /\u003e\n```\n\nImplement callback interface:\n```java\npublic class MainActivity extends AppCompatActivity implements ContentManager.PickContentListener {\n```\n\nThen implement PickContentListener methods:\n```java\n/**\n* Success result callback\n*\n* @param uri         Content uri\n* @param contentType If you pick content can be Image or Video, if take - only Image\n*/\n@Override\npublic void onContentLoaded(Uri uri, String contentType) {\n   if (contentType.equals(ContentManager.Content.IMAGE.toString())) {\n       //You can use any library for display image Fresco, Picasso, ImageLoader\n       //For sample:\n       ImageLoader.getInstance().displayImage(uri.toString(), ivPicture);\n   } else if (contentType.equals(ContentManager.Content.FILE.toString())) {\n       //handle file result\n       tvUri.setText(uri.toString());\n   }\n}\n        \n/**\n* Call when loading started\n*/\n@Override\npublic void onStartContentLoading() {\n  //Show loader or something like that\n  progressBar.setVisibility(View.VISIBLE);\n}\n\n/**\n* Call if have some problem with getting content\n*\n* @param error message\n*/\n@Override\npublic void onError(String error) {\n  //Show error\n}\n\n/**\n* Call if user manual cancel picking or taking content\n*/\n@Override\npublic void onCanceled() {\n  //User canceled\n}\n```\n\n\nDeclare field:\n```java\nprivate ContentManager contentManager;\n```\n\nCreate instance where \"this\" is your activity:\n```java\ncontentManager = new ContentManager(this, this);\n```\n\nOverride onActivityResult method of activity. It is needed for handling the result:\n```java\n@Override\nprotected void onActivityResult(int requestCode, int resultCode, Intent data) {\n  super.onActivityResult(requestCode, resultCode, data);\n  contentManager.onActivityResult(requestCode, resultCode, data);\n}\n```\n\nOverride onRequestPermissionsResult method to handle realtime permissions:\n```java\n@Override\npublic void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {\n    super.onRequestPermissionsResult(requestCode, permissions, grantResults);\n    contentManager.onRequestPermissionsResult(requestCode, permissions, grantResults);\n}\n```\n\nOverride onSaveInstanceState, onRestoreInstanceState. It is needed for fixing bugs with some Samsung and Sony devices when taking photo in a landscape mode:\n```java\n@Override\nprotected void onRestoreInstanceState(Bundle savedInstanceState) {\n  super.onRestoreInstanceState(savedInstanceState);\n  contentManager.onRestoreInstanceState(savedInstanceState);\n}\n\n@Override\nprotected void onSaveInstanceState(Bundle outState) {\n  super.onSaveInstanceState(outState);\n  contentManager.onSaveInstanceState(outState);\n}\n```\n\nPick image: \n```java\ncontentManager.pickContent(ContentManager.Content.IMAGE);\n```\n\nPick video:\n```jave\ncontentManager.pickContent(ContentManager.Content.VIDEO);\n```\n\nPick file:\n```java\ncontentManager.pickContent(ContentManager.Content.FILE);\n```\n\nTake photo from camera:\n```\ncontentManager.takePhoto();\n```\n\nTake a look at the [sample project](sample) for more information\n\n### Thanks\nThanks to [@coomar2841](https://github.com/coomar2841) and his [Android Multipicker Library](https://github.com/coomar2841/android-multipicker-library). We peeked at him some points in the implementation of picking files.\n\n### License \n\n```\nCopyright 2017 stfalcon.com\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n\n\n\n[sample]: \u003chttps://github.com/stfalcon-studio/ContentManager/tree/master/sample\u003e\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstfalcon-studio%2Fcontentmanager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstfalcon-studio%2Fcontentmanager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstfalcon-studio%2Fcontentmanager/lists"}