11package com .hackplan .androidarcmenu ;
22
33import android .content .Context ;
4+ import android .graphics .Color ;
45import android .support .annotation .DrawableRes ;
6+ import android .text .TextUtils ;
57import android .util .AttributeSet ;
68import android .view .View ;
79import android .widget .ImageView ;
@@ -26,19 +28,46 @@ public ArcButton(Context context, AttributeSet attrs, int defStyleAttr) {
2628
2729
2830 public static class Builder {
29- @ DrawableRes private int resId ;
31+ @ DrawableRes private int resId = - 1 ;
3032 private int id ;
33+ private int backgroundColor = -1 ;
34+ private String text ;
35+ private View customView ;
3136
3237 public Builder (@ DrawableRes int resId , int id ) {
3338 this .resId = resId ;
3439 this .id = id ;
3540 }
3641
37- public View getButton (Context context ) {
38- ImageView arcButton = new ImageView (context );
39- arcButton .setImageResource (resId );
40- arcButton .setTag (id );
41- return arcButton ;
42+ /**
43+ * NOT COMPLETED
44+ * @param text
45+ * @param backgroundColor
46+ * @param id
47+ */
48+ private Builder (String text , int backgroundColor , int id ) {
49+ this .text = text ;
50+ this .backgroundColor = backgroundColor ;
51+ this .id = id ;
52+ }
53+
54+ public Builder (View customView , int id ) {
55+ this .customView = customView ;
56+ this .id = id ;
57+ }
58+
59+ View getButton (Context context ) {
60+ if (customView != null ) {
61+ customView .setTag (id );
62+ return customView ;
63+
64+ } else if (resId != -1 ) {
65+ ImageView arcButton = new ImageView (context );
66+ arcButton .setImageResource (resId );
67+ arcButton .setTag (id );
68+ return arcButton ;
69+ }
70+ throw new RuntimeException ("ArcButton does not init correctly" );
4271 }
4372 }
4473}
0 commit comments