• R/O
  • SSH
  • HTTPS

mokeline: 提交


Commit MetaInfo

修订版22 (tree)
时间2012-01-10 01:59:26
作者coppercele

Log Message

アプリがバックグラウンドに回っても接続が切れないようにした。
戻るボタン2回でアプリを終了させるようにした。

更改概述

差异

--- mokelinesrc/MokeLine/AndroidManifest.xml (revision 21)
+++ mokelinesrc/MokeLine/AndroidManifest.xml (revision 22)
@@ -1,7 +1,7 @@
11 <?xml version="1.0" encoding="utf-8"?>
22 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
33 package="jp.moke"
4- android:versionName="@string/version" android:versionCode="13">
4+ android:versionName="@string/version" android:versionCode="14">
55 <uses-permission android:name="android.permission.INTERNET"></uses-permission>
66 <uses-sdk android:minSdkVersion="7"/>
77 <application android:icon="@drawable/icon" android:label="@string/app_name">
--- mokelinesrc/MokeLine/src/jp/moke/PharerougeMakaizouActivity.java (revision 21)
+++ mokelinesrc/MokeLine/src/jp/moke/PharerougeMakaizouActivity.java (revision 22)
@@ -163,10 +163,10 @@
163163
164164 private void close() {
165165
166- SharedPreferences preferences = PreferenceManager
167- .getDefaultSharedPreferences(this);
168- System.out.println(preferences.getBoolean(getString(R.string.pref_endurance), false));
169- if (!preferences.getBoolean(getString(R.string.pref_endurance), false)) {
166+// SharedPreferences preferences = PreferenceManager
167+// .getDefaultSharedPreferences(this);
168+// System.out.println(preferences.getBoolean(getString(R.string.pref_endurance), false));
169+// if (!preferences.getBoolean(getString(R.string.pref_endurance), false)) {
170170
171171 if (hlfacade != null) {
172172
@@ -185,7 +185,7 @@
185185 userlist = null;
186186 }
187187 findViewById(R.id.imageView1).setVisibility(View.INVISIBLE);
188- }
188+// }
189189
190190 }
191191
@@ -285,11 +285,13 @@
285285 }
286286
287287 private void openPref() {
288+ this.close();
288289 Intent intent = new Intent(this, ServerPrefActivity.class);
289290 startActivity(intent);
290291 }
291292
292293 private void openBookmarkPref() {
294+ this.close();
293295 Intent intent = new Intent(this, BookmarkPrefActivity.class);
294296 startActivity(intent);
295297 }
@@ -348,12 +350,12 @@
348350 handler.sleep(0);
349351 }
350352
351- protected void onStop() {
352- super.onStop();
353- if (this.hlfacade != null) {
354-
355- this.close();
356- }
353+ protected void onPausep() {
354+ super.onPause();
355+// if (this.hlfacade != null) {
356+//
357+// this.close();
358+// }
357359 // 再描画を終了する
358360 handler = null;
359361 }
@@ -396,5 +398,36 @@
396398 }
397399 }
398400 }
401+ @Override
402+ protected void onDestroy() {
403+ this.close();
404+ super.onDestroy();
405+ }
399406
407+ boolean exitflag = false;
408+
409+ @Override
410+ public void onBackPressed() {
411+ if (exitflag) {
412+ this.close();
413+ super.onBackPressed();
414+ this.finish();
415+ }
416+ else {
417+ displayToast(getString(R.string.message_confirm_exit));
418+ }
419+ new Thread() {
420+ public void run() {
421+ try {
422+ exitflag = true;
423+ sleep(5000);
424+ exitflag = false;
425+
426+ } catch (InterruptedException e) {
427+ e.printStackTrace();
428+ }
429+ }
430+ }.start();
431+
432+ }
400433 }
\ No newline at end of file
--- mokelinesrc/MokeLine/res/values/strings.xml (revision 21)
+++ mokelinesrc/MokeLine/res/values/strings.xml (revision 22)
@@ -1,7 +1,7 @@
11 <?xml version="1.0" encoding="utf-8"?>
22 <resources>
33 <string name="app_name">MokeLine</string>
4- <string name="version">20111230</string>
4+ <string name="version">20120110</string>
55 <string name="error_communication">通信エラーが発生しました</string>
66 <string name="error_pref_invalid">設定の入力が不正です</string>
77 <string name="error_server_notfound">サーバが見つかりません</string>
@@ -21,7 +21,9 @@
2121 <string name="pref_pass">pass</string>
2222 <string name="pref_nick">nick</string>
2323 <string name="pref_fontsize">fontsize</string>
24+<!--
2425 <string name="pref_endurance">endurance_mode</string>
26+ -->
2527
2628 <string name="pref_preferenceNum">preferenceNum</string>
2729
@@ -40,6 +42,7 @@
4042 <string name="message_bookmark_added">を追加しました</string>
4143 <string name="message_bookmark_deleteed">を削除しました</string>
4244 <string name="message_bookmark_loaded">を読み込みました</string>
45+ <string name="message_confirm_exit">もう一度戻るボタンを押すと終了します。</string>
4346
4447 <string name="menu_connect">接続</string>
4548 <string name="menu_disconnect">切断</string>
@@ -61,8 +64,10 @@
6164 <string name="menu_bookmark_add">追加</string>
6265 <string name="menu_bookmark_add_title">現在の設定に名前を付けて保存します</string>
6366 <string name="menu_bookmark_delete">削除</string>
67+ <!--
6468 <string name="endurance_mode_title">接続維持モード(Beta)</string>
6569 <string name="endurance_mode_summary">アプリをバックグラウンドにした程度では切れなくなります。\n手動で切断してください。</string>
70+ -->
6671
6772 <string-array name="list_fontsize">
6873 <item>大</item>
--- mokelinesrc/MokeLine/res/values-en/strings.xml (revision 21)
+++ mokelinesrc/MokeLine/res/values-en/strings.xml (revision 22)
@@ -1,7 +1,7 @@
11 <?xml version="1.0" encoding="utf-8"?>
22 <resources>
33 <string name="app_name">MokeLine</string>
4- <string name="version">20111230</string>
4+ <string name="version">20120110</string>
55 <string name="error_communication">Communication error occurred</string>
66 <string name="error_pref_invalid">Invalid configuration</string>
77 <string name="error_server_notfound">Server not found</string>
@@ -39,6 +39,7 @@
3939 <string name="message_bookmark_added">\u0020was added</string>
4040 <string name="message_bookmark_deleted">\u0020was deleted</string>
4141 <string name="message_bookmark_loaded">\u0020Loaded</string>
42+ <string name="message_confirm_exit">Press back key again to exit.</string>
4243
4344 <string name="menu_connect">Connect</string>
4445 <string name="menu_disconnect">Disconnect</string>
@@ -60,9 +61,10 @@
6061 <string name="menu_bookmark_add">New</string>
6162 <string name="menu_bookmark_add_title">Save as... </string>
6263 <string name="menu_bookmark_delete">Delete</string>
64+ <!--
6365 <string name="endurance_mode_title">EnduranceMode(Beta)</string>
6466 <string name="endurance_mode_summary">Auto disconnetct disabled.\nPlease disconnect by yourself.</string>
65-
67+ -->
6668
6769 <string-array name="list_fontsize">
6870 <item>Large</item>
--- mokelinesrc/MokeLine/res/xml/serverpref.xml (revision 21)
+++ mokelinesrc/MokeLine/res/xml/serverpref.xml (revision 22)
@@ -7,6 +7,8 @@
77 <EditTextPreference android:title="@string/menu_server_nick" android:key="nick"></EditTextPreference>
88 <ListPreference android:entries="@array/list_orientation" android:title="@string/menu_server_orientation" android:entryValues="@array/list_orientationvalues" android:key="orientation" android:dialogTitle="@string/menu_server_orientation_title"></ListPreference>
99 <ListPreference android:entryValues="@array/list_entryvalues" android:key="fontsize" android:entries="@array/list_fontsize" android:title="@string/menu_server_fontsize" android:dialogTitle="@string/menu_server_fontsize_title" android:selectable="true" android:enabled="true"></ListPreference>
10+<!--
1011 <CheckBoxPreference android:key="endurance_mode" android:title="@string/endurance_mode_title" android:summary="@string/endurance_mode_summary" />
12+ -->
1113
1214 </PreferenceScreen>
Show on old repository browser