1bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell/* 2bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Copyright (C) 2006 The Android Open Source Project 3bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 4bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Licensed under the Apache License, Version 2.0 (the "License"); 5bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * you may not use this file except in compliance with the License. 6bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * You may obtain a copy of the License at 7bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 8bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * http://www.apache.org/licenses/LICENSE-2.0 9bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 10bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Unless required by applicable law or agreed to in writing, software 11bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * distributed under the License is distributed on an "AS IS" BASIS, 12bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * See the License for the specific language governing permissions and 14bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * limitations under the License. 15bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 16bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 17da10fdd1400ecfd8d7f2e55651dd528d0614dfc5Jeff Brownpackage android.support.v7.internal.view.menu; 18bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 19bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.graphics.drawable.Drawable; 20bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 21bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell/** 2249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Minimal interface for a menu view. {@link #initialize(MenuBuilder)} must be called for the 2349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * menu to be functional. 24bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 25bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @hide 26bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 27bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellpublic interface MenuView { 28bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 2949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Initializes the menu to the given menu. This should be called after the 3049c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * view is inflated. 3120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 3220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @param menu The menu that this MenuView should display. 33bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 3420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns public void initialize(MenuBuilder menu); 35bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 36bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 3720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Returns the default animations to be used for this menu when entering/exiting. 3820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @return A resource ID for the default animations to be used for this menu. 39bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 4020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns public int getWindowAnimations(); 41bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 42bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 4349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Minimal interface for a menu item view. {@link #initialize(MenuItemImpl, int)} must be called 4449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * for the item to be functional. 45bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 4620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns public interface ItemView { 4720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns /** 4820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Initializes with the provided MenuItemData. This should be called after the view is 4920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * inflated. 5020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @param itemData The item that this ItemView should display. 5149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @param menuType The type of this menu, one of 5249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * {@link MenuBuilder#TYPE_ICON}, {@link MenuBuilder#TYPE_EXPANDED}, 5349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * {@link MenuBuilder#TYPE_DIALOG}). 5420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns */ 5520ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns public void initialize(MenuItemImpl itemData, int menuType); 56bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 5720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns /** 5820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Gets the item data that this view is displaying. 5920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @return the item data, or null if there is not one 6020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns */ 6120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns public MenuItemImpl getItemData(); 62bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 6320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns /** 6420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Sets the title of the item view. 6520ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @param title The title to set. 6620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns */ 6720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns public void setTitle(CharSequence title); 68bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 6920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns /** 7020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Sets the enabled state of the item view. 7120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @param enabled Whether the item view should be enabled. 7220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns */ 7320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns public void setEnabled(boolean enabled); 74bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 7520ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns /** 7620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Displays the checkbox for the item view. This does not ensure the item view will be 7720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * checked, for that use {@link #setChecked}. 7820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @param checkable Whether to display the checkbox or to hide it 7920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns */ 8020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns public void setCheckable(boolean checkable); 81bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 8220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns /** 8349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Checks the checkbox for the item view. If the checkbox is hidden, it will NOT be 8449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * made visible, call {@link #setCheckable(boolean)} for that. 8520ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @param checked Whether the checkbox should be checked 8620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns */ 8720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns public void setChecked(boolean checked); 8820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns 8920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns /** 9020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Sets the shortcut for the item. 9149c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @param showShortcut Whether a shortcut should be shown(if false, the value of 9249c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * shortcutKey should be ignored). 9349c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @param shortcutKey The shortcut key that should be shown on the ItemView. 9420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns */ 9520ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns public void setShortcut(boolean showShortcut, char shortcutKey); 9620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns 9720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns /** 9820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set the icon of this item view. 9920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @param icon The icon of this item. null to hide the icon. 10020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns */ 10120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns public void setIcon(Drawable icon); 10220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns 10320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns /** 10449c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * Whether this item view prefers displaying the condensed title rather 10549c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * than the normal title. If a condensed title is not available, the 10649c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * normal title will be used. 10720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 10849c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * @return Whether this item view prefers displaying the condensed 10949c78900da0d43140fb602431fb93212bd7f6c70Chris Banes * title. 11020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns */ 11120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns public boolean prefersCondensedTitle(); 11220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns 11320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns /** 11420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Whether this item view shows an icon. 11520ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 11620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @return Whether this item view shows an icon. 11720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns */ 11820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns public boolean showsIcon(); 11920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns } 120bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell} 121