• Stars
    star
    109
  • Rank 319,077 (Top 7 %)
  • Language
    Java
  • Created over 8 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Android library for getting photo or video from a device gallery, cloud or camera. Working with samsung devices. Made by Stfalcon

ContentManager

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

Who we are

Need iOS and Android apps, MVP development or prototyping? Contact us via [email protected]. We develop software since 2009, and we're known experts in this field. Check out our portfolio and see more libraries from stfalcon-studio.

Download

Download via Gradle:

compile 'com.github.stfalcon:contentmanager:0.5'

or Maven:

<dependency>
  <groupId>com.github.stfalcon</groupId>
  <artifactId>contentmanager</artifactId>
  <version>0.5</version>
  <type>pom</type>
</dependency>

Migration to version 0.5

In 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. Also, we have added new cool feature: picking files with any types.

Usage

Add the folowing permission to AndroidManifest.xml:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Implement callback interface:

public class MainActivity extends AppCompatActivity implements ContentManager.PickContentListener {

Then implement PickContentListener methods:

/**
* Success result callback
*
* @param uri         Content uri
* @param contentType If you pick content can be Image or Video, if take - only Image
*/
@Override
public void onContentLoaded(Uri uri, String contentType) {
   if (contentType.equals(ContentManager.Content.IMAGE.toString())) {
       //You can use any library for display image Fresco, Picasso, ImageLoader
       //For sample:
       ImageLoader.getInstance().displayImage(uri.toString(), ivPicture);
   } else if (contentType.equals(ContentManager.Content.FILE.toString())) {
       //handle file result
       tvUri.setText(uri.toString());
   }
}
        
/**
* Call when loading started
*/
@Override
public void onStartContentLoading() {
  //Show loader or something like that
  progressBar.setVisibility(View.VISIBLE);
}

/**
* Call if have some problem with getting content
*
* @param error message
*/
@Override
public void onError(String error) {
  //Show error
}

/**
* Call if user manual cancel picking or taking content
*/
@Override
public void onCanceled() {
  //User canceled
}

Declare field:

private ContentManager contentManager;

Create instance where "this" is your activity:

contentManager = new ContentManager(this, this);

Override onActivityResult method of activity. It is needed for handling the result:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  super.onActivityResult(requestCode, resultCode, data);
  contentManager.onActivityResult(requestCode, resultCode, data);
}

Override onRequestPermissionsResult method to handle realtime permissions:

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
    super.onRequestPermissionsResult(requestCode, permissions, grantResults);
    contentManager.onRequestPermissionsResult(requestCode, permissions, grantResults);
}

Override onSaveInstanceState, onRestoreInstanceState. It is needed for fixing bugs with some Samsung and Sony devices when taking photo in a landscape mode:

@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
  super.onRestoreInstanceState(savedInstanceState);
  contentManager.onRestoreInstanceState(savedInstanceState);
}

@Override
protected void onSaveInstanceState(Bundle outState) {
  super.onSaveInstanceState(outState);
  contentManager.onSaveInstanceState(outState);
}

Pick image:

contentManager.pickContent(ContentManager.Content.IMAGE);

Pick video:

contentManager.pickContent(ContentManager.Content.VIDEO);

Pick file:

contentManager.pickContent(ContentManager.Content.FILE);

Take photo from camera:

contentManager.takePhoto();

Take a look at the sample project for more information

Thanks

Thanks to @coomar2841 and his Android Multipicker Library. We peeked at him some points in the implementation of picking files.

License

Copyright 2017 stfalcon.com

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.

More Repositories

1

ChatKit

Android library. Flexible components for chat UI implementation with flexible possibilities for styling, customizing and data management. Made by Stfalcon
Java
3,681
star
2

StfalconImageViewer

A simple and customizable Android full-screen image viewer with shared image transition support, "pinch to zoom" and "swipe to dismiss" gestures
Kotlin
1,996
star
3

FrescoImageViewer

Customizable Android full screen image viewer for Fresco library supporting "pinch to zoom" and "swipe to dismiss" gestures. Made by Stfalcon
Java
1,812
star
4

SmsVerifyCatcher

Android library for phone number verification feature in your app. Automatically copies verification code from SMS right into the app. Made by Stfalcon
Java
845
star
5

MultiImageView

Android library to display a few images in one ImageView like avatar of group chat. Made by Stfalcon
Kotlin
472
star
6

StfalconPriceRangeBar-android

Android library for adding price range with chart like in airbnb with flexible customization. Made by Stfalcon
Kotlin
227
star
7

UniversalPickerDialog

Android dialog with auto generated pickers inside, which depends on count of datasets provided. Made by Stfalcon
Java
138
star
8

