当前位置: 首页>>代码示例>>Java>>正文


Java ImageInfo类代码示例

本文整理汇总了Java中com.lzy.ninegrid.ImageInfo的典型用法代码示例。如果您正苦于以下问题:Java ImageInfo类的具体用法?Java ImageInfo怎么用?Java ImageInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ImageInfo类属于com.lzy.ninegrid包,在下文中一共展示了ImageInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: uploadImages

import com.lzy.ninegrid.ImageInfo; //导入依赖的package包/类
public List<ImageInfo> uploadImages (final List<String> imagesPaths){
    if (imagesPaths != null) {
        List<ImageInfo> imageInfos = new ArrayList<>();
        for (String imagesPath : imagesPaths) {
            String imageType = getImageType(imagesPath);
            if (imageType != null){
                try {
                    AVFile avFile = AVFile.withAbsoluteLocalPath(getImageName(imageType), imagesPath);
                    AvObjectSaveHelper.runSaveFileSync(avFile);
                    ImageInfo imageInfo = new ImageInfo();
                    imageInfo.setThumbnailUrl(avFile.getThumbnailUrl(true,100,100));
                    imageInfo.setBigImageUrl(avFile.getUrl());
                    imageInfos.add(imageInfo);
                }catch (Exception e){
                    NLog.e(TagUtil.makeTag(FileStorageHelper.class),e);
                }
            }
        }
        return imageInfos;
    }
    return null;
}
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:23,代码来源:FileStorageHelper.java

示例2: onActivityResult

import com.lzy.ninegrid.ImageInfo; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == RESULT_OK) {
        switch (requestCode) {
            case REQUEST_CODE:
                String type = data.getStringExtra(TypeActivity.TYPE);
                tvType.setText(type);
                break;
            case REQUEST_CODE_CHOOSE:
                mSelected = Matisse.obtainResult(data);
                List<ImageInfo> imageInfoList = new ArrayList<>();
                Log.e("PHOTO", mSelected.toString());
                for (int i = 0; i < mSelected.size(); i++) {
                    ImageInfo info = new ImageInfo();
                    info.setThumbnailUrl(mSelected.get(i).toString());
                    info.setBigImageUrl(mSelected.get(i).toString());
                    imageInfoList.add(info);
                }
                nineGridView.setAdapter(new NineGridViewClickAdapter(this, imageInfoList));
                break;
        }
    }
}
 
开发者ID:HowieTianDev,项目名称:ChenYan,代码行数:25,代码来源:PubDynamicActivity.java

示例3: showBigImage

import com.lzy.ninegrid.ImageInfo; //导入依赖的package包/类
private void showBigImage(NeiHanContentBean.DataBean.GroupBean.LargeCoverBean large_image) {
    List<ImageInfo> imageInfo = new ArrayList<>();
    ImageInfo imageInfo_1 = new ImageInfo();
    imageInfo_1.setImageViewHeight(large_image.getHeight());
    imageInfo_1.setImageViewWidth(large_image.getWidth());
    imageInfo_1.setThumbnailUrl(large_image.getUrl_list().get(0).getUrl());
    imageInfo_1.setBigImageUrl(large_image.getUrl_list().get(0).getUrl());
    imageInfo.add(imageInfo_1);
    Intent intent = new Intent(mContext, ImagePreviewActivity.class);
    Bundle bundle = new Bundle();
    bundle.putSerializable(ImagePreviewActivity.IMAGE_INFO, (Serializable) imageInfo);
    bundle.putInt(ImagePreviewActivity.CURRENT_ITEM, 0);
    intent.putExtras(bundle);
    mContext.startActivity(intent);
    ((Activity) mContext).overridePendingTransition(0, 0);
}
 
开发者ID:devzwy,项目名称:NeiHanDuanZiTV,代码行数:17,代码来源:MainTab1Adapter.java

示例4: convert

import com.lzy.ninegrid.ImageInfo; //导入依赖的package包/类
@Override
protected void convert(BaseViewHolder baseViewHolder, final GankModel model) {
    baseViewHolder.setText(R.id.title, model.desc)//
            .setText(R.id.desc, model.desc)//
            .setText(R.id.pubDate, model.publishedAt.toString())//
            .setText(R.id.source, model.source);

    View view = baseViewHolder.getConvertView();
    view.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            WebActivity.runActivity(mContext, model.desc, model.url);
        }
    });

    NineGridView nineGrid = baseViewHolder.getView(R.id.nineGrid);
    ArrayList<ImageInfo> imageInfo = new ArrayList<>();
    if (model.images != null) {
        for (String image : model.images) {
            ImageInfo info = new ImageInfo();
            info.setThumbnailUrl(image);
            info.setBigImageUrl(image);
            imageInfo.add(info);
        }
    }
    nineGrid.setAdapter(new NineGridViewClickAdapter(mContext, imageInfo));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:28,代码来源:NewsAdapter.java

