godlibrary-gallery
https://github.com/abook23/godlibrary-gallery
#簡介
1.相冊選取圖片,圖片按照選擇順序排序
2.圖片預覽
3.點擊拍照贱呐,長按錄像
###Image
#使用方法
##Stop1
compile 'com.abook23:godlibrary-gallery:1.2.0'
##Stop2
PhotoActivity.startActivityForResult(Activity ac, int checkMax, ArrayList checkPath, int resultCode);
CameraVideoActivity.startForResult(Activity activity, int requestCode);
CameraVideoActivity.startForResult(Activity activity, int checkMax, int requestCode);
##示例
//PhotoActivity.CHECK_BUTTON_COLOR = R.color.;//選擇按鈕顏色
//PhotoActivity.COLOR_BACK_BUTTON = R.color.;// 頂部背景顏色
PhotoActivity.startActivityForResult(this, 9, null, 0)
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK) {
if (requestCode == 0) {
ArrayList list = data.getStringArrayListExtra(PhotoActivity.DATA);
if (list.size() == 0) {
return;
}
StringBuffer sb = new StringBuffer();
for (String s : list) {
sb.append("\n").append(s);
}
L.d(sb.toString());
}
}
}
#圖片墻
ImageInfoActivity.start(Context context, int position, ArrayList urls)
自義相機
CameraVideoFragment videoFragment = CameraVideoFragment.newInstance();
//沒特殊要求,sd 就可以了,HD 的視頻有點大,微信就相當于SD模式
videoFragment.setDefinition(CameraVideoFragment.Definition.SD);
videoFragment.setVideoMaxDuration(60 * 1000);//最大錄入時間,默認10s
videoFragment.setVideoRatio(0.8f);//視頻質量 ----微信視頻 質量大概在 0.8f 左右, 要清晰一點,就調節(jié)大一些
//videoFragment.setVideoMaxZie(50 * 1024 * 1024);//默認50MB
videoFragment.setOnCameraVideoListener(new CameraVideoFragment.OnCameraVideoListener() {
@Override
public void onFragmentResult(String path, String type) {
L.d(path);
}
});
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.add(R.id.videoFragment, videoFragment);
transaction.commit();
#第三方 引用 dependencies
```html
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:support-v4:25.1.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.sprylab.android.texturevideoview:texturevideoview:1.2.1'
compile 'com.android.support:recyclerview-v7:25.1.0'
}
```
License
-------
Copyright 2017 Wasabeef
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.0
Unless 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.