]> gitweb.fperrin.net Git - Dictionary.git/commitdiff
Fix flags of Scotland. Fix bug with URL encoding HTMLEntry titles.
authorThad Hughes <thadh@google.com>
Thu, 26 Dec 2013 01:58:06 +0000 (17:58 -0800)
committerThad Hughes <thadh@google.com>
Thu, 26 Dec 2013 01:58:06 +0000 (17:58 -0800)
res/drawable-xxhdpi/flag_of_scotland.png
src/com/hughes/android/dictionary/DictionaryManagerActivity.java
src/com/hughes/android/dictionary/MyWebView.java
src/com/hughes/android/dictionary/engine/HtmlEntry.java
todo.txt

index 551836fb4f4cafe9d397dd8b2d47c575005e79cf..8ce57bf39019bd3bd8513bc2add64d3f984d08fd 100644 (file)
Binary files a/res/drawable-xxhdpi/flag_of_scotland.png and b/res/drawable-xxhdpi/flag_of_scotland.png differ
index e3e76ad72a3c2f3b6944f0603a11f55c1813580e..5a0305015731bdfce8f90ac46b5a525188ceb481 100644 (file)
@@ -369,23 +369,23 @@ public class DictionaryManagerActivity extends SherlockListActivity {
         prefs.commit();
     }
 
-    // private void onClick(int index) {
-    // final DictionaryInfo dictionaryInfo = adapter.getItem(index);
-    // final DictionaryInfo downloadable =
-    // application.getDownloadable(dictionaryInfo.uncompressedFilename);
-    // if
-    // (!application.isDictionaryOnDevice(dictionaryInfo.uncompressedFilename)
-    // && downloadable != null) {
-    // final Intent intent = getDownloadIntent(downloadable);
-    // startActivity(intent);
-    // } else {
-    // final Intent intent =
-    // DictionaryActivity.getLaunchIntent(application.getPath(dictionaryInfo.uncompressedFilename),
-    // 0, "");
-    // startActivity(intent);
-    // }
-    // }
-    
+//    @Override
+//    private void onClick(int index) {
+//        final DictionaryInfo dictionaryInfo = adapter.getItem(index);
+//        final DictionaryInfo downloadable =
+//                application.getDownloadable(dictionaryInfo.uncompressedFilename);
+//        if (!application.isDictionaryOnDevice(dictionaryInfo.uncompressedFilename)
+//                && downloadable != null) {
+//            final Intent intent = getDownloadIntent(downloadable);
+//            startActivity(intent);
+//        } else {
+//            final Intent intent =
+//                    DictionaryActivity.getLaunchIntent(
+//                            application.getPath(dictionaryInfo.uncompressedFilename),
+//                            0, "");
+//            startActivity(intent);
+//        }
+//    }    
     
     class MyListAdapter extends BaseAdapter {
 
@@ -527,9 +527,20 @@ public class DictionaryManagerActivity extends SherlockListActivity {
         }
         details.setText(builder.toString());
         
-        row.setClickable(true);
-        row.setFocusable(true);
-        row.setLongClickable(true);
+        if (canLaunch) {
+            row.setClickable(true);
+            row.setOnClickListener(new OnClickListener() {
+                @Override
+                public void onClick(View v) {
+                    new IntentLauncher(parent.getContext(), 
+                            DictionaryActivity.getLaunchIntent(
+                                    application.getPath(dictionaryInfo.uncompressedFilename), 
+                                    dictionaryInfo.indexInfos.get(0).shortName, ""));
+                }
+            });
+            row.setFocusable(true);
+            row.setLongClickable(true);
+        }
         row.setBackgroundResource(android.R.drawable.menuitem_background);
         
         return row;
index d11cec05f6e6d7385db2481ffbb9d18bc855f940..ebec47cb30bf7278398056c7b79c5f37bffd594e 100644 (file)
@@ -33,6 +33,7 @@ public class MyWebView extends WebView {
                     Log.d(LOG, "Handling Quickdic URL: " + url);
                     final Intent result = new Intent();
                     HtmlEntry.quickdicUrlToIntent(url, result);
+                    Log.d(LOG, "SEARCH_TOKEN=" + result.getStringExtra(C.SEARCH_TOKEN));
                     activity.setResult(Activity.RESULT_OK, result);
                     activity.finish();
                     return true;
index 5fe0780f4422ca8925b81c2d3c5cd7c86ab156a2..612c6c1b7040ed1acd4fab4050768033a58ffe55 100644 (file)
@@ -1,6 +1,7 @@
 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;
@@ -159,7 +160,7 @@ public class HtmlEntry extends AbstractEntry implements RAFSerializable<HtmlEntr
         for (final HtmlEntry htmlEntry : htmlEntries) {
             final String titleEscaped = StringUtil.escapeUnicodeToPureHtml(htmlEntry.title);
             result.append(String.format("<h1><a href=\"%s\">%s</a></h1>\n<p>%s\n", 
-                    formatQuickdicUrl(indexShortName, titleEscaped), titleEscaped,
+                    formatQuickdicUrl(indexShortName, htmlEntry.title), titleEscaped,
                     htmlEntry.getHtml()));
         }
         return result.toString();
index 7bbc3c80a0d324ee88440c17a97f3888d1cf0db1..8cdab765f8aaa8990f5a82ffc3df6099f91afa37 100644 (file)
--- a/todo.txt
+++ b/todo.txt
@@ -1,2 +1,4 @@
+* Clicking link in HTML view doesn't trigger search.
+* Back button in top left
 * Contributions from:
 * HtmlEntries inline, expandable.
\ No newline at end of file