AppCompatMenuItemShortcutsTestActivity.java revision b31c3281d870e9abb673db239234d580dcc4feff
1/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package androidx.appcompat.app;
17
18import androidx.appcompat.test.R;
19import android.view.Menu;
20import android.view.MenuInflater;
21import android.view.MenuItem;
22
23public class AppCompatMenuItemShortcutsTestActivity extends AppCompatActivity {
24
25    @Override
26    public boolean onCreateOptionsMenu(Menu menu) {
27        MenuInflater inflater = getMenuInflater();
28        inflater.inflate(R.menu.appcompat_menu_shortcut, menu);
29        return true;
30    }
31
32    private int mMenuItemIdTracker;
33
34    public int getMenuItemIdTracker() {
35        return mMenuItemIdTracker;
36    }
37
38    public boolean handleMenuItem(MenuItem item) {
39        mMenuItemIdTracker = item.getItemId();
40        return true;
41    }
42}
43