示例5: instantiateItem

import com.lzy.ninegrid.ImageInfo; //导入依赖的package包/类
@Override
    public Object instantiateItem(ViewGroup container, int position) {
        View view = LayoutInflater.from(context).inflate(R.layout.item_photoview, container, false);
        final ProgressBar pb = (ProgressBar) view.findViewById(R.id.pb);
        final PhotoView imageView = (PhotoView) view.findViewById(R.id.pv);

        ImageInfo info = this.imageInfo.get(position);
        imageView.setOnPhotoTapListener(this);
        showExcessPic(info, imageView);

        //如果需要加载的loading,需要自己改写,不能使用这个方法
        NineGridView.getImageLoader().onDisplayImage(view.getContext(), imageView, info.bigImageUrl);

//        pb.setVisibility(View.VISIBLE);
//        Glide.with(context).load(info.bigImageUrl)//
//                .placeholder(R.drawable.ic_default_image)//
//                .error(R.drawable.ic_default_image)//
//                .diskCacheStrategy(DiskCacheStrategy.ALL)//
//                .listener(new RequestListener<String, GlideDrawable>() {
//                    @Override
//                    public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) {
//                        pb.setVisibility(View.GONE);
//                        return false;
//                    }
//
//                    @Override
//                    public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
//                        pb.setVisibility(View.GONE);
//                        return false;
//                    }
//                }).into(imageView);

        container.addView(view);
        return view;
    }
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:36,代码来源:ImagePreviewAdapter.java

示例6: showExcessPic

import com.lzy.ninegrid.ImageInfo; //导入依赖的package包/类
/** 展示过度图片 */
private void showExcessPic(ImageInfo imageInfo, PhotoView imageView) {
    //先获取大图的缓存图片
    Bitmap cacheImage = NineGridView.getImageLoader().getCacheImage(imageInfo.bigImageUrl);
    //如果大图的缓存不存在,在获取小图的缓存
    if (cacheImage == null) cacheImage = NineGridView.getImageLoader().getCacheImage(imageInfo.thumbnailUrl);
    //如果没有任何缓存,使用默认图片,否者使用缓存
    if (cacheImage == null) {
        imageView.setImageResource(R.drawable.ic_default_image);
    } else {
        imageView.setImageBitmap(cacheImage);
    }
}
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:14,代码来源:ImagePreviewAdapter.java

示例7: onCreate

import com.lzy.ninegrid.ImageInfo; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_preview);

    ViewPager viewPager = (ViewPager) findViewById(R.id.viewPager);
    final TextView tv_pager = (TextView) findViewById(R.id.tv_pager);
    rootView = (RelativeLayout) findViewById(R.id.rootView);

    DisplayMetrics metric = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metric);
    screenWidth = metric.widthPixels;
    screenHeight = metric.heightPixels;

    Intent intent = getIntent();
    imageInfo = (List<ImageInfo>) intent.getSerializableExtra(IMAGE_INFO);
    currentItem = intent.getIntExtra(CURRENT_ITEM, 0);

    imagePreviewAdapter = new ImagePreviewAdapter(this, imageInfo);
    viewPager.setAdapter(imagePreviewAdapter);
    viewPager.setCurrentItem(currentItem);
    viewPager.getViewTreeObserver().addOnPreDrawListener(this);
    viewPager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            currentItem = position;
            tv_pager.setText(String.format(getString(R.string.select), currentItem + 1, imageInfo.size()));
        }
    });
    tv_pager.setText(String.format(getString(R.string.select), currentItem + 1, imageInfo.size()));
}
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:32,代码来源:ImagePreviewActivity.java

示例8: onPreDraw

