package com.lenovo.anyshare.widget; import com.lenovo.common.Logger; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Paint.Style; import android.graphics.Rect; import android.util.AttributeSet; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.view.View; public class RadarScannerSurfaceView extends SurfaceView implements SurfaceHolder.Callback { private static final int TIME_INTERNAL = 100; private SurfaceTread mThread; private boolean mIsInAnimation = true; private View mCenterView; private Paint mLinePaint; private int mWidth = 0; private int mTop = 0; private int mLeft = 0; private Style mLinePaintStyle = Style.FILL; private int mTransparency = 0xFF; private int mRed = 0xff; private int mGreen = 0xff; private int mBlue = 0xff; private int mCurIndex[] = { 0, 0, 0, 0 }; private float mTime[] = { 0, 0.8f, 1.6f, 2.4f }; private int mV0 = 10; private int mAcc = 150; private int mInterval = 0; public RadarScannerSurfaceView(Context context) { super(context); initView(context); } public RadarScannerSurfaceView(Context context, AttributeSet attrs) { super(context, attrs); initView(context); } public RadarScannerSurfaceView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); initView(context); } public void setStyle(Style style, int transparency, int red, int green, int blue) { mLinePaintStyle = style; mTransparency = transparency; mRed = red; mGreen = green; mBlue = blue; mLinePaint.setStyle(mLinePaintStyle); } private void initView(Context context) { setWillNotDraw(false); getHolder().addCallback(this); mLinePaint = new Paint(); mLinePaint.setAntiAlias(true); mLinePaint.setStyle(mLinePaintStyle); } @Override public void onDraw(Canvas canvas) { canvas.drawColor(Color.WHITE); drawCanvas(canvas); } @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {} @Override public void surfaceCreated(SurfaceHolder holder) { mThread = new SurfaceTread(holder); mThread.mIsRun = true; mThread.start(); } @Override public void surfaceDestroyed(SurfaceHolder holder) { mThread.mIsRun = false; mThread.interrupt(); } public void setAlignView(View view) { mCenterView = view; this.postInvalidate(); } public void startAnimation() { // for (int i = 0; i < mTime.length; i++) { // mTime[i] = mInterval * i; // } mIsInAnimation = true; } public void stopAnimation() { // for (int i = 0; i < mTime.length; i++) { // mTime[i] = mInterval * i; // } mIsInAnimation = false; this.postInvalidate(); } private void drawCanvas(Canvas canvas) { if (mCenterView != null) { mTop = mCenterView.getTop(); mLeft = mCenterView.getLeft(); mWidth = mCenterView.getWidth(); } else { mLeft = 0; mTop = canvas.getHeight() / 2; mWidth = canvas.getWidth(); } Logger.v("xiaxing", "mWidth : " + mWidth); if (!mIsInAnimation) return; Rect line = new Rect(); mCenterView.getHitRect(line); int color = Color.argb(0xff, 0x24, 0xde, 0xff); mLinePaint.setColor(color); canvas.drawRect(line, mLinePaint); color = Color.argb(mTransparency, mRed, mGreen, mBlue); mLinePaint.setColor(color); canvas.drawRect(mLeft + mCurIndex[0], mTop, mLeft + 6 + mCurIndex[0], mTop + 4, mLinePaint); color = Color.argb(mTransparency, mRed, mGreen, mBlue); mLinePaint.setColor(color); canvas.drawRect(mLeft + mCurIndex[1], mTop, mLeft + 6 + mCurIndex[1], mTop + 4, mLinePaint); color = Color.argb(mTransparency, mRed, mGreen, mBlue); mLinePaint.setColor(color); canvas.drawRect(mLeft + mCurIndex[2], mTop, mLeft + 6 + mCurIndex[2], mTop + 4, mLinePaint); color = Color.argb(mTransparency, mRed, mGreen, mBlue); mLinePaint.setColor(color); canvas.drawRect(mLeft + mCurIndex[3], mTop, mLeft + 6 + mCurIndex[3], mTop + 4, mLinePaint); } public class SurfaceTread extends Thread { public boolean mIsRun = false; private SurfaceHolder mHolder; public SurfaceTread(SurfaceHolder holder) { this.mHolder = holder; } @Override public void run() { try { Thread.sleep(600); } catch (InterruptedException e) {} while (mIsRun) { if (!mIsInAnimation || !mHolder.getSurface().isValid()) { try { Thread.sleep(TIME_INTERNAL); } catch (InterruptedException e) {} continue; } RadarScannerSurfaceView.this.postInvalidate(); try { Thread.sleep(TIME_INTERNAL); } catch (InterruptedException e) {} // s = v0*t + a * t2 / 2 for (int i = 0; i < mCurIndex.length; i++) { if (mCurIndex[i] > mWidth) mTime[i] = 0; mTime[i] = mTime[i] + 0.1f; mCurIndex[i] = (int)(mV0 * mTime[i] + mAcc * mTime[i] * mTime[i] / 2); } } } }; }
相关推荐
来源:github/ShareCenterExampLicence:MIT平台:iOS设备:iPhone / iPad作者:邓宇光 新浪微博, 腾讯微博,人人网登录认证Demo。...如果测试时发现登录不了,那有可能是key过期了,得自己重新申请。...
ILSSCShareCenter 需求 Mercury移动浏览器有一个分享内容到第三方平台的功能,第三方平台的数量有十几个。现有的方案是将每个平台自家或第三方发布的SDK集成到项目中来实现。带来的问题是App体积包增大,代码的可控...
D-Link DNS-320L 驱动程序是微型程序,能够让您的 网络存储 硬件与操作系统软件进行通讯。维持最新的 D-Link DNS-320L 软件能够防止崩溃,并充分利用硬件与系统性能。使用陈旧或损坏的 D-Link DNS-320L 驱动程序会...
1. 双击打开eMaxim_link_tool 2. 插入接收器点击等待Status:显示Device detected. 3. 点击按钮或空格键进入对码,LED将会闪烁20秒,此时按鼠标或键盘对码键可进行配对,配对成功LED熄灭
DNS-320L是一款由D-Link推出的网络存储设备(NAS),主要功能是提供数据存储、备份和共享服务。默认情况下,该设备的操作界面采用英文显示,但针对中文用户,D-Link提供了中文化更新档案,使得用户可以将界面语言...
ShareCenter是一个专业的网络技术交流社区,尤其在Cisco网络设备和技术方面有着丰富的资源。对于网络工程师来说,这里是一个很好的学习和交流平台。 #### 9. TopRen (http://www.topren.net/forum/index.php) ...
### D-Link ShareCenter Pulse DNS-320 网络存储设备用户手册解析 #### 产品概述 D-Link ShareCenter Pulse DNS-320 是一款双硬盘位的网络附加存储(NAS)设备,旨在为家庭或小型办公室提供安全、高效的数据存储与...
- **推荐理由**:无论是寻找解决方案还是技术讨论,ShareCenter都是一个不错的选择。 #### 9. TopRen论坛 (http://www.topren.net/forum/index.php) - **简介**:TopRen论坛专注于IT管理和信息化建设,特别适合CIO...
8. **ShareCenter论坛**(http://www.sharecenter.net/):同样面向网络工程师,以CISCO技术为主,风格独特。 9. **唐人社区**(http://www.topren.net/forum/index.php):面向企业策划和CIO,提供信息化管理资讯...
8. ShareCenter(http://www.sharecenter.net/):网络工程师的热门选择,以CISCO技术为主,历史悠久,内容丰富。 9. Netsp网络技术(www.netsp.com.cn):收集了各大厂商的产品资料和配置信息,适合网络技术的学习...
- **网站概述**:ShareCenter网站似乎是一个资源共享平台,用户可以在上面分享和下载各种资源。 - **潜在价值**:对于需要特定技术资料或软件的用户来说非常有用。 ### 结论 通过上述对各网站的介绍和分析,我们...
4. 菊花论坛(http://www.sharecenter.net/):面向网络工程师。该社区特色在于它提供了大量的网络工程类文章和讨论,涵盖 CISCO 工程等方面的内容。 5. IT 售前论坛(http://www.sysvs.com/bbs):面向 IT 售前及...
22. **ShareCenter** (http://www.sharecenter.net/) - **功能简介**:提供技术文档和资源分享平台。 - **应用场景**:获取技术文档、分享知识资源。 23. **天涯俱乐部** (http://www.tianyaclub.com/) - **功能...