All Projects → zendesk → Belvedere

zendesk / Belvedere

Licence: apache-2.0
An image picker library for Android

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Belvedere

Mediapicker
Media Picker is an Android Libary that lets you to select multiple images or video
Stars: ✭ 254 (+108.2%)
Mutual labels:  images, media, picker
Bottomsheet Imagepicker
Modern image picker for Android
Stars: ✭ 267 (+118.85%)
Mutual labels:  library, picker
android-pickpic
Ready to use library that allows people to select pictures from their device and Facebook account.
Stars: ✭ 12 (-90.16%)
Mutual labels:  images, picker
Laravel Medialibrary
Associate files with Eloquent models
Stars: ✭ 4,743 (+3787.7%)
Mutual labels:  images, media
server-media
This repository collects icons, logos & information about game servers.
Stars: ✭ 29 (-76.23%)
Mutual labels:  images, media
Lassi-Android
All in 1 picker library for android.
Stars: ✭ 108 (-11.48%)
Mutual labels:  images, picker
Imagestore
Open source google photos alternative!
Stars: ✭ 429 (+251.64%)
Mutual labels:  images, media
Filepicker
FilePicker library for Android
Stars: ✭ 181 (+48.36%)
Mutual labels:  media, picker
Louvre
A small customizable library useful to handle an gallery image pick action built-in your app. 🌄🌠
Stars: ✭ 629 (+415.57%)
Mutual labels:  library, picker
Silicompressor
A powerful, flexible and easy to use Video and Image compression library for Android.
Stars: ✭ 1,081 (+786.07%)
Mutual labels:  library, media
Instascrape
🚀 A fast and lightweight utility and Python library for downloading posts, stories, and highlights from Instagram.
Stars: ✭ 76 (-37.7%)
Mutual labels:  library, media
Yt Dlc
media downloader and library for various sites.
Stars: ✭ 2,590 (+2022.95%)
Mutual labels:  library, media
Jcplayer
🎵 A simple audio player for Android applications.
Stars: ✭ 209 (+71.31%)
Mutual labels:  library, media
Isobmff
C++ Library for ISO/IEC 14496-12 - ISO Base Media File Format (QuickTime, MPEG-4, HEIF, etc)
Stars: ✭ 157 (+28.69%)
Mutual labels:  library, media
Datepicker
A Date Picker with Calendar for iPhone and iPad Apps.
Stars: ✭ 103 (-15.57%)
Mutual labels:  library, picker
Ypimagepicker
📸 Instagram-like image picker & filters for iOS
Stars: ✭ 3,661 (+2900.82%)
Mutual labels:  library, picker
Linear Time Picker
Gorgeous Android Time and Date picker library inspired by the Timely app
Stars: ✭ 613 (+402.46%)
Mutual labels:  library, picker
Photoviewslider
📷 A simple photo browser for Android applications.
Stars: ✭ 78 (-36.07%)
Mutual labels:  library, images
Contentmanager
Android library for getting photo or video from a device gallery, cloud or camera. Working with samsung devices. Made by Stfalcon
Stars: ✭ 108 (-11.48%)
Mutual labels:  images, picker
Angular Open Source Starter
This is a starter project for creating open-source libraries for Angular. It is a full fledged Angular workspace with demo application and easy library addition. It is designed to be used for open-sourcing libraries on Github and has everything you'd need ready for CI, code coverage, SSR testing, StackBlitz demo deployment and more.
Stars: ✭ 120 (-1.64%)
Mutual labels:  library

Belvedere

Build Status License

A file picker for Android.

Overview

Belvedere 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.

Download

First add the Zendesk maven repository. This is a new step for versions 3.0.0-RC and newer.

maven {
    url 'https://zendesk.jfrog.io/zendesk/oss-releases-local'
}

Secondly, add Belvedere as a dependency:

implementation ‘com.zendesk.belvedere2:belvedere:3.0.0-RC’

Belvedere 3.0.0-RC and newer uses AndroidX and is recommended for use with Android 11.

How to use Belvedere

ImageStream

A simple implementation of the ImageStream looks like this:

public class TestActivity extends AppCompatActivity implements ImageStream.Listener {

    private ImageStream imageStream;
    private Button selectAttachment;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // ...

