• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Offline HTML Reader for Android


Commit MetaInfo

Revision8774374a8b87d5db48cecb2344e15851e9dc1a82 (tree)
Zeit2013-05-11 21:04:37
AutorKana Koda <kodakana@user...>
CommiterKana Koda

Log Message

開くファイルがないときに表示するデフォルトのページを追加。内部的修正。

Ändern Zusammenfassung

Diff

Binary files a/.README.kate-swp and /dev/null differ
--- a/.classpath
+++ b/.classpath
@@ -4,6 +4,5 @@
44 <classpathentry kind="src" path="gen"/>
55 <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
66 <classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
7- <classpathentry exported="true" kind="lib" path="/home/kodakana/Documents/Workspace/Kigo/libs/android-support-v4.jar"/>
87 <classpathentry kind="output" path="bin/classes"/>
98 </classpath>
--- /dev/null
+++ b/.directory
@@ -0,0 +1,6 @@
1+[Dolphin]
2+Timestamp=2013,5,11,20,23,13
3+Version=3
4+
5+[Settings]
6+HiddenFilesShown=true
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1,8 +1,8 @@
11 <?xml version="1.0" encoding="utf-8"?>
22 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
33 package="org.pulpdust.unnetbrowser"
4- android:versionCode="4"
5- android:versionName="0.8"
4+ android:versionCode="5"
5+ android:versionName="0.82"
66 android:installLocation="auto" >
77
88 <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="14" />
--- a/README
+++ b/README
@@ -22,6 +22,7 @@ OI File Manager が必要です。OI File Manager がなくても、任意のフ
2222 * ハードキーボードから各種機能を操作可能です。
2323 * <(前へ)ボタンを長押しすると index ファイルを表示(有る場合)するか、HTML ファイル一覧を表示します。
2424 * >(次へ)ボタンを長押しすると履歴を進みます。
25+ * PgUp/PgDn ボタンを長押しすると、アクションバーの表示を一時的に切り替えることができます(Android 3.0 以降)。
2526
2627 キーボードショートカット
2728 ---------------------
Binary files /dev/null and b/assets/20121121222807.png differ
--- a/assets/index.html
+++ /dev/null
@@ -1 +0,0 @@
1-<html><body><h1>It works!</h1></body></html>
\ No newline at end of file
--- /dev/null
+++ b/assets/index_c.html
@@ -0,0 +1,16 @@
1+<html>
2+<head>
3+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
4+<title>Unnet Browser</title>
5+</head>
6+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
7+<meta http-equiv="Content-Style-Type" content="text/css" />
8+<title>Unnet Browser</title>
9+<link rel="stylesheet" type="text/css" href="style.css" />
10+</head>
11+<body>
12+<h1>Seeing this instead of the localpage you expected?</h1>
13+<div class="mural"><img src="20121121222807.png" alt="" /></div>
14+<p>Unnet Browser is an offline HTML reader. To open the HTML file stored in your memory card, Select it from any file manager, Or after installing the <a href="market://search?q=pname:org.openintents.filemanager">OI File Manager</a>, open the menu on this screen, please press the [Open...].</p>
15+</body>
16+</html>
\ No newline at end of file
--- /dev/null
+++ b/assets/index_ja.html
@@ -0,0 +1,13 @@
1+<html>
2+<head>
3+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
4+<meta http-equiv="Content-Style-Type" content="text/css" />
5+<title>Unnet Browser</title>
6+<link rel="stylesheet" type="text/css" href="style.css" />
7+</head>
8+<body>
9+<h1>あなたの予想に反して、このページが見えているでしょうか?</h1>
10+<div class="mural"><img src="20121121222807.png" alt="" /></div>
11+<p>Unnet Browser はオフライン HTML リーダです。あなたのメモリカードに保存されている HTML ファイルを開くには、任意のファイルマネージャからそれを選択するか、<a href="market://search?q=pname:org.openintents.filemanager">OI File Manager</a> をインストールしてから、この画面でメニューを開き、[開く…]を押してください。</p>
12+</body>
13+</html>
\ No newline at end of file
--- /dev/null
+++ b/assets/style.css
@@ -0,0 +1,6 @@
1+h1, .mural {
2+ text-align: center;
3+}
4+img {
5+ width: 50%;
6+}
--- a/bin/AndroidManifest.xml
+++ b/bin/AndroidManifest.xml
@@ -1,8 +1,8 @@
11 <?xml version="1.0" encoding="utf-8"?>
22 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
33 package="org.pulpdust.unnetbrowser"
4- android:versionCode="4"
5- android:versionName="0.8"
4+ android:versionCode="5"
5+ android:versionName="0.82"
66 android:installLocation="auto" >
77
88 <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="14" />
Binary files a/bin/Unnet Browser.apk and b/bin/Unnet Browser.apk differ
Binary files a/bin/classes.dex and b/bin/classes.dex differ
Binary files a/bin/classes/org/pulpdust/unnetbrowser/R$string.class and b/bin/classes/org/pulpdust/unnetbrowser/R$string.class differ
Binary files a/bin/classes/org/pulpdust/unnetbrowser/R$style.class and b/bin/classes/org/pulpdust/unnetbrowser/R$style.class differ
Binary files a/bin/classes/org/pulpdust/unnetbrowser/R$xml.class and b/bin/classes/org/pulpdust/unnetbrowser/R$xml.class differ
Binary files a/bin/classes/org/pulpdust/unnetbrowser/UnnetBrowserActivity$1.class and b/bin/classes/org/pulpdust/unnetbrowser/UnnetBrowserActivity$1.class differ
Binary files a/bin/classes/org/pulpdust/unnetbrowser/UnnetBrowserActivity$10.class and b/bin/classes/org/pulpdust/unnetbrowser/UnnetBrowserActivity$10.class differ
Binary files a/bin/classes/org/pulpdust/unnetbrowser/UnnetBrowserActivity$11.class and b/bin/classes/org/pulpdust/unnetbrowser/UnnetBrowserActivity$11.class differ
Binary files a/bin/classes/org/pulpdust/unnetbrowser/UnnetBrowserActivity$12.class and b/bin/classes/org/pulpdust/unnetbrowser/UnnetBrowserActivity$12.class differ
Binary files a/bin/classes/org/pulpdust/unnetbrowser/UnnetBrowserActivity$13.class and b/bin/classes/org/pulpdust/unnetbrowser/UnnetBrowserActivity$13.class differ
Binary files a/bin/classes/org/pulpdust/unnetbrowser/UnnetBrowserActivity$2.class and b/bin/classes/org/pulpdust/unnetbrowser/UnnetBrowserActivity$2.class differ
Binary files a/bin/classes/org/pulpdust/unnetbrowser/UnnetBrowserActivity$3.class and b/bin/classes/org/pulpdust/unnetbrowser/UnnetBrowserActivity$3.class differ
Binary files a/bin/classes/org/pulpdust/unnetbrowser/UnnetBrowserActivity$4.class and b/bin/classes/org/pulpdust/unnetbrowser/UnnetBrowserActivity$4.class differ
Binary files a/bin/classes/org/pulpdust/unnetbrowser/UnnetBrowserActivity$5.class and b/bin/classes/org/pulpdust/unnetbrowser/UnnetBrowserActivity$5.class differ
Binary files a/bin/classes/org/pulpdust/unnetbrowser/UnnetBrowserActivity$6.class and b/bin/classes/org/pulpdust/unnetbrowser/UnnetBrowserActivity$6.class differ
Binary files a/bin/classes/org/pulpdust/unnetbrowser/UnnetBrowserActivity$7.class and b/bin/classes/org/pulpdust/unnetbrowser/UnnetBrowserActivity$7.class differ
Binary files a/bin/classes/org/pulpdust/unnetbrowser/UnnetBrowserActivity$8.class and b/bin/classes/org/pulpdust/unnetbrowser/UnnetBrowserActivity$8.class differ
Binary files a/bin/classes/org/pulpdust/unnetbrowser/UnnetBrowserActivity$9.class and b/bin/classes/org/pulpdust/unnetbrowser/UnnetBrowserActivity$9.class differ
Binary files a/bin/classes/org/pulpdust/unnetbrowser/UnnetBrowserActivity$IndexDialog$1.class and b/bin/classes/org/pulpdust/unnetbrowser/UnnetBrowserActivity$IndexDialog$1.class differ
Binary files a/bin/classes/org/pulpdust/unnetbrowser/UnnetBrowserActivity$IndexDialog.class and b/bin/classes/org/pulpdust/unnetbrowser/UnnetBrowserActivity$IndexDialog.class differ
Binary files a/bin/classes/org/pulpdust/unnetbrowser/UnnetBrowserActivity.class and b/bin/classes/org/pulpdust/unnetbrowser/UnnetBrowserActivity.class differ
Binary files a/bin/classes/org/pulpdust/unnetbrowser/forHoneycomb.class and b/bin/classes/org/pulpdust/unnetbrowser/forHoneycomb.class differ
Binary files /dev/null and b/bin/dexedLibs/android-support-v4-d5e27d8057ff1bfa10b4fef9f0a379a6.jar differ
Binary files /dev/null and b/bin/dexedLibs/annotations-b08b0270ab1b3b2f368b5de4f35186a9.jar differ
Binary files a/bin/resources.ap_ and b/bin/resources.ap_ differ
--- a/gen/org/pulpdust/unnetbrowser/R.java
+++ b/gen/org/pulpdust/unnetbrowser/R.java
@@ -73,7 +73,6 @@ public final class R {
7373 public static final int match=0x7f06001c;
7474 public static final int next=0x7f06001e;
7575 public static final int open=0x7f06000b;
76- public static final int perf_actionbar_desc=0x7f060041;
7776 public static final int pgdn=0x7f060020;
7877 public static final int pgup=0x7f06001f;
7978 public static final int pref_actionbar=0x7f06002c;
Binary files /dev/null and b/libs/android-support-v4.jar differ
--- a/res/values-ja/strings.xml
+++ b/res/values-ja/strings.xml
@@ -46,7 +46,7 @@
4646 <string name="pref_wide">描画領域を拡げる</string>
4747 <string name="pref_title">タイトルバーを隠す</string>
4848 <string name="pref_actionbar">アクションバーを隠す</string>
49- <string name="perf_actionbar_desc">この設定は画面が再構築されるときに完全に反映されます。</string>
49+ <string name="pref_actionbar_desc">この設定は画面が再構築されるときに完全に反映されます。</string>
5050 <string name="pref_title_desc">この設定は画面が再構築されるときに反映されます。</string>
5151 <string name="pref_restart">自動的に開き直す</string>
5252 <string name="pref_restart_desc">設定を反映するために必要な場合に自動的に再起動するかどうか。</string>
--- a/src/org/pulpdust/unnetbrowser/UnnetBrowserActivity.java
+++ b/src/org/pulpdust/unnetbrowser/UnnetBrowserActivity.java
@@ -2,15 +2,14 @@ package org.pulpdust.unnetbrowser;
22
33 import java.io.File;
44 import java.io.UnsupportedEncodingException;
5+import java.net.URLDecoder;
56 import java.util.Arrays;
67 import java.util.Collections;
78 import java.util.List;
9+import java.util.Locale;
810 import java.util.regex.Matcher;
911 import java.util.regex.Pattern;
10-import java.net.URLDecoder;
11-import java.lang.Math;
1212
13-import android.app.Activity;
1413 import android.app.AlertDialog;
1514 import android.app.Dialog;
1615 import android.content.ActivityNotFoundException;
@@ -19,47 +18,45 @@ import android.content.DialogInterface;
1918 import android.content.Intent;
2019 import android.content.SharedPreferences;
2120 import android.content.res.Configuration;
21+import android.graphics.Bitmap;
22+import android.support.v4.app.DialogFragment;
23+import android.support.v4.app.FragmentActivity;
24+import android.support.v4.app.FragmentManager;
2225 import android.net.Uri;
2326 import android.os.Build;
2427 import android.os.Bundle;
2528 import android.os.Environment;
26-import android.support.v4.app.DialogFragment;
27-import android.support.v4.app.FragmentActivity;
28-import android.support.v4.app.FragmentManager;
2929 import android.preference.PreferenceManager;
3030 import android.text.Editable;
3131 import android.text.TextWatcher;
32-//import android.util.DisplayMetrics;
3332 import android.util.Log;
34-//import android.view.ContextMenu;
35-//import android.view.ContextMenu.ContextMenuInfo;
3633 import android.view.Gravity;
3734 import android.view.KeyEvent;
38-import android.view.LayoutInflater;
3935 import android.view.Menu;
4036 import android.view.MenuItem;
41-//import android.view.SubMenu;
42-import android.view.WindowManager;
43-import android.view.View.OnKeyListener;
44-import android.view.ViewGroup;
45-//import android.view.WindowManager.LayoutParams;
46-//import android.view.MotionEvent;
4737 import android.view.View;
4838 import android.view.View.OnClickListener;
39+import android.view.View.OnKeyListener;
4940 import android.view.View.OnLongClickListener;
50-//import android.view.View.OnTouchListener;
5141 import android.view.Window;
42+import android.view.WindowManager;
5243 import android.webkit.CookieManager;
44+import android.webkit.MimeTypeMap;
5345 import android.webkit.WebSettings;
5446 import android.webkit.WebView;
5547 import android.webkit.WebViewClient;
56-import android.webkit.MimeTypeMap;
57-//import android.widget.AdapterView.AdapterContextMenuInfo;
5848 import android.widget.Button;
5949 import android.widget.EditText;
6050 import android.widget.TextView;
6151 import android.widget.Toast;
62-import android.graphics.Bitmap;
52+//import android.util.DisplayMetrics;
53+//import android.view.ContextMenu;
54+//import android.view.ContextMenu.ContextMenuInfo;
55+//import android.view.SubMenu;
56+//import android.view.WindowManager.LayoutParams;
57+//import android.view.MotionEvent;
58+//import android.view.View.OnTouchListener;
59+//import android.widget.AdapterView.AdapterContextMenuInfo;
6360
6461 public class UnnetBrowserActivity extends FragmentActivity {
6562 final static String TAG = "UnnetBrowserActivity";
@@ -199,38 +196,56 @@ public class UnnetBrowserActivity extends FragmentActivity {
199196 File cur = new File(url);
200197 Matcher typem = accept.matcher(url);
201198 if (typem.matches()){
202- String cdir = cur.getParent();
203- String cfil = cur.getName();
204- if (cdir == null){
205- cdir = "/";
206- }
207- if (cdir.startsWith("file:")){
208- cdir = cdir.substring(5);
209- }
210- if (dir_s != null && !cdir.equals(dir_s)){
211- dir_prev = dir_s;
212- }
213- dir_s = cdir;
214- if (exDir()){
215- pnom = curIndex(cfil);
216- loadFiles(true, getApplication(), getSupportFragmentManager());
217- }
199+ String cdir = cur.getParent();
200+ String cfil = cur.getName();
201+ if (cdir == null){
202+ cdir = "/";
203+ }
204+ if (cdir.startsWith("file:")){
205+ cdir = cdir.substring(5);
206+ }
207+ if (dir_s != null && !cdir.equals(dir_s)){
208+ dir_prev = dir_s;
209+ }
210+ dir_s = cdir;
211+ if (exDir()){
212+ pnom = curIndex(cfil);
213+ loadFiles(true, getApplication(), getSupportFragmentManager());
214+ } else {
215+ doDefault();
216+ }
218217 } else {
219218 throwIntent(url);
220219 }
221220 } else if (dir_s != ""){
222221 if (exDir()){
223222 loadFiles(true, getApplication(), getSupportFragmentManager());
223+ } else {
224+ doDefault();
224225 }
225226 } else {
226-// webview.loadUrl("file:///android_asset/index.html");
227+ doDefault();
227228 }
228229 }
230+ public void doDefault(){
231+ String where = getLocale();
232+ webview.loadUrl("file:///android_asset/index_"+where+".html");
233+ }
229234 @Override
230235 public void onStart(){
231236 super.onStart();
232237
233238 }
239+ public String getLocale(){
240+ Locale lc = Locale.getDefault();
241+ String ls;
242+ if (lc.equals(Locale.JAPAN)){
243+ ls = "ja";
244+ } else {
245+ ls = "c";
246+ }
247+ return ls;
248+ }
234249 public void toHideActionBar(){
235250 forHoneycomb.hideActionBar(this);
236251 }
@@ -1232,6 +1247,8 @@ public class UnnetBrowserActivity extends FragmentActivity {
12321247 if (exDir()){
12331248 pnom = curIndex(cfil);
12341249 loadFiles(true, getApplication(), getSupportFragmentManager());
1250+ } else {
1251+ doDefault();
12351252 }
12361253 } else {
12371254 dir_s = dir_prev;