package com.example.janicduplessis.myapplication;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;

/**
 * Created by francis on 2015-11-07.
 */
public class DrawView extends View {


    public DrawView(Context context) {
        super(context);
    }

    public DrawView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public DrawView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    public DrawView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
    }

    @Override
    public void onDraw(Canvas canvas) {

       canvas.drawColor(0x00AAAAAA);
        int width = canvas.getWidth();
        int height = canvas.getHeight();

        Paint paint = new Paint();
        paint.setStyle(Paint.Style.STROKE);
        //then draw the square !!
        paint.setColor(Color.BLUE);
        paint.setStrokeWidth(8);

        canvas.drawRect((width / 7),
                ((height / 9)),
                ((width - (width / 7))),
                ((height - (height / 9))),
                paint);

    }
}

@@ -1122,24 +1122,78 @@
 eWidth(8);%0A%0A
+        //landscape%0A        if( width %3E height) %7B%0A    
         canv
@@ -1225,32 +1225,36 @@
                 
+ 
+   
 ((height / 9)),%0A
@@ -1249,24 +1249,28 @@
 ight / 9)),%0A
+    
             
@@ -1306,32 +1306,36 @@
                 
+  
+  
 ((height - (heig
@@ -1365,15 +1365,241 @@
     
+    
 paint);
+%0A        %7Delse%7B%0A            canvas.drawRect((width / 7),%0A                    ((height / 3)),%0A                    ((width - (width / 7))),%0A                    ((height - (height / 3))),%0A                    paint);%0A        %7D
 %0A%0A  

Change rectangle orientation