SocialAuthHelper

Easy social network authorization for Android. Supports Facebook, Twitter, Instagram, Google+, Vkontakte. Made by Stfalcon
Java
98
star
9

swipeable-button

Android Swipeable button like in iOS unlock screen. Made by Stfalcon
Kotlin
87
star
10

stf-vue-select

stf vue select - most flexible and customized select
JavaScript
62
star
11

DataBindingExample

Sample project for the https://stfalcon.com/en/blog/post/faster-android-apps-with-databinding blogpost
Java
57
star
12

BottomTabLayout

Simple library for creating bottom tab layout. Made by Stfalcon
Java
48
star
13

code_example

Code example shows how we write our code, style and technology what we use
Java
47
star
14

AndroidMvvmHelper

Base classes for easy MVVM implementation for Android. Made by Stfalcon
Java
36
star
15

StfalconFixturer-android

Utility for developers and QAs what helps minimize time wasting on writing the same data for testing over and over again. Made by Stfalcon
Kotlin
29
star
16

uaroads_android

UaRoads is a unique service for road condition monitoring. It provides safety and comfort to drivers. Project goal is to build routes through better roads with surface of higher quality.
Kotlin
25
star
17

AndroidMVVMExample

Sample project for the https://stfalcon.com/en/blog/post/android-mvvm blogpost
Java
23
star
18

opencart-theme_tecart

Tecart is awesome OpenCart template. It's specially designed for electronics, computers, mobile stores. Intuitive navigation. Great colors combination of blue, green and gray. It's compatible with features of default template. All sub pages are carefully customized.
CSS
23
star
19

lost-and-found

Web-service for announcements of lost and found things.
PHP
21
star
20

vue-stories-instagram

Vue
17
star
21

ls-plugin_lsgallery

Плагин «LSGallery» предназначен для создания пользователем альбомов и загрузки в них фотографий. Поддерживает пакетную загрузку фотографий и различные настройки приватности для альбомов. Также позволяет отмечать друзей на фотографиях
PHP
17
star
22

MVPHelper

Base classes for quick and easy implementation of MVP for Android applications.
Kotlin
16
star
23

blog-samples

Samples for articles presented in stfalcon blog
Swift
16
star
24

patrol-android

An Android application for video registration of traffic rules violations. You can use this like video registrator. App`s can automatically send violations to our server.
Java
15
star
25

ls-plugin_banneroid

Плагин для удобного размещения и управлениями баннерами на LiveStreet сайтах. Добавление/редактирование/удаление баннеров. Возможность выбирать дату начала/окончания показов, место отображения и др.
PHP
12
star
26

ApiBundle

📦 Base classes and helper services to build API application via Symfony.
PHP
11
star
27

ls-theme_street-spirit

Яркая, в меру строгая и минималистичная тема для LiveStreet. Отличная замена стандартному шаблону.
Smarty
11
star
28

SocialToolKit

Easy social network authorization for iOS. Supports Facebook, Vkontakte and Instagramm
Swift
10
star
29

stfalcon-vue-di

Lightweight dependency injection library for Vue.js
JavaScript
10
star
30

ls-plugin_l10n

Плагин для реализации мультиязычности на LiveStreet сайте. Возможность выбора языка интерфейса при регистрации пользователя и его последующая смена в настройках профиля. Возможность создавать переводы для блогов и топиков.
PHP
10
star
31

staginator

Easily creation of staging environments
HTML
8
star
32

ls-plugin_sitemap

С помощью файла Sitemap веб-мастеры могут сообщать поисковым системам о веб-страницах, которые доступны для сканирования
PHP
7
star
33

patrol

Source code of http://патруль.com/
PHP
6
star
34

uaroads_ios

UaRoads is a unique service for road condition monitoring. It provides safety and comfort to drivers. Project goal is to build routes through better roads with surface of higher quality.
Swift
6
star
35

SwaggerBundle

📦 Creates a Swagger-ui page in Symfony application.
PHP
6
star
36

ls-plugin_seo

Основное предназначение плагина это автоматическая генерация мета тегов keywords и description в зависимости от контента страницы (это положительно влияет на индексацию сайта поисковыми системами и ранжирование их выдачи)
PHP
6
star
37

ls-plugin_debugtoolbar

Предназначен для вывода технической информации о работе сайта на LiveStreet
JavaScript
5
star
38

ls-plugin_similar

Выводит список похожих записей как блок в сайдбаре. Записи сортирует по количеству совпавших тегов и дате/рейтингу.
PHP
5
star
39

ls-plugin_greeting

Плагин предназначен для рассылки приветсвий новым пользователя в LiveStreet CMS. Например, в тексте сообщения можно благодарить пользователя за регистрацию и дать ему ссылки на страницу помощи или общих вопросов по работе с сайтом
PHP
5
star
40

ls-plugin_mailing

Плагин для рассылок сообщений на LiveStreet сайтах с большим количеством пользователей. Есть возможность фильтра получателей по свойству «Пол» («мужчины», «женщины», «не указан») и по свойству «Язык» (интеграция с плагином «L10n»). Можно посмотреть список рассылок и статус хода рассылки
PHP
5
star
41

codedill

Web service for creating study tasks for developers and evaluating solutions anonymously.
PHP
5
star
42

ls-plugin_lsdigest

Плагин предназначен для рассылки дайджестов лучших записей за определенное время. Для работы плагина требуется плагин рассылок "Mailing"
PHP
5
star
43

DoctrineRedisCacheBundle

📦 Add custom namespace for doctrine cache pools.
PHP
4
star
44

zabbix-unifi-video

Zabbix monitoring for Unifi Video
Ruby
4
star
45

StfalconFixturer-ios

Utility for developers and QAs what helps minimize time wasting on writing the same data for testing over and over again. Made by Stfalcon
Swift
4
star
46

captainfailure

Distributed monitoring system.
Ruby
4
star
47

AbTestBundle

PHP
4
star
48

uaroads_wp

Windows Phone application for uaroads.com
C#
4
star
49

ls-plugin_treeblogs

LiveStreet plugin. Tree blogs
PHP
4
star
50

android-simple-weather

Java
3
star
51

ls-plugin_topicextend

LiveStreet plugin. Предназначен для расширения функционала создания топика
PHP
3
star
52

vue-bankid-se

JavaScript
3
star
53

wp-theme_snowberry

Simple and clean wordpress theme with nice contrast headers. Good readability of text. Perfect theme for personal blogs. Based on HTML of Twenty Eleven
PHP
3
star
54

patrol-ios

An iOS application for video registration of traffic rules violations. You can use this like video registrator. App`s can automatically send violations to our server.
Objective-C
3
star
55

