Project

General

Profile

« Previous | Next » 

Revision 47ba5ddc

Added by Leszek Koltunski over 4 years ago

RubikCube: further fixes

View differences:

src/main/java/org/distorted/component/HorizontalNumberPicker.java
36 36
  private TextView mNumber;
37 37
  private int mMin, mMax;
38 38

  
39
  public HorizontalNumberPicker(Context context, @Nullable AttributeSet attrs)
40
    {
41
    super(context, attrs);
42

  
43
    mMin = 0;
44
    mMax = 5;
45

  
46
    inflate(context, R.layout.numberpicker, this);
47

  
48
    mNumber = findViewById(R.id.textNumber);
49

  
50
    final Button btn_less = findViewById(R.id.buttonLess);
51
    btn_less.setOnClickListener(new AddHandler(-1));
52

  
53
    final Button btn_more = findViewById(R.id.buttonMore);
54
    btn_more.setOnClickListener(new AddHandler( 1));
55
    }
56

  
57
///////////////////////////////////////////////////////////////////////////////////////////////////
58

  
59 39
  private class AddHandler implements OnClickListener
60 40
    {
61 41
    final int diff;
......
82 62
      }
83 63
    }
84 64

  
65
///////////////////////////////////////////////////////////////////////////////////////////////////
66
// PUBLIC API
67
///////////////////////////////////////////////////////////////////////////////////////////////////
68

  
69
  public HorizontalNumberPicker(Context context, @Nullable AttributeSet attrs)
70
    {
71
    super(context, attrs);
72

  
73
    mMin = 0;
74
    mMax = 5;
75

  
76
    inflate(context, R.layout.numberpicker, this);
77

  
78
    mNumber = findViewById(R.id.textNumber);
79

  
80
    final Button btn_less = findViewById(R.id.buttonLess);
81
    btn_less.setOnClickListener(new AddHandler(-1));
82

  
83
    final Button btn_more = findViewById(R.id.buttonMore);
84
    btn_more.setOnClickListener(new AddHandler( 1));
85
    }
86

  
85 87
///////////////////////////////////////////////////////////////////////////////////////////////////
86 88

  
87 89
  public int getValue()
......
111 113
      }
112 114
    }
113 115

  
114
///////////////////////////////////////////////////////////////////////////////////////////////////
115

  
116
  public int getMin()
117
    {
118
    return mMin;
119
    }
120

  
121 116
///////////////////////////////////////////////////////////////////////////////////////////////////
122 117

  
123 118
  public void setMin(int min)
......
125 120
    mMin = min;
126 121
    }
127 122

  
128
///////////////////////////////////////////////////////////////////////////////////////////////////
129

  
130
  public int getMax()
131
    {
132
    return mMax;
133
    }
134

  
135 123
///////////////////////////////////////////////////////////////////////////////////////////////////
136 124

  
137 125
  public void setMax(int max)

Also available in: Unified diff