package com.seadowg.loafers.app;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import com.seadowg.loafers.app.internal.Screen;
import com.seadowg.loafers.app.internal.view.builder.AlertDialogBuilder;
import com.seadowg.loafers.app.internal.view.builder.ButtonBuilder;
import com.seadowg.loafers.app.internal.view.builder.ListViewBuilder;
import com.seadowg.loafers.widget.*;

public abstract class App extends Activity {
  private static App context;
  private static Screen screen;

  public abstract void open();

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    App.context = this;

    screen = new Screen();
    screen.attach(this);
    open();
  }

  private static void addView(View view) {
    screen.addView(view);
  }

  public static void add(final Button button) {
    App.addView(new ButtonBuilder(App.context, button).build());
  }

  public static EditText add(final Input input) {
    EditText view = new EditText(App.context);
    App.addView(view);

    return view;
  }

  public static TextView add(Text text) {
    TextView view = new TextView(App.context);
    view.setText(text.text);
    App.addView(view);

    return view;
  }

  public static ListView add(List list) {
    ListView view = new ListViewBuilder(App.context, list).build();
    App.addView(view);

    return view;
  }

  public static void show(final Popup popup) {
    new AlertDialogBuilder(App.context, popup).build().show();
  }
}

@@ -846,82 +846,8 @@
  %7D%0A%0A
-  private static void addView(View view) %7B%0A    screen.addView(view);%0A  %7D%0A%0A
   pu
@@ -890,32 +890,39 @@
 tton) %7B%0A    App.
+screen.
 addView(new Butt
@@ -1064,32 +1064,39 @@
 ntext);%0A    App.
+screen.
 addView(view);%0A%0A
@@ -1235,32 +1235,39 @@
 .text);%0A    App.
+screen.
 addView(view);%0A%0A
@@ -1398,24 +1398,24 @@
 uild();%0A
-
     App.
 addView(
@@ -1406,16 +1406,23 @@
     App.
+screen.
 addView(

Add views directly to the screen