Name: boxing
Owner: bilibili
Description: Android multi-media selector based on MVP mode.
Created: 2017-01-22 07:04:34.0
Updated: 2018-05-24 11:58:36.0
Pushed: 2018-05-24 11:58:34.0
Homepage: null
Size: 1602
Language: Java
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Android multi-media selector based on MVP mode.????
Core version: only contain the core function.
UI version: contain UI implements base on core version.
Core version
endency>
<groupId>com.bilibili</groupId>
<artifactId>boxing</artifactId>
<version>1.0.2</version>
<type>pom</type>
pendency>
UI version
endency>
<groupId>com.bilibili</groupId>
<artifactId>boxing-impl</artifactId>
<version>1.0.2</version>
<type>pom</type>
pendency>
Core version
ile 'com.bilibili:boxing:1.0.2'
UI version
ile 'com.bilibili:boxing-impl:1.0.2'
Media loading initialization(required)
ngMediaLoader.getInstance().init(new IBoxingMediaLoader()); // a class implements IBoxingMediaLoader
Image cropping initialization(optional)
ngCrop.getInstance().init(new IBoxingCrop()); // a class implements IBoxingCrop
Build BoxingConfig Specify the mode(Mode.SINGLE_IMG, Mode.MULTI_IMG, Mode.VIDEO) with camera and gif support.
ngConfig config = new BoxingConfig(Mode); // Mode?Mode.SINGLE_IMG, Mode.MULTI_IMG, Mode.VIDEO
ig.needCamera(cameraRes).needGif().withMaxCount(9) // camera, gif support, set selected images count
hMediaPlaceHolderRes(resInt) // set the image placeholder, default 0
hAlbumPlaceHolderRes(resInt) // set the album placeholder, default 0
hVideoDurationRes(resInt) // set the video duration resource in video mode, default 0
Get Boxing, set Intent and call start
tart thumbnails Activity, need boxing-impl.
ng.of(config).withIntent(context, BoxingActivity.class).start(callerActivity, REQUEST_CODE);
// start view raw image Activity, need boxing-impl. Boxing.of(config).withIntent(context, BoxingViewActivity.class).start(callerActivity, REQUEST_CODE);
// call of() use Mode.MULTI_IMG by default. Boxing.of().withIntent(context, class).start(callerActivity, REQUEST_CODE);
t Result
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) {
List<BaseMedia> medias = Boxing.getResult(data);
// avoid null
}
Advanced usage
a loading and image cropping initialization are the same as Simple Usage.
stomize Activity and Fragment
tends AbsBoxingViewActivity and AbsBoxingViewFragment.
ll `Boxing.of(config).withIntent(context, AbsBoxingViewActivity.class).start(callerActivity, REQUEST_CODE);` to start.
ly customize Fragment
tends AbsBoxingViewFragment,no AbsBoxingViewActivity.
ll `Boxing.of(BoxingConfig).setupFragment(AbsBoxingViewFragment, OnFinishListener);` to start.
FileProvider
camera in Android N, add this in AndroidManifest.xml
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"/>
Kotlin Support
hungry, stay foolish.
kout `feature/kotlin` for fun.
TODO
ort different config at the same moment.
License
right 2017 Bilibili
nsed 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
p://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
ss 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.