package com.image.coverflow;
import android.content.Context;
import android.graphics.Camera;
import android.graphics.Matrix;
import android.util.AttributeSet;
import android.view.View;
import android.view.animation.Transformation;
import android.widget.Gallery;
import android.widget.ImageView;
public class GalleryFlow extends Gallery {
private Camera mCamera=new Camera();
private int mMaxRotationAngle=60;
private int mMaxZoom=-120;
private int mCoverflowCenter;
public GalleryFlow(Context context) {
super(context);
this.setStaticTransformationsEnabled(true);
}
public GalleryFlow(Context context,AttributeSet attrs){
super(context, attrs);
this.setStaticTransformationsEnabled(true);
}
public GalleryFlow(Context context,AttributeSet attrs,int defStyle){
super(context, attrs,defStyle);
this.setStaticTransformationsEnabled(true);
}
public int getMaxRotationAngle(){
return mMaxRotationAngle;
}
public void setMaxRotationAngle(int maxRotationAngle){
mMaxRotationAngle=maxRotationAngle;
}
public int getMaxZoom(){
return mMaxZoom;
}
public void setMaxZoom(int maxZoom){
mMaxZoom=maxZoom;
}
private int getCenterOfCoverflow(){
return (getWidth()-getPaddingLeft()-getPaddingRight())/2+getPaddingLeft();
}
private static int getCenterOfView(View view){
return view.getLeft()+view.getWidth()/2;
}
@Override
protected boolean getChildStaticTransformation(View child, Transformation t) {
// TODO Auto-generated method stub
final int childCenter=getCenterOfView(child);
final int childWidth=child.getWidth();
int rotationAngle=0;
t.clear();
t.setTransformationType(Transformation.TYPE_MATRIX);
if(childCenter==mCoverflowCenter){
transformImageBitmap((ImageView)child,t,0);
}else{
rotationAngle=(int)(((float)(mCoverflowCenter-childCenter)/childWidth)*mMaxRotationAngle);
if(Math.abs(rotationAngle)>mMaxRotationAngle){
rotationAngle=(rotationAngle<0)?-mMaxRotationAngle:mMaxRotationAngle;
}
transformImageBitmap((ImageView)child, t, rotationAngle);
}
return true;
}
private void transformImageBitmap(ImageView child, Transformation t, int rotationAngle) {
mCamera.save();
final Matrix imageMatrix=t.getMatrix();
final int imageHeight=child.getLayoutParams().height;
final int imageWidth=child.getLayoutParams().width;
final int rotation=Math.abs(rotationAngle);
mCamera.translate(0.0f, 0.0f, 100.0f);
if(rotation<mMaxRotationAngle){
float zoomAmount=(float)(mMaxZoom+(rotation*1.5));
mCamera.translate(0.0f, 0.0f, zoomAmount);
}
mCamera.rotateY(rotationAngle);
mCamera.getMatrix(imageMatrix);
imageMatrix.preTranslate(-(imageWidth/2), -(imageHeight/2));
imageMatrix.postTranslate((imageWidth/2), (imageHeight/2));
mCamera.restore();
}
protected void onSizeChanged(int w,int h,int oldw,int oldh) {
mCoverflowCenter=getCenterOfCoverflow();
super.onSizeChanged(w, h, oldw, oldh);
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
小程序源码 摄影图像 炫酷相册源码.rar
共36个文件
class:10个
png:8个
java:4个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 160 浏览量
2023-03-29
19:52:24
上传
评论
收藏 4.15MB RAR 举报
温馨提示
免责声明:资料部分来源于合法的互联网渠道收集和整理,部分自己学习积累成果,供大家学习参考与交流。收取的费用仅用于收集和整理资料耗费时间的酬劳。 本人尊重原创作者或出版方,资料版权归原作者或出版方所有,本人不对所涉及的版权问题或内容负法律责任。如有侵权,请举报或通知本人删除。
资源推荐
资源详情
资源评论
收起资源包目录
小程序源码 摄影图像 炫酷相册源码.rar (36个子文件)
Android 炫酷相册源码
project.properties 361B
.classpath 364B
assets
src
com
image
coverflow
GalleryFlow.java 3KB
CoverflowActivity.java 2KB
ImageAdapter.java 3KB
res
drawable-mdpi
ic_launcher.png 3KB
drawable-ldpi
ic_launcher.png 2KB
values
strings.xml 184B
layout
layout_gallery.xml 583B
drawable-hdpi
p05.jpg 185KB
p04.jpg 274KB
p02.jpg 246KB
p01.jpg 199KB
p03.png 412KB
ic_launcher.png 4KB
bin
classes
com
image
coverflow
CoverflowActivity.class 2KB
R$string.class 430B
R$layout.class 407B
R$id.class 393B
GalleryFlow.class 4KB
R$attr.class 343B
ImageAdapter.class 4KB
R$drawable.class 545B
CoverflowActivity$MyGestureListener.class 2KB
R.class 538B
resources.ap_ 1.29MB
res
drawable-mdpi
ic_launcher.png 2KB
drawable-ldpi
ic_launcher.png 2KB
drawable-hdpi
p03.png 404KB
ic_launcher.png 4KB
classes.dex 10KB
coverflow.apk 1.3MB
proguard.cfg 1KB
.project 845B
AndroidManifest.xml 742B
gen
com
image
coverflow
R.java 1004B
共 36 条
- 1
资源评论
荣华富贵8
- 粉丝: 149
- 资源: 7649
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功