• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

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

Simple Notepad Application for Android OS


Commit MetaInfo

Révision266cf5d2003a2b36db4930ce1bc600770eadd87f (tree)
l'heure2013-06-26 17:14:50
AuteurMasahiko, SAWAI <say@user...>
CommiterMasahiko, SAWAI

Message de Log

notepad-app-level11 にテキスト受信機能の有効無効の設定を実装

Change Summary

Modification

--- a/notepad-app-level-11/res/values-ja/strings_preferences.xml
+++ b/notepad-app-level-11/res/values-ja/strings_preferences.xml
@@ -52,16 +52,24 @@
5252 <string name="note_list_sort_order_entry_date_added_desc" >作成日時の降順</string>
5353 -->
5454
55- <!-- AutoLink Category -->
55+ <!-- Auto Link Category -->
5656 <string name="note_autolink_category_title">自動リンク</string>
57- <!-- AutoLink : Note Title -->
57+ <!-- Auto Link : Note Title -->
5858 <string name="note_title_autolink_title">タイトル内の自動リンク</string>
59- <string name="note_title_autolink_summary_on">ノートのタイトル内のURLやメールアドレスは自動的にリンクされます。</string>
60- <string name="note_title_autolink_summary_off">ノートのタイトル内のURLやメールアドレスはリンクされません。</string>
61- <!-- AutoLink : Note Content -->
59+ <string name="note_title_autolink_summary_on">ノートのタイトル内のURLやメールアドレスを自動的にリンクにします。</string>
60+ <string name="note_title_autolink_summary_off">ノートのタイトル内のURLやメールアドレスをリンクにしません。</string>
61+ <!-- Auto Link : Note Content -->
6262 <string name="note_content_autolink_title">本文内の自動リンク</string>
63- <string name="note_content_autolink_summary_on">ノートの本文内のURLやメールアドレスは自動的にリンクされます。</string>
64- <string name="note_content_autolink_summary_off">ノートの本文内のURLやメールアドレスはリンクされません。</string>
63+ <string name="note_content_autolink_summary_on">ノートの本文内のURLやメールアドレスを自動的にリンクにします。</string>
64+ <string name="note_content_autolink_summary_off">ノートの本文内のURLやメールアドレスをリンクにしません。</string>
65+
66+ <!-- Share Data Category -->
67+ <string name="share_data_category_title">データ共有</string>
68+ <!-- Receive Text -->
69+ <string name="receive_text_category_title">テキストの受け取り</string>
70+ <string name="receive_text_title">テキストの受け取り</string>
71+ <string name="receive_text_summary_on">テキストデータを受け取って新規ノートとして追加できます。</string>
72+ <string name="receive_text_summary_off">テキストデータの受け取り機能は無効です。</string>
6573
6674 <!-- Backup and Restore Category -->
6775 <string name="backup_and_restore">バックアップと復元</string>
--- a/notepad-app-level-11/res/values/preference.xml
+++ b/notepad-app-level-11/res/values/preference.xml
@@ -85,10 +85,17 @@
8585 -->
8686 </string-array>
8787
88- <!-- note viewer auto link -->
88+ <!-- Auto Link Category -->
89+ <!-- Auto Link : Note Title -->
8990 <string name="note_title_autolink_key" >note_title_autolink</string>
9091 <bool name="note_title_autolink_default_value" >false</bool>
92+ <!-- Auto Link : Note Content -->
9193 <string name="note_content_autolink_key" >note_content_autolink</string>
9294 <bool name="note_content_autolink_default_value" >true</bool>
9395
96+ <!-- Share Data Category -->
97+ <!-- Share Data : Receive Text -->
98+ <string name="receive_text_key" >receive_text</string>
99+ <bool name="receive_text_default_value" >true</bool>
100+
94101 </resources>
--- a/notepad-app-level-11/res/values/strings_preference.xml
+++ b/notepad-app-level-11/res/values/strings_preference.xml
@@ -52,19 +52,26 @@
5252 <string name="note_list_sort_order_entry_date_added_desc" >created descending</string>
5353 -->
5454
55- <!-- AutoLink Category -->
55+ <!-- Auto Link Category -->
5656 <string name="note_autolink_category_title">Auto Link</string>
57- <!-- AutoLink : Note Title -->
57+ <!-- Auto Link : Note Title -->
5858 <string name="note_title_autolink_title">Auto Link in Title</string>
5959 <string name="note_title_autolink_summary_on">The URL and the E-mail in the title are linked automatically.</string>
6060 <string name="note_title_autolink_summary_off">The URL and the E-mail in the title are not linked.</string>
61- <!-- AutoLink : Note Content -->
61+ <!-- Auto Link : Note Content -->
6262 <string name="note_content_autolink_title">Auto Link in Text</string>
6363 <string name="note_content_autolink_summary_on">The URL and the E-mail in the text are linked automatically.</string>
6464 <string name="note_content_autolink_summary_off">The URL and the E-mail in the text are not linked.</string>
6565
66+ <!-- Share Data Category -->
67+ <string name="share_data_category_title">Share Data</string>
68+ <!-- Receive Text -->
69+ <string name="receive_text_title">Receive Text</string>
70+ <string name="receive_text_summary_on">The text intent receiving is enabled.</string>
71+ <string name="receive_text_summary_off">The text intent receiving is disabled.</string>
72+
6673 <!-- Backup and Restore Category -->
67- <string name="backup_and_restore">Backup &amp; Restore</string>
74+ <string name="backup_and_restore">Back up &amp; Restore</string>
6875 <!-- Backup Data -->
6976 <string name="backup_data">Backup Data</string>
7077 <string name="backup_data_title">Backup Data</string>
--- a/notepad-app-level-11/res/xml/notepad_preference.xml
+++ b/notepad-app-level-11/res/xml/notepad_preference.xml
@@ -109,6 +109,16 @@
109109 />
110110 </PreferenceCategory>
111111
112+ <PreferenceCategory android:title="@string/share_data_category_title" >
113+ <CheckBoxPreference
114+ android:key="@string/receive_text_key"
115+ android:defaultValue="@bool/receive_text_default_value"
116+ android:title="@string/receive_text_title"
117+ android:summaryOn="@string/receive_text_summary_on"
118+ android:summaryOff="@string/receive_text_summary_off"
119+ />
120+ </PreferenceCategory>
121+
112122 <PreferenceCategory android:title="@string/backup_and_restore" >
113123 <PreferenceScreen
114124 android:title="@string/backup_data_title"
--- a/notepad-app-level-11/src/org/routine_work/notepad/prefs/NotepadPreferenceActivity.java
+++ b/notepad-app-level-11/src/org/routine_work/notepad/prefs/NotepadPreferenceActivity.java
@@ -23,7 +23,9 @@
2323 */
2424 package org.routine_work.notepad.prefs;
2525
26+import android.content.ComponentName;
2627 import android.content.SharedPreferences;
28+import android.content.pm.PackageManager;
2729 import android.os.Bundle;
2830 import android.preference.ListPreference;
2931 import android.preference.PreferenceActivity;
@@ -32,6 +34,7 @@ import android.view.MenuInflater;
3234 import android.view.MenuItem;
3335 import org.routine_work.notepad.NotepadActivity;
3436 import org.routine_work.notepad.R;
37+import org.routine_work.notepad.ReceiveTextActivity;
3538 import org.routine_work.utils.Log;
3639
3740 /**
@@ -106,7 +109,33 @@ public class NotepadPreferenceActivity extends PreferenceActivity
106109 Log.v(LOG_TAG, "Hello");
107110 Log.i(LOG_TAG, "shared preference " + key + " is changed.");
108111
109- updateSummary();
112+ String receiveTextKey = getString(R.string.receive_text_key);
113+ if (key.equals(receiveTextKey))
114+ {
115+ // update component enable/disable
116+ boolean defaultValue = getResources().getBoolean(R.bool.receive_text_default_value);
117+ boolean receiveTextEnabled = prefs.getBoolean(key, defaultValue);
118+ int newState;
119+
120+ if (receiveTextEnabled)
121+ {
122+ newState = PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
123+ Log.d(LOG_TAG, "Enable ReceiveTextActivity component");
124+ }
125+ else
126+ {
127+ newState = PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
128+ Log.d(LOG_TAG, "Disable ReceiveTextActivity component");
129+ }
130+
131+ PackageManager packageManager = getPackageManager();
132+ ComponentName componentName = new ComponentName(this, ReceiveTextActivity.class);
133+ packageManager.setComponentEnabledSetting(componentName, newState, PackageManager.DONT_KILL_APP); // dont stop
134+ }
135+ else
136+ {
137+ updateSummary();
138+ }
110139
111140 Log.v(LOG_TAG, "Bye");
112141 }
--- a/notepad-app/src/org/routine_work/notepad/prefs/NotepadPreferenceActivity.java
+++ b/notepad-app/src/org/routine_work/notepad/prefs/NotepadPreferenceActivity.java
@@ -120,12 +120,12 @@ public class NotepadPreferenceActivity extends PreferenceActivity
120120 if (receiveTextEnabled)
121121 {
122122 newState = PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
123- Log.d(LOG_TAG, "Update ReceiveTextActivity component : PackageManager.COMPONENT_ENABLED_STATE_ENABLED");
123+ Log.d(LOG_TAG, "Enable ReceiveTextActivity component");
124124 }
125125 else
126126 {
127127 newState = PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
128- Log.d(LOG_TAG, "Update ReceiveTextActivity component : PackageManager.COMPONENT_ENABLED_STATE_DISABLED");
128+ Log.d(LOG_TAG, "Disable ReceiveTextActivity component");
129129 }
130130
131131 PackageManager packageManager = getPackageManager();