|
|
@ -58,13 +58,20 @@ public class PlateauView extends View implements ObserverCV {
|
|
|
|
private int lignes;
|
|
|
|
private int lignes;
|
|
|
|
private int dethColor = Color.BLACK;
|
|
|
|
private int dethColor = Color.BLACK;
|
|
|
|
private int modif = 80;
|
|
|
|
private int modif = 80;
|
|
|
|
|
|
|
|
private boolean formule;
|
|
|
|
|
|
|
|
|
|
|
|
public PlateauView(Context context, int colones, int lignes){
|
|
|
|
public PlateauView(Context context, int colones, int lignes){
|
|
|
|
super(context);
|
|
|
|
super(context);
|
|
|
|
this.colones = colones;
|
|
|
|
this.colones = colones;
|
|
|
|
this.lignes = lignes;
|
|
|
|
this.lignes = lignes;
|
|
|
|
|
|
|
|
int width = LauncherActivity.width;
|
|
|
|
|
|
|
|
int height = LauncherActivity.height;
|
|
|
|
|
|
|
|
formule = LauncherActivity.isPortrait ? width/colones < height/lignes : height/lignes >= width/colones;
|
|
|
|
init();
|
|
|
|
init();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isFormule(){
|
|
|
|
|
|
|
|
return formule;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void init(){
|
|
|
|
private void init(){
|
|
|
|
colors = new HashMap<>();
|
|
|
|
colors = new HashMap<>();
|
|
|
@ -93,14 +100,16 @@ public class PlateauView extends View implements ObserverCV {
|
|
|
|
|
|
|
|
|
|
|
|
if (LauncherActivity.isPortrait) {
|
|
|
|
if (LauncherActivity.isPortrait) {
|
|
|
|
if (width/colones < height/lignes) {
|
|
|
|
if (width/colones < height/lignes) {
|
|
|
|
rect = new Rect(width / colones * j + (width / colones) * 5 / 100, width / colones * i + (width / colones) * 5 / 100, (width / colones * (j + 1)) - (width / colones) * 5 / 100, (width / colones * (i + 1)) - (width / colones) * 5 / 100);
|
|
|
|
rect = new Rect((width / colones) * j + (width / colones) * 5 / 100, width / colones * i + (width / colones) * 5 / 100, (width / colones * (j + 1)) - (width / colones) * 5 / 100, (width / colones * (i + 1)) - (width / colones) * 5 / 100);
|
|
|
|
canvas.drawRect(rect, paint);
|
|
|
|
canvas.drawRect(rect, paint);
|
|
|
|
Log.d("orientation", "portrait");
|
|
|
|
Log.d("orientation", "portrait");
|
|
|
|
|
|
|
|
formule = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
rect = new Rect((height-modif) / lignes * j + ((height-modif) / lignes) * 5 / 100, (height-modif) / lignes * i + ((height-modif) / lignes) * 5 / 100, ((height-modif) / lignes * (j + 1)) - ((height-modif) / lignes) * 5 / 100, ((height-modif) / lignes * (i + 1)) - ((height-modif) / lignes) * 5 / 100);
|
|
|
|
rect = new Rect(((height-modif) / lignes) * j + ((height-modif) / lignes) * 5 / 100, (height-modif) / lignes * i + ((height-modif) / lignes) * 5 / 100, ((height-modif) / lignes * (j + 1)) - ((height-modif) / lignes) * 5 / 100, ((height-modif) / lignes * (i + 1)) - ((height-modif) / lignes) * 5 / 100);
|
|
|
|
canvas.drawRect(rect, paint);
|
|
|
|
canvas.drawRect(rect, paint);
|
|
|
|
Log.d("orientation", "portrait");
|
|
|
|
Log.d("orientation", "portrait");
|
|
|
|
|
|
|
|
formule = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
@ -108,11 +117,13 @@ public class PlateauView extends View implements ObserverCV {
|
|
|
|
rect = new Rect((height - modif) / lignes * j + ((height - modif) / lignes) * 5 / 100, (height - modif) / lignes * i + ((height - modif) / lignes) * 5 / 100, ((height - modif) / lignes * (j + 1)) - ((height - modif) / lignes) * 5 / 100, ((height - modif) / lignes * (i + 1)) - ((height - modif) / lignes) * 5 / 100);
|
|
|
|
rect = new Rect((height - modif) / lignes * j + ((height - modif) / lignes) * 5 / 100, (height - modif) / lignes * i + ((height - modif) / lignes) * 5 / 100, ((height - modif) / lignes * (j + 1)) - ((height - modif) / lignes) * 5 / 100, ((height - modif) / lignes * (i + 1)) - ((height - modif) / lignes) * 5 / 100);
|
|
|
|
canvas.drawRect(rect, paint);
|
|
|
|
canvas.drawRect(rect, paint);
|
|
|
|
Log.d("orientation", "landscpape");
|
|
|
|
Log.d("orientation", "landscpape");
|
|
|
|
|
|
|
|
formule = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
else{
|
|
|
|
rect = new Rect(width / colones * j + (width / colones) * 5 / 100, width / colones * i + (width / colones) * 5 / 100, (width / colones * (j + 1)) - (width / colones) * 5 / 100, (width / colones * (i + 1)) - (width / colones) * 5 / 100);
|
|
|
|
rect = new Rect(width / colones * j + (width / colones) * 5 / 100, width / colones * i + (width / colones) * 5 / 100, (width / colones * (j + 1)) - (width / colones) * 5 / 100, (width / colones * (i + 1)) - (width / colones) * 5 / 100);
|
|
|
|
canvas.drawRect(rect, paint);
|
|
|
|
canvas.drawRect(rect, paint);
|
|
|
|
Log.d("orientation", "landscpape");
|
|
|
|
Log.d("orientation", "landscpape");
|
|
|
|
|
|
|
|
formule = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|