Revision | bc6d8580ac41df7a1c6642547911c0b84bdb5642 (tree) |
---|---|
Time | 2013-02-04 18:10:52 |
Author | Masahiko, SAWAI <say@user...> |
Commiter | Masahiko, SAWAI |
Added action bar in ResolveInfoListActivity
@@ -10,4 +10,6 @@ | ||
10 | 10 | ** ACTION_INSERT への対応 |
11 | 11 | ** 各項目の編集画面一覧の作成 |
12 | 12 | |
13 | +* ResolveInfoListActivity | |
14 | +** 各項目にデフォルト設定済みかどうかが分かるようにしたい | |
13 | 15 |
@@ -20,8 +20,9 @@ | ||
20 | 20 | --> |
21 | 21 | |
22 | 22 | <!-- Intent List --> |
23 | - <activity android:name=".intent.IntentListActivity" | |
24 | - android:label="@string/app_name" | |
23 | + <activity | |
24 | + android:name=".intent.IntentListActivity" | |
25 | + android:label="@string/app_name" | |
25 | 26 | > |
26 | 27 | <intent-filter> |
27 | 28 | <action android:name="android.intent.action.MAIN" /> |
@@ -39,8 +40,9 @@ | ||
39 | 40 | </activity> |
40 | 41 | |
41 | 42 | <!-- Action List --> |
42 | - <activity android:name=".action.ActionListActivity" | |
43 | - android:label="Action List" | |
43 | + <activity | |
44 | + android:name=".action.ActionListActivity" | |
45 | + android:label="Action List" | |
44 | 46 | > |
45 | 47 | <intent-filter> |
46 | 48 | <action android:name="android.intent.action.MAIN" /> |
@@ -49,10 +51,10 @@ | ||
49 | 51 | </activity> |
50 | 52 | |
51 | 53 | <!-- Activity List Viewer --> |
52 | - <activity android:name=".ResolveInfoListActivity" /> | |
53 | - <!-- | |
54 | - android:theme="@android:style/Theme.Dialog" | |
55 | - --> | |
54 | + <activity | |
55 | + android:name=".ResolveInfoListActivity" | |
56 | + android:label="@string/activity_list" | |
57 | + /> | |
56 | 58 | |
57 | 59 | <!-- Common Activity --> |
58 | 60 | <activity android:name=".common.EditTextActivity" /> |
@@ -24,156 +24,7 @@ | ||
24 | 24 | /> |
25 | 25 | </LinearLayout> |
26 | 26 | |
27 | - <!-- content --> | |
28 | - <ScrollView | |
29 | - android:layout_width="fill_parent" | |
30 | - android:layout_height="fill_parent" | |
31 | - > | |
32 | - <LinearLayout | |
33 | - android:layout_width="fill_parent" | |
34 | - android:layout_height="fill_parent" | |
35 | - android:orientation="vertical" | |
36 | - > | |
37 | - <!-- Title --> | |
38 | - <TextView | |
39 | - style="@style/header" | |
40 | - android:text="@string/title" | |
41 | - /> | |
42 | - <LinearLayout style="@style/section" android:focusable="true" android:clickable="true" > | |
43 | - <TextView | |
44 | - android:id="@+id/title_textview" | |
45 | - android:layout_width="fill_parent" | |
46 | - android:layout_height="wrap_content" | |
47 | - android:layout_margin="6dip" | |
48 | - android:textSize="20sp" | |
49 | - android:textColor="?android:textColorPrimary" | |
50 | - /> | |
51 | - </LinearLayout> | |
52 | - | |
53 | - <!-- Section Action --> | |
54 | - <TextView | |
55 | - style="@style/header" | |
56 | - android:text="@string/action" | |
57 | - /> | |
58 | - | |
59 | - <LinearLayout style="@style/section" android:focusable="true" android:clickable="true" > | |
60 | - <TextView | |
61 | - style="@style/key" | |
62 | - android:text="@string/action_name" | |
63 | - /> | |
64 | - <TextView | |
65 | - style="@style/value" | |
66 | - android:id="@+id/action_textview" | |
67 | - /> | |
68 | - </LinearLayout> | |
69 | - | |
70 | - <!-- Component --> | |
71 | - <TextView | |
72 | - style="@style/header" | |
73 | - android:text="@string/component" | |
74 | - /> | |
75 | - | |
76 | - <LinearLayout style="@style/section" android:focusable="true" android:clickable="true" > | |
77 | - <TextView | |
78 | - style="@style/key" | |
79 | - android:text="@string/component_package" | |
80 | - /> | |
81 | - <TextView | |
82 | - style="@style/value" | |
83 | - android:id="@+id/component_package_textview" | |
84 | - /> | |
85 | - | |
86 | - <TextView | |
87 | - style="@style/key" | |
88 | - android:text="@string/component_class" | |
89 | - /> | |
90 | - <TextView | |
91 | - style="@style/value" | |
92 | - android:id="@+id/component_class_textview" | |
93 | - /> | |
94 | - </LinearLayout> | |
95 | - | |
96 | - <!-- Data --> | |
97 | - <TextView | |
98 | - style="@style/header" | |
99 | - android:text="@string/data" | |
100 | - /> | |
101 | - | |
102 | - <LinearLayout style="@style/section" android:focusable="true" android:clickable="true" > | |
103 | - <TextView | |
104 | - style="@style/key" | |
105 | - android:text="@string/data_uri" | |
106 | - /> | |
107 | - <TextView | |
108 | - style="@style/value" | |
109 | - android:id="@+id/data_uri_textview" | |
110 | - /> | |
111 | - | |
112 | - <TextView | |
113 | - style="@style/key" | |
114 | - android:text="@string/data_type" | |
115 | - /> | |
116 | - <TextView | |
117 | - style="@style/value" | |
118 | - android:id="@+id/data_type_textview" | |
119 | - /> | |
120 | - </LinearLayout> | |
121 | - | |
122 | - <!-- Category --> | |
123 | - <TextView | |
124 | - style="@style/header" | |
125 | - android:text="@string/categories" | |
126 | - /> | |
127 | - <LinearLayout | |
128 | - style="@style/section" | |
129 | - android:id="@+id/categories_section" | |
130 | - > | |
131 | - <TextView | |
132 | - android:layout_width="wrap_content" | |
133 | - android:layout_height="wrap_content" | |
134 | - android:layout_gravity="center" | |
135 | - android:text="@string/no_category" | |
136 | - android:textSize="20sp" | |
137 | - /> | |
138 | - </LinearLayout> | |
139 | - | |
140 | - <!-- Extras --> | |
141 | - <TextView | |
142 | - style="@style/header" | |
143 | - android:text="@string/extras" | |
144 | - /> | |
145 | - <LinearLayout | |
146 | - style="@style/section" | |
147 | - android:id="@+id/extras_section" | |
148 | - > | |
149 | - <TextView | |
150 | - android:layout_width="wrap_content" | |
151 | - android:layout_height="wrap_content" | |
152 | - android:layout_gravity="center" | |
153 | - android:text="@string/no_extra" | |
154 | - android:textSize="20sp" | |
155 | - /> | |
156 | - </LinearLayout> | |
157 | - | |
158 | - <!-- Flags --> | |
159 | - <TextView | |
160 | - style="@style/header" | |
161 | - android:text="@string/flags" | |
162 | - /> | |
163 | - <LinearLayout | |
164 | - style="@style/section" | |
165 | - android:id="@+id/flags_section" | |
166 | - > | |
167 | - <TextView | |
168 | - android:layout_width="wrap_content" | |
169 | - android:layout_height="wrap_content" | |
170 | - android:layout_gravity="center" | |
171 | - android:text="@string/no_flag" | |
172 | - android:textSize="20sp" | |
173 | - /> | |
174 | - </LinearLayout> | |
175 | - | |
176 | - </LinearLayout> | |
177 | - </ScrollView> | |
27 | + <!-- list --> | |
28 | + <include layout="@layout/simple_list" /> | |
178 | 29 | |
179 | 30 | </LinearLayout> |
\ No newline at end of file |
@@ -1,30 +0,0 @@ | ||
1 | -<?xml version="1.0" encoding="utf-8"?> | |
2 | -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
3 | - android:layout_width="fill_parent" | |
4 | - android:layout_height="fill_parent" | |
5 | - android:orientation="vertical" | |
6 | -> | |
7 | - <!-- action bar --> | |
8 | - <LinearLayout | |
9 | - style="@style/actionbar" | |
10 | - > | |
11 | - <ImageButton | |
12 | - style="@style/actionbar_left_button" | |
13 | - android:id="@+id/home_button" | |
14 | - android:src="?attr/ic_home" | |
15 | - /> | |
16 | - <TextView | |
17 | - style="@style/actionbar_title" | |
18 | - android:text="@string/edit_intent" | |
19 | - /> | |
20 | - <ImageButton | |
21 | - style="@style/actionbar_right_button" | |
22 | - android:id="@+id/ok_button" | |
23 | - android:src="?attr/ic_ok" | |
24 | - /> | |
25 | - </LinearLayout> | |
26 | - | |
27 | - <!-- list --> | |
28 | - <include layout="@layout/simple_list" /> | |
29 | - | |
30 | -</LinearLayout> | |
\ No newline at end of file |
@@ -1,9 +1,29 @@ | ||
1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | - android:layout_width="fill_parent" | |
4 | - android:layout_height="fill_parent" | |
5 | - android:orientation="vertical" | |
3 | + android:layout_width="fill_parent" | |
4 | + android:layout_height="fill_parent" | |
5 | + android:orientation="vertical" | |
6 | 6 | > |
7 | + <!-- action bar --> | |
8 | + <LinearLayout | |
9 | + style="@style/actionbar" | |
10 | + > | |
11 | + <ImageButton | |
12 | + style="@style/actionbar_left_button" | |
13 | + android:id="@+id/home_button" | |
14 | + android:src="?attr/ic_home" | |
15 | + /> | |
16 | + <TextView | |
17 | + style="@style/actionbar_title" | |
18 | + android:text="@string/activity_list" | |
19 | + /> | |
20 | + <ImageButton | |
21 | + style="@style/actionbar_right_button" | |
22 | + android:id="@+id/ok_button" | |
23 | + android:src="?attr/ic_ok" | |
24 | + /> | |
25 | + </LinearLayout> | |
26 | + | |
7 | 27 | <!-- list --> |
8 | 28 | <include layout="@layout/simple_list" /> |
9 | 29 | </LinearLayout> |
\ No newline at end of file |
@@ -43,6 +43,9 @@ | ||
43 | 43 | <string name="extras">Extras</string> |
44 | 44 | <string name="no_extra">No extra data</string> |
45 | 45 | |
46 | + <!-- ActivityList --> | |
47 | + <string name="activity_list">Activity List</string> | |
48 | + | |
46 | 49 | <!-- ActionList --> |
47 | 50 | <string name="action_list">Action List</string> |
48 | 51 | <string name="select_action">Select Action</string> |
@@ -9,6 +9,7 @@ import android.os.Parcelable; | ||
9 | 9 | import android.view.View; |
10 | 10 | import android.widget.AdapterView; |
11 | 11 | import android.widget.AdapterView.OnItemClickListener; |
12 | +import android.widget.ImageButton; | |
12 | 13 | import android.widget.ListView; |
13 | 14 | import android.widget.TextView; |
14 | 15 | import android.widget.Toast; |
@@ -16,21 +17,64 @@ import java.util.List; | ||
16 | 17 | import org.routine_work.utils.Log; |
17 | 18 | |
18 | 19 | public class ResolveInfoListActivity extends ListActivity |
19 | - implements OnItemClickListener | |
20 | + implements OnItemClickListener, View.OnClickListener | |
20 | 21 | { |
21 | 22 | |
22 | 23 | private static final String LOG_TAG = "intent-lab"; |
23 | 24 | private Intent targetIntent; |
24 | 25 | |
25 | - /** Called when the activity is first created. */ | |
26 | + public void onClick(View v) | |
27 | + { | |
28 | + Log.v(LOG_TAG, "Hello"); | |
29 | + | |
30 | + switch (v.getId()) | |
31 | + { | |
32 | + case R.id.home_button: | |
33 | + Log.d(LOG_TAG, "home_button is clicked."); | |
34 | + finish(); | |
35 | + break; | |
36 | + case R.id.ok_button: | |
37 | + Log.d(LOG_TAG, "ok_button is clicked."); | |
38 | + finish(); | |
39 | + break; | |
40 | + } | |
41 | + | |
42 | + Log.v(LOG_TAG, "Bye"); | |
43 | + } | |
44 | + | |
45 | + public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) | |
46 | + { | |
47 | + Log.v(LOG_TAG, "Hello"); | |
48 | + | |
49 | + TextView packageTextView = (TextView) view.findViewById(R.id.package_textview); | |
50 | + TextView nameTextView = (TextView) view.findViewById(R.id.name_textview); | |
51 | + String packageName = packageTextView.getText().toString(); | |
52 | + String className = nameTextView.getText().toString(); | |
53 | + | |
54 | + Intent intent = new Intent(targetIntent); | |
55 | + intent.setClassName(packageName, className); | |
56 | + startActivity(intent); | |
57 | + | |
58 | + Log.v(LOG_TAG, "Bye"); | |
59 | + } | |
60 | + | |
26 | 61 | @Override |
27 | - public void onCreate(Bundle savedInstanceState) | |
62 | + protected void onCreate(Bundle savedInstanceState) | |
28 | 63 | { |
29 | 64 | Log.v(LOG_TAG, "Hello"); |
30 | 65 | |
31 | 66 | super.onCreate(savedInstanceState); |
32 | 67 | setContentView(R.layout.resolve_info_list_activity); |
33 | 68 | |
69 | + // init listeners | |
70 | + ImageButton homeButton = (ImageButton) findViewById(R.id.home_button); | |
71 | + ImageButton okButton = (ImageButton) findViewById(R.id.ok_button); | |
72 | + homeButton.setOnClickListener(this); | |
73 | + okButton.setOnClickListener(this); | |
74 | + | |
75 | + ListView listView = getListView(); | |
76 | + listView.setOnItemClickListener(this); | |
77 | + | |
34 | 78 | // get target intent |
35 | 79 | Parcelable parcelableExtra = getIntent().getParcelableExtra(Intent.EXTRA_INTENT); |
36 | 80 | if (parcelableExtra instanceof Intent) |
@@ -71,24 +115,6 @@ public class ResolveInfoListActivity extends ListActivity | ||
71 | 115 | ResolveInfoAdapter resolveInfoAdapter = new ResolveInfoAdapter(this, activities); |
72 | 116 | setListAdapter(resolveInfoAdapter); |
73 | 117 | |
74 | - ListView listView = getListView(); | |
75 | - listView.setOnItemClickListener(this); | |
76 | - | |
77 | - Log.v(LOG_TAG, "Bye"); | |
78 | - } | |
79 | - | |
80 | - public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) | |
81 | - { | |
82 | - Log.v(LOG_TAG, "Hello"); | |
83 | - | |
84 | - TextView packageTextView = (TextView) view.findViewById(R.id.package_textview); | |
85 | - TextView nameTextView = (TextView) view.findViewById(R.id.name_textview); | |
86 | - String packageName = packageTextView.getText().toString(); | |
87 | - String className = nameTextView.getText().toString(); | |
88 | - | |
89 | - Intent intent = new Intent(targetIntent); | |
90 | - intent.setClassName(packageName, className); | |
91 | - startActivity(intent); | |
92 | 118 | |
93 | 119 | Log.v(LOG_TAG, "Bye"); |
94 | 120 | } |
@@ -81,7 +81,7 @@ public class IntentDetailActivity extends ListActivity | ||
81 | 81 | Log.v(LOG_TAG, "Hello"); |
82 | 82 | |
83 | 83 | super.onCreate(savedInstanceState); |
84 | - setContentView(R.layout.intent_detail_activity2); | |
84 | + setContentView(R.layout.intent_detail_activity); | |
85 | 85 | |
86 | 86 | ImageButton homeButton = (ImageButton) findViewById(R.id.home_button); |
87 | 87 | homeButton.setOnClickListener(this); |