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


Java Thumbnails类代码示例

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


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

示例1: doInBackground

import android.provider.MediaStore.Video.Thumbnails; //导入依赖的package包/类
@Override
protected Bitmap doInBackground(Void... params) {
	Bitmap bitmap = null;
	try {
		bitmap = ThumbnailUtils.createVideoThumbnail(mImageKey, Thumbnails.FULL_SCREEN_KIND);

		if (bitmap != null) {
			bitmap = Bitmap.createScaledBitmap(bitmap, mMaxWidth, mMaxWidth, false);
			addBitmapToCache(mImageKey, bitmap);
			return bitmap;
		}
		return null;
	} catch (Exception e) {
		if (e != null) {
			e.printStackTrace();
		}
		return null;
	}
}
 
开发者ID:learnNcode,项目名称:MediaChooser,代码行数:20,代码来源:GalleryCache.java

示例2: getStreamFromContent

import android.provider.MediaStore.Video.Thumbnails; //导入依赖的package包/类
protected InputStream getStreamFromContent(String imageUri, Object extra) throws
        FileNotFoundException {
    ContentResolver res = this.context.getContentResolver();
    Uri uri = Uri.parse(imageUri);
    if (isVideoContentUri(uri)) {
        Bitmap bitmap = Thumbnails.getThumbnail(res, Long.valueOf(uri.getLastPathSegment())
                .longValue(), 1, null);
        if (bitmap != null) {
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            bitmap.compress(CompressFormat.PNG, 0, bos);
            return new ByteArrayInputStream(bos.toByteArray());
        }
    } else if (imageUri.startsWith(CONTENT_CONTACTS_URI_PREFIX)) {
        return getContactPhotoStream(uri);
    }
    return res.openInputStream(uri);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:18,代码来源:BaseImageDownloader.java

示例3: getView

import android.provider.MediaStore.Video.Thumbnails; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
	ViewHolder holder = null;
	if (convertView == null) {
		holder=new ViewHolder();  
		convertView = mInflater.inflate(R.layout.videos_list_item, null);
		holder.thumb = (ImageView)convertView.findViewById(R.id.video_thumb);
		holder.name = (TextView)convertView.findViewById(R.id.video_name);
		holder.time = (TextView)convertView.findViewById(R.id.video_file_created_time);
		holder.duration = (TextView) convertView.findViewById(R.id.video_total_duration);
		convertView.setTag(holder);
	}else {
		logd("convertView != null, reuse");
		holder = (ViewHolder)convertView.getTag();
	}
	
	VideosInfo videoInfo = new VideosInfo(mVideosPaths.get(position));
	//holder.thumb.setImageBitmap(ExtractPicturesWorker.extractBitmap(mVideosPaths.get(position), 0));
	holder.thumb.setImageBitmap(ThumbnailUtils.createVideoThumbnail(mVideosPaths.get(position), Thumbnails.MINI_KIND));
	holder.name.setText("文件名:" + videoInfo.getName());
	holder.time.setText("时间:" + videoInfo.getLastModifyTime());
	holder.duration.setText("时长:" + videoInfo.getDuration());

	return convertView;
}
 
开发者ID:dxjia,项目名称:GifAssistant,代码行数:26,代码来源:VideosListAdapter.java

示例4: getVideoThumbnail

import android.provider.MediaStore.Video.Thumbnails; //导入依赖的package包/类
/**
 * 获取视频图像
 * 
 * @param videoPath
 * @return
 */
public static Bitmap getVideoThumbnail(String videoPath) {
    Bitmap bitmap = null;
    bitmap = ThumbnailUtils.createVideoThumbnail(videoPath, Thumbnails.MINI_KIND);
    bitmap = ThumbnailUtils.extractThumbnail(bitmap, 100, 100, ThumbnailUtils.OPTIONS_RECYCLE_INPUT);
    return bitmap;
}
 
开发者ID:csulennon,项目名称:GreenDamFileExploere,代码行数:13,代码来源:CMImageLoader.java

示例5: doInBackground

