Compare Revisions
Last modification
- Rev 16 2011-01-23 23:19:30
- Author: PointedEars
- Log message:
- Working update thread
- Changed to Euro-based conversion because of ECB as data provider
- Added XPath namespace helpers in case we can get namespaces working
/trunk/src/de/pointedears/converter/helpers/CurrenciesUpdateThread.java |
File deleted |
|
Property changes: |
Deleted: svn:mime-type |
## -1 +0,0 ## |
-text/plain |
\ No newline at end of property |
Index: ConverterThread.java |
=================================================================== |
--- ConverterThread.java (nonexistent) |
+++ ConverterThread.java (revision 16) |
@@ -0,0 +1,30 @@ |
+package de.pointedears.converter.helpers; |
+ |
+import android.os.Handler; |
+ |
+/** |
+ * General thread to perform background tasks |
+ * |
+ * @author pelinux |
+ */ |
+public class ConverterThread extends Thread |
+{ |
+ private Handler handler = null; |
+ private Runnable runnable = null; |
+ |
+ /** |
+ * @param runnable |
+ * @param handler |
+ */ |
+ public ConverterThread(Runnable runnable, Handler handler) |
+ { |
+ this.handler = handler; |
+ this.runnable = runnable; |
+ } |
+ |
+ @Override |
+ public void run() |
+ { |
+ this.handler.post(this.runnable); |
+ } |
+} |
/ConverterThread.java |
Property changes: |
Added: svn:mime-type |
## -0,0 +1 ## |
+text/plain |
\ No newline at end of property |
Index: ConverterNamespaceContext.java |
=================================================================== |
--- ConverterNamespaceContext.java (nonexistent) |
+++ ConverterNamespaceContext.java (revision 16) |
@@ -0,0 +1,58 @@ |
+package de.pointedears.converter.helpers; |
+ |
+import java.util.HashMap; |
+import java.util.Iterator; |
+ |
+import javax.xml.XMLConstants; |
+import javax.xml.namespace.NamespaceContext; |
+ |
+/** |
+ * @author pelinux |
+ * |
+ */ |
+public final class ConverterNamespaceContext implements NamespaceContext |
+{ |
+ private final HashMap<String, String> namespaces = |
+ new HashMap<String, String>(); |
+ |
+ public void add(String prefix, String uri) |
+ { |
+ this.namespaces.put(prefix, uri); |
+ } |
+ |
+ @Override |
+ public Iterator getPrefixes(String namespaceURI) |
+ { |
+ throw new UnsupportedOperationException(); |
+ } |
+ |
+ @Override |
+ public String getPrefix(String namespaceURI) |
+ { |
+ throw new UnsupportedOperationException(); |
+ } |
+ |
+ @Override |
+ public String getNamespaceURI(String prefix) |
+ { |
+ if (prefix == null) |
+ { |
+ throw new NullPointerException("Null prefix"); |
+ } |
+ else |
+ { |
+ if ("xml".equals(prefix)) |
+ { |
+ return XMLConstants.XML_NS_URI; |
+ } |
+ |
+ String storedPrefix = this.namespaces.get(prefix); |
+ if (storedPrefix != null) |
+ { |
+ return storedPrefix; |
+ } |
+ |
+ return XMLConstants.NULL_NS_URI; |
+ } |
+ } |
+} |
\ No newline at end of file |