package io.cine.android;

import android.util.Log;

/**
 * Created by thomas on 1/16/15.
 */
public class BroadcastConfig {
    private int width;
    private int height;
    private String requestedCamera;
    private String lockedOrientation;


    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public int getHeight() {
        return height;
    }

    public void setHeight(int height) {
        this.height = height;
    }

    public String getLockedOrientation() {
        return lockedOrientation;
    }

    public void lockOrientation(String lockedOrientation) {
        if(lockedOrientation.equals("landscape") || lockedOrientation.equals("portrait") || lockedOrientation == null){
            this.lockedOrientation = lockedOrientation;
        } else {
            throw new RuntimeException("Orientation must be \"landscape\" or \"portrait\"");
        }
    }

    public String getRequestedCamera() {
        return requestedCamera;
    }

    public void selectCamera(String camera) {
        if(camera.equals("back") || camera.equals("front") || camera == null){
            this.requestedCamera = camera;
        } else {
            throw new RuntimeException("Camera must be \"front\" or \"back\"");
        }
    }
}

@@ -129,19 +129,23 @@
 private 
-i
+I
 nt
+eger
  width;%0A
@@ -156,19 +156,23 @@
 private 
-i
+I
 nt
+eger
  height;
@@ -272,24 +272,94 @@
 etWidth() %7B%0A
+        if (width == null)%7B%0A            return -1;%0A        %7Delse%7B%0A    
         retu
@@ -360,32 +360,42 @@
   return width;%0A
+        %7D%0A
     %7D%0A%0A    publi
@@ -483,24 +483,95 @@
 tHeight() %7B%0A
+        if (height == null)%7B%0A            return -1;%0A        %7Delse%7B%0A    
         retu
@@ -573,32 +573,42 @@
  return height;%0A
+        %7D%0A
     %7D%0A%0A    publi

Set BroadCastConfig width and height to Integers, and check for null values; return -1 if null. This allows us to avoid the problem of ints defaulting to 0 which messes up the default settings for screen width/height