boxing

½éÉÜ£º

»ùÓÚMVPģʽµÄAndroid¶àýÌåÑ¡ÔñÆ÷£­Bilibili

ÔËÐÐЧ¹û£º

ʹÓÃ˵Ã÷£º

ÌØÐÔ


  • Ö§³Ö×Ô¶¨ÒåUI

  • Ö§³Ö¶à/µ¥Í¼Æ¬Ñ¡ÔñºÍÔ¤ÀÀ£¬µ¥Í¼²Ã¼ô¹¦ÄÜ

  • Ö§³Ögif

  • Ö§³ÖÊÓƵѡÔñ¹¦ÄÜ

  • ÌṩͼƬѹËõ

Download


ºËÐÄ°æ±¾£ºÖ»°üº¬ºËÐŦÄÜ¡£ ʵÏÖ°æ±¾£ºÔÚºËÐŦÄÜÖ®ÉÏÌí¼ÓÁËʵÏÖ½çÃæ¡£

  • Maven
    ºËÐÄ°æ±¾
<dependency>                                                      
    <groupId>com.bilibili</groupId>                                    
    <artifactId>boxing</artifactId>                                    
    <version>0.2.0</version>                                       
    <type>pom</type>                                                
</dependency>

ʵÏÖ°æ±¾

<dependency>                                                          
    <groupId>com.bilibili</groupId>                                    
    <artifactId>boxing-impl</artifactId>                              
    <version>0.2.0</version>                                       
    <type>pom</type>                                                  
</dependency>
  • Gradle

    ºËÐÄ°æ±¾

compile 'com.bilibili:boxing:0.2.0'

ʵÏÖ°æ±¾

compile 'com.bilibili:boxing-impl:0.2.0'

¼òµ¥Ó÷¨

  • ³õʼ»¯Í¼Æ¬¼ÓÔØ£¨±ØÑ¡£©
BoxingMediaLoader.getInstance().init(new IBoxingMediaLoader()); // ÐèҪʵÏÖIBoxingMediaLoader
  • ³õʼ»¯Í¼Æ¬²Ã¼ô£¨¿ÉÑ¡£©
BoxingCrop.getInstance().init(new IBoxingCrop());  // ÐèҪʵÏÖ IBoxingCrop
  • ¹¹Ôì²ÎÊý Ö¸¶¨Ä£Ê½£ºÍ¼Æ¬µ¥Ñ¡£¬¶àÑ¡£¬ÊÓƵµ¥Ñ¡£¬ÊÇ·ñÖ§³ÖgifºÍÏà»ú¡£
BoxingConfig config = new BoxingConfig(Mode); // Mode£ºMode.SINGLE_IMG, Mode.MULTI_IMG, Mode.VIDEO
config.needCamera().needGif().withMaxCount(9); // Ö§³Ögif,Ïà»ú£¬ÉèÖÃ×î´óѡͼÊý
  • ³õʼ»¯Boxing£¬¹¹ÔìIntent²¢Æô¶¯
// Æô¶¯ËõÂÔͼ½çÃæ, ÒÀÀµ
boxing-impl.Boxing.of(config).withIntent(context, BoxingActivity.class).start(callerActivity, REQUEST_CODE); 
// Æô¶¯Ô¤ÀÀԭͼ½çÃ棬ÒÀÀµ
boxing-impl.Boxing.of(config).withIntent(context, BoxingViewActivity.class).start(callerActivity, REQUEST_CODE); 
// µ÷ÓÃof·½·¨Ä¬ÈÏʹÓÃ
Mode.MULTI_IMGBoxing.of().withIntent(context, class).start(callerActivity, REQUEST_CODE);
  • È¡½á¹û
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {    
    List<BaseMedia> medias = Boxing.getResult(data);    
    //×¢ÒâÅжÏnull
}

½ø½×Ó÷¨

³õʼ»¯Í¼Æ¬¼ÓÔغͲüôͬÉÏ¡£

  • ×Ô¶¨ÒåActivityÓëFragment ¼Ì³ÐAbsBoxingViewActivityºÍAbsBoxingViewFragment¡£ µ÷ÓÃBoxing.of(config).withIntent(context, class).start(callerActivity, REQUEST_CODE);Æô¶¯¡£

  • ½ö×Ô¶¨ÒåFragment ¼Ì³ÐAbsBoxingViewFragment£¬²»ÒÀÀµAbsBoxingViewActivity¡£ µ÷ÓÃBoxing.of(BoxingConfig).setupFragment(AbsBoxingViewFragment, OnFinishListener);Íê³ÉÅäÖá£

FileProvider

Android N °æ±¾Ê¹ÓÃÏà»ú±ØÐëÔÚAndroidManifest.xmlÖÐÌí¼Ó

<provider                                                 
    android:name="android.support.v4.content.FileProvider"
    android:authorities="${applicationId}.file.provider" >               
    <meta-data                                            
        android:name="android.support.FILE_PROVIDER_PATHS"
        android:resource="@xml/boxing_file_provider"/>
</provider>
已下载
0