• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#objective-cqt誰得cocoawindowspythonphprubygameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwittertestdombtronvb.netdirectxarduinopreviewerゲームエンジン

はてなハイク・キーワードの検索と入力アプリ


Commit MetaInfo

Révision3855fd55642622c4aeeffc3c8924c0568b5b2866 (tree)
l'heure2012-09-07 22:04:11
AuteurKodakana <kodakana@linu...>
CommiterKodakana

Message de Log

項目をタップしたときの動作として「Open」を選択できるようにした。日本語リソースの追加。ハイクのハイクのドメインを選択できるようにした。

Change Summary

Modification

--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1,11 +1,11 @@
11 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
22 package="org.pulpdust.kigo"
33 android:versionCode="1"
4- android:versionName="0.2"
4+ android:versionName="0.3"
55 android:installLocation="auto" >
66
77 <uses-sdk
8- android:minSdkVersion="8"
8+ android:minSdkVersion="4"
99 android:targetSdkVersion="8" />
1010 <uses-permission android:name="android.permission.INTERNET"/>
1111 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
--- a/bin/AndroidManifest.xml
+++ b/bin/AndroidManifest.xml
@@ -1,11 +1,11 @@
11 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
22 package="org.pulpdust.kigo"
33 android:versionCode="1"
4- android:versionName="0.2"
4+ android:versionName="0.3"
55 android:installLocation="auto" >
66
77 <uses-sdk
8- android:minSdkVersion="8"
8+ android:minSdkVersion="4"
99 android:targetSdkVersion="8" />
1010 <uses-permission android:name="android.permission.INTERNET"/>
1111 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
Binary files a/bin/Kigo.apk and b/bin/Kigo.apk differ
Binary files a/bin/classes.dex and b/bin/classes.dex differ
Binary files a/bin/classes/org/pulpdust/kigo/KigoActivity$1.class and b/bin/classes/org/pulpdust/kigo/KigoActivity$1.class differ
Binary files a/bin/classes/org/pulpdust/kigo/KigoActivity$2.class and b/bin/classes/org/pulpdust/kigo/KigoActivity$2.class differ
Binary files a/bin/classes/org/pulpdust/kigo/KigoActivity$3.class and b/bin/classes/org/pulpdust/kigo/KigoActivity$3.class differ
Binary files a/bin/classes/org/pulpdust/kigo/KigoActivity$4.class and b/bin/classes/org/pulpdust/kigo/KigoActivity$4.class differ
Binary files a/bin/classes/org/pulpdust/kigo/KigoActivity$5.class and b/bin/classes/org/pulpdust/kigo/KigoActivity$5.class differ
Binary files a/bin/classes/org/pulpdust/kigo/KigoActivity$6.class and b/bin/classes/org/pulpdust/kigo/KigoActivity$6.class differ
Binary files a/bin/classes/org/pulpdust/kigo/KigoActivity.class and b/bin/classes/org/pulpdust/kigo/KigoActivity.class differ
Binary files a/bin/classes/org/pulpdust/kigo/R$array.class and b/bin/classes/org/pulpdust/kigo/R$array.class differ
Binary files a/bin/classes/org/pulpdust/kigo/R$attr.class and b/bin/classes/org/pulpdust/kigo/R$attr.class differ
Binary files a/bin/classes/org/pulpdust/kigo/R$dimen.class and b/bin/classes/org/pulpdust/kigo/R$dimen.class differ
Binary files a/bin/classes/org/pulpdust/kigo/R$drawable.class and b/bin/classes/org/pulpdust/kigo/R$drawable.class differ
Binary files a/bin/classes/org/pulpdust/kigo/R$id.class and b/bin/classes/org/pulpdust/kigo/R$id.class differ
Binary files a/bin/classes/org/pulpdust/kigo/R$layout.class and b/bin/classes/org/pulpdust/kigo/R$layout.class differ
Binary files a/bin/classes/org/pulpdust/kigo/R$menu.class and b/bin/classes/org/pulpdust/kigo/R$menu.class differ
Binary files a/bin/classes/org/pulpdust/kigo/R$string.class and b/bin/classes/org/pulpdust/kigo/R$string.class differ
Binary files a/bin/classes/org/pulpdust/kigo/R$style.class and b/bin/classes/org/pulpdust/kigo/R$style.class differ
Binary files a/bin/classes/org/pulpdust/kigo/R$xml.class and b/bin/classes/org/pulpdust/kigo/R$xml.class differ
Binary files a/bin/resources.ap_ and b/bin/resources.ap_ differ
--- a/gen/org/pulpdust/kigo/R.java
+++ b/gen/org/pulpdust/kigo/R.java
@@ -11,6 +11,8 @@ public final class R {
1111 public static final class array {
1212 public static final int font_size_labels=0x7f050001;
1313 public static final int font_size_values=0x7f050000;
14+ public static final int host_l=0x7f050005;
15+ public static final int host_v=0x7f050004;
1416 public static final int tap_b_l=0x7f050003;
1517 public static final int tap_b_v=0x7f050002;
1618 }
@@ -49,31 +51,32 @@ public final class R {
4951 }
5052 public static final class string {
5153 public static final int app_name=0x7f070000;
52- public static final int bcc=0x7f07000f;
54+ public static final int bcc=0x7f070010;
5355 public static final int button_find=0x7f070004;
54- public static final int cc=0x7f07000e;
56+ public static final int cc=0x7f07000f;
5557 public static final int err_fail_get=0x7f070007;
5658 public static final int err_no_net=0x7f070006;
5759 public static final int hello_world=0x7f070001;
5860 public static final int hint_word=0x7f070005;
59- public static final int info_entries=0x7f070015;
60- public static final int info_follows=0x7f070016;
61- public static final int info_title=0x7f070017;
62- public static final int info_word=0x7f070018;
63- public static final int menu_copy=0x7f070010;
64- public static final int menu_info=0x7f070012;
65- public static final int menu_open=0x7f070011;
66- public static final int menu_relat=0x7f070013;
67- public static final int menu_send=0x7f070014;
61+ public static final int info_entries=0x7f070016;
62+ public static final int info_follows=0x7f070017;
63+ public static final int info_title=0x7f070018;
64+ public static final int info_word=0x7f070019;
65+ public static final int menu_copy=0x7f070011;
66+ public static final int menu_info=0x7f070013;
67+ public static final int menu_open=0x7f070012;
68+ public static final int menu_relat=0x7f070014;
69+ public static final int menu_send=0x7f070015;
6870 public static final int menu_settings=0x7f070002;
6971 public static final int on_load=0x7f070008;
7072 public static final int pref_cat_app=0x7f070009;
71- public static final int pref_cat_templ=0x7f07000c;
73+ public static final int pref_cat_templ=0x7f07000d;
7274 public static final int pref_font=0x7f07000a;
75+ public static final int pref_host=0x7f07000c;
7376 public static final int pref_tap=0x7f07000b;
74- public static final int relateds=0x7f070019;
77+ public static final int relateds=0x7f07001a;
7578 public static final int title_activity_kigo=0x7f070003;
76- public static final int to=0x7f07000d;
79+ public static final int to=0x7f07000e;
7780 }
7881 public static final class style {
7982 public static final int AppTheme=0x7f080000;
--- a/res/layout/activity_kigo.xml
+++ b/res/layout/activity_kigo.xml
@@ -27,6 +27,7 @@
2727 android:id="@+id/button1"
2828 android:layout_width="wrap_content"
2929 android:layout_height="wrap_content"
30+ android:layout_alignBottom="@+id/editText1"
3031 android:layout_alignParentRight="true"
3132 android:layout_alignParentTop="true"
3233 android:text="@string/button_find" />
--- /dev/null
+++ b/res/values-ja/arrays.xml
@@ -0,0 +1,53 @@
1+<?xml version="1.0" encoding="utf-8"?>
2+<resources>
3+ <string-array name="font_size_values">
4+ <item>6</item>
5+ <item>8</item>
6+ <item>10</item>
7+ <item>12</item>
8+ <item>14</item>
9+ <item>16</item>
10+ <item>18</item>
11+ <item>20</item>
12+ <item>22</item>
13+ <item>24</item>
14+ <item>26</item>
15+ <item>28</item>
16+ <item>30</item>
17+ <item>32</item>
18+ </string-array>
19+ <string-array name="font_size_labels">
20+ <item>6</item>
21+ <item>8</item>
22+ <item>10</item>
23+ <item>12</item>
24+ <item>14</item>
25+ <item>16</item>
26+ <item>18</item>
27+ <item>20</item>
28+ <item>22</item>
29+ <item>24</item>
30+ <item>26</item>
31+ <item>28</item>
32+ <item>30</item>
33+ <item>32</item>
34+ </string-array>
35+ <string-array name="tap_b_v">
36+ <item>0</item>
37+ <item>1</item>
38+ <item>2</item>
39+ </string-array>
40+ <string-array name="tap_b_l">
41+ <item>コピー</item>
42+ <item>送信</item>
43+ <item>開く</item>
44+ </string-array>
45+ <string-array name="host_v">
46+ <item>http://h.hatena.ne.jp/</item>
47+ <item>http://h.hatena.com/</item>
48+ </string-array>
49+ <string-array name="host_l">
50+ <item>日本(.ne.jp)</item>
51+ <item>全世界(.com)</item>
52+ </string-array>
53+</resources>
\ No newline at end of file
--- /dev/null
+++ b/res/values-ja/strings.xml
@@ -0,0 +1,31 @@
1+<resources>
2+
3+ <string name="app_name">Kigo</string>
4+ <string name="hello_world">ほげえええぇぇぇぇぇ</string>
5+ <string name="menu_settings">設定</string>
6+ <string name="title_activity_kigo">Kigo</string>
7+ <string name="button_find">検索</string>
8+ <string name="hint_word">お題を探す</string>
9+ <string name="err_no_net">繋がりません。</string>
10+ <string name="err_fail_get">API から取得できませんでした。</string>
11+ <string name="on_load">読み込み中&#8230;</string>
12+ <string name="pref_cat_app">アプリケーションの設定</string>
13+ <string name="pref_font">文字の大きさ</string>
14+ <string name="pref_tap">叩いたとき</string>
15+ <string name="pref_host">ハイクのホスト</string>
16+ <string name="pref_cat_templ">送信の雛形</string>
17+ <string name="to">To:</string>
18+ <string name="cc">CC:</string>
19+ <string name="bcc">BCC:</string>
20+ <string name="menu_copy">コピー</string>
21+ <string name="menu_open">開く</string>
22+ <string name="menu_info">情報</string>
23+ <string name="menu_relat">関連</string>
24+ <string name="menu_send">送信</string>
25+ <string name="info_entries"><b>投句数</b>: </string>
26+ <string name="info_follows"><b>愛好家</b>: </string>
27+ <string name="info_title"><b>標題</b>: </string>
28+ <string name="info_word"><b>実名</b>: </string>
29+ <string name="relateds">関連キーワード</string>
30+
31+</resources>
\ No newline at end of file
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -35,10 +35,19 @@
3535 <string-array name="tap_b_v">
3636 <item>0</item>
3737 <item>1</item>
38+ <item>2</item>
3839 </string-array>
3940 <string-array name="tap_b_l">
4041 <item>Copy</item>
4142 <item>Send</item>
43+ <item>Open</item>
44+ </string-array>
45+ <string-array name="host_v">
46+ <item>http://h.hatena.ne.jp/</item>
47+ <item>http://h.hatena.com/</item>
48+ </string-array>
49+ <string-array name="host_l">
50+ <item>Japan(.ne.jp)</item>
51+ <item>World Wide(.com)</item>
4252 </string-array>
43-
4453 </resources>
\ No newline at end of file
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -12,6 +12,7 @@
1212 <string name="pref_cat_app">Application Settings</string>
1313 <string name="pref_font">Font Size</string>
1414 <string name="pref_tap">Tap Behavior</string>
15+ <string name="pref_host">Haiku Host</string>
1516 <string name="pref_cat_templ">Send To Template</string>
1617 <string name="to">To:</string>
1718 <string name="cc">CC:</string>
--- a/res/xml/prefs.xml
+++ b/res/xml/prefs.xml
@@ -14,6 +14,12 @@
1414 android:entryValues="@array/font_size_values"
1515 android:dialogTitle="@string/pref_font"
1616 android:defaultValue="16" />
17+ <ListPreference
18+ android:key="host"
19+ android:title="@string/pref_host"
20+ android:entries="@array/host_l"
21+ android:entryValues="@array/host_v"
22+ android:defaultValue="http://h.hatena.ne.jp/" />
1723 </PreferenceCategory>
1824 <PreferenceCategory android:title="@string/pref_cat_templ">
1925 <EditTextPreference
--- a/src/org/pulpdust/kigo/KigoActivity.java
+++ b/src/org/pulpdust/kigo/KigoActivity.java
@@ -63,9 +63,12 @@ public class KigoActivity extends Activity {
6363 CharSequence cptxt;
6464 String host = "http://h.hatena.ne.jp/";
6565 String base = host + "keyword/";
66+ String kpth = "keyword/";
6667 String uri = host +
6768 "api/keywords/list.xml?without_related_keywords=true";
69+ String lpth = "api/keywords/list.xml?without_related_keywords=true";
6870 String iuri = host + "api/keywords/show.xml?word=";
71+ String ipth = "api/keywords/show.xml?word=";
6972 String guri;
7073 String sbj = "";
7174 String obj;
@@ -114,9 +117,7 @@ public class KigoActivity extends Activity {
114117 @Override
115118 public boolean onEditorAction(TextView v, int aid, KeyEvent kev) {
116119 if (aid == EditorInfo.IME_ACTION_SEARCH){
117- sbj = edttxt.getText().toString().trim();
118- guri = uri + "&word=" + sbj;
119- reLoad(guri);
120+ goFind();
120121 }
121122 return true;
122123 }
@@ -127,9 +128,7 @@ public class KigoActivity extends Activity {
127128 public boolean onKey(View v, int kcd, KeyEvent kev) {
128129 if (kev.getAction() == KeyEvent.ACTION_UP &&
129130 kcd == KeyEvent.KEYCODE_ENTER){
130- sbj = edttxt.getText().toString().trim();
131- guri = uri + "&word=" + sbj;
132- reLoad(guri);
131+ goFind();
133132 return true;
134133 }
135134 return false;
@@ -142,9 +141,7 @@ public class KigoActivity extends Activity {
142141 } else {
143142 bttn.setOnClickListener(new OnClickListener(){
144143 public void onClick(View v){
145- sbj = edttxt.getText().toString().trim();
146- guri = uri + "&word=" + sbj;
147- reLoad(guri);
144+ goFind();
148145 }
149146 });
150147 }
@@ -164,6 +161,8 @@ public class KigoActivity extends Activity {
164161 doCopy(((TextView) v).getText());
165162 } else if (tpbhvr == 1){
166163 sendTo(((TextView) v).getText());
164+ } else if (tpbhvr == 2){
165+ doOpen(((TextView) v).getText());
167166 }
168167 }
169168 }
@@ -197,13 +196,24 @@ public class KigoActivity extends Activity {
197196 if (save[2] != null){ bwrd = save[2]; }
198197 } else {
199198 if (rltd == true){
200- guri = iuri + sbj;
199+ guri = host + ipth + sbj;
200+ reLoad(guri);
201201 } else {
202- guri = uri + "&word=" + sbj;
202+// guri = host + lpth + "&word=" + sbj;
203+ goFind();
203204 }
204- reLoad(guri);
205205 }
206206 }
207+ public void goFind(){
208+ sbj = edttxt.getText().toString().trim();
209+ try {
210+ guri = host + lpth + "&word=" + URLEncoder.encode(sbj, "UTF-8").replace("+", "%20");
211+ } catch (UnsupportedEncodingException e) {
212+ // TODO Auto-generated catch block
213+ e.printStackTrace();
214+ }
215+ reLoad(guri);
216+ }
207217 public void doCopy(CharSequence text){
208218 ClipboardManager clipbd = (ClipboardManager)
209219 getSystemService(Context.CLIPBOARD_SERVICE);
@@ -235,6 +245,17 @@ public class KigoActivity extends Activity {
235245 intent.putExtra(Intent.EXTRA_SUBJECT, subject);
236246 startActivity(intent);
237247 }
248+ public void doOpen(CharSequence word){
249+ String openuri;
250+ try {
251+ openuri = host + kpth + URLEncoder.encode(word.toString(), "UTF-8").replace("+", "%20");
252+ Intent openi = new Intent(Intent.ACTION_VIEW, Uri.parse(openuri));
253+ startActivity(openi);
254+ } catch (UnsupportedEncodingException e) {
255+ // TODO Auto-generated catch block
256+ e.printStackTrace();
257+ }
258+ }
238259 @Override
239260 public boolean onContextItemSelected(MenuItem mi){
240261 switch (mi.getItemId()){
@@ -245,15 +266,7 @@ public class KigoActivity extends Activity {
245266 sendTo(cptxt);
246267 return true;
247268 case R.id.menu_open:
248- String openuri;
249- try {
250- openuri = base + URLEncoder.encode(cptxt.toString(), "UTF-8");
251- Intent sendi = new Intent(Intent.ACTION_VIEW, Uri.parse(openuri));
252- startActivity(sendi);
253- } catch (UnsupportedEncodingException e) {
254- // TODO Auto-generated catch block
255- e.printStackTrace();
256- }
269+ doOpen(cptxt);
257270 return true;
258271 case R.id.menu_info:
259272 echoInfo(cptxt.toString());
@@ -278,7 +291,7 @@ public class KigoActivity extends Activity {
278291 buri = guri;
279292 rltd = true;
280293 }
281- guri = iuri + URLEncoder.encode(cptxt.toString(), "UTF-8");
294+ guri = host + ipth + URLEncoder.encode(cptxt.toString(), "UTF-8").replace("+", "%20");
282295 edttxt.setVisibility(View.GONE);
283296 bttn.setVisibility(View.GONE);
284297 setTitle(getString(R.string.app_name) + " - " + getString(R.string.relateds));
@@ -295,7 +308,7 @@ public class KigoActivity extends Activity {
295308 }
296309 public void echoInfo(String word){
297310 try {
298- String turi = iuri + URLEncoder.encode(word.toString(), "UTF-8");
311+ String turi = host + ipth + URLEncoder.encode(word.toString(), "UTF-8").replace("+", "%20");
299312 String xml = getHttp(turi);
300313 if (xml != null){
301314 String info[] = exInfo(xml);
@@ -490,6 +503,7 @@ public class KigoActivity extends Activity {
490503 SharedPreferences sprefs = PreferenceManager.getDefaultSharedPreferences(this);
491504 tpbhvr = Integer.parseInt(sprefs.getString("tap_b", "0"));
492505 fntsz = Integer.parseInt(sprefs.getString("font_size", "16"));
506+ host = sprefs.getString("host", "http://h.hatena.ne.jp/");
493507 send_to[0] = sprefs.getString("send_to", "");
494508 cc[0] = sprefs.getString("cc", "");
495509 bcc[0] = sprefs.getString("bcc", "");