• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

コミットメタ情報

リビジョン41ea52e96b862187f37f7b95ee2b52a8b1fb8bf4 (tree)
日時2012-11-01 17:04:14
作者Masahiko, SAWAI <say@user...>
コミッターMasahiko, SAWAI

ログメッセージ

Intent 詳細表示画面にフラグ一覧表示を追加

変更サマリ

差分

--- a/intent-lab/res/layout/action_list_item.xml
+++ b/intent-lab/res/layout/action_list_item.xml
@@ -14,7 +14,7 @@
1414 android:layout_height="wrap_content"
1515 android:text="ACTION_NAME"
1616 android:textSize="18sp"
17- android:textColor="@android:color/white"
17+ android:textColor="?android:textColorPrimary"
1818 android:singleLine="true"
1919 android:ellipsize="marquee"
2020 />
--- a/intent-lab/res/layout/action_list_item_single_choice.xml
+++ b/intent-lab/res/layout/action_list_item_single_choice.xml
@@ -21,7 +21,7 @@
2121 android:layout_height="wrap_content"
2222 android:text="ACTION_NAME"
2323 android:textSize="18sp"
24- android:textColor="@android:color/white"
24+ android:textColor="?android:textColorPrimary"
2525 android:singleLine="true"
2626 android:ellipsize="marquee"
2727 />
--- a/intent-lab/res/layout/category_list_item.xml
+++ b/intent-lab/res/layout/category_list_item.xml
@@ -1,12 +1,20 @@
11 <?xml version="1.0" encoding="utf-8"?>
2-<TextView xmlns:android="http://schemas.android.com/apk/res/android"
3- android:id="@+id/category_textview"
2+<LinearLayout
3+ xmlns:android="http://schemas.android.com/apk/res/android"
44 android:layout_width="fill_parent"
55 android:layout_height="wrap_content"
6+ android:orientation="vertical"
67 android:paddingLeft="@dimen/list_item_paddingLeft"
78 android:paddingRight="@dimen/list_item_paddingRight"
89 android:paddingTop="@dimen/list_item_paddingTop"
910 android:paddingBottom="@dimen/list_item_paddingBottom"
10- android:text="CATEGORY"
11- android:textSize="16sp"
12-/>
\ No newline at end of file
11+>
12+ <TextView
13+ android:id="@+id/category_textview"
14+ android:layout_width="fill_parent"
15+ android:layout_height="wrap_content"
16+ android:text="CATEGORY"
17+ android:textSize="16sp"
18+ android:textColor="?android:textColorPrimary"
19+ />
20+</LinearLayout>
\ No newline at end of file
--- a/intent-lab/res/layout/extra_list_item.xml
+++ b/intent-lab/res/layout/extra_list_item.xml
@@ -37,6 +37,6 @@
3737 android:gravity="right"
3838 android:text="VALUE"
3939 android:textSize="20sp"
40- android:textColor="@android:color/white"
40+ android:textColor="?android:textColorPrimary"
4141 />
4242 </LinearLayout>
\ No newline at end of file
--- a/intent-lab/res/layout/flag_list_item.xml
+++ b/intent-lab/res/layout/flag_list_item.xml
@@ -1,5 +1,6 @@
11 <?xml version="1.0" encoding="utf-8"?>
2-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+<LinearLayout
3+ xmlns:android="http://schemas.android.com/apk/res/android"
34 android:layout_width="fill_parent"
45 android:layout_height="wrap_content"
56 android:orientation="vertical"
@@ -8,9 +9,12 @@
89 android:paddingTop="@dimen/list_item_paddingTop"
910 android:paddingBottom="@dimen/list_item_paddingBottom"
1011 >
11- <TextView
12- style="@style/key"
12+ <TextView
1313 android:id="@+id/flag_name_textview"
14+ android:layout_width="fill_parent"
15+ android:layout_height="wrap_content"
16+ android:gravity="left"
1417 android:textSize="14sp"
18+ android:textColor="?android:textColorPrimary"
1519 />
1620 </LinearLayout>
\ No newline at end of file
--- a/intent-lab/res/layout/intent_detail_item.xml
+++ b/intent-lab/res/layout/intent_detail_item.xml
@@ -123,12 +123,23 @@
123123 style="@style/key"
124124 android:text="@string/categories"
125125 />
126- <TextView
127- style="@style/value"
128- android:id="@+id/categories_textview"
129- android:hint="@string/categories"
130- android:lineSpacingMultiplier="1.4"
131- />
126+ <FrameLayout
127+ android:layout_width="fill_parent"
128+ android:layout_height="wrap_content"
129+ >
130+ <LinearLayout
131+ android:id="@+id/categories_container"
132+ android:layout_width="fill_parent"
133+ android:layout_height="wrap_content"
134+ android:orientation="vertical"
135+ />
136+ <TextView
137+ android:id="@+id/no_category_textview"
138+ style="@style/value"
139+ android:hint="@string/no_category"
140+ android:text=""
141+ />
142+ </FrameLayout>
132143 </LinearLayout>
133144
134145 <!-- Extras -->
@@ -142,18 +153,53 @@
142153 style="@style/key"
143154 android:text="@string/extras"
144155 />
145- <LinearLayout
146- android:id="@+id/extras_container"
156+ <FrameLayout
147157 android:layout_width="fill_parent"
148158 android:layout_height="wrap_content"
149- android:orientation="vertical"
150159 >
160+ <LinearLayout
161+ android:id="@+id/extras_container"
162+ android:layout_width="fill_parent"
163+ android:layout_height="wrap_content"
164+ android:orientation="vertical"
165+ />
151166 <TextView
167+ android:id="@+id/no_extra_textview"
152168 style="@style/value"
153169 android:hint="@string/no_extra"
154170 android:text=""
155171 />
156- </LinearLayout>
172+ </FrameLayout>
173+ </LinearLayout>
174+
175+ <!-- Flags -->
176+ <LinearLayout
177+ android:id="@+id/intent_detail_item_flags"
178+ android:layout_width="fill_parent"
179+ android:layout_height="wrap_content"
180+ android:orientation="vertical"
181+ >
182+ <TextView
183+ style="@style/key"
184+ android:text="@string/flags"
185+ />
186+ <FrameLayout
187+ android:layout_width="fill_parent"
188+ android:layout_height="wrap_content"
189+ >
190+ <LinearLayout
191+ android:id="@+id/flags_container"
192+ android:layout_width="fill_parent"
193+ android:layout_height="wrap_content"
194+ android:orientation="vertical"
195+ />
196+ <TextView
197+ android:id="@+id/no_flag_textview"
198+ style="@style/value"
199+ android:hint="@string/no_flag"
200+ android:text=""
201+ />
202+ </FrameLayout>
157203 </LinearLayout>
158204
159205 </FrameLayout>
\ No newline at end of file
--- a/intent-lab/src/org/routine_work/intent_lab/intent/IntentDetailActivity2.java
+++ b/intent-lab/src/org/routine_work/intent_lab/intent/IntentDetailActivity2.java
@@ -32,7 +32,8 @@ public class IntentDetailActivity2 extends ListActivity
3232 private static final int POSITION_DATA_URI = 3;
3333 private static final int POSITION_DATA_TYPE = 4;
3434 private static final int POSITION_CATEGORIES = 5;
35- private static final int POSITION_EXTRAS = 6;
35+ private static final int POSITION_FLAGS = 6;
36+ private static final int POSITION_EXTRAS = 7;
3637 // data
3738 private Uri targetUri;
3839 private String targetName;
@@ -114,67 +115,6 @@ public class IntentDetailActivity2 extends ListActivity
114115 return title;
115116 }
116117
117- private void bindExtras(ViewGroup extraContainer, Bundle extras)
118- {
119- Log.v(LOG_TAG, "Hello");
120-
121- Log.d(LOG_TAG, "extras => " + extras);
122- if (extras != null)
123- {
124- extraContainer.removeAllViews();
125-
126- LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
127- for (String key : extras.keySet())
128- {
129- Object value = extras.get(key);
130- String type = value.getClass().getSimpleName();
131- Log.d(LOG_TAG, "extra key => " + key);
132- Log.d(LOG_TAG, "extra value => " + value);
133-
134- View extraItem = inflater.inflate(R.layout.extra_list_item, null);
135- TextView keyTextView = (TextView) extraItem.findViewById(R.id.extra_key_textview);
136- TextView typeTextView = (TextView) extraItem.findViewById(R.id.extra_type_textview);
137- TextView valueTextView = (TextView) extraItem.findViewById(R.id.extra_value_textview);
138-
139- keyTextView.setText(key);
140- typeTextView.setText(type);
141- valueTextView.setText(value.toString());
142- extraContainer.addView(extraItem);
143- }
144- }
145- Log.v(LOG_TAG, "Bye");
146- }
147-
148- /*
149- private void initializeFlags(Intent targetIntent)
150- {
151- Log.v(LOG_TAG, "Hello");
152-
153- int flags = targetIntent.getFlags();
154- Log.d(LOG_TAG, "flags => " + flags);
155- if (flags != 0)
156- {
157- ViewGroup flagsViewGroup = (ViewGroup) findViewById(R.id.flags_section);
158- flagsViewGroup.removeAllViews();
159-
160- LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
161- for (int i = 0; i < IntentFlags.FLAG_VALUES.length; i++)
162- {
163- int flagValue = IntentFlags.FLAG_VALUES[i];
164- String flagName = IntentFlags.FLAG_NAMES[i];
165- if ((flags & flagValue) != 0)
166- {
167- Log.d(LOG_TAG, "flag name => " + flagName);
168- View flagItem = inflater.inflate(R.layout.flag_list_item, flagsViewGroup, true);
169- TextView flagNameTextView = (TextView) flagItem.findViewById(R.id.flag_name_textview);
170- flagNameTextView.setText(flagName);
171- }
172- }
173- }
174-
175- Log.v(LOG_TAG, "Bye");
176- }
177- */
178118 class IntentDetailListAdapter extends BaseAdapter
179119 {
180120
@@ -187,7 +127,7 @@ public class IntentDetailActivity2 extends ListActivity
187127
188128 public int getCount()
189129 {
190- return 7;
130+ return 8;
191131 }
192132
193133 public Object getItem(int position)
@@ -213,6 +153,9 @@ public class IntentDetailActivity2 extends ListActivity
213153 case POSITION_CATEGORIES:
214154 result = targetIntent.getCategories();
215155 break;
156+ case POSITION_FLAGS:
157+ result = targetIntent.getFlags();
158+ break;
216159 case POSITION_EXTRAS:
217160 result = targetIntent.getExtras();
218161 break;
@@ -245,6 +188,7 @@ public class IntentDetailActivity2 extends ListActivity
245188 View dataTypeView = itemView.findViewById(R.id.intent_detail_item_data_type);
246189 View categoriesView = itemView.findViewById(R.id.intent_detail_item_categories);
247190 View extrasView = itemView.findViewById(R.id.intent_detail_item_extras);
191+ View flagsView = itemView.findViewById(R.id.intent_detail_item_flags);
248192
249193 nameView.setVisibility(View.GONE);
250194 actionView.setVisibility(View.GONE);
@@ -253,6 +197,7 @@ public class IntentDetailActivity2 extends ListActivity
253197 dataTypeView.setVisibility(View.GONE);
254198 categoriesView.setVisibility(View.GONE);
255199 extrasView.setVisibility(View.GONE);
200+ flagsView.setVisibility(View.GONE);
256201
257202 Object item = getItem(position);
258203 switch (position)
@@ -313,31 +258,24 @@ public class IntentDetailActivity2 extends ListActivity
313258 dataTypeView.setVisibility(View.VISIBLE);
314259 break;
315260 case POSITION_CATEGORIES:
316- String categoriesText = null;
317261 if (item instanceof Set)
318262 {
319263 Set<String> categoriesSet = (Set<String>) item;
320- StringBuilder buffer = new StringBuilder();
321- for (String category : categoriesSet)
322- {
323- buffer.append(category);
324- buffer.append("\n");
325- }
326- if (buffer.length() > 0)
327- {
328- buffer.delete(buffer.length() - 1, buffer.length());
329- }
330- categoriesText = buffer.toString();
264+ bindCategories(categoriesView, categoriesSet);
331265 }
332- TextView categoriesTextView = (TextView) categoriesView.findViewById(R.id.categories_textview);
333- categoriesTextView.setText(categoriesText);
334266 categoriesView.setVisibility(View.VISIBLE);
335267 break;
268+ case POSITION_FLAGS:
269+ if (item instanceof Integer)
270+ {
271+ bindFlags(flagsView, (Integer) item);
272+ }
273+ flagsView.setVisibility(View.VISIBLE);
274+ break;
336275 case POSITION_EXTRAS:
337276 if (item instanceof Bundle)
338277 {
339- LinearLayout extraContainer = (LinearLayout) extrasView.findViewById(R.id.extras_container);
340- bindExtras(extraContainer, (Bundle) item);
278+ bindExtras(extrasView, (Bundle) item);
341279 }
342280 extrasView.setVisibility(View.VISIBLE);
343281 break;
@@ -346,5 +284,121 @@ public class IntentDetailActivity2 extends ListActivity
346284 Log.d(LOG_TAG, "Bye");
347285 return itemView;
348286 }
287+
288+ private void bindCategories(View categoriesView, Set<String> categories)
289+ {
290+ Log.v(LOG_TAG, "Hello");
291+ Log.d(LOG_TAG, "categories => " + categories);
292+
293+ LinearLayout categoriesContainer = (LinearLayout) categoriesView.findViewById(R.id.categories_container);
294+ TextView noCategoryTextView = (TextView) categoriesView.findViewById(R.id.no_category_textview);
295+
296+ if (categories != null && categories.size() > 0)
297+ {
298+ Log.d(LOG_TAG, "categories.size() => " + categories.size());
299+ categoriesContainer.removeAllViews();
300+
301+ for (String category : categories)
302+ {
303+ View categoryItem = inflater.inflate(R.layout.category_list_item, null);
304+ TextView categoryTextView = (TextView) categoryItem.findViewById(R.id.category_textview);
305+ Log.d(LOG_TAG, "categoryTextView=> " + categoryTextView);
306+ categoryTextView.setText(category);
307+
308+ categoriesContainer.addView(categoryItem);
309+ }
310+
311+ categoriesContainer.setVisibility(View.VISIBLE);
312+ noCategoryTextView.setVisibility(View.GONE);
313+ }
314+ else
315+ {
316+ categoriesContainer.setVisibility(View.GONE);
317+ noCategoryTextView.setVisibility(View.VISIBLE);
318+ }
319+
320+ Log.v(LOG_TAG, "Bye");
321+ }
322+
323+ private void bindFlags(View flagsView, int flags)
324+ {
325+ Log.v(LOG_TAG, "Hello");
326+
327+ LinearLayout flagsContainer = (LinearLayout) flagsView.findViewById(R.id.flags_container);
328+ TextView noFlagTextView = (TextView) flagsView.findViewById(R.id.no_flag_textview);
329+
330+ Log.d(LOG_TAG, "flags => " + flags);
331+ if (flags != 0)
332+ {
333+ flagsContainer.removeAllViews();
334+
335+ for (int i = 0; i < IntentFlags.FLAG_VALUES.length; i++)
336+ {
337+ int flagValue = IntentFlags.FLAG_VALUES[i];
338+ String flagName = IntentFlags.FLAG_NAMES[i];
339+ if ((flags & flagValue) != 0)
340+ {
341+ Log.d(LOG_TAG, "flag name => " + flagName);
342+ View flagItemView = inflater.inflate(R.layout.flag_list_item, null);
343+ TextView flagNameTextView = (TextView) flagItemView.findViewById(R.id.flag_name_textview);
344+ flagNameTextView.setText(flagName);
345+
346+ flagsContainer.addView(flagItemView);
347+ }
348+ }
349+
350+ noFlagTextView.setVisibility(View.GONE);
351+ flagsContainer.setVisibility(View.VISIBLE);
352+ }
353+ else
354+ {
355+ noFlagTextView.setVisibility(View.VISIBLE);
356+ flagsContainer.setVisibility(View.GONE);
357+ }
358+
359+ Log.v(LOG_TAG, "Bye");
360+ }
361+
362+ private void bindExtras(View extrasView, Bundle extras)
363+ {
364+ Log.v(LOG_TAG, "Hello");
365+
366+ LinearLayout extraContainer = (LinearLayout) extrasView.findViewById(R.id.extras_container);
367+ TextView noExtraTextView = (TextView) extrasView.findViewById(R.id.no_extra_textview);
368+
369+ Log.d(LOG_TAG, "extras => " + extras);
370+ if (extras != null)
371+ {
372+ extraContainer.removeAllViews();
373+
374+ for (String key : extras.keySet())
375+ {
376+ Object value = extras.get(key);
377+ String type = value.getClass().getSimpleName();
378+ Log.d(LOG_TAG, "extra key => " + key);
379+ Log.d(LOG_TAG, "extra value => " + value);
380+
381+ View extraItem = inflater.inflate(R.layout.extra_list_item, null);
382+ TextView keyTextView = (TextView) extraItem.findViewById(R.id.extra_key_textview);
383+ TextView typeTextView = (TextView) extraItem.findViewById(R.id.extra_type_textview);
384+ TextView valueTextView = (TextView) extraItem.findViewById(R.id.extra_value_textview);
385+
386+ keyTextView.setText(key);
387+ typeTextView.setText(type);
388+ valueTextView.setText(value.toString());
389+ extraContainer.addView(extraItem);
390+ }
391+
392+ extraContainer.setVisibility(View.VISIBLE);
393+ noExtraTextView.setVisibility(View.GONE);
394+ }
395+ else
396+ {
397+ extraContainer.setVisibility(View.GONE);
398+ noExtraTextView.setVisibility(View.VISIBLE);
399+ }
400+
401+ Log.v(LOG_TAG, "Bye");
402+ }
349403 }
350404 }