import com.lzy.ninegrid.ImageInfo; //导入依赖的package包/类
/** 绘制前开始动画 */
@Override
public boolean onPreDraw() {
    rootView.getViewTreeObserver().removeOnPreDrawListener(this);
    final View view = imagePreviewAdapter.getPrimaryItem();
    final ImageView imageView = imagePreviewAdapter.getPrimaryImageView();
    computeImageWidthAndHeight(imageView);

    final ImageInfo imageData = imageInfo.get(currentItem);
    final float vx = imageData.imageViewWidth * 1.0f / imageWidth;
    final float vy = imageData.imageViewHeight * 1.0f / imageHeight;
    ValueAnimator valueAnimator = ValueAnimator.ofFloat(0, 1.0f);
    valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            long duration = animation.getDuration();
            long playTime = animation.getCurrentPlayTime();
            float fraction = duration > 0 ? (float) playTime / duration : 1f;
            if (fraction > 1) fraction = 1;
            view.setTranslationX(evaluateInt(fraction, imageData.imageViewX + imageData.imageViewWidth / 2 - imageView.getWidth() / 2, 0));
            view.setTranslationY(evaluateInt(fraction, imageData.imageViewY + imageData.imageViewHeight / 2 - imageView.getHeight() / 2, 0));
            view.setScaleX(evaluateFloat(fraction, vx, 1));
            view.setScaleY(evaluateFloat(fraction, vy, 1));
            view.setAlpha(fraction);
            rootView.setBackgroundColor(evaluateArgb(fraction, Color.TRANSPARENT, Color.BLACK));
        }
    });
    addIntoListener(valueAnimator);
    valueAnimator.setDuration(ANIMATE_DURATION);
    valueAnimator.start();
    return true;
}
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:33,代码来源:ImagePreviewActivity.java

示例9: finishActivityAnim

import com.lzy.ninegrid.ImageInfo; //导入依赖的package包/类
/** activity的退场动画 */
public void finishActivityAnim() {
    final View view = imagePreviewAdapter.getPrimaryItem();
    final ImageView imageView = imagePreviewAdapter.getPrimaryImageView();
    computeImageWidthAndHeight(imageView);

    final ImageInfo imageData = imageInfo.get(currentItem);
    final float vx = imageData.imageViewWidth * 1.0f / imageWidth;
    final float vy = imageData.imageViewHeight * 1.0f / imageHeight;
    final ValueAnimator valueAnimator = ValueAnimator.ofFloat(0, 1.0f);
    valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            long duration = animation.getDuration();
            long playTime = animation.getCurrentPlayTime();
            float fraction = duration > 0 ? (float) playTime / duration : 1f;
            if (fraction > 1) fraction = 1;
            view.setTranslationX(evaluateInt(fraction, 0, imageData.imageViewX + imageData.imageViewWidth / 2 - imageView.getWidth() / 2));
            view.setTranslationY(evaluateInt(fraction, 0, imageData.imageViewY + imageData.imageViewHeight / 2 - imageView.getHeight() / 2));
            view.setScaleX(evaluateFloat(fraction, 1, vx));
            view.setScaleY(evaluateFloat(fraction, 1, vy));
            view.setAlpha(1 - fraction);
            rootView.setBackgroundColor(evaluateArgb(fraction, Color.BLACK, Color.TRANSPARENT));
        }
    });
    addOutListener(valueAnimator);
    valueAnimator.setDuration(ANIMATE_DURATION);
    valueAnimator.start();
}
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:30,代码来源:ImagePreviewActivity.java

示例10: onImageItemClick

import com.lzy.ninegrid.ImageInfo; //导入依赖的package包/类
@Override
protected void onImageItemClick(Context context, NineGridView nineGridView, int index, List<ImageInfo> imageInfo) {
    for (int i = 0; i < imageInfo.size(); i++) {
        ImageInfo info = imageInfo.get(i);
        View imageView;
        if (i < nineGridView.getMaxSize()) {
            imageView = nineGridView.getChildAt(i);
        } else {
            //如果图片的数量大于显示的数量,则超过部分的返回动画统一退回到最后一个图片的位置
            imageView = nineGridView.getChildAt(nineGridView.getMaxSize() - 1);
        }
        info.imageViewWidth = imageView.getWidth();
        info.imageViewHeight = imageView.getHeight();
        int[] points = new int[2];
        imageView.getLocationInWindow(points);
        info.imageViewX = points[0];
        info.imageViewY = points[1] - statusHeight;
    }

    Intent intent = new Intent(context, ImagePreviewActivity.class);
    Bundle bundle = new Bundle();
    bundle.putSerializable(ImagePreviewActivity.IMAGE_INFO, (Serializable) imageInfo);
    bundle.putInt(ImagePreviewActivity.CURRENT_ITEM, index);
    intent.putExtras(bundle);
    context.startActivity(intent);
    ((Activity) context).overridePendingTransition(0, 0);
}
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:28,代码来源:NineGridViewClickAdapter.java

