From: Reimar Döffinger Date: Thu, 20 Aug 2015 21:23:48 +0000 (+0200) Subject: Move Android code out of engine code. X-Git-Url: http://gitweb.fperrin.net/?a=commitdiff_plain;h=b674aa184932eb6d2797786e454706d6f0ed7562;p=Dictionary.git Move Android code out of engine code. --- diff --git a/src/com/hughes/android/dictionary/MyWebView.java b/src/com/hughes/android/dictionary/MyWebView.java index 4e30faf..d0fdd5b 100644 --- a/src/com/hughes/android/dictionary/MyWebView.java +++ b/src/com/hughes/android/dictionary/MyWebView.java @@ -18,6 +18,16 @@ public class MyWebView extends WebView { HtmlDisplayActivity activity; + public static void quickdicUrlToIntent(final String url, final Intent intent) { + int firstColon = url.indexOf("?"); + if (firstColon == -1) + return; + int secondColon = url.indexOf("&", firstColon + 1); + if (secondColon == -1) + return; + intent.putExtra(C.SEARCH_TOKEN, StringUtil.decodeFromUrl(url.substring(secondColon + 1))); + } + public MyWebView(Context context) { super(context); } @@ -33,7 +43,7 @@ public class MyWebView extends WebView { if (HtmlEntry.isQuickdicUrl(url)) { Log.d(LOG, "Handling Quickdic URL: " + url); final Intent result = new Intent(); - HtmlEntry.quickdicUrlToIntent(url, result); + quickdicUrlToIntent(url, result); Log.d(LOG, "SEARCH_TOKEN=" + result.getStringExtra(C.SEARCH_TOKEN)); activity.setResult(Activity.RESULT_OK, result); activity.finish(); diff --git a/src/com/hughes/android/dictionary/engine/HtmlEntry.java b/src/com/hughes/android/dictionary/engine/HtmlEntry.java index 24424aa..6e65a68 100644 --- a/src/com/hughes/android/dictionary/engine/HtmlEntry.java +++ b/src/com/hughes/android/dictionary/engine/HtmlEntry.java @@ -1,9 +1,6 @@ package com.hughes.android.dictionary.engine; -import android.content.Intent; -import android.util.Log; - import com.hughes.android.dictionary.C; import com.hughes.util.StringUtil; import com.hughes.util.raf.RAFListSerializer; @@ -179,16 +176,6 @@ public class HtmlEntry extends AbstractEntry implements RAFSerializable