import android.provider.MediaStore.Video.Thumbnails; //导入依赖的package包/类
@Override
protected Bitmap doInBackground(Void... params) {
    Bitmap bitmap = null;
    try {
        bitmap = ThumbnailUtils.createVideoThumbnail(mImageKey, Thumbnails.FULL_SCREEN_KIND);

        if (bitmap != null) {
            bitmap = Bitmap.createScaledBitmap(bitmap, mMaxWidth, mMaxWidth, false);
            addBitmapToCache(mImageKey, bitmap);
            return bitmap;
        }
        return null;
    } catch (Exception e) {
        if (e != null) {
            e.printStackTrace();
        }
        return null;
    }
}
 
开发者ID:learnNcode,项目名称:MediaChooser,代码行数:20,代码来源:GalleryCache.java

示例6: getStreamFromContent

import android.provider.MediaStore.Video.Thumbnails; //导入依赖的package包/类
protected InputStream getStreamFromContent(String imageUri, Object extra) throws FileNotFoundException {
    ContentResolver res = this.context.getContentResolver();
    Uri uri = Uri.parse(imageUri);
    if (isVideoUri(uri)) {
        Bitmap bitmap = Thumbnails.getThumbnail(res, Long.valueOf(uri.getLastPathSegment()).longValue(), 1, null);
        if (bitmap != null) {
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            bitmap.compress(CompressFormat.PNG, 0, bos);
            return new ByteArrayInputStream(bos.toByteArray());
        }
    } else if (imageUri.startsWith(CONTENT_CONTACTS_URI_PREFIX)) {
        return Contacts.openContactPhotoInputStream(res, uri);
    }
    return res.openInputStream(uri);
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:16,代码来源:BaseImageDownloader.java

示例7: getVideoThumbnail

import android.provider.MediaStore.Video.Thumbnails; //导入依赖的package包/类
public Bitmap getVideoThumbnail() {
    final Bitmap thumbnail = ThumbnailUtils.createVideoThumbnail(mVideoFile.getFullPath(),
            Thumbnails.FULL_SCREEN_KIND);
    if (thumbnail == null) {
        CLog.d(CLog.ACTIVITY, "Failed to generate video preview");
    }
    return thumbnail;
}
 
开发者ID:linglongxin24,项目名称:VideoCamera,代码行数:9,代码来源:VideoCaptureActivity.java

示例8: createPreviewImage

import android.provider.MediaStore.Video.Thumbnails; //导入依赖的package包/类
private String createPreviewImage() throws IOException {
	previewImage = null;
	Bitmap bitmap = ThumbnailUtils.createVideoThumbnail(filePath,
			Thumbnails.FULL_SCREEN_KIND);
	if (bitmap != null) {
		previewImage = foldername + File.separator
				+ Calendar.getInstance().getTimeInMillis() + ".jpg";
		File file = new File(previewImage);
		FileOutputStream stream = new FileOutputStream(file);
		bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream);
		stream.flush();
	}
	return previewImage;
}
 
开发者ID:haruio,项目名称:haru-sdk-android,代码行数:15,代码来源:VideoProcessorThread.java

示例9: createThumbnailOfVideo

import android.provider.MediaStore.Video.Thumbnails; //导入依赖的package包/类
private String createThumbnailOfVideo() throws IOException {
	String thumbnailPath = null;
	Bitmap bitmap = ThumbnailUtils.createVideoThumbnail(filePath,
			Thumbnails.MINI_KIND);
	if (bitmap != null) {
		thumbnailPath = foldername + File.separator
				+ Calendar.getInstance().getTimeInMillis() + ".jpg";
		File file = new File(thumbnailPath);
		FileOutputStream stream = new FileOutputStream(file);
		bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream);
		stream.flush();
	}
	return thumbnailPath;
}
 
开发者ID:haruio,项目名称:haru-sdk-android,代码行数:15,代码来源:VideoProcessorThread.java

示例10: doInBackground

