package com.sometrik.framework;

import android.content.Context;
import android.view.View;
import android.view.ViewParent;
import android.widget.LinearLayout;

public class FWLayout extends LinearLayout implements NativeCommandHandler {
  
  private FrameWork frame;
  
  public FWLayout(FrameWork frameWork) {
    super(frameWork);
    this.frame = frameWork;
  }

  @Override
  public int getElementId() {
    return getId();
  }
 
  @Override
  public void addChild(View view) {
    addView(view);
  }

  @Override
  public void addOption(int optionId, String text) {
    System.out.println("FWLayout couldn't handle command");
  }

  @Override
  public void setValue(String v) {
    System.out.println("FWLayout couldn't handle command");
  }

  @Override
  public void setValue(int v) {
    if (v == 1){
      frame.setCurrentView(this, true);
    } else if (v == 2){
      frame.setCurrentView(this, false);
    }
  }

  @Override
  public void setViewEnabled(Boolean enabled) {
    System.out.println("FWLayout couldn't handle command");
  }

  @Override
  public void setStyle(String key, String value) { }

  @Override
  public void setError(boolean hasError, String errorText) { }

  @Override
  public void onScreenOrientationChange(boolean isLandscape) {
    invalidate();
  }

  @Override
  public void addData(int rowNumber, int columnNumber, String text) {
    System.out.println("FWLayout couldn't handle command");
  }

  @Override
  public void setViewVisibility(boolean visibility) {
    if (visibility){
      this.setVisibility(VISIBLE);
    } else {
      this.setVisibility(INVISIBLE);
    }
  }
}

@@ -58,16 +58,45 @@
 ontext;%0A
+import android.view.Gravity;%0A
 import a
@@ -1134,16 +1134,419 @@
 value) %7B
+%0A    if (key.equals(%22gravity%22))%7B%0A%09LinearLayout.LayoutParams params = (LayoutParams) getLayoutParams();%0A      if (value.equals(%22bottom%22))%7B%0A%09params.gravity = Gravity.BOTTOM;%0A      %7D else if (value.equals(%22top%22))%7B%0A%09params.gravity = Gravity.TOP;%0A      %7D else if (value.equals(%22left%22))%7B%0A%09params.gravity = Gravity.LEFT;%0A      %7D else if (value.equals(%22right%22))%7B%0A%09params.gravity = Gravity.RIGHT;%0A      %7D%0A    %7D%0A 
  %7D%0A%0A  @O

Add gravity to FWLayout style options