/*******************************************************************************
* Copyright 2011, 2012 Chris Banes.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
package com.clientBase.photo;
import static android.view.MotionEvent.ACTION_CANCEL;
import static android.view.MotionEvent.ACTION_DOWN;
import static android.view.MotionEvent.ACTION_UP;
import java.lang.ref.WeakReference;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Matrix;
import android.graphics.Matrix.ScaleToFit;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnLongClickListener;
import android.view.ViewParent;
import android.view.ViewTreeObserver;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.Interpolator;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
import com.clientBase.photo.log.LogManager;
public class PhotoViewAttacher implements IPhotoView, View.OnTouchListener,
OnGestureListener, ViewTreeObserver.OnGlobalLayoutListener {
private static final String LOG_TAG = "PhotoViewAttacher";
// let debug flag be dynamic, but still Proguard can be used to remove from
// release builds
private static final boolean DEBUG = Log.isLoggable(LOG_TAG, Log.DEBUG);
static final Interpolator sInterpolator = new AccelerateDecelerateInterpolator();
int ZOOM_DURATION = DEFAULT_ZOOM_DURATION;
static final int EDGE_NONE = -1;
static final int EDGE_LEFT = 0;
static final int EDGE_RIGHT = 1;
static final int EDGE_BOTH = 2;
private float mMinScale = DEFAULT_MIN_SCALE;
private float mMidScale = DEFAULT_MID_SCALE;
private float mMaxScale = DEFAULT_MAX_SCALE;
private boolean mAllowParentInterceptOnEdge = true;
private static void checkZoomLevels(float minZoom, float midZoom,
float maxZoom) {
if (minZoom >= midZoom) {
throw new IllegalArgumentException(
"MinZoom has to be less than MidZoom");
} else if (midZoom >= maxZoom) {
throw new IllegalArgumentException(
"MidZoom has to be less than MaxZoom");
}
}
/**
* @return true if the ImageView exists, and it's Drawable existss
*/
private static boolean hasDrawable(ImageView imageView) {
return null != imageView && null != imageView.getDrawable();
}
/**
* @return true if the ScaleType is supported.
*/
private static boolean isSupportedScaleType(final ScaleType scaleType) {
if (null == scaleType) {
return false;
}
switch (scaleType) {
case MATRIX:
throw new IllegalArgumentException(scaleType.name()
+ " is not supported in PhotoView");
default:
return true;
}
}
/**
* Set's the ImageView's ScaleType to Matrix.
*/
private static void setImageViewScaleTypeMatrix(ImageView imageView) {
/**
* PhotoView sets it's own ScaleType to Matrix, then diverts all calls
* setScaleType to this.setScaleType automatically.
*/
if (null != imageView && !(imageView instanceof IPhotoView)) {
if (!ScaleType.MATRIX.equals(imageView.getScaleType())) {
imageView.setScaleType(ScaleType.MATRIX);
}
}
}
private WeakReference<ImageView> mImageView;
// Gesture Detectors
private GestureDetector mGestureDetector;
private com.clientBase.photo.GestureDetector mScaleDragDetector;
// These are set so we don't keep allocating them on the heap
private final Matrix mBaseMatrix = new Matrix();
private final Matrix mDrawMatrix = new Matrix();
private final Matrix mSuppMatrix = new Matrix();
private final RectF mDisplayRect = new RectF();
private final float[] mMatrixValues = new float[9];
// Listeners
private OnMatrixChangedListener mMatrixChangeListener;
private OnPhotoTapListener mPhotoTapListener;
private OnViewTapListener mViewTapListener;
private OnLongClickListener mLongClickListener;
private int mIvTop, mIvRight, mIvBottom, mIvLeft;
private FlingRunnable mCurrentFlingRunnable;
private int mScrollEdge = EDGE_BOTH;
private boolean mZoomEnabled;
private ScaleType mScaleType = ScaleType.FIT_CENTER;
public PhotoViewAttacher(ImageView imageView) {
mImageView = new WeakReference<ImageView>(imageView);
imageView.setDrawingCacheEnabled(true);
imageView.setOnTouchListener(this);
ViewTreeObserver observer = imageView.getViewTreeObserver();
if (null != observer)
observer.addOnGlobalLayoutListener(this);
// Make sure we using MATRIX Scale Type
setImageViewScaleTypeMatrix(imageView);
if (imageView.isInEditMode()) {
return;
}
// Create Gesture Detectors...
mScaleDragDetector = VersionedGestureDetector.newInstance(
imageView.getContext(), this);
mGestureDetector = new GestureDetector(imageView.getContext(),
new GestureDetector.SimpleOnGestureListener() {
// forward long click listener
@Override
public void onLongPress(MotionEvent e) {
if (null != mLongClickListener) {
mLongClickListener.onLongClick(getImageView());
}
}
});
mGestureDetector.setOnDoubleTapListener(new DefaultOnDoubleTapListener(
this));
// Finally, update the UI so that we're zoomable
setZoomable(true);
}
@Override
public void setOnDoubleTapListener(
GestureDetector.OnDoubleTapListener newOnDoubleTapListener) {
if (newOnDoubleTapListener != null)
this.mGestureDetector
.setOnDoubleTapListener(newOnDoubleTapListener);
else
this.mGestureDetector
.setOnDoubleTapListener(new DefaultOnDoubleTapListener(this));
}
@Override
public boolean canZoom() {
return mZoomEnabled;
}
@SuppressWarnings("deprecation")
public void cleanup() {
if (null == mImageView) {
return; // cleanup already done
}
final ImageView imageView = mImageView.get();
if (null != imageView) {
// Remove this as a global layout listener
ViewTreeObserver observer = imageView.getViewTreeObserver();
if (null != observer && observer.isAlive()) {
observer.removeGlobalOnLayoutListener(this);
}
// Remove the ImageView's reference to this
imageView.setOnTouchListener(null);
// make sure a pending fling runnable won't be run
cancelFling();
}
if (null != mGestureDetector) {
mGestureDetector.setOnDoubleTapListener(null);
}
// Clear listeners too
mMatrixChangeListener = null;
mPhotoTapListener = null;
mViewTapListener = null;
// Finally, clear ImageView
mImageView = null;
}
@Override
public RectF getDisplayRect() {
checkMatrixBounds();
return getDisplayRect(getDrawMatrix());
}
@Override
public boolean setDisplayMatrix(Matrix finalMatrix) {
if (finalMatrix == null)
throw new IllegalArgumentException("Matrix cannot be null");
ImageView imageView = getImageView();
if (null == imageView)
return false;
if (null == imageView.getDrawable())
return false;
mSuppMatrix.set(finalMatrix);
setImageViewMatrix(getDrawMatrix());
checkMatrixBounds();
return true;
}
/**
* @deprecated use {@link #setRotationTo(float)}
*/
@Override
public void setPhotoViewRotation(float degrees) {
mSuppMatrix.setRotate(degrees % 360);
checkAndDisplayMatrix();
}
@Override
public void setRotationTo(float degrees) {
mSuppMatrix.setRotate(degrees % 360);
checkAndDisplayMatrix();
}
@Override
public void setRotationBy(float degrees) {
mSuppMatrix.postRotate(degrees
没有合适的资源?快使用搜索试试~ 我知道了~
毕业设计源码-基于android的母婴商城app系统
共825个文件
xml:236个
png:225个
java:207个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
4星 · 超过85%的资源 1 下载量 80 浏览量
2023-02-21
21:56:45
上传
评论
收藏 13.06MB RAR 举报
温馨提示
(1)用户注册登录:用户通过登录账号和密码来登录, (2)母婴用品详细信息功能 (3)母婴用品查找功能: (4)购物车功能: (5)个人信息操作功能: (6)订单管理员功能: (7)母婴健康咨询: (8)游客登录: 后台功能 (1)管理员登录功能: (2)母婴用品种类的增加、删除、修改功能: (3)订单的查看功能: (4)用户的基本信息管理功能: ———————————————— 版权声明:本文为CSDN博主「Android毕业设计源码」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/u014388322/article/details/128749932
资源推荐
资源详情
资源评论
收起资源包目录
毕业设计源码-基于android的母婴商城app系统 (825个子文件)
gradlew.bat 2KB
.gitignore 105B
.gitignore 8B
build.gradle 2KB
build.gradle 757B
settings.gradle 16B
gradlew 5KB
Msc.jar 358KB
httpcore-4.4.1.jar 315KB
commons-net-3.0.1.jar 263KB
universal-image-loader-1.9.3.jar 157KB
afinal_0.5.1_bin.jar 153KB
gradle-wrapper.jar 52KB
PhotoViewAttacher.java 28KB
WheelView.java 24KB
SystemBarTintManager.java 19KB
Util.java 19KB
AnimationView.java 13KB
ShopFragment.java 13KB
MyFragment.java 13KB
PullToRefreshLayout.java 12KB
SearchActivity.java 12KB
IPhotoView.java 11KB
CycleViewPager.java 10KB
ShouYEFragment.java 10KB
IndexMainFragment.java 10KB
PayShopMessageActivity.java 9KB
FrameworkActivity.java 9KB
MemberUserUtils.java 9KB
CarFragment.java 9KB
IndexFragment.java 9KB
RecommendFragment.java 9KB
LoginActivity.java 9KB
ShopMessageActivity.java 8KB
CollectShopMessageActivity.java 8KB
TimeUtil.java 8KB
PhotoView.java 7KB
ShowCreatePicturesActivity.java 7KB
PictureSlideDeleteFragment.java 7KB
WheelMain.java 7KB
BaseActivity.java 7KB
IcsLinearLayout.java 7KB
SelectImagesActivity.java 6KB
TimeUtilDialog.java 6KB
ActionSheetDialog.java 6KB
StarBar.java 6KB
MyAlertDialog.java 6KB
BaseFragment.java 6KB
ShowImageWebView.java 6KB
BaseMessageActivity.java 6KB
RegisterCreatActivity.java 5KB
GridAdapter.java 5KB
ShopReviewMessageActivity.java 5KB
Rotate3dAnimation.java 5KB
IconPageIndicator.java 5KB
JellyRefreshLayout.java 5KB
ShowPictureActivity.java 5KB
InstructorAdapter.java 5KB
ImageLoaderOptions.java 5KB
FileUtils.java 5KB
ChatMessageActivity.java 5KB
CarListAdapter.java 5KB
Logger.java 4KB
MainFragment.java 4KB
CarModel.java 4KB
SelectedImageAdapter.java 4KB
NewsFragment.java 4KB
RoundRectImageView.java 4KB
AddressChoiceActivity.java 4KB
AddressListActivity.java 4KB
ShopModel.java 4KB
CupcakeGestureDetector.java 4KB
ShopSendAdapter.java 4KB
ImageUtil.java 4KB
MyShopTypeListActivity.java 4KB
ShopSearchListAdapter.java 4KB
MyOrderActivity.java 4KB
MyCollectActivity.java 4KB
OrderBean.java 4KB
DatabaseContext.java 4KB
MyShopListActivity.java 3KB
UploadUtils.java 3KB
MyCarActivity.java 3KB
ArcImageView.java 3KB
OptAnimationLoader.java 3KB
ShopListAdapter.java 3KB
UpdatePswdActivity.java 3KB
EclairGestureDetector.java 3KB
CreatJiJianActivity.java 3KB
OrderAdapter.java 3KB
MoneyUpdateActivity.java 3KB
DefaultOnDoubleTapListener.java 3KB
UpdateNameActivity.java 3KB
CollectListAdapter.java 3KB
ScreenUtils.java 3KB
CircleImageView.java 3KB
JellyLayout.java 3KB
OrderInforActivity.java 3KB
UserActivity.java 3KB
ShopOrderReviewAdapter.java 3KB
共 825 条
- 1
- 2
- 3
- 4
- 5
- 6
- 9
资源评论
- 2301_768930442023-06-29有没有更详细的视频讲解Android毕业设计源码2023-08-10给你的文件里面有文档;文档里面有源码的整体的逻辑说明视频
Android毕业设计源码
- 粉丝: 1w+
- 资源: 253
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功