• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#objective-cqtwindows誰得cocoapythonphprubygameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwittertestdomvb.netdirectxbtronarduinopreviewerゲームエンジン

Offline HTML Reader for Android


Commit MetaInfo

Révision7974910048949fa7734b88a8a074164b0e5a723b (tree)
l'heure2012-11-20 20:06:26
AuteurKana Koda <kodakana@user...>
CommiterKana Koda

Message de Log

メモリリークに関する修正。Honeycomb以上でアクションバーを使うように変更。

Change Summary

Modification

Binary files /dev/null and b/.README.kate-swp differ
--- a/.classpath
+++ b/.classpath
@@ -4,5 +4,6 @@
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"/>
78 <classpathentry kind="output" path="bin/classes"/>
89 </classpath>
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1,11 +1,11 @@
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="3"
5- android:versionName="0.72"
4+ android:versionCode="4"
5+ android:versionName="0.8"
66 android:installLocation="auto" >
77
8- <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="8" />
8+ <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="14" />
99 <uses-permission android:name="android.permission.INTERNET"/>
1010
1111 <application
--- a/README
+++ b/README
@@ -54,8 +54,6 @@ Android のバージョンによっては、インストール時にその他の
5454
5555 いろいろ
5656 -------
57- * 本アプリの[メニュー] - [開く]から目的のフォルダを開いたら、ファイルを指定せずに[OK]ボタンを押しても、
58- そのフォルダの中にある HTML ファイルを開くことができます。
5957 * 拡張子 htm、html、xhtml 以外のファイルが指定された場合は、他のアプリを呼び出します。
6058
6159 許諾条件
--- a/README_EN
+++ b/README_EN
@@ -20,6 +20,7 @@ Features & Functions
2020 * You can operate the various functions from the hard keyboard.
2121 * Display a list of HTML files or index file (if it exists) Press and hold the [<(Previous)] button.
2222 * Forward to the History Press and hold the [>(Next)] button.
23+ * Hold the PgUp/PgDn button, you can switch the show or hide the actionbar temporarily.
2324
2425 Keyboard Shortcut
2526 -------------------
@@ -48,11 +49,10 @@ Keyboard Shortcut
4849 Permissions
4950 ------------
5051 This app requires Internet access permissions to read the images of remote.
51-Depending on the version of Android, which may be displayed to allow the permissions other than this during the installation, it is one that is required by the OS for compatibility, Kigo are those permissions are not used.
52+Depending on the version of Android, which may be displayed to allow the permissions other than this during the installation, it is one that is required by the OS for compatibility, Unnet Browser are those permissions are not used.
5253
5354 Tips
5455 -----
55- * Once you have opened the desired folder from the [Menu] - [Open], pressing the [OK] button without specifying a file, you can open the HTML files in that folder.
5656 * If the file extension htm, html, xhtml other than is specified, call other apps.
5757
5858 License
--- a/bin/AndroidManifest.xml
+++ b/bin/AndroidManifest.xml
@@ -1,11 +1,11 @@
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="3"
5- android:versionName="0.72"
4+ android:versionCode="4"
5+ android:versionName="0.8"
66 android:installLocation="auto" >
77
8- <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="8" />
8+ <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="14" />
99 <uses-permission android:name="android.permission.INTERNET"/>
1010
1111 <application
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$drawable.class and b/bin/classes/org/pulpdust/unnetbrowser/R$drawable.class differ
Binary files a/bin/classes/org/pulpdust/unnetbrowser/R$id.class and b/bin/classes/org/pulpdust/unnetbrowser/R$id.class differ
Binary files a/bin/classes/org/pulpdust/unnetbrowser/R$layout.class and b/bin/classes/org/pulpdust/unnetbrowser/R$layout.class 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 /dev/null and b/bin/classes/org/pulpdust/unnetbrowser/UnnetBrowserActivity$IndexDialog$1.class differ
Binary files /dev/null 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 /dev/null and b/bin/classes/org/pulpdust/unnetbrowser/forHoneycomb.class differ
Binary files a/bin/res/drawable-hdpi/ic_launcher.png and b/bin/res/drawable-hdpi/ic_launcher.png differ
Binary files a/bin/res/drawable-ldpi/ic_launcher.png and b/bin/res/drawable-ldpi/ic_launcher.png differ
Binary files a/bin/res/drawable-mdpi/ic_launcher.png and b/bin/res/drawable-mdpi/ic_launcher.png differ
Binary files a/bin/res/drawable-xhdpi/ic_launcher.png and b/bin/res/drawable-xhdpi/ic_launcher.png 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
@@ -17,7 +17,8 @@ public final class R {
1717 public static final class attr {
1818 }
1919 public static final class drawable {
20- public static final int ic_launcher=0x7f020000;
20+ public static final int bg_actionbar=0x7f020000;
21+ public static final int ic_launcher=0x7f020001;
2122 }
2223 public static final class id {
2324 public static final int bt_go_find=0x7f080002;
@@ -39,7 +40,7 @@ public final class R {
3940 public static final int main=0x7f030001;
4041 }
4142 public static final class string {
42- public static final int about=0x7f06003b;
43+ public static final int about=0x7f06003d;
4344 public static final int address=0x7f060005;
4445 public static final int app_author=0x7f060006;
4546 public static final int app_copy=0x7f060008;
@@ -48,14 +49,14 @@ public final class R {
4849 public static final int app_name=0x7f060001;
4950 public static final int app_ver=0x7f060004;
5051 public static final int back=0x7f06001a;
51- public static final int behaviour=0x7f06003a;
52+ public static final int behaviour=0x7f06003c;
5253 public static final int bottom=0x7f06000d;
5354 public static final int buttons=0x7f060015;
5455 public static final int close=0x7f060010;
5556 public static final int copy=0x7f060007;
56- public static final int display=0x7f060039;
57- public static final int err_404=0x7f06003c;
58- public static final int err_500=0x7f06003d;
57+ public static final int display=0x7f06003b;
58+ public static final int err_404=0x7f06003e;
59+ public static final int err_500=0x7f06003f;
5960 public static final int etc=0x7f060011;
6061 public static final int find=0x7f060014;
6162 public static final int first=0x7f060021;
@@ -64,34 +65,37 @@ public final class R {
6465 public static final int go_find=0x7f06001b;
6566 public static final int hello=0x7f060000;
6667 public static final int index=0x7f060013;
67- public static final int info_restart=0x7f06002f;
68+ public static final int info_restart=0x7f060031;
6869 public static final int license=0x7f060009;
69- public static final int loading=0x7f06003e;
70+ public static final int loading=0x7f060040;
7071 public static final int m_next=0x7f060018;
7172 public static final int m_prev=0x7f060017;
7273 public static final int match=0x7f06001c;
7374 public static final int next=0x7f06001e;
7475 public static final int open=0x7f06000b;
76+ public static final int perf_actionbar_desc=0x7f060041;
7577 public static final int pgdn=0x7f060020;
7678 public static final int pgup=0x7f06001f;
79+ public static final int pref_actionbar=0x7f06002c;
80+ public static final int pref_actionbar_desc=0x7f06002d;
7781 public static final int pref_button=0x7f060025;
78- public static final int pref_cache=0x7f060038;
82+ public static final int pref_cache=0x7f06003a;
7983 public static final int pref_font=0x7f060026;
8084 public static final int pref_image=0x7f060028;
81- public static final int pref_restart=0x7f06002d;
82- public static final int pref_restart_desc=0x7f06002e;
85+ public static final int pref_restart=0x7f06002f;
86+ public static final int pref_restart_desc=0x7f060030;
8387 public static final int pref_script=0x7f060027;
8488 public static final int pref_title=0x7f06002b;
85- public static final int pref_title_desc=0x7f06002c;
89+ public static final int pref_title_desc=0x7f06002e;
8690 public static final int pref_titlebar=0x7f060024;
87- public static final int pref_vol=0x7f060030;
88- public static final int pref_vol_def=0x7f060031;
89- public static final int pref_vol_fns=0x7f060035;
90- public static final int pref_vol_fns_v11=0x7f060036;
91- public static final int pref_vol_iof=0x7f060037;
92- public static final int pref_vol_nop=0x7f060033;
93- public static final int pref_vol_scl=0x7f060032;
94- public static final int pref_vol_zoom=0x7f060034;
91+ public static final int pref_vol=0x7f060032;
92+ public static final int pref_vol_def=0x7f060033;
93+ public static final int pref_vol_fns=0x7f060037;
94+ public static final int pref_vol_fns_v11=0x7f060038;
95+ public static final int pref_vol_iof=0x7f060039;
96+ public static final int pref_vol_nop=0x7f060035;
97+ public static final int pref_vol_scl=0x7f060034;
98+ public static final int pref_vol_zoom=0x7f060036;
9599 public static final int pref_wide=0x7f06002a;
96100 public static final int pref_zoom=0x7f060029;
97101 public static final int prefs=0x7f06000f;
Binary files a/res/drawable-hdpi/ic_launcher.png and b/res/drawable-hdpi/ic_launcher.png differ
Binary files a/res/drawable-ldpi/ic_launcher.png and b/res/drawable-ldpi/ic_launcher.png differ
Binary files a/res/drawable-mdpi/ic_launcher.png and b/res/drawable-mdpi/ic_launcher.png differ
Binary files a/res/drawable-xhdpi/ic_launcher.png and b/res/drawable-xhdpi/ic_launcher.png differ
--- /dev/null
+++ b/res/drawable/bg_actionbar.xml
@@ -0,0 +1,4 @@
1+<?xml version="1.0" encoding="utf-8"?>
2+<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
3+ <solid android:color="#BB000000" />
4+</shape>
\ No newline at end of file
--- a/res/values-ja/strings.xml
+++ b/res/values-ja/strings.xml
@@ -5,7 +5,7 @@
55 <string name="app_name">Unnet Browser</string>
66 <string name="app_desc">オフライン HTML リーダ</string>
77 <string name="version">バージョン</string>
8- <string name="app_ver">0.7</string>
8+ <string name="app_ver">0.8</string>
99 <string name="address">連絡先</string>
1010 <string name="app_author">Kodakana&lt;kodakana.hws@gmail.com&gt;</string>
1111 <string name="copy">製作・著作</string>
@@ -45,9 +45,11 @@
4545 <string name="pref_zoom">拡大/縮小操作を使う</string>
4646 <string name="pref_wide">描画領域を拡げる</string>
4747 <string name="pref_title">タイトルバーを隠す</string>
48+ <string name="pref_actionbar">アクションバーを隠す</string>
49+ <string name="perf_actionbar_desc">この設定は画面が再構築されるときに完全に反映されます。</string>
4850 <string name="pref_title_desc">この設定は画面が再構築されるときに反映されます。</string>
4951 <string name="pref_restart">自動的に開き直す</string>
50- <string name="pref_restart_desc">タイトルバーの設定を反映するために自動的に再起動するかどうか。</string>
52+ <string name="pref_restart_desc">設定を反映するために必要な場合に自動的に再起動するかどうか。</string>
5153 <string name="info_restart">設定を反映するために自動的に再起動します。</string>
5254 <string name="pref_vol">音量キー</string>
5355 <string name="pref_vol_def">割り当てなし</string>
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -5,7 +5,7 @@
55 <string name="app_name">Unnet Browser</string>
66 <string name="app_desc">is an offline HTML reader.</string>
77 <string name="version">Version</string>
8- <string name="app_ver">0.7</string>
8+ <string name="app_ver">0.8</string>
99 <string name="address">Address</string>
1010 <string name="app_author">Kodakana &lt;kodakana.hws@gmail.com&gt;</string>
1111 <string name="copy">Copyright</string>
@@ -45,10 +45,12 @@
4545 <string name="pref_zoom">Using zoom controls</string>
4646 <string name="pref_wide">Use wide viewport</string>
4747 <string name="pref_title">Hide the titlebar</string>
48- <string name="pref_title_desc">This setting will take effect when the screen is reconstructed.</string>
48+ <string name="pref_actionbar">Hide the actionbar</string>
49+ <string name="pref_actionbar_desc">This setting will </string>
50+ <string name="pref_title_desc">This setting will take complete effect when the screen is reconstructed.</string>
4951 <string name="pref_restart">Auto restart</string>
50- <string name="pref_restart_desc">Or automatically restarted in take to effect the setting of the title bar.</string>
51- <string name="info_restart">Are automatically restarted in take to effect the setting.</string>
52+ <string name="pref_restart_desc">Whether restart automatically if needed to effect the settings.</string>
53+ <string name="info_restart">automatically restart for take to effect the settings.</string>
5254 <string name="pref_vol">Volume Key</string>
5355 <string name="pref_vol_def">Default</string>
5456 <string name="pref_vol_scl">Page scroll</string>
--- /dev/null
+++ b/res/xml-v11/prefs.xml
@@ -0,0 +1,65 @@
1+<?xml version="1.0" encoding="utf-8"?>
2+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
3+ android:title="@string/pref_titlebar" >
4+ <PreferenceCategory android:title="@string/display">
5+ <ListPreference
6+ android:key="font_size"
7+ android:title="@string/pref_font"
8+ android:entries="@array/font_size_labels"
9+ android:entryValues="@array/font_size_values"
10+ android:dialogTitle="@string/pref_font"
11+ android:defaultValue="16" />
12+ <CheckBoxPreference
13+ android:key="load_remote"
14+ android:title="@string/pref_image" />
15+ <CheckBoxPreference
16+ android:key="hide_title"
17+ android:title="@string/pref_actionbar" />
18+ <CheckBoxPreference
19+ android:key="after_restart"
20+ android:title="@string/pref_restart"
21+ android:summary="@string/pref_restart_desc" />
22+ </PreferenceCategory>
23+ <PreferenceCategory android:title="@string/behaviour">
24+ <ListPreference
25+ android:key="vol_func"
26+ android:title="@string/pref_vol"
27+ android:entries="@array/vol_func_labels"
28+ android:entryValues="@array/vol_func_values"
29+ android:dialogTitle="@string/pref_vol"
30+ android:defaultValue="0" />
31+ <CheckBoxPreference
32+ android:key="show_zoom"
33+ android:title="@string/pref_zoom"
34+ android:defaultValue="true" />
35+ <CheckBoxPreference
36+ android:key="del_cache"
37+ android:title="@string/pref_cache"
38+ android:defaultValue="true" />
39+ <CheckBoxPreference
40+ android:key="en_script"
41+ android:title="@string/pref_script" />
42+<!-- <CheckBoxPreference -->
43+<!-- android:key="wide_view" -->
44+<!-- android:title="@string/pref_wide" /> -->
45+ </PreferenceCategory>
46+ <PreferenceCategory android:title="@string/about">
47+ <Preference
48+ android:selectable="false"
49+ android:title="@string/app_name"
50+ android:summary="@string/app_desc" />
51+ <Preference
52+ android:selectable="false"
53+ android:title="@string/version"
54+ android:summary="@string/app_ver" />
55+ <Preference
56+ android:selectable="false"
57+ android:title="@string/copy"
58+ android:summary="@string/app_copy" />
59+ <Preference
60+ android:selectable="false"
61+ android:title="@string/license"
62+ android:summary="@string/app_lic" />
63+ </PreferenceCategory>
64+
65+</PreferenceScreen>
\ No newline at end of file
--- a/src/org/pulpdust/unnetbrowser/UnnetBrowserActivity.java
+++ b/src/org/pulpdust/unnetbrowser/UnnetBrowserActivity.java
@@ -12,6 +12,7 @@ import java.lang.Math;
1212
1313 import android.app.Activity;
1414 import android.app.AlertDialog;
15+import android.app.Dialog;
1516 import android.content.ActivityNotFoundException;
1617 import android.content.Context;
1718 import android.content.DialogInterface;
@@ -22,6 +23,9 @@ import android.net.Uri;
2223 import android.os.Build;
2324 import android.os.Bundle;
2425 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;
2529 import android.preference.PreferenceManager;
2630 import android.text.Editable;
2731 import android.text.TextWatcher;
@@ -57,60 +61,62 @@ import android.widget.TextView;
5761 import android.widget.Toast;
5862 import android.graphics.Bitmap;
5963
60-public class UnnetBrowserActivity extends Activity {
64+public class UnnetBrowserActivity extends FragmentActivity {
6165 final static String TAG = "UnnetBrowserActivity";
6266 public static final String PREFS = "prefs";
63- WebView webview;
67+ static WebView webview;
6468 TextView textview1;
65- Button button1;
69+ static Button button1;
6670 Button button2;
6771 Button button3;
68- Button button4;
72+ static Button button4;
6973 EditText edittext1;
7074 Button button5;
7175 Uri dir;
72- String dir_s = "";
76+ static String dir_s = "";
7377 String dir_prev;
74- String htmls[];
78+ static String htmls[];
7579 String sort = "asc";
7680 String fsbj = "";
7781 String exts = "^.+\\.x?html?$";
7882 AlertDialog alrt;
7983 EditText findtext;
8084 Button gofind;
81- int newidx = 0;
85+ static int newidx = 0;
8286 int newidx_prev;
83- int pnom = 0;
84- int index_of = -1;
87+ static int pnom = 0;
88+ static int index_of = -1;
8589 int volkey = 0;
8690 int matchs = -1;
8791 int match = 0;
8892 int iscale;
8993 float fscale = -1;
90- boolean after_back_key = false;
94+ static boolean after_back_key = false;
9195 boolean will_load = true;
92- boolean hide_title = false;
96+ static boolean hide_title = false;
97+ boolean hide_title_default;
9398 boolean hide_title_p;
9499 boolean del_cache = true;
95100 boolean mode_find = false;
96101 boolean hide_buttons = false;
97102 boolean full_screen = false;
98- private static final int MENU_0 = 9;
99- private static final int MENU_TOP = 1;
100- private static final int MENU_BTM = 2;
101- private static final int MENU_SRT = 3;
102- private static final int MENU_PRF = 4;
103- private static final int MENU_CLS = 5;
103+ static final int MENU_0 = 9;
104+ static final int MENU_TOP = 1;
105+ static final int MENU_BTM = 2;
106+ static final int MENU_SRT = 3;
107+ static final int MENU_PRF = 4;
108+ static final int MENU_CLS = 5;
104109 // private static final int CTXT_CPY = 6;
105- private static final int MENU_CPY = 7;
106- private static final int MENU_FND = 8;
107- private static final int MENU_BTN = 10;
108- private static final int MENU_FSC = 11;
109- private static final int MENU_NXT = 12;
110- private static final int MENU_PRV = 13;
111- private static final int MENU_IDX = 14;
112- private static final int MENU_FWD = 15;
113- private static final int MENU_BCK = 16;
110+ static final int MENU_CPY = 7;
111+ static final int MENU_FND = 8;
112+ static final int MENU_BTN = 10;
113+ static final int MENU_FSC = 11;
114+ static final int MENU_NXT = 12;
115+ static final int MENU_PRV = 13;
116+ static final int MENU_IDX = 14;
117+ static final int MENU_FWD = 15;
118+ static final int MENU_BCK = 16;
119+ Menu omenu;
114120 // DisplayMetrics dmtrcs;
115121 Pattern accept = Pattern.compile(exts,
116122 Pattern.CASE_INSENSITIVE|Pattern.UNICODE_CASE);
@@ -133,14 +139,10 @@ public class UnnetBrowserActivity extends Activity {
133139 hide_buttons = settings.getBoolean("last_buttons", false);
134140 hide_title_p = hide_title;
135141 full_screen = settings.getBoolean("last_screen", false);
136- Window wndw = getWindow();
137- setTitlebar();
138- requestWindowFeature(Window.FEATURE_LEFT_ICON);
139-// wndw.setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
140142 requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
143+ setTitlebar();
141144 setContentView(R.layout.main);
142- wndw.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.ic_launcher);
143- setWebView();
145+ setWebView(this);
144146 // registerForContextMenu(webview);
145147 button1 = (Button)findViewById(R.id.button1);
146148 button2 = (Button)findViewById(R.id.button2);
@@ -159,6 +161,35 @@ public class UnnetBrowserActivity extends Activity {
159161 if (savedInstanceState != null){
160162 webview.restoreState(savedInstanceState);
161163 }
164+ if (Build.VERSION.SDK_INT >= 11){
165+ button2.setOnLongClickListener(new OnLongClickListener(){
166+ public boolean onLongClick(View v){
167+ if (hide_title){
168+ return false;
169+ } else {
170+ toHideActionBar();
171+ hide_title = true;
172+ if (omenu != null) variMenu(omenu);
173+ toUpdateOptionsMenu();
174+ return true;
175+ }
176+ }
177+ });
178+ button3.setOnLongClickListener(new OnLongClickListener(){
179+ public boolean onLongClick(View v){
180+ if (hide_title){
181+ toShowActionBar();
182+ hide_title = false;
183+ if (omenu != null) variMenu(omenu);
184+ toUpdateOptionsMenu();
185+ return true;
186+ } else {
187+ return false;
188+ }
189+ }
190+ });
191+ }
192+
162193 setFinder();
163194 varView(0);
164195 // webview.setInitialScale(iscale);
@@ -182,19 +213,34 @@ public class UnnetBrowserActivity extends Activity {
182213 dir_s = cdir;
183214 if (exDir()){
184215 pnom = curIndex(cfil);
185- loadFiles(true);
216+ loadFiles(true, getApplication(), getSupportFragmentManager());
186217 }
187218 } else {
188219 throwIntent(url);
189220 }
190221 } else if (dir_s != ""){
191222 if (exDir()){
192- loadFiles(true);
223+ loadFiles(true, getApplication(), getSupportFragmentManager());
193224 }
194225 } else {
195226 // webview.loadUrl("file:///android_asset/index.html");
196227 }
197228 }
229+ @Override
230+ public void onStart(){
231+ super.onStart();
232+
233+ }
234+ public void toHideActionBar(){
235+ forHoneycomb.hideActionBar(this);
236+ }
237+ public void toShowActionBar(){
238+ forHoneycomb.showActionBar(this);
239+// if (omenu != null) forHoneycomb.prepareOptionsMenu(omenu, 0);
240+ }
241+ public void toUpdateOptionsMenu(){
242+ if (Build.VERSION.SDK_INT >= 11) forHoneycomb.updateOptionsMenu(this);
243+ }
198244 public void setFinder(){
199245 textview1 = (TextView) findViewById(R.id.textView1);
200246 textview1.setVisibility(View.GONE);
@@ -239,7 +285,7 @@ public class UnnetBrowserActivity extends Activity {
239285 super.onConfigurationChanged(nc);
240286 // webview.setInitialScale(iscale);
241287 }
242- public void setWebView(){
288+ public void setWebView(final Context c){
243289 webview = (WebView)findViewById(R.id.webview1);
244290 webview.setScrollBarStyle(WebView.SCROLLBARS_INSIDE_OVERLAY);
245291 // int dscale = dmtrcs.widthPixels / 10;
@@ -280,10 +326,10 @@ public class UnnetBrowserActivity extends Activity {
280326 if (!kev.isAltPressed() && htmls != null){
281327 if (index_of > -1){
282328 pnom = index_of;
283- loadFiles(true);
329+ loadFiles(true, c, getSupportFragmentManager());
284330 return true;
285331 } else {
286- echoIndex();
332+ echoIndex(c, getSupportFragmentManager());
287333 return true;
288334 }
289335 } else {
@@ -291,14 +337,14 @@ public class UnnetBrowserActivity extends Activity {
291337 }
292338 case KeyEvent.KEYCODE_N:
293339 if (!kev.isAltPressed()){
294- goNext();
340+ goNext(getApplication());
295341 return true;
296342 } else {
297343 return false;
298344 }
299345 case KeyEvent.KEYCODE_P:
300346 if (!kev.isAltPressed()){
301- goPrev();
347+ goPrev(getApplication());
302348 return true;
303349 } else {
304350 return false;
@@ -378,7 +424,7 @@ public class UnnetBrowserActivity extends Activity {
378424 } else {
379425 pnom = curIndex(cfil);
380426 }
381- loadFiles(true);
427+ loadFiles(true, c, getSupportFragmentManager());
382428 return true;
383429 }
384430 }
@@ -495,9 +541,7 @@ public class UnnetBrowserActivity extends Activity {
495541 // return super.onContextItemSelected(item);
496542 // }
497543 // }
498- @Override
499- public boolean onPrepareOptionsMenu(Menu menu){
500- super.onPrepareOptionsMenu(menu);
544+ public boolean variMenu(Menu menu){
501545 MenuItem prpr0 = (MenuItem) menu.findItem(MENU_PRV);
502546 MenuItem prpr1 = (MenuItem) menu.findItem(MENU_NXT);
503547 MenuItem prpr2 = (MenuItem) menu.findItem(MENU_IDX);
@@ -507,26 +551,39 @@ public class UnnetBrowserActivity extends Activity {
507551 prpr1.setVisible(true);
508552 prpr2.setVisible(false);
509553 prpr3.setVisible(false);
510- return true;
554+ if (Build.VERSION.SDK_INT >= 11 && !hide_title) forHoneycomb.prepareOptionsMenu(menu, 1);
555+ else if (Build.VERSION.SDK_INT >= 11 && hide_title) forHoneycomb.prepareOptionsMenu(menu, 2);
511556 } else if (hide_buttons && volkey == 2){
512557 prpr0.setVisible(false);
513558 prpr1.setVisible(false);
514559 prpr2.setVisible(true);
515560 prpr3.setVisible(true);
516- return true;
561+ if (Build.VERSION.SDK_INT >= 11 && !hide_title) forHoneycomb.prepareOptionsMenu(menu, 0);
562+ else if (Build.VERSION.SDK_INT >= 11 && hide_title) forHoneycomb.prepareOptionsMenu(menu, 2);
517563 } else if (hide_buttons){
518564 prpr0.setVisible(true);
519565 prpr1.setVisible(true);
520566 prpr2.setVisible(true);
521567 prpr3.setVisible(true);
522- return true;
568+ if (Build.VERSION.SDK_INT >= 11 && !hide_title) forHoneycomb.prepareOptionsMenu(menu, 1);
569+ else if (Build.VERSION.SDK_INT >= 11 && hide_title) forHoneycomb.prepareOptionsMenu(menu, 2);
523570 } else {
524571 prpr0.setVisible(false);
525572 prpr1.setVisible(false);
526573 prpr2.setVisible(false);
527574 prpr3.setVisible(false);
528- return true;
575+ if (Build.VERSION.SDK_INT >= 11 && !hide_title) forHoneycomb.prepareOptionsMenu(menu, 0);
576+ else if (Build.VERSION.SDK_INT >= 11 && hide_title) forHoneycomb.prepareOptionsMenu(menu, 2);
529577 }
578+ return true;
579+ }
580+ @Override
581+ public boolean onPrepareOptionsMenu(Menu menu){
582+ super.onPrepareOptionsMenu(menu);
583+// if (Build.VERSION.SDK_INT >= 11){
584+// forHoneycomb.prepareOptionsMenu(menu, 0);
585+// }
586+ return variMenu(menu);
530587 }
531588 @Override
532589 public boolean onCreateOptionsMenu(Menu menu){
@@ -573,13 +630,18 @@ public class UnnetBrowserActivity extends Activity {
573630 }
574631 MenuItem mnitm5 = menu.add(0, MENU_FND, 0, R.string.find);
575632 mnitm5.setAlphabeticShortcut('f');
576- MenuItem mnitm7 = menu.add(0, MENU_FSC, 0, R.string.fullscreen);
577- mnitm7.setAlphabeticShortcut('1');
633+ if (Build.VERSION.SDK_INT <= 10 || Build.VERSION.SDK_INT >= 14){
634+ MenuItem mnitm7 = menu.add(0, MENU_FSC, 0, R.string.fullscreen);
635+ mnitm7.setAlphabeticShortcut('1');
636+ }
578637 MenuItem mnitm6 = menu.add(0, MENU_BTN, 0, R.string.buttons);
579638 mnitm6.setAlphabeticShortcut('b');
580639 MenuItem mnitm8 = menu.add(0, MENU_PRF, 0, R.string.prefs);
581640 // mnitm8.setIcon(android.R.drawable.ic_menu_preferences);
582641 mnitm8.setAlphabeticShortcut('p');
642+ if (Build.VERSION.SDK_INT >= 11){
643+ omenu = menu;
644+ }
583645
584646 return true;
585647 }
@@ -592,13 +654,13 @@ public class UnnetBrowserActivity extends Activity {
592654 case MENU_TOP:
593655 if (dir_s != ""){
594656 pnom = 0;
595- loadFiles(true);
657+ loadFiles(true, getApplication(), getSupportFragmentManager());
596658 }
597659 return true;
598660 case MENU_BTM:
599661 if (dir_s != ""){
600662 pnom = newidx - 1;
601- loadFiles(true);
663+ loadFiles(true, getApplication(), getSupportFragmentManager());
602664 }
603665 return true;
604666 case MENU_SRT:
@@ -606,12 +668,12 @@ public class UnnetBrowserActivity extends Activity {
606668 if (sort.equals("desc")){
607669 ascHtmls();
608670 sort = "asc";
609- loadFiles(true);
671+ loadFiles(true, getApplication(), getSupportFragmentManager());
610672 return true;
611673 } else {
612674 descHtmls();
613675 sort = "desc";
614- loadFiles(true);
676+ loadFiles(true, getApplication(), getSupportFragmentManager());
615677 return true;
616678 }
617679 }
@@ -635,11 +697,11 @@ public class UnnetBrowserActivity extends Activity {
635697 return true;
636698 case MENU_BTN:
637699 if (hide_buttons){
638- showButtons();
639700 hide_buttons = false;
701+ showButtons();
640702 } else {
641- hideButtons();
642703 hide_buttons = true;
704+ hideButtons();
643705 }
644706 return true;
645707 case MENU_FSC:
@@ -652,19 +714,19 @@ public class UnnetBrowserActivity extends Activity {
652714 }
653715 return true;
654716 case MENU_PRV:
655- goPrev();
717+ goPrev(getApplication());
656718 return true;
657719 case MENU_NXT:
658- goNext();
720+ goNext(getApplication());
659721 return true;
660722 case MENU_IDX:
661723 if (htmls != null){
662724 if (index_of > -1){
663725 pnom = index_of;
664- loadFiles(true);
726+ loadFiles(true, getApplication(), getSupportFragmentManager());
665727 return true;
666728 } else {
667- echoIndex();
729+ echoIndex(getApplication(), getSupportFragmentManager());
668730 return true;
669731 }
670732 } else {
@@ -723,7 +785,7 @@ public class UnnetBrowserActivity extends Activity {
723785 webview.pageUp(false);
724786 return true;
725787 } else if (volkey == 2){
726- goPrev();
788+ goPrev(getApplication());
727789 return true;
728790 } else if (volkey == 3){
729791 webview.zoomIn();
@@ -737,10 +799,10 @@ public class UnnetBrowserActivity extends Activity {
737799 if (htmls != null){
738800 if (index_of > -1){
739801 pnom = index_of;
740- loadFiles(true);
802+ loadFiles(true, getApplication(), getSupportFragmentManager());
741803 return true;
742804 } else {
743- echoIndex();
805+ echoIndex(getApplication(), getSupportFragmentManager());
744806 return true;
745807 }
746808 } else {
@@ -754,7 +816,7 @@ public class UnnetBrowserActivity extends Activity {
754816 webview.pageDown(false);
755817 return true;
756818 } else if (volkey == 2){
757- goNext();
819+ goNext(getApplication());
758820 return true;
759821 } else if (volkey == 3){
760822 webview.zoomOut();
@@ -812,37 +874,67 @@ public class UnnetBrowserActivity extends Activity {
812874 }
813875 return super.dispatchKeyEvent(kev);
814876 }
815- public void echoIndex(){
816- AlertDialog.Builder bldr = new AlertDialog.Builder(this);
817- bldr.setTitle(R.string.index);
818- bldr.setItems(htmls, new DialogInterface.OnClickListener() {
819- public void onClick(DialogInterface dialog, int which) {
820- pnom = which;
821- loadFiles(true);
822- }
823- });
824- bldr.show();
825-
877+
878+ public static class IndexDialog extends DialogFragment {
879+ static Context cx;
880+ static FragmentManager fm;
881+ public static IndexDialog newInstance(Context c, String[] items, FragmentManager f){
882+ cx = c;
883+ fm = f;
884+ IndexDialog id = new IndexDialog();
885+ Bundle args = new Bundle();
886+ args.putStringArray("htmls", items);
887+ id.setArguments(args);
888+ return id;
889+ }
890+ public Dialog onCreateDialog(Bundle savedInstaceState){
891+ String[] htmls = getArguments().getStringArray("htmls");
892+ return new AlertDialog.Builder(getActivity())
893+ .setTitle(R.string.index)
894+ .setItems(htmls, new DialogInterface.OnClickListener(){
895+ public void onClick(DialogInterface df, int which){
896+ pnom = which;
897+ loadFiles(true, cx, fm);
898+ }
899+ })
900+ .create();
901+ }
826902 }
827- public void echoFinder(Context cntxt){
828- AlertDialog.Builder adbldr = new AlertDialog.Builder(cntxt);
829- LayoutInflater ifltr = (LayoutInflater) cntxt.getSystemService(LAYOUT_INFLATER_SERVICE);
830- View layout = ifltr.inflate(R.layout.find, (ViewGroup) findViewById(R.id.layout_root));
831- findtext = (EditText) layout.findViewById(R.id.find_sbj);
832- findtext.setText(fsbj);
833- gofind = (Button) layout.findViewById(R.id.bt_go_find);
834- gofind.setOnClickListener(new OnClickListener(){
835- public void onClick(View v){
836- textFind(findtext.getText().toString());
837-// alrt.dismiss();
838- }
839- });
840- adbldr.setTitle(R.string.find);
841- adbldr.setCancelable(true);
842- adbldr.setView(layout);
843- alrt = adbldr.create();
844- alrt.show();
903+ public static void echoIndex(Context c, FragmentManager fm){
904+ DialogFragment dd = IndexDialog.newInstance(c, htmls, fm);
905+ dd.show(fm, "hoge");
845906 }
907+// public void echoIndex(){
908+// AlertDialog.Builder bldr = new AlertDialog.Builder(this);
909+// bldr.setTitle(R.string.index);
910+// bldr.setItems(htmls, new DialogInterface.OnClickListener() {
911+// public void onClick(DialogInterface dialog, int which) {
912+// pnom = which;
913+// loadFiles(true);
914+// }
915+// });
916+// bldr.show();
917+//
918+// }
919+// public void echoFinder(Context cntxt){
920+// AlertDialog.Builder adbldr = new AlertDialog.Builder(cntxt);
921+// LayoutInflater ifltr = (LayoutInflater) cntxt.getSystemService(LAYOUT_INFLATER_SERVICE);
922+// View layout = ifltr.inflate(R.layout.find, (ViewGroup) findViewById(R.id.layout_root));
923+// findtext = (EditText) layout.findViewById(R.id.find_sbj);
924+// findtext.setText(fsbj);
925+// gofind = (Button) layout.findViewById(R.id.bt_go_find);
926+// gofind.setOnClickListener(new OnClickListener(){
927+// public void onClick(View v){
928+// textFind(findtext.getText().toString());
929+//// alrt.dismiss();
930+// }
931+// });
932+// adbldr.setTitle(R.string.find);
933+// adbldr.setCancelable(true);
934+// adbldr.setView(layout);
935+// alrt = adbldr.create();
936+// alrt.show();
937+// }
846938 public void textFind(String subject){
847939 fsbj = subject;
848940 textview1.setVisibility(View.VISIBLE);
@@ -890,12 +982,12 @@ public class UnnetBrowserActivity extends Activity {
890982 public void shiftDown(){
891983 KeyEvent shifton = new KeyEvent(0, 0, KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_SHIFT_LEFT, 0, 0);
892984 shifton.dispatch(webview);
893- Toast.makeText(this, R.string.shift_on, Toast.LENGTH_SHORT).show();
985+ Toast.makeText(getApplication(), R.string.shift_on, Toast.LENGTH_SHORT).show();
894986 }
895987 public void shiftUp(){
896988 KeyEvent shiftoff = new KeyEvent(0, 0, KeyEvent.ACTION_UP, KeyEvent.KEYCODE_SHIFT_LEFT, 0, 0);
897989 shiftoff.dispatch(webview);
898- Toast.makeText(this, R.string.shift_off, Toast.LENGTH_SHORT).show();
990+ Toast.makeText(getApplication(), R.string.shift_off, Toast.LENGTH_SHORT).show();
899991 }
900992 private void pickDirectory(){
901993 // Intent intent = new Intent("org.openintents.action.PICK_DIRECTORY");
@@ -912,7 +1004,7 @@ public class UnnetBrowserActivity extends Activity {
9121004 try {
9131005 startActivityForResult(intent, 1);
9141006 } catch (ActivityNotFoundException e){
915- Toast.makeText(this, R.string.first, Toast.LENGTH_LONG).show();
1007+ Toast.makeText(getApplication(), R.string.first, Toast.LENGTH_LONG).show();
9161008 }
9171009 }
9181010 public boolean exDir(){
@@ -922,7 +1014,7 @@ public class UnnetBrowserActivity extends Activity {
9221014 String files[] = fold.list();
9231015 if (files == null){
9241016 dir_s = dir_prev;
925- Toast.makeText(this, R.string.err_404, Toast.LENGTH_LONG).show();
1017+ Toast.makeText(getApplication(), R.string.err_404, Toast.LENGTH_LONG).show();
9261018 return false;
9271019 }
9281020 // int fcount = files.length;
@@ -944,7 +1036,7 @@ public class UnnetBrowserActivity extends Activity {
9441036 dir_s = dir_prev;
9451037 // exDir();
9461038 will_load = false;
947- Toast.makeText(this, R.string.err_404, Toast.LENGTH_LONG).show();
1039+ Toast.makeText(getApplication(), R.string.err_404, Toast.LENGTH_LONG).show();
9481040 return false;
9491041 }
9501042 index_of = -1;
@@ -1000,7 +1092,7 @@ public class UnnetBrowserActivity extends Activity {
10001092 }
10011093 }
10021094 }
1003- public void loadFiles(boolean load){
1095+ public static void loadFiles(boolean load, final Context c, final FragmentManager fm){
10041096 Log.d(TAG, "loadFiles");
10051097 if (htmls != null){
10061098 if (pnom > newidx){
@@ -1009,42 +1101,27 @@ public class UnnetBrowserActivity extends Activity {
10091101 if (load){
10101102 webview.loadUrl("file://" + dir_s + "/" + htmls[pnom]);
10111103 }
1012- if (hide_title){
1013- echoPos();
1014- }
10151104 // changeTitle();
10161105 button1.setOnClickListener(new OnClickListener(){
10171106 public void onClick(View v){
1018- goPrev();
1107+ goPrev(c);
10191108 }
10201109 });
10211110 button1.setOnLongClickListener(new OnLongClickListener(){
10221111 public boolean onLongClick(View v){
10231112 if (index_of > -1){
10241113 pnom = index_of;
1025- loadFiles(true);
1114+ loadFiles(true, c, fm);
10261115 return true;
10271116 } else {
1028- echoIndex();
1117+ echoIndex(c, fm);
10291118 return true;
10301119 }
10311120 }
10321121 });
1033-// button2.setOnLongClickListener(new OnLongClickListener(){
1034-// public boolean onLongClick(View v){
1035-// shiftDown();
1036-// return true;
1037-// }
1038-// });
1039-// button3.setOnLongClickListener(new OnLongClickListener(){
1040-// public boolean onLongClick(View v){
1041-// shiftUp();
1042-// return true;
1043-// }
1044-// });
10451122 button4.setOnClickListener(new OnClickListener(){
10461123 public void onClick(View v){
1047- goNext();
1124+ goNext(c);
10481125 }
10491126 });
10501127 button4.setOnLongClickListener(new OnLongClickListener(){
@@ -1060,32 +1137,25 @@ public class UnnetBrowserActivity extends Activity {
10601137 });
10611138 }
10621139 }
1063- public void goPrev(){
1140+ public static void goPrev(Context c){
10641141 if (pnom > 0){
10651142 pnom = pnom - 1;
10661143 webview.loadUrl("file://" + dir_s + "/" + htmls[pnom]);
1067- if (hide_title){
1068- echoPos();
1069- }
10701144 // changeTitle();
10711145 }
10721146 }
1073- public void goNext(){
1147+ public static void goNext(Context c){
10741148 if (pnom < newidx-1){
10751149 pnom = pnom + 1;
10761150 webview.loadUrl("file://" + dir_s + "/" + htmls[pnom]);
1077- if (hide_title){
1078- echoPos();
1079- }
10801151 // changeTitle();
10811152 }
10821153 }
1083- public void echoPos(){
1154+ public static void echoPos(Context c){
10841155 int pnom_s = pnom + 1;
10851156 int newidx_s = newidx;
1086- Toast tst = Toast.makeText(this, pnom_s + "/" + newidx_s, Toast.LENGTH_SHORT);
1157+ Toast tst = Toast.makeText(c, pnom_s + "/" + newidx_s, Toast.LENGTH_SHORT);
10871158 tst.setGravity(Gravity.BOTTOM, 0, 0);
1088- tst.cancel();
10891159 tst.show();
10901160 }
10911161 public void changeTitle(){
@@ -1096,8 +1166,17 @@ public class UnnetBrowserActivity extends Activity {
10961166 name = webview.getUrl();
10971167 }
10981168 // String title = pnom_s + "/" + newidx_s + " " + htmls[pnom];
1099- String title = pnom_s + "/" + newidx_s + " " + name + " - " + getString(R.string.app_name);
1100- this.setTitle(title);
1169+ String main = pnom_s + "/" + newidx_s;
1170+ String sub = name;
1171+ String title = main + " " + sub + " - " + getString(R.string.app_name);
1172+ if (Build.VERSION.SDK_INT >= 11){
1173+ forHoneycomb.setTitle(this, main, sub);
1174+ } else {
1175+ this.setTitle(title);
1176+ }
1177+ if (hide_title){
1178+ echoPos(getApplication());
1179+ }
11011180 }
11021181 @Override
11031182 protected void onActivityResult(int requestCode, int resultCode, Intent data){
@@ -1137,7 +1216,7 @@ public class UnnetBrowserActivity extends Activity {
11371216 asis = exDir();
11381217 }
11391218 if (newidx > 0){
1140- loadFiles(will_load);
1219+ loadFiles(will_load, getApplication(), getSupportFragmentManager());
11411220 will_load = true;
11421221 }
11431222 } else if (typem.matches()){
@@ -1152,7 +1231,7 @@ public class UnnetBrowserActivity extends Activity {
11521231 dir_s = cdir;
11531232 if (exDir()){
11541233 pnom = curIndex(cfil);
1155- loadFiles(true);
1234+ loadFiles(true, getApplication(), getSupportFragmentManager());
11561235 }
11571236 } else {
11581237 dir_s = dir_prev;
@@ -1184,7 +1263,7 @@ public class UnnetBrowserActivity extends Activity {
11841263 try{
11851264 startActivity(intnt);
11861265 } catch (ActivityNotFoundException e){
1187- Toast.makeText(this, R.string.err_500, Toast.LENGTH_LONG).show();
1266+ Toast.makeText(getApplication(), R.string.err_500, Toast.LENGTH_LONG).show();
11881267 }
11891268
11901269 }
@@ -1192,21 +1271,24 @@ public class UnnetBrowserActivity extends Activity {
11921271 SharedPreferences shrdprfs = PreferenceManager.getDefaultSharedPreferences(this);
11931272 // hide_buttons = shrdprfs.getBoolean("hide_buttons", false);
11941273 if (mode == 0){
1195- if (hide_buttons){
1196- hideButtons();
1197- } else if(!hide_buttons) {
1198- showButtons();
1199- }
1200- if (mode_find){
1201- showFinder();
1202- } else {
1203- hideFinder();
1204- }
1205- if (full_screen){
1206- getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
1207- } else {
1208- getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
1209- }
1274+ if (Build.VERSION.SDK_INT >= 11 && hide_title){
1275+ hide_buttons = false;
1276+ showButtons();
1277+ } else if (hide_buttons){
1278+ hideButtons();
1279+ } else if(!hide_buttons) {
1280+ showButtons();
1281+ }
1282+ if (mode_find){
1283+ showFinder();
1284+ } else {
1285+ hideFinder();
1286+ }
1287+ if (full_screen){
1288+ getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
1289+ } else {
1290+ getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
1291+ }
12101292 }
12111293 WebSettings wbsttngs = webview.getSettings();
12121294 wbsttngs.setSaveFormData(false);
@@ -1223,24 +1305,45 @@ public class UnnetBrowserActivity extends Activity {
12231305 del_cache = shrdprfs.getBoolean("del_cache", true);
12241306 if (mode == 1){
12251307 hide_title = shrdprfs.getBoolean("hide_title", false);
1226- if (hide_title != hide_title_p && shrdprfs.getBoolean("after_restart", false)){
1227- Toast.makeText(this, R.string.info_restart, Toast.LENGTH_SHORT).show();
1228- restartActivity();
1229- }
1308+ if (hide_title != hide_title_default && Build.VERSION.SDK_INT >= 11){
1309+ if (hide_title){
1310+ forHoneycomb.hideActionBar(this);
1311+ hide_buttons = false;
1312+ showButtons();
1313+ toUpdateOptionsMenu();
1314+ }
1315+ else if (!hide_title) forHoneycomb.showActionBar(this);
1316+ }
1317+ if (hide_title != hide_title_default && shrdprfs.getBoolean("after_restart", false)){
1318+ Toast.makeText(getApplication(), R.string.info_restart, Toast.LENGTH_SHORT).show();
1319+ restartActivity();
1320+ }
12301321 }
12311322
12321323 }
12331324 public void setTitlebar(){
12341325 SharedPreferences shrdprfs = PreferenceManager.getDefaultSharedPreferences(this);
12351326 hide_title = shrdprfs.getBoolean("hide_title", false);
1236- if (hide_title){
1237- requestWindowFeature(Window.FEATURE_NO_TITLE);
1238- }
1239-
1327+ hide_title_default = hide_title;
1328+ if (Build.VERSION.SDK_INT >= 11){
1329+ if (hide_title){
1330+ getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
1331+ }
1332+ forHoneycomb.setActionBarBackground(this, R.drawable.bg_actionbar);
1333+ forHoneycomb.setActionBar(this, hide_title);
1334+ } else {
1335+ if (hide_title){
1336+ requestWindowFeature(Window.FEATURE_NO_TITLE);
1337+ }
1338+ Window wndw = getWindow();
1339+// wndw.setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
1340+ requestWindowFeature(Window.FEATURE_LEFT_ICON);
1341+ wndw.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.ic_launcher);
1342+ }
12401343 }
12411344 public void restartActivity(){
12421345 Intent intent = getIntent();
1243- intent.setClass(this, this.getClass());
1346+ intent.setClass(getApplication(), this.getClass());
12441347 finish();
12451348 this.startActivity(intent);
12461349 }
@@ -1248,13 +1351,21 @@ public class UnnetBrowserActivity extends Activity {
12481351 button1.setVisibility(View.VISIBLE);
12491352 button2.setVisibility(View.VISIBLE);
12501353 button3.setVisibility(View.VISIBLE);
1251- button4.setVisibility(View.VISIBLE);
1354+ button4.setVisibility(View.VISIBLE);
1355+ if (Build.VERSION.SDK_INT >= 11 && omenu != null){
1356+ variMenu(omenu);
1357+ toUpdateOptionsMenu();
1358+ }
12521359 }
12531360 public void hideButtons(){
12541361 button1.setVisibility(View.GONE);
12551362 button2.setVisibility(View.GONE);
12561363 button3.setVisibility(View.GONE);
12571364 button4.setVisibility(View.GONE);
1365+ if (Build.VERSION.SDK_INT >= 11 && omenu != null){
1366+ variMenu(omenu);
1367+ toUpdateOptionsMenu();
1368+ }
12581369 }
12591370 public void showFinder(){
12601371 edittext1.setVisibility(View.VISIBLE);
--- /dev/null
+++ b/src/org/pulpdust/unnetbrowser/forHoneycomb.java
@@ -0,0 +1,62 @@
1+package org.pulpdust.unnetbrowser;
2+
3+import android.annotation.TargetApi;
4+import android.app.ActionBar;
5+import android.app.Activity;
6+import android.view.Menu;
7+import android.view.MenuItem;
8+
9+@TargetApi(11)
10+public class forHoneycomb {
11+ public static void setActionBar(Activity av, boolean hide){
12+ ActionBar ab = av.getActionBar();
13+ if (hide){
14+ ab.hide();
15+ } else {
16+ ab.show();
17+ }
18+ }
19+ public static void setActionBarBackground(Activity av, int resource){
20+ ActionBar ab = av.getActionBar();
21+ ab.setBackgroundDrawable(av.getResources().getDrawable(resource));
22+ }
23+ public static void showActionBar(Activity av){
24+ ActionBar ab = av.getActionBar();
25+ ab.show();
26+ }
27+ public static void hideActionBar(Activity av){
28+ ActionBar ab = av.getActionBar();
29+ ab.hide();
30+ }
31+ public static void setTitle(Activity av, CharSequence title, CharSequence subtitle){
32+ ActionBar ab = av.getActionBar();
33+ ab.setTitle(title);
34+ ab.setSubtitle(subtitle);
35+ }
36+ public static void prepareOptionsMenu(Menu m, int variation){
37+ MenuItem mip = (MenuItem) m.findItem(UnnetBrowserActivity.MENU_PRV);
38+ MenuItem min = (MenuItem) m.findItem(UnnetBrowserActivity.MENU_NXT);
39+ MenuItem mit = (MenuItem) m.findItem(UnnetBrowserActivity.MENU_TOP);
40+ MenuItem mib = (MenuItem) m.findItem(UnnetBrowserActivity.MENU_BTM);
41+ if (variation == 0){
42+ mip.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
43+ min.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
44+ mit.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
45+ mib.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
46+ } else if (variation == 1){
47+ mip.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
48+ min.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
49+ mit.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
50+ mib.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
51+ } else if (variation == 2){
52+ mip.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
53+ min.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
54+ mit.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
55+ mib.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
56+ }
57+ }
58+ public static void updateOptionsMenu(Activity av){
59+ av.invalidateOptionsMenu();
60+ }
61+
62+}