        imageStream = BelvedereUi.install(this);
        imageStream.addListener(this);

        selectAttachment.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                BelvedereUi.imageStream(getApplicationContext())
                        .withCameraIntent()
                        .withDocumentIntent("*/*", true)
                        .showPopup(TestActivity.this);
            }
        });
    }

    @Override
    public void onDismissed() {
        // Image Stream was dismissed
    }

    @Override
    public void onVisible() {
        // Image Stream was shown
    }

    @Override
    public void onMediaSelected(List<MediaResult> mediaResults) {
        // The user selected attachments
    }

    @Override
    public void onMediaDeselected(List<MediaResult> mediaResults) {
        // The user deselected attachments
    }
}

Dialog (from 1.x)

public class TestActivity extends AppCompatActivity {

    private ImageStream imageStream;
    private Button selectAttachment;
    
    // Make sure to manage a strong reference to the callback because Belvedere uses
    // a WeakReference to avoid memory leaks
    private Callback<List<MediaResult>> callback; 

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // ...

        selectAttachment.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Belvedere belvedere = Belvedere.from(this);
                MediaIntent document = belvedere.document().build();
                MediaIntent camera = belvedere.camera().build();

                BelvedereUi.showDialog(getSupportFragmentManager(), document, camera);
            }
        });
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        
        callback = new Callback<List<MediaResult>> () {
            @Override
            public void success(List<MediaResult> result) {
                // Handle selected files                
            }
        };
        
        Belvedere.from(this).getFilesFromActivityOnResult(requestCode, resultCode, data, callback);
    }
}

API only

Select an image from the camera.

public class TestActivity extends AppCompatActivity {

    private ImageStream imageStream;
    private Button selectAttachmentFromCamera;
    private Button selectAttachmentFromDocuments;
    
    // Make sure to manage a strong reference to the callback because Belvedere uses
    // a WeakReference to avoid memory leaks
    private Callback<List<MediaResult>> callback; 

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // ...

        selectAttachmentFromCamera.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Belvedere.from(TestActivity.this)
                        .camera()
                        .open(TestActivity.this);
            }
        });

        selectAttachmentFromDocuments.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Belvedere.from(TestActivity.this)
                        .document()
                        .open(TestActivity.this);
            }
        });
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        
        callback = new Callback<List<MediaResult>> () {
            @Override
            public void success(List<MediaResult> result) {
                // Handle selected files                
            }
        };
        
        Belvedere.from(this).getFilesFromActivityOnResult(requestCode, resultCode, data, callback);
    }
}

Place a file into Belvedere’s internal storage

Moreover, it’s possible to put your own data into Belvedere’s cache. To get access to an internal file, call:

MediaResult mediaResult = Belvedere.from(this).getFile("dire_name", "file_name.jpg");

Again, you’ll get a file object and a Uri. For example, you can use the file to open a FileOutputStream.

Open or share an internal file

Files that are available through Belvedere could be opened or shared with other apps. To do that, use the Uri you get from a BelvedereResult.

Use the first code snippet to open a file and the second one to share a file:

Intent viewIntent = Belvedere.from(this).getViewIntent(mediaResult.getUri(), mediaResult.getMimeType());
startActivity(viewIntent);
Intent shareIntent = Belvedere.from(this).getShareIntent(mediaResult.getUri(), mediaResult.getMimeType());
startActivity(shareIntent);

Picasso Compatibility

Since version 3.0.0 Belvedere requires Picasso 2.8 or higher because of the migration to AndroidX.

Contributing

Bug reports, feature requests and contributions are very welcome. Please follow these steps to contribute:

  • Submit a Pull Request with a detailed explanation of changes and screenshots (if UI is changing). Tests would be great too!
  • One of the core team members will review your changes.
  • After successful code review, you’ll receive a 👍 and the changes will be merged by one of the core members.

If you’re submitting a bug report, please try to follow these steps:

  • Search through the open and closed issues, maybe there is already an issue describing exactly the same problem.
  • Describe the issue as detailed as possible. Try to describe the expected and the actual outcome.
  • Add reproduction steps. If possible provide sample code that showcases the issue.
  • Provide a failing test.

License

Copyright 2018 Zendesk

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless 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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].