]> gitweb.fperrin.net Git - Dictionary.git/commitdiff
Fix trailing whitespace and DOS linebreaks.
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>
Sun, 5 Jun 2016 12:38:53 +0000 (14:38 +0200)
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>
Sun, 5 Jun 2016 12:38:53 +0000 (14:38 +0200)
29 files changed:
res/drawable/theme_default_normal_row_bg.xml
res/drawable/theme_default_token_row_main_bg.xml
res/drawable/theme_default_token_row_other_bg.xml
res/drawable/theme_light_normal_row_bg.xml
res/drawable/theme_light_token_row_main_bg.xml
res/drawable/theme_light_token_row_other_bg.xml
res/layout/about_activity.xml
res/layout/about_dictionary_dialog.xml
res/layout/dictionary_activity.xml
res/layout/dictionary_manager_row.xml
res/layout/html_display_activity.xml
res/layout/select_dictionary_dialog.xml
res/values-de/arrays.xml
res/values-de/strings.xml
res/values-es/arrays.xml
res/values-es/strings.xml
res/values-it/strings.xml
res/values-ja/arrays.xml
res/values-v11/styles.xml
res/values-v14/styles.xml
res/values/arrays.xml
src/com/hughes/android/dictionary/AboutActivity.java
src/com/hughes/android/dictionary/DictionaryActivity.java
src/com/hughes/android/dictionary/DictionaryApplication.java
src/com/hughes/android/dictionary/DictionaryManagerActivity.java
src/com/hughes/android/dictionary/HtmlDisplayActivity.java
src/com/hughes/android/dictionary/PreferenceActivity.java
src/com/hughes/android/dictionary/engine/Index.java
src/com/hughes/android/dictionary/engine/Language.java

index ee37a0c24f7e767d814bd97ec701e8386a146990..11e22e6fcac3a744c70796b664af4a0ae62af6f3 100644 (file)
@@ -1,4 +1,4 @@
 <selector xmlns:android="http://schemas.android.com/apk/res/android">
-  <item android:state_selected="true" android:drawable="@android:color/transparent" /> 
-  <item android:drawable="@color/theme_default_normal_row_bg" /> 
-</selector>
\ No newline at end of file
+  <item android:state_selected="true" android:drawable="@android:color/transparent" />
+  <item android:drawable="@color/theme_default_normal_row_bg" />
+</selector>
index aa03ef6a968811afb8cb8953d925c18d70c310a9..62c7c6b33117df220c1d40c773c426c6020cafe0 100644 (file)
@@ -1,4 +1,4 @@
 <selector xmlns:android="http://schemas.android.com/apk/res/android">
-  <item android:state_selected="true" android:drawable="@android:color/transparent" /> 
-  <item android:drawable="@color/theme_default_token_row_main_bg" /> 
-</selector>
\ No newline at end of file
+  <item android:state_selected="true" android:drawable="@android:color/transparent" />
+  <item android:drawable="@color/theme_default_token_row_main_bg" />
+</selector>
index 4bdbce1c55b7ba479aaa01c3e8867117cf8b74de..2b3c0ebf4aae2cb434c946735b2569af65715b29 100644 (file)
@@ -1,4 +1,4 @@
 <selector xmlns:android="http://schemas.android.com/apk/res/android">
-  <item android:state_selected="true" android:drawable="@android:color/transparent" /> 
-  <item android:drawable="@color/theme_default_token_row_other_bg" /> 
-</selector>
\ No newline at end of file
+  <item android:state_selected="true" android:drawable="@android:color/transparent" />
+  <item android:drawable="@color/theme_default_token_row_other_bg" />
+</selector>
index 95e99632d66becb92821f6393924d2f3f0130233..0894385066bab07231ab6d74fb2813da2ab94046 100644 (file)
@@ -1,4 +1,4 @@
 <selector xmlns:android="http://schemas.android.com/apk/res/android">
-  <item android:state_selected="true" android:drawable="@android:color/transparent" /> 
-  <item android:drawable="@color/theme_light_normal_row_bg" /> 
-</selector>
\ No newline at end of file
+  <item android:state_selected="true" android:drawable="@android:color/transparent" />
+  <item android:drawable="@color/theme_light_normal_row_bg" />
+</selector>
index 31259088093606b04078f74c335a434e63084364..4d1a2a1c15611e2830d62230a7b0d54b20fa2ee4 100644 (file)
@@ -1,4 +1,4 @@
 <selector xmlns:android="http://schemas.android.com/apk/res/android">
-  <item android:state_selected="true" android:drawable="@android:color/transparent" /> 
-  <item android:drawable="@color/theme_light_token_row_main_bg" /> 
-</selector>
\ No newline at end of file
+  <item android:state_selected="true" android:drawable="@android:color/transparent" />
+  <item android:drawable="@color/theme_light_token_row_main_bg" />
+</selector>
index 7e74c1d4c6956ba16c5e1917b51723366d642581..3271df280a5adea787ef336753d42570344dcc2c 100644 (file)
@@ -1,4 +1,4 @@
 <selector xmlns:android="http://schemas.android.com/apk/res/android">
