はてなハイク・キーワードの検索と入力アプリ
修订版 | 3f158e57b63164c375e7fe7f96d7eddc8e65ff5e (tree) |
---|---|
时间 | 2012-10-30 00:11:01 |
作者 | Kodakana <kodakana@linu...> |
Commiter | Kodakana |
前回の修正によりHoneycomb以上で情報ダイアログが出せなくなっていた手違いの修正。
@@ -1,7 +1,7 @@ | ||
1 | 1 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" |
2 | 2 | package="org.pulpdust.kigo" |
3 | - android:versionCode="4" | |
4 | - android:versionName="0.55" | |
3 | + android:versionCode="5" | |
4 | + android:versionName="0.56" | |
5 | 5 | android:installLocation="auto" > |
6 | 6 | |
7 | 7 | <uses-sdk |
@@ -1,7 +1,7 @@ | ||
1 | 1 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" |
2 | 2 | package="org.pulpdust.kigo" |
3 | - android:versionCode="4" | |
4 | - android:versionName="0.55" | |
3 | + android:versionCode="5" | |
4 | + android:versionName="0.56" | |
5 | 5 | android:installLocation="auto" > |
6 | 6 | |
7 | 7 | <uses-sdk |
@@ -1,7 +1,7 @@ | ||
1 | 1 | <resources> |
2 | 2 | |
3 | 3 | <string name="app_name">Kigo</string> |
4 | - <string name="app_ver">0.55</string> | |
4 | + <string name="app_ver">0.56</string> | |
5 | 5 | <string name="app_lic">GNU GPL v3</string> |
6 | 6 | <string name="address">連絡先</string> |
7 | 7 | <string name="app_author">Kodakana<kodakana.hws@gmail.com></string> |
@@ -1,7 +1,7 @@ | ||
1 | 1 | <resources> |
2 | 2 | |
3 | 3 | <string name="app_name">Kigo</string> |
4 | - <string name="app_ver">0.55</string> | |
4 | + <string name="app_ver">0.56</string> | |
5 | 5 | <string name="app_lic">GNU GPL v3</string> |
6 | 6 | <string name="address">Address</string> |
7 | 7 | <string name="app_author">Kodakana<kodakana.hws@gmail.com></string> |
@@ -338,65 +338,80 @@ public class KigoActivity extends FragmentActivity { | ||
338 | 338 | return echoInfo(cx, getActivity(), getArguments().getString("word")); |
339 | 339 | } |
340 | 340 | } |
341 | - public static AlertDialog echoInfo(Context context, FragmentActivity av, String word){ | |
341 | + public static class Share { | |
342 | + static String xml; | |
343 | + } | |
344 | + public static AlertDialog echoInfo(final Context context, final FragmentActivity av, final String word){ | |
342 | 345 | // final Handler handler = new Handler(); |
346 | + boolean isc = isConnect(context); | |
343 | 347 | AlertDialog ad = null; |
348 | + Share.xml = null; | |
344 | 349 | // final Context context = this; |
345 | -// new Thread(new Runnable(){ | |
346 | -// @Override | |
347 | -// public void run(){ | |
350 | + Thread th = new Thread(new Runnable(){ | |
351 | + @Override | |
352 | + public void run(){ | |
348 | 353 | try { |
349 | 354 | String turi = host + ipth + URLEncoder.encode(word, "UTF-8").replace("+", "%20"); |
350 | - final String xml = getHttp(context, turi); | |
351 | -// handler.post(new Runnable(){ | |
352 | -// @Override | |
353 | -// public void run(){ | |
354 | - if (xml != null){ | |
355 | - String info[] = exInfo(xml); | |
356 | - if(info != null){ | |
357 | - AlertDialog.Builder abuilder = new AlertDialog.Builder(context); | |
358 | - LayoutInflater linflater = | |
359 | - (LayoutInflater) context.getSystemService(LAYOUT_INFLATER_SERVICE); | |
360 | - View layout = linflater.inflate(R.layout.info, | |
361 | - (ViewGroup) av.findViewById(R.id.layout_root)); | |
362 | - TextView tv1 = (TextView) layout.findViewById(R.id.textView1); | |
363 | - TextView tv2 = (TextView) layout.findViewById(R.id.textView2); | |
364 | - TextView tv3 = (TextView) layout.findViewById(R.id.textView3); | |
365 | -// TextView tv4 = (TextView) layout.findViewById(R.id.textView4); | |
366 | - tv1.setText(av.getString(R.string.info_entries) + info[0]); | |
367 | - tv2.setText(av.getString(R.string.info_follows) + info[1]); | |
368 | - tv3.setText(av.getString(R.string.info_title) + info[2]); | |
369 | -// tv4.setText(getString(R.string.info_word) + info[3]); | |
370 | - abuilder.setTitle(word); | |
371 | - abuilder.setCancelable(true); | |
372 | - abuilder.setView(layout); | |
373 | - ad = abuilder.create(); | |
374 | - } | |
375 | - } else { | |
376 | - AlertDialog.Builder empty = new AlertDialog.Builder(context); | |
377 | - LayoutInflater linflater = | |
378 | - (LayoutInflater) context.getSystemService(LAYOUT_INFLATER_SERVICE); | |
379 | - View layout = linflater.inflate(R.layout.info, | |
380 | - (ViewGroup) av.findViewById(R.id.layout_root)); | |
381 | - TextView tv1 = (TextView) layout.findViewById(R.id.textView1); | |
382 | - tv1.setText(R.string.err_fail_get); | |
383 | - empty.setTitle(word); | |
384 | - empty.setCancelable(true); | |
385 | - empty.setView(layout); | |
386 | - ad = empty.create(); | |
387 | -// Toast.makeText(context, R.string.err_fail_get, | |
388 | -// Toast.LENGTH_SHORT).show(); | |
389 | - } | |
390 | -// } | |
391 | -// }); | |
355 | + Share.xml = getHttp(context, turi); | |
392 | 356 | |
393 | 357 | } catch (UnsupportedEncodingException e) { |
394 | 358 | // TODO Auto-generated catch block |
395 | 359 | e.printStackTrace(); |
396 | 360 | } |
397 | - return ad; | |
398 | -// } | |
399 | -// }).start(); | |
361 | + } | |
362 | + }); | |
363 | + if (isc){ | |
364 | + th.start(); | |
365 | + try { | |
366 | + th.join(); | |
367 | + } catch (InterruptedException e) { | |
368 | + // TODO Auto-generated catch block | |
369 | + e.printStackTrace(); | |
370 | + } | |
371 | +// handler.post(new Runnable(){ | |
372 | +// @Override | |
373 | +// public void run(){ | |
374 | + if (Share.xml != null){ | |
375 | + String info[] = exInfo(Share.xml); | |
376 | + if(info != null){ | |
377 | + AlertDialog.Builder abuilder = new AlertDialog.Builder(context); | |
378 | + LayoutInflater linflater = | |
379 | + (LayoutInflater) context.getSystemService(LAYOUT_INFLATER_SERVICE); | |
380 | + View layout = linflater.inflate(R.layout.info, | |
381 | + (ViewGroup) av.findViewById(R.id.layout_root)); | |
382 | + TextView tv1 = (TextView) layout.findViewById(R.id.textView1); | |
383 | + TextView tv2 = (TextView) layout.findViewById(R.id.textView2); | |
384 | + TextView tv3 = (TextView) layout.findViewById(R.id.textView3); | |
385 | +// TextView tv4 = (TextView) layout.findViewById(R.id.textView4); | |
386 | + tv1.setText(av.getString(R.string.info_entries) + info[0]); | |
387 | + tv2.setText(av.getString(R.string.info_follows) + info[1]); | |
388 | + tv3.setText(av.getString(R.string.info_title) + info[2]); | |
389 | +// tv4.setText(getString(R.string.info_word) + info[3]); | |
390 | + abuilder.setTitle(word); | |
391 | + abuilder.setCancelable(true); | |
392 | + abuilder.setView(layout); | |
393 | + ad = abuilder.create(); | |
394 | + } | |
395 | + } | |
396 | + } | |
397 | + if (ad == null) { | |
398 | + AlertDialog.Builder empty = new AlertDialog.Builder(context); | |
399 | + LayoutInflater linflater = | |
400 | + (LayoutInflater) context.getSystemService(LAYOUT_INFLATER_SERVICE); | |
401 | + View layout = linflater.inflate(R.layout.info, | |
402 | + (ViewGroup) av.findViewById(R.id.layout_root)); | |
403 | + TextView tv1 = (TextView) layout.findViewById(R.id.textView1); | |
404 | + tv1.setText(R.string.err_fail_get); | |
405 | + empty.setTitle(word); | |
406 | + empty.setCancelable(true); | |
407 | + empty.setView(layout); | |
408 | + ad = empty.create(); | |
409 | +// Toast.makeText(context, R.string.err_fail_get, | |
410 | +// Toast.LENGTH_SHORT).show(); | |
411 | + } | |
412 | +// } | |
413 | +// }); | |
414 | + return ad; | |
400 | 415 | } |
401 | 416 | |
402 | 417 | // @Override |