/ABSherlock/src/com/actionbarsherlock/internal/view/menu/MenuItemMule.java
Java | 234 lines | 184 code | 48 blank | 2 comment | 0 complexity | cdfc2379540fd2a20d55f265317edc56 MD5 | raw file
1package com.actionbarsherlock.internal.view.menu;
2
3import android.content.Intent;
4import android.graphics.drawable.Drawable;
5import android.view.ActionProvider;
6import android.view.MenuItem;
7import android.view.SubMenu;
8import android.view.View;
9import android.view.ContextMenu.ContextMenuInfo;
10
11/** Used to carry an instance of our version of MenuItem through a native channel. */
12public class MenuItemMule implements MenuItem {
13 private static final String ERROR = "Cannot interact with object designed for temporary "
14 + "instance passing. Make sure you using both SherlockFragmentActivity and "
15 + "SherlockFragment.";
16
17
18 private final com.actionbarsherlock.view.MenuItem mItem;
19
20 public MenuItemMule(com.actionbarsherlock.view.MenuItem item) {
21 mItem = item;
22 }
23
24 public com.actionbarsherlock.view.MenuItem unwrap() {
25 return mItem;
26 }
27
28
29 @Override
30 public boolean collapseActionView() {
31 throw new IllegalStateException(ERROR);
32 }
33
34 @Override
35 public boolean expandActionView() {
36 throw new IllegalStateException(ERROR);
37 }
38
39 @Override
40 public ActionProvider getActionProvider() {
41 throw new IllegalStateException(ERROR);
42 }
43
44 @Override
45 public View getActionView() {
46 throw new IllegalStateException(ERROR);
47 }
48
49 @Override
50 public char getAlphabeticShortcut() {
51 throw new IllegalStateException(ERROR);
52 }
53
54 @Override
55 public int getGroupId() {
56 throw new IllegalStateException(ERROR);
57 }
58
59 @Override
60 public Drawable getIcon() {
61 throw new IllegalStateException(ERROR);
62 }
63
64 @Override
65 public Intent getIntent() {
66 throw new IllegalStateException(ERROR);
67 }
68
69 @Override
70 public int getItemId() {
71 throw new IllegalStateException(ERROR);
72 }
73
74 @Override
75 public ContextMenuInfo getMenuInfo() {
76 throw new IllegalStateException(ERROR);
77 }
78
79 @Override
80 public char getNumericShortcut() {
81 throw new IllegalStateException(ERROR);
82 }
83
84 @Override
85 public int getOrder() {
86 throw new IllegalStateException(ERROR);
87 }
88
89 @Override
90 public SubMenu getSubMenu() {
91 throw new IllegalStateException(ERROR);
92 }
93
94 @Override
95 public CharSequence getTitle() {
96 throw new IllegalStateException(ERROR);
97 }
98
99 @Override
100 public CharSequence getTitleCondensed() {
101 return mItem.getTitleCondensed();
102 //throw new IllegalStateException(ERROR);
103 }
104
105 @Override
106 public boolean hasSubMenu() {
107 throw new IllegalStateException(ERROR);
108 }
109
110 @Override
111 public boolean isActionViewExpanded() {
112 throw new IllegalStateException(ERROR);
113 }
114
115 @Override
116 public boolean isCheckable() {
117 throw new IllegalStateException(ERROR);
118 }
119
120 @Override
121 public boolean isChecked() {
122 throw new IllegalStateException(ERROR);
123 }
124
125 @Override
126 public boolean isEnabled() {
127 throw new IllegalStateException(ERROR);
128 }
129
130 @Override
131 public boolean isVisible() {
132 throw new IllegalStateException(ERROR);
133 }
134
135 @Override
136 public MenuItem setActionProvider(ActionProvider arg0) {
137 throw new IllegalStateException(ERROR);
138 }
139
140 @Override
141 public MenuItem setActionView(View arg0) {
142 throw new IllegalStateException(ERROR);
143 }
144
145 @Override
146 public MenuItem setActionView(int arg0) {
147 throw new IllegalStateException(ERROR);
148 }
149
150 @Override
151 public MenuItem setAlphabeticShortcut(char arg0) {
152 throw new IllegalStateException(ERROR);
153 }
154
155 @Override
156 public MenuItem setCheckable(boolean arg0) {
157 throw new IllegalStateException(ERROR);
158 }
159
160 @Override
161 public MenuItem setChecked(boolean arg0) {
162 throw new IllegalStateException(ERROR);
163 }
164
165 @Override
166 public MenuItem setEnabled(boolean arg0) {
167 throw new IllegalStateException(ERROR);
168 }
169
170 @Override
171 public MenuItem setIcon(Drawable arg0) {
172 throw new IllegalStateException(ERROR);
173 }
174
175 @Override
176 public MenuItem setIcon(int arg0) {
177 throw new IllegalStateException(ERROR);
178 }
179
180 @Override
181 public MenuItem setIntent(Intent arg0) {
182 throw new IllegalStateException(ERROR);
183 }
184
185 @Override
186 public MenuItem setNumericShortcut(char arg0) {
187 throw new IllegalStateException(ERROR);
188 }
189
190 @Override
191 public MenuItem setOnActionExpandListener(OnActionExpandListener arg0) {
192 throw new IllegalStateException(ERROR);
193 }
194
195 @Override
196 public MenuItem setOnMenuItemClickListener(OnMenuItemClickListener arg0) {
197 throw new IllegalStateException(ERROR);
198 }
199
200 @Override
201 public MenuItem setShortcut(char arg0, char arg1) {
202 throw new IllegalStateException(ERROR);
203 }
204
205 @Override
206 public void setShowAsAction(int arg0) {
207 throw new IllegalStateException(ERROR);
208 }
209
210 @Override
211 public MenuItem setShowAsActionFlags(int arg0) {
212 throw new IllegalStateException(ERROR);
213 }
214
215 @Override
216 public MenuItem setTitle(CharSequence arg0) {
217 throw new IllegalStateException(ERROR);
218 }
219
220 @Override
221 public MenuItem setTitle(int arg0) {
222 throw new IllegalStateException(ERROR);
223 }
224
225 @Override
226 public MenuItem setTitleCondensed(CharSequence arg0) {
227 throw new IllegalStateException(ERROR);
228 }
229
230 @Override
231 public MenuItem setVisible(boolean arg0) {
232 throw new IllegalStateException(ERROR);
233 }
234}