示例11: uploadImagesAsync

import com.lzy.ninegrid.ImageInfo; //导入依赖的package包/类
public void uploadImagesAsync(final List<String> imagesPaths, final DoneCallback<ImageInfo> callback){
    RxjavaUtils.AsyncJob(new Runnable() {
        @Override
        public void run() {
            if (imagesPaths != null) {
                List<ImageInfo> imageInfos = new ArrayList<>();
                for (String imagesPath : imagesPaths) {
                    String imageType = getImageType(imagesPath);
                    if (imageType != null){
                        try {
                            AVFile avFile = AVFile.withAbsoluteLocalPath(getImageName(imageType), imagesPath);
                            final String thumbNailUrl = avFile.getThumbnailUrl(true,100,100);
                            avFile.save();
                            ImageInfo imageInfo = new ImageInfo();
                            imageInfo.setThumbnailUrl(thumbNailUrl);
                            imageInfo.setBigImageUrl(avFile.getUrl());
                            imageInfos.add(imageInfo);
                        }catch (Exception e){
                            NLog.e(TagUtil.makeTag(FileStorageHelper.class),e);
                        }
                    }
                }

                callback.done(imageInfos,null);
            }
        }
    });
}
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:29,代码来源:FileStorageHelper.java

示例12: uploadImagesTask

import com.lzy.ninegrid.ImageInfo; //导入依赖的package包/类
public Task<List<ImageInfo>> uploadImagesTask(final List<String> imagesPaths){
    return Task.forResult(imagesPaths).continueWithTask(new Continuation<List<String>, Task<List<ImageInfo>>>() {
        @Override
        public Task<List<ImageInfo>> then(Task<List<String>> task) throws Exception {
            Exception e = task.getError();
            NLog.i(TagUtil.makeTag(getClass()),"uploadImagesTask e = "+e);
            if (e != null) {
                return Task.forError(e);
            }

            List<String> ipaths = task.getResult();
            List<ImageInfo> imageInfos = new ArrayList<>();
            if (ipaths != null) {
                for (String ipath : ipaths) {
                    String imageType = getImageType(ipath);
                    if (imageType != null){
                        try {
                            AVFile avFile = AVFile.withAbsoluteLocalPath(getImageName(imageType), ipath);
                            AvObjectSaveHelper.runSaveFileSync(avFile);
                            String thumbNailUrl = avFile.getThumbnailUrl(true,100,100);
                            ImageInfo imageInfo = new ImageInfo();
                            imageInfo.setThumbnailUrl(thumbNailUrl);
                            imageInfo.setBigImageUrl(avFile.getUrl());
                            imageInfos.add(imageInfo);
                        }catch (Exception exception){
                            return Task.forError(exception);
                        }
                    }
                }
            }
            return Task.forResult(imageInfos);
        }
    },Task.BACKGROUND_EXECUTOR);
}
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:35,代码来源:FileStorageHelper.java

示例13: nineTest

import com.lzy.ninegrid.ImageInfo; //导入依赖的package包/类
private void nineTest() {
    List<ImageInfo> imageInfoList = new ArrayList<>();
    for (int i = 0; i < 9; i++) {
        ImageInfo imageInfo = new ImageInfo();
        imageInfo.setBigImageUrl("http://img1a.xgo-img.com.cn/pics/1538/a1537491.jpg");
        imageInfo.setThumbnailUrl("http://img1a.xgo-img.com.cn/pics/1538/a1537491.jpg");
        imageInfoList.add(imageInfo);
    }

    nineGridView.setAdapter(new NineGridViewClickAdapter(this, imageInfoList));
}
 
开发者ID:HowieTianDev,项目名称:ChenYan,代码行数:12,代码来源:Main2Activity.java

示例14: ImagePreviewAdapter

import com.lzy.ninegrid.ImageInfo; //导入依赖的package包/类
public ImagePreviewAdapter(Context context, @NonNull List<ImageInfo> imageInfo) {
    super();
    this.imageInfo = imageInfo;
    this.context = context;
}
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:6,代码来源:ImagePreviewAdapter.java

示例15: NineGridViewClickAdapter

import com.lzy.ninegrid.ImageInfo; //导入依赖的package包/类
public NineGridViewClickAdapter(Context context, List<ImageInfo> imageInfo) {
    super(context, imageInfo);
    statusHeight = getStatusHeight(context);
}
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:5,代码来源:NineGridViewClickAdapter.java


注:本文中的com.lzy.ninegrid.ImageInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。