Project

General

Profile

« Previous | Next » 

Revision 2afc6754

Added by Leszek Koltunski over 2 years ago

Move RubikControl to objectlib (as 'ObjectAutomator')
Hide ObjectPreRender inside objectlib and move its APi to ObjectControl.

View differences:

src/main/java/org/distorted/screens/RubikScreenSolution.java
28 28
import android.widget.LinearLayout;
29 29
import android.widget.TextView;
30 30

  
31
import org.distorted.objectlib.main.ObjectControl;
31 32
import org.distorted.objectlib.main.TwistyObject;
32

  
33 33
import org.distorted.objectlib.helpers.MovesFinished;
34

  
34 35
import org.distorted.helpers.TransparentImageButton;
35 36
import org.distorted.main.R;
36 37
import org.distorted.main.RubikActivity;
37
import org.distorted.objectlib.main.ObjectPreRender;
38 38
import org.distorted.patterns.RubikPattern;
39 39

  
40 40
///////////////////////////////////////////////////////////////////////////////////////////////////
......
121 121
      @Override
122 122
      public void onClick(View v)
123 123
        {
124
        ObjectPreRender pre = act.getPreRender();
125
        backMove(pre);
124
        ObjectControl control = act.getControl();
125
        backMove(control);
126 126
        mMovesText.setText(act.getString(R.string.mo_placeholder,mCurrMove,mNumMoves));
127 127
        }
128 128
      });
......
140 140
      @Override
141 141
      public void onClick(View v)
142 142
        {
143
        ObjectPreRender pre = act.getPreRender();
144
        makeMove(pre);
143
        ObjectControl control = act.getControl();
144
        makeMove(control);
145 145
        mMovesText.setText(act.getString(R.string.mo_placeholder,mCurrMove,mNumMoves));
146 146
        }
147 147
      });
......
187 187

  
188 188
///////////////////////////////////////////////////////////////////////////////////////////////////
189 189

  
190
  private void makeMove(ObjectPreRender pre)
190
  private void makeMove(ObjectControl control)
191 191
    {
192 192
    if( mCanRotate )
193 193
      {
......
196 196
      if( mCurrMove>mNumMoves )
197 197
        {
198 198
        mCurrMove= 0;
199
        pre.initializeObject(null);
199
        control.initializeObject(null);
200 200
        }
201 201
      else
202 202
        {
203 203
        int axis      = mMoves[mCurrMove-1][0];
204 204
		    int rowBitmap = mMoves[mCurrMove-1][1];
205 205
		    int bareAngle = mMoves[mCurrMove-1][2];
206
		    int basicAngle= pre.getObject().getBasicAngle()[axis];
206
		    int basicAngle= control.getObject().getBasicAngle()[axis];
207 207
        int angle     = bareAngle*(360/basicAngle);
208 208
        int duration  = Math.abs(angle)*MILLIS_PER_DEGREE;
209 209

  
210 210
        if( angle!=0 )
211 211
          {
212 212
          mCanRotate = false;
213
          pre.addRotation(this, axis, rowBitmap, angle, duration);
213
          control.addRotation(this, axis, rowBitmap, angle, duration);
214 214
          }
215 215
        else
216 216
          {
......
226 226

  
227 227
///////////////////////////////////////////////////////////////////////////////////////////////////
228 228

  
229
  private void backMove(ObjectPreRender pre)
229
  private void backMove(ObjectControl control)
230 230
    {
231 231
    if( mCanRotate )
232 232
      {
......
235 235
      if( mCurrMove<0 )
236 236
        {
237 237
        mCurrMove=mNumMoves;
238
        pre.initializeObject(mMoves);
238
        control.initializeObject(mMoves);
239 239
        }
240 240
      else
241 241
        {
242 242
        int axis      = mMoves[mCurrMove][0];
243 243
		    int rowBitmap = mMoves[mCurrMove][1];
244 244
		    int bareAngle = mMoves[mCurrMove][2];
245
        int basicAngle= pre.getObject().getBasicAngle()[axis];
245
        int basicAngle= control.getObject().getBasicAngle()[axis];
246 246
        int angle     = bareAngle*(360/basicAngle);
247 247
        int duration  = Math.abs(angle)*MILLIS_PER_DEGREE;
248 248

  
249 249
        if( angle!=0 )
250 250
          {
251 251
          mCanRotate = false;
252
          pre.addRotation(this, axis, rowBitmap, -angle, duration);
252
          control.addRotation(this, axis, rowBitmap, -angle, duration);
253 253
          }
254 254
        else
255 255
          {

Also available in: Unified diff