If you think the Android project iosched2011 listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
/*
* Copyright 2011 Google Inc.//www.java2s.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/package com.google.android.apps.iosched.util;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.view.ContextMenu;
import android.view.MenuItem;
import android.view.SubMenu;
import android.view.View;
/**
* A <em>really</em> dumb implementation of the {@link MenuItem} interface, that's only useful for
* our old-actionbar purposes. See <code>com.android.internal.view.menu.MenuItemImpl</code> in
* AOSP for a more complete implementation.
*/publicclass SimpleMenuItem implements MenuItem {
private SimpleMenu mMenu;
privatefinalint mId;
privatefinalint mOrder;
private CharSequence mTitle;
private CharSequence mTitleCondensed;
private Drawable mIconDrawable;
privateint mIconResId = 0;
privateboolean mEnabled = true;
public SimpleMenuItem(SimpleMenu menu, int id, int order, CharSequence title) {
mMenu = menu;
mId = id;
mOrder = order;
mTitle = title;
}
publicint getItemId() {
return mId;
}
publicint getOrder() {
return mOrder;
}
public MenuItem setTitle(CharSequence title) {
mTitle = title;
returnthis;
}
public MenuItem setTitle(int titleRes) {
return setTitle(mMenu.getContext().getString(titleRes));
}
public CharSequence getTitle() {
return mTitle;
}
public MenuItem setTitleCondensed(CharSequence title) {
mTitleCondensed = title;
returnthis;
}
public CharSequence getTitleCondensed() {
return mTitleCondensed != null ? mTitleCondensed : mTitle;
}
public MenuItem setIcon(Drawable icon) {
mIconResId = 0;
mIconDrawable = icon;
returnthis;
}
public MenuItem setIcon(int iconResId) {
mIconDrawable = null;
mIconResId = iconResId;
returnthis;
}
public Drawable getIcon() {
if (mIconDrawable != null) {
return mIconDrawable;
}
if (mIconResId != 0) {
return mMenu.getResources().getDrawable(mIconResId);
}
return null;
}
public MenuItem setEnabled(boolean enabled) {
mEnabled = enabled;
returnthis;
}
publicboolean isEnabled() {
return mEnabled;
}
// No-op operations. We use no-ops to allow inflation from menu XML.
publicint getGroupId() {
return 0;
}
public View getActionView() {
return null;
}
public MenuItem setIntent(Intent intent) {
// Noop
returnthis;
}
public Intent getIntent() {
return null;
}
public MenuItem setShortcut(char c, char c1) {
// Noop
returnthis;
}
public MenuItem setNumericShortcut(char c) {
// Noop
returnthis;
}
publicchar getNumericShortcut() {
return 0;
}
public MenuItem setAlphabeticShortcut(char c) {
// Noop
returnthis;
}
publicchar getAlphabeticShortcut() {
return 0;
}
public MenuItem setCheckable(boolean b) {
// Noop
returnthis;
}
publicboolean isCheckable() {
return false;
}
public MenuItem setChecked(boolean b) {
// Noop
returnthis;
}
publicboolean isChecked() {
return false;
}
public MenuItem setVisible(boolean b) {
// Noop
returnthis;
}
publicboolean isVisible() {
return true;
}
publicboolean hasSubMenu() {
return false;
}
public SubMenu getSubMenu() {
return null;
}
public MenuItem setOnMenuItemClickListener(
OnMenuItemClickListener onMenuItemClickListener) {
// Noop
returnthis;
}
public ContextMenu.ContextMenuInfo getMenuInfo() {
return null;
}
publicvoid setShowAsAction(int i) {
// Noop
}
public MenuItem setActionView(View view) {
// Noop
returnthis;
}
public MenuItem setActionView(int i) {
// Noop
returnthis;
}
}