博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
MediaChooser图库浏览器
阅读量:6593 次
发布时间:2019-06-24

本文共 3658 字,大约阅读时间需要 12 分钟。

MediaChooser Android库 MediaChooser是一个库,浏览并选择视频和图像从SD卡。它可以用来显示文件中查看图像和视频(显示所有文件)或文件夹视图(显示文件分类)。项目按日期,时间与最新的产品呈现先排序。https://github.com/learnNcode/MediaChooser

 

Media Chooser

Library to browse & select videos and images from disk.

Screenshots

 

Setup

Add following permission to your applications manifest file.

Add following code to the application node of your application's manifest file

ChangeLog

Version 1.0.5

1] Updated picasso jar.

2] Preview file on item longpress.

3] Removed deprecated code.

Version 1.0.4

1] Fixed tab content issue.

Version 1.0.3

1] Fixed video icon visibility when video tab selected.

Version 1.0.2

1] Fixed blank image tab or video tab issue.

Version 1.0.1

1] Fixed nexus 10 crash.

2] Added helper methods for ease.

What does this library do ?

Useful library for selecting images and videos from sd-card. The library can be used to display images & videos in file view or folder view. File view shows all files whereas Folder view shows files categorized. All items are sorted according to date-time with latest item showing first.

Usage

To display images and videos according to:

1] Folders

Intent intent = new Intent(MainActivity.this, BucketHomeFragmentActivity.class); startActivity(intent);

2] Files

Intent intent = new Intent(MainActivity.this, HomeFragmentActivity.class); startActivity(intent);

To get list of selected images and videos :

1] For images you have to register a broadcast with

MediaChooser.IMAGE_SELECTED_ACTION_FROM_MEDIA_CHOOSERaction.

Example:

IntentFilter imageIntentFilter = new IntentFilter(MediaChooser.IMAGE_SELECTED_ACTION_FROM_MEDIA_CHOOSER); registerReceiver(imageBroadcastReceiver, imageIntentFilter);

2] For videos you have to register a broadcast with MediaChooser.VIDEO_SELECTED_ACTION_FROM_MEDIA_CHOOSER action.

Example:

IntentFilter videoIntentFilter = new IntentFilter(MediaChooser.VIDEO_SELECTED_ACTION_FROM_MEDIA_CHOOSER); registerReceiver(videoBroadcastReceiver, videoIntentFilter);

Helper methods

1] showCameraVideoView : To hide/show camera button. example:

MediaChooser.showCameraVideoView(false); // This will hide the view. By default its visible.

2] setImageSize and setVideoSize : To set file size limit in mb for image/video selection. example:

MediaChooser.setVideoSize(10); // Default set to 20mb.MediaChooser.setImageSize(10); // Default set to 20mb.

3] setSelectionLimit : To set number of items that can be selected. example:

MediaChooser.setSelectionLimit(10);  //default set to 100.

4] setSelectedMediaCount / getSelectedMediaCount : To set/retrieve total selected file count. example:

int totalCount = MediaChooser.getSelectedMediaCount();

5] showOnlyImageTab :- To show image tab only. example:

MediaChooser.showOnlyImageTab();

6] showOnlyVideoTab :- To show video tab only. example:

MediaChooser.showOnlyVideoTab();

7] showImageVideoTab : To display both image and video tab. example:

MediaChooser.showImageVideoTab(); //By default both tabs are visible.

Check the attached demo sample app.

Acknowledgement

License

Copyright 2013 learnNcode (learnncode@gmail.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.0Unless required by applicable law or agreed to in writing, softwaredistributed 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 andlimitations under the License.

Thank You

If you like our work say a Hi :)

Happy Coding Happy Learning.

转载地址:http://nodio.baihongyu.com/

你可能感兴趣的文章
跟我一起考PMP--项目人力资源管理
查看>>
【虚拟化实战】存储设计之七Block Size
查看>>
烂泥:记一次诡异的网络中断
查看>>
在 SELECT 查询中使用集运算符
查看>>
UITableView 延迟加载图片的例子
查看>>
控制IMG图片的大小缩放
查看>>
Visual C++ 时尚编程百例006(快捷键)
查看>>
ASP.NET MVC3 系列教程 - 如何使项目Debug进MVC3源代码
查看>>
操作步骤:用ildasm/ilasm修改IL代码
查看>>
HTTP POST GET 本质区别详解
查看>>
【java】构建工具,maven,ant,gradlew
查看>>
51驱动1602液晶显示器的程序
查看>>
委托-利用GetInvocationList处理链式委托
查看>>
正则表达式 之 C#后台应用
查看>>
[Android] 深入浅出Android App耗电量统计
查看>>
对称加密与非对称加密
查看>>
docker学习(5) 在mac中创建mysql docker容器
查看>>
【C语言】字符串替换空格:实现一个函数,把字符串里的空格替换成“%20”
查看>>
C语言--函数
查看>>
BZOJ4605 : 崂山白花蛇草水
查看>>