aboutsummaryrefslogtreecommitdiffstats
path: root/com_actionbarsherlock/src/com/actionbarsherlock/internal/view/menu/MenuMule.java
blob: 183e87a564002395f5c691a429c01540aa49585d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
package com.actionbarsherlock.internal.view.menu;

import android.content.ComponentName;
import android.content.Intent;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.SubMenu;

/** Used to carry an instance of our version of Menu through a native channel. */
public class MenuMule implements Menu {
    private static final String ERROR = "Cannot interact with object designed for temporary "
            + "instance passing. Make sure you using both SherlockFragmentActivity and "
            + "SherlockFragment.";


    private final com.actionbarsherlock.view.Menu mMenu;

    public MenuMule(com.actionbarsherlock.view.Menu menu) {
        mMenu = menu;
    }

    public com.actionbarsherlock.view.Menu unwrap() {
        return mMenu;
    }


    @Override
    public MenuItem add(CharSequence arg0) {
        throw new IllegalStateException(ERROR);
    }

    @Override
    public MenuItem add(int arg0) {
        throw new IllegalStateException(ERROR);
    }

    @Override
    public MenuItem add(int arg0, int arg1, int arg2, CharSequence arg3) {
        throw new IllegalStateException(ERROR);
    }

    @Override
    public MenuItem add(int arg0, int arg1, int arg2, int arg3) {
        throw new IllegalStateException(ERROR);
    }

    @Override
    public int addIntentOptions(int arg0, int arg1, int arg2,
            ComponentName arg3, Intent[] arg4, Intent arg5, int arg6,
            MenuItem[] arg7) {
        throw new IllegalStateException(ERROR);
    }

    @Override
    public SubMenu addSubMenu(CharSequence arg0) {
        throw new IllegalStateException(ERROR);
    }

    @Override
    public SubMenu addSubMenu(int arg0) {
        throw new IllegalStateException(ERROR);
    }

    @Override
    public SubMenu addSubMenu(int arg0, int arg1, int arg2, CharSequence arg3) {
        throw new IllegalStateException(ERROR);
    }

    @Override
    public SubMenu addSubMenu(int arg0, int arg1, int arg2, int arg3) {
        throw new IllegalStateException(ERROR);
    }

    @Override
    public void clear() {
        throw new IllegalStateException(ERROR);
    }

    @Override
    public void close() {
        throw new IllegalStateException(ERROR);
    }

    @Override
    public MenuItem findItem(int arg0) {
        throw new IllegalStateException(ERROR);
    }

    @Override
    public MenuItem getItem(int arg0) {
        throw new IllegalStateException(ERROR);
    }

    @Override
    public boolean hasVisibleItems() {
        return mMenu.hasVisibleItems();
        //throw new IllegalStateException(ERROR);
    }

    @Override
    public boolean isShortcutKey(int arg0, KeyEvent arg1) {
        throw new IllegalStateException(ERROR);
    }

    @Override
    public boolean performIdentifierAction(int arg0, int arg1) {
        throw new IllegalStateException(ERROR);
    }

    @Override
    public boolean performShortcut(int arg0, KeyEvent arg1, int arg2) {
        throw new IllegalStateException(ERROR);
    }

    @Override
    public void removeGroup(int arg0) {
        throw new IllegalStateException(ERROR);
    }

    @Override
    public void removeItem(int arg0) {
        throw new IllegalStateException(ERROR);
    }

    @Override
    public void setGroupCheckable(int arg0, boolean arg1, boolean arg2) {
        throw new IllegalStateException(ERROR);
    }

    @Override
    public void setGroupEnabled(int arg0, boolean arg1) {
        throw new IllegalStateException(ERROR);
    }

    @Override
    public void setGroupVisible(int arg0, boolean arg1) {
        throw new IllegalStateException(ERROR);
    }

    @Override
    public void setQwertyMode(boolean arg0) {
        throw new IllegalStateException(ERROR);
    }

    @Override
    public int size() {
        throw new IllegalStateException(ERROR);
    }
}