Révision | d1cba97ef48b6d35fae95eee1b39d93b2d4d3024 (tree) |
---|---|
l'heure | 2013-05-06 20:09:51 |
Auteur | Masahiko, SAWAI <say@user...> |
Commiter | Masahiko, SAWAI |
いろいろ細かい修正
@@ -1,16 +1,59 @@ | ||
1 | 1 | ! ToDo |
2 | 2 | |
3 | -* IntentDetailActivity | |
4 | -** 保存処理実装 | |
5 | -*** 保存処理 | |
6 | -*** 変更済みチェックメソッド | |
7 | -*** この形式であれば onActivityResult で変更があった場合に保存してしまえばいい? | |
8 | -**** 編集途中でのキャンセルを可能にするか否かでどちらがいいかが変わる | |
9 | -**** この形式での編集だと編集途中でのキャンセルは現実的ではない | |
10 | -** ACTION_INSERT への対応 | |
11 | -** 各項目の編集画面一覧の作成 | |
12 | - | |
13 | -* ResolveInfoListActivity | |
14 | -** 各項目にデフォルト設定済みかどうかが分かるようにしたい | |
3 | +!! IntentListActivity | |
4 | + | |
5 | +#* List のコンテキストメニューから Edit Intent を削除 | |
6 | + | |
7 | +!! IntentDetailActivity | |
8 | + | |
9 | +#* 保存処理実装 | |
10 | +#** 保存処理 | |
11 | +#** 変更済みチェックメソッド | |
12 | +#** この形式であれば onActivityResult で変更があった場合に保存してしまえばいい? | |
13 | +#*** 編集途中でのキャンセルを可能にするか否かでどちらがいいかが変わる | |
14 | +#*** この形式での編集だと編集途中でのキャンセルは現実的ではない | |
15 | +#*** -> キャンセル不可とする | |
16 | +# | |
17 | +#* タイトルを変更 | |
18 | +#** Edit Intent -> Intent Detail | |
19 | + | |
20 | +* ACTION_INSERT への対応 | |
21 | + | |
22 | +* OptionMenu に各種操作をつける | |
23 | +** Send Intent | |
24 | +** Test Intent | |
25 | +** Delete Intent | |
26 | + | |
27 | +* 編集機能 | |
28 | +#** Name | |
29 | +#** Action | |
30 | +** Component Package | |
31 | +** Component Class | |
32 | +** Data Uri | |
33 | +** Data type | |
34 | +** Categories | |
35 | +** Flags | |
36 | + | |
37 | +!! ResolveInfoListActivity | |
38 | + | |
39 | +* 各項目にデフォルト設定済みかどうかが分かるようにしたい | |
15 | 40 | ** 可能かどうか調べる |
16 | 41 | |
42 | +!! ActionEditActivity | |
43 | + | |
44 | +* EditTextActivity の右に ActionListActivity を呼び出すボタン | |
45 | + | |
46 | +!! ActionListActivity | |
47 | + | |
48 | +* 検索機能を実装する | |
49 | + | |
50 | + | |
51 | +!! ComponentPackageEditActivity | |
52 | +!! PackageListActivity | |
53 | + | |
54 | +!! ComponentClassEditActivity | |
55 | + | |
56 | + | |
57 | +!! アプリアイコンを作る | |
58 | + | |
59 | + |
@@ -123,6 +123,7 @@ | ||
123 | 123 | <source>1.5</source> |
124 | 124 | <target>1.5</target> |
125 | 125 | <encoding>UTF-8</encoding> |
126 | + <compilerArgument>-Xlint:unchecked</compilerArgument> | |
126 | 127 | </configuration> |
127 | 128 | </plugin> |
128 | 129 |
@@ -15,7 +15,7 @@ | ||
15 | 15 | /> |
16 | 16 | <TextView |
17 | 17 | style="@style/actionbar_title" |
18 | - android:text="@string/edit_intent" | |
18 | + android:text="@string/intent_detail" | |
19 | 19 | /> |
20 | 20 | <!-- |
21 | 21 | <ImageButton |
@@ -44,19 +44,15 @@ | ||
44 | 44 | /> |
45 | 45 | </LinearLayout> |
46 | 46 | |
47 | - <!-- Component --> | |
47 | + <!-- Component Package --> | |
48 | 48 | <LinearLayout |
49 | - android:id="@+id/intent_detail_item_component" | |
49 | + android:id="@+id/intent_detail_item_component_package" | |
50 | 50 | android:layout_width="fill_parent" |
51 | 51 | android:layout_height="wrap_content" |
52 | 52 | android:orientation="vertical" |
53 | 53 | > |
54 | 54 | <TextView |
55 | 55 | style="@style/key" |
56 | - android:text="@string/component" | |
57 | - /> | |
58 | - <TextView | |
59 | - style="@style/subkey" | |
60 | 56 | android:text="@string/component_package" |
61 | 57 | /> |
62 | 58 | <TextView |
@@ -64,8 +60,17 @@ | ||
64 | 60 | android:id="@+id/component_package_textview" |
65 | 61 | android:hint="@string/component_package" |
66 | 62 | /> |
63 | + </LinearLayout> | |
64 | + | |
65 | + <!-- Component Class --> | |
66 | + <LinearLayout | |
67 | + android:id="@+id/intent_detail_item_component_class" | |
68 | + android:layout_width="fill_parent" | |
69 | + android:layout_height="wrap_content" | |
70 | + android:orientation="vertical" | |
71 | + > | |
67 | 72 | <TextView |
68 | - style="@style/subkey" | |
73 | + style="@style/key" | |
69 | 74 | android:text="@string/component_class" |
70 | 75 | /> |
71 | 76 | <TextView |
@@ -18,15 +18,8 @@ | ||
18 | 18 | android:id="@+id/view_intent_menuitem" |
19 | 19 | android:title="@string/view_intent" |
20 | 20 | android:icon="@android:drawable/ic_menu_view" |
21 | - android:numericShortcut="5" | |
22 | - android:alphabeticShortcut="v" | |
23 | - /> | |
24 | - <item | |
25 | - android:id="@+id/edit_intent_menuitem" | |
26 | - android:title="@string/edit_intent" | |
27 | - android:icon="@android:drawable/ic_menu_send" | |
28 | 21 | android:numericShortcut="3" |
29 | - android:alphabeticShortcut="e" | |
22 | + android:alphabeticShortcut="v" | |
30 | 23 | /> |
31 | 24 | <item |
32 | 25 | android:id="@+id/delete_intent_menuitem" |
@@ -23,16 +23,15 @@ | ||
23 | 23 | <string name="send_intent">Send Intent</string> |
24 | 24 | <string name="test_intent">Test Intent</string> |
25 | 25 | <string name="view_intent">View Intent</string> |
26 | - <string name="edit_intent">Edit Intent</string> | |
27 | 26 | <string name="delete_intent">Delete Intent</string> |
28 | 27 | |
29 | 28 | <!-- Intent Detail --> |
29 | + <string name="intent_detail">Intent Detail</string> | |
30 | 30 | <string name="basic">Basic</string> |
31 | 31 | <string name="action">Action</string> |
32 | 32 | <string name="action_name">Name</string> |
33 | - <string name="component">Component</string> | |
34 | - <string name="component_package">Package</string> | |
35 | - <string name="component_class">Class</string> | |
33 | + <string name="component_package">Component Package</string> | |
34 | + <string name="component_class">Component Class</string> | |
36 | 35 | <string name="data">Data</string> |
37 | 36 | <string name="data_uri">Data URI</string> |
38 | 37 | <string name="data_type">Data Type</string> |
@@ -44,6 +44,7 @@ public class ActionListActivity extends ListActivity | ||
44 | 44 | private static final List<Map<String, String>> ACTION_DATA_LIST; |
45 | 45 | private static final int ACTION_MODE_NORMAL = 0; |
46 | 46 | private static final int ACTION_MODE_SEARCH = 1; |
47 | + @SuppressWarnings("unchecked") | |
47 | 48 | private static final Map<Integer, Boolean>[] ACTION_ITEM_VISIBILITY = new Map[] |
48 | 49 | { |
49 | 50 | new HashMap<Integer, Boolean>() |
@@ -100,7 +101,7 @@ public class ActionListActivity extends ListActivity | ||
100 | 101 | { |
101 | 102 | String value = (String) field.get(null); |
102 | 103 | // Log.d(LOG_TAG, name + " -> " + value); |
103 | - Map<String, String> actionData = new HashMap(); | |
104 | + Map<String, String> actionData = new HashMap<String, String>(); | |
104 | 105 | actionData.put(KEY_ACTION_NAME, name); |
105 | 106 | actionData.put(KEY_ACTION_STRING, value); |
106 | 107 | ACTION_DATA_LIST.add(actionData); |
@@ -231,9 +232,9 @@ public class ActionListActivity extends ListActivity | ||
231 | 232 | { |
232 | 233 | actionMode = newActionMode; |
233 | 234 | Log.d(LOG_TAG, "update actionMode => " + actionMode); |
234 | - | |
235 | - // update visibility | |
236 | - for (Entry<Integer, Boolean> e : ACTION_ITEM_VISIBILITY[actionMode].entrySet()) | |
235 | + // update visibility | |
236 | + Map<Integer, Boolean> actionItemVisibility = ACTION_ITEM_VISIBILITY[actionMode]; | |
237 | + for (Entry<Integer, Boolean> e : actionItemVisibility.entrySet()) | |
237 | 238 | { |
238 | 239 | View actionItemView = findViewById(e.getKey()); |
239 | 240 | if (actionItemView != null) |
@@ -31,20 +31,22 @@ public class IntentDetailActivity extends ListActivity | ||
31 | 31 | private static final String LOG_TAG = "intent-lab"; |
32 | 32 | private static final int POSITION_NAME = 0; |
33 | 33 | private static final int POSITION_ACTION = 1; |
34 | - private static final int POSITION_COMPONENT = 2; | |
35 | - private static final int POSITION_DATA_URI = 3; | |
36 | - private static final int POSITION_DATA_TYPE = 4; | |
37 | - private static final int POSITION_CATEGORIES = 5; | |
38 | - private static final int POSITION_FLAGS = 6; | |
39 | - private static final int POSITION_EXTRAS = 7; | |
34 | + private static final int POSITION_COMPONENT_PACKAGE = 2; | |
35 | + private static final int POSITION_COMPONENT_CLASS = 3; | |
36 | + private static final int POSITION_DATA_URI = 4; | |
37 | + private static final int POSITION_DATA_TYPE = 5; | |
38 | + private static final int POSITION_CATEGORIES = 6; | |
39 | + private static final int POSITION_FLAGS = 7; | |
40 | + private static final int POSITION_EXTRAS = 8; | |
40 | 41 | private static final int REQUEST_CODE_EDIT_INTENT_NAME = 101; |
41 | 42 | private static final int REQUEST_CODE_EDIT_INTENT_ACTION = 102; |
42 | - private static final int REQUEST_CODE_EDIT_INTENT_COMPONENT = 103; | |
43 | - private static final int REQUEST_CODE_EDIT_INTENT_DATA_URI = 104; | |
44 | - private static final int REQUEST_CODE_EDIT_INTENT_DATA_TYPE = 105; | |
45 | - private static final int REQUEST_CODE_EDIT_INTENT_CATEGORIES = 106; | |
46 | - private static final int REQUEST_CODE_EDIT_INTENT_FLAGS = 106; | |
47 | - private static final int REQUEST_CODE_EDIT_INTENT_EXTRAS = 108; | |
43 | + private static final int REQUEST_CODE_EDIT_INTENT_COMPONENT_PACKAGE = 103; | |
44 | + private static final int REQUEST_CODE_EDIT_INTENT_COMPONENT_CLASS = 104; | |
45 | + private static final int REQUEST_CODE_EDIT_INTENT_DATA_URI = 105; | |
46 | + private static final int REQUEST_CODE_EDIT_INTENT_DATA_TYPE = 106; | |
47 | + private static final int REQUEST_CODE_EDIT_INTENT_CATEGORIES = 107; | |
48 | + private static final int REQUEST_CODE_EDIT_INTENT_FLAGS = 108; | |
49 | + private static final int REQUEST_CODE_EDIT_INTENT_EXTRAS = 109; | |
48 | 50 | // data |
49 | 51 | private Uri currentIntentUri; |
50 | 52 | private IntentModel currentIntentModel; |
@@ -76,6 +78,18 @@ public class IntentDetailActivity extends ListActivity | ||
76 | 78 | case POSITION_ACTION: |
77 | 79 | startActionPickActivity(); |
78 | 80 | break; |
81 | + case POSITION_COMPONENT_PACKAGE: | |
82 | + startComponentPackageEditActivity(); | |
83 | + break; | |
84 | + case POSITION_COMPONENT_CLASS: | |
85 | + startComponentClassEditActivity(); | |
86 | + break; | |
87 | + case POSITION_DATA_URI: | |
88 | + startDataUriEditActivity(); | |
89 | + break; | |
90 | + case POSITION_DATA_TYPE: | |
91 | + startDataTypeEditActivity(); | |
92 | + break; | |
79 | 93 | } |
80 | 94 | |
81 | 95 | Log.d(LOG_TAG, "onItemClick() : Bye"); |
@@ -193,6 +207,26 @@ public class IntentDetailActivity extends ListActivity | ||
193 | 207 | startActivityForResult(intent, REQUEST_CODE_EDIT_INTENT_ACTION); |
194 | 208 | } |
195 | 209 | |
210 | + private void startComponentPackageEditActivity() | |
211 | + { | |
212 | + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | |
213 | + } | |
214 | + | |
215 | + private void startDataUriEditActivity() | |
216 | + { | |
217 | + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | |
218 | + } | |
219 | + | |
220 | + private void startDataTypeEditActivity() | |
221 | + { | |
222 | + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | |
223 | + } | |
224 | + | |
225 | + private void startComponentClassEditActivity() | |
226 | + { | |
227 | + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | |
228 | + } | |
229 | + | |
196 | 230 | class IntentDetailListAdapter extends BaseAdapter |
197 | 231 | { |
198 | 232 |
@@ -219,7 +253,10 @@ public class IntentDetailActivity extends ListActivity | ||
219 | 253 | case POSITION_ACTION: |
220 | 254 | result = currentIntentModel.getIntent().getAction(); |
221 | 255 | break; |
222 | - case POSITION_COMPONENT: | |
256 | + case POSITION_COMPONENT_PACKAGE: | |
257 | + result = currentIntentModel.getIntent().getComponent(); | |
258 | + break; | |
259 | + case POSITION_COMPONENT_CLASS: | |
223 | 260 | result = currentIntentModel.getIntent().getComponent(); |
224 | 261 | break; |
225 | 262 | case POSITION_DATA_URI: |
@@ -246,6 +283,7 @@ public class IntentDetailActivity extends ListActivity | ||
246 | 283 | return position; |
247 | 284 | } |
248 | 285 | |
286 | + @SuppressWarnings("unchecked") | |
249 | 287 | public View getView(int position, View convertView, ViewGroup parent) |
250 | 288 | { |
251 | 289 | View itemView; |
@@ -261,7 +299,8 @@ public class IntentDetailActivity extends ListActivity | ||
261 | 299 | } |
262 | 300 | View nameView = itemView.findViewById(R.id.intent_detail_item_name); |
263 | 301 | View actionView = itemView.findViewById(R.id.intent_detail_item_action); |
264 | - View componentView = itemView.findViewById(R.id.intent_detail_item_component); | |
302 | + View componentPackageView = itemView.findViewById(R.id.intent_detail_item_component_package); | |
303 | + View componentClassView = itemView.findViewById(R.id.intent_detail_item_component_class); | |
265 | 304 | View dataUriView = itemView.findViewById(R.id.intent_detail_item_data_uri); |
266 | 305 | View dataTypeView = itemView.findViewById(R.id.intent_detail_item_data_type); |
267 | 306 | View categoriesView = itemView.findViewById(R.id.intent_detail_item_categories); |
@@ -270,7 +309,8 @@ public class IntentDetailActivity extends ListActivity | ||
270 | 309 | |
271 | 310 | nameView.setVisibility(View.GONE); |
272 | 311 | actionView.setVisibility(View.GONE); |
273 | - componentView.setVisibility(View.GONE); | |
312 | + componentPackageView.setVisibility(View.GONE); | |
313 | + componentClassView.setVisibility(View.GONE); | |
274 | 314 | dataUriView.setVisibility(View.GONE); |
275 | 315 | dataTypeView.setVisibility(View.GONE); |
276 | 316 | categoriesView.setVisibility(View.GONE); |
@@ -300,21 +340,32 @@ public class IntentDetailActivity extends ListActivity | ||
300 | 340 | titleTextView.setText(actionText); |
301 | 341 | actionView.setVisibility(View.VISIBLE); |
302 | 342 | break; |
303 | - case POSITION_COMPONENT: | |
343 | + case POSITION_COMPONENT_PACKAGE: | |
344 | + { | |
304 | 345 | String componentPackageText = null; |
305 | - String componentClassText = null; | |
306 | 346 | ComponentName componentName = (ComponentName) item; |
307 | 347 | if (componentName != null) |
308 | 348 | { |
309 | 349 | componentPackageText = componentName.getPackageName(); |
310 | - componentClassText = componentName.getClassName(); | |
311 | 350 | } |
312 | - TextView componentPackageTextView = (TextView) componentView.findViewById(R.id.component_package_textview); | |
313 | - TextView componentClassTextView = (TextView) componentView.findViewById(R.id.component_class_textview); | |
351 | + TextView componentPackageTextView = (TextView) componentPackageView.findViewById(R.id.component_package_textview); | |
314 | 352 | componentPackageTextView.setText(componentPackageText); |
353 | + componentPackageView.setVisibility(View.VISIBLE); | |
354 | + break; | |
355 | + } | |
356 | + case POSITION_COMPONENT_CLASS: | |
357 | + { | |
358 | + String componentClassText = null; | |
359 | + ComponentName componentName = (ComponentName) item; | |
360 | + if (componentName != null) | |
361 | + { | |
362 | + componentClassText = componentName.getClassName(); | |
363 | + } | |
364 | + TextView componentClassTextView = (TextView) componentClassView.findViewById(R.id.component_class_textview); | |
315 | 365 | componentClassTextView.setText(componentClassText); |
316 | - componentView.setVisibility(View.VISIBLE); | |
366 | + componentClassView.setVisibility(View.VISIBLE); | |
317 | 367 | break; |
368 | + } | |
318 | 369 | case POSITION_DATA_URI: |
319 | 370 | String dataUriText = null; |
320 | 371 | if (item instanceof Uri) |
@@ -162,10 +162,6 @@ public class IntentListActivity extends ListActivity | ||
162 | 162 | viewIntent(intentId); |
163 | 163 | result = true; |
164 | 164 | break; |
165 | - case R.id.edit_intent_menuitem: | |
166 | - editIntent(intentId); | |
167 | - result = true; | |
168 | - break; | |
169 | 165 | case R.id.delete_intent_menuitem: |
170 | 166 | deleteIntent(intentId); |
171 | 167 | result = true; |
@@ -217,14 +213,6 @@ public class IntentListActivity extends ListActivity | ||
217 | 213 | Log.v(LOG_TAG, "Bye"); |
218 | 214 | } |
219 | 215 | |
220 | - private void editIntent(long intentId) | |
221 | - { | |
222 | - Log.d(LOG_TAG, "editIntent() Hello intentId => " + intentId); | |
223 | - Uri uri = ContentUris.withAppendedId(IntentStore.Intents.CONTENT_URI, intentId); | |
224 | - Intent intent = new Intent(Intent.ACTION_EDIT, uri); | |
225 | - startActivity(intent); | |
226 | - } | |
227 | - | |
228 | 216 | private void deleteIntent(long intentId) |
229 | 217 | { |
230 | 218 | Log.d(LOG_TAG, "deleteIntent() Hello intentId => " + intentId); |
@@ -1,7 +1,7 @@ | ||
1 | 1 | /* |
2 | 2 | * The MIT License |
3 | 3 | * |
4 | - * Copyright 2011-2012 Masahiko, SAWAI <masahiko.sawai@gmail.com>. | |
4 | + * Copyright 2011-2013 Masahiko, SAWAI <masahiko.sawai@gmail.com>. | |
5 | 5 | * |
6 | 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | 7 | * of this software and associated documentation files (the "Software"), to deal |
@@ -26,7 +26,6 @@ package org.routine_work.intent_lab.intent.provider; | ||
26 | 26 | import android.content.ContentResolver; |
27 | 27 | import android.content.ContentUris; |
28 | 28 | import android.content.ContentValues; |
29 | -import android.content.Context; | |
30 | 29 | import android.content.Intent; |
31 | 30 | import android.database.Cursor; |
32 | 31 | import android.net.Uri; |
@@ -255,6 +254,11 @@ public class IntentStore | ||
255 | 254 | long intentModified = cursor.getLong(modifiedColumnIndex); |
256 | 255 | String intentAction = cursor.getString(actionColumnIndex); |
257 | 256 | String intentDataUriString = cursor.getString(dataUriColumnIndex); |
257 | + Uri intentDataUri = null; | |
258 | + if (intentDataUriString != null) | |
259 | + { | |
260 | + intentDataUri = Uri.parse(intentDataUriString); | |
261 | + } | |
258 | 262 | |
259 | 263 | result = new IntentModel(); |
260 | 264 | result.setIntent(intentObject); |
@@ -263,7 +267,7 @@ public class IntentStore | ||
263 | 267 | result.setCreated(intentCreated); |
264 | 268 | result.setModified(intentModified); |
265 | 269 | result.setAction(intentAction); |
266 | - result.setDataUri(Uri.parse(intentDataUriString)); | |
270 | + result.setDataUri(intentDataUri); | |
267 | 271 | } |
268 | 272 | } |
269 | 273 | finally |
@@ -311,6 +315,7 @@ public class IntentStore | ||
311 | 315 | { |
312 | 316 | is.close(); |
313 | 317 | } |
318 | + | |
314 | 319 | if (os != null) |
315 | 320 | { |
316 | 321 | os.close(); |