use of com.zhihu.matisse.internal.entity.CaptureStrategy in project ttdj by soonphe.
the class PublishGoodsFragment method onItemClick.
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (parent.getId() == R.id.activity_postmessage_gridview) {
// 判断是否为最后一个
if (position == parent.getChildCount() - 1) {
new RxPermissions(getContext()).request(Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.CAMERA).subscribe(granded -> {
if (granded) {
Matisse.from(this).choose(MimeType.ofAll(), false).countable(true).capture(// 拍照
true).captureStrategy(new CaptureStrategy(true, "com.connxun.ltcx.app.fileprovider")).maxSelectable(6).addFilter(new GifSizeFilter(320, 320, 5 * Filter.K * Filter.K)).gridExpectedSize(getResources().getDimensionPixelSize(R.dimen.grid_expected_size)).restrictOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED).thumbnailScale(0.85f).imageEngine(new GlideEngine()).forResult(REQUEST_CODE_CHOOSE);
} else {
ToastUtils.showShort("请先授予应用相关权限");
mOperation.showBasicDialog(R.string.error, R.string.grant_permission, (dialog, which) -> {
// Intent intent = new Intent(Settings.ACTION_WIRELESS_SETTINGS); //飞行模式,无线网和网络设置界面
// 跳转位置服务界面
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(intent);
});
}
});
}
}
}
use of com.zhihu.matisse.internal.entity.CaptureStrategy in project ttdj by soonphe.
the class ApplyStoreActivity method onViewClicked.
@OnClick({ R.id.iv_image, R.id.tv_publish })
public void onViewClicked(View view) {
switch(view.getId()) {
case R.id.iv_image:
new RxPermissions(getContext()).request(Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.CAMERA).subscribe(granded -> {
if (granded) {
Matisse.from(getContext()).choose(MimeType.ofAll(), false).countable(true).capture(// 拍照
true).captureStrategy(new CaptureStrategy(true, "com.connxun.ltcx.app.fileprovider")).maxSelectable(1).addFilter(new GifSizeFilter(320, 320, 5 * Filter.K * Filter.K)).gridExpectedSize(getResources().getDimensionPixelSize(R.dimen.grid_expected_size)).restrictOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED).thumbnailScale(0.85f).imageEngine(new GlideEngine()).forResult(REQUEST_CODE_CHOOSE);
} else {
ToastUtils.showShort("请先授予应用相关权限");
mOperation.showBasicDialog(R.string.error, R.string.grant_permission, (dialog, which) -> {
// Intent intent = new Intent(Settings.ACTION_WIRELESS_SETTINGS); //飞行模式,无线网和网络设置界面
// 跳转位置服务界面
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(intent);
});
}
});
break;
case R.id.tv_publish:
validator.validate();
break;
}
}
use of com.zhihu.matisse.internal.entity.CaptureStrategy in project ttdj by soonphe.
the class PersonCertifyActivity method initView.
@Override
public void initView(View view) {
presenter.attachView(this);
// 初始化底部recycleView
certifyAdapter = new CertifyAdapter(R.layout.item_center_rv);
// recycleView布局加载(LinearLayoutManager)
rvList.setLayoutManager(new GridLayoutManager(getContext(), 4));
// 添加分割线
rvList.addItemDecoration(new SpaceDecoration(20));
// rvList.addItemDecoration(new DividerDecoration(R.color.divider_recycle,1));
// rvList.addItemDecoration(new RecycleViewDivider(getContext(), LinearLayoutManager.HORIZONTAL));
rvList.setAdapter(certifyAdapter);
// 解决NestedScrollView和RecycleView滑动冲突
rvList.setNestedScrollingEnabled(false);
certifyAdapter.setFooterView(LayoutInflater.from(this).inflate(R.layout.item_center_rv_footer, null));
certifyAdapter.setFooterViewAsFlow(true);
certifyAdapter.getFooterLayout().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new RxPermissions(getContext()).request(Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.CAMERA).subscribe(granded -> {
if (granded) {
Matisse.from(getContext()).choose(MimeType.ofAll(), false).countable(true).capture(// 拍照
true).captureStrategy(new CaptureStrategy(true, "com.connxun.ltcx.app.fileprovider")).maxSelectable(2 - certifyAdapter.getData().size()).addFilter(new GifSizeFilter(320, 320, 5 * Filter.K * Filter.K)).gridExpectedSize(getResources().getDimensionPixelSize(R.dimen.grid_expected_size)).restrictOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED).thumbnailScale(0.85f).imageEngine(new GlideEngine()).forResult(REQUEST_CODE_CHOOSE);
} else {
ToastUtils.showShort("请先授予应用相关权限");
mOperation.showBasicDialog(R.string.error, R.string.grant_permission, (dialog, which) -> {
// Intent intent = new Intent(Settings.ACTION_WIRELESS_SETTINGS); //飞行模式,无线网和网络设置界面
// 跳转位置服务界面
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(intent);
});
}
});
}
});
}
Aggregations