Skip to content

Commit

Permalink
完成初版
Browse files Browse the repository at this point in the history
  • Loading branch information
aaatttcccc committed Feb 10, 2019
1 parent 79c61c8 commit adced5b
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 7 deletions.
Binary file added Demonstration.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 7 additions & 7 deletions app/src/main/java/com/zhongjh/cameraapp/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -196,20 +196,20 @@ public void onRequestPermissionsResult(int requestCode, String[] permissions, in
*/
private void openMain(int alreadyImageCount, int alreadyVideoCount, int alreadyAudioCount) {

// 拍摄
// 拍摄有关设置
CameraSetting cameraSetting = new CameraSetting();
cameraSetting.mimeTypeSet(MimeType.ofAll());
cameraSetting.supportSingleMediaType(false);
cameraSetting.captureStrategy(new CaptureStrategy(true, "com.zhongjh.cameraapp.fileprovider", "AA/camera"));
cameraSetting.mimeTypeSet(MimeType.ofAll());// 支持的类型:图片,视频
cameraSetting.supportSingleMediaType(false);// 仅仅支持一个相片
cameraSetting.captureStrategy(new CaptureStrategy(true, "com.zhongjh.cameraapp.fileprovider", "AA/camera")); // 保存目录

// 相册
AlbumSetting albumSetting = new AlbumSetting(true)
.captureStrategy(
new CaptureStrategy(true, "com.zhongjh.cameraapp.fileprovider", "AA/album"))// 设置路径和7.0保护路径等等
.showSingleMediaType(true) // 仅仅显示一个多媒体类型
.countable(true)// 是否显示多选图片的数字
.addFilter(new GifSizeFilter(320, 320, 5 * Filter.K * Filter.K))
.gridExpectedSize(getResources().getDimensionPixelSize(R.dimen.grid_expected_size))
.addFilter(new GifSizeFilter(320, 320, 5 * Filter.K * Filter.K))// 查看的大小限制
.gridExpectedSize(getResources().getDimensionPixelSize(R.dimen.grid_expected_size))// 九宫格大小
.thumbnailScale(0.85f)
.setOnSelectedListener((uriList, pathList) -> {
// 每次选择的事件
Expand All @@ -224,7 +224,7 @@ private void openMain(int alreadyImageCount, int alreadyVideoCount, int alreadyA

// 录音机
RecorderSetting recorderSetting = new RecorderSetting();
recorderSetting.captureStrategy(new CaptureStrategy(true,"com.zhongjh.cameraapp.fileprovider", "AA/recorder"));
recorderSetting.captureStrategy(new CaptureStrategy(true,"com.zhongjh.cameraapp.fileprovider", "AA/recorder"));// 保存目录

// 全局
MultiMediaSetting.from(MainActivity.this)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.zhongjh.albumcamerarecorder.listener;


/**
* 首页的事件
*/
public interface OnMainListener {

void onOpenFail(String errorMessage);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.zhongjh.albumcamerarecorder.settings;

public class RecordeSpec {

private RecordeSpec() {
}

private static final class InstanceHolder {
private static final RecordeSpec INSTANCE = new RecordeSpec();
}

public static RecordeSpec getInstance() {
return InstanceHolder.INSTANCE;
}

public static RecordeSpec getCleanInstance() {
RecordeSpec recordeSpec = getInstance();
recordeSpec.reset();
return recordeSpec;
}

/**
* 重置
*/
private void reset() {
captureStrategy = null;
}

// region 属性
public CaptureStrategy captureStrategy; // 参数1 true表示拍照存储在共有目录,false表示存储在私有目录;参数2与 AndroidManifest中authorities值相同,用于适配7.0系统 必须设置

// endregion 属性

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.zhongjh.albumcamerarecorder.settings;

/**
* 录音机
*/
public final class RecorderSetting {

private final RecordeSpec mRecordeSpec;

public RecorderSetting() {
mRecordeSpec = RecordeSpec.getInstance();
}

/**
* 提供保存公有或者私有的文件路径
* 文件路径存储于 {@link android.support.v4.content.FileProvider}.
*
* @param captureStrategy {@link CaptureStrategy},仅仅启用时才需要
* @return {@link GlobalSetting} for fluent API.
*/
public RecorderSetting captureStrategy(CaptureStrategy captureStrategy) {
mRecordeSpec.captureStrategy = captureStrategy;
return this;
}

}

0 comments on commit adced5b

Please sign in to comment.