Android Radar UI

Source: Internet
Author: User
Tags radar

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 = Contex t;} @Overrideprotected void OnDraw (canvas canvas) {super.ondraw (canvas);}}
public class Searchdevicesview extends baseview{public static final String TAG = "Searchdevicesview";p ublic static final B Oolean 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};p rivate Float Offsetargs = 0;private Boolean issearching = False;priva Te 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 (Issea rching) {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 (i ssearching) 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, GE Theight ()/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);}}}

: http://download.csdn.net/detail/u014600432/8248689

Android Radar UI

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.