Flipping through Git's---history's strongest picture selector galleryfinal (incidentally, with a recent photo of Meg)

Source: Internet
Author: User
Tags image filter

Reprint please indicate the source: Wang 亟亟 's way of Daniel

Technical content in P2,P1 is nonsense can skip

P1: (Appetizer)

Recently the work on hand almost finished, can put more energy to spend on the study, or will continue to git this part of the article (Porter), and then prepare a full number of previously untouched knowledge points (specifically learn what did not think well, will look at it)

First, a recent photo of my baby.

P2: (Orthodox cuisine)

Today is a claim to be "the strongest picture selector in history" galleryfinal

Don't say a word about it first look at the effect

The author realizes almost all the functions of the "soap flakes" selector that we normally need, as well as some editing and image scaling functions.
Edit function from: Https://github.com/jdamcd/android-crop
Image zoom from: Https://github.com/chrisbanes/PhotoView

How to use

Grade:

‘cn.finalteam:galleryfinal:1.4.3‘‘com.android.support:support-v4:23.1.1‘

Eclipse:
。。。。。。。。 I don't know how to say ...

Here, wake up.

This project is compiled based on the SDK 23 (6.0) system, please change the targetsdkversion to 23

I'll explain how to use this library, which is different from our custom controls, or requires some configuration work (Picture loading section takes Imageloader as an example)

    1. Because of the things we use imageloader so we generally have to configure our Imageloader in application, like this
 Public  class iapplication extends application {    @Override     Public void onCreate() {Super. OnCreate ();//recommended to configure in application        //Set ThemeThemeconfig theme = Themeconfig.cyan Themeconfig theme =NewThemeconfig.builder (). build ();//Configuration functionFunctionconfig Functionconfig =NewFunctionconfig.builder (). Setenablecamera (true). Setenableedit (true)//. Setenablecrop (True). Setenablerotate (true). Setcropsquare (true). Setenablepreview (true). build (); Coreconfig Coreconfig =NewCoreconfig.builder ( This,NewUilimageloader (), theme). Setfunctionconfig (Functionconfig). Setpauseonscrolllistener (NewUilpauseonscrolllistener (false,true). build ();    Galleryfinal.init (Coreconfig); }}

Of course, you can also configure it in the activity, like this

private void Initimageloader (context context) {//This configuration tuning is custom. You can tune every option, your may tune some of them,//orYou can create the default configuration by//imageloaderconfiguration. Createdefault(this);Method. Imageloaderconfiguration. BuilderConfig = new Imageloaderconfiguration. Builder(context);Config. ThreadPriority(Thread. NORM_priority-2);Config. Denycacheimagemultiplesizesinmemory();Config. Diskcachefilenamegenerator(New Md5filenamegenerator ());Config. Diskcachesize( -*1024x768*1024x768);//MiBConfig. Tasksprocessingorder(Queueprocessingtype. LIFO);Config. Writedebuglogs();//Remove for release appInitialize imageloader with configuration. Imageloader. getinstance(). Init(config. Build());}

2. Configure a series of properties such as UI selector UI

Themeconfig theme = new Themeconfig. Builder()        .... Build();Can be used by default theme can also be customized to set icon Ah font color AH what, like this. Settitlebarbgcolor(Color. RGB(0xFF,0x57,0x22)). Settitlebartextcolor(Color. BLACK). Settitlebariconcolor(Color. BLACK). Setfabnornalcolor(Color. RED). Setfabpressedcolor(Color. BLUE). Setchecknornalcolor(Color. White). Setcheckselectedcolor(Color. BLACK). Seticonback(R. Mipmap. IC_action_previous_item). Seticonrotate(R. Mipmap. IC_action_repeat). Seticoncrop(R. Mipmap. IC_action_crop). Seticoncamera(R. Mipmap. IC_action_camera)

3. Function configuration, the configuration of the specific selector function rendering

//Configuration functionFunctionconfig Functionconfig =NewFunctionconfig.builder () .... Build ();//Can be set, as followsSetmutiselect (Boolean)//configuration is multi-selectSetmutiselectmaxsize (intMaxSize)//Configure multi-Select quantitySetenableedit (Boolean)//Turn on edit functionSetenablecrop (Boolean)//Turn on crop functionSetenablerotate (Boolean)//Turn on selection functionSetenablecamera (Boolean)//Turn on camera functionSetcropwidth (intWidth//Clipping widthSetcropheight (intHeight//Cut heightSetcropsquare (Boolean)//Crop squareSetSelected (List)//Add the selected list, just the default in the list the selection does not filter the pictureSetFilter (List List)//Add image filter, which is not displayed in GalleryfinalTakephotofolter (File file)//Configure photo Save directory, do not configure the default is/sdcard/dcim/galleryfinal/Setrotatereplacesource (Boolean)//Configure whether to replace the original picture when selecting a picture, default does not replaceSetcropreplacesource (Boolean)//Configure whether to replace the original picture when cropping the picture, default does not replaceSetforcecrop (Boolean)//Start the Force cropping function, one enters the editing page to turn on the picture clipping, does not need the user to manually click the crop, this function only for the single selection operationSetforcecropedit (Boolean)//Whether the picture can be edited when the Force cropping feature is turned on (that is, whether the rotate icon and the photo icon are displayed)Setenablepreview (Boolean)//Whether to turn on preview function

4. Main operation configuration (take photos, select albums, tailoring, etc.)

Coreconfig coreconfig = new Coreconfig. Builder(mainactivity. this, Imageloader, Themeconfig). Setfunctionconfig(functionconfig) .... Build();Then configure the specific action item Actionsheet. Createbuilder(mainactivity. this, Getsupportfragmentmanager ()) .... Show();The configurable content is as follows: Radio Open album: Galleryfinal. Opengallerysingle(Request_code_gallery, Monhanlderresultcallback);With configuration galleryfinal. Opengallerysingle(Request_code_gallery, Functionconfig, Monhanlderresultcallback);Multi-Select Open album Galleryfinal. Opengallerymuti(Request_code_gallery, Monhanlderresultcallback);with config functionconfig config = new Functionconfig. Builder(mainactivity. this). Setmutiselectmaxsize(8). Build();Galleryfinal. Opengallerymuti(Request_code_gallery, Functionconfig, Monhanlderresultcallback);Photo Galleryfinal. Opencamera(Request_code_camera, Monhanlderresultcallback);With configuration galleryfinal. Opencamera(Request_code_camera, Functionconfig, Monhanlderresultcallback);Crop galleryfinal. Opencrop(Request_code_camera, Monhanlderresultcallback);With configuration galleryfinal. Opencrop(Request_code_camera, Functionconfig, Monhanlderresultcallback);Photo Editor Galleryfinal. Openedit(Request_code_camera, Monhanlderresultcallback);With configuration galleryfinal. Openedit(Request_code_camera, Functionconfig, Monhanlderresultcallback);

Add a callback returned by an operation

  privatenew GalleryFinal.OnHanlderResultCallback() {        @Override        publicvoidonHanlderSuccess(int reqeustCode, List<PhotoInfo> resultList) {            ifnull) {                mPhotoList.addAll(resultList);                mChoosePhotoListAdapter.notifyDataSetChanged();            }        }

Then it can be used, it seems to need to configure the things very troublesome, but once set up can be used, the key function is powerful, configuration trouble will endure!!

Source Address: Https://github.com/ddwhan0123/GalleryFinal/archive/master.zip

Author Git:https://github.com/pengjianbo

Flipping through Git's---history's strongest picture selector galleryfinal (incidentally, with a recent photo of Meg)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.