PhotoPick-Master
I have pulled out the gallery made in the project, which includes the following contents: 2. View large images (including SD cards, RES, network images) and save them to your mobile gallery. 3. Adapt the immersive status bar.
Take a look at some of the renderings below:
You can download APK and run it first. Apk is quite large, and there are several large long images in it
The project has been mounted on Github. If you need it, welcome to fork. You can leave a message here if there is any issue of the project, or click here to commit. I hope I can help you.
## How to introduce compile into your project ## # How to introduce compile into your project ##
Add the following code to your root Gradle (the outermost layer of your project)
allprojects { repositories { google() mavenCentral() jcenter() maven { url 'https://jitpack.io' } } } ext { android = [ CompileSdkVersion: 28, // set buildToolsVersion: '28.0.3' for your project, // set targetSdkVersion for your project: // Android supportVersion frescoVersion: '1.11.0' // Android supportVersion frescoVersion: '1.11.0']}Copy the code
Add the following dependencies to your module gradle dependencies
implementation "com.android.support:appcompat-v7:${rootProject.ext.android.supportVersion}" implementation "com.android.support:recyclerview-v7:${rootProject.ext.android.supportVersion}" implementation "Com. Facebook. Fresco" : fresco ": ${rootProject. Ext. Android. FrescoVersion}" / / support GIF dynamic figure, Need to add the implementation "com. Facebook. Fresco" : animated - GIF: ${rootProject. Ext. Android. FrescoVersion} "/ / support WebP (static figure + dynamic figure), Need to add the implementation "com. Facebook. Fresco" : animated - webp: ${rootProject. Ext. Android. FrescoVersion} "implementation "Com. Facebook. Fresco" : webpsupport: ${rootProject. Ext. Android. FrescoVersion} "/ / viewpager point implementation 'me relex: circleindicator: 1.1.8 @ aar' / / slip control panel, the project potopick included use case implementation 'com. Sothree. Slidinguppanel: library: 3.3.0' / / android6.0 permissions utility class implementation 'com. Lovedise: permissiongen: while' / / load for super long figure library implementation 'com. Davemorrissey. LABS: subsampling - scale - image - view: 3.9.0' implementation "Com. Android. Support: support - v4: ${rootProject. Ext. Android. SupportVersion}" / / gallery implementation 'com. Making. Gongzhiq: PhotoPick - Master: v2.08'Copy the code
3. Then initialize it in your Application’s onCreate() method
public class App extends Application { @Override public void onCreate() { super.onCreate(); FrescoImageLoader.init(this); / / below is the configuration toolbar color pictures and address / / FrescoImageLoader init (this, android R.c olor. Holo_blue_light); // FrescoImageLoader.init(this,android.R.color.holo_blue_light,"/storage/xxxx/xxx"); }}Copy the code
## How to use it
-
Hao to Use (can be dynamically set parameters, not used)
-
gallery
New photopickconfig.builder (this).pickMode(photopickconfig.mode_multip_pick) // MaxPickSize (15) // maxPickSize(15). ShowCamera (false) // Whether to display the camera icon, the default display. ClipPhoto (true) // Whether to select the image to crop, SpanCount (4) // The number of columns in the gallery. The default is 3 columns, This number is too big is not recommended. ShowGif (true). / / whether the default true / / display GIF setOnPhotoResultCallback (OnPhotoResultCallback OnPhotoResultCallback) Build () if you don't want the Activity to get the data back from onActivityResult();Copy the code
- Gets the address of the image selected (or cropped) by the gallery
Method one: new PhotoPickConfig.Builder(this) .pickMode(PhotoPickConfig.MODE_MULTIP_PICK) .maxPickSize(15) .showCamera(true) SetOriginalPicture (true) / / let the original image. The user can select setOnPhotoResultCallback (new PhotoPickConfig. Builder. OnPhotoResultCallback () { @Override public void onResult(PhotoResultBean result) { Log.e("MainActivity", "result = " + result.getPhotoLists().size()); } }) .build(); Method 2: @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode ! = Activity.RESULT_OK || data == null) { return; } switch (requestCode) { case PhotoPickConfig.PICK_REQUEST_CODE: Collection/images/return address ArrayList < String > photoLists = data. GetStringArrayListExtra (PhotoPickConfig. EXTRA_STRING_ARRAYLIST); if (photoLists ! = null && ! photoLists.isEmpty()) { File file = new File(photoLists.get(0)); If (file.exists()) {//you can do something else {//toast error}} break; }}Copy the code
- To view a larger version
New PhotoPagerConfig. Builder (this). SetBigImageUrls (ImageProvider. GetImageUrls ()) / / big picture url, can be a sd card res, asset, .setSmAlLimageurls (ArrayList<String> smallImgUrls) // The url of the small image, used to display before the big image. AddSingleBigImageUrl (String bigImageUrl) AddSingleSmallImageUrl (String smallImageUrl) // Add small images to arrayList.setSavaimage (true) // SetSaveImageLocalPath ("Android/SD/ XXX/XXX ") // Here is the address where you want to save the large image to the phone, which can be seen in the phone gallery. SetOpenDownAnimate (false).setopenDownanimate (false).setopenDownanimate (false).setopenDownanimate (false).setopenDownanimate (false) This function is enabled by default. Similar to wechat picture browsing, can slide off the same.build(); New photopagerConfig. Builder(this,Class<? > clazz) // Here you pass in your custom Activity class. Your custom Activity must inherit PhotoPagerActivity... . . .build();Copy the code
- confusion
Refer to the proguard-rules file in simpleCopy the code
v2.1
The 2019-04-11 implementation ‘com. Making. Gongzhiq: PhotoPick – Master: v2.05’ repair flash back problems
v2.1
The 2019-01-17 implementation ‘com. Making. Awent: PhotoPick – Master: v2.04’ fix: fix (# 7)
v2.0
The 2018-10-25 implementation ‘com. Making. Awent: PhotoPick – Master: v2.02’
v1.9
The 2018-10-16 compile ‘com. Making. Awent: PhotoPick – Master: v1.096’
Fixed: Failed to save pictures by viewing large network pictures
v1.8
2018-1-0 compile ‘com. Making. Awent: PhotoPick – Master: v1.095’
v1.7
The 2017-12-22 compile ‘com. Making. Awent: PhotoPick – Master: v1.094’
Fixed: bug: 8.0 + Java. Lang. An IllegalStateException: Only fullscreen opaque activities can request “orientation
Optimization: Remove the manifest registration activity step
v1.6
The 2017-11-10 compile ‘com. Making. Awent: PhotoPick – Master: v1.092’
Optimization: 1, picture pull down multiple finger operation no longer lead to picture dislocation 2, solve the picture multiple finger zoom and picture pull down conflict problem 3, optimize the picture pull down close activity excessive animation 4, think small picture name using low word is not very good, the related API has been changed to small, old API is not affected
Ps: You are advised to update the latest version
v1.5.1
The 2017-10-28 compile ‘com. Making. Awent: PhotoPick – Master: v1.09’
Optimization: loading of super-long graphs
v1.5
2017-10-25
The compile ‘com. Making. Awent: PhotoPick – Master: v1.08’
.setopendownanimate (false).setopenanimate (false).setopendownanimate (false).setopendownanimate (false).setopendownanimate (false).setopendownanimate (false).setopenDownanimate (false) Android: theme = “@ style/PhoAppTheme. Transparent” 2, view a larger gallery, images can be invaded the navigation bar
Fixed: Fixed a crash when viewing gallery on some phones
Optimization: remove the imitation wechat picture return effect, because the effect feels too bad, it has been removed, and then put out after optimization
v1.4
2017-10-08
The compile ‘com. Making. Awent: PhotoPick – Master: v1.07’
Add ext to root Gradle. Gradle configures it for its own project. Optimized custom image browsers for transferring your own data through bundles. For details, see MyPhotoPagerActivity in Demo
v1.311
2017-09-17
The compile ‘com. Making. Awent: PhotoPick – Master: v1.06’
Feature:
1, the gallery of return data, is not limited in the Activity, realizes PhotoPickConfig anywhere. Builder. OnPhotoResultCallback interfaces are available
2, the image browser can extend its own interface, refer to the Demo MyPhotoPagerActivity
3. Support browsing of long graph (including horizontal and vertical) and WebP images. For long graph of network, the width should be better than 400, so that the whole screen can be filled and the experience is better
4, gallery selection can be previewed, view the network map can be similar to wechat mobile effect
Optimization:
1, large picture loading progress bar imitation wechat
2. For loading local or RES/asset large images, see FrescoImageLoader
3. Optimize image loading memory
Update build version to 26
Ps: If the build fails after downloading the demo, it should be caused by the network being unable to climb the wall, so you can use the blue light to climb the wall globally
v1.31
The 2017-04-10 PM – 17:00
Gradle update to 3.4
AddSingleBigImageUrl (String bigImageUrl) and addSingleLowImageUrl(String lowImageUrl) please update to the latest library
v1.3
2017-02-19pm – 10:00 Fix the lable replacement bug in the APLICATION file and update it to the latest library
v1.2
Draw projects into a Library format that makes it easier to incorporate them into your projects
v1.1
2017-01-10 PM-19:00 New picture download display circular progress bar and download percentage, new imitation wechat picture preview, GIF playback, and can save GIF to local gallery
v1.0.1
The PM – 2016-9-04-17: 00 P: Recently, the developer realized that the previous code design was a little dirty, and it was a little troublesome to change, so now we change a method, and configure parameters in Javabean, so that the modification is more convenient and clear, pay attention to the confusion when the project packaging, remember the Javabean here do not confuse. Because the Javabean implements the Parcelable interface, you can see the ‘Proguard-rules.pro’ file in the code for details. In addition, there are two new content: 1, Android6.0 permission adaptation, 2, show the small picture before the big picture. Details can be seen in the project code, I have updated to Github.