import android.provider.MediaStore.Video.Thumbnails; //导入依赖的package包/类
@Override
protected Drawable doInBackground(Void... params)
{
    Drawable drawable = null;
    Bitmap bitmap = null;
    ContentResolver contentResolver = imageView.getContext().getContentResolver();
    
    if (media.isVideo()) {
        bitmap = MediaStore.Video.Thumbnails.getThumbnail(contentResolver, media.getId(),
                MediaStore.Video.Thumbnails.MINI_KIND, null);
        
        if (bitmap == null) { // can`t get thumb from media database, use
                              // thumb
            if (media.isVideo()) {
                bitmap = ThumbnailUtils.createVideoThumbnail(media.getPath(), Thumbnails.MINI_KIND);
            }
        }
    } else {
        bitmap = ImageUtils.decodeBitmapFromFile(media.getPath(), imageView.getWidth(), imageView.getHeight());
    }
    
    if (bitmap != null) {
        drawable = new BitmapDrawable(res, bitmap);
    }
    
    return drawable;
}
 
开发者ID:fblandroidhackathon,项目名称:persontracker,代码行数:28,代码来源:LoadMediaThumbTask.java

示例11: onCreateView

import android.provider.MediaStore.Video.Thumbnails; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@SuppressLint("NewApi")
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
		Bundle savedInstanceState) {
	Log.v("Create:::", "onCreateView called");
	View rootView = inflater.inflate(R.layout.video_fragment, container,
			false);
	set=(Button) rootView.findViewById(R.id.button_set_alarm);
	set.setOnClickListener(new View.OnClickListener() {
		
		@Override
		public void onClick(View arg0) {
			startActivity(new Intent(getActivity(),SetAlarmActivity.class));			
		}
	});
	mVideoView = (VideoView) rootView.findViewById(R.id.shouye_video_view);
	mVideoView.setOnTouchListener(this);
	mVideoView.setOnCompletionListener(this);
	
	MediaController mc = new MediaController(this.getActivity());
	mc.setVisibility(View.INVISIBLE);
	mVideoView.setMediaController(mc);

	String path = "android.resource://com.qd.clock/" + R.raw.video1;


	Bitmap thumbAsBitmap = ThumbnailUtils.createVideoThumbnail(path,
			MediaStore.Images.Thumbnails.FULL_SCREEN_KIND);
	Bitmap image = this.getVideoThumbnailWithId(R.raw.video1);
	
	
	mVideoView.setBackgroundResource(R.drawable.img_48);
	
	return rootView;
}
 
开发者ID:quding0308,项目名称:beautyClock,代码行数:37,代码来源:GKVideoFragment.java

示例12: processBitmap

import android.provider.MediaStore.Video.Thumbnails; //导入依赖的package包/类
@Override
protected Bitmap processBitmap(Object data) {
	
	String filePath= String.valueOf(data);
	return ThumbnailUtils.createVideoThumbnail(filePath, Thumbnails.MICRO_KIND);
}
 
开发者ID:liuyanggithub,项目名称:SuperSelector,代码行数:7,代码来源:ImageResizer.java

示例13: processBitmap

import android.provider.MediaStore.Video.Thumbnails; //导入依赖的package包/类
@Override
protected Bitmap processBitmap(Object data) {
	
	String filePath=String.valueOf(data);
	return ThumbnailUtils.createVideoThumbnail(filePath, Thumbnails.MICRO_KIND);
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:7,代码来源:ImageResizer.java

示例14: loadImageFromFilePath

import android.provider.MediaStore.Video.Thumbnails; //导入依赖的package包/类
public static Bitmap loadImageFromFilePath(String filePath) {
	return ThumbnailUtils.createVideoThumbnail(filePath,
			Thumbnails.MICRO_KIND);
}
 
开发者ID:macyuan,项目名称:TAG,代码行数:5,代码来源:AsyncImageLoader.java

示例15: getThumbnail

import android.provider.MediaStore.Video.Thumbnails; //导入依赖的package包/类
private Bitmap getThumbnail() {
    if (filename == null) return null;
    return ThumbnailUtils.createVideoThumbnail(filename, Thumbnails.FULL_SCREEN_KIND);
}
 
开发者ID:linglongxin24,项目名称:VideoCamera,代码行数:5,代码来源:CaptureDemoFragment.java


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