-  <item android:state_selected="true" android:drawable="@android:color/transparent" /> 
-  <item android:drawable="@color/theme_light_token_row_other_bg" /> 
-</selector>
\ No newline at end of file
+  <item android:state_selected="true" android:drawable="@android:color/transparent" />
+  <item android:drawable="@color/theme_light_token_row_other_bg" />
+</selector>
index aeec432828419774c1c5b698782ad40de1f12497..b3ba12c209a4f89c8537eb36fa121db4b5814f3c 100644 (file)
@@ -41,7 +41,7 @@
             android:layout_height="wrap_content"
             android:text="@string/contactMe"
             android:textAppearance="?android:attr/textAppearanceSmall" />
-        
+
         <TextView
             android:id="@+id/email"
             android:layout_width="wrap_content"
index d143340328119d60a9041bae9507ac1c534ce7dd..731d4934045a1f881482bee4da38f3eaa59be457 100644 (file)
@@ -1,11 +1,11 @@
 <ScrollView android:id="@+id/ScrollView01"
   xmlns:android="http://schemas.android.com/apk/res/android"
-  android:layout_width="fill_parent" 
+  android:layout_width="fill_parent"
   android:layout_height="fill_parent">
-  
-  <TextView 
+
+  <TextView
     android:id="@+id/text"
-    android:layout_width="wrap_content" 
+    android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:layout_gravity="center_horizontal"/>
 
index 3aefc7f848f54e42c3568bd1a942f0c1a6b80a83..76f3a01eb74461a00e92638bbba02682c522792f 100644 (file)
@@ -4,8 +4,8 @@
     android:layout_height="fill_parent"
     android:orientation="vertical" >
 
-    <!-- 
-    
+    <!--
+
     <LinearLayout
         android:id="@+id/SearchBarLinearLayout"
         android:layout_width="fill_parent"
@@ -38,7 +38,7 @@
     </LinearLayout>
 
  -->
+
     <ListView
         android:id="@id/android:list"
         android:layout_width="fill_parent"
@@ -55,4 +55,4 @@
         android:layout_height="match_parent"
         android:text="@string/noSearchResults" />
 
-</LinearLayout>
\ No newline at end of file
+</LinearLayout>
index 365e1f48c5b2359fce5af711168e480fc64a2171..eeaf5ed29d0a16cba3e450a5df4dfa77a724604f 100644 (file)
@@ -19,7 +19,7 @@
         </LinearLayout>
 
         <!--
-        http://stackoverflow.com/questions/11243867/android-last-line-of-textview-cut-off 
+        http://stackoverflow.com/questions/11243867/android-last-line-of-textview-cut-off
          -->
         <TextView
             android:id="@+id/dictionaryName"
@@ -49,4 +49,4 @@
         android:textAppearance="?android:attr/textAppearanceSmall"
         tools:ignore="HardcodedText" />
 
-</LinearLayout>
\ No newline at end of file
+</LinearLayout>
index 0e226263c1275965819ee6440d635a9143e17ab4..a47c7d4ab3b7a2c17d665b8e661f8164ab7909ae 100644 (file)
@@ -3,7 +3,7 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:orientation="vertical" >
-    
+
   <com.hughes.android.dictionary.MyWebView
       android:id="@+id/webView"
       android:layout_width="match_parent"
@@ -16,4 +16,4 @@
       android:layout_height="wrap_content"
       android:text="@android:string/ok" />
 
-</LinearLayout>
\ No newline at end of file
+</LinearLayout>
index 54fe60867ba020167e83380085200ad935cf8e6a..b73deb816604d33745d45bda49a74d2b9ad8d8ee 100644 (file)
@@ -1,16 +1,16 @@
 <?xml version="1.0" encoding="utf-8"?>
 
-<LinearLayout 
+<LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical" android:layout_width="fill_parent"
        android:layout_height="fill_parent">
 
-       <ListView 
-               android:id="@id/android:list" 
+       <ListView
+               android:id="@id/android:list"
                android:layout_width="fill_parent"
-               android:layout_height="0dip" 
+               android:layout_height="0dip"
                android:choiceMode="singleChoice"
-               android:clickable="true" 
+               android:clickable="true"
                android:focusable="true"
     android:layout_weight="1.0"
     />
index 9709e0fb30fa4ea0140acc02e062c881040e3c47..63409eafa03d9c13470efa9c31ab82ab3cdb08be 100644 (file)
@@ -13,5 +13,5 @@
     <item>Weiß-Theme</item>
     <item>Standard-Theme</item>
   </string-array>
-  
+
 </resources>
index 88971b20c0aabea4317f3cb7810c772d7e16de4b..193d82d0e38c1df388f68879dc9469194ed0da1e 100644 (file)
@@ -44,7 +44,7 @@
     <string name="nextWord">Nächstes Wort</string>
     <string name="previousWord">Voriges Wort</string>
     <string name="randomWord">Zufälliges Wort</string>
