Permalink
Browse files

Constructor cleanup

  • Loading branch information...
1 parent 1df740a commit 57ba859d5c8178c16604e5275bb36e33c7b347e8 @ctrlaltdel committed Dec 28, 2011
Showing with 11 additions and 9 deletions.
  1. +5 −1 android/res/layout/main.xml
  2. +3 −6 android/src/ch/fixme/cowsay/Cow.java
  3. +3 −2 android/src/ch/fixme/cowsay/Main.java
@@ -5,13 +5,17 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent">
+ <Spinner
+ android:id="@+id/type"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
<TextView
android:id="@+id/thecow"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:gravity="bottom"
- android:text="asd"
android:typeface="monospace" />
<LinearLayout
@@ -13,12 +13,12 @@
private String style = "default";
private String eyes = "oo";
private String tongue = " ";
- private String thoughts = "";
+ public String thoughts = "";
public String[] message;
private int maxlen;
private int think = 0;
- private int face;
+ public int face;
public static final int FACE_BORG = 1;
public static final int FACE_DEAD = 2;
@@ -33,12 +33,9 @@
final Context context;
- public Cow(Context myContext, String message, String cow, int face) {
+ public Cow(Context myContext) {
Log.e("TEST", "message="+message);
context = myContext;
- this.maxlen = (message.length() < WRAPLEN) ? message.length() : WRAPLEN;
- this.message = message.split("\n");
- this.face = face;
construct_face();
}
@@ -24,7 +24,7 @@ public void onCreate(Bundle savedInstanceState)
final Context ctxt = getApplicationContext();
final EditText txt = (EditText) findViewById(R.id.message);
- cow = new Cow(ctxt, txt.getText().toString(), "", 0);
+ cow = new Cow(ctxt);
((Button) findViewById(R.id.btn_say)).setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
@@ -46,7 +46,8 @@ public void afterTextChanged(Editable editable) {
}
};
- ((EditText) findViewById(R.id.message)).addTextChangedListener(myTextWatcher);
+ txt.addTextChangedListener(myTextWatcher);
+ txt.setText("Moo");
}
private void cowRefresh() {

0 comments on commit 57ba859

Please sign in to comment.