android 雷达UI
来源:互联网 发布:python json数据处理 编辑:程序博客网 时间:2024/04/28 01:54
public class BaseView extends RelativeLayout{public Context context;public BaseView(Context context) {super(context);this.context = context;}public BaseView(Context context, AttributeSet attrs) {super(context, attrs);this.context = context;}public BaseView(Context context, AttributeSet attrs, int defStyle) {super(context, attrs, defStyle);this.context = context;}@Overrideprotected void onDraw(Canvas canvas) {super.onDraw(canvas);}}
public class SearchDevicesView extends BaseView{public static final String TAG = "SearchDevicesView";public static final boolean D = BuildConfig.DEBUG; @SuppressWarnings("unused")private long TIME_DIFF = 1500;int[] lineColor = new int[]{0x7B, 0x7B, 0x7B};int[] innerCircle0 = new int[]{0xb9, 0xff, 0xFF};int[] innerCircle1 = new int[]{0xdf, 0xff, 0xFF};int[] innerCircle2 = new int[]{0xec, 0xff, 0xFF};int[] argColor = new int[]{0xF3, 0xf3, 0xfa};private float offsetArgs = 0;private boolean isSearching = false;private Bitmap bitmap;private Bitmap bitmap1;private Bitmap bitmap2;public boolean isSearching() {return isSearching;}public void setSearching(boolean isSearching) {this.isSearching = isSearching;offsetArgs = 0;invalidate();}public SearchDevicesView(Context context) {super(context);initBitmap();}public SearchDevicesView(Context context, AttributeSet attrs) {super(context, attrs);initBitmap();}public SearchDevicesView(Context context, AttributeSet attrs, int defStyle) {super(context, attrs, defStyle);initBitmap();}private void initBitmap(){if(bitmap == null){bitmap = Bitmap.createBitmap(BitmapFactory.decodeResource(context.getResources(), R.drawable.gplus_search_bg));}if(bitmap1 == null){bitmap1 = Bitmap.createBitmap(BitmapFactory.decodeResource(context.getResources(), R.drawable.locus_round_click));}if(bitmap2 == null){bitmap2 = Bitmap.createBitmap(BitmapFactory.decodeResource(context.getResources(), R.drawable.gplus_search_args));}}@SuppressLint("DrawAllocation")@Overrideprotected void onDraw(Canvas canvas) {super.onDraw(canvas);canvas.drawBitmap(bitmap, getWidth() / 2 - bitmap.getWidth() / 2, getHeight() / 2 - bitmap.getHeight() / 2, null);if(isSearching){Rect rMoon = new Rect(getWidth()/2-bitmap2.getWidth(),getHeight()/2,getWidth()/2,getHeight()/2+bitmap2.getHeight()); canvas.rotate(offsetArgs,getWidth()/2,getHeight()/2);canvas.drawBitmap(bitmap2,null,rMoon,null);offsetArgs = offsetArgs + 3;}else{canvas.drawBitmap(bitmap2, getWidth() / 2 - bitmap2.getWidth() , getHeight() / 2, null);}canvas.drawBitmap(bitmap1, getWidth() / 2 - bitmap1.getWidth() / 2, getHeight() / 2 - bitmap1.getHeight() / 2, null);if(isSearching) invalidate();}@Overridepublic boolean onTouchEvent(MotionEvent event) {switch (event.getAction()) {case MotionEvent.ACTION_DOWN:handleActionDownEvenet(event);return true;case MotionEvent.ACTION_MOVE: return true;case MotionEvent.ACTION_UP:return true;}return super.onTouchEvent(event);}private void handleActionDownEvenet(MotionEvent event){RectF rectF = new RectF(getWidth() / 2 - bitmap1.getWidth() / 2, getHeight() / 2 - bitmap1.getHeight() / 2, getWidth() / 2 + bitmap1.getWidth() / 2, getHeight() / 2 + bitmap1.getHeight() / 2);if(rectF.contains(event.getX(), event.getY())){if(D) Log.d(TAG, "click search device button");if(!isSearching()) {setSearching(true);}else{setSearching(false);}}}}
0 0
- android 雷达UI
- android 雷达UI
- Android UI 之自定义RadarView——高仿微信雷达扫描
- Android UI 之自定义RadarView——高仿微信雷达扫描
- [UI]自定义View--雷达图
- Android UI动画之防雷达信号,canvas drawCircle实现,伴随随机icon闪现
- Android UI设计之<十四>自定义ViewGroup,实现绚丽的仿支付宝咻一咻雷达脉冲效果
- Android UI设计之<十四>自定义ViewGroup,实现绚丽的仿支付宝咻一咻雷达脉冲效果
- Android高级UI之颜色渲染——SweepGradient,Matrix实现雷达扫描效果
- Android雷达扫描
- Android 自定义雷达图
- Android雷达式进度条
- Android 雷达扫描效果
- android 仿微信雷达扫描
- android雷达图
- Android 雷达图
- Android 雷达图
- 雷达
- maven 安装
- 矩阵快速幂模板 参考bjfu1440
- 解决编译u-boot-1.1.6 出现undefined reference to `raise'问题后,串口不输出问题
- Photoshop如何实现UI自动切图?
- 怎么找android应用的包名和启动activity
- android 雷达UI
- 高仿微信对话列表滑动删除效果
- 一些关于矩阵的理解
- 为你的网站开启 gzip 压缩功能(nodejs、nginx)
- Kettle定时任务(V4.1)
- Material Design中设置返回箭头的颜色
- Web App、Hybrid App与Native App
- Android UI模板设计 TopBar 标题栏的设计
- Redis --- Sentinel