本文整理汇总了Java中com.netease.nim.uikit.common.media.picker.model.PickerContract类的典型用法代码示例。如果您正苦于以下问题:Java PickerContract类的具体用法?Java PickerContract怎么用?Java PickerContract使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PickerContract类属于com.netease.nim.uikit.common.media.picker.model包,在下文中一共展示了PickerContract类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPickedLocal
import com.netease.nim.uikit.common.media.picker.model.PickerContract; //导入依赖的package包/类
private void onPickedLocal(Intent data, int code) {
boolean mutiSelect = getIntent().getBooleanExtra(Extras.EXTRA_MUTI_SELECT_MODE, false);
try {
List<PhotoInfo> photos = PickerContract.getPhotos(data);
if (photos != null && photos.size() >= 1) {
PhotoInfo select = photos.get(0);
String photoPath = select.getAbsolutePath();
boolean crop = getIntent().getBooleanExtra(Extras.EXTRA_NEED_CROP, false);
if (crop) {
crop(photoPath);
} else {
if (data != null) {
Intent result = new Intent(data);
result.putExtra(Extras.EXTRA_FROM_LOCAL, true);
setResult(RESULT_OK, result);
finish();
}
}
}
} catch (Exception e) {
Toast.makeText(this, R.string.picker_image_error, Toast.LENGTH_LONG).show();
finish();
}
}
示例2: onPhotoSingleClick
import com.netease.nim.uikit.common.media.picker.model.PickerContract; //导入依赖的package包/类
@Override
public void onPhotoSingleClick(List<PhotoInfo> photos, int position) {
if (isMutiMode) {
PickerAlbumPreviewActivity.start(this, photos, position, isSupportOriginal,
isSendOriginalImage, hasSelectList, mutiSelectLimitSize);
} else {
if (photos != null) {
PhotoInfo photo = photos.get(position);
List<PhotoInfo> selectList = new ArrayList<PhotoInfo>();
selectList.add(photo);
setResult(RESULT_OK, PickerContract.makeDataIntent(selectList, false));
finish();
}
}
}
示例3: onPhotoSingleClick
import com.netease.nim.uikit.common.media.picker.model.PickerContract; //导入依赖的package包/类
@Override
public void onPhotoSingleClick(List<PhotoInfo> photos, int position) {
if(isMutiMode){
PickerAlbumPreviewActivity.start(this, photos, position, isSupportOriginal,
isSendOriginalImage, hasSelectList, mutiSelectLimitSize);
}else{
if(photos != null){
PhotoInfo photo = photos.get(position);
List<PhotoInfo> selectList = new ArrayList<PhotoInfo>();
selectList.add(photo);
setResult(RESULT_OK, PickerContract.makeDataIntent(selectList, false));
finish();
}
}
}
示例4: start
import com.netease.nim.uikit.common.media.picker.model.PickerContract; //导入依赖的package包/类
public static void start(Activity activity, List<PhotoInfo> photos, int position, boolean supportOrig,
boolean isOrig, List<PhotoInfo> selectPhotoList, int mutiSelectLimitSize) {
Intent intent = PickerContract.makePreviewDataIntent(photos, selectPhotoList);
intent.setClass(activity, PickerAlbumPreviewActivity.class);
intent.putExtra(Extras.EXTRA_PREVIEW_CURRENT_POS, position);
intent.putExtra(Extras.EXTRA_SUPPORT_ORIGINAL, supportOrig);
intent.putExtra(Extras.EXTRA_IS_ORIGINAL, isOrig);
intent.putExtra(Extras.EXTRA_MUTI_SELECT_SIZE_LIMIT, mutiSelectLimitSize);
activity.startActivityForResult(intent, RequestCode.PICKER_IMAGE_PREVIEW);
}
示例5: proceedExtras
import com.netease.nim.uikit.common.media.picker.model.PickerContract; //导入依赖的package包/类
private void proceedExtras(){
Intent intent = getIntent();
isSupportOriginal = intent.getBooleanExtra(Extras.EXTRA_SUPPORT_ORIGINAL, false);
isSendOriginalImage = intent.getBooleanExtra(Extras.EXTRA_IS_ORIGINAL, false);
firstDisplayImageIndex = intent.getIntExtra(Extras.EXTRA_PREVIEW_CURRENT_POS, 0);
mutiSelectLimitSize = intent.getIntExtra(Extras.EXTRA_MUTI_SELECT_SIZE_LIMIT, 9);
photoLists.addAll(PickerContract.getPhotos(intent));
totalSize = photoLists.size();
selectPhotoList.clear();
selectPhotoList.addAll(PickerContract.getSelectPhotos(intent));
}
示例6: onClick
import com.netease.nim.uikit.common.media.picker.model.PickerContract; //导入依赖的package包/类
@Override
public void onClick(View v) {
if (v.getId() == R.id.picker_bottombar_preview) {
PickerAlbumPreviewActivity.start(this, hasSelectList, 0, isSupportOriginal,
isSendOriginalImage, hasSelectList, mutiSelectLimitSize);
} else if (v.getId() == R.id.picker_bottombar_select) {
setResult(RESULT_OK, PickerContract.makeDataIntent(hasSelectList, isSendOriginalImage));
finish();
}
}
示例7: onActivityResult
import com.netease.nim.uikit.common.media.picker.model.PickerContract; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == RequestCode.PICKER_IMAGE_PREVIEW) {
if (resultCode == RESULT_OK) {
if (data != null) {
setResult(RESULT_OK, new Intent(data));
finish();
}
} else if (resultCode == PickerAlbumPreviewActivity.RESULT_FROM_USER) {
if (data != null) {
// update photo fragment
isSendOriginalImage = data.getBooleanExtra(Extras.EXTRA_IS_ORIGINAL, false);
List<PhotoInfo> list = PickerContract.getPhotos(data);
if (photoFragment != null && list != null) {
photoFragment.updateGridview(list);
}
// update select photo list
List<PhotoInfo> selectList = PickerContract.getSelectPhotos(data);
resetSelectPhotos(selectList);
updateSelectBtnStatus();
if (photoFragment != null && hasSelectList != null) {
photoFragment.updateSelectedForAdapter(hasSelectList.size());
}
}
}
}
}
示例8: onClick
import com.netease.nim.uikit.common.media.picker.model.PickerContract; //导入依赖的package包/类
@Override
public void onClick(View v) {
if (v.getId() == R.id.picker_bottombar_preview) {
PickerAlbumPreviewActivity.start(this, hasSelectList, 0, isSupportOriginal,
isSendOriginalImage, hasSelectList, mutiSelectLimitSize);
} else if (v.getId() == R.id.picker_bottombar_select) {
setResult(RESULT_OK, PickerContract.makeDataIntent(hasSelectList, isSendOriginalImage));
finish();
}
}
示例9: onActivityResult
import com.netease.nim.uikit.common.media.picker.model.PickerContract; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == RequestCode.PICKER_IMAGE_PREVIEW) {
if (resultCode == RESULT_OK) {
if(data != null){
setResult(RESULT_OK, new Intent(data));
finish();
}
}
else if(resultCode == PickerAlbumPreviewActivity.RESULT_FROM_USER){
if(data != null){
// update photo fragment
isSendOriginalImage = data.getBooleanExtra(Extras.EXTRA_IS_ORIGINAL, false);
List<PhotoInfo> list = PickerContract.getPhotos(data);
if(photoFragment != null && list != null){
photoFragment.updateGridview(list);
}
// update select photo list
List<PhotoInfo> selectList = PickerContract.getSelectPhotos(data);
resetSelectPhotos(selectList);
updateSelectBtnStatus();
if(photoFragment != null && hasSelectList != null){
photoFragment.updateSelectedForAdapter(hasSelectList.size());
}
}
}
}
}
示例10: start
import com.netease.nim.uikit.common.media.picker.model.PickerContract; //导入依赖的package包/类
public static void start(Activity activity, List<PhotoInfo> photos, int position, boolean supportOrig,
boolean isOrig, List<PhotoInfo> selectPhotoList, int mutiSelectLimitSize) {
Intent intent = PickerContract.makePreviewDataIntent(photos, selectPhotoList);
intent.setClass(activity, PickerAlbumPreviewActivity.class);
intent.putExtra(Extras.EXTRA_PREVIEW_CURRENT_POS, position);
intent.putExtra(Extras.EXTRA_SUPPORT_ORIGINAL, supportOrig);
intent.putExtra(Extras.EXTRA_IS_ORIGINAL, isOrig);
intent.putExtra(Extras.EXTRA_MUTI_SELECT_SIZE_LIMIT, mutiSelectLimitSize);
activity.startActivityForResult(intent, RequestCode.PICKER_IMAGE_PREVIEW);
}
示例11: proceedExtras
import com.netease.nim.uikit.common.media.picker.model.PickerContract; //导入依赖的package包/类
private void proceedExtras() {
Intent intent = getIntent();
isSupportOriginal = intent.getBooleanExtra(Extras.EXTRA_SUPPORT_ORIGINAL, false);
isSendOriginalImage = intent.getBooleanExtra(Extras.EXTRA_IS_ORIGINAL, false);
firstDisplayImageIndex = intent.getIntExtra(Extras.EXTRA_PREVIEW_CURRENT_POS, 0);
mutiSelectLimitSize = intent.getIntExtra(Extras.EXTRA_MUTI_SELECT_SIZE_LIMIT, 9);
photoLists.addAll(PickerContract.getPhotos(intent));
totalSize = photoLists.size();
selectPhotoList.clear();
selectPhotoList.addAll(PickerContract.getSelectPhotos(intent));
}
示例12: onClick
import com.netease.nim.uikit.common.media.picker.model.PickerContract; //导入依赖的package包/类
@Override
public void onClick(View v) {
if (v.getId() == R.id.picker_image_preview_photos_select) {
if (photoLists == null || currentPosition >= photoLists.size())
return;
PhotoInfo selectPhoto = photoLists.get(currentPosition);
boolean isChoose = selectPhoto.isChoose();
if (selectPhotoList != null && selectPhotoList.size() >= mutiSelectLimitSize && !isChoose) {
Toast.makeText(this, String.format(getResources().getString(R.string.picker_image_exceed_max_image_select)
, mutiSelectLimitSize), Toast.LENGTH_SHORT).show();
return;
}
selectPhoto.setChoose(!isChoose);
updatePreviewSelectBtnStatus(!isChoose);
// check
if (!isChoose) {
boolean isSelect = checkSelectPhoto(selectPhoto);
if (!isSelect) {
selectPhotoList.add(selectPhoto);
}
} else {
removeSelectPhoto(selectPhoto);
}
// update bottom bar
updateSelectBtnStatus();
// 如果没有选择,则自动取消原图发送
if (selectPhotoList.size() == 0 && isSendOriginalImage) {
isSendOriginalImage = false;
}
updateOriImageSizeTip(isSendOriginalImage);
} else if (v.getId() == R.id.picker_image_preview_send) {
if (selectPhotoList != null && selectPhotoList.size() == 0) { // 没有选择,点击发送则发送当前图片
PhotoInfo current = photoLists.get(currentPosition);
current.setChoose(true);
selectPhotoList.add(current);
}
setResult(RESULT_OK, PickerContract.makeDataIntent(selectPhotoList, isSendOriginalImage));
finish();
} else if (v.getId() == R.id.picker_image_preview_orignal_image) {
if (!isSendOriginalImage) {
isSendOriginalImage = true;
// 如果已选图片小于mutiSelectLimitSize,点击发送原图,自动选择当前页面
int selectSize = selectPhotoList != null ? selectPhotoList.size() : 0;
if (selectSize < mutiSelectLimitSize) {
PhotoInfo cur = photoLists.get(currentPosition);
if (!cur.isChoose()) {
cur.setChoose(true);
selectPhotoList.add(cur);
updateSelectBtnStatus();
updatePreviewSelectBtnStatus(true);
}
}
} else {
isSendOriginalImage = false;
}
updateOriImageSizeTip(isSendOriginalImage);
}
}
示例13: onBackPressed
import com.netease.nim.uikit.common.media.picker.model.PickerContract; //导入依赖的package包/类
@Override
public void onBackPressed(){
setResult(RESULT_FROM_USER, PickerContract.makePreviewDataIntent(photoLists, selectPhotoList,
isSendOriginalImage));
finish();
}
示例14: onClick
import com.netease.nim.uikit.common.media.picker.model.PickerContract; //导入依赖的package包/类
@Override
public void onClick(View v) {
if (v.getId() == R.id.picker_image_preview_photos_select) {
if (photoLists == null || currentPosition >= photoLists.size())
return;
PhotoInfo selectPhoto = photoLists.get(currentPosition);
boolean isChoose = selectPhoto.isChoose();
if (selectPhotoList != null && selectPhotoList.size() >= mutiSelectLimitSize && !isChoose) {
Toast.makeText(this, String.format(getResources().getString(R.string.picker_image_exceed_max_image_select)
, mutiSelectLimitSize), Toast.LENGTH_SHORT).show();
return;
}
selectPhoto.setChoose(!isChoose);
updatePreviewSelectBtnStatus(!isChoose);
// check
if (!isChoose) {
boolean isSelect = checkSelectPhoto(selectPhoto);
if (!isSelect) {
selectPhotoList.add(selectPhoto);
}
} else {
removeSelectPhoto(selectPhoto);
}
// update bottom bar
updateSelectBtnStatus();
// 如果没有选择,则自动取消原图发送
if (selectPhotoList.size() == 0 && isSendOriginalImage) {
isSendOriginalImage = false;
}
updateOriImageSizeTip(isSendOriginalImage);
} else if (v.getId() == R.id.picker_image_preview_send) {
if (selectPhotoList != null && selectPhotoList.size() == 0) { // 没有选择,点击发送则发送当前图片
PhotoInfo current = photoLists.get(currentPosition);
current.setChoose(true);
selectPhotoList.add(current);
}
setResult(RESULT_OK, PickerContract.makeDataIntent(selectPhotoList, isSendOriginalImage));
finish();
} else if (v.getId() == R.id.picker_image_preview_orignal_image) {
if (!isSendOriginalImage) {
isSendOriginalImage = true;
// 如果已选图片小于mutiSelectLimitSize,点击发送原图,自动选择当前页面
int selectSize = selectPhotoList != null ? selectPhotoList.size() : 0;
if (selectSize < mutiSelectLimitSize) {
PhotoInfo cur = photoLists.get(currentPosition);
if (!cur.isChoose()) {
cur.setChoose(true);
selectPhotoList.add(cur);
updateSelectBtnStatus();
updatePreviewSelectBtnStatus(true);
}
}
} else {
isSendOriginalImage = false;
}
updateOriImageSizeTip(isSendOriginalImage);
}
}
示例15: onBackPressed
import com.netease.nim.uikit.common.media.picker.model.PickerContract; //导入依赖的package包/类
@Override
public void onBackPressed() {
setResult(RESULT_FROM_USER, PickerContract.makePreviewDataIntent(photoLists, selectPhotoList,
isSendOriginalImage));
finish();
}