Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Constructor cleanup

  • Loading branch information...
commit 57ba859d5c8178c16604e5275bb36e33c7b347e8 1 parent 1df740a
François Deppierraz authored
6 android/res/layout/main.xml
View
@@ -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
9 android/src/ch/fixme/cowsay/Cow.java
View
@@ -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();
}
5 android/src/ch/fixme/cowsay/Main.java
View
@@ -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() {
Please sign in to comment.
Something went wrong with that request. Please try again.