fixed arrowMarker for error dependencies
This commit is contained in:
parent
e5404acd4d
commit
6aacff8e6a
2 changed files with 36 additions and 5 deletions
|
@ -20,6 +20,7 @@ import android.support.v7.app.ActionBarDrawerToggle;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
@ -112,6 +113,10 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
//toolbar.addView();
|
//toolbar.addView();
|
||||||
|
|
||||||
|
if(gameSolved) {
|
||||||
|
disableReset();
|
||||||
|
}
|
||||||
|
|
||||||
//Create new GameField
|
//Create new GameField
|
||||||
layout = (SudokuFieldLayout)findViewById(R.id.sudokuLayout);
|
layout = (SudokuFieldLayout)findViewById(R.id.sudokuLayout);
|
||||||
gameController.registerGameSolvedListener(this);
|
gameController.registerGameSolvedListener(this);
|
||||||
|
@ -178,6 +183,7 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
|
||||||
}
|
}
|
||||||
gameController.notifyHighlightChangedListeners();
|
gameController.notifyHighlightChangedListeners();
|
||||||
gameController.notifyTimerListener(gameController.getTime());
|
gameController.notifyTimerListener(gameController.getTime());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -286,6 +292,7 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
|
||||||
|
|
||||||
gameController.pauseTimer();
|
gameController.pauseTimer();
|
||||||
gameController.deleteGame(this);
|
gameController.deleteGame(this);
|
||||||
|
disableReset();
|
||||||
|
|
||||||
//Show time hints new plus old best time
|
//Show time hints new plus old best time
|
||||||
|
|
||||||
|
@ -342,6 +349,12 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
|
||||||
return h + ":" + m + ":" + s;
|
return h + ":" + m + ":" + s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void disableReset(){
|
||||||
|
NavigationView navView = (NavigationView)findViewById(R.id.nav_view);
|
||||||
|
Menu navMenu = navView.getMenu();
|
||||||
|
navMenu.findItem(R.id.menu_reset).setEnabled(false);
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public void onTick(int time) {
|
public void onTick(int time) {
|
||||||
|
|
||||||
|
|
|
@ -221,13 +221,31 @@ public class SudokuFieldLayout extends RelativeLayout implements IHighlightChang
|
||||||
|
|
||||||
int row2 = conflict.getRowCell2();
|
int row2 = conflict.getRowCell2();
|
||||||
int col2 = conflict.getColCell2();
|
int col2 = conflict.getColCell2();
|
||||||
canvas.drawCircle(gameCellWidth * col2 + gameCellWidth / 2, gameCellHeight * row2 + gameCellHeight / 2, gameCellWidth/2 - gameCellWidth / 8, p);
|
canvas.drawCircle(gameCellWidth * col2 + gameCellWidth / 2, gameCellHeight * row2 + gameCellHeight / 2, gameCellWidth / 2 - gameCellWidth / 8, p);
|
||||||
|
|
||||||
|
float offset1=0;
|
||||||
|
float offset2= 0;
|
||||||
|
|
||||||
|
float radius = gameCellWidth/2 - gameCellWidth / 8;
|
||||||
|
if (col == col2 || row == row2) {
|
||||||
|
offset1 = (col > col2)? 0-radius:radius;
|
||||||
|
offset2 = (row > row2)? 0-radius:radius;
|
||||||
|
offset1 = (col == col2)?0f:offset1;
|
||||||
|
offset2 = (row == row2)?0f:offset2;
|
||||||
|
} else {
|
||||||
|
double alpha = Math.atan((Math.abs(col2-col))/(Math.abs(row2 - row)));
|
||||||
|
offset1 = (col > col2)? 0-radius:radius;
|
||||||
|
offset2 = (row > row2)? 0-radius:radius;
|
||||||
|
offset1*=Math.sin(alpha);
|
||||||
|
offset2*=Math.cos(alpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
canvas.drawLine(
|
canvas.drawLine(
|
||||||
gameCellWidth * col + gameCellWidth / 2,
|
(gameCellWidth * col + gameCellWidth / 2)+offset1,
|
||||||
gameCellHeight * row + gameCellHeight / 2,
|
(gameCellHeight * row + gameCellHeight / 2)+offset2,
|
||||||
gameCellWidth * col2 + gameCellWidth / 2,
|
(gameCellWidth * col2 + gameCellWidth / 2)-offset1,
|
||||||
gameCellHeight * row2 + gameCellHeight / 2, p);
|
(gameCellHeight * row2 + gameCellHeight / 2)-offset2, p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue