• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

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

Revisionc1a0791ba10d3abf1a8d06126a1818567d540c56 (tree)
Zeit2012-08-07 15:20:00
AutorMasahiko, SAWAI <say@user...>
CommiterMasahiko, SAWAI

Log Message

NotepadActivity の起動時の検索語の扱いを微修正

Ändern Zusammenfassung

Diff

--- a/notepad-app/src/org/routine_work/notepad/NotepadActivity.java
+++ b/notepad-app/src/org/routine_work/notepad/NotepadActivity.java
@@ -120,7 +120,7 @@ public class NotepadActivity extends ListActivity
120120 * Called when the activity is first created.
121121 */
122122 @Override
123- public void onCreate(Bundle savedInstanceState)
123+ protected void onCreate(Bundle savedInstanceState)
124124 {
125125 Log.v(LOG_TAG, "Hello");
126126
@@ -419,10 +419,23 @@ public class NotepadActivity extends ListActivity
419419
420420 public void onFocusChange(View v, boolean hasFocus)
421421 {
422- if (v.getId() == R.id.search_edittext && hasFocus)
422+ Log.v(LOG_TAG, "Hello");
423+
424+ if (v.getId() == R.id.search_edittext)
423425 {
424- IMEUtils.showSoftKeyboardWindow(this, v);
426+ if (hasFocus)
427+ {
428+ Log.d(LOG_TAG, "search_edittext has focus.");
429+ IMEUtils.showSoftKeyboardWindow(this, v);
430+ }
431+ else
432+ {
433+ Log.d(LOG_TAG, "search_edittext has focus.");
434+ IMEUtils.hideSoftKeyboardWindow(this, v);
435+ }
425436 }
437+
438+ Log.v(LOG_TAG, "Bye");
426439 }
427440
428441 private void initializeWithIntent(Intent intent)
@@ -436,6 +449,7 @@ public class NotepadActivity extends ListActivity
436449 Log.d(LOG_TAG, "intent.scheme => " + intent.getScheme());
437450 Log.d(LOG_TAG, "------------------------------");
438451
452+ String queryString = null;
439453 String action = intent.getAction();
440454 if (ACTION_QUIT.equals(action))
441455 {
@@ -443,8 +457,7 @@ public class NotepadActivity extends ListActivity
443457 }
444458 else if (Intent.ACTION_SEARCH.equals(action))
445459 {
446- String queryString = intent.getStringExtra(SearchManager.QUERY);
447- searchEditText.setText(queryString);
460+ queryString = intent.getStringExtra(SearchManager.QUERY);
448461 }
449462 else if (Intent.ACTION_VIEW.equals(action))
450463 {
@@ -465,27 +478,34 @@ public class NotepadActivity extends ListActivity
465478 {
466479 Log.d(LOG_TAG, "open note : data => " + data);
467480 String idString = data.getLastPathSegment();
468- searchEditText.setText("id:" + idString);
481+ queryString = "id:" + idString;
469482 processed = true;
470483 }
471484 }
472485
473486 if (!processed)
474487 {
475- String queryString = intent.getStringExtra(SearchManager.QUERY);
476- searchEditText.setText(queryString);
488+ queryString = intent.getStringExtra(SearchManager.QUERY);
477489 }
478490 }
479491 }
480492
481- if (TextUtils.isEmpty(searchEditText.getText()))
493+ if (queryString != null)
482494 {
483- searchEditText.setText(null);
484- setActionMode(ACTION_MODE_NORMAL);
495+ enterSearchMode();
496+ if (TextUtils.isEmpty(queryString.trim()))
497+ {
498+ searchEditText.setText(null);
499+ }
500+ else
501+ {
502+ searchEditText.setText(queryString);
503+ }
485504 }
486505 else
487506 {
488- setActionMode(ACTION_MODE_SEARCH);
507+ setActionMode(ACTION_MODE_NORMAL);
508+ searchEditText.setText(null);
489509 }
490510
491511 Log.v(LOG_TAG, "Bye");
@@ -630,7 +650,6 @@ public class NotepadActivity extends ListActivity
630650 searchEditText.setText(null);
631651 getListView().requestFocus();
632652 setActionMode(ACTION_MODE_NORMAL);
633- IMEUtils.hideSoftKeyboardWindow(this, searchEditText);
634653 }
635654 }
636655
@@ -640,7 +659,6 @@ public class NotepadActivity extends ListActivity
640659 {
641660 setActionMode(ACTION_MODE_SEARCH);
642661 searchEditText.requestFocus();
643- IMEUtils.showSoftKeyboardWindow(this, searchEditText);
644662 }
645663 }
646664