]> gitweb.fperrin.net Git - Dictionary.git/blobdiff - src/com/hughes/android/util/NonLinkClickableSpan.java
Fixed text color of normal text.
[Dictionary.git] / src / com / hughes / android / util / NonLinkClickableSpan.java
index 075cc59ef58020d53657131a1a561dd293e14c20..a590d387ad7237608383c0ca19eddc8bcba672b4 100644 (file)
@@ -19,19 +19,28 @@ import android.text.style.ClickableSpan;
 import android.view.View;
 
 public class NonLinkClickableSpan extends ClickableSpan {
-  
-  public static final NonLinkClickableSpan instance = new NonLinkClickableSpan();
-
-  // Won't see these on a long-click.
-  @Override
-  public void onClick(View widget) {
-  }
-
-  @Override
-  public void updateDrawState(TextPaint ds) {
-    super.updateDrawState(ds);
-    ds.setUnderlineText(false);
-    //ds.setColor(color);
-  }
+
+    // The singleton pattern doesn't work here--we need a separate instance for
+    // each span.
+
+    final int color;
+    
+    public NonLinkClickableSpan(int color) {
+        this.color = color;
+    }
+
+    // Won't see these on a long-click.
+    @Override
+    public void onClick(View widget) {
+        // Don't need to do anything.  These spans are just used to see where
+        // the user long-pressed.
+    }
+
+    @Override
+    public void updateDrawState(TextPaint ds) {
+        super.updateDrawState(ds);
+        ds.setUnderlineText(false);
+        ds.setColor(color);
+    }
 
 }