Revision e019c70b
Added by Leszek Koltunski about 4 years ago
| src/main/java/org/distorted/helpers/MovesController.java | ||
|---|---|---|
| 21 | 21 |
|
| 22 | 22 |
import java.util.ArrayList; |
| 23 | 23 |
|
| 24 |
import android.app.Activity; |
|
| 24 | 25 |
import android.view.View; |
| 25 | 26 |
import android.widget.ImageButton; |
| 26 | 27 |
import android.widget.LinearLayout; |
| 27 | 28 |
|
| 28 | 29 |
import org.distorted.objectlib.helpers.BlockController; |
| 29 | 30 |
import org.distorted.objectlib.helpers.MovesFinished; |
| 30 |
import org.distorted.objectlib.helpers.TwistyActivity; |
|
| 31 | 31 |
import org.distorted.objectlib.main.ObjectControl; |
| 32 | 32 |
|
| 33 | 33 |
import org.distorted.main.R; |
| ... | ... | |
| 87 | 87 |
|
| 88 | 88 |
////////////////////////////////////////////////////////////////////////////////////////////////// |
| 89 | 89 |
|
| 90 |
public void backMove(TwistyActivity act)
|
|
| 90 |
public void backMove(Activity act, ObjectControl control)
|
|
| 91 | 91 |
{
|
| 92 | 92 |
if( mCanPrevMove ) |
| 93 | 93 |
{
|
| ... | ... | |
| 102 | 102 |
if( angle!=0 ) |
| 103 | 103 |
{
|
| 104 | 104 |
mCanPrevMove = false; |
| 105 |
mControl = act.getControl();
|
|
| 105 |
mControl = control;
|
|
| 106 | 106 |
mControl.blockTouch(BlockController.MOVES_PLACE_0); |
| 107 | 107 |
mControl.addRotation(this, axis, (1<<move.mRow), -angle, MILLIS_PER_DEGREE); |
| 108 | 108 |
} |
| ... | ... | |
| 118 | 118 |
|
| 119 | 119 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 120 | 120 |
|
| 121 |
private void changeBackMove(TwistyActivity act, final boolean on)
|
|
| 121 |
private void changeBackMove(Activity act, final boolean on) |
|
| 122 | 122 |
{
|
| 123 | 123 |
act.runOnUiThread(new Runnable() |
| 124 | 124 |
{
|
| ... | ... | |
| 133 | 133 |
|
| 134 | 134 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 135 | 135 |
|
| 136 |
public void addMove(TwistyActivity act, int axis, int row, int angle)
|
|
| 136 |
public void addMove(Activity act, int axis, int row, int angle) |
|
| 137 | 137 |
{
|
| 138 | 138 |
if( mMoves.isEmpty() ) changeBackMove(act,true); |
| 139 | 139 |
mMoves.add(new Move(axis,row,angle)); |
| ... | ... | |
| 149 | 149 |
|
| 150 | 150 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 151 | 151 |
|
| 152 |
public void clearMoves(final TwistyActivity act)
|
|
| 152 |
public void clearMoves(final Activity act) |
|
| 153 | 153 |
{
|
| 154 | 154 |
mMoves.clear(); |
| 155 | 155 |
changeBackMove(act,false); |
| ... | ... | |
| 164 | 164 |
|
| 165 | 165 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 166 | 166 |
|
| 167 |
public void setupButton(final TwistyActivity act, final float width)
|
|
| 167 |
public void setupButton(final Activity act, ObjectControl control, final float width)
|
|
| 168 | 168 |
{
|
| 169 | 169 |
final int icon = getPrevIcon( !mMoves.isEmpty() ); |
| 170 | 170 |
mPrevButton = new TransparentImageButton(act, icon, width, LinearLayout.LayoutParams.MATCH_PARENT); |
| ... | ... | |
| 174 | 174 |
@Override |
| 175 | 175 |
public void onClick(View v) |
| 176 | 176 |
{
|
| 177 |
backMove(act); |
|
| 177 |
backMove(act,control);
|
|
| 178 | 178 |
} |
| 179 | 179 |
}); |
| 180 | 180 |
} |
Also available in: Unified diff
Remove the concept of a 'TwistyActivity' altogether.