package com.worldchip.apk;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.Buffer;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.Timer;
import java.util.TimerTask;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.Matrix;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.preference.PreferenceManager;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.Display;
import android.view.GestureDetector;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.view.Window;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.Gallery;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
import android.widget.Toast;
public class ImageGalleryView extends Activity{
private static final String TAG = "ImageGalleryView";
private static final String PREF_SLIDESHOW_REPEAT =
"pref_gallery_slideshow_repeat_key";
Gallery gallery=null;
Animation anim=null;
String[] paths=null;
List<String> mImagePathList;
private ImageGetter mGetter;
private final Random mRandom = new Random(System.currentTimeMillis());
boolean mPaused = true;
private boolean mSlideShowLoop = false;
private int mSlideShowInterval=1000;
private int mLastSlideShowImage;
int mCurrentPosition = 0;
// represents which style animation to use
private int mAnimationIndex;
private Animation [] mSlideShowInAnimation;
private Animation [] mSlideShowOutAnimation;
private SharedPreferences mPrefs;
// Choices for what adjacents to load.
private static final int[] sOrderAdjacents = new int[] {0, 1, -1};
private static final int[] sOrderSlideshow = new int[] {0};
GestureDetector mGestureDetector;
final GetterHandler mHandler = new GetterHandler();
static final int MODE_NORMAL = 1;
static final int MODE_SLIDESHOW = 2;
private int mMode = MODE_NORMAL;
// The image view displayed for normal mode.
private ImageViewTouch mCurrentImageView;
private Button mSaveConfirm;
private Button mSaveCancel;
// This is the cache for thumbnail bitmaps.
private BitmapCache mCache;
String path=null;
GalleryAdapter galleryAdapter=null;
private float scaleWidth=1, scaleHeight=1;
private int mSlideShowImageCurrent = 0;
private final ImageViewTouchBase [] mSlideShowImageViews =
new ImageViewTouchBase[2];
private Bitmap currentBitmap;
private Bitmap effectsBitmap;
private String currentPath;
private int currentPosition;
private int displayWidth, displayHeight;
//FLING PARMS
public static final int FLING_MIN_DISTANCE=100;
public static final int FLING_MIN_VELOCITY=200;
//Menu
public static final int ANIMATION = Menu.FIRST;
public static final int ROTATE = Menu.FIRST+1;
public static final int THUMBNAIL = Menu.FIRST+2;
public static final int SETUPFOR = Menu.FIRST+5;
public static final int DELETE = Menu.FIRST+6;
public static final int DETAILS = Menu.FIRST+3;
public static final int QUITE = Menu.FIRST+4;
public static final int EFFECTS = Menu.FIRST+7;
private void setupOnTouchListeners(View rootView) {
mGestureDetector = new GestureDetector(this, new MyGestureListener());
OnTouchListener rootListener = new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
mGestureDetector.onTouchEvent(event);
// We do not use the return value of
// mGestureDetector.onTouchEvent because we will not receive
// the "up" event if we return false for the "down" event.
return true;
}
};
rootView.setOnTouchListener(rootListener);
}
private class MyGestureListener extends
GestureDetector.SimpleOnGestureListener {
@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2,
float distanceX, float distanceY) {
//if (mPaused) return false;
ImageViewTouch imageView = mCurrentImageView;
if (imageView.getScale() > 1F) {
imageView.postTranslateCenter(-distanceX, -distanceY);
}
return true;
}
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
float velocityY) {
// TODO Auto-generated method stub
if((e1.getX()-e2.getX()>FLING_MIN_DISTANCE)&&
Math.abs(velocityX)>FLING_MIN_VELOCITY)
{
moveNextOrPrevious(1);
}
else if((e2.getX()-e1.getX()>FLING_MIN_DISTANCE)&&
Math.abs(velocityX)>FLING_MIN_VELOCITY)
{
moveNextOrPrevious(-1);
}
return super.onFling(e1, e2, velocityX, velocityY);
}
@Override
public boolean onSingleTapUp(MotionEvent e) {
//if (mPaused) return false;
//setMode(MODE_NORMAL);
//openOptionsMenu();
return true;
}
@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
//if (mPaused) return false;
//showOnScreenControls();
//scheduleDismissOnScreenControls();
setMode(MODE_NORMAL);
openOptionsMenu();
return true;
}
@Override
public boolean onDown(MotionEvent e) {
// TODO Auto-generated method stub
return super.onDown(e);
}
@Override
public boolean onDoubleTap(MotionEvent e) {
//if (mPaused) return false;
ImageViewTouch imageView = mCurrentImageView;
// Switch between the original scale and 3x scale.
if (imageView.getScale() > 2F) {
mCurrentImageView.zoomTo(1f);
} else {
mCurrentImageView.zoomToPoint(3f, e.getX(), e.getY());
}
return true;
}
}
private Animation makeInAnimation(int id) {
Animation inAnimation = AnimationUtils.loadAnimation(this, id);
return inAnimation;
}
private Animation makeOutAnimation(int id) {
Animation outAnimation = AnimationUtils.loadAnimation(this, id);
return outAnimation;
}
private static int getPreferencesInteger(
SharedPreferences prefs, String key, int defaultValue) {
String value = prefs.getString(key, null);
try {
return value == null ? defaultValue : Integer.parseInt(value);
} catch (NumberFormatException ex) {
Log.e(TAG, "couldn't parse preference: " + value, ex);
return defaultValue;
}
}
void setMode(int mode) {
if (mMode == mode) {
return;
}
View slideshowPanel = findViewById(R.id.slideShowContainer);
View normalPanel = findViewById(R.id.abs);
Window win = getWindow();
mMode = mode;
if (mo
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
Android 图片浏览功能源码-IT计算机-毕业设计.zip (224个子文件)
resources.ap_ 172KB
JoyImageView.apk 238KB
proguard.cfg 1KB
ImageGalleryView.class 21KB
ImageManager.class 12KB
ImageListView.class 12KB
Util.class 10KB
ImageViewTouchBase.class 9KB
ImageCommon.class 7KB
BaseImageList.class 6KB
JoyImageViewActivity.class 6KB
DBAdapter.class 6KB
ImageListUber.class 6KB
BaseImage.class 5KB
UriImage.class 5KB
BitmapManager.class 5KB
Image.class 5KB
ImageList.class 5KB
ImageGetter$ImageGetterRunnable.class 4KB
GridViewAdapter.class 4KB
ImageGetter.class 4KB
ImageGridView.class 4KB
ImageListView$2.class 3KB
ListViewAdapter.class 3KB
ListAdapter.class 3KB
ImageViewMain.class 3KB
JoyImageViewActivity$4.class 3KB
SaveingImageService$1.class 3KB
ImageGalleryView$12$1.class 3KB
ImageGalleryView$10.class 3KB
GalleryAdapter.class 3KB
ImageGridView$1.class 3KB
JoyImageViewActivity$ProgressThread.class 3KB
SaveingImageService.class 3KB
ImageGalleryView$14.class 3KB
ImageManager$ImageListParam.class 2KB
ImageViewTouch.class 2KB
ImageGalleryView$MyGestureListener.class 2KB
LruCache.class 2KB
ImageGalleryView$8.class 2KB
ImageGalleryView$13.class 2KB
ImageGalleryView$12.class 2KB
SingleImageList.class 2KB
BitmapCache.class 2KB
Common.class 2KB
RotateBitmap.class 2KB
R$string.class 2KB
ImageViewMain$1.class 2KB
DBAdapter$DatabaseHelper.class 2KB
ImageManager$EmptyImageList.class 2KB
ImageGalleryView$6.class 2KB
ImageGetter$ImageGetterRunnable$1.class 2KB
JoyImageViewActivity$1.class 2KB
ImageGalleryView$1.class 1KB
ImageListView$1.class 1KB
BitmapManager$ThreadStatus.class 1KB
GetterHandler.class 1KB
ImageGalleryView$7.class 1KB
ImageViewTouchBase$2.class 1KB
ImageManager$DataLocation.class 1KB
ImageListUber$DescendingComparator.class 1KB
ImageListUber$AscendingComparator.class 1KB
ImageGalleryView$9.class 1KB
ImageGetter$ImageGetterRunnable$2.class 1KB
ImageManager$ImageListParam$1.class 1KB
R$anim.class 1KB
BitmapManager$State.class 1KB
IImage.class 1KB
USBDisconnectReceiver.class 1KB
ImageListUber$MergeSlot.class 1KB
LruCache$1.class 1KB
R$id.class 1KB
ImageGalleryView$11.class 1KB
R$drawable.class 1KB
LruCache$Entry.class 1015B
JoyImageViewActivity$2.class 949B
ImageGalleryView$2.class 944B
ImageGalleryView$4.class 943B
JoyImageViewActivity$3.class 881B
ImageViewTouchBase$1.class 877B
ImageGalleryView$15.class 857B
ImageGalleryView$3.class 842B
ImageGalleryView$5.class 831B
ListViewAdapter$ViewHolder.class 796B
ListAdapter$ViewHolder.class 726B
R$layout.class 703B
Util$1.class 656B
IImageList.class 626B
BitmapCache$Entry.class 575B
R.class 569B
ImageInfo.class 462B
R$attr.class 337B
ImageGetterCallback.class 333B
ImageViewTouchBase$Recycler.class 277B
.classpath 289B
classes.dex 125KB
ImageGalleryView.java 45KB
ImageManager.java 17KB
Util.java 14KB
ImageListView.java 13KB
共 224 条
- 1
- 2
- 3
资源评论
芝麻粒儿
- 粉丝: 6w+
- 资源: 2万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功