Skip to content

Commit

Permalink
stop animated FAB being triggered at wrong times
Browse files Browse the repository at this point in the history
  • Loading branch information
lewismcgeary committed Mar 3, 2016
1 parent 9185920 commit 5fae4e2
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ public interface GameStateCallback {
void cellDrawingInProgress();

void cellDrawingFinished();

void gameStarted();
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public void passLiveCellsToModelAndStartGame(){
worldGrid.setInitialLiveCells(userSelectedCells);
startConstantUpdate();
worldGridLayout.setEnabled(false);
worldGridLayout.gameStarted();
} else {
worldGridLayout.noCellsWereSelected();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ public void cellDrawingFinished() {
mListener.cellDrawingFinished();
}

@Override
public void gameStarted() {
mListener.gameStarted();
}

public interface OnFragmentInteractionListener {

void gameOver();
Expand All @@ -151,5 +156,7 @@ public interface OnFragmentInteractionListener {
void cellDrawingInProgress();

void cellDrawingFinished();

void gameStarted();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@ public void noCellsWereSelected(){
public void cellsDiedGameOver(){
gameStateCallback.gameOver();
}

public void gameStarted() {
gameStateCallback.gameStarted();
}
//can disable this as no scrolling needed
@Override
public boolean shouldDelayChildPressedState() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ protected void onResume() {
@Override
public void onBackPressed() {
super.onBackPressed();
showButtonInStartMode();
startResetFab.hide();
appBarLayout.setExpanded(true, true);
setFixedScreenOrientation(false);
Expand Down Expand Up @@ -87,7 +86,6 @@ private void initialiseButton(){
@Override
public void onClick(View v) {
if (startResetFab.getTag().equals(startButtonText)) {
showButtonInResetMode();
lifeGridFragment.worldGridPresenter.passLiveCellsToModelAndStartGame();
} else {
showButtonInStartMode();
Expand Down Expand Up @@ -209,12 +207,17 @@ public void noCellsWereSelected() {
ViewGroup group = (ViewGroup) snack.getView();
group.setBackgroundColor(ContextCompat.getColor(this, R.color.colorPrimaryDark));
snack.show();
showButtonInStartMode();
}

@Override
public void gameStarted() {
showButtonInResetMode();
}

@Override
public void letsPlay() {
setFixedScreenOrientation(true);
showButtonInStartMode();
startTransition();
}

Expand Down

0 comments on commit 5fae4e2

Please sign in to comment.