ukrainealarm-python-client

Python
3
star
56

StfalconContentPicker

Swift
3
star
57

SwiftExtensions

SwiftExtension is a bunch of useful extension, that we are using at Stfalcon
Swift
3
star
58

world-sights

PHP
3
star
59

lost-and-found-android

Android application for Web-service "Lost and Found"
Java
3
star
60

rock-events

PHP
3
star
61

android_unlocker-3d

Анлокер для Android, который позволяет разблокировать девайс при помощи ранее записанного жеста
Java
3
star
62

ls-plugin_openidcmt

При отправке комментария гость увидит всплывающее окошко авторизации/регистрации, а после авторизации/регистрации его комментарий появится на сайте. Плагин может работать совместно с плагином OpenId (что удобней для гостей сайта) или без него.
PHP
3
star
63

stfalcon-vuex-loading-plugin

JavaScript
2
star
64

stf-angular-select

TypeScript
2
star
65

opencart-plugin_easy-export-import

OpenCart plugin for easy export and import of goods
PHP
2
star
66

android_organizer

Java
2
star
67

android_mtproto-vk-challenge

Приложение для первого тура Durov's Android Challenge
Java
2
star
68

brain-warm-up_v1-game

PHP
2
star
69

sphinxsearch-docker

Puppet
2
star
70

stfalcon-studio.github.io

Websit for stfalcon projects, hosted directly from GitHub repository
HTML
2
star
71

GoogleAwarenessDemo

Kotlin
2
star
72

ls-plugin_usewatermark

Плагин дает пользователю возможность выбора накладывать на загружаемое изображение водяной знак или нет. Также плагин может делать бекап оригиналов закачиваемых изображений до накладывания водяного знака (на случай если вы захотите отказаться от водяных знаков)
PHP
2
star
73

stf-input-list-filter

JavaScript
1
star
74

SonataTranslationBundle

PHP
1
star
75

brain-warm-up_v2-crossword

Algorithmic task in the way of a game. Correct solutions are checked by the automatic unit tests
PHP
1
star
76

android_template_project

Kotlin
1
star
77

dng2jpg

Конвертер графических файлов из формата DNG в формат JPEG
C++
1
star
78

stf-ng-select

The most flexible, reusable and customise select
TypeScript
1
star
79

magento-theme_metriksq

Free Magento theme
1
star
80

ls-plugin_gallery2lsgallery-convertor

Плагин для конвертации данных из старого плагина галереии (от extravert) в фортам LSGallery.
PHP
1
star
81

ls-plugin_lssettings

PHP
1
star
82

YouTubeLikeFeed

Kotlin
1
star