Revision | 968849f063bc9c73243560e97d5bf1ae75aa1668 (tree) |
---|---|
Zeit | 2013-02-08 17:50:50 |
Autor | Masahiko, SAWAI <say@user...> |
Commiter | Masahiko, SAWAI |
Cleanup ResourceListActivity.java
@@ -62,17 +62,14 @@ public abstract class ResourceListActivity extends ListActivity | ||
62 | 62 | private SearchWordDBHelper searchWordDBHelper; |
63 | 63 | private SQLiteDatabase searchWordDB; |
64 | 64 | private final List<Cursor> searchWordCursorList = new ArrayList<Cursor>(); |
65 | - private AutoCompleteTextView searchWordAutoCompleteTextView; | |
66 | 65 | |
67 | -// private Uri apiReferenceUri; | |
68 | 66 | @Override |
69 | 67 | protected void onCreate(Bundle savedInstanceState) |
70 | 68 | { |
71 | 69 | super.onCreate(savedInstanceState); |
72 | 70 | setContentView(R.layout.resource_list_activity); |
73 | 71 | |
74 | - initializeSearch(); | |
75 | - | |
72 | + initializeSearchViews(); | |
76 | 73 | initializeListData(); |
77 | 74 | initializeSearchWordAutoComplete(); |
78 | 75 | } |
@@ -202,15 +199,6 @@ public abstract class ResourceListActivity extends ListActivity | ||
202 | 199 | } |
203 | 200 | } |
204 | 201 | |
205 | - protected void initializeSearch() | |
206 | - { | |
207 | - EditText searchWordEditText = (EditText) findViewById(R.id.search_word_textview); | |
208 | - searchWordEditText.setOnEditorActionListener(this); | |
209 | - | |
210 | - Button searchGoButton = (Button) findViewById(R.id.search_go_button); | |
211 | - searchGoButton.setOnClickListener(this); | |
212 | - } | |
213 | - | |
214 | 202 | protected Uri getApiReferenceUri() |
215 | 203 | { |
216 | 204 | return Uri.parse(API_BASE_URI + "R." + getResourceType() + ".html"); |
@@ -224,10 +212,18 @@ public abstract class ResourceListActivity extends ListActivity | ||
224 | 212 | |
225 | 213 | protected abstract void updateListData(); |
226 | 214 | |
215 | + protected void initializeSearchViews() | |
216 | + { | |
217 | + EditText searchWordEditText = (EditText) findViewById(R.id.search_word_textview); | |
218 | + searchWordEditText.setOnEditorActionListener(this); | |
219 | + | |
220 | + Button searchGoButton = (Button) findViewById(R.id.search_go_button); | |
221 | + searchGoButton.setOnClickListener(this); | |
222 | + } | |
223 | + | |
227 | 224 | protected void initializeSearchWordAutoComplete() |
228 | 225 | { |
229 | 226 | Log.v(LOG_TAG, "Hello"); |
230 | - searchWordAutoCompleteTextView = (AutoCompleteTextView) findViewById(R.id.search_word_textview); | |
231 | 227 | searchWordDBHelper = new SearchWordDBHelper(this); |
232 | 228 | searchWordDB = searchWordDBHelper.getWritableDatabase(); |
233 | 229 |
@@ -253,7 +249,6 @@ public abstract class ResourceListActivity extends ListActivity | ||
253 | 249 | { |
254 | 250 | searchWordCursorList.add(cursor); |
255 | 251 | } |
256 | -// startManagingCursor(cursor); | |
257 | 252 | return cursor; |
258 | 253 | } |
259 | 254 | }); |
@@ -267,6 +262,7 @@ public abstract class ResourceListActivity extends ListActivity | ||
267 | 262 | } |
268 | 263 | }); |
269 | 264 | |
265 | + AutoCompleteTextView searchWordAutoCompleteTextView = (AutoCompleteTextView) findViewById(R.id.search_word_textview); | |
270 | 266 | searchWordAutoCompleteTextView.setAdapter(adapter); |
271 | 267 | |
272 | 268 | Log.v(LOG_TAG, "Bye"); |
@@ -295,6 +291,7 @@ public abstract class ResourceListActivity extends ListActivity | ||
295 | 291 | |
296 | 292 | private void updateSearchWordDB() |
297 | 293 | { |
294 | + AutoCompleteTextView searchWordAutoCompleteTextView = (AutoCompleteTextView) findViewById(R.id.search_word_textview); | |
298 | 295 | String searchWord = searchWordAutoCompleteTextView.getText().toString().trim(); |
299 | 296 | if (searchWord.length() > 1) |
300 | 297 | { |