-    
+
     <!-- About dictionary. -->
     <string name="dictionaryPath">Datei: %s</string>
     <string name="dictionarySize">Größe: %,d bytes</string>
@@ -84,5 +84,5 @@
     <string name="themeTitle">Farbschema</string>
     <string name="themeSummary">Auswahl des Farbschemas für das Wörterbuch und die Menüs.</string>
     <string name="chosenNotWritable">Chosen directory not writable, try one of</string>
-   
+
 </resources>
index 309a59c11ecb768ad39407d070b42143bb65ba55..12017222273413daec17c392e672aa81273162d8 100644 (file)
@@ -13,5 +13,5 @@
     <item>Tema luminoso</item>
     <item>Tema predeterminado</item>
   </string-array>
-  
+
 </resources>
index 70ba29233d3587984139e986774f0ec6b519461e..93ca703e4a39b51190e88b621b4c3f6278cfc06a 100644 (file)
@@ -24,7 +24,7 @@
 
     <!-- Download. -->
     <string name="downloadFailed">Error descargando archivo: \n%s</string>
-    <string name="downloadManagerQueryFailed">No se pudo consultar con el gestor de descargas.\nEstá deshabilitado o no se encuentra</string>   
+    <string name="downloadManagerQueryFailed">No se pudo consultar con el gestor de descargas.\nEstá deshabilitado o no se encuentra</string>
     <string name="unzippingDictionary">Descomprimiendo diccionario: \n%s</string>
     <string name="unzippingFailed">Error descomprimiendo diccionario: \n%s</string>
     <string name="installationFinished">Terminado: \n%s.</string>
index 83408d5a5297858268fc5563f0c4bfab9e117789..571d344214f881f7e6ad271ae4648f200c66eb24 100644 (file)
@@ -7,7 +7,7 @@
     <string name="help">Guida</string>
     <string name="reportIssue">Segnala problema…</string>
     <string name="no_dict_file">Please specify a default directory in the settings.</string>
-    
+
     <!-- DictionaryManagerActivity -->
     <string name="dictionaryManager">Gestione dizionari</string>
     <string name="dictionariesOnDevice">Dizionari sul dispositivo</string>
@@ -43,7 +43,7 @@
     <string name="speak">Pronuncia</string>
     <string name="nextWord">Next word</string>
     <string name="previousWord">Previous word</string>
-    
+
     <!-- About dictionary. -->
     <string name="dictionaryPath">File: %s</string>
     <string name="dictionarySize">Dimenzione: %,d bytes</string>
 
     <!-- About. -->
     <string name="contactMe">Grazie a Fabio per la traduzione in italiano!
-Se stai usando QuickDic, mi piacerebbe saperlo. 
-Sfortunatamente, non ho responsabilità circa il contenuto del dizionario 
-(al difuori della formattazione), in quanto è creato con altre sorgenti. 
-Per favore inviami (in inglese) commenti, suggerimenti, 
+Se stai usando QuickDic, mi piacerebbe saperlo.
+Sfortunatamente, non ho responsabilità circa il contenuto del dizionario
+(al difuori della formattazione), in quanto è creato con altre sorgenti.
+Per favore inviami (in inglese) commenti, suggerimenti,
 segnalazioni di bug o semplicemente un breve saluto a:</string>
     <string name="webPage">Per più informazioni, guarda:</string>
     <string name="contributionsFrom">Contributions from:</string>
index d7477045ecadb56f2bef8f8ac6c521e8081c79a4..139a9eb5ab548346b935538b15659b19af3e526f 100644 (file)
@@ -13,5 +13,5 @@
     <item>ライト テーマ</item>
     <item>デフォルト テーマ</item>
   </string-array>
-  
+
 </resources>
index dae0c37e5f610e5e4e805c82c085798991c87ea4..45064cdd4cce0c437a43adbe9f4b2f45ab563d48 100644 (file)
@@ -1,5 +1,5 @@
 <resources>
-    
+
     <style name="AppBaseThemeLight" parent="@style/Theme.AppCompat.Light">
         <!--
             Theme customizations available in newer API levels can go in
@@ -7,7 +7,7 @@
             backward-compatibility can go here.
         -->
     </style>
-    
+
     <style name="AppBaseThemeDark" parent="@style/Theme.AppCompat">
         <!--
             Theme customizations available in newer API levels can go in
index 94fd7e0e329a2a356d312b41f3307e6c5cef5d3d..f11f7450a82fb155e3cc0a5f90a9a53af9653885 100644 (file)
@@ -1,3 +1,3 @@
 <resources>
-    
+
 </resources>
index 732313bc4039071e15078f6f0a00a9c9e1795702..276f9a0ecbe1624db7d960a4c982ed925282b1f7 100644 (file)
@@ -26,5 +26,5 @@
     <item>Light theme</item>
     <item>Default theme</item>
   </string-array>
-  
+
 </resources>
