• 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

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


Commit MetaInfo

Revisionffd83955cf64b0fd61952f169678ec05d22f644d (tree)
Zeit2012-10-09 20:07:43
AutorKodakana <kodakana@linu...>
CommiterKodakana

Log Message

targetSdkVersion を14に変更。Honeycomb で Holo、ICS 以降で DeviceDefault テーマが使用されるように指定。Http Get 処理をスレッド化。

Ändern Zusammenfassung

Diff

--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1,18 +1,19 @@
11 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
22 package="org.pulpdust.kigo"
3- android:versionCode="1"
4- android:versionName="0.4"
3+ android:versionCode="2"
4+ android:versionName="0.5"
55 android:installLocation="auto" >
66
77 <uses-sdk
88 android:minSdkVersion="4"
9- android:targetSdkVersion="8" />
9+ android:targetSdkVersion="14" />
1010 <uses-permission android:name="android.permission.INTERNET"/>
1111 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
1212
1313 <application
1414 android:icon="@drawable/ic_launcher"
15- android:label="@string/app_name">
15+ android:label="@string/app_name"
16+ android:theme="@style/AppTheme">
1617 <activity
1718 android:name=".KigoActivity"
1819 android:label="@string/title_activity_kigo"
--- a/bin/AndroidManifest.xml
+++ b/bin/AndroidManifest.xml
@@ -1,18 +1,19 @@
11 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
22 package="org.pulpdust.kigo"
3- android:versionCode="1"
4- android:versionName="0.4"
3+ android:versionCode="2"
4+ android:versionName="0.5"
55 android:installLocation="auto" >
66
77 <uses-sdk
88 android:minSdkVersion="4"
9- android:targetSdkVersion="8" />
9+ android:targetSdkVersion="14" />
1010 <uses-permission android:name="android.permission.INTERNET"/>
1111 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
1212
1313 <application
1414 android:icon="@drawable/ic_launcher"
15- android:label="@string/app_name">
15+ android:label="@string/app_name"
16+ android:theme="@style/AppTheme">
1617 <activity
1718 android:name=".KigoActivity"
1819 android:label="@string/title_activity_kigo"
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 /dev/null and b/bin/classes/org/pulpdust/kigo/KigoActivity$7$1.class differ
Binary files /dev/null and b/bin/classes/org/pulpdust/kigo/KigoActivity$7.class differ
Binary files /dev/null and b/bin/classes/org/pulpdust/kigo/KigoActivity$8$1.class differ
Binary files /dev/null and b/bin/classes/org/pulpdust/kigo/KigoActivity$8.class differ
Binary files a/bin/classes/org/pulpdust/kigo/KigoActivity.class and b/bin/classes/org/pulpdust/kigo/KigoActivity.class differ
--- /dev/null
+++ b/bin/jarlist.cache
@@ -0,0 +1,3 @@
1+# cache for current jar dependecy. DO NOT EDIT.
2+# format is <lastModified> <length> <SHA-1> <path>
3+# Encoding is UTF-8
Binary files a/bin/resources.ap_ and b/bin/resources.ap_ differ
--- a/project.properties
+++ b/project.properties
@@ -11,4 +11,4 @@
1111 #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
1212
1313 # Project target.
14-target=android-8
14+target=android-14
--- /dev/null
+++ b/res/.directory
@@ -0,0 +1,3 @@
1+[Dolphin]
2+Timestamp=2012,10,5,23,54,32
3+ViewMode=1
--- /dev/null
+++ b/res/values-v11/styles.xml
@@ -0,0 +1,4 @@
1+<?xml version="1.0" encoding="utf-8"?>
2+<resources>
3+ <style name="AppTheme" parent="@android:style/Theme.Holo" />
4+</resources>
\ No newline at end of file
--- /dev/null
+++ b/res/values-v14/styles.xml
@@ -0,0 +1,4 @@
1+<?xml version="1.0" encoding="utf-8"?>
2+<resources>
3+ <style name="AppTheme" parent="@android:style/Theme.DeviceDefault" />
4+</resources>
\ No newline at end of file
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -1,5 +1,5 @@
11 <resources>
22
3- <style name="AppTheme" parent="android:Theme.Light" />
3+ <style name="AppTheme" parent="android:Theme" />
44
55 </resources>
\ No newline at end of file
--- a/src/org/pulpdust/kigo/KigoActivity.java
+++ b/src/org/pulpdust/kigo/KigoActivity.java
@@ -1,14 +1,17 @@
11 package org.pulpdust.kigo;
22
33 import java.io.ByteArrayOutputStream;
4+import java.io.IOException;
45 import java.io.StringReader;
56 import java.io.UnsupportedEncodingException;
67 import java.util.ArrayList;
78 import java.util.List;
89 import java.net.URLEncoder;
10+import java.lang.Thread;
911
1012 import org.apache.http.HttpResponse;
1113 import org.apache.http.HttpStatus;
14+import org.apache.http.client.ClientProtocolException;
1215 import org.apache.http.client.HttpClient;
1316 import org.apache.http.client.methods.HttpGet;
1417 import org.apache.http.impl.client.DefaultHttpClient;
@@ -18,6 +21,7 @@ import android.net.ConnectivityManager;
1821 import android.net.NetworkInfo;
1922 import android.net.Uri;
2023 import android.os.Bundle;
24+import android.os.Handler;
2125 import android.preference.PreferenceManager;
2226 import android.app.Activity;
2327 import android.app.AlertDialog;
@@ -59,7 +63,7 @@ public class KigoActivity extends Activity {
5963 EditText edttxt;
6064 Button bttn;
6165 ListView lstvw;
62- HttpResponse res;
66+ HttpResponse res = null;
6367 CharSequence cptxt;
6468 String host = "http://h.hatena.ne.jp/";
6569 String base = host + "keyword/";
@@ -104,7 +108,7 @@ public class KigoActivity extends Activity {
104108 loadSave();
105109 }
106110 readPrefs();
107- requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
111+// requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
108112 setContentView(R.layout.activity_kigo);
109113 edttxt = (EditText) findViewById(R.id.editText1);
110114 if (rltd == true){
@@ -308,41 +312,52 @@ public class KigoActivity extends Activity {
308312 return false;
309313 }
310314 }
311- public void echoInfo(String word){
312- try {
313- String turi = host + ipth + URLEncoder.encode(word.toString(), "UTF-8").replace("+", "%20");
314- String xml = getHttp(turi);
315- if (xml != null){
316- String info[] = exInfo(xml);
317- if(info != null){
318- Context context = this;
319- AlertDialog.Builder abuilder = new AlertDialog.Builder(context);
320- LayoutInflater linflater =
321- (LayoutInflater) context.getSystemService(LAYOUT_INFLATER_SERVICE);
322- View layout = linflater.inflate(R.layout.info,
323- (ViewGroup) findViewById(R.id.layout_root));
324- TextView tv1 = (TextView) layout.findViewById(R.id.textView1);
325- TextView tv2 = (TextView) layout.findViewById(R.id.textView2);
326- TextView tv3 = (TextView) layout.findViewById(R.id.textView3);
327-// TextView tv4 = (TextView) layout.findViewById(R.id.textView4);
328- tv1.setText(getString(R.string.info_entries) + info[0]);
329- tv2.setText(getString(R.string.info_follows) + info[1]);
330- tv3.setText(getString(R.string.info_title) + info[2]);
331-// tv4.setText(getString(R.string.info_word) + info[3]);
332- abuilder.setTitle(word);
333- abuilder.setCancelable(true);
334- abuilder.setView(layout);
335- abuilder.show();
336- }
337- } else {
338- Toast.makeText(getApplicationContext(), R.string.err_fail_get,
339- Toast.LENGTH_SHORT).show();
340- }
341-
342- } catch (UnsupportedEncodingException e) {
343- // TODO Auto-generated catch block
344- e.printStackTrace();
345- }
315+ public void echoInfo(final String word){
316+ final Handler handler = new Handler();
317+ final Context context = this;
318+ new Thread(new Runnable(){
319+ @Override
320+ public void run(){
321+ try {
322+ String turi = host + ipth + URLEncoder.encode(word.toString(), "UTF-8").replace("+", "%20");
323+ final String xml = getHttp(turi);
324+ handler.post(new Runnable(){
325+ @Override
326+ public void run(){
327+ if (xml != null){
328+ String info[] = exInfo(xml);
329+ if(info != null){
330+ AlertDialog.Builder abuilder = new AlertDialog.Builder(context);
331+ LayoutInflater linflater =
332+ (LayoutInflater) context.getSystemService(LAYOUT_INFLATER_SERVICE);
333+ View layout = linflater.inflate(R.layout.info,
334+ (ViewGroup) findViewById(R.id.layout_root));
335+ TextView tv1 = (TextView) layout.findViewById(R.id.textView1);
336+ TextView tv2 = (TextView) layout.findViewById(R.id.textView2);
337+ TextView tv3 = (TextView) layout.findViewById(R.id.textView3);
338+// TextView tv4 = (TextView) layout.findViewById(R.id.textView4);
339+ tv1.setText(getString(R.string.info_entries) + info[0]);
340+ tv2.setText(getString(R.string.info_follows) + info[1]);
341+ tv3.setText(getString(R.string.info_title) + info[2]);
342+// tv4.setText(getString(R.string.info_word) + info[3]);
343+ abuilder.setTitle(word);
344+ abuilder.setCancelable(true);
345+ abuilder.setView(layout);
346+ abuilder.show();
347+ }
348+ } else {
349+ Toast.makeText(getApplicationContext(), R.string.err_fail_get,
350+ Toast.LENGTH_SHORT).show();
351+ }
352+ }
353+ });
354+
355+ } catch (UnsupportedEncodingException e) {
356+ // TODO Auto-generated catch block
357+ e.printStackTrace();
358+ }
359+ }
360+ }).start();
346361 }
347362
348363 @Override
@@ -383,19 +398,31 @@ public class KigoActivity extends Activity {
383398 return super.dispatchKeyEvent(kev);
384399 }
385400 }
386- public void reLoad(String uri){
387- ProgressDialog pdialog = ProgressDialog.show(this, "",
388- getString(R.string.on_load), true);
389- arryadpt.clear();
390- obj = null;
391- obj = getHttp(uri);
392- if (obj != null){
393- xmlBaker(obj);
394- } else {
395- Toast.makeText(getApplicationContext(), R.string.err_fail_get,
396- Toast.LENGTH_SHORT).show();
397- }
398- pdialog.dismiss();
401+ public void reLoad(final String uri){
402+// final Getter getter = new Getter();
403+ final Handler handler = new Handler();
404+ new Thread(new Runnable(){
405+ @Override
406+ public void run(){
407+ obj = null;
408+// obj = getter.getHttp(uri);
409+ obj = getHttp(uri);
410+ handler.post(new Runnable(){
411+ @Override
412+ public void run(){
413+ arryadpt.clear();
414+ if (obj != null){
415+ xmlBaker(obj);
416+ } else {
417+ Toast.makeText(getApplicationContext(), R.string.err_fail_get,
418+ Toast.LENGTH_SHORT).show();
419+ }
420+
421+ }
422+ });
423+
424+ }
425+ }).start();
399426 }
400427 public static boolean isConnect(Context c){
401428 ConnectivityManager cmanager = (ConnectivityManager)
@@ -406,16 +433,22 @@ public class KigoActivity extends Activity {
406433 }
407434 return false;
408435 }
409- public String getHttp(String uri){
436+ public String getHttp(final String uri){
410437 if (!isConnect(getApplicationContext())){
411438 Toast.makeText(getApplicationContext(), R.string.err_no_net,
412439 Toast.LENGTH_SHORT).show();
413440 return null;
414441 } else {
415- HttpClient client = new DefaultHttpClient();
416- HttpGet req = new HttpGet(uri.toString());
417442 try {
418- res = client.execute(req);
443+ HttpClient client = new DefaultHttpClient();
444+ HttpGet req = new HttpGet(uri.toString());
445+ res = client.execute(req);
446+ } catch (ClientProtocolException e){
447+ Log.e(TAG, e.getMessage());
448+ return null;
449+ } catch (IOException e){
450+ Log.e(TAG, e.getMessage());
451+ return null;
419452 } catch (Exception e){
420453 Log.e(TAG, e.getMessage());
421454 return null;