index 1f9a1a2129c751a83b0f670182cd49e82f5d9dc9..7afcc0cf6bf67e66a9261c33e6f1e9e813815eee 100644 (file)
@@ -1,47 +1,47 @@
-// Copyright 2011 Google Inc. All Rights Reserved.\r
-//\r
-// Licensed under the Apache License, Version 2.0 (the "License");\r
-// you may not use this file except in compliance with the License.\r
-// You may obtain a copy of the License at\r
-//\r
-//     http://www.apache.org/licenses/LICENSE-2.0\r
-//\r
-// Unless required by applicable law or agreed to in writing, software\r
-// distributed under the License is distributed on an "AS IS" BASIS,\r
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-// See the License for the specific language governing permissions and\r
-// limitations under the License.\r
-\r
-package com.hughes.android.dictionary;\r
-\r
-import android.app.Activity;\r
-import android.content.pm.PackageInfo;\r
-import android.content.pm.PackageManager;\r
-import android.os.Bundle;\r
-import android.widget.TextView;\r
-\r
-public final class AboutActivity extends Activity {\r
-\r
-    public static final String CURRENT_DICT_INFO = "currentDictInfo";\r
-\r
-    /** Called when the activity is first created. */\r
-    @Override\r
-    public void onCreate(final Bundle savedInstanceState) {\r
-        setTheme(((DictionaryApplication) getApplication()).getSelectedTheme().themeId);\r
-\r
-        super.onCreate(savedInstanceState);\r
-        setContentView(R.layout.about_activity);\r
-        String ver = "???";\r
-        try {\r
-            PackageManager pm = getPackageManager();\r
-            if (pm != null) {\r
-                PackageInfo p = pm.getPackageInfo(getPackageName(), 0);\r
-                ver = p.versionName + " (ID " + p.versionCode + ")";\r
-            }\r
-        } catch (Exception e) {\r
-        }\r
-        TextView titleView = (TextView)findViewById(R.id.titleText);\r
-        titleView.setText("QuickDic " + ver);\r
-    }\r
-\r
-}\r
+// Copyright 2011 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.hughes.android.dictionary;
+
+import android.app.Activity;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.os.Bundle;
+import android.widget.TextView;
+
+public final class AboutActivity extends Activity {
+
+    public static final String CURRENT_DICT_INFO = "currentDictInfo";
+
+    /** Called when the activity is first created. */
+    @Override
+    public void onCreate(final Bundle savedInstanceState) {
+        setTheme(((DictionaryApplication) getApplication()).getSelectedTheme().themeId);
+
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.about_activity);
+        String ver = "???";
+        try {
+            PackageManager pm = getPackageManager();
+            if (pm != null) {
+                PackageInfo p = pm.getPackageInfo(getPackageName(), 0);
+                ver = p.versionName + " (ID " + p.versionCode + ")";
+            }
+        } catch (Exception e) {
+        }
+        TextView titleView = (TextView)findViewById(R.id.titleText);
+        titleView.setText("QuickDic " + ver);
+    }
+
+}
index 6f7eeb02843fff0daa5f68b10739be1284711358..c79faf32c77e4384867e54a8745839b5e8f28c4b 100644 (file)
@@ -473,9 +473,9 @@ public class DictionaryActivity extends ActionBarActivity {
         actionBar.setDisplayShowTitleEnabled(false);
         actionBar.setDisplayShowHomeEnabled(false);
         actionBar.setDisplayHomeAsUpEnabled(false);
-        
+
         final LinearLayout customSearchView = new LinearLayout(getSupportActionBar().getThemedContext());
-        
+
         final LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
                 ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
         customSearchView.setLayoutParams(layoutParams);
@@ -1459,7 +1459,7 @@ public class DictionaryActivity extends ActionBarActivity {
             result.setFocusable(true);
             result.setLongClickable(true);
 //            result.setBackgroundResource(android.R.drawable.menuitem_background);
-            
+
             result.setBackgroundResource(theme.normalRowBg);
 
             result.setOnClickListener(new TextView.OnClickListener() {
index 50acb43c0a745e6ba111ed7f9dd5fb82c3f6c988..e15dfff2fa9eeb37652a450deda399263a69bcfe 100644 (file)
@@ -283,7 +283,7 @@ public class DictionaryApplication extends Application {
         final List<String> dictionaryFilesOrdered = new ArrayList<String>();
 
         final Map<String, DictionaryInfo> uncompressedFilenameToDictionaryInfo = new LinkedHashMap<String, DictionaryInfo>();
-        
+
         /**
          * Sometimes a deserialized version of this data structure isn't valid.
          * @return
index 50871040b0e7a6ad49f21f52f0f3167e808bdec5..a1bc375823f8954db8fb41e4d3ba0500fb4ff7eb 100644 (file)
@@ -171,8 +171,8 @@ public class DictionaryManagerActivity extends ActionBarActivity {
                 Log.w(LOG, "Download finished: " + dest + " Id: " + downloadId);
                 Toast.makeText(context, getString(R.string.unzippingDictionary, dest),
                         Toast.LENGTH_LONG).show();
-                
-                
+
+
                 final Uri zipUri = Uri.parse(dest);
                 File localZipFile = null;
                 InputStream zipFileStream = null;
index bf8eda232284bb01bc876252851b191dff8d990a..de3c138373728e8b764e0a8b8ffc1f4e5f633989 100644 (file)
-// Copyright 2011 Google Inc. All Rights Reserved.\r
-//\r
-// Licensed under the Apache License, Version 2.0 (the "License");\r
-// you may not use this file except in compliance with the License.\r
-// You may obtain a copy of the License at\r
-//\r
-//     http://www.apache.org/licenses/LICENSE-2.0\r
-//\r
-// Unless required by applicable law or agreed to in writing, software\r
-// distributed under the License is distributed on an "AS IS" BASIS,\r
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-// See the License for the specific language governing permissions and\r
-// limitations under the License.\r
-\r
-package com.hughes.android.dictionary;\r
-\r
-import android.content.Context;\r
-import android.content.Intent;\r
-import android.os.Bundle;\r
-import android.support.v7.app.ActionBar;\r
-import android.support.v7.app.ActionBarActivity;\r
-import android.util.Base64;\r
-import android.util.Log;\r
-import android.view.MenuItem;\r
-import android.view.View;\r
-import android.view.View.OnClickListener;\r
-import android.widget.Button;\r
-\r
-import com.hughes.util.StringUtil;\r
-\r
-import java.io.IOException;\r
-import java.io.InputStream;\r
-import java.io.UnsupportedEncodingException;\r
-\r
-public final class HtmlDisplayActivity extends ActionBarActivity {\r
-\r
-    static final String LOG = "QuickDic";\r
-\r
-    static final String HTML_RES = "html_res";\r
-    static final String HTML = "html";\r
-    static final String TEXT_TO_HIGHLIGHT = "textToHighlight";\r
-    static final String SHOW_OK_BUTTON = "showOKButton";\r
-\r
-    public static Intent getHelpLaunchIntent(Context c) {\r
-        final Intent intent = new Intent(c, HtmlDisplayActivity.class);\r
-        intent.putExtra(HTML_RES, R.raw.help);\r
-        return intent;\r
-    }\r
-\r
-    public static Intent getWhatsNewLaunchIntent(Context c) {\r
-        final Intent intent = new Intent(c, HtmlDisplayActivity.class);\r
-        intent.putExtra(HTML_RES, R.raw.whats_new);\r
-        return intent;\r
-    }\r
-\r
-    public static Intent getHtmlIntent(Context c, final String html, final String textToHighlight,\r
-            final boolean showOkButton) {\r
-        final Intent intent = new Intent(c, HtmlDisplayActivity.class);\r
-        intent.putExtra(HTML, html);\r
-        intent.putExtra(TEXT_TO_HIGHLIGHT, textToHighlight);\r
-        intent.putExtra(SHOW_OK_BUTTON, showOkButton);\r
-        return intent;\r
-    }\r
-\r
-    /** Called when the activity is first created. */\r
-    @Override\r
-    public void onCreate(final Bundle savedInstanceState) {\r
-        setTheme(((DictionaryApplication) getApplication()).getSelectedTheme().themeId);\r
-\r
-        super.onCreate(savedInstanceState);\r
-        setContentView(R.layout.html_display_activity);\r
-        \r
-        ActionBar actionBar = getSupportActionBar();\r
-        actionBar.setDisplayHomeAsUpEnabled(true);\r
-\r
-        final int htmlRes = getIntent().getIntExtra(HTML_RES, -1);\r
-        String html;\r
-        if (htmlRes != -1) {\r
-            InputStream res = getResources().openRawResource(htmlRes);\r
-            html = StringUtil.readToString(res);\r
-            try {\r
-                res.close();\r
-            } catch (IOException e) {\r
-            }\r
-        } else {\r
-            html = getIntent().getStringExtra(HTML);\r
-        }\r
-        final MyWebView webView = (MyWebView) findViewById(R.id.webView);\r
-        try {\r
-            // No way to get pure UTF-8 data into WebView\r
-            html = Base64.encodeToString(html.getBytes("UTF-8"), Base64.DEFAULT);\r
-        } catch (UnsupportedEncodingException e) {\r
-            throw new RuntimeException("Missing UTF-8 support?!", e);\r
-        }\r
-        // Use loadURL to allow specifying a charset\r
-        webView.loadUrl("data:text/html;charset=utf-8;base64," + html);\r
-        webView.activity = this;\r
-\r
-        final String textToHighlight = getIntent().getStringExtra(TEXT_TO_HIGHLIGHT);\r
-        if (textToHighlight != null && !"".equals(textToHighlight)) {\r
-            Log.d(LOG, "NOT Highlighting text: " + textToHighlight);\r
-            // This isn't working:\r
-            // webView.findAll(textToHighlight);\r
-            // webView.showFindDialog(textToHighlight, false);\r
-        }\r
-\r
-        final Button okButton = (Button) findViewById(R.id.okButton);\r
-        okButton.setOnClickListener(new OnClickListener() {\r
-            @Override\r
-            public void onClick(View v) {\r
-                finish();\r
-            }\r
-        });\r
-        if (!getIntent().getBooleanExtra(SHOW_OK_BUTTON, true)) {\r
-            okButton.setVisibility(Button.GONE);\r
-        }\r
-    }\r
-\r
-    @Override\r
-    public void onBackPressed() {\r
-        final MyWebView webView = (MyWebView)findViewById(R.id.webView);\r
-        if (webView.canGoBack()) webView.goBack();\r
-        else super.onBackPressed();\r
-    }\r
-\r
-    @Override\r
-    public boolean onOptionsItemSelected(MenuItem item) {\r
-        // Explicitly handle the up button press so\r
-        // we return to the dictionary.\r
-        if (item.getItemId() == android.R.id.home)\r
-        {\r
-            finish();\r
-            return true;\r
-        }\r
-        return super.onOptionsItemSelected(item);\r
-    }\r
-}\r
+// Copyright 2011 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.hughes.android.dictionary;
+
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.v7.app.ActionBar;
+import android.support.v7.app.ActionBarActivity;
+import android.util.Base64;
+import android.util.Log;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+
+import com.hughes.util.StringUtil;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+
+public final class HtmlDisplayActivity extends ActionBarActivity {
+
+    static final String LOG = "QuickDic";
+
+    static final String HTML_RES = "html_res";
+    static final String HTML = "html";
+    static final String TEXT_TO_HIGHLIGHT = "textToHighlight";
+    static final String SHOW_OK_BUTTON = "showOKButton";
+
+    public static Intent getHelpLaunchIntent(Context c) {
+        final Intent intent = new Intent(c, HtmlDisplayActivity.class);
+        intent.putExtra(HTML_RES, R.raw.help);
+        return intent;
+    }
+
+    public static Intent getWhatsNewLaunchIntent(Context c) {
+        final Intent intent = new Intent(c, HtmlDisplayActivity.class);
+        intent.putExtra(HTML_RES, R.raw.whats_new);
+        return intent;
+    }
+
+    public static Intent getHtmlIntent(Context c, final String html, final String textToHighlight,
+            final boolean showOkButton) {
+        final Intent intent = new Intent(c, HtmlDisplayActivity.class);
+        intent.putExtra(HTML, html);
+        intent.putExtra(TEXT_TO_HIGHLIGHT, textToHighlight);
+        intent.putExtra(SHOW_OK_BUTTON, showOkButton);
+        return intent;
+    }
+
+    /** Called when the activity is first created. */
+    @Override
+    public void onCreate(final Bundle savedInstanceState) {
+        setTheme(((DictionaryApplication) getApplication()).getSelectedTheme().themeId);
+
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.html_display_activity);
+
+        ActionBar actionBar = getSupportActionBar();
+        actionBar.setDisplayHomeAsUpEnabled(true);
+
+        final int htmlRes = getIntent().getIntExtra(HTML_RES, -1);
+        String html;
+        if (htmlRes != -1) {
+            InputStream res = getResources().openRawResource(htmlRes);
+            html = StringUtil.readToString(res);
+            try {
+                res.close();
+            } catch (IOException e) {
+            }
+        } else {
+            html = getIntent().getStringExtra(HTML);
+        }
+        final MyWebView webView = (MyWebView) findViewById(R.id.webView);
+        try {
+            // No way to get pure UTF-8 data into WebView
+            html = Base64.encodeToString(html.getBytes("UTF-8"), Base64.DEFAULT);
+        } catch (UnsupportedEncodingException e) {
+            throw new RuntimeException("Missing UTF-8 support?!", e);
+        }
+        // Use loadURL to allow specifying a charset
+        webView.loadUrl("data:text/html;charset=utf-8;base64," + html);
+        webView.activity = this;
+
+        final String textToHighlight = getIntent().getStringExtra(TEXT_TO_HIGHLIGHT);
+        if (textToHighlight != null && !"".equals(textToHighlight)) {
+            Log.d(LOG, "NOT Highlighting text: " + textToHighlight);
+            // This isn't working:
+            // webView.findAll(textToHighlight);
+            // webView.showFindDialog(textToHighlight, false);
+        }
+
+        final Button okButton = (Button) findViewById(R.id.okButton);
+        okButton.setOnClickListener(new OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                finish();
+            }
+        });
+        if (!getIntent().getBooleanExtra(SHOW_OK_BUTTON, true)) {
+            okButton.setVisibility(Button.GONE);
+        }
+    }
+
+    @Override
+    public void onBackPressed() {
+        final MyWebView webView = (MyWebView)findViewById(R.id.webView);
+        if (webView.canGoBack()) webView.goBack();
+        else super.onBackPressed();
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        // Explicitly handle the up button press so
+        // we return to the dictionary.
+        if (item.getItemId() == android.R.id.home)
+        {
+            finish();
+            return true;
+        }
+        return super.onOptionsItemSelected(item);
+    }
+}
index bcca16a6ceabc8d83a6892b25098dfce07a51948..1e7ba15c54cf3fee16df1b32d8fc8c908f656e3a 100644 (file)
@@ -35,7 +35,7 @@ public class PreferenceActivity extends android.preference.PreferenceActivity
     public void onCreate(Bundle savedInstanceState) {
         final DictionaryApplication application = (DictionaryApplication) getApplication();
         setTheme(application.getSelectedTheme().themeId);
-        
+
         final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
         if (prefs.getString(getString(R.string.quickdicDirectoryKey), "").equals("")) {
             prefs.edit().putString(getString(R.string.quickdicDirectoryKey), application.getDictDir().getAbsolutePath()).commit();
index 5ee2ce96a4984ad8a9e823b28410f973e4daacc2..01cd12576748ca879ff9ac4f16bc0d0242f61b83 100644 (file)
@@ -13,7 +13,7 @@
 // limitations under the License.
 
 /**
- * 
+ *
  */
 
 package com.hughes.android.dictionary.engine;
index 0d48fc38c4a412456afc07b1fda83d91662dabaf..007ad4b6e16293906fbb6188aa5986b43a0c9ba8 100644 (file)
-// Copyright 2011 Google Inc. All Rights Reserved.\r
-//\r
-// Licensed under the Apache License, Version 2.0 (the "License");\r
-// you may not use this file except in compliance with the License.\r
-// You may obtain a copy of the License at\r
-//\r
-//     http://www.apache.org/licenses/LICENSE-2.0\r
-//\r
-// Unless required by applicable law or agreed to in writing, software\r
-// distributed under the License is distributed on an "AS IS" BASIS,\r
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-// See the License for the specific language governing permissions and\r
-// limitations under the License.\r
-\r
-package com.hughes.android.dictionary.engine;\r
-\r
-import com.hughes.android.dictionary.DictionaryApplication;\r
-import java.text.Collator;\r
-\r
-import java.util.Comparator;\r
-import java.util.LinkedHashMap;\r
-import java.util.Locale;\r
-import java.util.Map;\r
-import java.util.regex.Pattern;\r
-\r
-public class Language {\r
-\r
-    public static final class LanguageResources {\r
-        public final String englishName;\r
-        public final int nameId;\r
-        public final int flagId;\r
-\r
-        public LanguageResources(final String englishName, int nameId, int flagId) {\r
-            this.englishName = englishName;\r
-            this.nameId = nameId;\r
-            this.flagId = flagId;\r
-        }\r
-\r
-        public LanguageResources(final String englishName, int nameId) {\r
-            this(englishName, nameId, 0);\r
-        }\r
-    }\r
-\r
-    private static final Map<String, Language> registry = new LinkedHashMap<String, Language>();\r
-\r
-    final String isoCode;\r
-    final Locale locale;\r
-\r
-    private Collator collator;\r
-\r
-    private Language(final Locale locale, final String isoCode) {\r
-        this.locale = locale;\r
-        this.isoCode = isoCode;\r
-\r
-        registry.put(isoCode.toLowerCase(), this);\r
-    }\r
-\r
-    @Override\r
-    public String toString() {\r
-        return locale.toString();\r
-    }\r
-\r
-    public String getIsoCode() {\r
-        return isoCode;\r
-    }\r
-\r
-    public synchronized Comparator getCollator() {\r
-        if (!DictionaryApplication.USE_COLLATOR)\r
-            return String.CASE_INSENSITIVE_ORDER;\r
-        // Don't think this is thread-safe...\r
-        // if (collator == null) {\r
-        this.collator = Collator.getInstance(locale);\r
-        this.collator.setStrength(Collator.IDENTICAL);\r
-        // }\r
-        return collator;\r
-    }\r
-\r
-    public String getDefaultNormalizerRules() {\r
-        return ":: Any-Latin; ' ' > ; :: Lower; :: NFD; :: [:Nonspacing Mark:] Remove; :: NFC ;";\r
-    }\r
-\r
-    /**\r
-     * A practical pattern to identify strong RTL characters. This pattern is\r
-     * not completely correct according to the Unicode standard. It is\r
-     * simplified for performance and small code size.\r
-     */\r
-    private static final String rtlChars =\r
-            "\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC";\r
-\r
-    private static final String puncChars =\r
-            "\\[\\]\\(\\)\\{\\}\\=";\r
-\r
-    private static final Pattern RTL_LEFT_BOUNDARY = Pattern.compile("([" + puncChars + "])(["\r
-            + rtlChars + "])");\r
-    private static final Pattern RTL_RIGHT_BOUNDARY = Pattern.compile("([" + rtlChars + "])(["\r
-            + puncChars + "])");\r
-\r
-    public static String fixBidiText(String text) {\r
-        // text = RTL_LEFT_BOUNDARY.matcher(text).replaceAll("$1\u200e $2");\r
-        // text = RTL_RIGHT_BOUNDARY.matcher(text).replaceAll("$1 \u200e$2");\r
-        return text;\r
-    }\r
-\r
-    // ----------------------------------------------------------------\r
-\r
-    public static final Language en = new Language(Locale.ENGLISH, "EN");\r
-    public static final Language fr = new Language(Locale.FRENCH, "FR");\r
-    public static final Language it = new Language(Locale.ITALIAN, "IT");\r
-\r
-    public static final Language de = new Language(Locale.GERMAN, "DE") {\r
-        @Override\r
-        public String getDefaultNormalizerRules() {\r
-            return ":: Lower; 'ae' > 'ä'; 'oe' > 'ö'; 'ue' > 'ü'; 'ß' > 'ss'; ";\r
-        }\r
-    };\r
-\r
-    // ----------------------------------------------------------------\r
-\r
-    public static synchronized Language lookup(final String isoCode) {\r
-        Language lang = registry.get(isoCode.toLowerCase());\r
-        if (lang == null) {\r
-            lang = new Language(new Locale(isoCode), isoCode);\r
-        }\r
-        return lang;\r
-    }\r
-\r
-}\r
+// Copyright 2011 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.hughes.android.dictionary.engine;
+
+import com.hughes.android.dictionary.DictionaryApplication;
+import java.text.Collator;
+
+import java.util.Comparator;
+import java.util.LinkedHashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.regex.Pattern;
+
+public class Language {
+
+    public static final class LanguageResources {
+        public final String englishName;
+        public final int nameId;
+        public final int flagId;
+
+        public LanguageResources(final String englishName, int nameId, int flagId) {
+            this.englishName = englishName;
+            this.nameId = nameId;
+            this.flagId = flagId;
+        }
+
+        public LanguageResources(final String englishName, int nameId) {
+            this(englishName, nameId, 0);
+        }
+    }
+
+    private static final Map<String, Language> registry = new LinkedHashMap<String, Language>();
+
+    final String isoCode;
+    final Locale locale;
+
+    private Collator collator;
+
+    private Language(final Locale locale, final String isoCode) {
+        this.locale = locale;
+        this.isoCode = isoCode;
+
+        registry.put(isoCode.toLowerCase(), this);
+    }
+
+    @Override
+    public String toString() {
+        return locale.toString();
+    }
+
+    public String getIsoCode() {
+        return isoCode;
+    }
+
+    public synchronized Comparator getCollator() {
+        if (!DictionaryApplication.USE_COLLATOR)
+            return String.CASE_INSENSITIVE_ORDER;
+        // Don't think this is thread-safe...
+        // if (collator == null) {
+        this.collator = Collator.getInstance(locale);
+        this.collator.setStrength(Collator.IDENTICAL);
+        // }
+        return collator;
+    }
+
+    public String getDefaultNormalizerRules() {
+        return ":: Any-Latin; ' ' > ; :: Lower; :: NFD; :: [:Nonspacing Mark:] Remove; :: NFC ;";
+    }
+
+    /**
+     * A practical pattern to identify strong RTL characters. This pattern is
+     * not completely correct according to the Unicode standard. It is
+     * simplified for performance and small code size.
+     */
+    private static final String rtlChars =
+            "\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC";
+
+    private static final String puncChars =
+            "\\[\\]\\(\\)\\{\\}\\=";
+
+    private static final Pattern RTL_LEFT_BOUNDARY = Pattern.compile("([" + puncChars + "])(["
+            + rtlChars + "])");
+    private static final Pattern RTL_RIGHT_BOUNDARY = Pattern.compile("([" + rtlChars + "])(["
+            + puncChars + "])");
+
+    public static String fixBidiText(String text) {
+        // text = RTL_LEFT_BOUNDARY.matcher(text).replaceAll("$1\u200e $2");
+        // text = RTL_RIGHT_BOUNDARY.matcher(text).replaceAll("$1 \u200e$2");
+        return text;
+    }
+
+    // ----------------------------------------------------------------
+
+    public static final Language en = new Language(Locale.ENGLISH, "EN");
+    public static final Language fr = new Language(Locale.FRENCH, "FR");
+    public static final Language it = new Language(Locale.ITALIAN, "IT");
+
+    public static final Language de = new Language(Locale.GERMAN, "DE") {
+        @Override
+        public String getDefaultNormalizerRules() {
+            return ":: Lower; 'ae' > 'ä'; 'oe' > 'ö'; 'ue' > 'ü'; 'ß' > 'ss'; ";
+        }
+    };
+
+    // ----------------------------------------------------------------
+
+    public static synchronized Language lookup(final String isoCode) {
+        Language lang = registry.get(isoCode.toLowerCase());
+        if (lang == null) {
+            lang = new Language(new Locale(isoCode), isoCode);
+        }
+        return lang;
+    }
+
+}